@pixiv/three-vrm-core 2.1.2 → 3.0.0-beta.0

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.
Files changed (86) hide show
  1. package/lib/three-vrm-core.cjs +3335 -0
  2. package/lib/three-vrm-core.min.cjs +2 -0
  3. package/lib/three-vrm-core.module.js +3203 -3441
  4. package/lib/three-vrm-core.module.min.js +2 -2
  5. package/package.json +19 -18
  6. package/types/meta/VRMMetaLoaderPlugin.d.ts +1 -1
  7. package/types/meta/VRMMetaLoaderPluginOptions.d.ts +1 -1
  8. package/lib/three-vrm-core.js +0 -3599
  9. package/lib/three-vrm-core.min.js +0 -2
  10. package/ts3.4/types/VRMCore.d.ts +0 -58
  11. package/ts3.4/types/VRMCoreLoaderPlugin.d.ts +0 -18
  12. package/ts3.4/types/VRMCoreLoaderPluginOptions.d.ts +0 -20
  13. package/ts3.4/types/VRMCoreParameters.d.ts +0 -17
  14. package/ts3.4/types/expressions/VRMExpression.d.ts +0 -65
  15. package/ts3.4/types/expressions/VRMExpressionBind.d.ts +0 -11
  16. package/ts3.4/types/expressions/VRMExpressionLoaderPlugin.d.ts +0 -23
  17. package/ts3.4/types/expressions/VRMExpressionManager.d.ts +0 -124
  18. package/ts3.4/types/expressions/VRMExpressionMaterialColorBind.d.ts +0 -58
  19. package/ts3.4/types/expressions/VRMExpressionMaterialColorType.d.ts +0 -12
  20. package/ts3.4/types/expressions/VRMExpressionMorphTargetBind.d.ts +0 -35
  21. package/ts3.4/types/expressions/VRMExpressionOverrideType.d.ts +0 -6
  22. package/ts3.4/types/expressions/VRMExpressionPresetName.d.ts +0 -21
  23. package/ts3.4/types/expressions/VRMExpressionTextureTransformBind.d.ts +0 -40
  24. package/ts3.4/types/expressions/index.d.ts +0 -10
  25. package/ts3.4/types/firstPerson/VRMFirstPerson.d.ts +0 -84
  26. package/ts3.4/types/firstPerson/VRMFirstPersonLoaderPlugin.d.ts +0 -20
  27. package/ts3.4/types/firstPerson/VRMFirstPersonMeshAnnotation.d.ts +0 -6
  28. package/ts3.4/types/firstPerson/VRMFirstPersonMeshAnnotationType.d.ts +0 -7
  29. package/ts3.4/types/firstPerson/index.d.ts +0 -4
  30. package/ts3.4/types/humanoid/VRMHumanBone.d.ts +0 -10
  31. package/ts3.4/types/humanoid/VRMHumanBoneList.d.ts +0 -5
  32. package/ts3.4/types/humanoid/VRMHumanBoneName.d.ts +0 -63
  33. package/ts3.4/types/humanoid/VRMHumanBoneParentMap.d.ts +0 -9
  34. package/ts3.4/types/humanoid/VRMHumanBones.d.ts +0 -11
  35. package/ts3.4/types/humanoid/VRMHumanoid.d.ts +0 -182
  36. package/ts3.4/types/humanoid/VRMHumanoidLoaderPlugin.d.ts +0 -33
  37. package/ts3.4/types/humanoid/VRMHumanoidLoaderPluginOptions.d.ts +0 -16
  38. package/ts3.4/types/humanoid/VRMHumanoidRig.d.ts +0 -31
  39. package/ts3.4/types/humanoid/VRMPose.d.ts +0 -24
  40. package/ts3.4/types/humanoid/VRMPoseTransform.d.ts +0 -24
  41. package/ts3.4/types/humanoid/VRMRequiredHumanBoneName.d.ts +0 -18
  42. package/ts3.4/types/humanoid/VRMRig.d.ts +0 -62
  43. package/ts3.4/types/humanoid/helpers/VRMHumanoidHelper.d.ts +0 -9
  44. package/ts3.4/types/humanoid/helpers/index.d.ts +0 -1
  45. package/ts3.4/types/humanoid/index.d.ts +0 -12
  46. package/ts3.4/types/index.d.ts +0 -9
  47. package/ts3.4/types/lookAt/VRMLookAt.d.ts +0 -149
  48. package/ts3.4/types/lookAt/VRMLookAtApplier.d.ts +0 -18
  49. package/ts3.4/types/lookAt/VRMLookAtBoneApplier.d.ts +0 -83
  50. package/ts3.4/types/lookAt/VRMLookAtExpressionApplier.d.ts +0 -56
  51. package/ts3.4/types/lookAt/VRMLookAtLoaderPlugin.d.ts +0 -31
  52. package/ts3.4/types/lookAt/VRMLookAtLoaderPluginOptions.d.ts +0 -9
  53. package/ts3.4/types/lookAt/VRMLookAtRangeMap.d.ts +0 -23
  54. package/ts3.4/types/lookAt/VRMLookAtTypeName.d.ts +0 -8
  55. package/ts3.4/types/lookAt/helpers/VRMLookAtHelper.d.ts +0 -11
  56. package/ts3.4/types/lookAt/helpers/index.d.ts +0 -1
  57. package/ts3.4/types/lookAt/helpers/utils/FanBufferGeometry.d.ts +0 -13
  58. package/ts3.4/types/lookAt/helpers/utils/LineAndSphereBufferGeometry.d.ts +0 -13
  59. package/ts3.4/types/lookAt/index.d.ts +0 -8
  60. package/ts3.4/types/lookAt/tests/VRMLookAt.test.d.ts +0 -1
  61. package/ts3.4/types/lookAt/tests/VRMLookAtBoneApplier.test.d.ts +0 -1
  62. package/ts3.4/types/lookAt/utils/calcAzimuthAltitude.d.ts +0 -16
  63. package/ts3.4/types/lookAt/utils/sanitizeAngle.d.ts +0 -11
  64. package/ts3.4/types/lookAt/utils/tests/calcAzimuthAltitude.test.d.ts +0 -1
  65. package/ts3.4/types/lookAt/utils/tests/sanitizeAngle.test.d.ts +0 -1
  66. package/ts3.4/types/meta/VRM0Meta.d.ts +0 -62
  67. package/ts3.4/types/meta/VRM1Meta.d.ts +0 -86
  68. package/ts3.4/types/meta/VRMMeta.d.ts +0 -6
  69. package/ts3.4/types/meta/VRMMetaLoaderPlugin.d.ts +0 -32
  70. package/ts3.4/types/meta/VRMMetaLoaderPluginOptions.d.ts +0 -22
  71. package/ts3.4/types/meta/index.d.ts +0 -5
  72. package/ts3.4/types/tests/matchers/toBeCloseToQuaternion.d.ts +0 -10
  73. package/ts3.4/types/tests/matchers/toBeCloseToVector3.d.ts +0 -10
  74. package/ts3.4/types/utils/getWorldQuaternionLite.d.ts +0 -10
  75. package/ts3.4/types/utils/gltfExtractPrimitivesFromNode.d.ts +0 -22
  76. package/ts3.4/types/utils/gltfGetAssociatedMaterialIndex.d.ts +0 -10
  77. package/ts3.4/types/utils/quatInvertCompat.d.ts +0 -8
  78. package/ts3.4/types/utils/renameMaterialProperty.d.ts +0 -1
  79. package/ts3.4/types/utils/resolveURL.d.ts +0 -4
  80. package/ts3.4/types/utils/saturate.d.ts +0 -6
  81. package/types/lookAt/tests/VRMLookAt.test.d.ts +0 -1
  82. package/types/lookAt/tests/VRMLookAtBoneApplier.test.d.ts +0 -1
  83. package/types/lookAt/utils/tests/calcAzimuthAltitude.test.d.ts +0 -1
  84. package/types/lookAt/utils/tests/sanitizeAngle.test.d.ts +0 -1
  85. package/types/tests/matchers/toBeCloseToQuaternion.d.ts +0 -10
  86. package/types/tests/matchers/toBeCloseToVector3.d.ts +0 -10
