@doki-land/live2d 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/l2d.umd.js +1 -1
- package/dist/l2d.umd.js.map +1 -1
- package/lib/cubism2.d.ts +178 -178
- package/lib/cubism2.min.js +1 -1
- package/package.json +6 -5
- package/readme.md +18 -18
- package/src/fs/index.ts +88 -88
- package/src/icons/icons.ts +38 -38
- package/src/icons/style.css +37 -37
- package/src/index.ts +5 -7
- package/src/types/Live2dOptions.ts +55 -55
- package/src/types/ModelOptions.ts +39 -39
- package/src/types/index.ts +2 -2
- package/dist/l2d.esm.js +0 -39429
- package/dist/l2d.esm.js.map +0 -1
package/dist/l2d.umd.js
CHANGED
|
@@ -1204,5 +1204,5 @@ void main(void)\r
|
|
|
1204
1204
|
[Details] render texture count : {1}, mask count : {2}`,t-r,this._renderTextureCount,t);for(let D=0;D<x;D++){const k=this._clippingContextListForMask[A++];k._layoutChannelNo=0,k._layoutBounds.x=0,k._layoutBounds.y=0,k._layoutBounds.width=1,k._layoutBounds.height=1,k._bufferIndex=0}}}}getColorBuffer(){return this._maskColorBuffers}getClippingContextListForDraw(){return this._clippingContextListForDraw}getClippingMaskCount(){return this._clippingContextListForMask.length}setClippingMaskBufferSize(t){this._clippingMaskBufferSize=t}getClippingMaskBufferSize(){return this._clippingMaskBufferSize}getRenderTextureCount(){return this._renderTextureCount}}class S1{constructor(t,r){this.frameNo=t,this.textures=r}}class P1{constructor(t,r,i){this._isUsing=!1,this._owner=t,this._clippingIdList=r,this._clippingIdCount=i,this._allClippedDrawRect=new mu,this._layoutBounds=new mu,this._clippedDrawableIndexList=[],this._matrixForMask=new mi,this._matrixForDraw=new mi,this._bufferIndex=0}release(){const t=this;t._layoutBounds=void 0,t._allClippedDrawRect=void 0,t._clippedDrawableIndexList=void 0}addClippedDrawable(t){this._clippedDrawableIndexList.push(t)}getClippingManager(){return this._owner}setGl(t){this._owner.setGL(t)}}class $1{setGlEnable(t,r){r?this.gl.enable(t):this.gl.disable(t)}setGlEnableVertexAttribArray(t,r){r?this.gl.enableVertexAttribArray(t):this.gl.disableVertexAttribArray(t)}save(){if(this.gl==null){Zi(`'gl' is null. WebGLRenderingContext is required.
|
|
1205
1205
|
Please call 'CubimRenderer_WebGL.startUp' function.`);return}this._lastArrayBufferBinding=this.gl.getParameter(this.gl.ARRAY_BUFFER_BINDING),this._lastArrayBufferBinding=this.gl.getParameter(this.gl.ELEMENT_ARRAY_BUFFER_BINDING),this._lastProgram=this.gl.getParameter(this.gl.CURRENT_PROGRAM),this._lastActiveTexture=this.gl.getParameter(this.gl.ACTIVE_TEXTURE),this.gl.activeTexture(this.gl.TEXTURE1),this._lastTexture1Binding2D=this.gl.getParameter(this.gl.TEXTURE_BINDING_2D),this.gl.activeTexture(this.gl.TEXTURE0),this._lastTexture0Binding2D=this.gl.getParameter(this.gl.TEXTURE_BINDING_2D),this._lastVertexAttribArrayEnabled[0]=this.gl.getVertexAttrib(0,this.gl.VERTEX_ATTRIB_ARRAY_ENABLED),this._lastVertexAttribArrayEnabled[1]=this.gl.getVertexAttrib(1,this.gl.VERTEX_ATTRIB_ARRAY_ENABLED),this._lastVertexAttribArrayEnabled[2]=this.gl.getVertexAttrib(2,this.gl.VERTEX_ATTRIB_ARRAY_ENABLED),this._lastVertexAttribArrayEnabled[3]=this.gl.getVertexAttrib(3,this.gl.VERTEX_ATTRIB_ARRAY_ENABLED),this._lastScissorTest=this.gl.isEnabled(this.gl.SCISSOR_TEST),this._lastStencilTest=this.gl.isEnabled(this.gl.STENCIL_TEST),this._lastDepthTest=this.gl.isEnabled(this.gl.DEPTH_TEST),this._lastCullFace=this.gl.isEnabled(this.gl.CULL_FACE),this._lastBlend=this.gl.isEnabled(this.gl.BLEND),this._lastFrontFace=this.gl.getParameter(this.gl.FRONT_FACE),this._lastColorMask=this.gl.getParameter(this.gl.COLOR_WRITEMASK),this._lastBlending[0]=this.gl.getParameter(this.gl.BLEND_SRC_RGB),this._lastBlending[1]=this.gl.getParameter(this.gl.BLEND_DST_RGB),this._lastBlending[2]=this.gl.getParameter(this.gl.BLEND_SRC_ALPHA),this._lastBlending[3]=this.gl.getParameter(this.gl.BLEND_DST_ALPHA),this._lastFBO=this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING),this._lastViewport=this.gl.getParameter(this.gl.VIEWPORT)}restore(){if(this.gl==null){Zi(`'gl' is null. WebGLRenderingContext is required.
|
|
1206
1206
|
Please call 'CubimRenderer_WebGL.startUp' function.`);return}this.gl.useProgram(this._lastProgram),this.setGlEnableVertexAttribArray(0,this._lastVertexAttribArrayEnabled[0]),this.setGlEnableVertexAttribArray(1,this._lastVertexAttribArrayEnabled[1]),this.setGlEnableVertexAttribArray(2,this._lastVertexAttribArrayEnabled[2]),this.setGlEnableVertexAttribArray(3,this._lastVertexAttribArrayEnabled[3]),this.setGlEnable(this.gl.SCISSOR_TEST,this._lastScissorTest),this.setGlEnable(this.gl.STENCIL_TEST,this._lastStencilTest),this.setGlEnable(this.gl.DEPTH_TEST,this._lastDepthTest),this.setGlEnable(this.gl.CULL_FACE,this._lastCullFace),this.setGlEnable(this.gl.BLEND,this._lastBlend),this.gl.frontFace(this._lastFrontFace),this.gl.colorMask(this._lastColorMask[0],this._lastColorMask[1],this._lastColorMask[2],this._lastColorMask[3]),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._lastArrayBufferBinding),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._lastElementArrayBufferBinding),this.gl.activeTexture(this.gl.TEXTURE1),this.gl.bindTexture(this.gl.TEXTURE_2D,this._lastTexture1Binding2D),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this._lastTexture0Binding2D),this.gl.activeTexture(this._lastActiveTexture),this.gl.blendFuncSeparate(this._lastBlending[0],this._lastBlending[1],this._lastBlending[2],this._lastBlending[3])}setGl(t){this.gl=t}constructor(){this._lastVertexAttribArrayEnabled=new Array(4),this._lastColorMask=new Array(4),this._lastBlending=new Array(4),this._lastViewport=new Array(4)}}class xn{static getInstance(){return Zs==null&&(Zs=new xn),Zs}static deleteInstance(){Zs&&(Zs.release(),Zs=void 0)}constructor(){this._shaderSets=[]}release(){this.releaseShaderProgram()}setupShaderProgram(t,r,i,n,o,h,f,A,T,C,x,M,D,k,U){D||Zi("NoPremultipliedAlpha is not allowed"),this._shaderSets.length==0&&this.generateShaders();let G,X,J,Z;const it=t.getClippingContextBufferForMask();if(it!=null){const Q=this._shaderSets[0];this.gl.useProgram(Q.shaderProgram),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,r),this.gl.uniform1i(Q.samplerTexture0Location,0),f.vertex==null&&(f.vertex=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,f.vertex),this.gl.bufferData(this.gl.ARRAY_BUFFER,n,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(Q.attributePositionLocation),this.gl.vertexAttribPointer(Q.attributePositionLocation,2,this.gl.FLOAT,!1,0,0),f.uv==null&&(f.uv=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,f.uv),this.gl.bufferData(this.gl.ARRAY_BUFFER,h,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(Q.attributeTexCoordLocation),this.gl.vertexAttribPointer(Q.attributeTexCoordLocation,2,this.gl.FLOAT,!1,0,0);const _t=it._layoutChannelNo,et=it.getClippingManager().getChannelFlagAsColor(_t);this.gl.uniform4f(Q.uniformChannelFlagLocation,et.R,et.G,et.B,et.A),this.gl.uniformMatrix4fv(Q.uniformClipMatrixLocation,!1,it._matrixForMask.getArray());const ft=it._layoutBounds;this.gl.uniform4f(Q.uniformBaseColorLocation,ft.x*2-1,ft.y*2-1,ft.getRight()*2-1,ft.getBottom()*2-1),this.gl.uniform4f(Q.uniformMultiplyColorLocation,x.R,x.G,x.B,x.A),this.gl.uniform4f(Q.uniformScreenColorLocation,M.R,M.G,M.B,M.A),G=this.gl.ZERO,X=this.gl.ONE_MINUS_SRC_COLOR,J=this.gl.ZERO,Z=this.gl.ONE_MINUS_SRC_ALPHA}else{const Q=t.getClippingContextBufferForDraw(),et=Q!=null?U?2:1:0;let ft;switch(T){case gs.CubismBlendMode_Normal:default:ft=this._shaderSets[1+et],G=this.gl.ONE,X=this.gl.ONE_MINUS_SRC_ALPHA,J=this.gl.ONE,Z=this.gl.ONE_MINUS_SRC_ALPHA;break;case gs.CubismBlendMode_Additive:ft=this._shaderSets[4+et],G=this.gl.ONE,X=this.gl.ONE,J=this.gl.ZERO,Z=this.gl.ONE;break;case gs.CubismBlendMode_Multiplicative:ft=this._shaderSets[7+et],G=this.gl.DST_COLOR,X=this.gl.ONE_MINUS_SRC_ALPHA,J=this.gl.ZERO,Z=this.gl.ONE;break}if(this.gl.useProgram(ft.shaderProgram),f.vertex==null&&(f.vertex=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,f.vertex),this.gl.bufferData(this.gl.ARRAY_BUFFER,n,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(ft.attributePositionLocation),this.gl.vertexAttribPointer(ft.attributePositionLocation,2,this.gl.FLOAT,!1,0,0),f.uv==null&&(f.uv=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,f.uv),this.gl.bufferData(this.gl.ARRAY_BUFFER,h,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(ft.attributeTexCoordLocation),this.gl.vertexAttribPointer(ft.attributeTexCoordLocation,2,this.gl.FLOAT,!1,0,0),Q!=null){this.gl.activeTexture(this.gl.TEXTURE1);const wt=Q.getClippingManager().getColorBuffer()[t.getClippingContextBufferForDraw()._bufferIndex];this.gl.bindTexture(this.gl.TEXTURE_2D,wt),this.gl.uniform1i(ft.samplerTexture1Location,1),this.gl.uniformMatrix4fv(ft.uniformClipMatrixLocation,!1,Q._matrixForDraw.getArray());const Rt=Q._layoutChannelNo,It=Q.getClippingManager().getChannelFlagAsColor(Rt);this.gl.uniform4f(ft.uniformChannelFlagLocation,It.R,It.G,It.B,It.A)}this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,r),this.gl.uniform1i(ft.samplerTexture0Location,0),this.gl.uniformMatrix4fv(ft.uniformMatrixLocation,!1,k.getArray()),this.gl.uniform4f(ft.uniformBaseColorLocation,C.R,C.G,C.B,C.A),this.gl.uniform4f(ft.uniformMultiplyColorLocation,x.R,x.G,x.B,x.A),this.gl.uniform4f(ft.uniformScreenColorLocation,M.R,M.G,M.B,M.A)}f.index==null&&(f.index=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,f.index),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,o,this.gl.DYNAMIC_DRAW),this.gl.blendFuncSeparate(G,X,J,Z)}releaseShaderProgram(){for(let t=0;t<this._shaderSets.length;t++)this.gl.deleteProgram(this._shaderSets[t].shaderProgram),this._shaderSets[t].shaderProgram=0;this._shaderSets=[]}generateShaders(){for(let t=0;t<C1;t++)this._shaderSets.push({});this._shaderSets[0].shaderProgram=this.loadShaderProgram(M1,R1),this._shaderSets[1].shaderProgram=this.loadShaderProgram(I1,D1),this._shaderSets[2].shaderProgram=this.loadShaderProgram(t2,F1),this._shaderSets[3].shaderProgram=this.loadShaderProgram(t2,L1),this._shaderSets[4].shaderProgram=this._shaderSets[1].shaderProgram,this._shaderSets[5].shaderProgram=this._shaderSets[2].shaderProgram,this._shaderSets[6].shaderProgram=this._shaderSets[3].shaderProgram,this._shaderSets[7].shaderProgram=this._shaderSets[1].shaderProgram,this._shaderSets[8].shaderProgram=this._shaderSets[2].shaderProgram,this._shaderSets[9].shaderProgram=this._shaderSets[3].shaderProgram,this._shaderSets[0].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[0].shaderProgram,"a_position"),this._shaderSets[0].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[0].shaderProgram,"a_texCoord"),this._shaderSets[0].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"s_texture0"),this._shaderSets[0].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_clipMatrix"),this._shaderSets[0].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_channelFlag"),this._shaderSets[0].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_baseColor"),this._shaderSets[0].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_multiplyColor"),this._shaderSets[0].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[0].shaderProgram,"u_screenColor"),this._shaderSets[1].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[1].shaderProgram,"a_position"),this._shaderSets[1].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[1].shaderProgram,"a_texCoord"),this._shaderSets[1].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"s_texture0"),this._shaderSets[1].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"u_matrix"),this._shaderSets[1].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"u_baseColor"),this._shaderSets[1].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"u_multiplyColor"),this._shaderSets[1].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[1].shaderProgram,"u_screenColor"),this._shaderSets[2].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[2].shaderProgram,"a_position"),this._shaderSets[2].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[2].shaderProgram,"a_texCoord"),this._shaderSets[2].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"s_texture0"),this._shaderSets[2].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"s_texture1"),this._shaderSets[2].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_matrix"),this._shaderSets[2].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_clipMatrix"),this._shaderSets[2].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_channelFlag"),this._shaderSets[2].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_baseColor"),this._shaderSets[2].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_multiplyColor"),this._shaderSets[2].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[2].shaderProgram,"u_screenColor"),this._shaderSets[3].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[3].shaderProgram,"a_position"),this._shaderSets[3].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[3].shaderProgram,"a_texCoord"),this._shaderSets[3].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"s_texture0"),this._shaderSets[3].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"s_texture1"),this._shaderSets[3].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_matrix"),this._shaderSets[3].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_clipMatrix"),this._shaderSets[3].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_channelFlag"),this._shaderSets[3].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_baseColor"),this._shaderSets[3].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_multiplyColor"),this._shaderSets[3].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[3].shaderProgram,"u_screenColor"),this._shaderSets[4].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[4].shaderProgram,"a_position"),this._shaderSets[4].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[4].shaderProgram,"a_texCoord"),this._shaderSets[4].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"s_texture0"),this._shaderSets[4].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"u_matrix"),this._shaderSets[4].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"u_baseColor"),this._shaderSets[4].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"u_multiplyColor"),this._shaderSets[4].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[4].shaderProgram,"u_screenColor"),this._shaderSets[5].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[5].shaderProgram,"a_position"),this._shaderSets[5].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[5].shaderProgram,"a_texCoord"),this._shaderSets[5].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"s_texture0"),this._shaderSets[5].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"s_texture1"),this._shaderSets[5].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_matrix"),this._shaderSets[5].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_clipMatrix"),this._shaderSets[5].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_channelFlag"),this._shaderSets[5].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_baseColor"),this._shaderSets[5].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_multiplyColor"),this._shaderSets[5].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[5].shaderProgram,"u_screenColor"),this._shaderSets[6].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[6].shaderProgram,"a_position"),this._shaderSets[6].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[6].shaderProgram,"a_texCoord"),this._shaderSets[6].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"s_texture0"),this._shaderSets[6].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"s_texture1"),this._shaderSets[6].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_matrix"),this._shaderSets[6].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_clipMatrix"),this._shaderSets[6].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_channelFlag"),this._shaderSets[6].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_baseColor"),this._shaderSets[6].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_multiplyColor"),this._shaderSets[6].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[6].shaderProgram,"u_screenColor"),this._shaderSets[7].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[7].shaderProgram,"a_position"),this._shaderSets[7].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[7].shaderProgram,"a_texCoord"),this._shaderSets[7].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"s_texture0"),this._shaderSets[7].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"u_matrix"),this._shaderSets[7].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"u_baseColor"),this._shaderSets[7].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"u_multiplyColor"),this._shaderSets[7].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[7].shaderProgram,"u_screenColor"),this._shaderSets[8].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[8].shaderProgram,"a_position"),this._shaderSets[8].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[8].shaderProgram,"a_texCoord"),this._shaderSets[8].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"s_texture0"),this._shaderSets[8].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"s_texture1"),this._shaderSets[8].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_matrix"),this._shaderSets[8].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_clipMatrix"),this._shaderSets[8].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_channelFlag"),this._shaderSets[8].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_baseColor"),this._shaderSets[8].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_multiplyColor"),this._shaderSets[8].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[8].shaderProgram,"u_screenColor"),this._shaderSets[9].attributePositionLocation=this.gl.getAttribLocation(this._shaderSets[9].shaderProgram,"a_position"),this._shaderSets[9].attributeTexCoordLocation=this.gl.getAttribLocation(this._shaderSets[9].shaderProgram,"a_texCoord"),this._shaderSets[9].samplerTexture0Location=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"s_texture0"),this._shaderSets[9].samplerTexture1Location=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"s_texture1"),this._shaderSets[9].uniformMatrixLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_matrix"),this._shaderSets[9].uniformClipMatrixLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_clipMatrix"),this._shaderSets[9].uniformChannelFlagLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_channelFlag"),this._shaderSets[9].uniformBaseColorLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_baseColor"),this._shaderSets[9].uniformMultiplyColorLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_multiplyColor"),this._shaderSets[9].uniformScreenColorLocation=this.gl.getUniformLocation(this._shaderSets[9].shaderProgram,"u_screenColor")}loadShaderProgram(t,r){const i=this.gl.createProgram(),n=this.compileShaderSource(this.gl.VERTEX_SHADER,t);if(!n)return Zi("Vertex shader compile error!"),0;const o=this.compileShaderSource(this.gl.FRAGMENT_SHADER,r);return o?(this.gl.attachShader(i,n),this.gl.attachShader(i,o),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?(this.gl.deleteShader(n),this.gl.deleteShader(o),i):(Zi("Failed to link program: {0}",i),this.gl.deleteShader(n),this.gl.deleteShader(o),i&&this.gl.deleteProgram(i),0)):(Zi("Vertex shader compile error!"),0)}compileShaderSource(t,r){const i=r,n=this.gl.createShader(t);if(this.gl.shaderSource(n,i),this.gl.compileShader(n),!n){const h=this.gl.getShaderInfoLog(n);Zi("Shader compile log: {0} ",h)}return this.gl.getShaderParameter(n,this.gl.COMPILE_STATUS)?n:(this.gl.deleteShader(n),null)}setGl(t){this.gl=t}}const M1="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",R1="precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}",I1="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",t2="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",D1="precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;uniform vec4 u_multiplyColor;uniform vec4 u_screenColor;void main(){ vec4 texColor = texture2D(s_texture0, v_texCoord); texColor.rgb = texColor.rgb * u_multiplyColor.rgb; texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb); vec4 color = texColor * u_baseColor; gl_FragColor = vec4(color.rgb, color.a);}",F1="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_multiplyColor;uniform vec4 u_screenColor;void main(){ vec4 texColor = texture2D(s_texture0, v_texCoord); texColor.rgb = texColor.rgb * u_multiplyColor.rgb; texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb); vec4 col_formask = texColor * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}",L1="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;uniform vec4 u_multiplyColor;uniform vec4 u_screenColor;void main(){ vec4 texColor = texture2D(s_texture0, v_texCoord); texColor.rgb = texColor.rgb * u_multiplyColor.rgb; texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb); vec4 col_formask = texColor * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * (1.0 - maskVal); gl_FragColor = col_formask;}";class e2 extends cu{initialize(t,r=1){t.isUsingMasking()&&(this._clippingManager=new Jd,this._clippingManager.initialize(t,t.getDrawableCount(),t.getDrawableMasks(),t.getDrawableMaskCounts(),r));for(let i=t.getDrawableCount()-1;i>=0;i--)this._sortedDrawableIndexList[i]=0;super.initialize(t)}bindTexture(t,r){this._textures[t]=r}getBindedTextures(){return this._textures}setClippingMaskBufferSize(t){if(!this._model.isUsingMasking())return;const r=this._clippingManager.getRenderTextureCount();this._clippingManager.release(),this._clippingManager=new Jd,this._clippingManager.setClippingMaskBufferSize(t),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts(),r)}getClippingMaskBufferSize(){return this._model.isUsingMasking()?this._clippingManager.getClippingMaskBufferSize():-1}getRenderTextureCount(){return this._model.isUsingMasking()?this._clippingManager.getRenderTextureCount():-1}constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._rendererProfile=new $1,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}release(){var t,r,i;const n=this;this._clippingManager.release(),n._clippingManager=void 0,(t=this.gl)==null||t.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,(r=this.gl)==null||r.deleteBuffer(this._bufferData.uv),this._bufferData.uv=null,(i=this.gl)==null||i.deleteBuffer(this._bufferData.index),this._bufferData.index=null,n._bufferData=void 0,n._textures=void 0}doDrawModel(){if(this.gl==null){Zi(`'gl' is null. WebGLRenderingContext is required.
|
|
1207
|
-
Please call 'CubimRenderer_WebGL.startUp' function.`);return}this._clippingManager!=null&&(this.preDraw(),this._clippingManager.setupClippingContext(this.getModel(),this)),this.preDraw();const t=this.getModel().getDrawableCount(),r=this.getModel().getDrawableRenderOrders();for(let i=0;i<t;++i){const n=r[i];this._sortedDrawableIndexList[n]=i}for(let i=0;i<t;++i){const n=this._sortedDrawableIndexList[i];if(!this.getModel().getDrawableDynamicFlagIsVisible(n))continue;const o=this._clippingManager!=null?this._clippingManager.getClippingContextListForDraw()[n]:null;if(o!=null&&this.isUsingHighPrecisionMask()){o._isUsing&&(this.gl.viewport(0,0,this._clippingManager.getClippingMaskBufferSize(),this._clippingManager.getClippingMaskBufferSize()),this.preDraw(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,o.getClippingManager().getMaskRenderTexture()[o._bufferIndex]),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT));{const h=o._clippingIdCount;for(let f=0;f<h;f++){const A=o._clippingIdList[f];this._model.getDrawableDynamicFlagVertexPositionsDidChange(A)&&(this.setIsCulling(this._model.getDrawableCulling(A)!=!1),this.setClippingContextBufferForMask(o),this.drawMesh(this.getModel().getDrawableTextureIndex(A),this.getModel().getDrawableVertexIndexCount(A),this.getModel().getDrawableVertexCount(A),this.getModel().getDrawableVertexIndices(A),this.getModel().getDrawableVertices(A),this.getModel().getDrawableVertexUvs(A),this.getModel().getMultiplyColor(A),this.getModel().getScreenColor(A),this.getModel().getDrawableOpacity(A),gs.CubismBlendMode_Normal,!1))}}this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,ka),this.setClippingContextBufferForMask(null),this.gl.viewport(ms[0],ms[1],ms[2],ms[3]),this.preDraw()}this.setClippingContextBufferForDraw(o),this.setIsCulling(this.getModel().getDrawableCulling(n)),this.drawMesh(this.getModel().getDrawableTextureIndex(n),this.getModel().getDrawableVertexIndexCount(n),this.getModel().getDrawableVertexCount(n),this.getModel().getDrawableVertexIndices(n),this.getModel().getDrawableVertices(n),this.getModel().getDrawableVertexUvs(n),this.getModel().getMultiplyColor(n),this.getModel().getScreenColor(n),this.getModel().getDrawableOpacity(n),this.getModel().getDrawableBlendMode(n),this.getModel().getDrawableInvertedMaskBit(n))}}drawMesh(t,r,i,n,o,h,f,A,T,C,x){this.isCulling()?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this.gl.frontFace(this.gl.CCW);const M=this.getModelColor();this.getClippingContextBufferForMask()==null&&(M.A*=T,this.isPremultipliedAlpha()&&(M.R*=M.A,M.G*=M.A,M.B*=M.A));let D=null;this._textures[t]!=null&&(D=this._textures[t]),xn.getInstance().setupShaderProgram(this,D,i,o,n,h,this._bufferData,T,C,M,f,A,this.isPremultipliedAlpha(),this.getMvpMatrix(),x),this.gl.drawElements(this.gl.TRIANGLES,r,this.gl.UNSIGNED_SHORT,0),this.gl.useProgram(null),this.setClippingContextBufferForDraw(null),this.setClippingContextBufferForMask(null)}saveProfile(){this._rendererProfile.save()}restoreProfile(){this._rendererProfile.restore()}static doStaticRelease(){xn.deleteInstance()}setRenderState(t,r){ka=t,ms=r}preDraw(){if(this.firstDraw&&(this.firstDraw=!1),this.gl.disable(this.gl.SCISSOR_TEST),this.gl.disable(this.gl.STENCIL_TEST),this.gl.disable(this.gl.DEPTH_TEST),this.gl.frontFace(this.gl.CW),this.gl.enable(this.gl.BLEND),this.gl.colorMask(!0,!0,!0,!0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null),this.getAnisotropy()>0&&this._extension)for(const t of Object.entries(this._textures))this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.texParameterf(this.gl.TEXTURE_2D,this._extension.TEXTURE_MAX_ANISOTROPY_EXT,this.getAnisotropy())}setClippingContextBufferForMask(t){this._clippingContextBufferForMask=t}getClippingContextBufferForMask(){return this._clippingContextBufferForMask}setClippingContextBufferForDraw(t){this._clippingContextBufferForDraw=t}getClippingContextBufferForDraw(){return this._clippingContextBufferForDraw}startUp(t){this.gl=t,this._clippingManager&&this._clippingManager.setGL(t),xn.getInstance().setGl(t),this._rendererProfile.setGl(t),this._extension=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")}}cu.staticRelease=()=>{e2.doStaticRelease()};const r2=new mi;class B1 extends Pd{constructor(t,r,i){super(),bt(this,"settings"),bt(this,"coreModel"),bt(this,"motionManager"),bt(this,"lipSync",!0),bt(this,"breath",gu.create()),bt(this,"eyeBlink"),bt(this,"userData"),bt(this,"renderer",new e2),bt(this,"idParamAngleX",_1),bt(this,"idParamAngleY",g1),bt(this,"idParamAngleZ",m1),bt(this,"idParamEyeBallX",y1),bt(this,"idParamEyeBallY",v1),bt(this,"idParamBodyAngleX",b1),bt(this,"idParamBreath",A1),bt(this,"idParamMouthForm",x1),bt(this,"pixelsPerUnit",1),bt(this,"centeringTransform",new nr),this.coreModel=t,this.settings=r,this.motionManager=new p1(r,i),this.init()}init(){var t;super.init(),(t=this.settings.getEyeBlinkParameters())!=null&&t.length&&(this.eyeBlink=w1.create(this.settings)),this.breath.setParameters([new yo(this.idParamAngleX,0,15,6.5345,.5),new yo(this.idParamAngleY,0,8,3.5345,.5),new yo(this.idParamAngleZ,0,10,5.5345,.5),new yo(this.idParamBodyAngleX,0,4,15.5345,.5),new yo(this.idParamBreath,0,.5,3.2345,.5)]),this.renderer.initialize(this.coreModel),this.renderer.setIsPremultipliedAlpha(!0)}getSize(){return[this.coreModel.getModel().canvasinfo.CanvasWidth,this.coreModel.getModel().canvasinfo.CanvasHeight]}getLayout(){const t={};if(this.settings.layout)for(const[r,i]of Object.entries(this.settings.layout)){const n=r.charAt(0).toLowerCase()+r.slice(1);t[n]=i}return t}setupLayout(){super.setupLayout(),this.pixelsPerUnit=this.coreModel.getModel().canvasinfo.PixelsPerUnit,this.centeringTransform.scale(this.pixelsPerUnit,this.pixelsPerUnit).translate(this.originalWidth/2,this.originalHeight/2)}updateWebGLContext(t,r){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(t),this.renderer._clippingManager._currentFrameNo=r,this.renderer._clippingManager._maskTexture=void 0,xn.getInstance()._shaderSets=[]}bindTexture(t,r){this.renderer.bindTexture(t,r)}getHitAreaDefs(){var t,r;return(r=(t=this.settings.hitAreas)==null?void 0:t.map(i=>({id:i.Id,name:i.Name,index:this.coreModel.getDrawableIndex(i.Id)})))!=null?r:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(t){return this.coreModel.getDrawableIndex(t)}getDrawableVertices(t){if(typeof t=="string"&&(t=this.coreModel.getDrawableIndex(t),t===-1))throw new TypeError("Unable to find drawable ID: "+t);const r=this.coreModel.getDrawableVertices(t).slice();for(let i=0;i<r.length;i+=2)r[i]=r[i]*this.pixelsPerUnit+this.originalWidth/2,r[i+1]=-r[i+1]*this.pixelsPerUnit+this.originalHeight/2;return r}updateTransform(t){this.drawingMatrix.copyFrom(this.centeringTransform).prepend(this.localTransform).prepend(t)}update(t,r){var i,n,o,h;super.update(t,r),t/=1e3,r/=1e3;const f=this.coreModel;this.emit("beforeMotionUpdate");const A=this.motionManager.update(this.coreModel,r);if(this.emit("afterMotionUpdate"),f.saveParameters(),(i=this.motionManager.expressionManager)==null||i.update(f,r),A||(n=this.eyeBlink)==null||n.updateParameters(f,t),this.updateFocus(),this.updateNaturalMovements(t*1e3,r*1e3),this.lipSync&&this.motionManager.currentAudio){let T=this.motionManager.mouthSync(),C=0;const x=1,M=1.2;T>0&&(C=.4),T=pn(T*M,C,x);for(let D=0;D<this.motionManager.lipSyncIds.length;++D)f.addParameterValueById(this.motionManager.lipSyncIds[D],T,.8)}(o=this.physics)==null||o.evaluate(f,t),(h=this.pose)==null||h.updateParameters(f,t),this.emit("beforeModelUpdate"),f.update(),f.loadParameters()}updateFocus(){this.coreModel.addParameterValueById(this.idParamEyeBallX,this.focusController.x),this.coreModel.addParameterValueById(this.idParamEyeBallY,this.focusController.y),this.coreModel.addParameterValueById(this.idParamAngleX,this.focusController.x*30),this.coreModel.addParameterValueById(this.idParamAngleY,this.focusController.y*30),this.coreModel.addParameterValueById(this.idParamAngleZ,this.focusController.x*this.focusController.y*-30),this.coreModel.addParameterValueById(this.idParamBodyAngleX,this.focusController.x*10)}updateFacialEmotion(t){this.coreModel.addParameterValueById(this.idParamMouthForm,t)}updateNaturalMovements(t,r){var i;(i=this.breath)==null||i.updateParameters(this.coreModel,t/1e3)}draw(t){const r=this.drawingMatrix,i=r2.getArray();i[0]=r.a,i[1]=r.b,i[4]=-r.c,i[5]=-r.d,i[12]=r.tx,i[13]=r.ty,this.renderer.setMvpMatrix(r2),this.renderer.setRenderState(t.getParameter(t.FRAMEBUFFER_BINDING),this.viewport),this.renderer.drawModel()}destroy(){super.destroy(),this.renderer.release(),this.coreModel.release(),this.renderer=void 0,this.coreModel=void 0}}class i2{constructor(t){this.groups=t.Groups,this.hitAreas=t.HitAreas,this.layout=t.Layout,this.moc=t.FileReferences.Moc,this.expressions=t.FileReferences.Expressions,this.motions=t.FileReferences.Motions,this.textures=t.FileReferences.Textures,this.physics=t.FileReferences.Physics,this.pose=t.FileReferences.Pose}getEyeBlinkParameters(){var t,r;return(r=(t=this.groups)==null?void 0:t.find(i=>i.Name==="EyeBlink"))==null?void 0:r.Ids}getLipSyncParameters(){var t,r;return(r=(t=this.groups)==null?void 0:t.find(i=>i.Name==="LipSync"))==null?void 0:r.Ids}}class bn extends Ra{constructor(t){if(super(t),bt(this,"moc"),bt(this,"textures"),!bn.isValidJSON(t))throw new TypeError("Invalid JSON.");Object.assign(this,new i2(t))}static isValidJSON(t){var r;return!!(t!=null&&t.FileReferences)&&typeof t.FileReferences.Moc=="string"&&((r=t.FileReferences.Textures)==null?void 0:r.length)>0&&t.FileReferences.Textures.every(i=>typeof i=="string")}replaceFiles(t){if(super.replaceFiles(t),this.motions)for(const[r,i]of Object.entries(this.motions))for(let n=0;n<i.length;n++)i[n].File=t(i[n].File,`motions.${r}[${n}].File`),i[n].Sound!==void 0&&(i[n].Sound=t(i[n].Sound,`motions.${r}[${n}].Sound`));if(this.expressions)for(let r=0;r<this.expressions.length;r++)this.expressions[r].File=t(this.expressions[r].File,`expressions[${r}].File`)}}Em(bn,[i2]);let Oa,s2=20;function k1(){return go.isStarted()?Promise.resolve():(Oa??(Oa=new Promise((s,t)=>{function r(){try{O1(),s()}catch(i){if(s2--,s2<0){const n=new Error("Failed to start up Cubism 4 framework.");n.cause=i,t(n);return}setTimeout(r,10)}}r()})),Oa)}function O1(s){s=Object.assign({logFunction:console.log,loggingLevel:yn.LogLevel_Verbose},s),go.startUp(s),go.initialize()}const N1=.001,n2=.5;class yu{static create(t){const r=new yu;typeof t.FadeInTime=="number"&&(r._fadeTimeSeconds=t.FadeInTime,r._fadeTimeSeconds<=0&&(r._fadeTimeSeconds=n2));const i=t.Groups,n=i.length;for(let o=0;o<n;++o){const h=i[o],f=h.length;let A=0;for(let T=0;T<f;++T){const C=h[T],x=new Na;x.partId=C.Id;const M=C.Link;if(M){const D=M.length;for(let k=0;k<D;++k){const U=new Na;U.partId=M[k],x.link.push(U)}}r._partGroups.push(x),++A}r._partGroupCounts.push(A)}return r}updateParameters(t,r){t!=this._lastModel&&this.reset(t),this._lastModel=t,r<0&&(r=0);let i=0;for(let n=0;n<this._partGroupCounts.length;n++){const o=this._partGroupCounts[n];this.doFade(t,r,i,o),i+=o}this.copyPartOpacities(t)}reset(t){let r=0;for(let i=0;i<this._partGroupCounts.length;++i){const n=this._partGroupCounts[i];for(let o=r;o<r+n;++o){this._partGroups[o].initialize(t);const h=this._partGroups[o].partIndex,f=this._partGroups[o].parameterIndex;if(!(h<0)){t.setPartOpacityByIndex(h,o==r?1:0),t.setParameterValueByIndex(f,o==r?1:0);for(let A=0;A<this._partGroups[o].link.length;++A)this._partGroups[o].link[A].initialize(t)}}r+=n}}copyPartOpacities(t){for(let r=0;r<this._partGroups.length;++r){const i=this._partGroups[r];if(i.link.length==0)continue;const n=this._partGroups[r].partIndex,o=t.getPartOpacityByIndex(n);for(let h=0;h<i.link.length;++h){const A=i.link[h].partIndex;A<0||t.setPartOpacityByIndex(A,o)}}}doFade(t,r,i,n){let o=-1,h=1;const f=.5,A=.15;for(let T=i;T<i+n;++T){const C=this._partGroups[T].partIndex,x=this._partGroups[T].parameterIndex;if(t.getParameterValueByIndex(x)>N1){if(o>=0)break;o=T,h=t.getPartOpacityByIndex(C),h+=r/this._fadeTimeSeconds,h>1&&(h=1)}}o<0&&(o=0,h=1);for(let T=i;T<i+n;++T){const C=this._partGroups[T].partIndex;if(o==T)t.setPartOpacityByIndex(C,h);else{let x=t.getPartOpacityByIndex(C),M;h<f?M=h*(f-1)/f+1:M=(1-h)*f/(1-f),(1-M)*(1-h)>A&&(M=1-A/(1-h)),x>M&&(x=M),t.setPartOpacityByIndex(C,x)}}}constructor(){this._fadeTimeSeconds=n2,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class Na{constructor(t){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],t!=null&&this.assignment(t)}assignment(t){return this.partId=t.partId,this.link=t.link.map(r=>r.clone()),this}initialize(t){this.parameterIndex=t.getParameterIndex(this.partId),this.partIndex=t.getPartIndex(this.partId),t.setParameterValueByIndex(this.parameterIndex,1)}clone(){const t=new Na;return t.partId=this.partId,t.parameterIndex=this.parameterIndex,t.partIndex=this.partIndex,t.link=this.link.map(r=>r.clone()),t}}class o2{constructor(t=!1,r=new ai){this.isOverwritten=t,this.Color=r}}class a2{constructor(t=!1,r=new ai){this.isOverwritten=t,this.Color=r}}class U1{constructor(t=!1,r=!1){this.isOverwritten=t,this.isCulling=r}}class G1{update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getPixelsPerUnit(){return this._model==null?0:this._model.canvasinfo.PixelsPerUnit}getCanvasWidth(){return this._model==null?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return this._model==null?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const t=this._model.parameters.count,r=this._savedParameters.length;for(let i=0;i<t;++i)i<r?this._savedParameters[i]=this._parameterValues[i]:this._savedParameters.push(this._parameterValues[i])}getMultiplyColor(t){return this.getOverwriteFlagForModelMultiplyColors()||this.getOverwriteFlagForDrawableMultiplyColors(t)?this._userMultiplyColors[t].Color:this.getDrawableMultiplyColor(t)}getScreenColor(t){return this.getOverwriteFlagForModelScreenColors()||this.getOverwriteFlagForDrawableScreenColors(t)?this._userScreenColors[t].Color:this.getDrawableScreenColor(t)}setMultiplyColorByTextureColor(t,r){this.setMultiplyColorByRGBA(t,r.R,r.G,r.B,r.A)}setMultiplyColorByRGBA(t,r,i,n,o=1){this._userMultiplyColors[t].Color.R=r,this._userMultiplyColors[t].Color.G=i,this._userMultiplyColors[t].Color.B=n,this._userMultiplyColors[t].Color.A=o}setScreenColorByTextureColor(t,r){this.setScreenColorByRGBA(t,r.R,r.G,r.B,r.A)}setScreenColorByRGBA(t,r,i,n,o=1){this._userScreenColors[t].Color.R=r,this._userScreenColors[t].Color.G=i,this._userScreenColors[t].Color.B=n,this._userScreenColors[t].Color.A=o}getPartMultiplyColor(t){return this._userPartMultiplyColors[t].Color}getPartScreenColor(t){return this._userPartScreenColors[t].Color}setPartColor(t,r,i,n,o,h,f){if(h[t].Color.R=r,h[t].Color.G=i,h[t].Color.B=n,h[t].Color.A=o,h[t].isOverwritten)for(let A=0;A<this._partChildDrawables[t].length;++A){const T=this._partChildDrawables[t][A];f[T].Color.R=r,f[T].Color.G=i,f[T].Color.B=n,f[T].Color.A=o}}setPartMultiplyColorByTextureColor(t,r){this.setPartMultiplyColorByRGBA(t,r.R,r.G,r.B,r.A)}setPartMultiplyColorByRGBA(t,r,i,n,o){this.setPartColor(t,r,i,n,o,this._userPartMultiplyColors,this._userMultiplyColors)}setPartScreenColorByTextureColor(t,r){this.setPartScreenColorByRGBA(t,r.R,r.G,r.B,r.A)}setPartScreenColorByRGBA(t,r,i,n,o){this.setPartColor(t,r,i,n,o,this._userPartScreenColors,this._userScreenColors)}getOverwriteFlagForModelMultiplyColors(){return this._isOverwrittenModelMultiplyColors}getOverwriteFlagForModelScreenColors(){return this._isOverwrittenModelScreenColors}setOverwriteFlagForModelMultiplyColors(t){this._isOverwrittenModelMultiplyColors=t}setOverwriteFlagForModelScreenColors(t){this._isOverwrittenModelScreenColors=t}getOverwriteFlagForDrawableMultiplyColors(t){return this._userMultiplyColors[t].isOverwritten}getOverwriteFlagForDrawableScreenColors(t){return this._userScreenColors[t].isOverwritten}setOverwriteFlagForDrawableMultiplyColors(t,r){this._userMultiplyColors[t].isOverwritten=r}setOverwriteFlagForDrawableScreenColors(t,r){this._userScreenColors[t].isOverwritten=r}getOverwriteColorForPartMultiplyColors(t){return this._userPartMultiplyColors[t].isOverwritten}getOverwriteColorForPartScreenColors(t){return this._userPartScreenColors[t].isOverwritten}setOverwriteColorForPartColors(t,r,i,n){i[t].isOverwritten=r;for(let o=0;o<this._partChildDrawables[t].length;++o){const h=this._partChildDrawables[t][o];n[h].isOverwritten=r,r&&(n[h].Color.R=i[t].Color.R,n[h].Color.G=i[t].Color.G,n[h].Color.B=i[t].Color.B,n[h].Color.A=i[t].Color.A)}}setOverwriteColorForPartMultiplyColors(t,r){this._userPartMultiplyColors[t].isOverwritten=r,this.setOverwriteColorForPartColors(t,r,this._userPartMultiplyColors,this._userMultiplyColors)}setOverwriteColorForPartScreenColors(t,r){this._userPartScreenColors[t].isOverwritten=r,this.setOverwriteColorForPartColors(t,r,this._userPartScreenColors,this._userScreenColors)}getDrawableCulling(t){if(this.getOverwriteFlagForModelCullings()||this.getOverwriteFlagForDrawableCullings(t))return this._userCullings[t].isCulling;const r=this._model.drawables.constantFlags;return!Live2DCubismCore.Utils.hasIsDoubleSidedBit(r[t])}setDrawableCulling(t,r){this._userCullings[t].isCulling=r}getOverwriteFlagForModelCullings(){return this._isOverwrittenCullings}setOverwriteFlagForModelCullings(t){this._isOverwrittenCullings=t}getOverwriteFlagForDrawableCullings(t){return this._userCullings[t].isOverwritten}setOverwriteFlagForDrawableCullings(t,r){this._userCullings[t].isOverwritten=r}getModelOapcity(){return this._modelOpacity}setModelOapcity(t){this._modelOpacity=t}getModel(){return this._model}getPartIndex(t){let r;const i=this._model.parts.count;for(r=0;r<i;++r)if(t==this._partIds[r])return r;return t in this._notExistPartId?this._notExistPartId[t]:(r=i+this._notExistPartId.length,this._notExistPartId[t]=r,this._notExistPartOpacities[r]=0,r)}getPartId(t){return this._model.parts.ids[t]}getPartCount(){return this._model.parts.count}setPartOpacityByIndex(t,r){if(t in this._notExistPartOpacities){this._notExistPartOpacities[t]=r;return}vn(0<=t&&t<this.getPartCount()),this._partOpacities[t]=r}setPartOpacityById(t,r){const i=this.getPartIndex(t);i<0||this.setPartOpacityByIndex(i,r)}getPartOpacityByIndex(t){return t in this._notExistPartOpacities?this._notExistPartOpacities[t]:(vn(0<=t&&t<this.getPartCount()),this._partOpacities[t])}getPartOpacityById(t){const r=this.getPartIndex(t);return r<0?0:this.getPartOpacityByIndex(r)}getParameterIndex(t){let r;const i=this._model.parameters.count;for(r=0;r<i;++r)if(t==this._parameterIds[r])return r;return t in this._notExistParameterId?this._notExistParameterId[t]:(r=this._model.parameters.count+Object.keys(this._notExistParameterId).length,this._notExistParameterId[t]=r,this._notExistParameterValues[r]=0,r)}getParameterCount(){return this._model.parameters.count}getParameterType(t){return this._model.parameters.types[t]}getParameterMaximumValue(t){return this._model.parameters.maximumValues[t]}getParameterMinimumValue(t){return this._model.parameters.minimumValues[t]}getParameterDefaultValue(t){return this._model.parameters.defaultValues[t]}getParameterValueByIndex(t){return t in this._notExistParameterValues?this._notExistParameterValues[t]:(vn(0<=t&&t<this.getParameterCount()),this._parameterValues[t])}getParameterValueById(t){const r=this.getParameterIndex(t);return this.getParameterValueByIndex(r)}setParameterValueByIndex(t,r,i=1){if(t in this._notExistParameterValues){this._notExistParameterValues[t]=i==1?r:this._notExistParameterValues[t]*(1-i)+r*i;return}vn(0<=t&&t<this.getParameterCount()),this._model.parameters.maximumValues[t]<r&&(r=this._model.parameters.maximumValues[t]),this._model.parameters.minimumValues[t]>r&&(r=this._model.parameters.minimumValues[t]),this._parameterValues[t]=i==1?r:this._parameterValues[t]=this._parameterValues[t]*(1-i)+r*i}setParameterValueById(t,r,i=1){const n=this.getParameterIndex(t);this.setParameterValueByIndex(n,r,i)}addParameterValueByIndex(t,r,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)+r*i)}addParameterValueById(t,r,i=1){const n=this.getParameterIndex(t);this.addParameterValueByIndex(n,r,i)}multiplyParameterValueById(t,r,i=1){const n=this.getParameterIndex(t);this.multiplyParameterValueByIndex(n,r,i)}multiplyParameterValueByIndex(t,r,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)*(1+(r-1)*i))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(t){const r=this._model.drawables.count;for(let i=0;i<r;++i)if(this._drawableIds[i]==t)return i;return-1}getDrawableCount(){return this._model.drawables.count}getDrawableId(t){return this._model.drawables.ids[t]}getDrawableRenderOrders(){return this._model.drawables.renderOrders}getDrawableTextureIndices(t){return this.getDrawableTextureIndex(t)}getDrawableTextureIndex(t){return this._model.drawables.textureIndices[t]}getDrawableDynamicFlagVertexPositionsDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(r[t])}getDrawableVertexIndexCount(t){return this._model.drawables.indexCounts[t]}getDrawableVertexCount(t){return this._model.drawables.vertexCounts[t]}getDrawableVertices(t){return this.getDrawableVertexPositions(t)}getDrawableVertexIndices(t){return this._model.drawables.indices[t]}getDrawableVertexPositions(t){return this._model.drawables.vertexPositions[t]}getDrawableVertexUvs(t){return this._model.drawables.vertexUvs[t]}getDrawableOpacity(t){return this._model.drawables.opacities[t]}getDrawableMultiplyColor(t){const r=this._model.drawables.multiplyColors,i=t*4,n=new ai;return n.R=r[i],n.G=r[i+1],n.B=r[i+2],n.A=r[i+3],n}getDrawableScreenColor(t){const r=this._model.drawables.screenColors,i=t*4,n=new ai;return n.R=r[i],n.G=r[i+1],n.B=r[i+2],n.A=r[i+3],n}getDrawableParentPartIndex(t){return this._model.drawables.parentPartIndices[t]}getDrawableBlendMode(t){const r=this._model.drawables.constantFlags;return Live2DCubismCore.Utils.hasBlendAdditiveBit(r[t])?gs.CubismBlendMode_Additive:Live2DCubismCore.Utils.hasBlendMultiplicativeBit(r[t])?gs.CubismBlendMode_Multiplicative:gs.CubismBlendMode_Normal}getDrawableInvertedMaskBit(t){const r=this._model.drawables.constantFlags;return Live2DCubismCore.Utils.hasIsInvertedMaskBit(r[t])}getDrawableMasks(){return this._model.drawables.masks}getDrawableMaskCounts(){return this._model.drawables.maskCounts}isUsingMasking(){for(let t=0;t<this._model.drawables.count;++t)if(!(this._model.drawables.maskCounts[t]<=0))return!0;return!1}getDrawableDynamicFlagIsVisible(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasIsVisibleBit(r[t])}getDrawableDynamicFlagVisibilityDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(r[t])}getDrawableDynamicFlagOpacityDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasOpacityDidChangeBit(r[t])}getDrawableDynamicFlagRenderOrderDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(r[t])}getDrawableDynamicFlagBlendColorDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasBlendColorDidChangeBit(r[t])}loadParameters(){let t=this._model.parameters.count;const r=this._savedParameters.length;t>r&&(t=r);for(let i=0;i<t;++i)this._parameterValues[i]=this._savedParameters[i]}initialize(){this._parameterValues=this._model.parameters.values,this._partOpacities=this._model.parts.opacities,this._parameterMaximumValues=this._model.parameters.maximumValues,this._parameterMinimumValues=this._model.parameters.minimumValues;{const r=this._model.parameters.ids,i=this._model.parameters.count;for(let n=0;n<i;++n)this._parameterIds.push(r[n])}const t=this._model.parts.count;{const r=this._model.parts.ids;for(let i=0;i<t;++i)this._partIds.push(r[i])}{const r=this._model.drawables.ids,i=this._model.drawables.count,n=new U1(!1,!1);for(let o=0;o<t;++o){const h=new ai(1,1,1,1),f=new ai(0,0,0,1),A=new a2(!1,h),T=new a2(!1,f);this._userPartMultiplyColors.push(A),this._userPartScreenColors.push(T),this._partChildDrawables.push([])}for(let o=0;o<i;++o){const h=new ai(1,1,1,1),f=new ai(0,0,0,1),A=new o2(!1,h),T=new o2(!1,f);this._drawableIds.push(r[o]),this._userMultiplyColors.push(A),this._userScreenColors.push(T),this._userCullings.push(n);const C=this.getDrawableParentPartIndex(o);C>=0&&this._partChildDrawables[C].push(o)}}}constructor(t){this._model=t,this._savedParameters=[],this._parameterIds=[],this._drawableIds=[],this._partIds=[],this._isOverwrittenModelMultiplyColors=!1,this._isOverwrittenModelScreenColors=!1,this._isOverwrittenCullings=!1,this._modelOpacity=1,this._userMultiplyColors=[],this._userScreenColors=[],this._userCullings=[],this._userPartMultiplyColors=[],this._userPartScreenColors=[],this._partChildDrawables=[],this._notExistPartId={},this._notExistParameterId={},this._notExistParameterValues={},this._notExistPartOpacities={},this.initialize()}release(){this._model.release(),this._model=void 0}}class vu{static create(t,r){if(r&&!this.hasMocConsistency(t))throw new Error("Inconsistent MOC3.");const i=Live2DCubismCore.Moc.fromArrayBuffer(t);if(i){const n=new vu(i);return n._mocVersion=Live2DCubismCore.Version.csmGetMocVersion(i,t),n}throw new Error("Failed to CubismMoc.create().")}createModel(){let t;const r=Live2DCubismCore.Model.fromMoc(this._moc);if(r)return t=new G1(r),++this._modelCount,t;throw new Error("Unknown error")}deleteModel(t){t!=null&&--this._modelCount}constructor(t){this._moc=t,this._modelCount=0,this._mocVersion=0}release(){this._moc._release(),this._moc=void 0}getLatestMocVersion(){return Live2DCubismCore.Version.csmGetLatestMocVersion()}getMocVersion(){return this._mocVersion}static hasMocConsistency(t){return Live2DCubismCore.Moc.prototype.hasMocConsistency(t)===1}}var xu=(s=>(s[s.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",s))(xu||{}),Qs=(s=>(s[s.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",s[s.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",s[s.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",s))(Qs||{});class V1{constructor(){this.initialPosition=new Ie(0,0),this.position=new Ie(0,0),this.lastPosition=new Ie(0,0),this.lastGravity=new Ie(0,0),this.force=new Ie(0,0),this.velocity=new Ie(0,0)}}class z1{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class X1{constructor(){this.source={}}}class W1{constructor(){this.destination={},this.translationScale=new Ie(0,0)}}class H1{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new Ie(0,0),this.wind=new Ie(0,0),this.fps=0}}class Y1{constructor(t){this._json=t}release(){this._json=void 0}getGravity(){const t=new Ie(0,0);return t.x=this._json.Meta.EffectiveForces.Gravity.X,t.y=this._json.Meta.EffectiveForces.Gravity.Y,t}getWind(){const t=new Ie(0,0);return t.x=this._json.Meta.EffectiveForces.Wind.X,t.y=this._json.Meta.EffectiveForces.Wind.Y,t}getFps(){return this._json.Meta.Fps||0}getSubRigCount(){return this._json.Meta.PhysicsSettingCount}getTotalInputCount(){return this._json.Meta.TotalInputCount}getTotalOutputCount(){return this._json.Meta.TotalOutputCount}getVertexCount(){return this._json.Meta.VertexCount}getNormalizationPositionMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Default}getNormalizationAngleMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Default}getInputCount(t){return this._json.PhysicsSettings[t].Input.length}getInputWeight(t,r){return this._json.PhysicsSettings[t].Input[r].Weight}getInputReflect(t,r){return this._json.PhysicsSettings[t].Input[r].Reflect}getInputType(t,r){return this._json.PhysicsSettings[t].Input[r].Type}getInputSourceId(t,r){return this._json.PhysicsSettings[t].Input[r].Source.Id}getOutputCount(t){return this._json.PhysicsSettings[t].Output.length}getOutputVertexIndex(t,r){return this._json.PhysicsSettings[t].Output[r].VertexIndex}getOutputAngleScale(t,r){return this._json.PhysicsSettings[t].Output[r].Scale}getOutputWeight(t,r){return this._json.PhysicsSettings[t].Output[r].Weight}getOutputDestinationId(t,r){return this._json.PhysicsSettings[t].Output[r].Destination.Id}getOutputType(t,r){return this._json.PhysicsSettings[t].Output[r].Type}getOutputReflect(t,r){return this._json.PhysicsSettings[t].Output[r].Reflect}getParticleCount(t){return this._json.PhysicsSettings[t].Vertices.length}getParticleMobility(t,r){return this._json.PhysicsSettings[t].Vertices[r].Mobility}getParticleDelay(t,r){return this._json.PhysicsSettings[t].Vertices[r].Delay}getParticleAcceleration(t,r){return this._json.PhysicsSettings[t].Vertices[r].Acceleration}getParticleRadius(t,r){return this._json.PhysicsSettings[t].Vertices[r].Radius}getParticlePosition(t,r){const i=new Ie(0,0);return i.x=this._json.PhysicsSettings[t].Vertices[r].Position.X,i.y=this._json.PhysicsSettings[t].Vertices[r].Position.Y,i}}const h2="X",l2="Y",u2="Angle",j1=5,bu=100,c2=.001,q1=5;class Au{static create(t){const r=new Au;return r.parse(t),r._physicsRig.gravity.y=0,r}static delete(t){t!=null&&t.release()}parse(t){this._physicsRig=new H1;const r=new Y1(t);this._physicsRig.gravity=r.getGravity(),this._physicsRig.wind=r.getWind(),this._physicsRig.subRigCount=r.getSubRigCount(),this._physicsRig.fps=r.getFps(),this._currentRigOutputs=[],this._previousRigOutputs=[];let i=0,n=0,o=0;for(let h=0;h<this._physicsRig.subRigCount;++h){const f=new z1;f.normalizationPosition.minimum=r.getNormalizationPositionMinimumValue(h),f.normalizationPosition.maximum=r.getNormalizationPositionMaximumValue(h),f.normalizationPosition.defalut=r.getNormalizationPositionDefaultValue(h),f.normalizationAngle.minimum=r.getNormalizationAngleMinimumValue(h),f.normalizationAngle.maximum=r.getNormalizationAngleMaximumValue(h),f.normalizationAngle.defalut=r.getNormalizationAngleDefaultValue(h),f.inputCount=r.getInputCount(h),f.baseInputIndex=i,i+=f.inputCount;for(let C=0;C<f.inputCount;++C){const x=new X1;switch(x.sourceParameterIndex=-1,x.weight=r.getInputWeight(h,C),x.reflect=r.getInputReflect(h,C),r.getInputType(h,C)){case h2:x.type=Qs.CubismPhysicsSource_X,x.getNormalizedParameterValue=Q1;break;case l2:x.type=Qs.CubismPhysicsSource_Y,x.getNormalizedParameterValue=K1;break;case u2:x.type=Qs.CubismPhysicsSource_Angle,x.getNormalizedParameterValue=J1;break}x.source.targetType=xu.CubismPhysicsTargetType_Parameter,x.source.id=r.getInputSourceId(h,C),this._physicsRig.inputs.push(x)}f.outputCount=r.getOutputCount(h),f.baseOutputIndex=n;const A=new f2,T=new f2;for(let C=0;C<f.outputCount;++C){A.outputs[C]=0,T.outputs[C]=0;let x=this._physicsRig.outputs[n+C];switch(x||(x=new W1,this._physicsRig.outputs[n+C]=x),x.destinationParameterIndex=-1,x.vertexIndex=r.getOutputVertexIndex(h,C),x.angleScale=r.getOutputAngleScale(h,C),x.weight=r.getOutputWeight(h,C),x.destination.targetType=xu.CubismPhysicsTargetType_Parameter,x.destination.id=r.getOutputDestinationId(h,C),r.getOutputType(h,C)){case h2:x.type=Qs.CubismPhysicsSource_X,x.getValue=ty,x.getScale=ny;break;case l2:x.type=Qs.CubismPhysicsSource_Y,x.getValue=ey,x.getScale=oy;break;case u2:x.type=Qs.CubismPhysicsSource_Angle,x.getValue=ry,x.getScale=ay;break}x.reflect=r.getOutputReflect(h,C)}this._currentRigOutputs.push(A),this._previousRigOutputs.push(T),n+=f.outputCount,f.particleCount=r.getParticleCount(h),f.baseParticleIndex=o,o+=f.particleCount;for(let C=0;C<f.particleCount;++C){const x=new V1;x.mobility=r.getParticleMobility(h,C),x.delay=r.getParticleDelay(h,C),x.acceleration=r.getParticleAcceleration(h,C),x.radius=r.getParticleRadius(h,C),x.position=r.getParticlePosition(h,C),this._physicsRig.particles.push(x)}this._physicsRig.settings.push(f)}this.initialize(),r.release()}stabilization(t){var r,i,n,o;let h,f,A,T;const C=new Ie;let x,M,D,k,U,G,X,J;U=t.getModel().parameters.values,G=t.getModel().parameters.maximumValues,X=t.getModel().parameters.minimumValues,J=t.getModel().parameters.defaultValues,((i=(r=this._parameterCaches)==null?void 0:r.length)!=null?i:0)<t.getParameterCount()&&(this._parameterCaches=new Float32Array(t.getParameterCount())),((o=(n=this._parameterInputCaches)==null?void 0:n.length)!=null?o:0)<t.getParameterCount()&&(this._parameterInputCaches=new Float32Array(t.getParameterCount()));for(let Z=0;Z<t.getParameterCount();++Z)this._parameterCaches[Z]=U[Z],this._parameterInputCaches[Z]=U[Z];for(let Z=0;Z<this._physicsRig.subRigCount;++Z){h={angle:0},C.x=0,C.y=0,x=this._physicsRig.settings[Z],M=this._physicsRig.inputs.slice(x.baseInputIndex),D=this._physicsRig.outputs.slice(x.baseOutputIndex),k=this._physicsRig.particles.slice(x.baseParticleIndex);for(let it=0;it<x.inputCount;++it)f=M[it].weight/bu,M[it].sourceParameterIndex==-1&&(M[it].sourceParameterIndex=t.getParameterIndex(M[it].source.id)),M[it].getNormalizedParameterValue(C,h,U[M[it].sourceParameterIndex],X[M[it].sourceParameterIndex],G[M[it].sourceParameterIndex],J[M[it].sourceParameterIndex],x.normalizationPosition,x.normalizationAngle,M[it].reflect,f),this._parameterCaches[M[it].sourceParameterIndex]=U[M[it].sourceParameterIndex];A=Ke.degreesToRadian(-h.angle),C.x=C.x*Ke.cos(A)-C.y*Ke.sin(A),C.y=C.x*Ke.sin(A)+C.y*Ke.cos(A),ly(k,x.particleCount,C,h.angle,this._options.wind,c2*x.normalizationPosition.maximum);for(let it=0;it<x.outputCount;++it){const Q=D[it].vertexIndex;if(D[it].destinationParameterIndex==-1&&(D[it].destinationParameterIndex=t.getParameterIndex(D[it].destination.id)),Q<1||Q>=x.particleCount)continue;let _t=new Ie;_t=k[Q].position.substract(k[Q-1].position),T=D[it].getValue(_t,k,Q,D[it].reflect,this._options.gravity),this._currentRigOutputs[Z].outputs[it]=T,this._previousRigOutputs[Z].outputs[it]=T;const et=D[it].destinationParameterIndex,ft=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(U.subarray(et))):U.slice(et);wu(ft,X[et],G[et],T,D[it]);for(let wt=et,Rt=0;wt<this._parameterCaches.length;wt++,Rt++)U[wt]=this._parameterCaches[wt]=ft[Rt]}}}evaluate(t,r){var i,n,o,h;let f,A,T,C;const x=new Ie;let M,D,k,U;if(0>=r)return;let G,X,J,Z,it;if(this._currentRemainTime+=r,this._currentRemainTime>q1&&(this._currentRemainTime=0),G=t.getModel().parameters.values,X=t.getModel().parameters.maximumValues,J=t.getModel().parameters.minimumValues,Z=t.getModel().parameters.defaultValues,((n=(i=this._parameterCaches)==null?void 0:i.length)!=null?n:0)<t.getParameterCount()&&(this._parameterCaches=new Float32Array(t.getParameterCount())),((h=(o=this._parameterInputCaches)==null?void 0:o.length)!=null?h:0)<t.getParameterCount()){this._parameterInputCaches=new Float32Array(t.getParameterCount());for(let _t=0;_t<t.getParameterCount();++_t)this._parameterInputCaches[_t]=G[_t]}for(this._physicsRig.fps>0?it=1/this._physicsRig.fps:it=r;this._currentRemainTime>=it;){for(let et=0;et<this._physicsRig.subRigCount;++et){M=this._physicsRig.settings[et],k=this._physicsRig.outputs.slice(M.baseOutputIndex);for(let ft=0;ft<M.outputCount;++ft)this._previousRigOutputs[et].outputs[ft]=this._currentRigOutputs[et].outputs[ft]}const _t=it/this._currentRemainTime;for(let et=0;et<t.getParameterCount();++et)this._parameterCaches[et]=this._parameterInputCaches[et]*(1-_t)+G[et]*_t,this._parameterInputCaches[et]=this._parameterCaches[et];for(let et=0;et<this._physicsRig.subRigCount;++et){f={angle:0},x.x=0,x.y=0,M=this._physicsRig.settings[et],D=this._physicsRig.inputs.slice(M.baseInputIndex),k=this._physicsRig.outputs.slice(M.baseOutputIndex),U=this._physicsRig.particles.slice(M.baseParticleIndex);for(let ft=0;ft<M.inputCount;++ft)A=D[ft].weight/bu,D[ft].sourceParameterIndex==-1&&(D[ft].sourceParameterIndex=t.getParameterIndex(D[ft].source.id)),D[ft].getNormalizedParameterValue(x,f,this._parameterCaches[D[ft].sourceParameterIndex],J[D[ft].sourceParameterIndex],X[D[ft].sourceParameterIndex],Z[D[ft].sourceParameterIndex],M.normalizationPosition,M.normalizationAngle,D[ft].reflect,A);T=Ke.degreesToRadian(-f.angle),x.x=x.x*Ke.cos(T)-x.y*Ke.sin(T),x.y=x.x*Ke.sin(T)+x.y*Ke.cos(T),hy(U,M.particleCount,x,f.angle,this._options.wind,c2*M.normalizationPosition.maximum,it,j1);for(let ft=0;ft<M.outputCount;++ft){const wt=k[ft].vertexIndex;if(k[ft].destinationParameterIndex==-1&&(k[ft].destinationParameterIndex=t.getParameterIndex(k[ft].destination.id)),wt<1||wt>=M.particleCount)continue;const Rt=new Ie;Rt.x=U[wt].position.x-U[wt-1].position.x,Rt.y=U[wt].position.y-U[wt-1].position.y,C=k[ft].getValue(Rt,U,wt,k[ft].reflect,this._options.gravity),this._currentRigOutputs[et].outputs[ft]=C;const It=k[ft].destinationParameterIndex,pt=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(this._parameterCaches.subarray(It))):this._parameterCaches.slice(It);wu(pt,J[It],X[It],C,k[ft]);for(let xt=It,Ct=0;xt<this._parameterCaches.length;xt++,Ct++)this._parameterCaches[xt]=pt[Ct]}}this._currentRemainTime-=it}const Q=this._currentRemainTime/it;this.interpolate(t,Q)}interpolate(t,r){let i,n,o,h,f;o=t.getModel().parameters.values,h=t.getModel().parameters.maximumValues,f=t.getModel().parameters.minimumValues;for(let A=0;A<this._physicsRig.subRigCount;++A){n=this._physicsRig.settings[A],i=this._physicsRig.outputs.slice(n.baseOutputIndex);for(let T=0;T<n.outputCount;++T){if(i[T].destinationParameterIndex==-1)continue;const C=i[T].destinationParameterIndex,x=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(o.subarray(C))):o.slice(C);wu(x,f[C],h[C],this._previousRigOutputs[A].outputs[T]*(1-r)+this._currentRigOutputs[A].outputs[T]*r,i[T]);for(let M=C,D=0;M<o.length;M++,D++)o[M]=x[D]}}}setOptions(t){this._options=t}getOption(){return this._options}constructor(){this._options=new Z1,this._options.gravity.y=-1,this._options.gravity.x=0,this._options.wind.x=0,this._options.wind.y=0,this._currentRigOutputs=[],this._previousRigOutputs=[],this._currentRemainTime=0}release(){this._physicsRig=void 0}initialize(){let t,r,i;for(let n=0;n<this._physicsRig.subRigCount;++n){r=this._physicsRig.settings[n],t=this._physicsRig.particles.slice(r.baseParticleIndex),t[0].initialPosition=new Ie(0,0),t[0].lastPosition=new Ie(t[0].initialPosition.x,t[0].initialPosition.y),t[0].lastGravity=new Ie(0,-1),t[0].lastGravity.y*=-1,t[0].velocity=new Ie(0,0),t[0].force=new Ie(0,0);for(let o=1;o<r.particleCount;++o)i=new Ie(0,0),i.y=t[o].radius,t[o].initialPosition=new Ie(t[o-1].initialPosition.x+i.x,t[o-1].initialPosition.y+i.y),t[o].position=new Ie(t[o].initialPosition.x,t[o].initialPosition.y),t[o].lastPosition=new Ie(t[o].initialPosition.x,t[o].initialPosition.y),t[o].lastGravity=new Ie(0,-1),t[o].lastGravity.y*=-1,t[o].velocity=new Ie(0,0),t[o].force=new Ie(0,0)}}}class Z1{constructor(){this.gravity=new Ie(0,0),this.wind=new Ie(0,0)}}class f2{constructor(){this.outputs=[]}}function Q1(s,t,r,i,n,o,h,f,A,T){s.x+=Tu(r,i,n,o,h.minimum,h.maximum,h.defalut,A)*T}function K1(s,t,r,i,n,o,h,f,A,T){s.y+=Tu(r,i,n,o,h.minimum,h.maximum,h.defalut,A)*T}function J1(s,t,r,i,n,o,h,f,A,T){t.angle+=Tu(r,i,n,o,f.minimum,f.maximum,f.defalut,A)*T}function ty(s,t,r,i,n){let o=s.x;return i&&(o*=-1),o}function ey(s,t,r,i,n){let o=s.y;return i&&(o*=-1),o}function ry(s,t,r,i,n){let o;return r>=2?n=t[r-1].position.substract(t[r-2].position):n=n.multiplyByScaler(-1),o=Ke.directionToRadian(n,s),i&&(o*=-1),o}function iy(s,t){return Math.abs(Math.max(s,t)-Math.min(s,t))}function sy(s,t){return Math.min(s,t)+iy(s,t)/2}function ny(s,t){return s.x}function oy(s,t){return s.y}function ay(s,t){return t}function hy(s,t,r,i,n,o,h,f){let A,T,C,x,M=new Ie(0,0),D=new Ie(0,0),k=new Ie(0,0),U=new Ie(0,0);s[0].position=new Ie(r.x,r.y),A=Ke.degreesToRadian(i),x=Ke.radianToDirection(A),x.normalize();for(let G=1;G<t;++G)s[G].force=x.multiplyByScaler(s[G].acceleration).add(n),s[G].lastPosition=new Ie(s[G].position.x,s[G].position.y),T=s[G].delay*h*30,M=s[G].position.substract(s[G-1].position),C=Ke.directionToRadian(s[G].lastGravity,x)/f,M.x=Ke.cos(C)*M.x-M.y*Ke.sin(C),M.y=Ke.sin(C)*M.x+M.y*Ke.cos(C),s[G].position=s[G-1].position.add(M),D=s[G].velocity.multiplyByScaler(T),k=s[G].force.multiplyByScaler(T).multiplyByScaler(T),s[G].position=s[G].position.add(D).add(k),U=s[G].position.substract(s[G-1].position),U.normalize(),s[G].position=s[G-1].position.add(U.multiplyByScaler(s[G].radius)),Ke.abs(s[G].position.x)<o&&(s[G].position.x=0),T!=0&&(s[G].velocity=s[G].position.substract(s[G].lastPosition),s[G].velocity=s[G].velocity.divisionByScalar(T),s[G].velocity=s[G].velocity.multiplyByScaler(s[G].mobility)),s[G].force=new Ie(0,0),s[G].lastGravity=new Ie(x.x,x.y)}function ly(s,t,r,i,n,o){let h,f,A=new Ie(0,0);s[0].position=new Ie(r.x,r.y),h=Ke.degreesToRadian(i),f=Ke.radianToDirection(h),f.normalize();for(let T=1;T<t;++T)s[T].force=f.multiplyByScaler(s[T].acceleration).add(n),s[T].lastPosition=new Ie(s[T].position.x,s[T].position.y),s[T].velocity=new Ie(0,0),A=s[T].force,A.normalize(),A=A.multiplyByScaler(s[T].radius),s[T].position=s[T-1].position.add(A),Ke.abs(s[T].position.x)<o&&(s[T].position.x=0),s[T].force=new Ie(0,0),s[T].lastGravity=new Ie(f.x,f.y)}function wu(s,t,r,i,n){let o,h,f;o=n.getScale(n.translationScale,n.angleScale),h=i*o,h<t?(h<n.valueBelowMinimum&&(n.valueBelowMinimum=h),h=t):h>r&&(h>n.valueExceededMaximum&&(n.valueExceededMaximum=h),h=r),f=n.weight/bu,f>=1||(h=s[0]*(1-f)+h*f),s[0]=h}function Tu(s,t,r,i,n,o,h,f){let A=0;const T=Ke.max(r,t);T<s&&(s=T);const C=Ke.min(r,t);C>s&&(s=C);const x=Ke.min(n,o),M=Ke.max(n,o),D=h,k=sy(C,T),U=s-k;switch(Math.sign(U)){case 1:{const G=M-D,X=T-k;X!=0&&(A=U*(G/X),A+=D);break}case-1:{const G=x-D,X=C-k;X!=0&&(A=U*(G/X),A+=D);break}case 0:{A=D;break}}return f?A:A*-1}oi.registerRuntime({version:4,ready:k1,test(s){return s instanceof bn||bn.isValidJSON(s)},isValidMoc(s){if(s.byteLength<4)return!1;const t=new Int8Array(s,0,4);return String.fromCharCode(...t)==="MOC3"},createModelSettings(s){return new bn(s)},createCoreModel(s,t){const r=vu.create(s,!!(t!=null&&t.checkMocConsistency));try{const i=r.createModel();return i.__moc=r,i}catch(i){try{r.release()}catch{}throw i}},createInternalModel(s,t,r){const i=new B1(s,t,r),n=s;return n.__moc&&(i.__moc=n.__moc,delete n.__moc,i.once("destroy",uy)),i},createPhysics(s,t){return Au.create(t)},createPose(s,t){return yu.create(t)}});function uy(){var s;(s=this.__moc)==null||s.release()}async function cy(s){const{element_id:t="live2d-canvas",models:r,width:i=300,height:n=300,auto_fit:o=!0,auto_motion:h=!0,mouse_tracking:f=!0}=s;let A=fy(t,s);const T=new kl({view:A,width:i,height:n,backgroundAlpha:0,autoDensity:!0,antialias:!0,eventMode:"static",eventFeatures:{move:!0,globalMove:!0,click:!0,wheel:!0}}),C=await uu.from(r[0].model_url);if(T.stage.addChild(C),o){const x=Math.min(i/C.width,n/C.height);C.scale.set(x),C.x=(i-C.width*x)/2,C.y=(n-C.height*x)/2}return f&&dy(C,T.view),h&&await py(C),createIconPanel(C,A),C}function fy(s,t){let r=document.getElementById(s);return r||(r=document.createElement("canvas"),r.id=s,document.body.appendChild(r),r.style.display="none",r.style.position="fixed",r.style.display="block",r.style.position="absolute",r.style.bottom=`${t.spacing_y||0}px`,r.style[t.position==="left"?"left":"right"]=`${t.spacing_x||0}px`,r.style.zIndex="9999"),r}function dy(s,t){document.addEventListener("mousemove",r=>{var A;const i=t.getBoundingClientRect(),n=i.left+i.width/2,o=i.top+i.height/2,h=(r.clientX-n)/i.width,f=-(r.clientY-o)/i.height;s.internalModel&&((A=s.internalModel.focusController)==null||A.focus(h,f))}),t.addEventListener("click",()=>{var r;try{const i=(r=s.internalModel)==null?void 0:r.motionManager.definitions;if(i)if(i.tap_body)s.motion("tap_body");else if(i.tap)s.motion("tap");else{const n=Object.keys(i)[0];n&&s.motion(n)}}catch(i){console.warn("Failed to play tap animation:",i)}})}async function py(s){var t;try{const r=(t=s.internalModel)==null?void 0:t.motionManager.definitions;if(r)if(r.idle)await s.motion("idle");else if(r.tap_body)await s.motion("tap_body");else{const i=Object.keys(r)[0];i&&await s.motion(i)}}catch(r){console.warn("Failed to start idle animation:",r)}}async function _y(s,t){uu.registerTicker($r),be.add(sa)}qr.Live2DModel=uu,qr.MotionManager=fo,qr.PIXI=bm,qr.SoundManager=Mr,qr.createLive2D=cy,qr.initializeLive2D=_y,Object.defineProperty(qr,Symbol.toStringTag,{value:"Module"})});
|
|
1207
|
+
Please call 'CubimRenderer_WebGL.startUp' function.`);return}this._clippingManager!=null&&(this.preDraw(),this._clippingManager.setupClippingContext(this.getModel(),this)),this.preDraw();const t=this.getModel().getDrawableCount(),r=this.getModel().getDrawableRenderOrders();for(let i=0;i<t;++i){const n=r[i];this._sortedDrawableIndexList[n]=i}for(let i=0;i<t;++i){const n=this._sortedDrawableIndexList[i];if(!this.getModel().getDrawableDynamicFlagIsVisible(n))continue;const o=this._clippingManager!=null?this._clippingManager.getClippingContextListForDraw()[n]:null;if(o!=null&&this.isUsingHighPrecisionMask()){o._isUsing&&(this.gl.viewport(0,0,this._clippingManager.getClippingMaskBufferSize(),this._clippingManager.getClippingMaskBufferSize()),this.preDraw(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,o.getClippingManager().getMaskRenderTexture()[o._bufferIndex]),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT));{const h=o._clippingIdCount;for(let f=0;f<h;f++){const A=o._clippingIdList[f];this._model.getDrawableDynamicFlagVertexPositionsDidChange(A)&&(this.setIsCulling(this._model.getDrawableCulling(A)!=!1),this.setClippingContextBufferForMask(o),this.drawMesh(this.getModel().getDrawableTextureIndex(A),this.getModel().getDrawableVertexIndexCount(A),this.getModel().getDrawableVertexCount(A),this.getModel().getDrawableVertexIndices(A),this.getModel().getDrawableVertices(A),this.getModel().getDrawableVertexUvs(A),this.getModel().getMultiplyColor(A),this.getModel().getScreenColor(A),this.getModel().getDrawableOpacity(A),gs.CubismBlendMode_Normal,!1))}}this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,ka),this.setClippingContextBufferForMask(null),this.gl.viewport(ms[0],ms[1],ms[2],ms[3]),this.preDraw()}this.setClippingContextBufferForDraw(o),this.setIsCulling(this.getModel().getDrawableCulling(n)),this.drawMesh(this.getModel().getDrawableTextureIndex(n),this.getModel().getDrawableVertexIndexCount(n),this.getModel().getDrawableVertexCount(n),this.getModel().getDrawableVertexIndices(n),this.getModel().getDrawableVertices(n),this.getModel().getDrawableVertexUvs(n),this.getModel().getMultiplyColor(n),this.getModel().getScreenColor(n),this.getModel().getDrawableOpacity(n),this.getModel().getDrawableBlendMode(n),this.getModel().getDrawableInvertedMaskBit(n))}}drawMesh(t,r,i,n,o,h,f,A,T,C,x){this.isCulling()?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this.gl.frontFace(this.gl.CCW);const M=this.getModelColor();this.getClippingContextBufferForMask()==null&&(M.A*=T,this.isPremultipliedAlpha()&&(M.R*=M.A,M.G*=M.A,M.B*=M.A));let D=null;this._textures[t]!=null&&(D=this._textures[t]),xn.getInstance().setupShaderProgram(this,D,i,o,n,h,this._bufferData,T,C,M,f,A,this.isPremultipliedAlpha(),this.getMvpMatrix(),x),this.gl.drawElements(this.gl.TRIANGLES,r,this.gl.UNSIGNED_SHORT,0),this.gl.useProgram(null),this.setClippingContextBufferForDraw(null),this.setClippingContextBufferForMask(null)}saveProfile(){this._rendererProfile.save()}restoreProfile(){this._rendererProfile.restore()}static doStaticRelease(){xn.deleteInstance()}setRenderState(t,r){ka=t,ms=r}preDraw(){if(this.firstDraw&&(this.firstDraw=!1),this.gl.disable(this.gl.SCISSOR_TEST),this.gl.disable(this.gl.STENCIL_TEST),this.gl.disable(this.gl.DEPTH_TEST),this.gl.frontFace(this.gl.CW),this.gl.enable(this.gl.BLEND),this.gl.colorMask(!0,!0,!0,!0),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,null),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,null),this.getAnisotropy()>0&&this._extension)for(const t of Object.entries(this._textures))this.gl.bindTexture(this.gl.TEXTURE_2D,t),this.gl.texParameterf(this.gl.TEXTURE_2D,this._extension.TEXTURE_MAX_ANISOTROPY_EXT,this.getAnisotropy())}setClippingContextBufferForMask(t){this._clippingContextBufferForMask=t}getClippingContextBufferForMask(){return this._clippingContextBufferForMask}setClippingContextBufferForDraw(t){this._clippingContextBufferForDraw=t}getClippingContextBufferForDraw(){return this._clippingContextBufferForDraw}startUp(t){this.gl=t,this._clippingManager&&this._clippingManager.setGL(t),xn.getInstance().setGl(t),this._rendererProfile.setGl(t),this._extension=this.gl.getExtension("EXT_texture_filter_anisotropic")||this.gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this.gl.getExtension("MOZ_EXT_texture_filter_anisotropic")}}cu.staticRelease=()=>{e2.doStaticRelease()};const r2=new mi;class B1 extends Pd{constructor(t,r,i){super(),bt(this,"settings"),bt(this,"coreModel"),bt(this,"motionManager"),bt(this,"lipSync",!0),bt(this,"breath",gu.create()),bt(this,"eyeBlink"),bt(this,"userData"),bt(this,"renderer",new e2),bt(this,"idParamAngleX",_1),bt(this,"idParamAngleY",g1),bt(this,"idParamAngleZ",m1),bt(this,"idParamEyeBallX",y1),bt(this,"idParamEyeBallY",v1),bt(this,"idParamBodyAngleX",b1),bt(this,"idParamBreath",A1),bt(this,"idParamMouthForm",x1),bt(this,"pixelsPerUnit",1),bt(this,"centeringTransform",new nr),this.coreModel=t,this.settings=r,this.motionManager=new p1(r,i),this.init()}init(){var t;super.init(),(t=this.settings.getEyeBlinkParameters())!=null&&t.length&&(this.eyeBlink=w1.create(this.settings)),this.breath.setParameters([new yo(this.idParamAngleX,0,15,6.5345,.5),new yo(this.idParamAngleY,0,8,3.5345,.5),new yo(this.idParamAngleZ,0,10,5.5345,.5),new yo(this.idParamBodyAngleX,0,4,15.5345,.5),new yo(this.idParamBreath,0,.5,3.2345,.5)]),this.renderer.initialize(this.coreModel),this.renderer.setIsPremultipliedAlpha(!0)}getSize(){return[this.coreModel.getModel().canvasinfo.CanvasWidth,this.coreModel.getModel().canvasinfo.CanvasHeight]}getLayout(){const t={};if(this.settings.layout)for(const[r,i]of Object.entries(this.settings.layout)){const n=r.charAt(0).toLowerCase()+r.slice(1);t[n]=i}return t}setupLayout(){super.setupLayout(),this.pixelsPerUnit=this.coreModel.getModel().canvasinfo.PixelsPerUnit,this.centeringTransform.scale(this.pixelsPerUnit,this.pixelsPerUnit).translate(this.originalWidth/2,this.originalHeight/2)}updateWebGLContext(t,r){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(t),this.renderer._clippingManager._currentFrameNo=r,this.renderer._clippingManager._maskTexture=void 0,xn.getInstance()._shaderSets=[]}bindTexture(t,r){this.renderer.bindTexture(t,r)}getHitAreaDefs(){var t,r;return(r=(t=this.settings.hitAreas)==null?void 0:t.map(i=>({id:i.Id,name:i.Name,index:this.coreModel.getDrawableIndex(i.Id)})))!=null?r:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(t){return this.coreModel.getDrawableIndex(t)}getDrawableVertices(t){if(typeof t=="string"&&(t=this.coreModel.getDrawableIndex(t),t===-1))throw new TypeError("Unable to find drawable ID: "+t);const r=this.coreModel.getDrawableVertices(t).slice();for(let i=0;i<r.length;i+=2)r[i]=r[i]*this.pixelsPerUnit+this.originalWidth/2,r[i+1]=-r[i+1]*this.pixelsPerUnit+this.originalHeight/2;return r}updateTransform(t){this.drawingMatrix.copyFrom(this.centeringTransform).prepend(this.localTransform).prepend(t)}update(t,r){var i,n,o,h;super.update(t,r),t/=1e3,r/=1e3;const f=this.coreModel;this.emit("beforeMotionUpdate");const A=this.motionManager.update(this.coreModel,r);if(this.emit("afterMotionUpdate"),f.saveParameters(),(i=this.motionManager.expressionManager)==null||i.update(f,r),A||(n=this.eyeBlink)==null||n.updateParameters(f,t),this.updateFocus(),this.updateNaturalMovements(t*1e3,r*1e3),this.lipSync&&this.motionManager.currentAudio){let T=this.motionManager.mouthSync(),C=0;const x=1,M=1.2;T>0&&(C=.4),T=pn(T*M,C,x);for(let D=0;D<this.motionManager.lipSyncIds.length;++D)f.addParameterValueById(this.motionManager.lipSyncIds[D],T,.8)}(o=this.physics)==null||o.evaluate(f,t),(h=this.pose)==null||h.updateParameters(f,t),this.emit("beforeModelUpdate"),f.update(),f.loadParameters()}updateFocus(){this.coreModel.addParameterValueById(this.idParamEyeBallX,this.focusController.x),this.coreModel.addParameterValueById(this.idParamEyeBallY,this.focusController.y),this.coreModel.addParameterValueById(this.idParamAngleX,this.focusController.x*30),this.coreModel.addParameterValueById(this.idParamAngleY,this.focusController.y*30),this.coreModel.addParameterValueById(this.idParamAngleZ,this.focusController.x*this.focusController.y*-30),this.coreModel.addParameterValueById(this.idParamBodyAngleX,this.focusController.x*10)}updateFacialEmotion(t){this.coreModel.addParameterValueById(this.idParamMouthForm,t)}updateNaturalMovements(t,r){var i;(i=this.breath)==null||i.updateParameters(this.coreModel,t/1e3)}draw(t){const r=this.drawingMatrix,i=r2.getArray();i[0]=r.a,i[1]=r.b,i[4]=-r.c,i[5]=-r.d,i[12]=r.tx,i[13]=r.ty,this.renderer.setMvpMatrix(r2),this.renderer.setRenderState(t.getParameter(t.FRAMEBUFFER_BINDING),this.viewport),this.renderer.drawModel()}destroy(){super.destroy(),this.renderer.release(),this.coreModel.release(),this.renderer=void 0,this.coreModel=void 0}}class i2{constructor(t){this.groups=t.Groups,this.hitAreas=t.HitAreas,this.layout=t.Layout,this.moc=t.FileReferences.Moc,this.expressions=t.FileReferences.Expressions,this.motions=t.FileReferences.Motions,this.textures=t.FileReferences.Textures,this.physics=t.FileReferences.Physics,this.pose=t.FileReferences.Pose}getEyeBlinkParameters(){var t,r;return(r=(t=this.groups)==null?void 0:t.find(i=>i.Name==="EyeBlink"))==null?void 0:r.Ids}getLipSyncParameters(){var t,r;return(r=(t=this.groups)==null?void 0:t.find(i=>i.Name==="LipSync"))==null?void 0:r.Ids}}class bn extends Ra{constructor(t){if(super(t),bt(this,"moc"),bt(this,"textures"),!bn.isValidJSON(t))throw new TypeError("Invalid JSON.");Object.assign(this,new i2(t))}static isValidJSON(t){var r;return!!(t!=null&&t.FileReferences)&&typeof t.FileReferences.Moc=="string"&&((r=t.FileReferences.Textures)==null?void 0:r.length)>0&&t.FileReferences.Textures.every(i=>typeof i=="string")}replaceFiles(t){if(super.replaceFiles(t),this.motions)for(const[r,i]of Object.entries(this.motions))for(let n=0;n<i.length;n++)i[n].File=t(i[n].File,`motions.${r}[${n}].File`),i[n].Sound!==void 0&&(i[n].Sound=t(i[n].Sound,`motions.${r}[${n}].Sound`));if(this.expressions)for(let r=0;r<this.expressions.length;r++)this.expressions[r].File=t(this.expressions[r].File,`expressions[${r}].File`)}}Em(bn,[i2]);let Oa,s2=20;function k1(){return go.isStarted()?Promise.resolve():(Oa??(Oa=new Promise((s,t)=>{function r(){try{O1(),s()}catch(i){if(s2--,s2<0){const n=new Error("Failed to start up Cubism 4 framework.");n.cause=i,t(n);return}setTimeout(r,10)}}r()})),Oa)}function O1(s){s=Object.assign({logFunction:console.log,loggingLevel:yn.LogLevel_Verbose},s),go.startUp(s),go.initialize()}const N1=.001,n2=.5;class yu{static create(t){const r=new yu;typeof t.FadeInTime=="number"&&(r._fadeTimeSeconds=t.FadeInTime,r._fadeTimeSeconds<=0&&(r._fadeTimeSeconds=n2));const i=t.Groups,n=i.length;for(let o=0;o<n;++o){const h=i[o],f=h.length;let A=0;for(let T=0;T<f;++T){const C=h[T],x=new Na;x.partId=C.Id;const M=C.Link;if(M){const D=M.length;for(let k=0;k<D;++k){const U=new Na;U.partId=M[k],x.link.push(U)}}r._partGroups.push(x),++A}r._partGroupCounts.push(A)}return r}updateParameters(t,r){t!=this._lastModel&&this.reset(t),this._lastModel=t,r<0&&(r=0);let i=0;for(let n=0;n<this._partGroupCounts.length;n++){const o=this._partGroupCounts[n];this.doFade(t,r,i,o),i+=o}this.copyPartOpacities(t)}reset(t){let r=0;for(let i=0;i<this._partGroupCounts.length;++i){const n=this._partGroupCounts[i];for(let o=r;o<r+n;++o){this._partGroups[o].initialize(t);const h=this._partGroups[o].partIndex,f=this._partGroups[o].parameterIndex;if(!(h<0)){t.setPartOpacityByIndex(h,o==r?1:0),t.setParameterValueByIndex(f,o==r?1:0);for(let A=0;A<this._partGroups[o].link.length;++A)this._partGroups[o].link[A].initialize(t)}}r+=n}}copyPartOpacities(t){for(let r=0;r<this._partGroups.length;++r){const i=this._partGroups[r];if(i.link.length==0)continue;const n=this._partGroups[r].partIndex,o=t.getPartOpacityByIndex(n);for(let h=0;h<i.link.length;++h){const A=i.link[h].partIndex;A<0||t.setPartOpacityByIndex(A,o)}}}doFade(t,r,i,n){let o=-1,h=1;const f=.5,A=.15;for(let T=i;T<i+n;++T){const C=this._partGroups[T].partIndex,x=this._partGroups[T].parameterIndex;if(t.getParameterValueByIndex(x)>N1){if(o>=0)break;o=T,h=t.getPartOpacityByIndex(C),h+=r/this._fadeTimeSeconds,h>1&&(h=1)}}o<0&&(o=0,h=1);for(let T=i;T<i+n;++T){const C=this._partGroups[T].partIndex;if(o==T)t.setPartOpacityByIndex(C,h);else{let x=t.getPartOpacityByIndex(C),M;h<f?M=h*(f-1)/f+1:M=(1-h)*f/(1-f),(1-M)*(1-h)>A&&(M=1-A/(1-h)),x>M&&(x=M),t.setPartOpacityByIndex(C,x)}}}constructor(){this._fadeTimeSeconds=n2,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class Na{constructor(t){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],t!=null&&this.assignment(t)}assignment(t){return this.partId=t.partId,this.link=t.link.map(r=>r.clone()),this}initialize(t){this.parameterIndex=t.getParameterIndex(this.partId),this.partIndex=t.getPartIndex(this.partId),t.setParameterValueByIndex(this.parameterIndex,1)}clone(){const t=new Na;return t.partId=this.partId,t.parameterIndex=this.parameterIndex,t.partIndex=this.partIndex,t.link=this.link.map(r=>r.clone()),t}}class o2{constructor(t=!1,r=new ai){this.isOverwritten=t,this.Color=r}}class a2{constructor(t=!1,r=new ai){this.isOverwritten=t,this.Color=r}}class U1{constructor(t=!1,r=!1){this.isOverwritten=t,this.isCulling=r}}class G1{update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getPixelsPerUnit(){return this._model==null?0:this._model.canvasinfo.PixelsPerUnit}getCanvasWidth(){return this._model==null?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return this._model==null?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const t=this._model.parameters.count,r=this._savedParameters.length;for(let i=0;i<t;++i)i<r?this._savedParameters[i]=this._parameterValues[i]:this._savedParameters.push(this._parameterValues[i])}getMultiplyColor(t){return this.getOverwriteFlagForModelMultiplyColors()||this.getOverwriteFlagForDrawableMultiplyColors(t)?this._userMultiplyColors[t].Color:this.getDrawableMultiplyColor(t)}getScreenColor(t){return this.getOverwriteFlagForModelScreenColors()||this.getOverwriteFlagForDrawableScreenColors(t)?this._userScreenColors[t].Color:this.getDrawableScreenColor(t)}setMultiplyColorByTextureColor(t,r){this.setMultiplyColorByRGBA(t,r.R,r.G,r.B,r.A)}setMultiplyColorByRGBA(t,r,i,n,o=1){this._userMultiplyColors[t].Color.R=r,this._userMultiplyColors[t].Color.G=i,this._userMultiplyColors[t].Color.B=n,this._userMultiplyColors[t].Color.A=o}setScreenColorByTextureColor(t,r){this.setScreenColorByRGBA(t,r.R,r.G,r.B,r.A)}setScreenColorByRGBA(t,r,i,n,o=1){this._userScreenColors[t].Color.R=r,this._userScreenColors[t].Color.G=i,this._userScreenColors[t].Color.B=n,this._userScreenColors[t].Color.A=o}getPartMultiplyColor(t){return this._userPartMultiplyColors[t].Color}getPartScreenColor(t){return this._userPartScreenColors[t].Color}setPartColor(t,r,i,n,o,h,f){if(h[t].Color.R=r,h[t].Color.G=i,h[t].Color.B=n,h[t].Color.A=o,h[t].isOverwritten)for(let A=0;A<this._partChildDrawables[t].length;++A){const T=this._partChildDrawables[t][A];f[T].Color.R=r,f[T].Color.G=i,f[T].Color.B=n,f[T].Color.A=o}}setPartMultiplyColorByTextureColor(t,r){this.setPartMultiplyColorByRGBA(t,r.R,r.G,r.B,r.A)}setPartMultiplyColorByRGBA(t,r,i,n,o){this.setPartColor(t,r,i,n,o,this._userPartMultiplyColors,this._userMultiplyColors)}setPartScreenColorByTextureColor(t,r){this.setPartScreenColorByRGBA(t,r.R,r.G,r.B,r.A)}setPartScreenColorByRGBA(t,r,i,n,o){this.setPartColor(t,r,i,n,o,this._userPartScreenColors,this._userScreenColors)}getOverwriteFlagForModelMultiplyColors(){return this._isOverwrittenModelMultiplyColors}getOverwriteFlagForModelScreenColors(){return this._isOverwrittenModelScreenColors}setOverwriteFlagForModelMultiplyColors(t){this._isOverwrittenModelMultiplyColors=t}setOverwriteFlagForModelScreenColors(t){this._isOverwrittenModelScreenColors=t}getOverwriteFlagForDrawableMultiplyColors(t){return this._userMultiplyColors[t].isOverwritten}getOverwriteFlagForDrawableScreenColors(t){return this._userScreenColors[t].isOverwritten}setOverwriteFlagForDrawableMultiplyColors(t,r){this._userMultiplyColors[t].isOverwritten=r}setOverwriteFlagForDrawableScreenColors(t,r){this._userScreenColors[t].isOverwritten=r}getOverwriteColorForPartMultiplyColors(t){return this._userPartMultiplyColors[t].isOverwritten}getOverwriteColorForPartScreenColors(t){return this._userPartScreenColors[t].isOverwritten}setOverwriteColorForPartColors(t,r,i,n){i[t].isOverwritten=r;for(let o=0;o<this._partChildDrawables[t].length;++o){const h=this._partChildDrawables[t][o];n[h].isOverwritten=r,r&&(n[h].Color.R=i[t].Color.R,n[h].Color.G=i[t].Color.G,n[h].Color.B=i[t].Color.B,n[h].Color.A=i[t].Color.A)}}setOverwriteColorForPartMultiplyColors(t,r){this._userPartMultiplyColors[t].isOverwritten=r,this.setOverwriteColorForPartColors(t,r,this._userPartMultiplyColors,this._userMultiplyColors)}setOverwriteColorForPartScreenColors(t,r){this._userPartScreenColors[t].isOverwritten=r,this.setOverwriteColorForPartColors(t,r,this._userPartScreenColors,this._userScreenColors)}getDrawableCulling(t){if(this.getOverwriteFlagForModelCullings()||this.getOverwriteFlagForDrawableCullings(t))return this._userCullings[t].isCulling;const r=this._model.drawables.constantFlags;return!Live2DCubismCore.Utils.hasIsDoubleSidedBit(r[t])}setDrawableCulling(t,r){this._userCullings[t].isCulling=r}getOverwriteFlagForModelCullings(){return this._isOverwrittenCullings}setOverwriteFlagForModelCullings(t){this._isOverwrittenCullings=t}getOverwriteFlagForDrawableCullings(t){return this._userCullings[t].isOverwritten}setOverwriteFlagForDrawableCullings(t,r){this._userCullings[t].isOverwritten=r}getModelOapcity(){return this._modelOpacity}setModelOapcity(t){this._modelOpacity=t}getModel(){return this._model}getPartIndex(t){let r;const i=this._model.parts.count;for(r=0;r<i;++r)if(t==this._partIds[r])return r;return t in this._notExistPartId?this._notExistPartId[t]:(r=i+this._notExistPartId.length,this._notExistPartId[t]=r,this._notExistPartOpacities[r]=0,r)}getPartId(t){return this._model.parts.ids[t]}getPartCount(){return this._model.parts.count}setPartOpacityByIndex(t,r){if(t in this._notExistPartOpacities){this._notExistPartOpacities[t]=r;return}vn(0<=t&&t<this.getPartCount()),this._partOpacities[t]=r}setPartOpacityById(t,r){const i=this.getPartIndex(t);i<0||this.setPartOpacityByIndex(i,r)}getPartOpacityByIndex(t){return t in this._notExistPartOpacities?this._notExistPartOpacities[t]:(vn(0<=t&&t<this.getPartCount()),this._partOpacities[t])}getPartOpacityById(t){const r=this.getPartIndex(t);return r<0?0:this.getPartOpacityByIndex(r)}getParameterIndex(t){let r;const i=this._model.parameters.count;for(r=0;r<i;++r)if(t==this._parameterIds[r])return r;return t in this._notExistParameterId?this._notExistParameterId[t]:(r=this._model.parameters.count+Object.keys(this._notExistParameterId).length,this._notExistParameterId[t]=r,this._notExistParameterValues[r]=0,r)}getParameterCount(){return this._model.parameters.count}getParameterType(t){return this._model.parameters.types[t]}getParameterMaximumValue(t){return this._model.parameters.maximumValues[t]}getParameterMinimumValue(t){return this._model.parameters.minimumValues[t]}getParameterDefaultValue(t){return this._model.parameters.defaultValues[t]}getParameterValueByIndex(t){return t in this._notExistParameterValues?this._notExistParameterValues[t]:(vn(0<=t&&t<this.getParameterCount()),this._parameterValues[t])}getParameterValueById(t){const r=this.getParameterIndex(t);return this.getParameterValueByIndex(r)}setParameterValueByIndex(t,r,i=1){if(t in this._notExistParameterValues){this._notExistParameterValues[t]=i==1?r:this._notExistParameterValues[t]*(1-i)+r*i;return}vn(0<=t&&t<this.getParameterCount()),this._model.parameters.maximumValues[t]<r&&(r=this._model.parameters.maximumValues[t]),this._model.parameters.minimumValues[t]>r&&(r=this._model.parameters.minimumValues[t]),this._parameterValues[t]=i==1?r:this._parameterValues[t]=this._parameterValues[t]*(1-i)+r*i}setParameterValueById(t,r,i=1){const n=this.getParameterIndex(t);this.setParameterValueByIndex(n,r,i)}addParameterValueByIndex(t,r,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)+r*i)}addParameterValueById(t,r,i=1){const n=this.getParameterIndex(t);this.addParameterValueByIndex(n,r,i)}multiplyParameterValueById(t,r,i=1){const n=this.getParameterIndex(t);this.multiplyParameterValueByIndex(n,r,i)}multiplyParameterValueByIndex(t,r,i=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)*(1+(r-1)*i))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(t){const r=this._model.drawables.count;for(let i=0;i<r;++i)if(this._drawableIds[i]==t)return i;return-1}getDrawableCount(){return this._model.drawables.count}getDrawableId(t){return this._model.drawables.ids[t]}getDrawableRenderOrders(){return this._model.drawables.renderOrders}getDrawableTextureIndices(t){return this.getDrawableTextureIndex(t)}getDrawableTextureIndex(t){return this._model.drawables.textureIndices[t]}getDrawableDynamicFlagVertexPositionsDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(r[t])}getDrawableVertexIndexCount(t){return this._model.drawables.indexCounts[t]}getDrawableVertexCount(t){return this._model.drawables.vertexCounts[t]}getDrawableVertices(t){return this.getDrawableVertexPositions(t)}getDrawableVertexIndices(t){return this._model.drawables.indices[t]}getDrawableVertexPositions(t){return this._model.drawables.vertexPositions[t]}getDrawableVertexUvs(t){return this._model.drawables.vertexUvs[t]}getDrawableOpacity(t){return this._model.drawables.opacities[t]}getDrawableMultiplyColor(t){const r=this._model.drawables.multiplyColors,i=t*4,n=new ai;return n.R=r[i],n.G=r[i+1],n.B=r[i+2],n.A=r[i+3],n}getDrawableScreenColor(t){const r=this._model.drawables.screenColors,i=t*4,n=new ai;return n.R=r[i],n.G=r[i+1],n.B=r[i+2],n.A=r[i+3],n}getDrawableParentPartIndex(t){return this._model.drawables.parentPartIndices[t]}getDrawableBlendMode(t){const r=this._model.drawables.constantFlags;return Live2DCubismCore.Utils.hasBlendAdditiveBit(r[t])?gs.CubismBlendMode_Additive:Live2DCubismCore.Utils.hasBlendMultiplicativeBit(r[t])?gs.CubismBlendMode_Multiplicative:gs.CubismBlendMode_Normal}getDrawableInvertedMaskBit(t){const r=this._model.drawables.constantFlags;return Live2DCubismCore.Utils.hasIsInvertedMaskBit(r[t])}getDrawableMasks(){return this._model.drawables.masks}getDrawableMaskCounts(){return this._model.drawables.maskCounts}isUsingMasking(){for(let t=0;t<this._model.drawables.count;++t)if(!(this._model.drawables.maskCounts[t]<=0))return!0;return!1}getDrawableDynamicFlagIsVisible(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasIsVisibleBit(r[t])}getDrawableDynamicFlagVisibilityDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(r[t])}getDrawableDynamicFlagOpacityDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasOpacityDidChangeBit(r[t])}getDrawableDynamicFlagRenderOrderDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(r[t])}getDrawableDynamicFlagBlendColorDidChange(t){const r=this._model.drawables.dynamicFlags;return Live2DCubismCore.Utils.hasBlendColorDidChangeBit(r[t])}loadParameters(){let t=this._model.parameters.count;const r=this._savedParameters.length;t>r&&(t=r);for(let i=0;i<t;++i)this._parameterValues[i]=this._savedParameters[i]}initialize(){this._parameterValues=this._model.parameters.values,this._partOpacities=this._model.parts.opacities,this._parameterMaximumValues=this._model.parameters.maximumValues,this._parameterMinimumValues=this._model.parameters.minimumValues;{const r=this._model.parameters.ids,i=this._model.parameters.count;for(let n=0;n<i;++n)this._parameterIds.push(r[n])}const t=this._model.parts.count;{const r=this._model.parts.ids;for(let i=0;i<t;++i)this._partIds.push(r[i])}{const r=this._model.drawables.ids,i=this._model.drawables.count,n=new U1(!1,!1);for(let o=0;o<t;++o){const h=new ai(1,1,1,1),f=new ai(0,0,0,1),A=new a2(!1,h),T=new a2(!1,f);this._userPartMultiplyColors.push(A),this._userPartScreenColors.push(T),this._partChildDrawables.push([])}for(let o=0;o<i;++o){const h=new ai(1,1,1,1),f=new ai(0,0,0,1),A=new o2(!1,h),T=new o2(!1,f);this._drawableIds.push(r[o]),this._userMultiplyColors.push(A),this._userScreenColors.push(T),this._userCullings.push(n);const C=this.getDrawableParentPartIndex(o);C>=0&&this._partChildDrawables[C].push(o)}}}constructor(t){this._model=t,this._savedParameters=[],this._parameterIds=[],this._drawableIds=[],this._partIds=[],this._isOverwrittenModelMultiplyColors=!1,this._isOverwrittenModelScreenColors=!1,this._isOverwrittenCullings=!1,this._modelOpacity=1,this._userMultiplyColors=[],this._userScreenColors=[],this._userCullings=[],this._userPartMultiplyColors=[],this._userPartScreenColors=[],this._partChildDrawables=[],this._notExistPartId={},this._notExistParameterId={},this._notExistParameterValues={},this._notExistPartOpacities={},this.initialize()}release(){this._model.release(),this._model=void 0}}class vu{static create(t,r){if(r&&!this.hasMocConsistency(t))throw new Error("Inconsistent MOC3.");const i=Live2DCubismCore.Moc.fromArrayBuffer(t);if(i){const n=new vu(i);return n._mocVersion=Live2DCubismCore.Version.csmGetMocVersion(i,t),n}throw new Error("Failed to CubismMoc.create().")}createModel(){let t;const r=Live2DCubismCore.Model.fromMoc(this._moc);if(r)return t=new G1(r),++this._modelCount,t;throw new Error("Unknown error")}deleteModel(t){t!=null&&--this._modelCount}constructor(t){this._moc=t,this._modelCount=0,this._mocVersion=0}release(){this._moc._release(),this._moc=void 0}getLatestMocVersion(){return Live2DCubismCore.Version.csmGetLatestMocVersion()}getMocVersion(){return this._mocVersion}static hasMocConsistency(t){return Live2DCubismCore.Moc.prototype.hasMocConsistency(t)===1}}var xu=(s=>(s[s.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",s))(xu||{}),Qs=(s=>(s[s.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",s[s.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",s[s.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",s))(Qs||{});class V1{constructor(){this.initialPosition=new Ie(0,0),this.position=new Ie(0,0),this.lastPosition=new Ie(0,0),this.lastGravity=new Ie(0,0),this.force=new Ie(0,0),this.velocity=new Ie(0,0)}}class z1{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class X1{constructor(){this.source={}}}class W1{constructor(){this.destination={},this.translationScale=new Ie(0,0)}}class H1{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new Ie(0,0),this.wind=new Ie(0,0),this.fps=0}}class Y1{constructor(t){this._json=t}release(){this._json=void 0}getGravity(){const t=new Ie(0,0);return t.x=this._json.Meta.EffectiveForces.Gravity.X,t.y=this._json.Meta.EffectiveForces.Gravity.Y,t}getWind(){const t=new Ie(0,0);return t.x=this._json.Meta.EffectiveForces.Wind.X,t.y=this._json.Meta.EffectiveForces.Wind.Y,t}getFps(){return this._json.Meta.Fps||0}getSubRigCount(){return this._json.Meta.PhysicsSettingCount}getTotalInputCount(){return this._json.Meta.TotalInputCount}getTotalOutputCount(){return this._json.Meta.TotalOutputCount}getVertexCount(){return this._json.Meta.VertexCount}getNormalizationPositionMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Default}getNormalizationAngleMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Default}getInputCount(t){return this._json.PhysicsSettings[t].Input.length}getInputWeight(t,r){return this._json.PhysicsSettings[t].Input[r].Weight}getInputReflect(t,r){return this._json.PhysicsSettings[t].Input[r].Reflect}getInputType(t,r){return this._json.PhysicsSettings[t].Input[r].Type}getInputSourceId(t,r){return this._json.PhysicsSettings[t].Input[r].Source.Id}getOutputCount(t){return this._json.PhysicsSettings[t].Output.length}getOutputVertexIndex(t,r){return this._json.PhysicsSettings[t].Output[r].VertexIndex}getOutputAngleScale(t,r){return this._json.PhysicsSettings[t].Output[r].Scale}getOutputWeight(t,r){return this._json.PhysicsSettings[t].Output[r].Weight}getOutputDestinationId(t,r){return this._json.PhysicsSettings[t].Output[r].Destination.Id}getOutputType(t,r){return this._json.PhysicsSettings[t].Output[r].Type}getOutputReflect(t,r){return this._json.PhysicsSettings[t].Output[r].Reflect}getParticleCount(t){return this._json.PhysicsSettings[t].Vertices.length}getParticleMobility(t,r){return this._json.PhysicsSettings[t].Vertices[r].Mobility}getParticleDelay(t,r){return this._json.PhysicsSettings[t].Vertices[r].Delay}getParticleAcceleration(t,r){return this._json.PhysicsSettings[t].Vertices[r].Acceleration}getParticleRadius(t,r){return this._json.PhysicsSettings[t].Vertices[r].Radius}getParticlePosition(t,r){const i=new Ie(0,0);return i.x=this._json.PhysicsSettings[t].Vertices[r].Position.X,i.y=this._json.PhysicsSettings[t].Vertices[r].Position.Y,i}}const h2="X",l2="Y",u2="Angle",j1=5,bu=100,c2=.001,q1=5;class Au{static create(t){const r=new Au;return r.parse(t),r._physicsRig.gravity.y=0,r}static delete(t){t!=null&&t.release()}parse(t){this._physicsRig=new H1;const r=new Y1(t);this._physicsRig.gravity=r.getGravity(),this._physicsRig.wind=r.getWind(),this._physicsRig.subRigCount=r.getSubRigCount(),this._physicsRig.fps=r.getFps(),this._currentRigOutputs=[],this._previousRigOutputs=[];let i=0,n=0,o=0;for(let h=0;h<this._physicsRig.subRigCount;++h){const f=new z1;f.normalizationPosition.minimum=r.getNormalizationPositionMinimumValue(h),f.normalizationPosition.maximum=r.getNormalizationPositionMaximumValue(h),f.normalizationPosition.defalut=r.getNormalizationPositionDefaultValue(h),f.normalizationAngle.minimum=r.getNormalizationAngleMinimumValue(h),f.normalizationAngle.maximum=r.getNormalizationAngleMaximumValue(h),f.normalizationAngle.defalut=r.getNormalizationAngleDefaultValue(h),f.inputCount=r.getInputCount(h),f.baseInputIndex=i,i+=f.inputCount;for(let C=0;C<f.inputCount;++C){const x=new X1;switch(x.sourceParameterIndex=-1,x.weight=r.getInputWeight(h,C),x.reflect=r.getInputReflect(h,C),r.getInputType(h,C)){case h2:x.type=Qs.CubismPhysicsSource_X,x.getNormalizedParameterValue=Q1;break;case l2:x.type=Qs.CubismPhysicsSource_Y,x.getNormalizedParameterValue=K1;break;case u2:x.type=Qs.CubismPhysicsSource_Angle,x.getNormalizedParameterValue=J1;break}x.source.targetType=xu.CubismPhysicsTargetType_Parameter,x.source.id=r.getInputSourceId(h,C),this._physicsRig.inputs.push(x)}f.outputCount=r.getOutputCount(h),f.baseOutputIndex=n;const A=new f2,T=new f2;for(let C=0;C<f.outputCount;++C){A.outputs[C]=0,T.outputs[C]=0;let x=this._physicsRig.outputs[n+C];switch(x||(x=new W1,this._physicsRig.outputs[n+C]=x),x.destinationParameterIndex=-1,x.vertexIndex=r.getOutputVertexIndex(h,C),x.angleScale=r.getOutputAngleScale(h,C),x.weight=r.getOutputWeight(h,C),x.destination.targetType=xu.CubismPhysicsTargetType_Parameter,x.destination.id=r.getOutputDestinationId(h,C),r.getOutputType(h,C)){case h2:x.type=Qs.CubismPhysicsSource_X,x.getValue=ty,x.getScale=ny;break;case l2:x.type=Qs.CubismPhysicsSource_Y,x.getValue=ey,x.getScale=oy;break;case u2:x.type=Qs.CubismPhysicsSource_Angle,x.getValue=ry,x.getScale=ay;break}x.reflect=r.getOutputReflect(h,C)}this._currentRigOutputs.push(A),this._previousRigOutputs.push(T),n+=f.outputCount,f.particleCount=r.getParticleCount(h),f.baseParticleIndex=o,o+=f.particleCount;for(let C=0;C<f.particleCount;++C){const x=new V1;x.mobility=r.getParticleMobility(h,C),x.delay=r.getParticleDelay(h,C),x.acceleration=r.getParticleAcceleration(h,C),x.radius=r.getParticleRadius(h,C),x.position=r.getParticlePosition(h,C),this._physicsRig.particles.push(x)}this._physicsRig.settings.push(f)}this.initialize(),r.release()}stabilization(t){var r,i,n,o;let h,f,A,T;const C=new Ie;let x,M,D,k,U,G,X,J;U=t.getModel().parameters.values,G=t.getModel().parameters.maximumValues,X=t.getModel().parameters.minimumValues,J=t.getModel().parameters.defaultValues,((i=(r=this._parameterCaches)==null?void 0:r.length)!=null?i:0)<t.getParameterCount()&&(this._parameterCaches=new Float32Array(t.getParameterCount())),((o=(n=this._parameterInputCaches)==null?void 0:n.length)!=null?o:0)<t.getParameterCount()&&(this._parameterInputCaches=new Float32Array(t.getParameterCount()));for(let Z=0;Z<t.getParameterCount();++Z)this._parameterCaches[Z]=U[Z],this._parameterInputCaches[Z]=U[Z];for(let Z=0;Z<this._physicsRig.subRigCount;++Z){h={angle:0},C.x=0,C.y=0,x=this._physicsRig.settings[Z],M=this._physicsRig.inputs.slice(x.baseInputIndex),D=this._physicsRig.outputs.slice(x.baseOutputIndex),k=this._physicsRig.particles.slice(x.baseParticleIndex);for(let it=0;it<x.inputCount;++it)f=M[it].weight/bu,M[it].sourceParameterIndex==-1&&(M[it].sourceParameterIndex=t.getParameterIndex(M[it].source.id)),M[it].getNormalizedParameterValue(C,h,U[M[it].sourceParameterIndex],X[M[it].sourceParameterIndex],G[M[it].sourceParameterIndex],J[M[it].sourceParameterIndex],x.normalizationPosition,x.normalizationAngle,M[it].reflect,f),this._parameterCaches[M[it].sourceParameterIndex]=U[M[it].sourceParameterIndex];A=Ke.degreesToRadian(-h.angle),C.x=C.x*Ke.cos(A)-C.y*Ke.sin(A),C.y=C.x*Ke.sin(A)+C.y*Ke.cos(A),ly(k,x.particleCount,C,h.angle,this._options.wind,c2*x.normalizationPosition.maximum);for(let it=0;it<x.outputCount;++it){const Q=D[it].vertexIndex;if(D[it].destinationParameterIndex==-1&&(D[it].destinationParameterIndex=t.getParameterIndex(D[it].destination.id)),Q<1||Q>=x.particleCount)continue;let _t=new Ie;_t=k[Q].position.substract(k[Q-1].position),T=D[it].getValue(_t,k,Q,D[it].reflect,this._options.gravity),this._currentRigOutputs[Z].outputs[it]=T,this._previousRigOutputs[Z].outputs[it]=T;const et=D[it].destinationParameterIndex,ft=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(U.subarray(et))):U.slice(et);wu(ft,X[et],G[et],T,D[it]);for(let wt=et,Rt=0;wt<this._parameterCaches.length;wt++,Rt++)U[wt]=this._parameterCaches[wt]=ft[Rt]}}}evaluate(t,r){var i,n,o,h;let f,A,T,C;const x=new Ie;let M,D,k,U;if(0>=r)return;let G,X,J,Z,it;if(this._currentRemainTime+=r,this._currentRemainTime>q1&&(this._currentRemainTime=0),G=t.getModel().parameters.values,X=t.getModel().parameters.maximumValues,J=t.getModel().parameters.minimumValues,Z=t.getModel().parameters.defaultValues,((n=(i=this._parameterCaches)==null?void 0:i.length)!=null?n:0)<t.getParameterCount()&&(this._parameterCaches=new Float32Array(t.getParameterCount())),((h=(o=this._parameterInputCaches)==null?void 0:o.length)!=null?h:0)<t.getParameterCount()){this._parameterInputCaches=new Float32Array(t.getParameterCount());for(let _t=0;_t<t.getParameterCount();++_t)this._parameterInputCaches[_t]=G[_t]}for(this._physicsRig.fps>0?it=1/this._physicsRig.fps:it=r;this._currentRemainTime>=it;){for(let et=0;et<this._physicsRig.subRigCount;++et){M=this._physicsRig.settings[et],k=this._physicsRig.outputs.slice(M.baseOutputIndex);for(let ft=0;ft<M.outputCount;++ft)this._previousRigOutputs[et].outputs[ft]=this._currentRigOutputs[et].outputs[ft]}const _t=it/this._currentRemainTime;for(let et=0;et<t.getParameterCount();++et)this._parameterCaches[et]=this._parameterInputCaches[et]*(1-_t)+G[et]*_t,this._parameterInputCaches[et]=this._parameterCaches[et];for(let et=0;et<this._physicsRig.subRigCount;++et){f={angle:0},x.x=0,x.y=0,M=this._physicsRig.settings[et],D=this._physicsRig.inputs.slice(M.baseInputIndex),k=this._physicsRig.outputs.slice(M.baseOutputIndex),U=this._physicsRig.particles.slice(M.baseParticleIndex);for(let ft=0;ft<M.inputCount;++ft)A=D[ft].weight/bu,D[ft].sourceParameterIndex==-1&&(D[ft].sourceParameterIndex=t.getParameterIndex(D[ft].source.id)),D[ft].getNormalizedParameterValue(x,f,this._parameterCaches[D[ft].sourceParameterIndex],J[D[ft].sourceParameterIndex],X[D[ft].sourceParameterIndex],Z[D[ft].sourceParameterIndex],M.normalizationPosition,M.normalizationAngle,D[ft].reflect,A);T=Ke.degreesToRadian(-f.angle),x.x=x.x*Ke.cos(T)-x.y*Ke.sin(T),x.y=x.x*Ke.sin(T)+x.y*Ke.cos(T),hy(U,M.particleCount,x,f.angle,this._options.wind,c2*M.normalizationPosition.maximum,it,j1);for(let ft=0;ft<M.outputCount;++ft){const wt=k[ft].vertexIndex;if(k[ft].destinationParameterIndex==-1&&(k[ft].destinationParameterIndex=t.getParameterIndex(k[ft].destination.id)),wt<1||wt>=M.particleCount)continue;const Rt=new Ie;Rt.x=U[wt].position.x-U[wt-1].position.x,Rt.y=U[wt].position.y-U[wt-1].position.y,C=k[ft].getValue(Rt,U,wt,k[ft].reflect,this._options.gravity),this._currentRigOutputs[et].outputs[ft]=C;const It=k[ft].destinationParameterIndex,pt=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(this._parameterCaches.subarray(It))):this._parameterCaches.slice(It);wu(pt,J[It],X[It],C,k[ft]);for(let xt=It,Ct=0;xt<this._parameterCaches.length;xt++,Ct++)this._parameterCaches[xt]=pt[Ct]}}this._currentRemainTime-=it}const Q=this._currentRemainTime/it;this.interpolate(t,Q)}interpolate(t,r){let i,n,o,h,f;o=t.getModel().parameters.values,h=t.getModel().parameters.maximumValues,f=t.getModel().parameters.minimumValues;for(let A=0;A<this._physicsRig.subRigCount;++A){n=this._physicsRig.settings[A],i=this._physicsRig.outputs.slice(n.baseOutputIndex);for(let T=0;T<n.outputCount;++T){if(i[T].destinationParameterIndex==-1)continue;const C=i[T].destinationParameterIndex,x=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(o.subarray(C))):o.slice(C);wu(x,f[C],h[C],this._previousRigOutputs[A].outputs[T]*(1-r)+this._currentRigOutputs[A].outputs[T]*r,i[T]);for(let M=C,D=0;M<o.length;M++,D++)o[M]=x[D]}}}setOptions(t){this._options=t}getOption(){return this._options}constructor(){this._options=new Z1,this._options.gravity.y=-1,this._options.gravity.x=0,this._options.wind.x=0,this._options.wind.y=0,this._currentRigOutputs=[],this._previousRigOutputs=[],this._currentRemainTime=0}release(){this._physicsRig=void 0}initialize(){let t,r,i;for(let n=0;n<this._physicsRig.subRigCount;++n){r=this._physicsRig.settings[n],t=this._physicsRig.particles.slice(r.baseParticleIndex),t[0].initialPosition=new Ie(0,0),t[0].lastPosition=new Ie(t[0].initialPosition.x,t[0].initialPosition.y),t[0].lastGravity=new Ie(0,-1),t[0].lastGravity.y*=-1,t[0].velocity=new Ie(0,0),t[0].force=new Ie(0,0);for(let o=1;o<r.particleCount;++o)i=new Ie(0,0),i.y=t[o].radius,t[o].initialPosition=new Ie(t[o-1].initialPosition.x+i.x,t[o-1].initialPosition.y+i.y),t[o].position=new Ie(t[o].initialPosition.x,t[o].initialPosition.y),t[o].lastPosition=new Ie(t[o].initialPosition.x,t[o].initialPosition.y),t[o].lastGravity=new Ie(0,-1),t[o].lastGravity.y*=-1,t[o].velocity=new Ie(0,0),t[o].force=new Ie(0,0)}}}class Z1{constructor(){this.gravity=new Ie(0,0),this.wind=new Ie(0,0)}}class f2{constructor(){this.outputs=[]}}function Q1(s,t,r,i,n,o,h,f,A,T){s.x+=Tu(r,i,n,o,h.minimum,h.maximum,h.defalut,A)*T}function K1(s,t,r,i,n,o,h,f,A,T){s.y+=Tu(r,i,n,o,h.minimum,h.maximum,h.defalut,A)*T}function J1(s,t,r,i,n,o,h,f,A,T){t.angle+=Tu(r,i,n,o,f.minimum,f.maximum,f.defalut,A)*T}function ty(s,t,r,i,n){let o=s.x;return i&&(o*=-1),o}function ey(s,t,r,i,n){let o=s.y;return i&&(o*=-1),o}function ry(s,t,r,i,n){let o;return r>=2?n=t[r-1].position.substract(t[r-2].position):n=n.multiplyByScaler(-1),o=Ke.directionToRadian(n,s),i&&(o*=-1),o}function iy(s,t){return Math.abs(Math.max(s,t)-Math.min(s,t))}function sy(s,t){return Math.min(s,t)+iy(s,t)/2}function ny(s,t){return s.x}function oy(s,t){return s.y}function ay(s,t){return t}function hy(s,t,r,i,n,o,h,f){let A,T,C,x,M=new Ie(0,0),D=new Ie(0,0),k=new Ie(0,0),U=new Ie(0,0);s[0].position=new Ie(r.x,r.y),A=Ke.degreesToRadian(i),x=Ke.radianToDirection(A),x.normalize();for(let G=1;G<t;++G)s[G].force=x.multiplyByScaler(s[G].acceleration).add(n),s[G].lastPosition=new Ie(s[G].position.x,s[G].position.y),T=s[G].delay*h*30,M=s[G].position.substract(s[G-1].position),C=Ke.directionToRadian(s[G].lastGravity,x)/f,M.x=Ke.cos(C)*M.x-M.y*Ke.sin(C),M.y=Ke.sin(C)*M.x+M.y*Ke.cos(C),s[G].position=s[G-1].position.add(M),D=s[G].velocity.multiplyByScaler(T),k=s[G].force.multiplyByScaler(T).multiplyByScaler(T),s[G].position=s[G].position.add(D).add(k),U=s[G].position.substract(s[G-1].position),U.normalize(),s[G].position=s[G-1].position.add(U.multiplyByScaler(s[G].radius)),Ke.abs(s[G].position.x)<o&&(s[G].position.x=0),T!=0&&(s[G].velocity=s[G].position.substract(s[G].lastPosition),s[G].velocity=s[G].velocity.divisionByScalar(T),s[G].velocity=s[G].velocity.multiplyByScaler(s[G].mobility)),s[G].force=new Ie(0,0),s[G].lastGravity=new Ie(x.x,x.y)}function ly(s,t,r,i,n,o){let h,f,A=new Ie(0,0);s[0].position=new Ie(r.x,r.y),h=Ke.degreesToRadian(i),f=Ke.radianToDirection(h),f.normalize();for(let T=1;T<t;++T)s[T].force=f.multiplyByScaler(s[T].acceleration).add(n),s[T].lastPosition=new Ie(s[T].position.x,s[T].position.y),s[T].velocity=new Ie(0,0),A=s[T].force,A.normalize(),A=A.multiplyByScaler(s[T].radius),s[T].position=s[T-1].position.add(A),Ke.abs(s[T].position.x)<o&&(s[T].position.x=0),s[T].force=new Ie(0,0),s[T].lastGravity=new Ie(f.x,f.y)}function wu(s,t,r,i,n){let o,h,f;o=n.getScale(n.translationScale,n.angleScale),h=i*o,h<t?(h<n.valueBelowMinimum&&(n.valueBelowMinimum=h),h=t):h>r&&(h>n.valueExceededMaximum&&(n.valueExceededMaximum=h),h=r),f=n.weight/bu,f>=1||(h=s[0]*(1-f)+h*f),s[0]=h}function Tu(s,t,r,i,n,o,h,f){let A=0;const T=Ke.max(r,t);T<s&&(s=T);const C=Ke.min(r,t);C>s&&(s=C);const x=Ke.min(n,o),M=Ke.max(n,o),D=h,k=sy(C,T),U=s-k;switch(Math.sign(U)){case 1:{const G=M-D,X=T-k;X!=0&&(A=U*(G/X),A+=D);break}case-1:{const G=x-D,X=C-k;X!=0&&(A=U*(G/X),A+=D);break}case 0:{A=D;break}}return f?A:A*-1}oi.registerRuntime({version:4,ready:k1,test(s){return s instanceof bn||bn.isValidJSON(s)},isValidMoc(s){if(s.byteLength<4)return!1;const t=new Int8Array(s,0,4);return String.fromCharCode(...t)==="MOC3"},createModelSettings(s){return new bn(s)},createCoreModel(s,t){const r=vu.create(s,!!(t!=null&&t.checkMocConsistency));try{const i=r.createModel();return i.__moc=r,i}catch(i){try{r.release()}catch{}throw i}},createInternalModel(s,t,r){const i=new B1(s,t,r),n=s;return n.__moc&&(i.__moc=n.__moc,delete n.__moc,i.once("destroy",uy)),i},createPhysics(s,t){return Au.create(t)},createPose(s,t){return yu.create(t)}});function uy(){var s;(s=this.__moc)==null||s.release()}async function cy(s){const{element_id:t="live2d-canvas",models:r,width:i=300,height:n=300,auto_fit:o=!0,auto_motion:h=!0,mouse_tracking:f=!0}=s;let A=fy(t,s);const T=new kl({view:A,width:i,height:n,backgroundAlpha:0,autoDensity:!0,antialias:!0,eventMode:"static",eventFeatures:{move:!0,globalMove:!0,click:!0,wheel:!0}}),C=await uu.from(r[0].model_url);if(T.stage.addChild(C),o){const x=Math.min(i/C.width,n/C.height);C.scale.set(x),C.x=(i-C.width*x)/2,C.y=(n-C.height*x)/2}return f&&dy(C,T.view),h&&await py(C),C}function fy(s,t){let r=document.getElementById(s);return r||(r=document.createElement("canvas"),r.id=s,document.body.appendChild(r),r.style.display="none",r.style.position="fixed",r.style.display="block",r.style.position="absolute",r.style.bottom=`${t.spacing_y||0}px`,r.style[t.position==="left"?"left":"right"]=`${t.spacing_x||0}px`,r.style.zIndex="9999"),r}function dy(s,t){document.addEventListener("mousemove",r=>{var A;const i=t.getBoundingClientRect(),n=i.left+i.width/2,o=i.top+i.height/2,h=(r.clientX-n)/i.width,f=-(r.clientY-o)/i.height;s.internalModel&&((A=s.internalModel.focusController)==null||A.focus(h,f))}),t.addEventListener("click",()=>{var r;try{const i=(r=s.internalModel)==null?void 0:r.motionManager.definitions;if(i)if(i.tap_body)s.motion("tap_body");else if(i.tap)s.motion("tap");else{const n=Object.keys(i)[0];n&&s.motion(n)}}catch(i){console.warn("Failed to play tap animation:",i)}})}async function py(s){var t;try{const r=(t=s.internalModel)==null?void 0:t.motionManager.definitions;if(r)if(r.idle)await s.motion("idle");else if(r.tap_body)await s.motion("tap_body");else{const i=Object.keys(r)[0];i&&await s.motion(i)}}catch(r){console.warn("Failed to start idle animation:",r)}}async function _y(){uu.registerTicker($r),be.add(sa)}qr.Live2DModel=uu,qr.MotionManager=fo,qr.PIXI=bm,qr.SoundManager=Mr,qr.createLive2D=cy,qr.initializeLive2D=_y,Object.defineProperty(qr,Symbol.toStringTag,{value:"Module"})});
|
|
1208
1208
|
//# sourceMappingURL=l2d.umd.js.map
|