@@ -1,2 +1,2 @@
1
- /*! (c) 2020-2024 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
2
- import*as e from"three";class t extends e.Object3D{get overrideBlinkAmount(){return"block"===this.overrideBlink?0<this.weight?1:0:"blend"===this.overrideBlink?this.weight:0}get overrideLookAtAmount(){return"block"===this.overrideLookAt?0<this.weight?1:0:"blend"===this.overrideLookAt?this.weight:0}get overrideMouthAmount(){return"block"===this.overrideMouth?0<this.weight?1:0:"blend"===this.overrideMouth?this.weight:0}constructor(e){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${e}`,this.expressionName=e,this.type="VRMExpression",this.visible=!1}addBind(e){this._binds.push(e)}applyWeight(e){var t;let i=this.isBinary?this.weight<=.5?0:1:this.weight;i*=null!==(t=null==e?void 0:e.multiplier)&&void 0!==t?t:1,this._binds.forEach((e=>e.applyWeight(i)))}clearAppliedWeight(){this._binds.forEach((e=>e.clearAppliedWeight()))}}function i(e,t,i,r){return new(i||(i=Promise))((function(o,n){function s(e){try{l(r.next(e))}catch(e){n(e)}}function a(e){try{l(r.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function r(e,t,i){var r,o;const n=e.parser.json,s=null===(r=n.nodes)||void 0===r?void 0:r[t];if(null==s)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${t}] of glTF but the node doesn't exist`),null;const a=s.mesh;if(null==a)return null;const l=null===(o=n.meshes)||void 0===o?void 0:o[a];if(null==l)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const h=l.primitives.length,u=[];return i.traverse((e=>{u.length<h&&e.isMesh&&u.push(e)})),u}function o(e,t){return i(this,void 0,void 0,(function*(){const i=yield e.parser.getDependency("node",t);return r(e,t,i)}))}function n(e){return i(this,void 0,void 0,(function*(){const t=yield e.parser.getDependencies("node"),i=new Map;return t.forEach(((t,o)=>{const n=r(e,o,t);null!=n&&i.set(o,n)})),i}))}function s(t,i){var r,o;let n=null;if(parseInt(e.REVISION,10)>=133)n=null!==(o=null===(r=t.associations.get(i))||void 0===r?void 0:r.materials)&&void 0!==o?o:null;else{const e=t.associations.get(i);"materials"===(null==e?void 0:e.type)&&(n=e.index)}return n}"function"==typeof SuppressedError&&SuppressedError;const a={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function l(e){return Math.max(Math.min(e,1),0)}class h{get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},t=new Set(Object.values(a));return Object.entries(this._expressionMap).forEach((([i,r])=>{t.has(i)&&(e[i]=r)})),e}get customExpressionMap(){const e={},t=new Set(Object.values(a));return Object.entries(this._expressionMap).forEach((([i,r])=>{t.has(i)||(e[i]=r)})),e}constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}copy(e){return this._expressions.concat().forEach((e=>{this.unregisterExpression(e)})),e._expressions.forEach((e=>{this.registerExpression(e)})),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return(new h).copy(this)}getExpression(e){var t;return null!==(t=this._expressionMap[e])&&void 0!==t?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);-1===t&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const i=this.getExpression(e);return null!==(t=null==i?void 0:i.weight)&&void 0!==t?t:null}setValue(e,t){const i=this.getExpression(e);i&&(i.weight=l(t))}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach((e=>{e.clearAppliedWeight()})),this._expressions.forEach((t=>{let i=1;const r=t.expressionName;-1!==this.blinkExpressionNames.indexOf(r)&&(i*=e.blink),-1!==this.lookAtExpressionNames.indexOf(r)&&(i*=e.lookAt),-1!==this.mouthExpressionNames.indexOf(r)&&(i*=e.mouth),t.applyWeight({multiplier:i})}))}_calculateWeightMultipliers(){let e=1,t=1,i=1;return this._expressions.forEach((r=>{e-=r.overrideBlinkAmount,t-=r.overrideLookAtAmount,i-=r.overrideMouthAmount})),e=Math.max(0,e),t=Math.max(0,t),i=Math.max(0,i),{blink:e,lookAt:t,mouth:i}}}const u={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},d={_Color:u.Color,_EmissionColor:u.EmissionColor,_ShadeColor:u.ShadeColor,_RimColor:u.RimColor,_OutlineColor:u.OutlineColor},p=new e.Color;class c{constructor({material:e,type:t,targetValue:i,targetAlpha:r}){this.material=e,this.type=t,this.targetValue=i,this.targetAlpha=null!=r?r:1;const o=this._initColorBindState(),n=this._initAlphaBindState();this._state={color:o,alpha:n}}applyWeight(e){const{color:t,alpha:i}=this._state;if(null!=t){const{propertyName:i,deltaValue:r}=t,o=this.material[i];null!=o&&o.add(p.copy(r).multiplyScalar(e))}if(null!=i){const{propertyName:t,deltaValue:r}=i;null!=this.material[t]&&(this.material[t]+=r*e)}}clearAppliedWeight(){const{color:e,alpha:t}=this._state;if(null!=e){const{propertyName:t,initialValue:i}=e,r=this.material[t];null!=r&&r.copy(i)}if(null!=t){const{propertyName:e,initialValue:i}=t;null!=this.material[e]&&(this.material[e]=i)}}_initColorBindState(){var t,i,r;const{material:o,type:n,targetValue:s}=this,a=this._getPropertyNameMap(),l=null!==(i=null===(t=null==a?void 0:a[n])||void 0===t?void 0:t[0])&&void 0!==i?i:null;if(null==l)return console.warn(`Tried to add a material color bind to the material ${null!==(r=o.name)&&void 0!==r?r:"(no name)"}, the type ${n} but the material or the type is not supported.`),null;const h=o[l].clone();return{propertyName:l,initialValue:h,deltaValue:new e.Color(s.r-h.r,s.g-h.g,s.b-h.b)}}_initAlphaBindState(){var e,t,i;const{material:r,type:o,targetAlpha:n}=this,s=this._getPropertyNameMap(),a=null!==(t=null===(e=null==s?void 0:s[o])||void 0===e?void 0:e[1])&&void 0!==t?t:null;if(null==a&&1!==n)return console.warn(`Tried to add a material alpha bind to the material ${null!==(i=r.name)&&void 0!==i?i:"(no name)"}, the type ${o} but the material or the type does not support alpha.`),null;if(null==a)return null;const l=r[a];return{propertyName:a,initialValue:l,deltaValue:n-l}}_getPropertyNameMap(){var e,t;return null!==(t=null===(e=Object.entries(c._propertyNameMapMap).find((([e])=>!0===this.material[e])))||void 0===e?void 0:e[1])&&void 0!==t?t:null}}c._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};class m{constructor({primitives:e,index:t,weight:i}){this.primitives=e,this.index=t,this.weight=i}applyWeight(e){this.primitives.forEach((t=>{var i;null!=(null===(i=t.morphTargetInfluences)||void 0===i?void 0:i[this.index])&&(t.morphTargetInfluences[this.index]+=this.weight*e)}))}clearAppliedWeight(){this.primitives.forEach((e=>{var t;null!=(null===(t=e.morphTargetInfluences)||void 0===t?void 0:t[this.index])&&(e.morphTargetInfluences[this.index]=0)}))}}const g=new e.Vector2;class f{constructor({material:e,scale:t,offset:i}){var r,o;this.material=e,this.scale=t,this.offset=i;const n=null===(r=Object.entries(f._propertyNamesMap).find((([t])=>!0===e[t])))||void 0===r?void 0:r[1];null==n?(console.warn(`Tried to add a texture transform bind to the material ${null!==(o=e.name)&&void 0!==o?o:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],n.forEach((r=>{var o;const n=null===(o=e[r])||void 0===o?void 0:o.clone();if(!n)return null;e[r]=n;const s=n.offset.clone(),a=n.repeat.clone(),l=i.clone().sub(s),h=t.clone().sub(a);this._properties.push({name:r,initialOffset:s,deltaOffset:l,initialScale:a,deltaScale:h})})))}applyWeight(e){this._properties.forEach((t=>{const i=this.material[t.name];void 0!==i&&(i.offset.add(g.copy(t.deltaOffset).multiplyScalar(e)),i.repeat.add(g.copy(t.deltaScale).multiplyScalar(e)))}))}clearAppliedWeight(){this._properties.forEach((e=>{const t=this.material[e.name];void 0!==t&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))}))}}f._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};const v=new Set(["1.0","1.0-beta"]);class y{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return i(this,void 0,void 0,(function*(){e.userData.vrmExpressionManager=yield this._import(e)}))}_import(e){return i(this,void 0,void 0,(function*(){const t=yield this._v1Import(e);if(t)return t;const i=yield this._v0Import(e);return i||null}))}_v1Import(r){var n,l;return i(this,void 0,void 0,(function*(){const u=this.parser.json;if(!(-1!==(null===(n=u.extensionsUsed)||void 0===n?void 0:n.indexOf("VRMC_vrm"))))return null;const d=null===(l=u.extensions)||void 0===l?void 0:l.VRMC_vrm;if(!d)return null;const p=d.specVersion;if(!v.has(p))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${p}"`),null;const g=d.expressions;if(!g)return null;const y=new Set(Object.values(a)),w=new Map;null!=g.preset&&Object.entries(g.preset).forEach((([e,t])=>{null!=t&&(y.has(e)?w.set(e,t):console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${e}" detected. Ignoring the expression`))})),null!=g.custom&&Object.entries(g.custom).forEach((([e,t])=>{y.has(e)?console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${e}". Ignoring the expression`):w.set(e,t)}));const x=new h;return yield Promise.all(Array.from(w.entries()).map((([n,a])=>i(this,void 0,void 0,(function*(){var l,h,u,d,p,g,v;const y=new t(n);if(r.scene.add(y),y.isBinary=null!==(l=a.isBinary)&&void 0!==l&&l,y.overrideBlink=null!==(h=a.overrideBlink)&&void 0!==h?h:"none",y.overrideLookAt=null!==(u=a.overrideLookAt)&&void 0!==u?u:"none",y.overrideMouth=null!==(d=a.overrideMouth)&&void 0!==d?d:"none",null===(p=a.morphTargetBinds)||void 0===p||p.forEach((e=>i(this,void 0,void 0,(function*(){var t;if(void 0===e.node||void 0===e.index)return;const i=yield o(r,e.node),n=e.index;i.every((e=>Array.isArray(e.morphTargetInfluences)&&n<e.morphTargetInfluences.length))?y.addBind(new m({primitives:i,index:n,weight:null!==(t=e.weight)&&void 0!==t?t:1})):console.warn(`VRMExpressionLoaderPlugin: ${a.name} attempts to index morph #${n} but not found.`)})))),a.materialColorBinds||a.textureTransformBinds){const t=[];r.scene.traverse((e=>{const i=e.material;i&&t.push(i)})),null===(g=a.materialColorBinds)||void 0===g||g.forEach((r=>i(this,void 0,void 0,(function*(){t.filter((e=>{const t=s(this.parser,e);return r.material===t})).forEach((t=>{y.addBind(new c({material:t,type:r.type,targetValue:(new e.Color).fromArray(r.targetValue),targetAlpha:r.targetValue[3]}))}))})))),null===(v=a.textureTransformBinds)||void 0===v||v.forEach((r=>i(this,void 0,void 0,(function*(){t.filter((e=>{const t=s(this.parser,e);return r.material===t})).forEach((t=>{var i,o;y.addBind(new f({material:t,offset:(new e.Vector2).fromArray(null!==(i=r.offset)&&void 0!==i?i:[0,0]),scale:(new e.Vector2).fromArray(null!==(o=r.scale)&&void 0!==o?o:[1,1])}))}))}))))}x.registerExpression(y)}))))),x}))}_v0Import(r){var n;return i(this,void 0,void 0,(function*(){const s=this.parser.json,a=null===(n=s.extensions)||void 0===n?void 0:n.VRM;if(!a)return null;const l=a.blendShapeMaster;if(!l)return null;const u=new h,p=l.blendShapeGroups;if(!p)return u;const g=new Set;return yield Promise.all(p.map((n=>i(this,void 0,void 0,(function*(){var a;const l=n.presetName,h=null!=l&&y.v0v1PresetNameMap[l]||null,p=null!=h?h:n.name;if(null==p)return void console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");if(g.has(p))return void console.warn(`VRMExpressionLoaderPlugin: An expression preset ${l} has duplicated entries. Ignoring the expression`);g.add(p);const v=new t(p);r.scene.add(v),v.isBinary=null!==(a=n.isBinary)&&void 0!==a&&a,n.binds&&n.binds.forEach((e=>i(this,void 0,void 0,(function*(){var t;if(void 0===e.mesh||void 0===e.index)return;const a=[];null===(t=s.nodes)||void 0===t||t.forEach(((t,i)=>{t.mesh===e.mesh&&a.push(i)}));const l=e.index;yield Promise.all(a.map((t=>i(this,void 0,void 0,(function*(){var i;const s=yield o(r,t);s.every((e=>Array.isArray(e.morphTargetInfluences)&&l<e.morphTargetInfluences.length))?v.addBind(new m({primitives:s,index:l,weight:.01*(null!==(i=e.weight)&&void 0!==i?i:100)})):console.warn(`VRMExpressionLoaderPlugin: ${n.name} attempts to index ${l}th morph but not found.`)})))))}))));const w=n.materialValues;w&&0!==w.length&&w.forEach((t=>{if(void 0===t.materialName||void 0===t.propertyName||void 0===t.targetValue)return;const i=[];r.scene.traverse((e=>{if(e.material){const r=e.material;Array.isArray(r)?i.push(...r.filter((e=>(e.name===t.materialName||e.name===t.materialName+" (Outline)")&&-1===i.indexOf(e)))):r.name===t.materialName&&-1===i.indexOf(r)&&i.push(r)}}));const o=t.propertyName;i.forEach((i=>{if("_MainTex_ST"===o){const r=new e.Vector2(t.targetValue[0],t.targetValue[1]),o=new e.Vector2(t.targetValue[2],t.targetValue[3]);return o.y=1-o.y-r.y,void v.addBind(new f({material:i,scale:r,offset:o}))}const r=d[o];r?v.addBind(new c({material:i,type:r,targetValue:(new e.Color).fromArray(t.targetValue),targetAlpha:t.targetValue[3]})):console.warn(o+" is not supported")}))})),u.registerExpression(v)}))))),u}))}}y.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};const w={None:"none",Block:"block",Blend:"blend"};class x{constructor(e,t){this._firstPersonOnlyLayer=x.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=x.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=t}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map((e=>({meshes:e.meshes.concat(),type:e.type}))),this}clone(){return new x(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=x.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=x.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this.meshAnnotations.forEach((e=>{e.meshes.forEach((t=>{"firstPersonOnly"===e.type?(t.layers.set(this._firstPersonOnlyLayer),t.traverse((e=>e.layers.set(this._firstPersonOnlyLayer)))):"thirdPersonOnly"===e.type?(t.layers.set(this._thirdPersonOnlyLayer),t.traverse((e=>e.layers.set(this._thirdPersonOnlyLayer)))):"auto"===e.type&&this._createHeadlessModel(t)}))})),this._initializedLayers=!0)}_excludeTriangles(e,t,i,r){let o=0;if(null!=t&&t.length>0)for(let n=0;n<e.length;n+=3){const s=e[n],a=e[n+1],l=e[n+2],h=t[s],u=i[s];if(h[0]>0&&r.includes(u[0]))continue;if(h[1]>0&&r.includes(u[1]))continue;if(h[2]>0&&r.includes(u[2]))continue;if(h[3]>0&&r.includes(u[3]))continue;const d=t[a],p=i[a];if(d[0]>0&&r.includes(p[0]))continue;if(d[1]>0&&r.includes(p[1]))continue;if(d[2]>0&&r.includes(p[2]))continue;if(d[3]>0&&r.includes(p[3]))continue;const c=t[l],m=i[l];c[0]>0&&r.includes(m[0])||(c[1]>0&&r.includes(m[1])||c[2]>0&&r.includes(m[2])||c[3]>0&&r.includes(m[3])||(e[o++]=s,e[o++]=a,e[o++]=l))}return o}_createErasedMesh(t,i){const r=new e.SkinnedMesh(t.geometry.clone(),t.material);r.name=`${t.name}(erase)`,r.frustumCulled=t.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const o=r.geometry,n=o.getAttribute("skinIndex"),s=n instanceof e.GLBufferAttribute?[]:n.array,a=[];for(let e=0;e<s.length;e+=4)a.push([s[e],s[e+1],s[e+2],s[e+3]]);const l=o.getAttribute("skinWeight"),h=l instanceof e.GLBufferAttribute?[]:l.array,u=[];for(let e=0;e<h.length;e+=4)u.push([h[e],h[e+1],h[e+2],h[e+3]]);const d=o.getIndex();if(!d)throw new Error("The geometry doesn't have an index buffer");const p=Array.from(d.array),c=this._excludeTriangles(p,u,a,i),m=[];for(let e=0;e<c;e++)m[e]=p[e];return o.setIndex(m),t.onBeforeRender&&(r.onBeforeRender=t.onBeforeRender),r.bind(new e.Skeleton(t.skeleton.bones,t.skeleton.boneInverses),new e.Matrix4),r}_createHeadlessModelForSkinnedMesh(e,t){const i=[];if(t.skeleton.bones.forEach(((e,t)=>{this._isEraseTarget(e)&&i.push(t)})),!i.length)return t.layers.enable(this._thirdPersonOnlyLayer),void t.layers.enable(this._firstPersonOnlyLayer);t.layers.set(this._thirdPersonOnlyLayer);const r=this._createErasedMesh(t,i);e.add(r)}_createHeadlessModel(t){if("Group"===t.type)if(t.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(t))t.traverse((e=>e.layers.set(this._thirdPersonOnlyLayer)));else{const i=new e.Group;i.name=`_headless_${t.name}`,i.layers.set(this._firstPersonOnlyLayer),t.parent.add(i),t.children.filter((e=>"SkinnedMesh"===e.type)).forEach((e=>{const t=e;this._createHeadlessModelForSkinnedMesh(i,t)}))}else if("SkinnedMesh"===t.type){const e=t;this._createHeadlessModelForSkinnedMesh(t.parent,e)}else this._isEraseTarget(t)&&(t.layers.set(this._thirdPersonOnlyLayer),t.traverse((e=>e.layers.set(this._thirdPersonOnlyLayer))))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")||!!e.parent&&this._isEraseTarget(e.parent)}}x.DEFAULT_FIRSTPERSON_ONLY_LAYER=9,x.DEFAULT_THIRDPERSON_ONLY_LAYER=10;const _=new Set(["1.0","1.0-beta"]);class M{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return i(this,void 0,void 0,(function*(){const t=e.userData.vrmHumanoid;if(null!==t){if(void 0===t)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");e.userData.vrmFirstPerson=yield this._import(e,t)}}))}_import(e,t){return i(this,void 0,void 0,(function*(){if(null==t)return null;const i=yield this._v1Import(e,t);if(i)return i;const r=yield this._v0Import(e,t);return r||null}))}_v1Import(e,t){var r,o;return i(this,void 0,void 0,(function*(){const i=this.parser.json;if(!(-1!==(null===(r=i.extensionsUsed)||void 0===r?void 0:r.indexOf("VRMC_vrm"))))return null;const s=null===(o=i.extensions)||void 0===o?void 0:o.VRMC_vrm;if(!s)return null;const a=s.specVersion;if(!_.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=s.firstPerson;if(!l)return null;const h=[],u=yield n(e);return Array.from(u.entries()).forEach((([e,t])=>{var i;const r=l.meshAnnotations?l.meshAnnotations.find((t=>t.node===e)):void 0;h.push({meshes:t,type:null!==(i=null==r?void 0:r.type)&&void 0!==i?i:"both"})})),new x(t,h)}))}_v0Import(e,t){var r;return i(this,void 0,void 0,(function*(){const i=this.parser.json,o=null===(r=i.extensions)||void 0===r?void 0:r.VRM;if(!o)return null;const s=o.firstPerson;if(!s)return null;const a=[],l=yield n(e);return Array.from(l.entries()).forEach((([e,t])=>{const r=i.nodes[e],o=s.meshAnnotations?s.meshAnnotations.find((e=>e.mesh===r.mesh)):void 0;a.push({meshes:t,type:this._convertV0FlagToV1Type(null==o?void 0:o.firstPersonFlag)})})),new x(t,a)}))}_convertV0FlagToV1Type(e){return"FirstPersonOnly"===e?"firstPersonOnly":"ThirdPersonOnly"===e?"thirdPersonOnly":"Auto"===e?"auto":"both"}}const R={Auto:"auto",Both:"both",ThirdPersonOnly:"thirdPersonOnly",FirstPersonOnly:"firstPersonOnly"},P=new e.Vector3,L=new e.Vector3,A=new e.Quaternion;class b extends e.Group{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach((t=>{const i=new e.AxesHelper(1);i.matrixAutoUpdate=!1,i.material.depthTest=!1,i.material.depthWrite=!1,this.add(i),this._boneAxesMap.set(t,i)}))}dispose(){Array.from(this._boneAxesMap.values()).forEach((e=>{e.geometry.dispose(),e.material.dispose()}))}updateMatrixWorld(e){Array.from(this._boneAxesMap.entries()).forEach((([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(P,A,L);const i=P.set(.1,.1,.1).divide(L);t.matrix.copy(e.node.matrixWorld).scale(i)})),super.updateMatrixWorld(e)}}const E=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],B={Hips:"hips",Spine:"spine",Chest:"chest",UpperChest:"upperChest",Neck:"neck",Head:"head",LeftEye:"leftEye",RightEye:"rightEye",Jaw:"jaw",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",LeftToes:"leftToes",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",RightToes:"rightToes",LeftShoulder:"leftShoulder",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightShoulder:"rightShoulder",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand",LeftThumbMetacarpal:"leftThumbMetacarpal",LeftThumbProximal:"leftThumbProximal",LeftThumbDistal:"leftThumbDistal",LeftIndexProximal:"leftIndexProximal",LeftIndexIntermediate:"leftIndexIntermediate",LeftIndexDistal:"leftIndexDistal",LeftMiddleProximal:"leftMiddleProximal",LeftMiddleIntermediate:"leftMiddleIntermediate",LeftMiddleDistal:"leftMiddleDistal",LeftRingProximal:"leftRingProximal",LeftRingIntermediate:"leftRingIntermediate",LeftRingDistal:"leftRingDistal",LeftLittleProximal:"leftLittleProximal",LeftLittleIntermediate:"leftLittleIntermediate",LeftLittleDistal:"leftLittleDistal",RightThumbMetacarpal:"rightThumbMetacarpal",RightThumbProximal:"rightThumbProximal",RightThumbDistal:"rightThumbDistal",RightIndexProximal:"rightIndexProximal",RightIndexIntermediate:"rightIndexIntermediate",RightIndexDistal:"rightIndexDistal",RightMiddleProximal:"rightMiddleProximal",RightMiddleIntermediate:"rightMiddleIntermediate",RightMiddleDistal:"rightMiddleDistal",RightRingProximal:"rightRingProximal",RightRingIntermediate:"rightRingIntermediate",RightRingDistal:"rightRingDistal",RightLittleProximal:"rightLittleProximal",RightLittleIntermediate:"rightLittleIntermediate",RightLittleDistal:"rightLittleDistal"},I={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function V(e){return e.invert?e.invert():e.inverse(),e}const k=new e.Vector3,U=new e.Quaternion;class T{constructor(e){this.humanBones=e,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const e={};return Object.keys(this.humanBones).forEach((t=>{const i=t,r=this.getBoneNode(i);r&&(k.copy(r.position),U.copy(r.quaternion),e[i]={position:k.toArray(),rotation:U.toArray()})})),e}getPose(){const e={};return Object.keys(this.humanBones).forEach((t=>{const i=t,r=this.getBoneNode(i);if(!r)return;k.set(0,0,0),U.identity();const o=this.restPose[i];(null==o?void 0:o.position)&&k.fromArray(o.position).negate(),(null==o?void 0:o.rotation)&&V(U.fromArray(o.rotation)),k.add(r.position),U.premultiply(r.quaternion),e[i]={position:k.toArray(),rotation:U.toArray()}})),e}setPose(e){Object.entries(e).forEach((([e,t])=>{const i=e,r=this.getBoneNode(i);if(!r)return;const o=this.restPose[i];o&&((null==t?void 0:t.position)&&(r.position.fromArray(t.position),o.position&&r.position.add(k.fromArray(o.position))),(null==t?void 0:t.rotation)&&(r.quaternion.fromArray(t.rotation),o.rotation&&r.quaternion.multiply(U.fromArray(o.rotation))))}))}resetPose(){Object.entries(this.restPose).forEach((([e,t])=>{const i=this.getBoneNode(e);i&&((null==t?void 0:t.position)&&i.position.fromArray(t.position),(null==t?void 0:t.rotation)&&i.quaternion.fromArray(t.rotation))}))}getBone(e){var t;return null!==(t=this.humanBones[e])&&void 0!==t?t:void 0}getBoneNode(e){var t,i;return null!==(i=null===(t=this.humanBones[e])||void 0===t?void 0:t.node)&&void 0!==i?i:null}}const D=new e.Vector3,H=new e.Quaternion,O=new e.Vector3;class N extends T{static _setupTransforms(t){const i=new e.Object3D;i.name="VRMHumanoidRig";const r={},o={},n={};E.forEach((i=>{var s;const a=t.getBoneNode(i);if(a){const t=new e.Vector3,l=new e.Quaternion;a.updateWorldMatrix(!0,!1),a.matrixWorld.decompose(t,l,D),r[i]=t,o[i]=a.quaternion.clone();const h=new e.Quaternion;null===(s=a.parent)||void 0===s||s.matrixWorld.decompose(D,h,D),n[i]=h}}));const s={};return E.forEach((o=>{var n;const a=t.getBoneNode(o);if(a){const t=r[o];let l,h=o;for(;null==l&&(h=I[h],null!=h);)l=r[h];const u=new e.Object3D;u.name="Normalized_"+a.name;(h?null===(n=s[h])||void 0===n?void 0:n.node:i).add(u),u.position.copy(t),l&&u.position.sub(l),s[o]={node:u}}})),{rigBones:s,root:i,parentWorldRotations:n,boneRotations:o}}constructor(e){const{rigBones:t,root:i,parentWorldRotations:r,boneRotations:o}=N._setupTransforms(e);super(t),this.original=e,this.root=i,this._parentWorldRotations=r,this._boneRotations=o}update(){E.forEach((e=>{const t=this.original.getBoneNode(e);if(null!=t){const i=this.getBoneNode(e),r=this._parentWorldRotations[e],o=H.copy(r).invert(),n=this._boneRotations[e];if(t.quaternion.copy(i.quaternion).multiply(r).premultiply(o).multiply(n),"hips"===e){const e=i.getWorldPosition(O);t.parent.updateWorldMatrix(!0,!1);const r=t.parent.matrixWorld,o=e.applyMatrix4(r.invert());t.position.copy(o)}}}))}}class F{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,t){var i;this.autoUpdateHumanBones=null===(i=null==t?void 0:t.autoUpdateHumanBones)||void 0===i||i,this._rawHumanBones=new T(e),this._normalizedHumanBones=new N(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new T(e.humanBones),this._normalizedHumanBones=new N(this._rawHumanBones),this}clone(){return new F(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}}const S={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},C=new Set(["1.0","1.0-beta"]),W={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"};class z{get name(){return"VRMHumanoidLoaderPlugin"}constructor(e,t){this.parser=e,this.helperRoot=null==t?void 0:t.helperRoot,this.autoUpdateHumanBones=null==t?void 0:t.autoUpdateHumanBones}afterRoot(e){return i(this,void 0,void 0,(function*(){e.userData.vrmHumanoid=yield this._import(e)}))}_import(e){return i(this,void 0,void 0,(function*(){const t=yield this._v1Import(e);if(t)return t;const i=yield this._v0Import(e);return i||null}))}_v1Import(e){var t,r;return i(this,void 0,void 0,(function*(){const o=this.parser.json;if(!(-1!==(null===(t=o.extensionsUsed)||void 0===t?void 0:t.indexOf("VRMC_vrm"))))return null;const n=null===(r=o.extensions)||void 0===r?void 0:r.VRMC_vrm;if(!n)return null;const s=n.specVersion;if(!C.has(s))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${s}"`),null;const a=n.humanoid;if(!a)return null;const l=null!=a.humanBones.leftThumbIntermediate||null!=a.humanBones.rightThumbIntermediate,h={};null!=a.humanBones&&(yield Promise.all(Object.entries(a.humanBones).map((([e,t])=>i(this,void 0,void 0,(function*(){let i=e;const r=t.node;if(l){const e=W[i];null!=e&&(i=e)}const o=yield this.parser.getDependency("node",r);null!=o?h[i]={node:o}:console.warn(`A glTF node bound to the humanoid bone ${i} (index = ${r}) does not exist`)}))))));const u=new F(this._ensureRequiredBonesExist(h),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(u.normalizedHumanBonesRoot),this.helperRoot){const e=new b(u);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return u}))}_v0Import(e){var t;return i(this,void 0,void 0,(function*(){const r=this.parser.json,o=null===(t=r.extensions)||void 0===t?void 0:t.VRM;if(!o)return null;const n=o.humanoid;if(!n)return null;const s={};null!=n.humanBones&&(yield Promise.all(n.humanBones.map((e=>i(this,void 0,void 0,(function*(){const t=e.bone,i=e.node;if(null==t||null==i)return;const r=yield this.parser.getDependency("node",i);if(null==r)return void console.warn(`A glTF node bound to the humanoid bone ${t} (index = ${i}) does not exist`);const o=W[t],n=null!=o?o:t;null==s[n]?s[n]={node:r}:console.warn(`Multiple bone entries for ${n} detected (index = ${i}), ignoring duplicated entries.`)}))))));const a=new F(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(a.normalizedHumanBonesRoot),this.helperRoot){const e=new b(a);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return a}))}_ensureRequiredBonesExist(e){const t=Object.values(S).filter((t=>null==e[t]));if(t.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${t.join(", ")}`);return e}}class Q extends e.BufferGeometry{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new e.BufferAttribute(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new e.BufferAttribute(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,e=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),e&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let e=0;e<64;e++){const t=e/63*this._currentTheta;this._attrPos.setXYZ(e+1,this._currentRadius*Math.sin(t),0,this._currentRadius*Math.cos(t))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<63;e++)this._attrIndex.setXYZ(3*e,0,e+1,e+2);this._attrIndex.needsUpdate=!0}}class Y extends e.BufferGeometry{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new e.Vector3,this._currentTail=new e.Vector3,this._attrPos=new e.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new e.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(2*e,e,t),this._attrIndex.setXY(64+2*e,32+e,32+t),this._attrIndex.setXY(128+2*e,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const j=new e.Quaternion,$=new e.Quaternion,q=new e.Vector3,G=new e.Vector3,X=Math.sqrt(2)/2,Z=new e.Quaternion(0,0,-X,X),J=new e.Vector3(0,1,0);class K extends e.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const t=new Q;t.radius=.5;const i=new e.MeshBasicMaterial({color:65280,transparent:!0,opacity:.5,side:e.DoubleSide,depthTest:!1,depthWrite:!1});this._meshPitch=new e.Mesh(t,i),this.add(this._meshPitch)}{const t=new Q;t.radius=.5;const i=new e.MeshBasicMaterial({color:16711680,transparent:!0,opacity:.5,side:e.DoubleSide,depthTest:!1,depthWrite:!1});this._meshYaw=new e.Mesh(t,i),this.add(this._meshYaw)}{const t=new Y;t.radius=.1;const i=new e.LineBasicMaterial({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new e.LineSegments(t,i),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(t){const i=e.MathUtils.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=i,this._meshYaw.geometry.update();const r=e.MathUtils.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=r,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(q),this.vrmLookAt.getLookAtWorldQuaternion(j),j.multiply(this.vrmLookAt.getFaceFrontQuaternion($)),this._meshYaw.position.copy(q),this._meshYaw.quaternion.copy(j),this._meshPitch.position.copy(q),this._meshPitch.quaternion.copy(j),this._meshPitch.quaternion.multiply($.setFromAxisAngle(J,i)),this._meshPitch.quaternion.multiply(Z);const{target:o,autoUpdate:n}=this.vrmLookAt;null!=o&&n&&(o.getWorldPosition(G).sub(q),this._lineTarget.geometry.tail.copy(G),this._lineTarget.geometry.update(),this._lineTarget.position.copy(q)),super.updateMatrixWorld(t)}}const ee=new e.Vector3,te=new e.Vector3;function ie(e,t){return e.matrixWorld.decompose(ee,t,te),t}function re(e){return[Math.atan2(-e.z,e.x),Math.atan2(e.y,Math.sqrt(e.x*e.x+e.z*e.z))]}function oe(e){const t=Math.round(e/2/Math.PI);return e-2*Math.PI*t}const ne=new e.Vector3(0,0,1),se=new e.Vector3,ae=new e.Vector3,le=new e.Vector3,he=new e.Quaternion,ue=new e.Quaternion,de=new e.Quaternion,pe=new e.Quaternion,ce=new e.Euler;class me{get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new e.Euler)}constructor(t,i){this.offsetFromHeadBone=new e.Vector3,this.autoUpdate=!0,this.faceFront=new e.Vector3(0,0,1),this.humanoid=t,this.applier=i,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new e.Quaternion)}getEuler(t){return t.set(e.MathUtils.DEG2RAD*this._pitch,e.MathUtils.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new me(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const t=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){return ie(this.humanoid.getRawBoneNode("head"),e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(ne)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,i]=re(this.faceFront);return ce.set(0,.5*Math.PI+t,i,"YZX"),e.setFromEuler(ce).premultiply(pe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(ue),this.getFaceFrontQuaternion(de),e.copy(ne).applyQuaternion(ue).applyQuaternion(de).applyEuler(this.getEuler(ce))}lookAt(t){const i=he.copy(this._restHeadWorldQuaternion).multiply(V(this.getLookAtWorldQuaternion(ue))),r=this.getLookAtWorldPosition(ae),o=le.copy(t).sub(r).applyQuaternion(i).normalize(),[n,s]=re(this.faceFront),[a,l]=re(o),h=oe(a-n),u=oe(s-l);this._yaw=e.MathUtils.RAD2DEG*h,this._pitch=e.MathUtils.RAD2DEG*u,this._needsUpdate=!0}update(e){null!=this.target&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(se)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}}me.EULER_ORDER="YXZ";const ge=new e.Vector3(0,0,1),fe=new e.Quaternion,ve=new e.Quaternion,ye=new e.Euler(0,0,0,"YXZ");class we{constructor(t,i,r,o,n){this.humanoid=t,this.rangeMapHorizontalInner=i,this.rangeMapHorizontalOuter=r,this.rangeMapVerticalDown=o,this.rangeMapVerticalUp=n,this.faceFront=new e.Vector3(0,0,1),this._restQuatLeftEye=new e.Quaternion,this._restQuatRightEye=new e.Quaternion,this._restLeftEyeParentWorldQuat=new e.Quaternion,this._restRightEyeParentWorldQuat=new e.Quaternion;const s=this.humanoid.getRawBoneNode("leftEye"),a=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),ie(s.parent,this._restLeftEyeParentWorldQuat)),a&&(this._restQuatRightEye.copy(a.quaternion),ie(a.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,i){const r=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye"),n=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");r&&(ye.x=i<0?-e.MathUtils.DEG2RAD*this.rangeMapVerticalDown.map(-i):e.MathUtils.DEG2RAD*this.rangeMapVerticalUp.map(i),ye.y=t<0?-e.MathUtils.DEG2RAD*this.rangeMapHorizontalInner.map(-t):e.MathUtils.DEG2RAD*this.rangeMapHorizontalOuter.map(t),fe.setFromEuler(ye),this._getWorldFaceFrontQuat(ve),n.quaternion.copy(ve).multiply(fe).multiply(ve.invert()),fe.copy(this._restLeftEyeParentWorldQuat),r.quaternion.copy(n.quaternion).multiply(fe).premultiply(fe.invert()).multiply(this._restQuatLeftEye)),o&&(ye.x=i<0?-e.MathUtils.DEG2RAD*this.rangeMapVerticalDown.map(-i):e.MathUtils.DEG2RAD*this.rangeMapVerticalUp.map(i),ye.y=t<0?-e.MathUtils.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):e.MathUtils.DEG2RAD*this.rangeMapHorizontalInner.map(t),fe.setFromEuler(ye),this._getWorldFaceFrontQuat(ve),s.quaternion.copy(ve).multiply(fe).multiply(ve.invert()),fe.copy(this._restRightEyeParentWorldQuat),o.quaternion.copy(s.quaternion).multiply(fe).premultiply(fe.invert()).multiply(this._restQuatRightEye))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const i=e.MathUtils.RAD2DEG*t.y,r=e.MathUtils.RAD2DEG*t.x;this.applyYawPitch(i,r)}_getWorldFaceFrontQuat(e){if(this.faceFront.distanceToSquared(ge)<.01)return e.identity();const[t,i]=re(this.faceFront);return ye.set(0,.5*Math.PI+t,i,"YZX"),e.setFromEuler(ye)}}we.type="bone";class xe{constructor(e,t,i,r,o){this.expressions=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=i,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=o}applyYawPitch(e,t){t<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-t))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(t))),e<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-e))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(e)))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const i=e.MathUtils.RAD2DEG*t.y,r=e.MathUtils.RAD2DEG*t.x;this.applyYawPitch(i,r)}}xe.type="expression";class _e{constructor(e,t){this.inputMaxValue=e,this.outputScale=t}map(e){return this.outputScale*l(e/this.inputMaxValue)}}const Me=new Set(["1.0","1.0-beta"]);class Re{get name(){return"VRMLookAtLoaderPlugin"}constructor(e,t){this.parser=e,this.helperRoot=null==t?void 0:t.helperRoot}afterRoot(e){return i(this,void 0,void 0,(function*(){const t=e.userData.vrmHumanoid;if(null===t)return;if(void 0===t)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const i=e.userData.vrmExpressionManager;if(null!==i){if(void 0===i)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");e.userData.vrmLookAt=yield this._import(e,t,i)}}))}_import(e,t,r){return i(this,void 0,void 0,(function*(){if(null==t||null==r)return null;const i=yield this._v1Import(e,t,r);if(i)return i;const o=yield this._v0Import(e,t,r);return o||null}))}_v1Import(e,t,r){var o,n,s;return i(this,void 0,void 0,(function*(){const e=this.parser.json;if(!(-1!==(null===(o=e.extensionsUsed)||void 0===o?void 0:o.indexOf("VRMC_vrm"))))return null;const i=null===(n=e.extensions)||void 0===n?void 0:n.VRMC_vrm;if(!i)return null;const a=i.specVersion;if(!Me.has(a))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=i.lookAt;if(!l)return null;const h="expression"===l.type?1:10,u=this._v1ImportRangeMap(l.rangeMapHorizontalInner,h),d=this._v1ImportRangeMap(l.rangeMapHorizontalOuter,h),p=this._v1ImportRangeMap(l.rangeMapVerticalDown,h),c=this._v1ImportRangeMap(l.rangeMapVerticalUp,h);let m;m="expression"===l.type?new xe(r,u,d,p,c):new we(t,u,d,p,c);const g=this._importLookAt(t,m);return g.offsetFromHeadBone.fromArray(null!==(s=l.offsetFromHeadBone)&&void 0!==s?s:[0,.06,0]),g}))}_v1ImportRangeMap(e,t){var i,r;let o=null!==(i=null==e?void 0:e.inputMaxValue)&&void 0!==i?i:90;const n=null!==(r=null==e?void 0:e.outputScale)&&void 0!==r?r:t;return o<.01&&(console.warn("VRMLookAtLoaderPlugin: inputMaxValue of a range map is too small. Consider reviewing the range map!"),o=.01),new _e(o,n)}_v0Import(e,t,r){var o,n,s,a;return i(this,void 0,void 0,(function*(){const e=this.parser.json,i=null===(o=e.extensions)||void 0===o?void 0:o.VRM;if(!i)return null;const l=i.firstPerson;if(!l)return null;const h="BlendShape"===l.lookAtTypeName?1:10,u=this._v0ImportDegreeMap(l.lookAtHorizontalInner,h),d=this._v0ImportDegreeMap(l.lookAtHorizontalOuter,h),p=this._v0ImportDegreeMap(l.lookAtVerticalDown,h),c=this._v0ImportDegreeMap(l.lookAtVerticalUp,h);let m;m="BlendShape"===l.lookAtTypeName?new xe(r,u,d,p,c):new we(t,u,d,p,c);const g=this._importLookAt(t,m);return l.firstPersonBoneOffset?g.offsetFromHeadBone.set(null!==(n=l.firstPersonBoneOffset.x)&&void 0!==n?n:0,null!==(s=l.firstPersonBoneOffset.y)&&void 0!==s?s:.06,-(null!==(a=l.firstPersonBoneOffset.z)&&void 0!==a?a:0)):g.offsetFromHeadBone.set(0,.06,0),g.faceFront.set(0,0,-1),m instanceof we&&m.faceFront.set(0,0,-1),g}))}_v0ImportDegreeMap(e,t){var i,r;const o=null==e?void 0:e.curve;"[0,0,0,1,1,1,1,0]"!==JSON.stringify(o)&&console.warn("Curves of LookAtDegreeMap defined in VRM 0.0 are not supported");let n=null!==(i=null==e?void 0:e.xRange)&&void 0!==i?i:90;const s=null!==(r=null==e?void 0:e.yRange)&&void 0!==r?r:t;return n<.01&&(console.warn("VRMLookAtLoaderPlugin: xRange of a degree map is too small. Consider reviewing the degree map!"),n=.01),new _e(n,s)}_importLookAt(e,t){const i=new me(e,t);if(this.helperRoot){const e=new K(i);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return i}}const Pe={Bone:"bone",Expression:"expression"};const Le=new Set(["1.0","1.0-beta"]);class Ae{get name(){return"VRMMetaLoaderPlugin"}constructor(e,t){var i,r,o;this.parser=e,this.needThumbnailImage=null===(i=null==t?void 0:t.needThumbnailImage)||void 0===i||i,this.acceptLicenseUrls=null!==(r=null==t?void 0:t.acceptLicenseUrls)&&void 0!==r?r:["https://vrm.dev/licenses/1.0/"],this.acceptV0Meta=null===(o=null==t?void 0:t.acceptV0Meta)||void 0===o||o}afterRoot(e){return i(this,void 0,void 0,(function*(){e.userData.vrmMeta=yield this._import(e)}))}_import(e){return i(this,void 0,void 0,(function*(){const t=yield this._v1Import(e);if(null!=t)return t;const i=yield this._v0Import(e);return null!=i?i:null}))}_v1Import(e){var t,r,o;return i(this,void 0,void 0,(function*(){const e=this.parser.json;if(!(-1!==(null===(t=e.extensionsUsed)||void 0===t?void 0:t.indexOf("VRMC_vrm"))))return null;const i=null===(r=e.extensions)||void 0===r?void 0:r.VRMC_vrm;if(null==i)return null;const n=i.specVersion;if(!Le.has(n))return console.warn(`VRMMetaLoaderPlugin: Unknown VRMC_vrm specVersion "${n}"`),null;const s=i.meta;if(!s)return null;const a=s.licenseUrl;if(!new Set(this.acceptLicenseUrls).has(a))throw new Error(`VRMMetaLoaderPlugin: The license url "${a}" is not accepted`);let l;return this.needThumbnailImage&&null!=s.thumbnailImage&&(l=null!==(o=yield this._extractGLTFImage(s.thumbnailImage))&&void 0!==o?o:void 0),{metaVersion:"1",name:s.name,version:s.version,authors:s.authors,copyrightInformation:s.copyrightInformation,contactInformation:s.contactInformation,references:s.references,thirdPartyLicenses:s.thirdPartyLicenses,thumbnailImage:l,licenseUrl:s.licenseUrl,avatarPermission:s.avatarPermission,allowExcessivelyViolentUsage:s.allowExcessivelyViolentUsage,allowExcessivelySexualUsage:s.allowExcessivelySexualUsage,commercialUsage:s.commercialUsage,allowPoliticalOrReligiousUsage:s.allowPoliticalOrReligiousUsage,allowAntisocialOrHateUsage:s.allowAntisocialOrHateUsage,creditNotation:s.creditNotation,allowRedistribution:s.allowRedistribution,modification:s.modification,otherLicenseUrl:s.otherLicenseUrl}}))}_v0Import(e){var t;return i(this,void 0,void 0,(function*(){const e=this.parser.json,i=null===(t=e.extensions)||void 0===t?void 0:t.VRM;if(!i)return null;const r=i.meta;if(!r)return null;if(!this.acceptV0Meta)throw new Error("VRMMetaLoaderPlugin: Attempted to load VRM0.0 meta but acceptV0Meta is false");let o;return this.needThumbnailImage&&null!=r.texture&&-1!==r.texture&&(o=yield this.parser.getDependency("texture",r.texture)),{metaVersion:"0",allowedUserName:r.allowedUserName,author:r.author,commercialUssageName:r.commercialUssageName,contactInformation:r.contactInformation,licenseName:r.licenseName,otherLicenseUrl:r.otherLicenseUrl,otherPermissionUrl:r.otherPermissionUrl,reference:r.reference,sexualUssageName:r.sexualUssageName,texture:null!=o?o:void 0,title:r.title,version:r.version,violentUssageName:r.violentUssageName}}))}_extractGLTFImage(t){var r;return i(this,void 0,void 0,(function*(){const i=this.parser.json,o=null===(r=i.images)||void 0===r?void 0:r[t];if(null==o)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image doesn't exist`),null;let n=o.uri;if(null!=o.bufferView){const e=yield this.parser.getDependency("bufferView",o.bufferView),t=new Blob([e],{type:o.mimeType});n=URL.createObjectURL(t)}if(null==n)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image couldn't load properly`),null;const s=new e.ImageLoader;return yield s.loadAsync((a=n,l=this.parser.options.path,"string"!=typeof a||""===a?"":(/^https?:\/\//i.test(l)&&/^\//.test(a)&&(l=l.replace(/(^https?:\/\/[^/]+).*/i,"$1")),/^(https?:)?\/\//i.test(a)||/^data:.*,.*$/i.test(a)||/^blob:.*$/i.test(a)?a:l+a))).catch((e=>(console.error(e),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null)));var a,l}))}}class be{constructor(e){this.scene=e.scene,this.meta=e.meta,this.humanoid=e.humanoid,this.expressionManager=e.expressionManager,this.firstPerson=e.firstPerson,this.lookAt=e.lookAt}update(e){this.humanoid.update(),this.lookAt&&this.lookAt.update(e),this.expressionManager&&this.expressionManager.update()}}class Ee{get name(){return"VRMC_vrm"}constructor(e,t){var i,r,o,n,s;this.parser=e;const a=null==t?void 0:t.helperRoot,l=null==t?void 0:t.autoUpdateHumanBones;this.expressionPlugin=null!==(i=null==t?void 0:t.expressionPlugin)&&void 0!==i?i:new y(e),this.firstPersonPlugin=null!==(r=null==t?void 0:t.firstPersonPlugin)&&void 0!==r?r:new M(e),this.humanoidPlugin=null!==(o=null==t?void 0:t.humanoidPlugin)&&void 0!==o?o:new z(e,{helperRoot:a,autoUpdateHumanBones:l}),this.lookAtPlugin=null!==(n=null==t?void 0:t.lookAtPlugin)&&void 0!==n?n:new Re(e,{helperRoot:a}),this.metaPlugin=null!==(s=null==t?void 0:t.metaPlugin)&&void 0!==s?s:new Ae(e)}afterRoot(e){return i(this,void 0,void 0,(function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e);const t=e.userData.vrmMeta,i=e.userData.vrmHumanoid;if(t&&i){const r=new be({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:i,lookAt:e.userData.vrmLookAt,meta:t});e.userData.vrmCore=r}}))}}export{be as VRMCore,Ee as VRMCoreLoaderPlugin,t as VRMExpression,y as VRMExpressionLoaderPlugin,h as VRMExpressionManager,c as VRMExpressionMaterialColorBind,u as VRMExpressionMaterialColorType,m as VRMExpressionMorphTargetBind,w as VRMExpressionOverrideType,a as VRMExpressionPresetName,f as VRMExpressionTextureTransformBind,x as VRMFirstPerson,M as VRMFirstPersonLoaderPlugin,R as VRMFirstPersonMeshAnnotationType,E as VRMHumanBoneList,B as VRMHumanBoneName,I as VRMHumanBoneParentMap,F as VRMHumanoid,b as VRMHumanoidHelper,z as VRMHumanoidLoaderPlugin,me as VRMLookAt,we as VRMLookAtBoneApplier,xe as VRMLookAtExpressionApplier,K as VRMLookAtHelper,Re as VRMLookAtLoaderPlugin,_e as VRMLookAtRangeMap,Pe as VRMLookAtTypeName,Ae as VRMMetaLoaderPlugin,S as VRMRequiredHumanBoneName};
1
+ /*! (c) 2019-2024 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
2
+ var R=(u,e,t)=>new Promise((r,o)=>{var n=s=>{try{a(t.next(s))}catch(l){o(l)}},i=s=>{try{a(t.throw(s))}catch(l){o(l)}},a=s=>s.done?r(s.value):Promise.resolve(s.value).then(n,i);a((t=t.apply(u,e)).next())});import*as Ce from"three";var Q=class extends Ce.Object3D{constructor(t){super();this.weight=0;this.isBinary=!1;this.overrideBlink="none";this.overrideLookAt="none";this.overrideMouth="none";this._binds=[];this.name=`VRMExpression_${t}`,this.expressionName=t,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return this.overrideBlink==="block"?0<this.weight?1:0:this.overrideBlink==="blend"?this.weight:0}get overrideLookAtAmount(){return this.overrideLookAt==="block"?0<this.weight?1:0:this.overrideLookAt==="blend"?this.weight:0}get overrideMouthAmount(){return this.overrideMouth==="block"?0<this.weight?1:0:this.overrideMouth==="blend"?this.weight:0}addBind(t){this._binds.push(t)}applyWeight(t){var o;let r=this.isBinary?this.weight<=.5?0:1:this.weight;r*=(o=t==null?void 0:t.multiplier)!=null?o:1,this._binds.forEach(n=>n.applyWeight(r))}clearAppliedWeight(){this._binds.forEach(t=>t.clearAppliedWeight())}};import*as O from"three";function We(u,e,t){var l,d;let r=u.parser.json,o=(l=r.nodes)==null?void 0:l[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;let n=o.mesh;if(n==null)return null;let i=(d=r.meshes)==null?void 0:d[n];if(i==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${n}] of glTF but the mesh doesn't exist`),null;let a=i.primitives.length,s=[];return t.traverse(c=>{s.length<a&&c.isMesh&&s.push(c)}),s}function _e(u,e){return R(this,null,function*(){let t=yield u.parser.getDependency("node",e);return We(u,e,t)})}function Ae(u){return R(this,null,function*(){let e=yield u.parser.getDependencies("node"),t=new Map;return e.forEach((r,o)=>{let n=We(u,o,r);n!=null&&t.set(o,n)}),t})}import*as je from"three";function we(u,e){var o,n;let t=parseInt(je.REVISION,10),r=null;if(t>=133)r=(n=(o=u.associations.get(e))==null?void 0:o.materials)!=null?n:null;else{let a=u.associations.get(e);(a==null?void 0:a.type)==="materials"&&(r=a.index)}return r}var z={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function Ee(u){return Math.max(Math.min(u,1),0)}var q=class u{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"];this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"];this.mouthExpressionNames=["aa","ee","ih","oh","ou"];this._expressions=[];this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){let e={},t=new Set(Object.values(z));return Object.entries(this._expressionMap).forEach(([r,o])=>{t.has(r)&&(e[r]=o)}),e}get customExpressionMap(){let e={},t=new Set(Object.values(z));return Object.entries(this._expressionMap).forEach(([r,o])=>{t.has(r)||(e[r]=o)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new u().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!=null?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){let t=this._expressions.indexOf(e);t===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var r;let t=this.getExpression(e);return(r=t==null?void 0:t.weight)!=null?r:null}setValue(e,t){let r=this.getExpression(e);r&&(r.weight=Ee(t))}getExpressionTrackName(e){let t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){let e=this._calculateWeightMultipliers();this._expressions.forEach(t=>{t.clearAppliedWeight()}),this._expressions.forEach(t=>{let r=1,o=t.expressionName;this.blinkExpressionNames.indexOf(o)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(o)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(o)!==-1&&(r*=e.mouth),t.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,t=1,r=1;return this._expressions.forEach(o=>{e-=o.overrideBlinkAmount,t-=o.overrideLookAtAmount,r-=o.overrideMouthAmount}),e=Math.max(0,e),t=Math.max(0,t),r=Math.max(0,r),{blink:e,lookAt:t,mouth:r}}};var Y={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},Qe={_Color:Y.Color,_EmissionColor:Y.EmissionColor,_ShadeColor:Y.ShadeColor,_RimColor:Y.RimColor,_OutlineColor:Y.OutlineColor};import*as ve from"three";var nt=new ve.Color,ge=class ge{constructor({material:e,type:t,targetValue:r,targetAlpha:o}){this.material=e,this.type=t,this.targetValue=r,this.targetAlpha=o!=null?o:1;let n=this._initColorBindState(),i=this._initAlphaBindState();this._state={color:n,alpha:i}}applyWeight(e){let{color:t,alpha:r}=this._state;if(t!=null){let{propertyName:o,deltaValue:n}=t,i=this.material[o];i!=null&&i.add(nt.copy(n).multiplyScalar(e))}if(r!=null){let{propertyName:o,deltaValue:n}=r;this.material[o]!=null&&(this.material[o]+=n*e)}}clearAppliedWeight(){let{color:e,alpha:t}=this._state;if(e!=null){let{propertyName:r,initialValue:o}=e,n=this.material[r];n!=null&&n.copy(o)}if(t!=null){let{propertyName:r,initialValue:o}=t;this.material[r]!=null&&(this.material[r]=o)}}_initColorBindState(){var l,d,c;let{material:e,type:t,targetValue:r}=this,o=this._getPropertyNameMap(),n=(d=(l=o==null?void 0:o[t])==null?void 0:l[0])!=null?d:null;if(n==null)return console.warn(`Tried to add a material color bind to the material ${(c=e.name)!=null?c:"(no name)"}, the type ${t} but the material or the type is not supported.`),null;let a=e[n].clone(),s=new ve.Color(r.r-a.r,r.g-a.g,r.b-a.b);return{propertyName:n,initialValue:a,deltaValue:s}}_initAlphaBindState(){var s,l,d;let{material:e,type:t,targetAlpha:r}=this,o=this._getPropertyNameMap(),n=(l=(s=o==null?void 0:o[t])==null?void 0:s[1])!=null?l:null;if(n==null&&r!==1)return console.warn(`Tried to add a material alpha bind to the material ${(d=e.name)!=null?d:"(no name)"}, the type ${t} but the material or the type does not support alpha.`),null;if(n==null)return null;let i=e[n],a=r-i;return{propertyName:n,initialValue:i,deltaValue:a}}_getPropertyNameMap(){var e,t;return(t=(e=Object.entries(ge._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?t:null}};ge._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var $=ge;var X=class{constructor({primitives:e,index:t,weight:r}){this.primitives=e,this.index=t,this.weight=r}applyWeight(e){this.primitives.forEach(t=>{var r;((r=t.morphTargetInfluences)==null?void 0:r[this.index])!=null&&(t.morphTargetInfluences[this.index]+=this.weight*e)})}clearAppliedWeight(){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]=0)})}};import*as qe from"three";var ze=new qe.Vector2,Ve=class Ve{constructor({material:e,scale:t,offset:r}){var n,i;this.material=e,this.scale=t,this.offset=r;let o=(n=Object.entries(Ve._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:n[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(i=e.name)!=null?i:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var m;let s=(m=e[a])==null?void 0:m.clone();if(!s)return null;e[a]=s;let l=s.offset.clone(),d=s.repeat.clone(),c=r.clone().sub(l),p=t.clone().sub(d);this._properties.push({name:a,initialOffset:l,deltaOffset:c,initialScale:d,deltaScale:p})}))}applyWeight(e){this._properties.forEach(t=>{let r=this.material[t.name];r!==void 0&&(r.offset.add(ze.copy(t.deltaOffset).multiplyScalar(e)),r.repeat.add(ze.copy(t.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{let t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))})}};Ve._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var Z=Ve;var it=new Set(["1.0","1.0-beta"]),ye=class ye{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return R(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return R(this,null,function*(){let t=yield this._v1Import(e);if(t)return t;let r=yield this._v0Import(e);return r||null})}_v1Import(e){return R(this,null,function*(){var d,c;let t=this.parser.json;if(!(((d=t.extensionsUsed)==null?void 0:d.indexOf("VRMC_vrm"))!==-1))return null;let o=(c=t.extensions)==null?void 0:c.VRMC_vrm;if(!o)return null;let n=o.specVersion;if(!it.has(n))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${n}"`),null;let i=o.expressions;if(!i)return null;let a=new Set(Object.values(z)),s=new Map;i.preset!=null&&Object.entries(i.preset).forEach(([p,m])=>{if(m!=null){if(!a.has(p)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${p}" detected. Ignoring the expression`);return}s.set(p,m)}}),i.custom!=null&&Object.entries(i.custom).forEach(([p,m])=>{if(a.has(p)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${p}". Ignoring the expression`);return}s.set(p,m)});let l=new q;return yield Promise.all(Array.from(s.entries()).map(M=>R(this,[M],function*([p,m]){var f,y,x,_,T,b,k;let h=new Q(p);if(e.scene.add(h),h.isBinary=(f=m.isBinary)!=null?f:!1,h.overrideBlink=(y=m.overrideBlink)!=null?y:"none",h.overrideLookAt=(x=m.overrideLookAt)!=null?x:"none",h.overrideMouth=(_=m.overrideMouth)!=null?_:"none",(T=m.morphTargetBinds)==null||T.forEach(L=>R(this,null,function*(){var v;if(L.node===void 0||L.index===void 0)return;let H=yield _e(e,L.node),U=L.index;if(!H.every(F=>Array.isArray(F.morphTargetInfluences)&&U<F.morphTargetInfluences.length)){console.warn(`VRMExpressionLoaderPlugin: ${m.name} attempts to index morph #${U} but not found.`);return}h.addBind(new X({primitives:H,index:U,weight:(v=L.weight)!=null?v:1}))})),m.materialColorBinds||m.textureTransformBinds){let L=[];e.scene.traverse(H=>{let U=H.material;U&&L.push(U)}),(b=m.materialColorBinds)==null||b.forEach(H=>R(this,null,function*(){L.filter(v=>{let F=we(this.parser,v);return H.material===F}).forEach(v=>{h.addBind(new $({material:v,type:H.type,targetValue:new O.Color().fromArray(H.targetValue),targetAlpha:H.targetValue[3]}))})})),(k=m.textureTransformBinds)==null||k.forEach(H=>R(this,null,function*(){L.filter(v=>{let F=we(this.parser,v);return H.material===F}).forEach(v=>{var F,Ge;h.addBind(new Z({material:v,offset:new O.Vector2().fromArray((F=H.offset)!=null?F:[0,0]),scale:new O.Vector2().fromArray((Ge=H.scale)!=null?Ge:[1,1])}))})}))}l.registerExpression(h)}))),l})}_v0Import(e){return R(this,null,function*(){var s;let t=this.parser.json,r=(s=t.extensions)==null?void 0:s.VRM;if(!r)return null;let o=r.blendShapeMaster;if(!o)return null;let n=new q,i=o.blendShapeGroups;if(!i)return n;let a=new Set;return yield Promise.all(i.map(l=>R(this,null,function*(){var h;let d=l.presetName,c=d!=null&&ye.v0v1PresetNameMap[d]||null,p=c!=null?c:l.name;if(p==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(a.has(p)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${d} has duplicated entries. Ignoring the expression`);return}a.add(p);let m=new Q(p);e.scene.add(m),m.isBinary=(h=l.isBinary)!=null?h:!1,l.binds&&l.binds.forEach(f=>R(this,null,function*(){var _;if(f.mesh===void 0||f.index===void 0)return;let y=[];(_=t.nodes)==null||_.forEach((T,b)=>{T.mesh===f.mesh&&y.push(b)});let x=f.index;yield Promise.all(y.map(T=>R(this,null,function*(){var k;let b=yield _e(e,T);if(!b.every(L=>Array.isArray(L.morphTargetInfluences)&&x<L.morphTargetInfluences.length)){console.warn(`VRMExpressionLoaderPlugin: ${l.name} attempts to index ${x}th morph but not found.`);return}m.addBind(new X({primitives:b,index:x,weight:.01*((k=f.weight)!=null?k:100)}))})))}));let M=l.materialValues;M&&M.length!==0&&M.forEach(f=>{if(f.materialName===void 0||f.propertyName===void 0||f.targetValue===void 0)return;let y=[];e.scene.traverse(_=>{if(_.material){let T=_.material;Array.isArray(T)?y.push(...T.filter(b=>(b.name===f.materialName||b.name===f.materialName+" (Outline)")&&y.indexOf(b)===-1)):T.name===f.materialName&&y.indexOf(T)===-1&&y.push(T)}});let x=f.propertyName;y.forEach(_=>{if(x==="_MainTex_ST"){let b=new O.Vector2(f.targetValue[0],f.targetValue[1]),k=new O.Vector2(f.targetValue[2],f.targetValue[3]);k.y=1-k.y-b.y,m.addBind(new Z({material:_,scale:b,offset:k}));return}let T=Qe[x];if(T){m.addBind(new $({material:_,type:T,targetValue:new O.Color().fromArray(f.targetValue),targetAlpha:f.targetValue[3]}));return}console.warn(x+" is not supported")})}),n.registerExpression(m)}))),n})}};ye.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var ne=ye;var st={None:"none",Block:"block",Blend:"blend"};import*as A from"three";var I=class I{constructor(e,t){this._firstPersonOnlyLayer=I.DEFAULT_FIRSTPERSON_ONLY_LAYER;this._thirdPersonOnlyLayer=I.DEFAULT_THIRDPERSON_ONLY_LAYER;this._initializedLayers=!1;this.humanoid=e,this.meshAnnotations=t}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(t=>({meshes:t.meshes.concat(),type:t.type})),this}clone(){return new I(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=I.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=I.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this.meshAnnotations.forEach(r=>{r.meshes.forEach(o=>{r.type==="firstPersonOnly"?(o.layers.set(this._firstPersonOnlyLayer),o.traverse(n=>n.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(o.layers.set(this._thirdPersonOnlyLayer),o.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(o)})}),this._initializedLayers=!0)}_excludeTriangles(e,t,r,o){let n=0;if(t!=null&&t.length>0)for(let i=0;i<e.length;i+=3){let a=e[i],s=e[i+1],l=e[i+2],d=t[a],c=r[a];if(d[0]>0&&o.includes(c[0])||d[1]>0&&o.includes(c[1])||d[2]>0&&o.includes(c[2])||d[3]>0&&o.includes(c[3]))continue;let p=t[s],m=r[s];if(p[0]>0&&o.includes(m[0])||p[1]>0&&o.includes(m[1])||p[2]>0&&o.includes(m[2])||p[3]>0&&o.includes(m[3]))continue;let M=t[l],h=r[l];M[0]>0&&o.includes(h[0])||M[1]>0&&o.includes(h[1])||M[2]>0&&o.includes(h[2])||M[3]>0&&o.includes(h[3])||(e[n++]=a,e[n++]=s,e[n++]=l)}return n}_createErasedMesh(e,t){let r=new A.SkinnedMesh(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);let o=r.geometry,n=o.getAttribute("skinIndex"),i=n instanceof A.GLBufferAttribute?[]:n.array,a=[];for(let h=0;h<i.length;h+=4)a.push([i[h],i[h+1],i[h+2],i[h+3]]);let s=o.getAttribute("skinWeight"),l=s instanceof A.GLBufferAttribute?[]:s.array,d=[];for(let h=0;h<l.length;h+=4)d.push([l[h],l[h+1],l[h+2],l[h+3]]);let c=o.getIndex();if(!c)throw new Error("The geometry doesn't have an index buffer");let p=Array.from(c.array),m=this._excludeTriangles(p,d,a,t),M=[];for(let h=0;h<m;h++)M[h]=p[h];return o.setIndex(M),e.onBeforeRender&&(r.onBeforeRender=e.onBeforeRender),r.bind(new A.Skeleton(e.skeleton.bones,e.skeleton.boneInverses),new A.Matrix4),r}_createHeadlessModelForSkinnedMesh(e,t){let r=[];if(t.skeleton.bones.forEach((n,i)=>{this._isEraseTarget(n)&&r.push(i)}),!r.length){t.layers.enable(this._thirdPersonOnlyLayer),t.layers.enable(this._firstPersonOnlyLayer);return}t.layers.set(this._thirdPersonOnlyLayer);let o=this._createErasedMesh(t,r);e.add(o)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer));else{let t=new A.Group;t.name=`_headless_${e.name}`,t.layers.set(this._firstPersonOnlyLayer),e.parent.add(t),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{let o=r;this._createHeadlessModelForSkinnedMesh(t,o)})}else if(e.type==="SkinnedMesh"){let t=e;this._createHeadlessModelForSkinnedMesh(e.parent,t)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};I.DEFAULT_FIRSTPERSON_ONLY_LAYER=9,I.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var J=I;var at=new Set(["1.0","1.0-beta"]),ie=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return R(this,null,function*(){let t=e.userData.vrmHumanoid;if(t!==null){if(t===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");e.userData.vrmFirstPerson=yield this._import(e,t)}})}_import(e,t){return R(this,null,function*(){if(t==null)return null;let r=yield this._v1Import(e,t);if(r)return r;let o=yield this._v0Import(e,t);return o||null})}_v1Import(e,t){return R(this,null,function*(){var d,c;let r=this.parser.json;if(!(((d=r.extensionsUsed)==null?void 0:d.indexOf("VRMC_vrm"))!==-1))return null;let n=(c=r.extensions)==null?void 0:c.VRMC_vrm;if(!n)return null;let i=n.specVersion;if(!at.has(i))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${i}"`),null;let a=n.firstPerson;if(!a)return null;let s=[],l=yield Ae(e);return Array.from(l.entries()).forEach(([p,m])=>{var h;let M=a.meshAnnotations?a.meshAnnotations.find(f=>f.node===p):void 0;s.push({meshes:m,type:(h=M==null?void 0:M.type)!=null?h:"both"})}),new J(t,s)})}_v0Import(e,t){return R(this,null,function*(){var s;let r=this.parser.json,o=(s=r.extensions)==null?void 0:s.VRM;if(!o)return null;let n=o.firstPerson;if(!n)return null;let i=[],a=yield Ae(e);return Array.from(a.entries()).forEach(([l,d])=>{let c=r.nodes[l],p=n.meshAnnotations?n.meshAnnotations.find(m=>m.mesh===c.mesh):void 0;i.push({meshes:d,type:this._convertV0FlagToV1Type(p==null?void 0:p.firstPersonFlag)})}),new J(t,i)})}_convertV0FlagToV1Type(e){return e==="FirstPersonOnly"?"firstPersonOnly":e==="ThirdPersonOnly"?"thirdPersonOnly":e==="Auto"?"auto":"both"}};var lt={Auto:"auto",Both:"both",ThirdPersonOnly:"thirdPersonOnly",FirstPersonOnly:"firstPersonOnly"};import*as N from"three";var Ye=new N.Vector3,$e=new N.Vector3,ut=new N.Quaternion,K=class extends N.Group{constructor(e){super(),this.vrmHumanoid=e,this._boneAxesMap=new Map,Object.values(e.humanBones).forEach(t=>{let r=new N.AxesHelper(1);r.matrixAutoUpdate=!1,r.material.depthTest=!1,r.material.depthWrite=!1,this.add(r),this._boneAxesMap.set(t,r)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(e=>{e.geometry.dispose(),e.material.dispose()})}updateMatrixWorld(e){Array.from(this._boneAxesMap.entries()).forEach(([t,r])=>{t.node.updateWorldMatrix(!0,!1),t.node.matrixWorld.decompose(Ye,ut,$e);let o=Ye.set(.1,.1,.1).divide($e);r.matrix.copy(t.node.matrixWorld).scale(o)}),super.updateMatrixWorld(e)}};var se=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"];var pt={Hips:"hips",Spine:"spine",Chest:"chest",UpperChest:"upperChest",Neck:"neck",Head:"head",LeftEye:"leftEye",RightEye:"rightEye",Jaw:"jaw",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",LeftToes:"leftToes",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",RightToes:"rightToes",LeftShoulder:"leftShoulder",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightShoulder:"rightShoulder",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand",LeftThumbMetacarpal:"leftThumbMetacarpal",LeftThumbProximal:"leftThumbProximal",LeftThumbDistal:"leftThumbDistal",LeftIndexProximal:"leftIndexProximal",LeftIndexIntermediate:"leftIndexIntermediate",LeftIndexDistal:"leftIndexDistal",LeftMiddleProximal:"leftMiddleProximal",LeftMiddleIntermediate:"leftMiddleIntermediate",LeftMiddleDistal:"leftMiddleDistal",LeftRingProximal:"leftRingProximal",LeftRingIntermediate:"leftRingIntermediate",LeftRingDistal:"leftRingDistal",LeftLittleProximal:"leftLittleProximal",LeftLittleIntermediate:"leftLittleIntermediate",LeftLittleDistal:"leftLittleDistal",RightThumbMetacarpal:"rightThumbMetacarpal",RightThumbProximal:"rightThumbProximal",RightThumbDistal:"rightThumbDistal",RightIndexProximal:"rightIndexProximal",RightIndexIntermediate:"rightIndexIntermediate",RightIndexDistal:"rightIndexDistal",RightMiddleProximal:"rightMiddleProximal",RightMiddleIntermediate:"rightMiddleIntermediate",RightMiddleDistal:"rightMiddleDistal",RightRingProximal:"rightRingProximal",RightRingIntermediate:"rightRingIntermediate",RightRingDistal:"rightRingDistal",RightLittleProximal:"rightLittleProximal",RightLittleIntermediate:"rightLittleIntermediate",RightLittleDistal:"rightLittleDistal"};var Be={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};import*as Te from"three";function xe(u){return u.invert?u.invert():u.inverse(),u}var G=new Te.Vector3,C=new Te.Quaternion,W=class{constructor(e){this.humanBones=e,this.restPose=this.getAbsolutePose()}getAbsolutePose(){let e={};return Object.keys(this.humanBones).forEach(t=>{let r=t,o=this.getBoneNode(r);o&&(G.copy(o.position),C.copy(o.quaternion),e[r]={position:G.toArray(),rotation:C.toArray()})}),e}getPose(){let e={};return Object.keys(this.humanBones).forEach(t=>{let r=t,o=this.getBoneNode(r);if(!o)return;G.set(0,0,0),C.identity();let n=this.restPose[r];n!=null&&n.position&&G.fromArray(n.position).negate(),n!=null&&n.rotation&&xe(C.fromArray(n.rotation)),G.add(o.position),C.premultiply(o.quaternion),e[r]={position:G.toArray(),rotation:C.toArray()}}),e}setPose(e){Object.entries(e).forEach(([t,r])=>{let o=t,n=this.getBoneNode(o);if(!n)return;let i=this.restPose[o];i&&(r!=null&&r.position&&(n.position.fromArray(r.position),i.position&&n.position.add(G.fromArray(i.position))),r!=null&&r.rotation&&(n.quaternion.fromArray(r.rotation),i.rotation&&n.quaternion.multiply(C.fromArray(i.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([e,t])=>{let r=this.getBoneNode(e);r&&(t!=null&&t.position&&r.position.fromArray(t.position),t!=null&&t.rotation&&r.quaternion.fromArray(t.rotation))})}getBone(e){var t;return(t=this.humanBones[e])!=null?t:void 0}getBoneNode(e){var t,r;return(r=(t=this.humanBones[e])==null?void 0:t.node)!=null?r:null}};import*as w from"three";var ke=new w.Vector3,mt=new w.Quaternion,dt=new w.Vector3,ae=class u extends W{static _setupTransforms(e){let t=new w.Object3D;t.name="VRMHumanoidRig";let r={},o={},n={},i={};se.forEach(s=>{var d;let l=e.getBoneNode(s);if(l){let c=new w.Vector3,p=new w.Quaternion;l.updateWorldMatrix(!0,!1),l.matrixWorld.decompose(c,p,ke),r[s]=c,o[s]=p,n[s]=l.quaternion.clone();let m=new w.Quaternion;(d=l.parent)==null||d.matrixWorld.decompose(ke,m,ke),i[s]=m}});let a={};return se.forEach(s=>{var d;let l=e.getBoneNode(s);if(l){let c=r[s],p=s,m;for(;m==null&&(p=Be[p],p!=null);)m=r[p];let M=new w.Object3D;M.name="Normalized_"+l.name,(p?(d=a[p])==null?void 0:d.node:t).add(M),M.position.copy(c),m&&M.position.sub(m),a[s]={node:M}}}),{rigBones:a,root:t,parentWorldRotations:i,boneRotations:n}}constructor(e){let{rigBones:t,root:r,parentWorldRotations:o,boneRotations:n}=u._setupTransforms(e);super(t),this.original=e,this.root=r,this._parentWorldRotations=o,this._boneRotations=n}update(){se.forEach(e=>{let t=this.original.getBoneNode(e);if(t!=null){let r=this.getBoneNode(e),o=this._parentWorldRotations[e],n=mt.copy(o).invert(),i=this._boneRotations[e];if(t.quaternion.copy(r.quaternion).multiply(o).premultiply(n).multiply(i),e==="hips"){let a=r.getWorldPosition(dt);t.parent.updateWorldMatrix(!0,!1);let s=t.parent.matrixWorld,l=a.applyMatrix4(s.invert());t.position.copy(l)}}})}};var ee=class u{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,t){var r;this.autoUpdateHumanBones=(r=t==null?void 0:t.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new W(e),this._normalizedHumanBones=new ae(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new W(e.humanBones),this._normalizedHumanBones=new ae(this._rawHumanBones),this}clone(){return new u(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}};var Fe={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"};var ht=new Set(["1.0","1.0-beta"]),Xe={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},le=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot,this.autoUpdateHumanBones=t==null?void 0:t.autoUpdateHumanBones}afterRoot(e){return R(this,null,function*(){e.userData.vrmHumanoid=yield this._import(e)})}_import(e){return R(this,null,function*(){let t=yield this._v1Import(e);if(t)return t;let r=yield this._v0Import(e);return r||null})}_v1Import(e){return R(this,null,function*(){var d,c;let t=this.parser.json;if(!(((d=t.extensionsUsed)==null?void 0:d.indexOf("VRMC_vrm"))!==-1))return null;let o=(c=t.extensions)==null?void 0:c.VRMC_vrm;if(!o)return null;let n=o.specVersion;if(!ht.has(n))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${n}"`),null;let i=o.humanoid;if(!i)return null;let a=i.humanBones.leftThumbIntermediate!=null||i.humanBones.rightThumbIntermediate!=null,s={};i.humanBones!=null&&(yield Promise.all(Object.entries(i.humanBones).map(M=>R(this,[M],function*([p,m]){let h=p,f=m.node;if(a){let x=Xe[h];x!=null&&(h=x)}let y=yield this.parser.getDependency("node",f);if(y==null){console.warn(`A glTF node bound to the humanoid bone ${h} (index = ${f}) does not exist`);return}s[h]={node:y}}))));let l=new ee(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(l.normalizedHumanBonesRoot),this.helperRoot){let p=new K(l);this.helperRoot.add(p),p.renderOrder=this.helperRoot.renderOrder}return l})}_v0Import(e){return R(this,null,function*(){var a;let r=(a=this.parser.json.extensions)==null?void 0:a.VRM;if(!r)return null;let o=r.humanoid;if(!o)return null;let n={};o.humanBones!=null&&(yield Promise.all(o.humanBones.map(s=>R(this,null,function*(){let l=s.bone,d=s.node;if(l==null||d==null)return;let c=yield this.parser.getDependency("node",d);if(c==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${d}) does not exist`);return}let p=Xe[l],m=p!=null?p:l;if(n[m]!=null){console.warn(`Multiple bone entries for ${m} detected (index = ${d}), ignoring duplicated entries.`);return}n[m]={node:c}}))));let i=new ee(this._ensureRequiredBonesExist(n),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(i.normalizedHumanBonesRoot),this.helperRoot){let s=new K(i);this.helperRoot.add(s),s.renderOrder=this.helperRoot.renderOrder}return i})}_ensureRequiredBonesExist(e){let t=Object.values(Fe).filter(r=>e[r]==null);if(t.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${t.join(", ")}`);return e}};import*as E from"three";import*as ue from"three";var pe=class extends ue.BufferGeometry{constructor(){super();this._currentTheta=0;this._currentRadius=0;this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new ue.BufferAttribute(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ue.BufferAttribute(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,t=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let t=0;t<64;t++){let r=t/63*this._currentTheta;this._attrPos.setXYZ(t+1,this._currentRadius*Math.sin(r),0,this._currentRadius*Math.cos(r))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<63;t++)this._attrIndex.setXYZ(t*3,0,t+1,t+2);this._attrIndex.needsUpdate=!0}};import*as S from"three";var be=class extends S.BufferGeometry{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new S.Vector3,this._currentTail=new S.Vector3,this._attrPos=new S.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new S.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){let t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){let t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}};var He=new E.Quaternion,Ze=new E.Quaternion,me=new E.Vector3,Je=new E.Vector3,Ke=Math.sqrt(2)/2,ct=new E.Quaternion(0,0,-Ke,Ke),Rt=new E.Vector3(0,1,0),de=class extends E.Group{constructor(e){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=e;{let t=new pe;t.radius=.5;let r=new E.MeshBasicMaterial({color:65280,transparent:!0,opacity:.5,side:E.DoubleSide,depthTest:!1,depthWrite:!1});this._meshPitch=new E.Mesh(t,r),this.add(this._meshPitch)}{let t=new pe;t.radius=.5;let r=new E.MeshBasicMaterial({color:16711680,transparent:!0,opacity:.5,side:E.DoubleSide,depthTest:!1,depthWrite:!1});this._meshYaw=new E.Mesh(t,r),this.add(this._meshYaw)}{let t=new be;t.radius=.1;let r=new E.LineBasicMaterial({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new E.LineSegments(t,r),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(e){let t=E.MathUtils.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=t,this._meshYaw.geometry.update();let r=E.MathUtils.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=r,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(me),this.vrmLookAt.getLookAtWorldQuaternion(He),He.multiply(this.vrmLookAt.getFaceFrontQuaternion(Ze)),this._meshYaw.position.copy(me),this._meshYaw.quaternion.copy(He),this._meshPitch.position.copy(me),this._meshPitch.quaternion.copy(He),this._meshPitch.quaternion.multiply(Ze.setFromAxisAngle(Rt,t)),this._meshPitch.quaternion.multiply(ct);let{target:o,autoUpdate:n}=this.vrmLookAt;o!=null&&n&&(o.getWorldPosition(Je).sub(me),this._lineTarget.geometry.tail.copy(Je),this._lineTarget.geometry.update(),this._lineTarget.position.copy(me)),super.updateMatrixWorld(e)}};import*as V from"three";import*as Ie from"three";var ft=new Ie.Vector3,Mt=new Ie.Vector3;function he(u,e){return u.matrixWorld.decompose(ft,e,Mt),e}function te(u){return[Math.atan2(-u.z,u.x),Math.atan2(u.y,Math.sqrt(u.x*u.x+u.z*u.z))]}function Ne(u){let e=Math.round(u/2/Math.PI);return u-2*Math.PI*e}var et=new V.Vector3(0,0,1),Et=new V.Vector3,gt=new V.Vector3,Vt=new V.Vector3,yt=new V.Quaternion,Ue=new V.Quaternion,tt=new V.Quaternion,xt=new V.Quaternion,Oe=new V.Euler,Le=class Le{constructor(e,t){this.offsetFromHeadBone=new V.Vector3;this.autoUpdate=!0;this.faceFront=new V.Vector3(0,0,1);this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new V.Quaternion)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new V.Euler)}getEuler(e){return e.set(V.MathUtils.DEG2RAD*this._pitch,V.MathUtils.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new Le(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){let t=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){let t=this.humanoid.getRawBoneNode("head");return he(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(et)<.01)return e.copy(this._restHeadWorldQuaternion).invert();let[t,r]=te(this.faceFront);return Oe.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(Oe).premultiply(xt.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(Ue),this.getFaceFrontQuaternion(tt),e.copy(et).applyQuaternion(Ue).applyQuaternion(tt).applyEuler(this.getEuler(Oe))}lookAt(e){let t=yt.copy(this._restHeadWorldQuaternion).multiply(xe(this.getLookAtWorldQuaternion(Ue))),r=this.getLookAtWorldPosition(gt),o=Vt.copy(e).sub(r).applyQuaternion(t).normalize(),[n,i]=te(this.faceFront),[a,s]=te(o),l=Ne(a-n),d=Ne(i-s);this._yaw=V.MathUtils.RAD2DEG*l,this._pitch=V.MathUtils.RAD2DEG*d,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(Et)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};Le.EULER_ORDER="YXZ";var ce=Le;import*as g from"three";var Tt=new g.Vector3(0,0,1),B=new g.Quaternion,re=new g.Quaternion,P=new g.Euler(0,0,0,"YXZ"),D=class{constructor(e,t,r,o,n){this.humanoid=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=r,this.rangeMapVerticalDown=o,this.rangeMapVerticalUp=n,this.faceFront=new g.Vector3(0,0,1),this._restQuatLeftEye=new g.Quaternion,this._restQuatRightEye=new g.Quaternion,this._restLeftEyeParentWorldQuat=new g.Quaternion,this._restRightEyeParentWorldQuat=new g.Quaternion;let i=this.humanoid.getRawBoneNode("leftEye"),a=this.humanoid.getRawBoneNode("rightEye");i&&(this._restQuatLeftEye.copy(i.quaternion),he(i.parent,this._restLeftEyeParentWorldQuat)),a&&(this._restQuatRightEye.copy(a.quaternion),he(a.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(e,t){let r=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye"),n=this.humanoid.getNormalizedBoneNode("leftEye"),i=this.humanoid.getNormalizedBoneNode("rightEye");r&&(t<0?P.x=-g.MathUtils.DEG2RAD*this.rangeMapVerticalDown.map(-t):P.x=g.MathUtils.DEG2RAD*this.rangeMapVerticalUp.map(t),e<0?P.y=-g.MathUtils.DEG2RAD*this.rangeMapHorizontalInner.map(-e):P.y=g.MathUtils.DEG2RAD*this.rangeMapHorizontalOuter.map(e),B.setFromEuler(P),this._getWorldFaceFrontQuat(re),n.quaternion.copy(re).multiply(B).multiply(re.invert()),B.copy(this._restLeftEyeParentWorldQuat),r.quaternion.copy(n.quaternion).multiply(B).premultiply(B.invert()).multiply(this._restQuatLeftEye)),o&&(t<0?P.x=-g.MathUtils.DEG2RAD*this.rangeMapVerticalDown.map(-t):P.x=g.MathUtils.DEG2RAD*this.rangeMapVerticalUp.map(t),e<0?P.y=-g.MathUtils.DEG2RAD*this.rangeMapHorizontalOuter.map(-e):P.y=g.MathUtils.DEG2RAD*this.rangeMapHorizontalInner.map(e),B.setFromEuler(P),this._getWorldFaceFrontQuat(re),i.quaternion.copy(re).multiply(B).multiply(re.invert()),B.copy(this._restRightEyeParentWorldQuat),o.quaternion.copy(i.quaternion).multiply(B).premultiply(B.invert()).multiply(this._restQuatRightEye))}lookAt(e){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");let t=g.MathUtils.RAD2DEG*e.y,r=g.MathUtils.RAD2DEG*e.x;this.applyYawPitch(t,r)}_getWorldFaceFrontQuat(e){if(this.faceFront.distanceToSquared(Tt)<.01)return e.identity();let[t,r]=te(this.faceFront);return P.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(P)}};D.type="bone";import*as Se from"three";var j=class{constructor(e,t,r,o,n){this.expressions=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=r,this.rangeMapVerticalDown=o,this.rangeMapVerticalUp=n}applyYawPitch(e,t){t<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-t))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(t))),e<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-e))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(e)))}lookAt(e){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");let t=Se.MathUtils.RAD2DEG*e.y,r=Se.MathUtils.RAD2DEG*e.x;this.applyYawPitch(t,r)}};j.type="expression";var oe=class{constructor(e,t){this.inputMaxValue=e,this.outputScale=t}map(e){return this.outputScale*Ee(e/this.inputMaxValue)}};var bt=new Set(["1.0","1.0-beta"]),Pe=.01,Re=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(e){return R(this,null,function*(){let t=e.userData.vrmHumanoid;if(t===null)return;if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");let r=e.userData.vrmExpressionManager;if(r!==null){if(r===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");e.userData.vrmLookAt=yield this._import(e,t,r)}})}_import(e,t,r){return R(this,null,function*(){if(t==null||r==null)return null;let o=yield this._v1Import(e,t,r);if(o)return o;let n=yield this._v0Import(e,t,r);return n||null})}_v1Import(e,t,r){return R(this,null,function*(){var f,y,x;let o=this.parser.json;if(!(((f=o.extensionsUsed)==null?void 0:f.indexOf("VRMC_vrm"))!==-1))return null;let i=(y=o.extensions)==null?void 0:y.VRMC_vrm;if(!i)return null;let a=i.specVersion;if(!bt.has(a))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;let s=i.lookAt;if(!s)return null;let l=s.type==="expression"?1:10,d=this._v1ImportRangeMap(s.rangeMapHorizontalInner,l),c=this._v1ImportRangeMap(s.rangeMapHorizontalOuter,l),p=this._v1ImportRangeMap(s.rangeMapVerticalDown,l),m=this._v1ImportRangeMap(s.rangeMapVerticalUp,l),M;s.type==="expression"?M=new j(r,d,c,p,m):M=new D(t,d,c,p,m);let h=this._importLookAt(t,M);return h.offsetFromHeadBone.fromArray((x=s.offsetFromHeadBone)!=null?x:[0,.06,0]),h})}_v1ImportRangeMap(e,t){var n,i;let r=(n=e==null?void 0:e.inputMaxValue)!=null?n:90,o=(i=e==null?void 0:e.outputScale)!=null?i:t;return r<Pe&&(console.warn("VRMLookAtLoaderPlugin: inputMaxValue of a range map is too small. Consider reviewing the range map!"),r=Pe),new oe(r,o)}_v0Import(e,t,r){return R(this,null,function*(){var M,h,f,y;let n=(M=this.parser.json.extensions)==null?void 0:M.VRM;if(!n)return null;let i=n.firstPerson;if(!i)return null;let a=i.lookAtTypeName==="BlendShape"?1:10,s=this._v0ImportDegreeMap(i.lookAtHorizontalInner,a),l=this._v0ImportDegreeMap(i.lookAtHorizontalOuter,a),d=this._v0ImportDegreeMap(i.lookAtVerticalDown,a),c=this._v0ImportDegreeMap(i.lookAtVerticalUp,a),p;i.lookAtTypeName==="BlendShape"?p=new j(r,s,l,d,c):p=new D(t,s,l,d,c);let m=this._importLookAt(t,p);return i.firstPersonBoneOffset?m.offsetFromHeadBone.set((h=i.firstPersonBoneOffset.x)!=null?h:0,(f=i.firstPersonBoneOffset.y)!=null?f:.06,-((y=i.firstPersonBoneOffset.z)!=null?y:0)):m.offsetFromHeadBone.set(0,.06,0),m.faceFront.set(0,0,-1),p instanceof D&&p.faceFront.set(0,0,-1),m})}_v0ImportDegreeMap(e,t){var i,a;let r=e==null?void 0:e.curve;JSON.stringify(r)!=="[0,0,0,1,1,1,1,0]"&&console.warn("Curves of LookAtDegreeMap defined in VRM 0.0 are not supported");let o=(i=e==null?void 0:e.xRange)!=null?i:90,n=(a=e==null?void 0:e.yRange)!=null?a:t;return o<Pe&&(console.warn("VRMLookAtLoaderPlugin: xRange of a degree map is too small. Consider reviewing the degree map!"),o=Pe),new oe(o,n)}_importLookAt(e,t){let r=new ce(e,t);if(this.helperRoot){let o=new de(r);this.helperRoot.add(o),o.renderOrder=this.helperRoot.renderOrder}return r}};var Ht={Bone:"bone",Expression:"expression"};import*as ot from"three";function rt(u,e){return typeof u!="string"||u===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(u)&&(e=e.replace(/(^https?:\/\/[^/]+).*/i,"$1")),/^(https?:)?\/\//i.test(u)||/^data:.*,.*$/i.test(u)||/^blob:.*$/i.test(u)?u:e+u)}var Lt=new Set(["1.0","1.0-beta"]),fe=class{get name(){return"VRMMetaLoaderPlugin"}constructor(e,t){var r,o,n;this.parser=e,this.needThumbnailImage=(r=t==null?void 0:t.needThumbnailImage)!=null?r:!1,this.acceptLicenseUrls=(o=t==null?void 0:t.acceptLicenseUrls)!=null?o:["https://vrm.dev/licenses/1.0/"],this.acceptV0Meta=(n=t==null?void 0:t.acceptV0Meta)!=null?n:!0}afterRoot(e){return R(this,null,function*(){e.userData.vrmMeta=yield this._import(e)})}_import(e){return R(this,null,function*(){let t=yield this._v1Import(e);if(t!=null)return t;let r=yield this._v0Import(e);return r!=null?r:null})}_v1Import(e){return R(this,null,function*(){var d,c,p;let t=this.parser.json;if(!(((d=t.extensionsUsed)==null?void 0:d.indexOf("VRMC_vrm"))!==-1))return null;let o=(c=t.extensions)==null?void 0:c.VRMC_vrm;if(o==null)return null;let n=o.specVersion;if(!Lt.has(n))return console.warn(`VRMMetaLoaderPlugin: Unknown VRMC_vrm specVersion "${n}"`),null;let i=o.meta;if(!i)return null;let a=i.licenseUrl;if(!new Set(this.acceptLicenseUrls).has(a))throw new Error(`VRMMetaLoaderPlugin: The license url "${a}" is not accepted`);let l;return this.needThumbnailImage&&i.thumbnailImage!=null&&(l=(p=yield this._extractGLTFImage(i.thumbnailImage))!=null?p:void 0),{metaVersion:"1",name:i.name,version:i.version,authors:i.authors,copyrightInformation:i.copyrightInformation,contactInformation:i.contactInformation,references:i.references,thirdPartyLicenses:i.thirdPartyLicenses,thumbnailImage:l,licenseUrl:i.licenseUrl,avatarPermission:i.avatarPermission,allowExcessivelyViolentUsage:i.allowExcessivelyViolentUsage,allowExcessivelySexualUsage:i.allowExcessivelySexualUsage,commercialUsage:i.commercialUsage,allowPoliticalOrReligiousUsage:i.allowPoliticalOrReligiousUsage,allowAntisocialOrHateUsage:i.allowAntisocialOrHateUsage,creditNotation:i.creditNotation,allowRedistribution:i.allowRedistribution,modification:i.modification,otherLicenseUrl:i.otherLicenseUrl}})}_v0Import(e){return R(this,null,function*(){var i;let r=(i=this.parser.json.extensions)==null?void 0:i.VRM;if(!r)return null;let o=r.meta;if(!o)return null;if(!this.acceptV0Meta)throw new Error("VRMMetaLoaderPlugin: Attempted to load VRM0.0 meta but acceptV0Meta is false");let n;return this.needThumbnailImage&&o.texture!=null&&o.texture!==-1&&(n=yield this.parser.getDependency("texture",o.texture)),{metaVersion:"0",allowedUserName:o.allowedUserName,author:o.author,commercialUssageName:o.commercialUssageName,contactInformation:o.contactInformation,licenseName:o.licenseName,otherLicenseUrl:o.otherLicenseUrl,otherPermissionUrl:o.otherPermissionUrl,reference:o.reference,sexualUssageName:o.sexualUssageName,texture:n!=null?n:void 0,title:o.title,version:o.version,violentUssageName:o.violentUssageName}})}_extractGLTFImage(e){return R(this,null,function*(){var i;let r=(i=this.parser.json.images)==null?void 0:i[e];if(r==null)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${e}] of glTF as a thumbnail but the image doesn't exist`),null;let o=r.uri;if(r.bufferView!=null){let a=yield this.parser.getDependency("bufferView",r.bufferView),s=new Blob([a],{type:r.mimeType});o=URL.createObjectURL(s)}return o==null?(console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${e}] of glTF as a thumbnail but the image couldn't load properly`),null):yield new ot.ImageLoader().loadAsync(rt(o,this.parser.options.path)).catch(a=>(console.error(a),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}};var Me=class{constructor(e){this.scene=e.scene,this.meta=e.meta,this.humanoid=e.humanoid,this.expressionManager=e.expressionManager,this.firstPerson=e.firstPerson,this.lookAt=e.lookAt}update(e){this.humanoid.update(),this.lookAt&&this.lookAt.update(e),this.expressionManager&&this.expressionManager.update()}};var De=class{get name(){return"VRMC_vrm"}constructor(e,t){var n,i,a,s,l;this.parser=e;let r=t==null?void 0:t.helperRoot,o=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(n=t==null?void 0:t.expressionPlugin)!=null?n:new ne(e),this.firstPersonPlugin=(i=t==null?void 0:t.firstPersonPlugin)!=null?i:new ie(e),this.humanoidPlugin=(a=t==null?void 0:t.humanoidPlugin)!=null?a:new le(e,{helperRoot:r,autoUpdateHumanBones:o}),this.lookAtPlugin=(s=t==null?void 0:t.lookAtPlugin)!=null?s:new Re(e,{helperRoot:r}),this.metaPlugin=(l=t==null?void 0:t.metaPlugin)!=null?l:new fe(e)}afterRoot(e){return R(this,null,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e);let t=e.userData.vrmMeta,r=e.userData.vrmHumanoid;if(t&&r){let o=new Me({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:r,lookAt:e.userData.vrmLookAt,meta:t});e.userData.vrmCore=o}})}};export{Me as VRMCore,De as VRMCoreLoaderPlugin,Q as VRMExpression,ne as VRMExpressionLoaderPlugin,q as VRMExpressionManager,$ as VRMExpressionMaterialColorBind,Y as VRMExpressionMaterialColorType,X as VRMExpressionMorphTargetBind,st as VRMExpressionOverrideType,z as VRMExpressionPresetName,Z as VRMExpressionTextureTransformBind,J as VRMFirstPerson,ie as VRMFirstPersonLoaderPlugin,lt as VRMFirstPersonMeshAnnotationType,se as VRMHumanBoneList,pt as VRMHumanBoneName,Be as VRMHumanBoneParentMap,ee as VRMHumanoid,K as VRMHumanoidHelper,le as VRMHumanoidLoaderPlugin,ce as VRMLookAt,D as VRMLookAtBoneApplier,j as VRMLookAtExpressionApplier,de as VRMLookAtHelper,Re as VRMLookAtLoaderPlugin,oe as VRMLookAtRangeMap,Ht as VRMLookAtTypeName,fe as VRMMetaLoaderPlugin,Fe as VRMRequiredHumanBoneName};
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "@pixiv/three-vrm-core",
3
- "version": "2.1.2",
3
+ "version": "3.0.0-beta.0",
4
4
  "description": "The implementation of core features of VRM, for @pixiv/three-vrm",
5
5
  "license": "MIT",
6
6
  "author": "pixiv",
7
7
  "files": [
8
8
  "/lib/",
9
- "/ts*/",
10
9
  "/types/",
11
10
  "LICENSE"
12
11
  ],
13
- "main": "lib/three-vrm-core.js",
14
- "module": "lib/three-vrm-core.module.js",
12
+ "type": "module",
13
+ "main": "lib/three-vrm-core.module.js",
15
14
  "types": "types/index.d.ts",
16
- "typesVersions": {
17
- "<3.9": {
18
- "*": [
19
- "ts3.4/*"
20
- ]
21
- }
15
+ "exports": {
16
+ ".": {
17
+ "types": "./types/index.d.ts",
18
+ "import": "./lib/three-vrm-core.module.js",
19
+ "require": "./lib/three-vrm-core.cjs"
20
+ },
21
+ "./package.json": "./package.json"
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
@@ -28,12 +28,13 @@
28
28
  "scripts": {
29
29
  "version": "yarn all",
30
30
  "all": "yarn lint && yarn clean && yarn build && yarn docs",
31
- "dev": "cross-env NODE_ENV=development rollup -w -c",
32
- "clean": "rimraf docs/ lib/ ts*/ types/",
31
+ "dev": "cross-env SERVE=1 yarn build-dev",
32
+ "clean": "rimraf docs/ lib/ types/",
33
33
  "build": "yarn build-dev && yarn build-prod && yarn build-types",
34
- "build-dev": "cross-env NODE_ENV=development rollup -c",
35
- "build-prod": "cross-env NODE_ENV=production rollup -c",
36
- "build-types": "tsc --declaration --declarationDir ./types --emitDeclarationOnly && downlevel-dts types ts3.4/types",
34
+ "build-js": "node ../../bin/build.mjs",
35
+ "build-dev": "cross-env NODE_ENV=development yarn build-js",
36
+ "build-prod": "cross-env NODE_ENV=production yarn build-js",
37
+ "build-types": "tsc --project ./tsconfig.build-types.json",
37
38
  "docs": "typedoc --entryPoints ./src/index.ts --out docs",
38
39
  "test": "jest",
39
40
  "lint": "eslint \"src/**/*.{ts,tsx}\" && yarn lint-examples && prettier \"src/**/*.{ts,tsx}\" --check",
@@ -50,8 +51,8 @@
50
51
  ]
51
52
  },
52
53
  "dependencies": {
53
- "@pixiv/types-vrm-0.0": "2.1.2",
54
- "@pixiv/types-vrmc-vrm-1.0": "2.1.2"
54
+ "@pixiv/types-vrm-0.0": "3.0.0-beta.0",
55
+ "@pixiv/types-vrmc-vrm-1.0": "3.0.0-beta.0"
55
56
  },
56
57
  "devDependencies": {
57
58
  "@types/three": "^0.164.0",
@@ -61,5 +62,5 @@
61
62
  "@types/three": "^0.164.0",
62
63
  "three": "^0.164.1"
63
64
  },
64
- "gitHead": "2ea1a8f0d12a421c572514b86a84fef8ddfe752f"
65
+ "gitHead": "a8ac23ec2e534dcae60de7cce71542a03537fcea"
65
66
  }
@@ -7,7 +7,7 @@ export declare class VRMMetaLoaderPlugin implements GLTFLoaderPlugin {
7
7
  readonly parser: GLTFParser;
8
8
  /**
9
9
  * If `false`, it won't load its thumbnail image ({@link VRM1Meta.thumbnailImage}).
10
- * `true` by default.
10
+ * `false` by default.
11
11
  */
12
12
  needThumbnailImage: boolean;
13
13
  /**
@@ -4,7 +4,7 @@
4
4
  export interface VRMMetaLoaderPluginOptions {
5
5
  /**
6
6
  * If `false`, it won't load its thumbnail image ({@link VRM1Meta.thumbnailImage}).
7
- * `true` by default.
7
+ * `false` by default.
8
8
  */
9
9
  needThumbnailImage?: boolean;
10
10
  /**