(self.webpackChunk_ld_apps_ludathon=self.webpackChunk_ld_apps_ludathon||[]).push([[297],{"../../../node_modules/@babylonjs/core/Actions/abstractActionManager.js":function(e,t,i){"use strict";i.d(t,{O:function(){return n}});class n{constructor(){this.hoverCursor="",this.actions=new Array,this.isRecursive=!1}static get HasTriggers(){for(const e in n.Triggers)if(Object.prototype.hasOwnProperty.call(n.Triggers,e))return!0;return!1}static get HasPickTriggers(){for(const e in n.Triggers)if(Object.prototype.hasOwnProperty.call(n.Triggers,e)){const t=parseInt(e);if(t>=1&&t<=7)return!0}return!1}static HasSpecificTrigger(e){for(const t in n.Triggers)if(Object.prototype.hasOwnProperty.call(n.Triggers,t)&&parseInt(t)===e)return!0;return!1}}n.Triggers={}},"../../../node_modules/@babylonjs/core/Actions/actionEvent.js":function(e,t,i){"use strict";i.d(t,{V:function(){return n}});class n{constructor(e,t,i,n,r,s){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=n,this.sourceEvent=r,this.additionalData=s}static CreateNew(e,t,i){const r=e.getScene();return new n(e,r.pointerX,r.pointerY,r.meshUnderPointer||e,t,i)}static CreateNewFromSprite(e,t,i,r){return new n(e,t.pointerX,t.pointerY,t.meshUnderPointer,i,r)}static CreateNewFromScene(e,t){return new n(null,e.pointerX,e.pointerY,e.meshUnderPointer,t)}static CreateNewFromPrimitive(e,t,i,r){return new n(e,t.x,t.y,null,i,r)}}},"../../../node_modules/@babylonjs/core/Animations/animation.js":function(e,t,i){"use strict";i.d(t,{f:function(){return u}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js"),o=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),l=i("../../../node_modules/@babylonjs/core/Animations/animationKey.js"),c=i("../../../node_modules/@babylonjs/core/Animations/animationRange.js"),h=i("../../../node_modules/@babylonjs/core/node.js"),_=i("../../../node_modules/@babylonjs/core/Maths/math.size.js"),d=i("../../../node_modules/@babylonjs/core/Misc/webRequest.js");class u{constructor(e,t,i,n,r,s){this.name=e,this.targetProperty=t,this.framePerSecond=i,this.dataType=n,this.loopMode=r,this.enableBlending=s,this._easingFunction=null,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this.targetPropertyPath=t.split("."),this.dataType=n,this.loopMode=void 0===r?u.ANIMATIONLOOPMODE_CYCLE:r,this.uniqueId=u._UniqueIdGenerator++}static _PrepareAnimation(e,t,i,s,o,a,l,c){let h;if(!isNaN(parseFloat(o))&&isFinite(o)?h=u.ANIMATIONTYPE_FLOAT:o instanceof n._f?h=u.ANIMATIONTYPE_QUATERNION:o instanceof n.P?h=u.ANIMATIONTYPE_VECTOR3:o instanceof n.FM?h=u.ANIMATIONTYPE_VECTOR2:o instanceof r.Wo?h=u.ANIMATIONTYPE_COLOR3:o instanceof r.HE?h=u.ANIMATIONTYPE_COLOR4:o instanceof _.$&&(h=u.ANIMATIONTYPE_SIZE),null==h)return null;const d=new u(e,t,i,h,l),p=[{frame:0,value:o},{frame:s,value:a}];return d.setKeys(p),void 0!==c&&d.setEasingFunction(c),d}static CreateAnimation(e,t,i,n){const r=new u(e+"Animation",e,i,t,u.ANIMATIONLOOPMODE_CONSTANT);return r.setEasingFunction(n),r}static CreateAndStartAnimation(e,t,i,n,r,s,o,a,l,c,h){const _=u._PrepareAnimation(e,i,n,r,s,o,a,l);return _?(t.getScene&&(h=t.getScene()),h?h.beginDirectAnimation(t,[_],0,r,1===_.loopMode,1,c):null):null}static CreateAndStartHierarchyAnimation(e,t,i,n,r,s,o,a,l,c,h){const _=u._PrepareAnimation(e,n,r,s,o,a,l,c);return _?t.getScene().beginDirectHierarchyAnimation(t,i,[_],0,s,1===_.loopMode,1,h):null}static CreateMergeAndStartAnimation(e,t,i,n,r,s,o,a,l,c){const h=u._PrepareAnimation(e,i,n,r,s,o,a,l);return h?(t.animations.push(h),t.getScene().beginAnimation(t,0,r,1===h.loopMode,1,c)):null}static MakeAnimationAdditive(e,t=0,i,r=!1,s){let o=e;if(r&&(o=e.clone(),o.name=s||o.name),!o._keys.length)return o;t=t>=0?t:0;let a=0;const l=o._keys[0];let c=o._keys.length-1;const h=o._keys[c],_={referenceValue:l.value,referencePosition:n.jp.Vector3[0],referenceQuaternion:n.jp.Quaternion[0],referenceScaling:n.jp.Vector3[1],keyPosition:n.jp.Vector3[2],keyQuaternion:n.jp.Quaternion[1],keyScaling:n.jp.Vector3[3]};let d=!1,p=l.frame,f=h.frame;if(i){const e=o.getRange(i);e&&(p=e.from,f=e.to)}let m=l.frame===p,g=h.frame===f;if(1===o._keys.length){const e=o._getKeyValue(o._keys[0]);_.referenceValue=e.clone?e.clone():e,d=!0}else if(t<=l.frame){const e=o._getKeyValue(l.value);_.referenceValue=e.clone?e.clone():e,d=!0}else if(t>=h.frame){const e=o._getKeyValue(h.value);_.referenceValue=e.clone?e.clone():e,d=!0}let b=0;for(;!d||!m||!g&&b=e.frame&&t<=i.frame){let n;if(t===e.frame)n=o._getKeyValue(e.value);else if(t===i.frame)n=o._getKeyValue(i.value);else{const e={key:b,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT};n=o._interpolate(t,e)}_.referenceValue=n.clone?n.clone():n,d=!0}if(!m&&p>=e.frame&&p<=i.frame){if(p===e.frame)a=b;else if(p===i.frame)a=b+1;else{const e={key:b,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},t=o._interpolate(p,e),i={frame:p,value:t.clone?t.clone():t};o._keys.splice(b+1,0,i),a=b+1}m=!0}if(!g&&f>=e.frame&&f<=i.frame){if(f===e.frame)c=b;else if(f===i.frame)c=b+1;else{const e={key:b,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},t=o._interpolate(f,e),i={frame:f,value:t.clone?t.clone():t};o._keys.splice(b+1,0,i),c=b+1}g=!0}b++}for(o.dataType===u.ANIMATIONTYPE_QUATERNION?_.referenceValue.normalize().conjugateInPlace():o.dataType===u.ANIMATIONTYPE_MATRIX&&(_.referenceValue.decompose(_.referenceScaling,_.referenceQuaternion,_.referencePosition),_.referenceQuaternion.normalize().conjugateInPlace()),b=a;b<=c;b++){const e=o._keys[b];if(!b||o.dataType===u.ANIMATIONTYPE_FLOAT||e.value!==l.value)switch(o.dataType){case u.ANIMATIONTYPE_MATRIX:e.value.decompose(_.keyScaling,_.keyQuaternion,_.keyPosition),_.keyPosition.subtractInPlace(_.referencePosition),_.keyScaling.divideInPlace(_.referenceScaling),_.referenceQuaternion.multiplyToRef(_.keyQuaternion,_.keyQuaternion),n.y3.ComposeToRef(_.keyScaling,_.keyQuaternion,_.keyPosition,e.value);break;case u.ANIMATIONTYPE_QUATERNION:_.referenceValue.multiplyToRef(e.value,e.value);break;case u.ANIMATIONTYPE_VECTOR2:case u.ANIMATIONTYPE_VECTOR3:case u.ANIMATIONTYPE_COLOR3:case u.ANIMATIONTYPE_COLOR4:e.value.subtractToRef(_.referenceValue,e.value);break;case u.ANIMATIONTYPE_SIZE:e.value.width-=_.referenceValue.width,e.value.height-=_.referenceValue.height;break;default:e.value-=_.referenceValue}}return o}static TransitionTo(e,t,i,n,r,s,o,a=null){if(o<=0)return i[e]=t,a&&a(),null;const l=r*(o/1e3);s.setKeys([{frame:0,value:i[e].clone?i[e].clone():i[e]},{frame:l,value:t}]),i.animations||(i.animations=[]),i.animations.push(s);const c=n.beginAnimation(i,0,l,!1);return c.onAnimationEnd=a,c}get runtimeAnimations(){return this._runtimeAnimations}get hasRunningRuntimeAnimations(){for(const e of this._runtimeAnimations)if(!e.isStopped())return!0;return!1}toString(e){let t="Name: "+this.name+", property: "+this.targetProperty;if(t+=", datatype: "+["Float","Vector3","Quaternion","Matrix","Color3","Vector2"][this.dataType],t+=", nKeys: "+(this._keys?this._keys.length:"none"),t+=", nRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";let e=!0;for(const i in this._ranges)e&&(t+=", ",e=!1),t+=i;t+="}"}return t}addEvent(e){this._events.push(e),this._events.sort(((e,t)=>e.frame-t.frame))}removeEvents(e){for(let t=0;t=0;i--)this._keys[i].frame>=e&&this._keys[i].frame<=t&&this._keys.splice(i,1)}this._ranges[e]=null}}getRange(e){return this._ranges[e]}getKeys(){return this._keys}getHighestFrame(){let e=0;for(let t=0,i=this._keys.length;t0)return t.highLimitValue.clone?t.highLimitValue.clone():t.highLimitValue;const i=this._keys,n=i.length;let r=t.key;for(;r>=0&&e=i[r+1].frame;)++r;if(t.key=r,r<0)return this._getKeyValue(i[0].value);if(r+1>n-1)return this._getKeyValue(i[n-1].value);const s=i[r],o=i[r+1],a=this._getKeyValue(s.value),c=this._getKeyValue(o.value);if(s.interpolation===l.N.STEP)return o.frame>e?a:c;const h=void 0!==s.outTangent&&void 0!==o.inTangent,_=o.frame-s.frame;let d=(e-s.frame)/_;const p=this.getEasingFunction();switch(null!==p&&(d=p.ease(d)),this.dataType){case u.ANIMATIONTYPE_FLOAT:{const e=h?this.floatInterpolateFunctionWithTangents(a,s.outTangent*_,c,o.inTangent*_,d):this.floatInterpolateFunction(a,c,d);switch(t.loopMode){case u.ANIMATIONLOOPMODE_CYCLE:case u.ANIMATIONLOOPMODE_CONSTANT:return e;case u.ANIMATIONLOOPMODE_RELATIVE:return t.offsetValue*t.repeatCount+e}break}case u.ANIMATIONTYPE_QUATERNION:{const e=h?this.quaternionInterpolateFunctionWithTangents(a,s.outTangent.scale(_),c,o.inTangent.scale(_),d):this.quaternionInterpolateFunction(a,c,d);switch(t.loopMode){case u.ANIMATIONLOOPMODE_CYCLE:case u.ANIMATIONLOOPMODE_CONSTANT:return e;case u.ANIMATIONLOOPMODE_RELATIVE:return e.addInPlace(t.offsetValue.scale(t.repeatCount))}return e}case u.ANIMATIONTYPE_VECTOR3:{const e=h?this.vector3InterpolateFunctionWithTangents(a,s.outTangent.scale(_),c,o.inTangent.scale(_),d):this.vector3InterpolateFunction(a,c,d);switch(t.loopMode){case u.ANIMATIONLOOPMODE_CYCLE:case u.ANIMATIONLOOPMODE_CONSTANT:return e;case u.ANIMATIONLOOPMODE_RELATIVE:return e.add(t.offsetValue.scale(t.repeatCount))}break}case u.ANIMATIONTYPE_VECTOR2:{const e=h?this.vector2InterpolateFunctionWithTangents(a,s.outTangent.scale(_),c,o.inTangent.scale(_),d):this.vector2InterpolateFunction(a,c,d);switch(t.loopMode){case u.ANIMATIONLOOPMODE_CYCLE:case u.ANIMATIONLOOPMODE_CONSTANT:return e;case u.ANIMATIONLOOPMODE_RELATIVE:return e.add(t.offsetValue.scale(t.repeatCount))}break}case u.ANIMATIONTYPE_SIZE:switch(t.loopMode){case u.ANIMATIONLOOPMODE_CYCLE:case u.ANIMATIONLOOPMODE_CONSTANT:return this.sizeInterpolateFunction(a,c,d);case u.ANIMATIONLOOPMODE_RELATIVE:return this.sizeInterpolateFunction(a,c,d).add(t.offsetValue.scale(t.repeatCount))}break;case u.ANIMATIONTYPE_COLOR3:{const e=h?this.color3InterpolateFunctionWithTangents(a,s.outTangent.scale(_),c,o.inTangent.scale(_),d):this.color3InterpolateFunction(a,c,d);switch(t.loopMode){case u.ANIMATIONLOOPMODE_CYCLE:case u.ANIMATIONLOOPMODE_CONSTANT:return e;case u.ANIMATIONLOOPMODE_RELATIVE:return e.add(t.offsetValue.scale(t.repeatCount))}break}case u.ANIMATIONTYPE_COLOR4:{const e=h?this.color4InterpolateFunctionWithTangents(a,s.outTangent.scale(_),c,o.inTangent.scale(_),d):this.color4InterpolateFunction(a,c,d);switch(t.loopMode){case u.ANIMATIONLOOPMODE_CYCLE:case u.ANIMATIONLOOPMODE_CONSTANT:return e;case u.ANIMATIONLOOPMODE_RELATIVE:return e.add(t.offsetValue.scale(t.repeatCount))}break}case u.ANIMATIONTYPE_MATRIX:switch(t.loopMode){case u.ANIMATIONLOOPMODE_CYCLE:case u.ANIMATIONLOOPMODE_CONSTANT:return u.AllowMatricesInterpolation?this.matrixInterpolateFunction(a,c,d,t.workValue):a;case u.ANIMATIONLOOPMODE_RELATIVE:return a}}return 0}matrixInterpolateFunction(e,t,i,r){return u.AllowMatrixDecomposeForInterpolation?r?(n.y3.DecomposeLerpToRef(e,t,i,r),r):n.y3.DecomposeLerp(e,t,i):r?(n.y3.LerpToRef(e,t,i,r),r):n.y3.Lerp(e,t,i)}clone(){const e=new u(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed,this._keys&&e.setKeys(this._keys),this._ranges){e._ranges={};for(const t in this._ranges){const i=this._ranges[t];i&&(e._ranges[t]=i.clone())}}return e}setKeys(e){this._keys=e.slice(0)}serialize(){const e={};e.name=this.name,e.property=this.targetProperty,e.framePerSecond=this.framePerSecond,e.dataType=this.dataType,e.loopBehavior=this.loopMode,e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed;const t=this.dataType;e.keys=[];const i=this.getKeys();for(let n=0;n=2&&(l=t.values[1]),t.values.length>=3&&(c=t.values[2]),t.values.length>=4&&(h=t.values[3]);break;case u.ANIMATIONTYPE_QUATERNION:if(o=n._f.FromArray(t.values),t.values.length>=8){const e=n._f.FromArray(t.values.slice(4,8));e.equals(n._f.Zero())||(l=e)}if(t.values.length>=12){const e=n._f.FromArray(t.values.slice(8,12));e.equals(n._f.Zero())||(c=e)}t.values.length>=13&&(h=t.values[12]);break;case u.ANIMATIONTYPE_MATRIX:o=n.y3.FromArray(t.values),t.values.length>=17&&(h=t.values[16]);break;case u.ANIMATIONTYPE_COLOR3:o=r.Wo.FromArray(t.values),t.values[3]&&(l=r.Wo.FromArray(t.values[3])),t.values[4]&&(c=r.Wo.FromArray(t.values[4])),t.values[5]&&(h=t.values[5]);break;case u.ANIMATIONTYPE_COLOR4:o=r.HE.FromArray(t.values),t.values[4]&&(l=r.HE.FromArray(t.values[4])),t.values[5]&&(c=r.HE.FromArray(t.values[5])),t.values[6]&&(h=r.HE.FromArray(t.values[6]));break;case u.ANIMATIONTYPE_VECTOR3:default:o=n.P.FromArray(t.values),t.values[3]&&(l=n.P.FromArray(t.values[3])),t.values[4]&&(c=n.P.FromArray(t.values[4])),t.values[5]&&(h=t.values[5])}const _={};_.frame=t.frame,_.value=o,null!=l&&(_.inTangent=l),null!=c&&(_.outTangent=c),null!=h&&(_.interpolation=h),s.push(_)}if(t.setKeys(s),e.ranges)for(a=0;a{const r=new d.g;r.addEventListener("readystatechange",(()=>{if(4==r.readyState)if(200==r.status){let t=JSON.parse(r.responseText);if(t.animations&&(t=t.animations),t.length){const e=new Array;for(const i of t)e.push(this.Parse(i));i(e)}else{const n=this.Parse(t);e&&(n.name=e),i(n)}}else n("Unable to load the animation")})),r.open("GET",t),r.send()}))}static ParseFromSnippetAsync(e){return new Promise(((t,i)=>{const n=new d.g;n.addEventListener("readystatechange",(()=>{if(4==n.readyState)if(200==n.status){const i=JSON.parse(JSON.parse(n.responseText).jsonPayload);if(i.animations){const n=JSON.parse(i.animations),r=new Array;for(const t of n.animations){const i=this.Parse(t);i.snippetId=e,r.push(i)}t(r)}else{const n=JSON.parse(i.animation),r=this.Parse(n);r.snippetId=e,t(r)}}else i("Unable to load the snippet "+e)})),n.open("GET",this.SnippetUrl+"/"+e.replace(/#/g,"/")),n.send()}))}}u._UniqueIdGenerator=0,u.AllowMatricesInterpolation=!1,u.AllowMatrixDecomposeForInterpolation=!0,u.SnippetUrl="https://snippet.babylonjs.com",u.ANIMATIONTYPE_FLOAT=0,u.ANIMATIONTYPE_VECTOR3=1,u.ANIMATIONTYPE_QUATERNION=2,u.ANIMATIONTYPE_MATRIX=3,u.ANIMATIONTYPE_COLOR3=4,u.ANIMATIONTYPE_COLOR4=7,u.ANIMATIONTYPE_VECTOR2=5,u.ANIMATIONTYPE_SIZE=6,u.ANIMATIONLOOPMODE_RELATIVE=0,u.ANIMATIONLOOPMODE_CYCLE=1,u.ANIMATIONLOOPMODE_CONSTANT=2,u.CreateFromSnippetAsync=u.ParseFromSnippetAsync,(0,a.H)("BABYLON.Animation",u),h.N._AnimationRangeFactory=(e,t,i)=>new c.X(e,t,i)},"../../../node_modules/@babylonjs/core/Animations/animationEvent.js":function(e,t,i){"use strict";i.d(t,{O:function(){return n}});class n{constructor(e,t,i){this.frame=e,this.action=t,this.onlyOnce=i,this.isDone=!1}_clone(){return new n(this.frame,this.action,this.onlyOnce)}}},"../../../node_modules/@babylonjs/core/Animations/animationGroup.js":function(e,t,i){"use strict";i.d(t,{O:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/Animations/animation.js"),r=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),s=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),o=i("../../../node_modules/@babylonjs/core/Misc/tags.js");class a{getClassName(){return"TargetedAnimation"}serialize(){const e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e}}class l{constructor(e,t=null){this.name=e,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this._isAdditive=!1,this._parentContainer=null,this.onAnimationEndObservable=new r.y$,this.onAnimationLoopObservable=new r.y$,this.onAnimationGroupLoopObservable=new r.y$,this.onAnimationGroupEndObservable=new r.y$,this.onAnimationGroupPauseObservable=new r.y$,this.onAnimationGroupPlayObservable=new r.y$,this.metadata=null,this._animationLoopFlags=[],this._scene=t||s.l.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.addAnimationGroup(this)}get from(){return this._from}get to(){return this._to}get isStarted(){return this._isStarted}get isPlaying(){return this._isStarted&&!this._isPaused}get speedRatio(){return this._speedRatio}set speedRatio(e){if(this._speedRatio!==e){this._speedRatio=e;for(let e=0;en[0].frame&&(this._from=n[0].frame),this._toe){const t={frame:e,value:r.value,inTangent:r.inTangent,outTangent:r.outTangent,interpolation:r.interpolation};n.splice(0,0,t)}if(s.frame{this.onAnimationLoopObservable.notifyObservers(t),this._animationLoopFlags[i]||(this._animationLoopFlags[i]=!0,this._animationLoopCount++,this._animationLoopCount===this._targetedAnimations.length&&(this.onAnimationGroupLoopObservable.notifyObservers(this),this._animationLoopCount=0,this._animationLoopFlags.length=0))}}start(e=!1,t=1,i,n,r){if(this._isStarted||0===this._targetedAnimations.length)return this;this._loopAnimation=e,this._animationLoopCount=0,this._animationLoopFlags.length=0;for(let s=0;s{this.onAnimationEndObservable.notifyObservers(o),this._checkAnimationGroupEnded(a)},this._processLoop(a,o,s),this._animatables.push(a)}return this._speedRatio=t,this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this}pause(){if(!this._isStarted)return this;this._isPaused=!0;for(let e=0;e-1&&this._scene.animationGroups.splice(e,1),this._parentContainer){const e=this._parentContainer.animationGroups.indexOf(this);e>-1&&this._parentContainer.animationGroups.splice(e,1),this._parentContainer=null}this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()}_checkAnimationGroupEnded(e){const t=this._animatables.indexOf(e);t>-1&&this._animatables.splice(t,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))}clone(e,t,i=!1){const n=new l(e||this.name,this._scene);for(const e of this._targetedAnimations)n.addTargetedAnimation(i?e.animation.clone():e.animation,t?t(e.target):e.target);return n}serialize(){const e={};e.name=this.name,e.from=this.from,e.to=this.to,e.targetedAnimations=[];for(let t=0;tt0&&(r=!0,this._soundLoaded(t));break;case"AudioBuffer":this._audioBufferLoaded(t);break;case"String":i.push(t);case"Array":0===i.length&&(i=t);for(let e=0;e{this._isReadyToPlay=!0,this.autoplay&&this.play(0,this._offset,this._length),this._readyToPlayCallback&&this._readyToPlayCallback()})),document.body.appendChild(this._htmlAudioElement),this._htmlAudioElement.load()):this._scene._loadFile(t,(e=>{this._soundLoaded(e)}),void 0,!0,!0,(e=>{e&&a.Y.Error("XHR "+e.status+" error on: "+t+"."),a.Y.Error("Sound creation aborted."),this._scene.mainSoundTrack.removeSound(this)}));break}}break;default:e=!1}e?r||(this._isReadyToPlay=!0,this._readyToPlayCallback&&window.setTimeout((()=>{this._readyToPlayCallback&&this._readyToPlayCallback()}),1e3)):a.Y.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.")}catch(e){a.Y.Error("Unexpected error. Sound creation aborted."),this._scene.mainSoundTrack.removeSound(this)}}else this._scene.mainSoundTrack.addSound(this),o.D.audioEngine&&!o.D.audioEngine.WarnedWebAudioUnsupported&&(a.Y.Error("Web Audio is not supported by your browser."),o.D.audioEngine.WarnedWebAudioUnsupported=!0),this._readyToPlayCallback&&window.setTimeout((()=>{this._readyToPlayCallback&&this._readyToPlayCallback()}),1e3)}get loop(){return this._loop}set loop(e){e!==this._loop&&(this._loop=e,this.updateOptions({loop:e}))}get currentTime(){var e;if(this._htmlAudioElement)return this._htmlAudioElement.currentTime;let t=this._startOffset;return this.isPlaying&&(null===(e=o.D.audioEngine)||void 0===e?void 0:e.audioContext)&&(t+=o.D.audioEngine.audioContext.currentTime-this._startTime),t}get spatialSound(){return this._spatialSound}set spatialSound(e){var t;this._spatialSound=e,this._spatialSound&&(null===(t=o.D.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&o.D.audioEngine.audioContext&&this._createSpatialParameters()}dispose(){var e;(null===(e=o.D.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&(this.isPlaying&&this.stop(),this._isReadyToPlay=!1,-1===this.soundTrackId?this._scene.mainSoundTrack.removeSound(this):this._scene.soundTracks&&this._scene.soundTracks[this.soundTrackId].removeSound(this),this._soundGain&&(this._soundGain.disconnect(),this._soundGain=null),this._soundPanner&&(this._soundPanner.disconnect(),this._soundPanner=null),this._soundSource&&(this._soundSource.disconnect(),this._soundSource=null),this._audioBuffer=null,this._htmlAudioElement&&(this._htmlAudioElement.pause(),this._htmlAudioElement.src="",document.body.removeChild(this._htmlAudioElement)),this._streamingSource&&this._streamingSource.disconnect(),this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._connectedTransformNode=null))}isReady(){return this._isReadyToPlay}getClassName(){return"Sound"}_audioBufferLoaded(e){var t;(null===(t=o.D.audioEngine)||void 0===t?void 0:t.audioContext)&&(this._audioBuffer=e,this._isReadyToPlay=!0,this.autoplay&&this.play(0,this._offset,this._length),this._readyToPlayCallback&&this._readyToPlayCallback())}_soundLoaded(e){var t;(null===(t=o.D.audioEngine)||void 0===t?void 0:t.audioContext)&&o.D.audioEngine.audioContext.decodeAudioData(e,(e=>{this._audioBufferLoaded(e)}),(e=>{a.Y.Error("Error while decoding audio data for: "+this.name+" / Error: "+e)}))}setAudioBuffer(e){var t;(null===(t=o.D.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&(this._audioBuffer=e,this._isReadyToPlay=!0)}updateOptions(e){var t,i,n,r,s,o,a,l,c,h;e&&(this.loop=null!==(t=e.loop)&&void 0!==t?t:this.loop,this.maxDistance=null!==(i=e.maxDistance)&&void 0!==i?i:this.maxDistance,this.useCustomAttenuation=null!==(n=e.useCustomAttenuation)&&void 0!==n?n:this.useCustomAttenuation,this.rolloffFactor=null!==(r=e.rolloffFactor)&&void 0!==r?r:this.rolloffFactor,this.refDistance=null!==(s=e.refDistance)&&void 0!==s?s:this.refDistance,this.distanceModel=null!==(o=e.distanceModel)&&void 0!==o?o:this.distanceModel,this._playbackRate=null!==(a=e.playbackRate)&&void 0!==a?a:this._playbackRate,this._length=null!==(l=e.length)&&void 0!==l?l:void 0,this._offset=null!==(c=e.offset)&&void 0!==c?c:void 0,this.setVolume(null!==(h=e.volume)&&void 0!==h?h:this._volume),this._updateSpatialParameters(),this.isPlaying&&(this._streaming&&this._htmlAudioElement?(this._htmlAudioElement.playbackRate=this._playbackRate,this._htmlAudioElement.loop!==this.loop&&(this._htmlAudioElement.loop=this.loop)):this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate,this._soundSource.loop!==this.loop&&(this._soundSource.loop=this.loop),void 0!==this._offset&&this._soundSource.loopStart!==this._offset&&(this._soundSource.loopStart=this._offset),void 0!==this._length&&this._length!==this._soundSource.loopEnd&&(this._soundSource.loopEnd=(0|this._offset)+this._length))))}_createSpatialParameters(){var e,t;(null===(e=o.D.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&o.D.audioEngine.audioContext&&(this._scene.headphone&&(this._panningModel="HRTF"),this._soundPanner=null!==(t=this._soundPanner)&&void 0!==t?t:o.D.audioEngine.audioContext.createPanner(),this._soundPanner&&this._outputAudioNode&&(this._updateSpatialParameters(),this._soundPanner.connect(this._outputAudioNode),this._inputAudioNode=this._soundPanner))}_updateSpatialParameters(){this._spatialSound&&this._soundPanner&&(this.useCustomAttenuation?(this._soundPanner.distanceModel="linear",this._soundPanner.maxDistance=Number.MAX_VALUE,this._soundPanner.refDistance=1,this._soundPanner.rolloffFactor=1,this._soundPanner.panningModel=this._panningModel):(this._soundPanner.distanceModel=this.distanceModel,this._soundPanner.maxDistance=this.maxDistance,this._soundPanner.refDistance=this.refDistance,this._soundPanner.rolloffFactor=this.rolloffFactor,this._soundPanner.panningModel=this._panningModel))}switchPanningModelToHRTF(){this._panningModel="HRTF",this._switchPanningModel()}switchPanningModelToEqualPower(){this._panningModel="equalpower",this._switchPanningModel()}_switchPanningModel(){var e;(null===(e=o.D.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&this._spatialSound&&this._soundPanner&&(this._soundPanner.panningModel=this._panningModel)}connectToSoundTrackAudioNode(e){var t;(null===(t=o.D.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&(this._isOutputConnected&&this._outputAudioNode.disconnect(),this._outputAudioNode.connect(e),this._isOutputConnected=!0)}setDirectionalCone(e,t,i){t{this._onended()},this._htmlAudioElement.playbackRate=this._playbackRate),this._streamingSource.disconnect(),this._inputAudioNode&&this._streamingSource.connect(this._inputAudioNode),this._htmlAudioElement){const e=()=>{var t,i;if(null===(t=o.D.audioEngine)||void 0===t?void 0:t.unlocked){const t=this._htmlAudioElement.play();void 0!==t&&t.catch((()=>{var t,i;null===(t=o.D.audioEngine)||void 0===t||t.lock(),(this.loop||this.autoplay)&&(null===(i=o.D.audioEngine)||void 0===i||i.onAudioUnlockedObservable.addOnce((()=>{e()})))}))}else(this.loop||this.autoplay)&&(null===(i=o.D.audioEngine)||void 0===i||i.onAudioUnlockedObservable.addOnce((()=>{e()})))};e()}}else{const r=()=>{var r,s,a;if(null===(r=o.D.audioEngine)||void 0===r?void 0:r.audioContext){if(i=i||this._length,t=t||this._offset,this._soundSource){const e=this._soundSource;e.onended=()=>{e.disconnect()}}if(this._soundSource=null===(s=o.D.audioEngine)||void 0===s?void 0:s.audioContext.createBufferSource(),this._soundSource&&this._inputAudioNode){this._soundSource.buffer=this._audioBuffer,this._soundSource.connect(this._inputAudioNode),this._soundSource.loop=this.loop,void 0!==t&&(this._soundSource.loopStart=t),void 0!==i&&(this._soundSource.loopEnd=(0|t)+i),this._soundSource.playbackRate.value=this._playbackRate,this._soundSource.onended=()=>{this._onended()},n=e?(null===(a=o.D.audioEngine)||void 0===a?void 0:a.audioContext.currentTime)+e:o.D.audioEngine.audioContext.currentTime;const r=this.isPaused?this._startOffset%this._soundSource.buffer.duration:t||0;this._soundSource.start(n,r,this.loop?void 0:i)}}};"suspended"===(null===(l=o.D.audioEngine)||void 0===l?void 0:l.audioContext.state)?setTimeout((()=>{var e;"suspended"===(null===(e=o.D.audioEngine)||void 0===e?void 0:e.audioContext.state)?(o.D.audioEngine.lock(),(this.loop||this.autoplay)&&o.D.audioEngine.onAudioUnlockedObservable.addOnce((()=>{r()}))):r()}),500):r()}this._startTime=n,this.isPlaying=!0,this.isPaused=!1}catch(e){a.Y.Error("Error while trying to play audio: "+this.name+", "+e.message)}}_onended(){this.isPlaying=!1,this._startOffset=0,this.onended&&this.onended(),this.onEndedObservable.notifyObservers(this)}stop(e){var t;if(this.isPlaying)if(this._streaming)this._htmlAudioElement?(this._htmlAudioElement.pause(),this._htmlAudioElement.currentTime>0&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect(),this.isPlaying=!1;else if((null===(t=o.D.audioEngine)||void 0===t?void 0:t.audioContext)&&this._soundSource){const t=e?o.D.audioEngine.audioContext.currentTime+e:void 0;this._soundSource.stop(t),void 0===t?(this.isPlaying=!1,this._soundSource.onended=()=>{}):this._soundSource.onended=()=>{this.isPlaying=!1},this.isPaused||(this._startOffset=0)}}pause(){var e;this.isPlaying&&(this.isPaused=!0,this._streaming?(this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect(),this.isPlaying=!1):(null===(e=o.D.audioEngine)||void 0===e?void 0:e.audioContext)&&(this.stop(0),this._startOffset+=o.D.audioEngine.audioContext.currentTime-this._startTime))}setVolume(e,t){var i;(null===(i=o.D.audioEngine)||void 0===i?void 0:i.canUseWebAudio)&&this._soundGain&&(t&&o.D.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(o.D.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,o.D.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,o.D.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e}setPlaybackRate(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))}getVolume(){return this._volume}attachToMesh(e){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,this._spatialSound||(this._spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=e=>this._onRegisterAfterWorldMatrixUpdate(e),this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)}detachFromMesh(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)}_onRegisterAfterWorldMatrixUpdate(e){var t;if(e.getBoundingInfo){const t=e.getBoundingInfo();this.setPosition(t.boundingSphere.centerWorld)}else this.setPosition(e.absolutePosition);(null===(t=o.D.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._isDirectional&&this.isPlaying&&this._updateDirection()}clone(){if(this._streaming)return null;{const e=()=>{this._isReadyToPlay?(i._audioBuffer=this.getAudioBuffer(),i._isReadyToPlay=!0,i.autoplay&&i.play(0,this._offset,this._length)):window.setTimeout(e,300)},t={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},i=new h(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,t);return this.useCustomAttenuation&&i.setAttenuationFunction(this._customAttenuationFunction),i.setPosition(this._position),i.setPlaybackRate(this._playbackRate),e(),i}}getAudioBuffer(){return this._audioBuffer}getSoundSource(){return this._soundSource}getSoundGain(){return this._soundGain}serialize(){const e={name:this.name,url:this.name,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId,metadata:this.metadata};return this._spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e}static Parse(e,t,i,n){const r=e.name;let o;o=e.url?i+e.url:i+r;const a={autoplay:e.autoplay,loop:e.loop,volume:e.volume,spatialSound:e.spatialSound,maxDistance:e.maxDistance,rolloffFactor:e.rolloffFactor,refDistance:e.refDistance,distanceModel:e.distanceModel,playbackRate:e.playbackRate};let l;if(n){const e=()=>{n._isReadyToPlay?(l._audioBuffer=n.getAudioBuffer(),l._isReadyToPlay=!0,l.autoplay&&l.play(0,l._offset,l._length)):window.setTimeout(e,300)};l=new h(r,new ArrayBuffer(0),t,null,a),e()}else l=new h(r,o,t,(()=>{t.removePendingData(l)}),a),t.addPendingData(l);if(e.position){const t=s.P.FromArray(e.position);l.setPosition(t)}if(e.isDirectional&&(l.setDirectionalCone(e.coneInnerAngle||360,e.coneOuterAngle||360,e.coneOuterGain||0),e.localDirectionToMesh)){const t=s.P.FromArray(e.localDirectionToMesh);l.setLocalDirectionToMesh(t)}if(e.connectedMeshId){const i=t.getMeshById(e.connectedMeshId);i&&l.attachToMesh(i)}return e.metadata&&(l.metadata=e.metadata),l}}h._SceneComponentInitialization=e=>{throw(0,l.S)("AudioSceneComponent")}},"../../../node_modules/@babylonjs/core/Audio/weightedsound.js":function(e,t,i){"use strict";i.d(t,{s:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Misc/logger.js");class r{constructor(e,t,i){if(this.loop=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._volume=1,this.isPlaying=!1,this.isPaused=!1,this._sounds=[],this._weights=[],t.length!==i.length)throw new Error("Sounds length does not equal weights length");this.loop=e,this._weights=i;let n=0;for(const e of i)n+=e;const r=n>0?1/n:0;for(let e=0;e{this._onended()}))}get directionalConeInnerAngle(){return this._coneInnerAngle}set directionalConeInnerAngle(e){if(e!==this._coneInnerAngle){if(this._coneOuterAnglec&&(c=Math.min(h-l,0)),a.scaleInPlace(c),a.addToRef(r.pivotMesh.absolutePosition,this._tmpVector),r.pivotMesh.setAbsolutePosition(this._tmpVector),a.addToRef(r.dragMesh.absolutePosition,this._tmpVector),r.dragMesh.setAbsolutePosition(this._tmpVector)}}attach(e){this._ownerNode=e,this._scene=this._ownerNode.getScene(),c._virtualScene||(c._virtualScene=new r.x(this._scene.getEngine(),{virtual:!0}),c._virtualScene.detachControl());const t=e=>this._ownerNode===e||e.isDescendantOf(this._ownerNode)&&(!this.draggableMeshes||-1!==this.draggableMeshes.indexOf(e));this._pointerObserver=this._scene.onPointerObservable.add((e=>{const i=e.event.pointerId;this._virtualMeshesInfo[i]||(this._virtualMeshesInfo[i]=this._createVirtualMeshInfo());const n=this._virtualMeshesInfo[i],r="xr-near"===e.event.pointerType;if(e.type==s.kD.POINTERDOWN){if(!n.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.pickedPoint&&e.pickInfo.ray&&(!r||e.pickInfo.aimTransform)&&t(e.pickInfo.pickedMesh)){if(!this.allowMultiPointer&&this.currentDraggingPointerIds.length>0)return;!this._pointerCamera||this._pointerCamera.cameraRigMode!==l.V.RIG_MODE_NONE||this._pointerCamera._isLeftCamera||this._pointerCamera._isRightCamera||e.pickInfo.ray.origin.copyFrom(this._pointerCamera.globalPosition),this._ownerNode.computeWorldMatrix(!0);const t=this._virtualMeshesInfo[i];r?(this._dragging=e.pickInfo.originMesh?this._dragType.NEAR_DRAG:this._dragType.DRAG_WITH_CONTROLLER,t.originMesh.position.copyFrom(e.pickInfo.aimTransform.position),this._dragging===this._dragType.NEAR_DRAG&&e.pickInfo.gripTransform?t.originMesh.rotationQuaternion.copyFrom(e.pickInfo.gripTransform.rotationQuaternion):t.originMesh.rotationQuaternion.copyFrom(e.pickInfo.aimTransform.rotationQuaternion)):(this._dragging=this._dragType.DRAG,t.originMesh.position.copyFrom(e.pickInfo.ray.origin)),t.lastOriginPosition.copyFrom(t.originMesh.position),t.dragMesh.position.copyFrom(e.pickInfo.pickedPoint),t.lastDragPosition.copyFrom(e.pickInfo.pickedPoint),t.pivotMesh.position.copyFrom(this._ownerNode.getAbsolutePivotPoint()),t.pivotMesh.rotationQuaternion.copyFrom(this._ownerNode.absoluteRotationQuaternion),t.startingPosition.copyFrom(t.dragMesh.position),t.startingPivotPosition.copyFrom(t.pivotMesh.position),t.startingOrientation.copyFrom(t.dragMesh.rotationQuaternion),t.startingPivotOrientation.copyFrom(t.pivotMesh.rotationQuaternion),r?(t.originMesh.addChild(t.dragMesh),t.originMesh.addChild(t.pivotMesh)):t.originMesh.lookAt(t.dragMesh.position),t.dragging=!0,-1===this.currentDraggingPointerIds.indexOf(i)&&this.currentDraggingPointerIds.push(i),this.detachCameraControls&&this._pointerCamera&&!this._pointerCamera.leftCamera&&(this._pointerCamera.inputs&&this._pointerCamera.inputs.attachedToElement?(this._pointerCamera.detachControl(),this._attachedToElement=!0):this._attachedToElement=!1),this._targetDragStart(t.pivotMesh.position,t.pivotMesh.rotationQuaternion,i),this.onDragStartObservable.notifyObservers({position:t.pivotMesh.position})}}else if(e.type==s.kD.POINTERUP||e.type==s.kD.POINTERDOUBLETAP){const e=this.currentDraggingPointerIds.indexOf(i);n.dragging=!1,-1!==e&&(this.currentDraggingPointerIds.splice(e,1),0===this.currentDraggingPointerIds.length&&(this._moving=!1,this._dragging=this._dragType.NONE,this.detachCameraControls&&this._attachedToElement&&this._pointerCamera&&!this._pointerCamera.leftCamera&&(this._pointerCamera.attachControl(!0),this._attachedToElement=!1)),n.originMesh.removeChild(n.dragMesh),n.originMesh.removeChild(n.pivotMesh),this._targetDragEnd(i),this.onDragEndObservable.notifyObservers({}))}else if(e.type==s.kD.POINTERMOVE&&-1!==this.currentDraggingPointerIds.indexOf(i)&&n.dragging&&e.pickInfo&&(e.pickInfo.ray||e.pickInfo.aimTransform)){let t=this.zDragFactor;(this.currentDraggingPointerIds.length>1||e.pickInfo.originMesh)&&(t=0),this._ownerNode.computeWorldMatrix(!0),r?this._pointerUpdateXR(e.pickInfo.aimTransform,e.pickInfo.gripTransform,i,t):this._pointerUpdate2D(e.pickInfo.ray,i,t),this._tmpQuaternion.copyFrom(n.startingPivotOrientation),this._tmpQuaternion.x=-this._tmpQuaternion.x,this._tmpQuaternion.y=-this._tmpQuaternion.y,this._tmpQuaternion.z=-this._tmpQuaternion.z,n.pivotMesh.absoluteRotationQuaternion.multiplyToRef(this._tmpQuaternion,this._tmpQuaternion),n.pivotMesh.absolutePosition.subtractToRef(n.startingPivotPosition,this._tmpVector),this.onDragObservable.notifyObservers({delta:this._tmpVector,position:n.pivotMesh.position,pickInfo:e.pickInfo}),this._targetDrag(this._tmpVector,this._tmpQuaternion,i),n.lastDragPosition.copyFrom(n.dragMesh.absolutePosition),this._moving=!0}}))}_applyZOffset(e,t,i){e.position.z-=e.position.z<1?t*i:t*i*e.position.z,e.position.z<0&&(e.position.z=0)}_targetDragStart(e,t,i){}_targetDrag(e,t,i){}_targetDragEnd(e){}detach(){this._scene&&(this.detachCameraControls&&this._attachedToElement&&this._pointerCamera&&!this._pointerCamera.leftCamera&&(this._pointerCamera.attachControl(!0),this._attachedToElement=!1),this._scene.onPointerObservable.remove(this._pointerObserver));for(const e in this._virtualMeshesInfo)this._virtualMeshesInfo[e].originMesh.dispose(),this._virtualMeshesInfo[e].dragMesh.dispose();this.onDragEndObservable.clear(),this.onDragObservable.clear(),this.onDragStartObservable.clear()}}},"../../../node_modules/@babylonjs/core/Behaviors/Meshes/fadeInOutBehavior.js":function(e,t,i){"use strict";i.d(t,{Y:function(){return n}});class n{constructor(){this.delay=0,this.fadeInTime=300,this._millisecondsPerFrame=1e3/60,this._hovered=!1,this._hoverValue=0,this._ownerNode=null,this._update=()=>{if(this._ownerNode){if(this._hoverValue+=this._hovered?this._millisecondsPerFrame:-this._millisecondsPerFrame,this._setAllVisibility(this._ownerNode,(this._hoverValue-this.delay)/this.fadeInTime),this._ownerNode.visibility>1)return this._setAllVisibility(this._ownerNode,1),void(this._hoverValue=this.fadeInTime+this.delay);if(this._ownerNode.visibility<0&&(this._setAllVisibility(this._ownerNode,0),this._hoverValue<0))return void(this._hoverValue=0);setTimeout(this._update,this._millisecondsPerFrame)}}}get name(){return"FadeInOut"}init(){}attach(e){this._ownerNode=e,this._setAllVisibility(this._ownerNode,0)}detach(){this._ownerNode=null}fadeIn(e){this._hovered=e,this._update()}_setAllVisibility(e,t){e.visibility=t,e.getChildMeshes().forEach((e=>{this._setAllVisibility(e,t)}))}}},"../../../node_modules/@babylonjs/core/Behaviors/Meshes/followBehavior.js":function(e,t,i){"use strict";i.d(t,{j:function(){return o}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js");class o{constructor(){this._tmpQuaternion=new n._f,this._tmpVectors=[new n.P,new n.P,new n.P,new n.P,new n.P,new n.P,new n.P],this._tmpMatrix=new n.y3,this._tmpInvertView=new n.y3,this._tmpForward=new n.P,this._tmpNodeForward=new n.P,this._tmpPosition=new n.P,this._workingPosition=new n.P,this._workingQuaternion=new n._f,this._lastTick=-1,this._recenterNextUpdate=!0,this.interpolatePose=!0,this.lerpTime=500,this.ignoreCameraPitchAndRoll=!1,this.pitchOffset=15,this.maxViewVerticalDegrees=30,this.maxViewHorizontalDegrees=30,this.orientToCameraDeadzoneDegrees=60,this.ignoreDistanceClamp=!1,this.ignoreAngleClamp=!1,this.verticalMaxDistance=0,this.defaultDistance=.8,this.maximumDistance=2,this.minimumDistance=.3,this.useFixedVerticalOffset=!1,this.fixedVerticalOffset=0,this._enabled=!0}get followedCamera(){return this._followedCamera||this._scene.activeCamera}set followedCamera(e){this._followedCamera=e}get name(){return"Follow"}init(){}attach(e,t){this._scene=e.getScene(),this.attachedNode=e,t&&(this.followedCamera=t),this._addObservables()}detach(){this.attachedNode=null,this._removeObservables()}recenter(){this._recenterNextUpdate=!0}_angleBetweenVectorAndPlane(e,t){return this._tmpVectors[0].copyFrom(e),e=this._tmpVectors[0],this._tmpVectors[1].copyFrom(t),t=this._tmpVectors[1],e.normalize(),t.normalize(),Math.PI/2-Math.acos(n.P.Dot(e,t))}_length2D(e){return Math.sqrt(e.x*e.x+e.z*e.z)}_distanceClamp(e,t=!1){let i=this.minimumDistance,n=this.maximumDistance;const s=this.defaultDistance,o=this._tmpVectors[0];o.copyFrom(e);let a=o.length();if(o.normalizeFromLength(a),this.ignoreCameraPitchAndRoll){i=this._length2D(o)*i,n=this._length2D(o)*n;const t=this._length2D(e);o.scaleInPlace(a/t),a=t}let l=a;return l=t?s:r.R.Clamp(a,i,n),e.copyFrom(o).scaleInPlace(l),a!==l}_applyVerticalClamp(e){0!==this.verticalMaxDistance&&(e.y=r.R.Clamp(e.y,-this.verticalMaxDistance,this.verticalMaxDistance))}_toOrientationQuatToRef(e,t){n._f.RotationYawPitchRollToRef(Math.atan2(e.x,e.z),Math.atan2(e.y,Math.sqrt(e.z*e.z+e.x*e.x)),0,t)}_applyPitchOffset(e){const t=this._tmpVectors[0],i=this._tmpVectors[1];t.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),i.copyFromFloats(1,0,0),n.P.TransformNormalToRef(t,e,t),t.y=0,t.normalize(),n.P.TransformNormalToRef(i,e,i),n._f.RotationAxisToRef(i,this.pitchOffset*Math.PI/180,this._tmpQuaternion),t.rotateByQuaternionToRef(this._tmpQuaternion,t),this._toOrientationQuatToRef(t,this._tmpQuaternion),this._tmpQuaternion.toRotationMatrix(this._tmpMatrix),e.copyFrom(this._tmpMatrix)}_angularClamp(e,t){const i=this._tmpVectors[5];i.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1);const r=this._tmpVectors[6];r.copyFromFloats(1,0,0),n.P.TransformNormalToRef(i,e,i),n.P.TransformNormalToRef(r,e,r);const o=n.P.UpReadOnly;if(t.length()s&&(n._f.RotationAxisToRef(r,-e+s,l),t.rotateByQuaternionToRef(l,t),a=!0)}const c=this._angleBetweenVectorAndPlane(t,r)*(this._scene.useRightHandedSystem?-1:1),h=this.maxViewHorizontalDegrees*Math.PI/180*.5;return c<-h?(n._f.RotationAxisToRef(o,-c-h,l),t.rotateByQuaternionToRef(l,t),a=!0):c>h&&(n._f.RotationAxisToRef(o,-c+h,l),t.rotateByQuaternionToRef(l,t),a=!0),a}_orientationClamp(e,t){var i;const r=this._tmpVectors[0];r.copyFrom(e).scaleInPlace(-1).normalize();const o=this._tmpVectors[1],a=this._tmpVectors[2];o.copyFromFloats(0,1,0),n.P.CrossToRef(r,o,a);const l=a.length();lthis.orientToCameraDeadzoneDegrees}_updateLeashing(e){if(this.attachedNode&&this._enabled){const t=this.attachedNode.parent;this.attachedNode.setParent(null);const i=this.attachedNode.getWorldMatrix(),r=this._workingPosition,s=this._workingQuaternion,o=this.attachedNode.getPivotPoint(),a=this._tmpInvertView;a.copyFrom(e.getViewMatrix()),a.invert(),n.P.TransformCoordinatesToRef(o,i,r);const l=this._tmpPosition;l.copyFromFloats(0,0,0),n.P.TransformCoordinatesToRef(l,i,l),l.scaleInPlace(-1).subtractInPlace(o),r.subtractInPlace(e.globalPosition),this.ignoreCameraPitchAndRoll&&this._applyPitchOffset(a);let c=!1;const h=this._tmpForward;h.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),n.P.TransformNormalToRef(h,a,h);const _=this._tmpNodeForward;if(_.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),n.P.TransformNormalToRef(_,i,_),this._recenterNextUpdate)r.copyFrom(h).scaleInPlace(this.defaultDistance);else if(this.ignoreAngleClamp){const e=r.length();r.copyFrom(h).scaleInPlace(e)}else c=this._angularClamp(a,r);let d=!1;this.ignoreDistanceClamp||(d=this._distanceClamp(r,c),this._applyVerticalClamp(r)),this.useFixedVerticalOffset&&(r.y=l.y-e.globalPosition.y+this.fixedVerticalOffset),(c||d||this._passedOrientationDeadzone(r,_)||this._recenterNextUpdate)&&this._orientationClamp(r,s),this._workingPosition.subtractInPlace(o),this._recenterNextUpdate=!1,this.attachedNode.setParent(t)}}_updateTransformToGoal(e){if(!this.attachedNode||!this.followedCamera||!this._enabled)return;this.attachedNode.rotationQuaternion||(this.attachedNode.rotationQuaternion=n._f.Identity());const t=this.attachedNode.parent;if(this.attachedNode.setParent(null),!this.interpolatePose)return this.attachedNode.position.copyFrom(this.followedCamera.globalPosition).addInPlace(this._workingPosition),void this.attachedNode.rotationQuaternion.copyFrom(this._workingQuaternion);const i=new n.P;i.copyFrom(this.attachedNode.position).subtractInPlace(this.followedCamera.globalPosition),n.P.SmoothToRef(i,this._workingPosition,e,this.lerpTime,i),i.addInPlace(this.followedCamera.globalPosition),this.attachedNode.position.copyFrom(i);const r=new n._f;r.copyFrom(this.attachedNode.rotationQuaternion),n._f.SmoothToRef(r,this._workingQuaternion,e,this.lerpTime,this.attachedNode.rotationQuaternion),this.attachedNode.setParent(t)}_addObservables(){this._lastTick=Date.now(),this._onBeforeRender=this._scene.onBeforeRenderObservable.add((()=>{if(!this.followedCamera)return;const e=Date.now();this._updateLeashing(this.followedCamera),this._updateTransformToGoal(e-this._lastTick),this._lastTick=e}))}_removeObservables(){this._onBeforeRender&&this._scene.onBeforeRenderObservable.remove(this._onBeforeRender)}}},"../../../node_modules/@babylonjs/core/Behaviors/Meshes/handConstraintBehavior.js":function(e,t,i){"use strict";var n,r,s;i("../../../node_modules/@babylonjs/core/XR/webXRFeaturesManager.js"),i("../../../node_modules/@babylonjs/core/XR/features/WebXRHandTracking.js"),i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),function(e){e[e.ABOVE_FINGER_TIPS=0]="ABOVE_FINGER_TIPS",e[e.RADIAL_SIDE=1]="RADIAL_SIDE",e[e.ULNAR_SIDE=2]="ULNAR_SIDE",e[e.BELOW_WRIST=3]="BELOW_WRIST"}(n||(n={})),function(e){e[e.LOOK_AT_CAMERA=0]="LOOK_AT_CAMERA",e[e.HAND_ROTATION=1]="HAND_ROTATION"}(r||(r={})),function(e){e[e.ALWAYS_VISIBLE=0]="ALWAYS_VISIBLE",e[e.PALM_UP=1]="PALM_UP",e[e.GAZE_FOCUS=2]="GAZE_FOCUS",e[e.PALM_AND_GAZE=3]="PALM_AND_GAZE"}(s||(s={}))},"../../../node_modules/@babylonjs/core/Behaviors/Meshes/pointerDragBehavior.js":function(e,t,i){"use strict";i.d(t,{M:function(){return _}});var n=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),r=i("../../../node_modules/@babylonjs/core/scene.js"),s=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),a=i("../../../node_modules/@babylonjs/core/Events/pointerEvents.js"),l=i("../../../node_modules/@babylonjs/core/Culling/ray.js"),c=i("../../../node_modules/@babylonjs/core/Misc/pivotTools.js"),h=i("../../../node_modules/@babylonjs/core/Meshes/Builders/planeBuilder.js");class _{constructor(e){this._useAlternatePickedPointAboveMaxDragAngleDragSpeed=-1.1,this._activeDragButton=-1,this.maxDragAngle=0,this.dragButtons=[0,1,2],this._useAlternatePickedPointAboveMaxDragAngle=!1,this.currentDraggingPointerId=-1,this.dragging=!1,this.dragDeltaRatio=.2,this.updateDragPlane=!0,this._debugMode=!1,this._moving=!1,this.onDragObservable=new s.y$,this.onDragStartObservable=new s.y$,this.onDragEndObservable=new s.y$,this.onEnabledObservable=new s.y$,this.moveAttached=!0,this._enabled=!0,this.startAndReleaseDragOnPointerEvents=!0,this.detachCameraControls=!0,this.useObjectOrientationForDragging=!0,this.validateDrag=e=>!0,this._tmpVector=new o.P(0,0,0),this._alternatePickedPoint=new o.P(0,0,0),this._worldDragAxis=new o.P(0,0,0),this._targetPosition=new o.P(0,0,0),this._attachedToElement=!1,this._startDragRay=new l.z(new o.P,new o.P),this._lastPointerRay={},this._dragDelta=new o.P,this._pointA=new o.P(0,0,0),this._pointC=new o.P(0,0,0),this._localAxis=new o.P(0,0,0),this._lookAt=new o.P(0,0,0),this._options=e||{};let t=0;if(this._options.dragAxis&&t++,this._options.dragPlaneNormal&&t++,t>1)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}get currentDraggingPointerID(){return this.currentDraggingPointerId}set currentDraggingPointerID(e){this.currentDraggingPointerId=e}set enabled(e){e!=this._enabled&&this.onEnabledObservable.notifyObservers(e),this._enabled=e}get enabled(){return this._enabled}get options(){return this._options}set options(e){this._options=e}get name(){return"PointerDrag"}init(){}attach(e,t){this._scene=e.getScene(),e.isNearGrabbable=!0,this.attachedNode=e,_._PlaneScene||(this._debugMode?_._PlaneScene=this._scene:(_._PlaneScene=new r.x(this._scene.getEngine(),{virtual:!0}),_._PlaneScene.detachControl(),this._scene.onDisposeObservable.addOnce((()=>{_._PlaneScene.dispose(),_._PlaneScene=null})))),this._dragPlane=(0,h.pT)("pointerDragPlane",{size:this._debugMode?1:1e4,updatable:!1,sideOrientation:n.Kj.DOUBLESIDE},_._PlaneScene),this.lastDragPosition=new o.P(0,0,0);const i=t||(e=>this.attachedNode==e||e.isDescendantOf(this.attachedNode));this._pointerObserver=this._scene.onPointerObservable.add((e=>{if(this.enabled){if(e.type==a.kD.POINTERDOWN)this.startAndReleaseDragOnPointerEvents&&!this.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.pickedPoint&&e.pickInfo.ray&&i(e.pickInfo.pickedMesh)&&-1===this._activeDragButton&&-1!==this.dragButtons.indexOf(e.event.button)&&(this._activeDragButton=e.event.button,this._startDrag(e.event.pointerId,e.pickInfo.ray,e.pickInfo.pickedPoint));else if(e.type==a.kD.POINTERUP)this.startAndReleaseDragOnPointerEvents&&this.currentDraggingPointerId==e.event.pointerId&&this._activeDragButton===e.event.button&&(this.releaseDrag(),this._activeDragButton=-1);else if(e.type==a.kD.POINTERMOVE){const t=e.event.pointerId;if(this.currentDraggingPointerId===_._AnyMouseId&&t!==_._AnyMouseId){const i=e.event;("mouse"===i.pointerType||!this._scene.getEngine().hostInformation.isMobile&&i instanceof MouseEvent)&&(this._lastPointerRay[this.currentDraggingPointerId]&&(this._lastPointerRay[t]=this._lastPointerRay[this.currentDraggingPointerId],delete this._lastPointerRay[this.currentDraggingPointerId]),this.currentDraggingPointerId=t)}this._lastPointerRay[t]||(this._lastPointerRay[t]=new l.z(new o.P,new o.P)),e.pickInfo&&e.pickInfo.ray&&(this._lastPointerRay[t].origin.copyFrom(e.pickInfo.ray.origin),this._lastPointerRay[t].direction.copyFrom(e.pickInfo.ray.direction),this.currentDraggingPointerId==t&&this.dragging&&this._moveDrag(e.pickInfo.ray))}}else this._attachedToElement&&(this.releaseDrag(),this._activeDragButton=-1)})),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add((()=>{if(this._moving&&this.moveAttached){let e=!1;c.m._RemoveAndStorePivotPoint(this.attachedNode),this._targetPosition.subtractToRef(this.attachedNode.absolutePosition,this._tmpVector),this._tmpVector.scaleInPlace(this.dragDeltaRatio),this.attachedNode.getAbsolutePosition().addToRef(this._tmpVector,this._tmpVector),this.validateDrag(this._tmpVector)&&(this.attachedNode.setAbsolutePosition(this._tmpVector),e=!0),c.m._RestorePivotPoint(this.attachedNode),e&&this.attachedNode.computeWorldMatrix()}}))}releaseDrag(){if(this.dragging&&(this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerId})),this.currentDraggingPointerId=-1,this._moving=!1,this.detachCameraControls&&this._attachedToElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera){if("ArcRotateCamera"===this._scene.activeCamera.getClassName()){const e=this._scene.activeCamera;e.attachControl(!e.inputs||e.inputs.noPreventDefault,e._useCtrlForPanning,e._panningMouseButton)}else this._scene.activeCamera.attachControl(!this._scene.activeCamera.inputs||this._scene.activeCamera.inputs.noPreventDefault);this._attachedToElement=!1}}startDrag(e=_._AnyMouseId,t,i){this._startDrag(e,t,i);let n=this._lastPointerRay[e];e===_._AnyMouseId&&(n=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),n&&this._moveDrag(n)}_startDrag(e,t,i){if(!this._scene.activeCamera||this.dragging||!this.attachedNode)return;c.m._RemoveAndStorePivotPoint(this.attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,i||this._tmpVector);const n=this._pickWithRayOnDragPlane(this._startDragRay);n&&(this.dragging=!0,this.currentDraggingPointerId=e,this.lastDragPosition.copyFrom(n),this.onDragStartObservable.notifyObservers({dragPlanePoint:n,pointerId:this.currentDraggingPointerId}),this._targetPosition.copyFrom(this.attachedNode.getAbsolutePosition()),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedToElement?(this._scene.activeCamera.detachControl(),this._attachedToElement=!0):this._attachedToElement=!1)),c.m._RestorePivotPoint(this.attachedNode)}_moveDrag(e){this._moving=!0;const t=this._pickWithRayOnDragPlane(e);if(t){c.m._RemoveAndStorePivotPoint(this.attachedNode),this.updateDragPlane&&this._updateDragPlanePosition(e,t);let i=0;this._options.dragAxis?(this.useObjectOrientationForDragging?o.P.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),i=o.P.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(i,this._dragDelta)):(i=this._dragDelta.length(),t.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragObservable.notifyObservers({dragDistance:i,delta:this._dragDelta,dragPlanePoint:t,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerId}),this.lastDragPosition.copyFrom(t),c.m._RestorePivotPoint(this.attachedNode)}}_pickWithRayOnDragPlane(e){if(!e)return null;let t=Math.acos(o.P.Dot(this._dragPlane.forward,e.direction));if(t>Math.PI/2&&(t=Math.PI-t),this.maxDragAngle>0&&t>this.maxDragAngle){if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(e.direction),this.attachedNode.absolutePosition.subtractToRef(e.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*o.P.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);const t=o.P.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-t,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint}return null}const i=_._PlaneScene.pickWithRay(e,(e=>e==this._dragPlane));return i&&i.hit&&i.pickedMesh&&i.pickedPoint?i.pickedPoint:null}_updateDragPlanePosition(e,t){this._pointA.copyFrom(t),this._options.dragAxis?(this.useObjectOrientationForDragging?o.P.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),e.origin.subtractToRef(this._pointA,this._pointC),this._pointC.normalize(),Math.abs(o.P.Dot(this._localAxis,this._pointC))>.999?Math.abs(o.P.Dot(o.P.UpReadOnly,this._pointC))>.999?this._lookAt.copyFrom(o.P.Right()):this._lookAt.copyFrom(o.P.UpReadOnly):(o.P.CrossToRef(this._localAxis,this._pointC,this._lookAt),o.P.CrossToRef(this._localAxis,this._lookAt,this._lookAt),this._lookAt.normalize()),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrientationForDragging?o.P.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(e.origin)),this._dragPlane.position.copyFrom(this.attachedNode.getAbsolutePosition()),this._dragPlane.computeWorldMatrix(!0)}detach(){this._lastPointerRay={},this.attachedNode&&(this.attachedNode.isNearGrabbable=!1),this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this._dragPlane&&this._dragPlane.dispose(),this.releaseDrag(),this._activeDragButton=-1}}_._AnyMouseId=-2},"../../../node_modules/@babylonjs/core/Behaviors/Meshes/sixDofDragBehavior.js":function(e,t,i){"use strict";i.d(t,{K:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),s=i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/baseSixDofDragBehavior.js"),o=i("../../../node_modules/@babylonjs/core/Meshes/transformNode.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js");class l extends s.N{constructor(){super(...arguments),this._sceneRenderObserver=null,this._targetPosition=new n.P(0,0,0),this._targetOrientation=new n._f,this._targetScaling=new n.P(1,1,1),this._startingPosition=new n.P(0,0,0),this._startingOrientation=new n._f,this._startingScaling=new n.P(1,1,1),this.onPositionChangedObservable=new r.y$,this.dragDeltaRatio=.2,this.rotateDraggedObject=!0,this.rotateAroundYOnly=!1,this.rotateWithMotionController=!0,this.disableMovement=!1,this.faceCameraOnDragStart=!1}get name(){return"SixDofDrag"}attach(e){super.attach(e),e.isNearGrabbable=!0,this._virtualTransformNode=new o.Y("virtual_sixDof",s.N._virtualScene),this._virtualTransformNode.rotationQuaternion=n._f.Identity(),this._sceneRenderObserver=e.getScene().onBeforeRenderObservable.add((()=>{if(1===this.currentDraggingPointerIds.length&&this._moving&&!this.disableMovement){const t=e.parent;e.setParent(null),e.position.addInPlace(this._targetPosition.subtract(e.position).scale(this.dragDeltaRatio)),this.onPositionChangedObservable.notifyObservers({position:e.absolutePosition}),(!t||t.scaling&&!t.scaling.isNonUniformWithinEpsilon(.001))&&n._f.SlerpToRef(e.rotationQuaternion,this._targetOrientation,this.dragDeltaRatio,e.rotationQuaternion),e.setParent(t)}}))}_getPositionOffsetAround(e,t,i){const r=n.jp.Matrix[0],s=n.jp.Matrix[1],o=n.jp.Matrix[2],a=n.jp.Matrix[3],l=n.jp.Matrix[4];return n.y3.TranslationToRef(e.x,e.y,e.z,r),n.y3.TranslationToRef(-e.x,-e.y,-e.z,s),n.y3.FromQuaternionToRef(i,o),n.y3.ScalingToRef(t,t,t,a),s.multiplyToRef(o,l),l.multiplyToRef(a,l),l.multiplyToRef(r,l),l.getTranslation()}_onePointerPositionUpdated(e,t){n.jp.Vector3[0].setAll(0),this._dragging===this._dragType.DRAG?this.rotateDraggedObject&&(this.rotateAroundYOnly?n._f.RotationYawPitchRollToRef(t.toEulerAngles().y,0,0,n.jp.Quaternion[0]):n.jp.Quaternion[0].copyFrom(t),n.jp.Quaternion[0].multiplyToRef(this._startingOrientation,this._targetOrientation)):(this._dragging===this._dragType.NEAR_DRAG||this._dragging===this._dragType.DRAG_WITH_CONTROLLER&&this.rotateWithMotionController)&&t.multiplyToRef(this._startingOrientation,this._targetOrientation),this._targetPosition.copyFrom(this._startingPosition).addInPlace(e)}_twoPointersPositionUpdated(){const e=this._virtualMeshesInfo[this.currentDraggingPointerIds[0]].startingPosition,t=this._virtualMeshesInfo[this.currentDraggingPointerIds[1]].startingPosition,i=n.jp.Vector3[0];e.addToRef(t,i),i.scaleInPlace(.5);const r=n.jp.Vector3[1];t.subtractToRef(e,r);const s=this._virtualMeshesInfo[this.currentDraggingPointerIds[0]].dragMesh.absolutePosition,o=this._virtualMeshesInfo[this.currentDraggingPointerIds[1]].dragMesh.absolutePosition,a=n.jp.Vector3[2];s.addToRef(o,a),a.scaleInPlace(.5);const l=n.jp.Vector3[3];o.subtractToRef(s,l);const c=l.length()/r.length(),h=a.subtract(i),_=n._f.FromEulerAngles(0,n.P.GetAngleBetweenVectorsOnPlane(r.normalize(),l.normalize(),n.P.UpReadOnly),0),d=this._ownerNode.parent;this._ownerNode.setParent(null);const u=this._getPositionOffsetAround(i.subtract(this._virtualTransformNode.getAbsolutePivotPoint()),c,_);this._virtualTransformNode.rotationQuaternion.multiplyToRef(_,this._ownerNode.rotationQuaternion),this._virtualTransformNode.scaling.scaleToRef(c,this._ownerNode.scaling),this._virtualTransformNode.position.addToRef(h.addInPlace(u),this._ownerNode.position),this.onPositionChangedObservable.notifyObservers({position:this._ownerNode.position}),this._ownerNode.setParent(d)}_targetDragStart(){const e=this.currentDraggingPointerIds.length,t=this._ownerNode.parent;this._ownerNode.rotationQuaternion||(this._ownerNode.rotationQuaternion=n._f.RotationYawPitchRoll(this._ownerNode.rotation.y,this._ownerNode.rotation.x,this._ownerNode.rotation.z));const i=this._ownerNode.getAbsolutePivotPoint();if(this._ownerNode.setParent(null),1===e){if(this._targetPosition.copyFrom(this._ownerNode.position),this._targetOrientation.copyFrom(this._ownerNode.rotationQuaternion),this._targetScaling.copyFrom(this._ownerNode.scaling),this.faceCameraOnDragStart&&this._scene.activeCamera){const e=n.jp.Vector3[0];this._scene.activeCamera.position.subtractToRef(i,e),e.normalize();const t=n.jp.Quaternion[0];this._scene.useRightHandedSystem?n._f.FromLookDirectionRHToRef(e,new n.P(0,1,0),t):n._f.FromLookDirectionLHToRef(e,new n.P(0,1,0),t),t.normalize(),n._f.RotationYawPitchRollToRef(t.toEulerAngles().y,0,0,n.jp.Quaternion[0]),this._targetOrientation.copyFrom(n.jp.Quaternion[0])}this._startingPosition.copyFrom(this._targetPosition),this._startingOrientation.copyFrom(this._targetOrientation),this._startingScaling.copyFrom(this._targetScaling)}else 2===e&&(this._virtualTransformNode.setPivotPoint(new n.P(0,0,0),a.T.LOCAL),this._virtualTransformNode.position.copyFrom(this._ownerNode.position),this._virtualTransformNode.scaling.copyFrom(this._ownerNode.scaling),this._virtualTransformNode.rotationQuaternion.copyFrom(this._ownerNode.rotationQuaternion),this._virtualTransformNode.setPivotPoint(i,a.T.WORLD),this._resetVirtualMeshesPosition());this._ownerNode.setParent(t)}_targetDrag(e,t){1===this.currentDraggingPointerIds.length?this._onePointerPositionUpdated(e,t):2===this.currentDraggingPointerIds.length&&this._twoPointersPositionUpdated()}_targetDragEnd(){if(1===this.currentDraggingPointerIds.length){this._resetVirtualMeshesPosition();const e=this.faceCameraOnDragStart;this.faceCameraOnDragStart=!1,this._targetDragStart(),this.faceCameraOnDragStart=e}}detach(){super.detach(),this._ownerNode&&(this._ownerNode.isNearGrabbable=!1,this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver)),this._virtualTransformNode&&this._virtualTransformNode.dispose()}}},"../../../node_modules/@babylonjs/core/Behaviors/Meshes/surfaceMagnetismBehavior.js":function(e,t,i){"use strict";i.d(t,{p:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Events/pointerEvents.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js");class s{constructor(){this._attachPointLocalOffset=new r.P,this._workingPosition=new r.P,this._workingQuaternion=new r._f,this._lastTick=-1,this._hit=!1,this.hitNormalOffset=.05,this.meshes=[],this.interpolatePose=!0,this.lerpTime=250,this.keepOrientationVertical=!0,this.enabled=!0,this.maxStickingDistance=.8}get name(){return"SurfaceMagnetism"}init(){}attach(e,t){this._attachedMesh=e,this._scene=t||e.getScene(),this._attachedMesh.rotationQuaternion||(this._attachedMesh.rotationQuaternion=r._f.RotationYawPitchRoll(this._attachedMesh.rotation.y,this._attachedMesh.rotation.x,this._attachedMesh.rotation.z)),this.updateAttachPoint(),this._workingPosition.copyFrom(this._attachedMesh.position),this._workingQuaternion.copyFrom(this._attachedMesh.rotationQuaternion),this._addObservables()}detach(){this._attachedMesh=null,this._removeObservables()}_getTargetPose(e){if(!this._attachedMesh)return null;if(e&&e.hit){const t=e.getNormal(!0,!0),i=e.pickedPoint;if(!t||!i)return null;t.normalize();const n=r.jp.Vector3[0];return n.copyFrom(t),n.scaleInPlace(this.hitNormalOffset),n.addInPlace(i),this._attachedMesh.parent&&(r.jp.Matrix[0].copyFrom(this._attachedMesh.parent.getWorldMatrix()).invert(),r.P.TransformNormalToRef(n,r.jp.Matrix[0],n)),{position:n,quaternion:r._f.RotationYawPitchRoll(-Math.atan2(t.x,-t.z),this.keepOrientationVertical?0:Math.atan2(t.y,Math.sqrt(t.z*t.z+t.x*t.x)),0)}}return null}updateAttachPoint(){this._getAttachPointOffsetToRef(this._attachPointLocalOffset)}findAndUpdateTarget(e){if(this._hit=!1,!e.ray)return!1;const t=e.ray.intersectsMeshes(this.meshes)[0];if(this._attachedMesh&&t&&t.hit&&t.pickedMesh){const e=this._getTargetPose(t);e&&r.P.Distance(this._attachedMesh.position,e.position){this.enabled&&e.type==n.kD.POINTERMOVE&&e.pickInfo&&this.findAndUpdateTarget(e.pickInfo)})),this._lastTick=Date.now(),this._onBeforeRender=this._scene.onBeforeRenderObservable.add((()=>{const e=Date.now();this._updateTransformToGoal(e-this._lastTick),this._lastTick=e}))}_removeObservables(){this._scene.onPointerObservable.remove(this._pointerObserver),this._scene.onBeforeRenderObservable.remove(this._onBeforeRender),this._pointerObserver=null,this._onBeforeRender=null}}},"../../../node_modules/@babylonjs/core/Bones/bone.js":function(e,t,i){"use strict";i.d(t,{N:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Misc/arrayTools.js"),s=i("../../../node_modules/@babylonjs/core/node.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js");class a extends s.N{constructor(e,t,i=null,r=null,s=null,o=null,a=null){super(e,t.getScene()),this.name=e,this.children=new Array,this.animations=new Array,this._index=null,this._absoluteTransform=new n.y3,this._invertedAbsoluteTransform=new n.y3,this._scalingDeterminant=1,this._worldTransform=new n.y3,this._needToDecompose=!0,this._needToCompose=!1,this._linkedTransformNode=null,this._waitingTransformNodeId=null,this._skeleton=t,this._localMatrix=r?r.clone():n.y3.Identity(),this._restPose=s||this._localMatrix.clone(),this._baseMatrix=o||this._localMatrix.clone(),this._index=a,t.bones.push(this),this.setParent(i,!1),(o||r)&&this._updateDifferenceMatrix()}get _matrix(){return this._compose(),this._localMatrix}set _matrix(e){this._needToCompose=!1,e.updateFlag!==this._localMatrix.updateFlag&&(this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose())}getClassName(){return"Bone"}getSkeleton(){return this._skeleton}get parent(){return this._parentNode}getParent(){return this.parent}getChildren(){return this.children}getIndex(){return null===this._index?this.getSkeleton().bones.indexOf(this):this._index}set parent(e){this.setParent(e)}setParent(e,t=!0){if(this.parent!==e){if(this.parent){const e=this.parent.children.indexOf(this);-1!==e&&this.parent.children.splice(e,1)}this._parentNode=e,this.parent&&this.parent.children.push(this),t&&this._updateDifferenceMatrix(),this.markAsDirty()}}getLocalMatrix(){return this._compose(),this._localMatrix}getBaseMatrix(){return this._baseMatrix}getRestPose(){return this._restPose}setRestPose(e){this._restPose.copyFrom(e)}getBindPose(){return this._baseMatrix}setBindPose(e){this.updateMatrix(e)}getWorldMatrix(){return this._worldTransform}returnToRest(){var e;if(this._linkedTransformNode){const t=n.jp.Vector3[0],i=n.jp.Quaternion[0],r=n.jp.Vector3[1];this.getRestPose().decompose(t,i,r),this._linkedTransformNode.position.copyFrom(r),this._linkedTransformNode.rotationQuaternion=null!==(e=this._linkedTransformNode.rotationQuaternion)&&void 0!==e?e:n._f.Identity(),this._linkedTransformNode.rotationQuaternion.copyFrom(i),this._linkedTransformNode.scaling.copyFrom(t)}else this._matrix=this._restPose}getInvertedAbsoluteTransform(){return this._invertedAbsoluteTransform}getAbsoluteTransform(){return this._absoluteTransform}linkTransformNode(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++}getTransformNode(){return this._linkedTransformNode}get position(){return this._decompose(),this._localPosition}set position(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()}get rotation(){return this.getRotation()}set rotation(e){this.setRotation(e)}get rotationQuaternion(){return this._decompose(),this._localRotation}set rotationQuaternion(e){this.setRotationQuaternion(e)}get scaling(){return this.getScale()}set scaling(e){this.setScale(e)}get animationPropertiesOverride(){return this._skeleton.animationPropertiesOverride}_decompose(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=n.P.Zero(),this._localRotation=n._f.Zero(),this._localPosition=n.P.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))}_compose(){this._needToCompose&&(this._localScaling?(this._needToCompose=!1,n.y3.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)):this._needToCompose=!1)}updateMatrix(e,t=!0,i=!0){this._baseMatrix.copyFrom(e),t&&this._updateDifferenceMatrix(),i?this._matrix=e:this.markAsDirty()}_updateDifferenceMatrix(e,t=!0){if(e||(e=this._baseMatrix),this.parent?e.multiplyToRef(this.parent._absoluteTransform,this._absoluteTransform):this._absoluteTransform.copyFrom(e),this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform),t)for(let e=0;e0}get useTextureToStoreBoneMatrices(){return this._useTextureToStoreBoneMatrices}set useTextureToStoreBoneMatrices(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()}get animationPropertiesOverride(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}get isUsingTextureForMatrices(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones}get uniqueId(){return this._uniqueId}getClassName(){return"Skeleton"}getChildren(){return this.bones.filter((e=>!e.getParent()))}getTransformMatrices(e){return this.needInitialSkinMatrix?(e._bonesTransformMatrices||this.prepare(),e._bonesTransformMatrices):(this._transformMatrices||this.prepare(),this._transformMatrices)}getTransformMatrixTexture(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture}getScene(){return this._scene}toString(e){let t=`Name: ${this.name}, nBones: ${this.bones.length}`;if(t+=`, nAnimationRanges: ${this._ranges?Object.keys(this._ranges).length:"none"}`,e){t+=", Ranges: {";let e=!0;for(const i in this._ranges)e&&(t+=", ",e=!1),t+=i;t+="}"}return t}getBoneIndexByName(e){for(let t=0,i=this.bones.length;t-1&&this._meshesWithPoseMatrix.splice(t,1)}_computeTransformMatrices(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(let i=0;i0)for(const e of this.bones)if(e._linkedTransformNode){const t=e._linkedTransformNode;e.position=t.position,t.rotationQuaternion?e.rotationQuaternion=t.rotationQuaternion:e.rotation=t.rotation,e.scaling=t.scaling}if(this.needInitialSkinMatrix)for(const e of this._meshesWithPoseMatrix){const t=e.getPoseMatrix();let i=this._isDirty;if(e._bonesTransformMatrices&&e._bonesTransformMatrices.length===16*(this.bones.length+1)||(e._bonesTransformMatrices=new Float32Array(16*(this.bones.length+1)),i=!0),i){if(this._synchronizedWithMesh!==e){this._synchronizedWithMesh=e;for(const e of this.bones)e.getParent()||(e.getBaseMatrix().multiplyToRef(t,s.jp.Matrix[1]),e._updateDifferenceMatrix(s.jp.Matrix[1]));if(this.isUsingTextureForMatrices){const t=4*(this.bones.length+1);e._transformMatrixTexture&&e._transformMatrixTexture.getSize().width===t||(e._transformMatrixTexture&&e._transformMatrixTexture.dispose(),e._transformMatrixTexture=o.l.CreateRGBATexture(e._bonesTransformMatrices,4*(this.bones.length+1),1,this._scene,!1,!1,1,1))}}this._computeTransformMatrices(e._bonesTransformMatrices,t),this.isUsingTextureForMatrices&&e._transformMatrixTexture&&e._transformMatrixTexture.update(e._bonesTransformMatrices)}}else{if(!this._isDirty)return;this._transformMatrices&&this._transformMatrices.length===16*(this.bones.length+1)||(this._transformMatrices=new Float32Array(16*(this.bones.length+1)),this.isUsingTextureForMatrices&&(this._transformMatrixTexture&&this._transformMatrixTexture.dispose(),this._transformMatrixTexture=o.l.CreateRGBATexture(this._transformMatrices,4*(this.bones.length+1),1,this._scene,!1,!1,1,1))),this._computeTransformMatrices(this._transformMatrices,null),this.isUsingTextureForMatrices&&this._transformMatrixTexture&&this._transformMatrixTexture.update(this._transformMatrices)}this._isDirty=!1}getAnimatables(){if(!this._animatables||this._animatables.length!==this.bones.length){this._animatables=[];for(let e=0;e{t.animations.forEach((t=>{t.enableBlending=!0,t.blendingSpeed=e}))}))}dispose(){if(this._meshesWithPoseMatrix.length=0,this.getScene().stopAnimation(this),this.getScene().removeSkeleton(this),this._parentContainer){const e=this._parentContainer.skeletons.indexOf(this);e>-1&&this._parentContainer.skeletons.splice(e,1),this._parentContainer=null}this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null)}serialize(){var e;const t={};t.name=this.name,t.id=this.id,this.dimensionsAtRest&&(t.dimensionsAtRest=this.dimensionsAtRest.asArray()),t.bones=[],t.needInitialSkinMatrix=this.needInitialSkinMatrix;for(let i=0;i0&&(s.animation=n.animations[0].serialize()),t.ranges=[];for(const e in this._ranges){const i=this._ranges[e];if(!i)continue;const n={};n.name=e,n.from=i.from,n.to=i.to,t.ranges.push(n)}}return t}static Parse(e,t){const i=new d(e.name,e.id,t);let r;for(e.dimensionsAtRest&&(i.dimensionsAtRest=s.P.FromArray(e.dimensionsAtRest)),i.needInitialSkinMatrix=e.needInitialSkinMatrix,r=0;r-1&&(l=i.bones[t.parentBoneIndex]);const c=t.rest?s.y3.FromArray(t.rest):null,h=new n.N(t.name,i,l,s.y3.FromArray(t.matrix),c,null,o);void 0!==t.id&&null!==t.id&&(h.id=t.id),t.length&&(h.length=t.length),t.metadata&&(h.metadata=t.metadata),t.animation&&h.animations.push(a.f.Parse(t.animation)),void 0!==t.linkedTransformNodeId&&null!==t.linkedTransformNodeId&&(i._hasWaitingData=!0,h._waitingTransformNodeId=t.linkedTransformNodeId)}if(e.ranges)for(r=0;r0&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e}sortBones(){const e=new Array,t=new Array(this.bones.length);for(let i=0;i{e.setCurrentPoseAsRest()}))}}},"../../../node_modules/@babylonjs/core/Buffers/buffer.js":function(e,t,i){"use strict";i.d(t,{l:function(){return r},o:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Buffers/dataBuffer.js");class r{constructor(e,t,i,r=0,s=!1,o=!1,a=!1,l){this._isAlreadyOwned=!1,e.getScene?this._engine=e.getScene().getEngine():this._engine=e,this._updatable=i,this._instanced=o,this._divisor=l||1,t instanceof n.h?(this._data=null,this._buffer=t):(this._data=t,this._buffer=null),this.byteStride=a?r:r*Float32Array.BYTES_PER_ELEMENT,s||this.create()}createVertexBuffer(e,t,i,n,r,o=!1,a){const l=o?t:t*Float32Array.BYTES_PER_ELEMENT,c=n?o?n:n*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new s(this._engine,this,e,this._updatable,!0,c,void 0===r?this._instanced:r,l,i,void 0,void 0,!0,this._divisor||a)}isUpdatable(){return this._updatable}getData(){return this._data}getBuffer(){return this._buffer}getStrideSize(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT}create(e=null){!e&&this._buffer||(e=e||this._data)&&(this._buffer?this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e),this._data=e):this._updatable?(this._buffer=this._engine.createDynamicVertexBuffer(e),this._data=e):this._buffer=this._engine.createVertexBuffer(e))}_rebuild(){this._buffer=null,this.create(this._data)}update(e){this.create(e)}updateDirectly(e,t,i,n=!1){this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,n?t:t*Float32Array.BYTES_PER_ELEMENT,i?i*this.byteStride:void 0),this._data=0===t&&void 0===i?e:null)}_increaseReferences(){this._buffer&&(this._isAlreadyOwned?this._buffer.references++:this._isAlreadyOwned=!0)}dispose(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null,this._data=null)}}class s{constructor(e,t,i,n,o,a,l,c,h,_,d=!1,u=!1,p=1,f=!1){if(t instanceof r?(this._buffer=t,this._ownsBuffer=f):(this._buffer=new r(e,t,n,a,o,l,u),this._ownsBuffer=!0),this.uniqueId=s._Counter++,this._kind=i,null==_){const e=this.getData();this.type=s.FLOAT,e instanceof Int8Array?this.type=s.BYTE:e instanceof Uint8Array?this.type=s.UNSIGNED_BYTE:e instanceof Int16Array?this.type=s.SHORT:e instanceof Uint16Array?this.type=s.UNSIGNED_SHORT:e instanceof Int32Array?this.type=s.INT:e instanceof Uint32Array&&(this.type=s.UNSIGNED_INT)}else this.type=_;const m=s.GetTypeByteLength(this.type);u?(this._size=h||(a?a/m:s.DeduceStride(i)),this.byteStride=a||this._buffer.byteStride||this._size*m,this.byteOffset=c||0):(this._size=h||a||s.DeduceStride(i),this.byteStride=a?a*m:this._buffer.byteStride||this._size*m,this.byteOffset=(c||0)*m),this.normalized=d,this._instanced=void 0!==l&&l,this._instanceDivisor=l?p:0,this._computeHashCode()}get instanceDivisor(){return this._instanceDivisor}set instanceDivisor(e){const t=0!=e;this._instanceDivisor=e,t!==this._instanced&&(this._instanced=t,this._computeHashCode())}_computeHashCode(){this.hashCode=(this.type-5120<<0)+((this.normalized?1:0)<<3)+(this._size<<4)+((this._instanced?1:0)<<6)+(this.byteStride<<12)}_rebuild(){this._buffer&&this._buffer._rebuild()}getKind(){return this._kind}isUpdatable(){return this._buffer.isUpdatable()}getData(){return this._buffer.getData()}getFloatData(e,t){const i=this.getData();if(!i)return null;const n=this.getSize()*s.GetTypeByteLength(this.type),r=e*this.getSize();if(this.type!==s.FLOAT||this.byteStride!==n){const e=new Float32Array(r);return this.forEach(r,((t,i)=>e[i]=t)),e}if(!(i instanceof Array||i instanceof Float32Array)||0!==this.byteOffset||i.length!==r){if(i instanceof Array){const e=this.byteOffset/4;return i.slice(e,e+r)}if(i instanceof ArrayBuffer)return new Float32Array(i,this.byteOffset,r);{let e=i.byteOffset+this.byteOffset;if(t){const t=new Float32Array(r),n=new Float32Array(i.buffer,e,r);return t.set(n),t}const n=e%4;return n&&(e=Math.max(0,e-n)),new Float32Array(i.buffer,e,r)}}return t?i.slice():i}getBuffer(){return this._buffer.getBuffer()}getStrideSize(){return this.byteStride/s.GetTypeByteLength(this.type)}getOffset(){return this.byteOffset/s.GetTypeByteLength(this.type)}getSize(e=!1){return e?this._size*s.GetTypeByteLength(this.type):this._size}getIsInstanced(){return this._instanced}getInstanceDivisor(){return this._instanceDivisor}create(e){this._buffer.create(e)}update(e){this._buffer.update(e)}updateDirectly(e,t,i=!1){this._buffer.updateDirectly(e,t,void 0,i)}dispose(){this._ownsBuffer&&this._buffer.dispose()}forEach(e,t){s.ForEach(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,e,this.normalized,t)}static DeduceStride(e){switch(e){case s.UVKind:case s.UV2Kind:case s.UV3Kind:case s.UV4Kind:case s.UV5Kind:case s.UV6Kind:return 2;case s.NormalKind:case s.PositionKind:return 3;case s.ColorKind:case s.MatricesIndicesKind:case s.MatricesIndicesExtraKind:case s.MatricesWeightsKind:case s.MatricesWeightsExtraKind:case s.TangentKind:return 4;default:throw new Error("Invalid kind '"+e+"'")}}static GetTypeByteLength(e){switch(e){case s.BYTE:case s.UNSIGNED_BYTE:return 1;case s.SHORT:case s.UNSIGNED_SHORT:return 2;case s.INT:case s.UNSIGNED_INT:case s.FLOAT:return 4;default:throw new Error(`Invalid type '${e}'`)}}static ForEach(e,t,i,n,r,o,a,l){if(e instanceof Array){let r=t/4;const s=i/4;for(let t=0;t{if(t.type!==o.kD.POINTERWHEEL)return;const i=t.event,n=i.deltaMode===a.G.DOM_DELTA_LINE?this._ffMultiplier:1;this._wheelDeltaX+=this.wheelPrecisionX*n*i.deltaX/this._normalize,this._wheelDeltaY-=this.wheelPrecisionY*n*i.deltaY/this._normalize,this._wheelDeltaZ+=this.wheelPrecisionZ*n*i.deltaZ/this._normalize,i.preventDefault&&(e||i.preventDefault())},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,o.kD.POINTERWHEEL)}detachControl(){this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null),this.onChangedObservable&&this.onChangedObservable.clear()}checkInputs(){this.onChangedObservable.notifyObservers({wheelDeltaX:this._wheelDeltaX,wheelDeltaY:this._wheelDeltaY,wheelDeltaZ:this._wheelDeltaZ}),this._wheelDeltaX=0,this._wheelDeltaY=0,this._wheelDeltaZ=0}getClassName(){return"BaseCameraMouseWheelInput"}getSimpleName(){return"mousewheel"}}(0,n.gn)([(0,r.qC)()],c.prototype,"wheelPrecisionX",void 0),(0,n.gn)([(0,r.qC)()],c.prototype,"wheelPrecisionY",void 0),(0,n.gn)([(0,r.qC)()],c.prototype,"wheelPrecisionZ",void 0)},"../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraKeyboardMoveInput.js":function(e,t,i){"use strict";i.d(t,{Y:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Cameras/cameraInputsManager.js"),o=i("../../../node_modules/@babylonjs/core/Events/keyboardEvents.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),l=i("../../../node_modules/@babylonjs/core/Misc/tools.js");class c{constructor(){this.keysUp=[38],this.keysUpward=[33],this.keysDown=[40],this.keysDownward=[34],this.keysLeft=[37],this.keysRight=[39],this.rotationSpeed=.5,this.keysRotateLeft=[],this.keysRotateRight=[],this._keys=new Array}attachControl(e){e=l.w1.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((()=>{this._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((t=>{const i=t.event;if(!i.metaKey)if(t.type===o.OG.KEYDOWN)-1===this.keysUp.indexOf(i.keyCode)&&-1===this.keysDown.indexOf(i.keyCode)&&-1===this.keysLeft.indexOf(i.keyCode)&&-1===this.keysRight.indexOf(i.keyCode)&&-1===this.keysUpward.indexOf(i.keyCode)&&-1===this.keysDownward.indexOf(i.keyCode)&&-1===this.keysRotateLeft.indexOf(i.keyCode)&&-1===this.keysRotateRight.indexOf(i.keyCode)||(-1===this._keys.indexOf(i.keyCode)&&this._keys.push(i.keyCode),e||i.preventDefault());else if(-1!==this.keysUp.indexOf(i.keyCode)||-1!==this.keysDown.indexOf(i.keyCode)||-1!==this.keysLeft.indexOf(i.keyCode)||-1!==this.keysRight.indexOf(i.keyCode)||-1!==this.keysUpward.indexOf(i.keyCode)||-1!==this.keysDownward.indexOf(i.keyCode)||-1!==this.keysRotateLeft.indexOf(i.keyCode)||-1!==this.keysRotateRight.indexOf(i.keyCode)){const t=this._keys.indexOf(i.keyCode);t>=0&&this._keys.splice(t,1),e||i.preventDefault()}})))}detachControl(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0}checkInputs(){if(this._onKeyboardObserver){const e=this.camera;for(let t=0;t{const r=n.event,s="touch"===r.pointerType;if(t.isInVRExclusivePointerMode)return;if(!this.touchEnabled&&s)return;if(n.type!==a.kD.POINTERMOVE&&-1===this.buttons.indexOf(r.button))return;const o=r.target;if(n.type!==a.kD.POINTERDOWN||-1!==this._currentActiveButton&&!s)if(n.type!==a.kD.POINTERUP||this._currentActiveButton!==r.button&&!s){if(n.type===a.kD.POINTERMOVE)if(t.isPointerLock&&this._onMouseMove)this._onMouseMove(n.event);else if(this._previousPosition){let t=r.clientX-this._previousPosition.x;const i=r.clientY-this._previousPosition.y;this.camera.getScene().useRightHandedSystem&&(t*=-1),this.camera.parent&&this.camera.parent._getWorldMatrixDeterminant()<0&&(t*=-1),this._allowCameraRotation&&(this.camera.cameraRotation.y+=t/this.angularSensibility,this.camera.cameraRotation.x+=i/this.angularSensibility),this.onPointerMovedObservable.notifyObservers({offsetX:t,offsetY:i}),this._previousPosition={x:r.clientX,y:r.clientY},e||r.preventDefault()}}else{try{null==o||o.releasePointerCapture(r.pointerId)}catch(e){}this._currentActiveButton=-1,this._previousPosition=null,e||r.preventDefault()}else{try{null==o||o.setPointerCapture(r.pointerId)}catch(e){}-1===this._currentActiveButton&&(this._currentActiveButton=r.button),this._previousPosition={x:r.clientX,y:r.clientY},e||(r.preventDefault(),i&&i.focus()),t.isPointerLock&&this._onMouseMove&&this._onMouseMove(n.event)}}),this._onMouseMove=i=>{if(!t.isPointerLock)return;if(t.isInVRExclusivePointerMode)return;let n=i.movementX;this.camera.getScene().useRightHandedSystem&&(n*=-1),this.camera.parent&&this.camera.parent._getWorldMatrixDeterminant()<0&&(n*=-1),this.camera.cameraRotation.y+=n/this.angularSensibility;const r=i.movementY;this.camera.cameraRotation.x+=r/this.angularSensibility,this._previousPosition=null,e||i.preventDefault()},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,a.kD.POINTERDOWN|a.kD.POINTERUP|a.kD.POINTERMOVE),i&&(this._contextMenuBind=this.onContextMenu.bind(this),i.addEventListener("contextmenu",this._contextMenuBind,!1))}onContextMenu(e){e.preventDefault()}detachControl(){if(this._observer){if(this.camera.getScene().onPointerObservable.remove(this._observer),this._contextMenuBind){const e=this.camera.getEngine().getInputElement();e&&e.removeEventListener("contextmenu",this._contextMenuBind)}this.onPointerMovedObservable&&this.onPointerMovedObservable.clear(),this._observer=null,this._onMouseMove=null,this._previousPosition=null}this._currentActiveButton=-1}getClassName(){return"FreeCameraMouseInput"}getSimpleName(){return"mouse"}}(0,n.gn)([(0,s.qC)()],c.prototype,"buttons",void 0),(0,n.gn)([(0,s.qC)()],c.prototype,"angularSensibility",void 0),o.u.FreeCameraMouseInput=c},"../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseWheelInput.js":function(e,t,i){"use strict";i.d(t,{A:function(){return h}});var n,r=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),s=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),o=i("../../../node_modules/@babylonjs/core/Cameras/cameraInputsManager.js"),a=i("../../../node_modules/@babylonjs/core/Cameras/Inputs/BaseCameraMouseWheelInput.js"),l=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),c=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js");!function(e){e[e.MoveRelative=0]="MoveRelative",e[e.RotateRelative=1]="RotateRelative",e[e.MoveScene=2]="MoveScene"}(n||(n={}));class h extends a.Y{constructor(){super(...arguments),this._moveRelative=l.P.Zero(),this._rotateRelative=l.P.Zero(),this._moveScene=l.P.Zero(),this._wheelXAction=n.MoveRelative,this._wheelXActionCoordinate=c.c7.X,this._wheelYAction=n.MoveRelative,this._wheelYActionCoordinate=c.c7.Z,this._wheelZAction=null,this._wheelZActionCoordinate=null}getClassName(){return"FreeCameraMouseWheelInput"}set wheelXMoveRelative(e){null===e&&this._wheelXAction!==n.MoveRelative||(this._wheelXAction=n.MoveRelative,this._wheelXActionCoordinate=e)}get wheelXMoveRelative(){return this._wheelXAction!==n.MoveRelative?null:this._wheelXActionCoordinate}set wheelYMoveRelative(e){null===e&&this._wheelYAction!==n.MoveRelative||(this._wheelYAction=n.MoveRelative,this._wheelYActionCoordinate=e)}get wheelYMoveRelative(){return this._wheelYAction!==n.MoveRelative?null:this._wheelYActionCoordinate}set wheelZMoveRelative(e){null===e&&this._wheelZAction!==n.MoveRelative||(this._wheelZAction=n.MoveRelative,this._wheelZActionCoordinate=e)}get wheelZMoveRelative(){return this._wheelZAction!==n.MoveRelative?null:this._wheelZActionCoordinate}set wheelXRotateRelative(e){null===e&&this._wheelXAction!==n.RotateRelative||(this._wheelXAction=n.RotateRelative,this._wheelXActionCoordinate=e)}get wheelXRotateRelative(){return this._wheelXAction!==n.RotateRelative?null:this._wheelXActionCoordinate}set wheelYRotateRelative(e){null===e&&this._wheelYAction!==n.RotateRelative||(this._wheelYAction=n.RotateRelative,this._wheelYActionCoordinate=e)}get wheelYRotateRelative(){return this._wheelYAction!==n.RotateRelative?null:this._wheelYActionCoordinate}set wheelZRotateRelative(e){null===e&&this._wheelZAction!==n.RotateRelative||(this._wheelZAction=n.RotateRelative,this._wheelZActionCoordinate=e)}get wheelZRotateRelative(){return this._wheelZAction!==n.RotateRelative?null:this._wheelZActionCoordinate}set wheelXMoveScene(e){null===e&&this._wheelXAction!==n.MoveScene||(this._wheelXAction=n.MoveScene,this._wheelXActionCoordinate=e)}get wheelXMoveScene(){return this._wheelXAction!==n.MoveScene?null:this._wheelXActionCoordinate}set wheelYMoveScene(e){null===e&&this._wheelYAction!==n.MoveScene||(this._wheelYAction=n.MoveScene,this._wheelYActionCoordinate=e)}get wheelYMoveScene(){return this._wheelYAction!==n.MoveScene?null:this._wheelYActionCoordinate}set wheelZMoveScene(e){null===e&&this._wheelZAction!==n.MoveScene||(this._wheelZAction=n.MoveScene,this._wheelZActionCoordinate=e)}get wheelZMoveScene(){return this._wheelZAction!==n.MoveScene?null:this._wheelZActionCoordinate}checkInputs(){if(0===this._wheelDeltaX&&0===this._wheelDeltaY&&0==this._wheelDeltaZ)return;this._moveRelative.setAll(0),this._rotateRelative.setAll(0),this._moveScene.setAll(0),this._updateCamera(),this.camera.getScene().useRightHandedSystem&&(this._moveRelative.z*=-1);const e=l.y3.Zero();this.camera.getViewMatrix().invertToRef(e);const t=l.P.Zero();l.P.TransformNormalToRef(this._moveRelative,e,t),this.camera.cameraRotation.x+=this._rotateRelative.x/200,this.camera.cameraRotation.y+=this._rotateRelative.y/200,this.camera.cameraDirection.addInPlace(t),this.camera.cameraDirection.addInPlace(this._moveScene),super.checkInputs()}_updateCamera(){this._updateCameraProperty(this._wheelDeltaX,this._wheelXAction,this._wheelXActionCoordinate),this._updateCameraProperty(this._wheelDeltaY,this._wheelYAction,this._wheelYActionCoordinate),this._updateCameraProperty(this._wheelDeltaZ,this._wheelZAction,this._wheelZActionCoordinate)}_updateCameraProperty(e,t,i){if(0===e)return;if(null===t||null===i)return;let r=null;switch(t){case n.MoveRelative:r=this._moveRelative;break;case n.RotateRelative:r=this._rotateRelative;break;case n.MoveScene:r=this._moveScene}switch(i){case c.c7.X:r.set(e,0,0);break;case c.c7.Y:r.set(0,e,0);break;case c.c7.Z:r.set(0,0,e)}}}(0,r.gn)([(0,s.qC)()],h.prototype,"wheelXMoveRelative",null),(0,r.gn)([(0,s.qC)()],h.prototype,"wheelYMoveRelative",null),(0,r.gn)([(0,s.qC)()],h.prototype,"wheelZMoveRelative",null),(0,r.gn)([(0,s.qC)()],h.prototype,"wheelXRotateRelative",null),(0,r.gn)([(0,s.qC)()],h.prototype,"wheelYRotateRelative",null),(0,r.gn)([(0,s.qC)()],h.prototype,"wheelZRotateRelative",null),(0,r.gn)([(0,s.qC)()],h.prototype,"wheelXMoveScene",null),(0,r.gn)([(0,s.qC)()],h.prototype,"wheelYMoveScene",null),(0,r.gn)([(0,s.qC)()],h.prototype,"wheelZMoveScene",null),o.u.FreeCameraMouseWheelInput=h},"../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraTouchInput.js":function(e,t,i){"use strict";i.d(t,{y:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Cameras/cameraInputsManager.js"),o=i("../../../node_modules/@babylonjs/core/Events/pointerEvents.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),l=i("../../../node_modules/@babylonjs/core/Misc/tools.js");class c{constructor(e=!1){this.allowMouse=e,this.touchAngularSensibility=2e5,this.touchMoveSensibility=250,this.singleFingerRotate=!1,this._offsetX=null,this._offsetY=null,this._pointerPressed=new Array,this._isSafari=l.w1.IsSafari()}attachControl(e){e=l.w1.BackCompatCameraNoPreventDefault(arguments);let t=null;if(void 0===this._pointerInput&&(this._onLostFocus=()=>{this._offsetX=null,this._offsetY=null},this._pointerInput=i=>{const n=i.event,r="mouse"===n.pointerType||this._isSafari&&void 0===n.pointerType;if(this.allowMouse||!r)if(i.type===o.kD.POINTERDOWN){if(e||n.preventDefault(),this._pointerPressed.push(n.pointerId),1!==this._pointerPressed.length)return;t={x:n.clientX,y:n.clientY}}else if(i.type===o.kD.POINTERUP){e||n.preventDefault();const i=this._pointerPressed.indexOf(n.pointerId);if(-1===i)return;if(this._pointerPressed.splice(i,1),0!=i)return;t=null,this._offsetX=null,this._offsetY=null}else if(i.type===o.kD.POINTERMOVE){if(e||n.preventDefault(),!t)return;if(0!=this._pointerPressed.indexOf(n.pointerId))return;this._offsetX=n.clientX-t.x,this._offsetY=-(n.clientY-t.y)}}),this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,o.kD.POINTERDOWN|o.kD.POINTERUP|o.kD.POINTERMOVE),this._onLostFocus){const e=this.camera.getEngine().getInputElement();e&&e.addEventListener("blur",this._onLostFocus)}}detachControl(){if(this._pointerInput){if(this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null),this._onLostFocus){const e=this.camera.getEngine().getInputElement();e&&e.removeEventListener("blur",this._onLostFocus),this._onLostFocus=null}this._pointerPressed.length=0,this._offsetX=null,this._offsetY=null}}checkInputs(){if(null===this._offsetX||null===this._offsetY)return;if(0===this._offsetX&&0===this._offsetY)return;const e=this.camera;if(e.cameraRotation.y=this._offsetX/this.touchAngularSensibility,this.singleFingerRotate&&1===this._pointerPressed.length||!this.singleFingerRotate&&this._pointerPressed.length>1)e.cameraRotation.x=-this._offsetY/this.touchAngularSensibility;else{const t=e._computeLocalCameraSpeed(),i=new a.P(0,0,0!==this.touchMoveSensibility?t*this._offsetY/this.touchMoveSensibility:0);a.y3.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(a.P.TransformCoordinates(i,e._cameraRotationMatrix))}}getClassName(){return"FreeCameraTouchInput"}getSimpleName(){return"touch"}}(0,n.gn)([(0,r.qC)()],c.prototype,"touchAngularSensibility",void 0),(0,n.gn)([(0,r.qC)()],c.prototype,"touchMoveSensibility",void 0),s.u.FreeCameraTouchInput=c},"../../../node_modules/@babylonjs/core/Cameras/camera.js":function(e,t,i){"use strict";i.d(t,{V:function(){return f}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Misc/smartArray.js"),o=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),a=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),l=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),c=i("../../../node_modules/@babylonjs/core/node.js"),h=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),_=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),d=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),u=i("../../../node_modules/@babylonjs/core/Maths/math.viewport.js"),p=i("../../../node_modules/@babylonjs/core/Maths/math.frustum.js");class f extends c.N{constructor(e,t,i,n=!0){super(e,i),this._position=l.P.Zero(),this._upVector=l.P.Up(),this._orthoLeft=null,this._orthoRight=null,this._orthoBottom=null,this._orthoTop=null,this.fov=.8,this.projectionPlaneTilt=0,this.minZ=1,this.maxZ=1e4,this.inertia=.9,this._mode=f.PERSPECTIVE_CAMERA,this.isIntermediate=!1,this.viewport=new u.l(0,0,1,1),this.layerMask=268435455,this.fovMode=f.FOVMODE_VERTICAL_FIXED,this.cameraRigMode=f.RIG_MODE_NONE,this.customRenderTargets=new Array,this.outputRenderTarget=null,this.onViewMatrixChangedObservable=new a.y$,this.onProjectionMatrixChangedObservable=new a.y$,this.onAfterCheckInputsObservable=new a.y$,this.onRestoreStateObservable=new a.y$,this.isRigCamera=!1,this._rigCameras=new Array,this._webvrViewMatrix=l.y3.Identity(),this._skipRendering=!1,this._projectionMatrix=new l.y3,this._postProcesses=new Array,this._activeMeshes=new s.t(256),this._globalPosition=l.P.Zero(),this._computedViewMatrix=l.y3.Identity(),this._doNotComputeProjectionMatrix=!1,this._transformMatrix=l.y3.Zero(),this._refreshFrustumPlanes=!0,this._absoluteRotation=l._f.Identity(),this._isCamera=!0,this._isLeftCamera=!1,this._isRightCamera=!1,this.getScene().addCamera(this),n&&!this.getScene().activeCamera&&(this.getScene().activeCamera=this),this.position=t,this.renderPassId=this.getScene().getEngine().createRenderPassId(`Camera ${e}`)}get position(){return this._position}set position(e){this._position=e}set upVector(e){this._upVector=e}get upVector(){return this._upVector}get screenArea(){var e,t,i,n;let r=0,s=0;if(this.mode===f.PERSPECTIVE_CAMERA)this.fovMode===f.FOVMODE_VERTICAL_FIXED?(s=2*this.minZ*Math.tan(this.fov/2),r=this.getEngine().getAspectRatio(this)*s):(r=2*this.minZ*Math.tan(this.fov/2),s=r/this.getEngine().getAspectRatio(this));else{const o=this.getEngine().getRenderWidth()/2,a=this.getEngine().getRenderHeight()/2;r=(null!==(e=this.orthoRight)&&void 0!==e?e:o)-(null!==(t=this.orthoLeft)&&void 0!==t?t:-o),s=(null!==(i=this.orthoTop)&&void 0!==i?i:a)-(null!==(n=this.orthoBottom)&&void 0!==n?n:-a)}return r*s}set orthoLeft(e){this._orthoLeft=e;for(const t of this._rigCameras)t.orthoLeft=e}get orthoLeft(){return this._orthoLeft}set orthoRight(e){this._orthoRight=e;for(const t of this._rigCameras)t.orthoRight=e}get orthoRight(){return this._orthoRight}set orthoBottom(e){this._orthoBottom=e;for(const t of this._rigCameras)t.orthoBottom=e}get orthoBottom(){return this._orthoBottom}set orthoTop(e){this._orthoTop=e;for(const t of this._rigCameras)t.orthoTop=e}get orthoTop(){return this._orthoTop}set mode(e){this._mode=e;for(const t of this._rigCameras)t.mode=e}get mode(){return this._mode}storeState(){return this._stateStored=!0,this._storedFov=this.fov,this}_restoreStateValues(){return!!this._stateStored&&(this.fov=this._storedFov,!0)}restoreState(){return!!this._restoreStateValues()&&(this.onRestoreStateObservable.notifyObservers(this),!0)}getClassName(){return"Camera"}toString(e){let t="Name: "+this.name;if(t+=", type: "+this.getClassName(),this.animations)for(let i=0;i-1?(h.Y.Error("You're trying to reuse a post process not defined as reusable."),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._postProcesses.indexOf(e))}detachPostProcess(e){const t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._cascadePostProcessesToRigCams()}getWorldMatrix(){return this._isSynchronizedViewMatrix()||this.getViewMatrix(),this._worldMatrix}_getViewMatrix(){return l.y3.Identity()}getViewMatrix(e){return!e&&this._isSynchronizedViewMatrix()||(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix)),this._computedViewMatrix}freezeProjectionMatrix(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)}unfreezeProjectionMatrix(){this._doNotComputeProjectionMatrix=!1}getProjectionMatrix(e){var t,i,n,r,s,o,a,c;if(this._doNotComputeProjectionMatrix||!e&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ,this._refreshFrustumPlanes=!0;const h=this.getEngine(),_=this.getScene();if(this.mode===f.PERSPECTIVE_CAMERA){this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=h.getAspectRatio(this),this._cache.projectionPlaneTilt=this.projectionPlaneTilt,this.minZ<=0&&(this.minZ=.1);const e=h.useReverseDepthBuffer;let t;t=_.useRightHandedSystem?l.y3.PerspectiveFovRHToRef:l.y3.PerspectiveFovLHToRef,t(this.fov,h.getAspectRatio(this),e?this.maxZ:this.minZ,e?this.minZ:this.maxZ,this._projectionMatrix,this.fovMode===f.FOVMODE_VERTICAL_FIXED,h.isNDCHalfZRange,this.projectionPlaneTilt,h.useReverseDepthBuffer)}else{const e=h.getRenderWidth()/2,d=h.getRenderHeight()/2;_.useRightHandedSystem?l.y3.OrthoOffCenterRHToRef(null!==(t=this.orthoLeft)&&void 0!==t?t:-e,null!==(i=this.orthoRight)&&void 0!==i?i:e,null!==(n=this.orthoBottom)&&void 0!==n?n:-d,null!==(r=this.orthoTop)&&void 0!==r?r:d,this.minZ,this.maxZ,this._projectionMatrix,h.isNDCHalfZRange):l.y3.OrthoOffCenterLHToRef(null!==(s=this.orthoLeft)&&void 0!==s?s:-e,null!==(o=this.orthoRight)&&void 0!==o?o:e,null!==(a=this.orthoBottom)&&void 0!==a?a:-d,null!==(c=this.orthoTop)&&void 0!==c?c:d,this.minZ,this.maxZ,this._projectionMatrix,h.isNDCHalfZRange),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.renderWidth=h.getRenderWidth(),this._cache.renderHeight=h.getRenderHeight()}return this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix}getTransformationMatrix(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix}_updateFrustumPlanes(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?p.i.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=p.i.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)}isInFrustum(e,t=!1){if(this._updateFrustumPlanes(),t&&this.rigCameras.length>0){let t=!1;return this.rigCameras.forEach((i=>{i._updateFrustumPlanes(),t=t||e.isInFrustum(i._frustumPlanes)})),t}return e.isInFrustum(this._frustumPlanes)}isCompletelyInFrustum(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)}getForwardRay(e=100,t,i){throw(0,d.S)("Ray")}getForwardRayToRef(e,t=100,i,n){throw(0,d.S)("Ray")}dispose(e,t=!1){for(this.onViewMatrixChangedObservable.clear(),this.onProjectionMatrixChangedObservable.clear(),this.onAfterCheckInputsObservable.clear(),this.onRestoreStateObservable.clear(),this.inputs&&this.inputs.clear(),this.getScene().stopAnimation(this),this.getScene().removeCamera(this);this._rigCameras.length>0;){const e=this._rigCameras.pop();e&&e.dispose()}if(this._parentContainer){const e=this._parentContainer.cameras.indexOf(this);e>-1&&this._parentContainer.cameras.splice(e,1),this._parentContainer=null}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses.length=0;else if(this.cameraRigMode!==f.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses.length=0;else{let e=this._postProcesses.length;for(;--e>=0;){const t=this._postProcesses[e];t&&t.dispose(this)}}let i=this.customRenderTargets.length;for(;--i>=0;)this.customRenderTargets[i].dispose();this.customRenderTargets.length=0,this._activeMeshes.dispose(),this.getScene().getEngine().releaseRenderPassId(this.renderPassId),super.dispose(e,t)}get isLeftCamera(){return this._isLeftCamera}get isRightCamera(){return this._isRightCamera}get leftCamera(){return this._rigCameras.length<1?null:this._rigCameras[0]}get rightCamera(){return this._rigCameras.length<2?null:this._rigCameras[1]}getLeftTarget(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()}getRightTarget(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()}setCameraRigMode(e,t){if(this.cameraRigMode!==e){for(;this._rigCameras.length>0;){const e=this._rigCameras.pop();e&&e.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=t.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=o.w1.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==f.RIG_MODE_NONE){const e=this.createRigCamera(this.name+"_L",0);e&&(e._isLeftCamera=!0);const t=this.createRigCamera(this.name+"_R",1);t&&(t._isRightCamera=!0),e&&t&&(this._rigCameras.push(e),this._rigCameras.push(t))}this._setRigMode(t),this._cascadePostProcessesToRigCams(),this.update()}}_setRigMode(e){}_getVRProjectionMatrix(){return l.y3.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix,!0,this.getEngine().isNDCHalfZRange),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix}_updateCameraRotationMatrix(){}_updateWebVRCameraRotationMatrix(){}_getWebVRProjectionMatrix(){return l.y3.Identity()}_getWebVRViewMatrix(){return l.y3.Identity()}setCameraRigParameter(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=o.w1.ToRadians(t/.0637))}createRigCamera(e,t){return null}_updateRigCameras(){for(let e=0;ef._CreateDefaultParsedCamera(t,i))}computeWorldMatrix(){return this.getWorldMatrix()}static Parse(e,t){const i=e.type,n=f.GetConstructorFromName(i,e.name,t,e.interaxial_distance,e.isStereoscopicSideBySide),s=r.p4.Parse(n,e,t);if(void 0!==e.parentId&&(s._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(s._waitingParentInstanceIndex=e.parentInstanceIndex),s.inputs&&(s.inputs.parse(e),s._setupInputs()),e.upVector&&(s.upVector=l.P.FromArray(e.upVector)),s.setPosition&&(s.position.copyFromFloats(0,0,0),s.setPosition(l.P.FromArray(e.position))),e.target&&s.setTarget&&s.setTarget(l.P.FromArray(e.target)),e.cameraRigMode){const t=e.interaxial_distance?{interaxialDistance:e.interaxial_distance}:{};s.setCameraRigMode(e.cameraRigMode,t)}if(e.animations){for(let t=0;t{throw(0,d.S)("UniversalCamera")},f.PERSPECTIVE_CAMERA=0,f.ORTHOGRAPHIC_CAMERA=1,f.FOVMODE_VERTICAL_FIXED=0,f.FOVMODE_HORIZONTAL_FIXED=1,f.RIG_MODE_NONE=0,f.RIG_MODE_STEREOSCOPIC_ANAGLYPH=10,f.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11,f.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12,f.RIG_MODE_STEREOSCOPIC_OVERUNDER=13,f.RIG_MODE_STEREOSCOPIC_INTERLACED=14,f.RIG_MODE_VR=20,f.RIG_MODE_WEBVR=21,f.RIG_MODE_CUSTOM=22,f.ForceAttachControlToAlwaysPreventDefault=!1,(0,n.gn)([(0,r.hd)("position")],f.prototype,"_position",void 0),(0,n.gn)([(0,r.hd)("upVector")],f.prototype,"_upVector",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"orthoLeft",null),(0,n.gn)([(0,r.qC)()],f.prototype,"orthoRight",null),(0,n.gn)([(0,r.qC)()],f.prototype,"orthoBottom",null),(0,n.gn)([(0,r.qC)()],f.prototype,"orthoTop",null),(0,n.gn)([(0,r.qC)()],f.prototype,"fov",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"projectionPlaneTilt",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"minZ",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"maxZ",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"inertia",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"mode",null),(0,n.gn)([(0,r.qC)()],f.prototype,"layerMask",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"fovMode",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"cameraRigMode",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"interaxialDistance",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"isStereoscopicSideBySide",void 0)},"../../../node_modules/@babylonjs/core/Cameras/cameraInputsManager.js":function(e,t,i){"use strict";i.d(t,{p:function(){return a},u:function(){return o}});var n=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Cameras/camera.js"),o={};class a{constructor(e){this.attachedToElement=!1,this.attached={},this.camera=e,this.checkInputs=()=>{}}add(e){const t=e.getSimpleName();this.attached[t]?n.Y.Warn("camera input of type "+t+" already exists on camera"):(this.attached[t]=e,e.camera=this.camera,e.checkInputs&&(this.checkInputs=this._addCheckInputs(e.checkInputs.bind(e))),this.attachedToElement&&e.attachControl(this.noPreventDefault))}remove(e){for(const t in this.attached){const i=this.attached[t];i===e&&(i.detachControl(),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}}removeByType(e){for(const t in this.attached){const i=this.attached[t];i.getClassName()===e&&(i.detachControl(),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}}_addCheckInputs(e){const t=this.checkInputs;return()=>{t(),e()}}attachInput(e){this.attachedToElement&&e.attachControl(this.noPreventDefault)}attachElement(e=!1){if(!this.attachedToElement){e=!s.V.ForceAttachControlToAlwaysPreventDefault&&e,this.attachedToElement=!0,this.noPreventDefault=e;for(const t in this.attached)this.attached[t].attachControl(e)}}detachElement(e=!1){for(const t in this.attached)this.attached[t].detachControl(),e&&(this.attached[t].camera=null);this.attachedToElement=!1}rebuildInputCheck(){this.checkInputs=()=>{};for(const e in this.attached){const t=this.attached[e];t.checkInputs&&(this.checkInputs=this._addCheckInputs(t.checkInputs.bind(t)))}}clear(){this.attachedToElement&&this.detachElement(!0),this.attached={},this.attachedToElement=!1,this.checkInputs=()=>{}}serialize(e){const t={};for(const e in this.attached){const i=this.attached[e],n=r.p4.Serialize(i);t[i.getClassName()]=n}e.inputsmgr=t}parse(e){const t=e.inputsmgr;if(t){this.clear();for(const e in t){const i=o[e];if(i){const n=t[e],s=r.p4.Parse((()=>new i),n,null);this.add(s)}}}else for(const t in this.attached){const i=o[this.attached[t].getClassName()];if(i){const n=r.p4.Parse((()=>new i),e,null);this.remove(this.attached[t]),this.add(n)}}}}},"../../../node_modules/@babylonjs/core/Cameras/freeCamera.js":function(e,t,i){"use strict";i.d(t,{c:function(){return h}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Engines/engine.js"),a=i("../../../node_modules/@babylonjs/core/Cameras/targetCamera.js"),l=i("../../../node_modules/@babylonjs/core/Cameras/freeCameraInputsManager.js"),c=i("../../../node_modules/@babylonjs/core/Misc/tools.js");class h extends a.C{constructor(e,t,i,n=!0){super(e,t,i,n),this.ellipsoid=new s.P(.5,1,.5),this.ellipsoidOffset=new s.P(0,0,0),this.checkCollisions=!1,this.applyGravity=!1,this._needMoveForGravity=!1,this._oldPosition=s.P.Zero(),this._diffPosition=s.P.Zero(),this._newPosition=s.P.Zero(),this._collisionMask=-1,this._onCollisionPositionChange=(e,t,i=null)=>{(e=>{this._newPosition.copyFrom(e),this._newPosition.subtractToRef(this._oldPosition,this._diffPosition),this._diffPosition.length()>o.D.CollisionsEpsilon&&(this.position.addInPlace(this._diffPosition),this.onCollide&&i&&this.onCollide(i))})(t)},this.inputs=new l.a(this),this.inputs.addKeyboard().addMouse()}get angularSensibility(){const e=this.inputs.attached.mouse;return e?e.angularSensibility:0}set angularSensibility(e){const t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)}get keysUp(){const e=this.inputs.attached.keyboard;return e?e.keysUp:[]}set keysUp(e){const t=this.inputs.attached.keyboard;t&&(t.keysUp=e)}get keysUpward(){const e=this.inputs.attached.keyboard;return e?e.keysUpward:[]}set keysUpward(e){const t=this.inputs.attached.keyboard;t&&(t.keysUpward=e)}get keysDown(){const e=this.inputs.attached.keyboard;return e?e.keysDown:[]}set keysDown(e){const t=this.inputs.attached.keyboard;t&&(t.keysDown=e)}get keysDownward(){const e=this.inputs.attached.keyboard;return e?e.keysDownward:[]}set keysDownward(e){const t=this.inputs.attached.keyboard;t&&(t.keysDownward=e)}get keysLeft(){const e=this.inputs.attached.keyboard;return e?e.keysLeft:[]}set keysLeft(e){const t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)}get keysRight(){const e=this.inputs.attached.keyboard;return e?e.keysRight:[]}set keysRight(e){const t=this.inputs.attached.keyboard;t&&(t.keysRight=e)}get keysRotateLeft(){const e=this.inputs.attached.keyboard;return e?e.keysRotateLeft:[]}set keysRotateLeft(e){const t=this.inputs.attached.keyboard;t&&(t.keysRotateLeft=e)}get keysRotateRight(){const e=this.inputs.attached.keyboard;return e?e.keysRotateRight:[]}set keysRotateRight(e){const t=this.inputs.attached.keyboard;t&&(t.keysRotateRight=e)}attachControl(e,t){t=c.w1.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)}detachControl(){this.inputs.detachElement(),this.cameraDirection=new s.P(0,0,0),this.cameraRotation=new s.FM(0,0)}get collisionMask(){return this._collisionMask}set collisionMask(e){this._collisionMask=isNaN(e)?-1:e}_collideWithWorld(e){let t;t=this.parent?s.P.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position,t.subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);const i=this.getScene().collisionCoordinator;this._collider||(this._collider=i.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;let n=e;this.applyGravity&&(n=e.add(this.getScene().gravity)),i.getNewPosition(this._oldPosition,n,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}_checkInputs(){this._localDirection||(this._localDirection=s.P.Zero(),this._transformedDirection=s.P.Zero()),this.inputs.checkInputs(),super._checkInputs()}_decideIfNeedsToMove(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0}_updatePosition(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):super._updatePosition()}dispose(){this.inputs.clear(),super.dispose()}getClassName(){return"FreeCamera"}}(0,n.gn)([(0,r.hd)()],h.prototype,"ellipsoid",void 0),(0,n.gn)([(0,r.hd)()],h.prototype,"ellipsoidOffset",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"checkCollisions",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"applyGravity",void 0)},"../../../node_modules/@babylonjs/core/Cameras/freeCameraInputsManager.js":function(e,t,i){"use strict";i.d(t,{a:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/Cameras/cameraInputsManager.js"),r=i("../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraKeyboardMoveInput.js"),s=i("../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseInput.js"),o=i("../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseWheelInput.js"),a=i("../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraTouchInput.js");class l extends n.p{constructor(e){super(e),this._mouseInput=null,this._mouseWheelInput=null}addKeyboard(){return this.add(new r.Y),this}addMouse(e=!0){return this._mouseInput||(this._mouseInput=new s.A(e),this.add(this._mouseInput)),this}removeMouse(){return this._mouseInput&&this.remove(this._mouseInput),this}addMouseWheel(){return this._mouseWheelInput||(this._mouseWheelInput=new o.A,this.add(this._mouseWheelInput)),this}removeMouseWheel(){return this._mouseWheelInput&&this.remove(this._mouseWheelInput),this}addTouch(){return this.add(new a.y),this}clear(){super.clear(),this._mouseInput=null}}},"../../../node_modules/@babylonjs/core/Cameras/targetCamera.js":function(e,t,i){"use strict";i.d(t,{C:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Cameras/camera.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js"),l=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js");class c extends s.V{constructor(e,t,i,n=!0){super(e,t,i,n),this._tmpUpVector=o.P.Zero(),this._tmpTargetVector=o.P.Zero(),this.cameraDirection=new o.P(0,0,0),this.cameraRotation=new o.FM(0,0),this.ignoreParentScaling=!1,this.updateUpVectorFromRotation=!1,this._tmpQuaternion=new o._f,this.rotation=new o.P(0,0,0),this.speed=2,this.noRotationConstraint=!1,this.invertRotation=!1,this.inverseRotationSpeed=.2,this.lockedTarget=null,this._currentTarget=o.P.Zero(),this._initialFocalDistance=1,this._viewMatrix=o.y3.Zero(),this._camMatrix=o.y3.Zero(),this._cameraTransformMatrix=o.y3.Zero(),this._cameraRotationMatrix=o.y3.Zero(),this._referencePoint=new o.P(0,0,1),this._transformedReferencePoint=o.P.Zero(),this._defaultUp=o.P.Up(),this._cachedRotationZ=0,this._cachedQuaternionRotationZ=0}getFrontPosition(e){this.getWorldMatrix();const t=this.getTarget().subtract(this.position);return t.normalize(),t.scaleInPlace(e),this.globalPosition.add(t)}_getLockedTargetPosition(){return this.lockedTarget?(this.lockedTarget.absolutePosition&&this.lockedTarget.computeWorldMatrix(),this.lockedTarget.absolutePosition||this.lockedTarget):null}storeState(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),super.storeState()}_restoreStateValues(){return!!super._restoreStateValues()&&(this.position=this._storedPosition.clone(),this.rotation=this._storedRotation.clone(),this.rotationQuaternion&&(this.rotationQuaternion=this._storedRotationQuaternion.clone()),this.cameraDirection.copyFromFloats(0,0,0),this.cameraRotation.copyFromFloats(0,0),!0)}_initCache(){super._initCache(),this._cache.lockedTarget=new o.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new o.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new o._f(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)}_updateCache(e){e||super._updateCache();const t=this._getLockedTargetPosition();t?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(t):this._cache.lockedTarget=t.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)}_isSynchronizedViewMatrix(){if(!super._isSynchronizedViewMatrix())return!1;const e=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(e):!e)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))}_computeLocalCameraSpeed(){const e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))}setTarget(e){this.upVector.normalize(),this._initialFocalDistance=e.subtract(this.position).length(),this.position.z===e.z&&(this.position.z+=a.kn),this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance),o.y3.LookAtLHToRef(this.position,e,this._defaultUp,this._camMatrix),this._camMatrix.invert(),this.rotation.x=Math.atan(this._camMatrix.m[6]/this._camMatrix.m[10]);const t=e.subtract(this.position);t.x>=0?this.rotation.y=-Math.atan(t.z/t.x)+Math.PI/2:this.rotation.y=-Math.atan(t.z/t.x)-Math.PI/2,this.rotation.z=0,isNaN(this.rotation.x)&&(this.rotation.x=0),isNaN(this.rotation.y)&&(this.rotation.y=0),isNaN(this.rotation.z)&&(this.rotation.z=0),this.rotationQuaternion&&o._f.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)}get target(){return this.getTarget()}set target(e){this.setTarget(e)}getTarget(){return this._currentTarget}_decideIfNeedsToMove(){return Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0}_updatePosition(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(o.jp.Matrix[0]),o.P.TransformNormalToRef(this.cameraDirection,o.jp.Matrix[0],o.jp.Vector3[0]),void this.position.addInPlace(o.jp.Vector3[0]);this.position.addInPlace(this.cameraDirection)}_checkInputs(){const e=this.invertRotation?-this.inverseRotationSpeed:1,t=this._decideIfNeedsToMove(),i=Math.abs(this.cameraRotation.x)>0||Math.abs(this.cameraRotation.y)>0;if(t&&this._updatePosition(),i){if(this.rotationQuaternion&&this.rotationQuaternion.toEulerAnglesToRef(this.rotation),this.rotation.x+=this.cameraRotation.x*e,this.rotation.y+=this.cameraRotation.y*e,!this.noRotationConstraint){const e=1.570796;this.rotation.x>e&&(this.rotation.x=e),this.rotation.x<-e&&(this.rotation.x=-e)}this.rotationQuaternion&&this.rotation.lengthSquared()&&o._f.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)}t&&(Math.abs(this.cameraDirection.x)h-n||l-__-r||c-dd-o)}intersectsSphere(e){return o.IntersectsSphere(this.minimumWorld,this.maximumWorld,e.centerWorld,e.radiusWorld)}intersectsMinMax(e,t){const i=this.minimumWorld,n=this.maximumWorld,r=i.x,s=i.y,o=i.z,a=n.x,l=n.y,c=n.z,h=e.x,_=e.y,d=e.z,u=t.x,p=t.y,f=t.z;return!(au||l<_||s>p||cf)}dispose(){var e,t;null===(e=this._drawWrapperFront)||void 0===e||e.dispose(),null===(t=this._drawWrapperBack)||void 0===t||t.dispose()}static Intersects(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)}static IntersectsSphere(e,t,i,n){const s=o._TmpVector3[0];return r.P.ClampToRef(i,e,t,s),r.P.DistanceSquared(i,s)<=n*n}static IsCompletelyInFrustum(e,t){for(let i=0;i<6;++i){const n=t[i];for(let t=0;t<8;++t)if(n.dotCoordinate(e[t])<0)return!1}return!0}static IsInFrustum(e,t){for(let i=0;i<6;++i){let n=!0;const r=t[i];for(let t=0;t<8;++t)if(r.dotCoordinate(e[t])>=0){n=!1;break}if(n)return!1}return!0}}o._TmpVector3=n.B.BuildArray(3,r.P.Zero)},"../../../node_modules/@babylonjs/core/Culling/boundingInfo.js":function(e,t,i){"use strict";i.d(t,{j:function(){return _}});var n=i("../../../node_modules/@babylonjs/core/Misc/arrayTools.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Culling/boundingBox.js"),o=i("../../../node_modules/@babylonjs/core/Culling/boundingSphere.js");const a={min:0,max:0},l={min:0,max:0},c=(e,t,i)=>{const n=r.P.Dot(t.centerWorld,e),s=Math.abs(r.P.Dot(t.directions[0],e))*t.extendSize.x+Math.abs(r.P.Dot(t.directions[1],e))*t.extendSize.y+Math.abs(r.P.Dot(t.directions[2],e))*t.extendSize.z;i.min=n-s,i.max=n+s},h=(e,t,i)=>(c(e,t,a),c(e,i,l),!(a.min>l.max||l.min>a.max));class _{constructor(e,t,i){this._isLocked=!1,this.boundingBox=new s.k(e,t,i),this.boundingSphere=new o.K(e,t,i)}reConstruct(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)}get minimum(){return this.boundingBox.minimum}get maximum(){return this.boundingBox.maximum}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked=e}update(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))}centerOn(e,t){const i=_._TmpVector3[0].copyFrom(e).subtractInPlace(t),n=_._TmpVector3[1].copyFrom(e).addInPlace(t);return this.boundingBox.reConstruct(i,n,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(i,n,this.boundingBox.getWorldMatrix()),this}encapsulate(e){const t=r.P.Minimize(this.minimum,e),i=r.P.Maximize(this.maximum,e);return this.reConstruct(t,i,this.boundingBox.getWorldMatrix()),this}encapsulateBoundingInfo(e){return this.encapsulate(e.boundingBox.centerWorld.subtract(e.boundingBox.extendSizeWorld)),this.encapsulate(e.boundingBox.centerWorld.add(e.boundingBox.extendSizeWorld)),this}scale(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this}isInFrustum(e,t=0){return!(2!==t&&3!==t||!this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(!(1!==t&&3!==t)||this.boundingBox.isInFrustum(e))}get diagonalLength(){const e=this.boundingBox;return e.maximumWorld.subtractToRef(e.minimumWorld,_._TmpVector3[0]).length()}isCompletelyInFrustum(e){return this.boundingBox.isCompletelyInFrustum(e)}_checkCollision(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)}intersectsPoint(e){return!!this.boundingSphere.centerWorld&&!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e)}intersects(e,t){if(!o.K.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!s.k.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;const i=this.boundingBox,n=e.boundingBox;return!!(h(i.directions[0],i,n)&&h(i.directions[1],i,n)&&h(i.directions[2],i,n)&&h(n.directions[0],i,n)&&h(n.directions[1],i,n)&&h(n.directions[2],i,n)&&h(r.P.Cross(i.directions[0],n.directions[0]),i,n)&&h(r.P.Cross(i.directions[0],n.directions[1]),i,n)&&h(r.P.Cross(i.directions[0],n.directions[2]),i,n)&&h(r.P.Cross(i.directions[1],n.directions[0]),i,n)&&h(r.P.Cross(i.directions[1],n.directions[1]),i,n)&&h(r.P.Cross(i.directions[1],n.directions[2]),i,n)&&h(r.P.Cross(i.directions[2],n.directions[0]),i,n)&&h(r.P.Cross(i.directions[2],n.directions[1]),i,n)&&h(r.P.Cross(i.directions[2],n.directions[2]),i,n))}}_._TmpVector3=n.B.BuildArray(2,r.P.Zero)},"../../../node_modules/@babylonjs/core/Culling/boundingSphere.js":function(e,t,i){"use strict";i.d(t,{K:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Misc/arrayTools.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js");class s{constructor(e,t,i){this.center=r.P.Zero(),this.centerWorld=r.P.Zero(),this.minimum=r.P.Zero(),this.maximum=r.P.Zero(),this.reConstruct(e,t,i)}reConstruct(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);const n=r.P.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*n,this._update(i||r.y3.IdentityReadOnly)}scale(e){const t=this.radius*e,i=s._TmpVector3,n=i[0].setAll(t),r=this.center.subtractToRef(n,i[1]),o=this.center.addToRef(n,i[2]);return this.reConstruct(r,o,this._worldMatrix),this}getWorldMatrix(){return this._worldMatrix}_update(e){if(e.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{r.P.TransformCoordinatesToRef(this.center,e,this.centerWorld);const t=s._TmpVector3[0];r.P.TransformNormalFromFloatsToRef(1,1,1,e,t),this.radiusWorld=Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.radius}}isInFrustum(e){const t=this.centerWorld,i=this.radiusWorld;for(let n=0;n<6;n++)if(e[n].dotCoordinate(t)<=-i)return!1;return!0}isCenterInFrustum(e){const t=this.centerWorld;for(let i=0;i<6;i++)if(e[i].dotCoordinate(t)<0)return!1;return!0}intersectsPoint(e){const t=r.P.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorldr.x)return!1}else if(s=1/this.direction.x,o=(n.x-this.origin.x)*s,a=(r.x-this.origin.x)*s,a===-1/0&&(a=1/0),o>a&&(l=o,o=a,a=l),c=Math.max(o,c),_=Math.min(a,_),c>_)return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.yr.y)return!1}else if(s=1/this.direction.y,o=(n.y-this.origin.y)*s,a=(r.y-this.origin.y)*s,a===-1/0&&(a=1/0),o>a&&(l=o,o=a,a=l),c=Math.max(o,c),_=Math.min(a,_),c>_)return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.zr.z)return!1}else if(s=1/this.direction.z,o=(n.z-this.origin.z)*s,a=(r.z-this.origin.z)*s,a===-1/0&&(a=1/0),o>a&&(l=o,o=a,a=l),c=Math.max(o,c),_=Math.min(a,_),c>_)return!1;return!0}intersectsBox(e,t=0){return this.intersectsBoxMinMax(e.minimum,e.maximum,t)}intersectsSphere(e,t=0){const i=e.center.x-this.origin.x,n=e.center.y-this.origin.y,r=e.center.z-this.origin.z,s=i*i+n*n+r*r,o=e.radius+t,a=o*o;if(s<=a)return!0;const l=i*this.direction.x+n*this.direction.y+r*this.direction.z;return!(l<0)&&s-l*l<=a}intersectsTriangle(e,t,i){const n=h._TmpVector3[0],s=h._TmpVector3[1],a=h._TmpVector3[2],l=h._TmpVector3[3],c=h._TmpVector3[4];t.subtractToRef(e,n),i.subtractToRef(e,s),r.P.CrossToRef(this.direction,s,a);const _=r.P.Dot(n,a);if(0===_)return null;const d=1/_;this.origin.subtractToRef(e,l);const u=r.P.Dot(l,a)*d;if(u<0||u>1)return null;r.P.CrossToRef(l,n,c);const p=r.P.Dot(this.direction,c)*d;if(p<0||u+p>1)return null;const f=r.P.Dot(s,c)*d;return f>this.length?null:new o.c(1-u-p,u,f)}intersectsPlane(e){let t;const i=r.P.Dot(e.normal,this.direction);if(Math.abs(i)<9.99999997475243e-7)return null;{const n=r.P.Dot(e.normal,this.origin);return t=(-e.d-n)/i,t<0?t<-9.99999997475243e-7?null:0:t}}intersectsAxis(e,t=0){switch(e){case"y":{const e=(this.origin.y-t)/this.direction.y;return e>0?null:new r.P(this.origin.x+this.direction.x*-e,t,this.origin.z+this.direction.z*-e)}case"x":{const e=(this.origin.x-t)/this.direction.x;return e>0?null:new r.P(t,this.origin.y+this.direction.y*-e,this.origin.z+this.direction.z*-e)}case"z":{const e=(this.origin.z-t)/this.direction.z;return e>0?null:new r.P(this.origin.x+this.direction.x*-e,this.origin.y+this.direction.y*-e,t)}default:return null}}intersectsMesh(e,t){const i=r.jp.Matrix[0];return e.getWorldMatrix().invertToRef(i),this._tmpRay?h.TransformToRef(this,i,this._tmpRay):this._tmpRay=h.Transform(this,i),e.intersects(this._tmpRay,t)}intersectsMeshes(e,t,i){i?i.length=0:i=[];for(let n=0;nt.distance?1:0}intersectionSegment(e,t,i){const n=this.origin,s=r.jp.Vector3[0],o=r.jp.Vector3[1],a=r.jp.Vector3[2],l=r.jp.Vector3[3];t.subtractToRef(e,s),this.direction.scaleToRef(h._Rayl,a),n.addToRef(a,o),e.subtractToRef(n,l);const c=r.P.Dot(s,s),_=r.P.Dot(s,a),d=r.P.Dot(a,a),u=r.P.Dot(s,l),p=r.P.Dot(a,l),f=c*d-_*_;let m,g,b=f,y=f;fb&&(m=b,g=p+_,y=d)),g<0?(g=0,-u<0?m=0:-u>c?m=b:(m=-u,b=c)):g>y&&(g=y,-u+_<0?m=0:-u+_>c?m=b:(m=-u+_,b=c));const v=Math.abs(m)0&&A<=this.length&&x.lengthSquared()=e.distance?null:c:null},a.x.prototype._internalPick=function(e,t,i,n,o){if(!s.p)return null;let a=null;for(let s=0;s(this._tempPickingRay||(this._tempPickingRay=h.Zero()),this.createPickingRayToRef(e,t,i,this._tempPickingRay,o||null),this._tempPickingRay)),i,n,!0);return a&&(a.ray=this.createPickingRay(e,t,r.y3.Identity(),o||null)),a},a.x.prototype.pick=function(e,t,i,n,o,a,l=!1){if(!s.p)return null;const c=this._internalPick(((i,n)=>(this._tempPickingRay||(this._tempPickingRay=h.Zero()),this.createPickingRayToRef(e,t,i,this._tempPickingRay,o||null,!1,n),this._tempPickingRay)),i,n,!1,a);return c&&(c.ray=this.createPickingRay(e,t,r.y3.Identity(),o||null)),c},a.x.prototype.pickWithRay=function(e,t,i,n){const s=this._internalPick((t=>(this._pickWithRayInverseMatrix||(this._pickWithRayInverseMatrix=r.y3.Identity()),t.invertToRef(this._pickWithRayInverseMatrix),this._cachedRayForTransform||(this._cachedRayForTransform=h.Zero()),h.TransformToRef(e,this._pickWithRayInverseMatrix,this._cachedRayForTransform),this._cachedRayForTransform)),t,i,!1,n);return s&&(s.ray=e),s},a.x.prototype.multiPick=function(e,t,i,n,r){return this._internalMultiPick((i=>this.createPickingRay(e,t,i,n||null)),i,r)},a.x.prototype.multiPickWithRay=function(e,t,i){return this._internalMultiPick((t=>(this._pickWithRayInverseMatrix||(this._pickWithRayInverseMatrix=r.y3.Identity()),t.invertToRef(this._pickWithRayInverseMatrix),this._cachedRayForTransform||(this._cachedRayForTransform=h.Zero()),h.TransformToRef(e,this._pickWithRayInverseMatrix,this._cachedRayForTransform),this._cachedRayForTransform)),t,i)},l.V.prototype.getForwardRay=function(e=100,t,i){return this.getForwardRayToRef(new h(r.P.Zero(),r.P.Zero(),e),e,t,i)},l.V.prototype.getForwardRayToRef=function(e,t=100,i,n){return i||(i=this.getWorldMatrix()),e.length=t,n?e.origin.copyFrom(n):e.origin.copyFrom(this.position),r.jp.Vector3[2].set(0,0,this._scene.useRightHandedSystem?-1:1),r.P.TransformNormalToRef(r.jp.Vector3[2],i,r.jp.Vector3[3]),r.P.NormalizeToRef(r.jp.Vector3[3],e.direction),e}},"../../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceEnums.js":function(e,t,i){"use strict";var n,r,s,o,a,l,c;i.d(t,{FP:function(){return s},Fz:function(){return r},Yi:function(){return n}}),function(e){e[e.Generic=0]="Generic",e[e.Keyboard=1]="Keyboard",e[e.Mouse=2]="Mouse",e[e.Touch=3]="Touch",e[e.DualShock=4]="DualShock",e[e.Xbox=5]="Xbox",e[e.Switch=6]="Switch",e[e.DualSense=7]="DualSense"}(n||(n={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.LeftClick=2]="LeftClick",e[e.MiddleClick=3]="MiddleClick",e[e.RightClick=4]="RightClick",e[e.BrowserBack=5]="BrowserBack",e[e.BrowserForward=6]="BrowserForward",e[e.MouseWheelX=7]="MouseWheelX",e[e.MouseWheelY=8]="MouseWheelY",e[e.MouseWheelZ=9]="MouseWheelZ",e[e.Move=12]="Move"}(r||(r={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.LeftClick=2]="LeftClick",e[e.MiddleClick=3]="MiddleClick",e[e.RightClick=4]="RightClick",e[e.BrowserBack=5]="BrowserBack",e[e.BrowserForward=6]="BrowserForward",e[e.MouseWheelX=7]="MouseWheelX",e[e.MouseWheelY=8]="MouseWheelY",e[e.MouseWheelZ=9]="MouseWheelZ",e[e.DeltaHorizontal=10]="DeltaHorizontal",e[e.DeltaVertical=11]="DeltaVertical"}(s||(s={})),function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.L1=4]="L1",e[e.R1=5]="R1",e[e.L2=6]="L2",e[e.R2=7]="R2",e[e.Share=8]="Share",e[e.Options=9]="Options",e[e.L3=10]="L3",e[e.R3=11]="R3",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.TouchPad=17]="TouchPad",e[e.LStickXAxis=18]="LStickXAxis",e[e.LStickYAxis=19]="LStickYAxis",e[e.RStickXAxis=20]="RStickXAxis",e[e.RStickYAxis=21]="RStickYAxis"}(o||(o={})),function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.L1=4]="L1",e[e.R1=5]="R1",e[e.L2=6]="L2",e[e.R2=7]="R2",e[e.Create=8]="Create",e[e.Options=9]="Options",e[e.L3=10]="L3",e[e.R3=11]="R3",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.TouchPad=17]="TouchPad",e[e.LStickXAxis=18]="LStickXAxis",e[e.LStickYAxis=19]="LStickYAxis",e[e.RStickXAxis=20]="RStickXAxis",e[e.RStickYAxis=21]="RStickYAxis"}(a||(a={})),function(e){e[e.A=0]="A",e[e.B=1]="B",e[e.X=2]="X",e[e.Y=3]="Y",e[e.LB=4]="LB",e[e.RB=5]="RB",e[e.LT=6]="LT",e[e.RT=7]="RT",e[e.Back=8]="Back",e[e.Start=9]="Start",e[e.LS=10]="LS",e[e.RS=11]="RS",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.LStickXAxis=17]="LStickXAxis",e[e.LStickYAxis=18]="LStickYAxis",e[e.RStickXAxis=19]="RStickXAxis",e[e.RStickYAxis=20]="RStickYAxis"}(l||(l={})),function(e){e[e.B=0]="B",e[e.A=1]="A",e[e.Y=2]="Y",e[e.X=3]="X",e[e.L=4]="L",e[e.R=5]="R",e[e.ZL=6]="ZL",e[e.ZR=7]="ZR",e[e.Minus=8]="Minus",e[e.Plus=9]="Plus",e[e.LS=10]="LS",e[e.RS=11]="RS",e[e.DPadUp=12]="DPadUp",e[e.DPadDown=13]="DPadDown",e[e.DPadLeft=14]="DPadLeft",e[e.DPadRight=15]="DPadRight",e[e.Home=16]="Home",e[e.Capture=17]="Capture",e[e.LStickXAxis=18]="LStickXAxis",e[e.LStickYAxis=19]="LStickYAxis",e[e.RStickXAxis=20]="RStickXAxis",e[e.RStickYAxis=21]="RStickYAxis"}(c||(c={}))},"../../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceSource.js":function(e,t,i){"use strict";i.d(t,{p:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Misc/observable.js");class r{constructor(e,t,i=0){this.deviceType=t,this.deviceSlot=i,this.onInputChangedObservable=new n.y$,this._deviceInputSystem=e}getInput(e){return this._deviceInputSystem.pollInput(this.deviceType,this.deviceSlot,e)}}},"../../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceSourceManager.js":function(e,t,i){"use strict";i.d(t,{U:function(){return p}});var n=i("../../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceEnums.js"),r=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),s=i("../../../node_modules/@babylonjs/core/Events/deviceInputEvents.js");class o{static CreateDeviceEvent(e,t,i,r,s,o){switch(e){case n.Yi.Keyboard:return this._CreateKeyboardEvent(i,r,s,o);case n.Yi.Mouse:if(i===n.Fz.MouseWheelX||i===n.Fz.MouseWheelY||i===n.Fz.MouseWheelZ)return this._CreateWheelEvent(e,t,i,r,s,o);case n.Yi.Touch:return this._CreatePointerEvent(e,t,i,r,s,o);default:throw`Unable to generate event for device ${n.Yi[e]}`}}static _CreatePointerEvent(e,t,i,r,s,o){const a=this._CreateMouseEvent(e,t,i,r,s,o);return e===n.Yi.Mouse?(a.deviceType=n.Yi.Mouse,a.pointerId=1,a.pointerType="mouse"):(a.deviceType=n.Yi.Touch,a.pointerId=t,a.pointerType="touch"),i===n.Fz.Move?a.type="pointermove":i>=n.Fz.LeftClick&&i<=n.Fz.RightClick&&(a.type=1===r?"pointerdown":"pointerup",a.button=i-2),a}static _CreateWheelEvent(e,t,i,r,o,a){const l=this._CreateMouseEvent(e,t,i,r,o,a);switch(l.type="wheel",l.deltaMode=s.G.DOM_DELTA_PIXEL,l.deltaX=0,l.deltaY=0,l.deltaZ=0,i){case n.Fz.MouseWheelX:l.deltaX=r;break;case n.Fz.MouseWheelY:l.deltaY=r;break;case n.Fz.MouseWheelZ:l.deltaZ=r}return l}static _CreateMouseEvent(e,t,i,r,s,o){const a=this._CreateEvent(o),l=s.pollInput(e,t,n.Fz.Horizontal),c=s.pollInput(e,t,n.Fz.Vertical);return o?(a.movementX=0,a.movementY=0,a.offsetX=a.movementX-o.getBoundingClientRect().x,a.offsetY=a.movementY-o.getBoundingClientRect().y):(a.movementX=s.pollInput(e,t,n.FP.DeltaHorizontal),a.movementY=s.pollInput(e,t,n.FP.DeltaVertical),a.offsetX=0,a.offsetY=0),this._CheckNonCharacterKeys(a,s),a.clientX=l,a.clientY=c,a.x=l,a.y=c,a.deviceType=e,a.deviceSlot=t,a.inputIndex=i,a}static _CreateKeyboardEvent(e,t,i,r){const s=this._CreateEvent(r);return this._CheckNonCharacterKeys(s,i),s.deviceType=n.Yi.Keyboard,s.deviceSlot=0,s.inputIndex=e,s.type=1===t?"keydown":"keyup",s.key=String.fromCharCode(e),s.keyCode=e,s}static _CheckNonCharacterKeys(e,t){const i=t.isDeviceAvailable(n.Yi.Keyboard),r=i&&1===t.pollInput(n.Yi.Keyboard,0,18),s=i&&1===t.pollInput(n.Yi.Keyboard,0,17),o=i&&(1===t.pollInput(n.Yi.Keyboard,0,91)||1===t.pollInput(n.Yi.Keyboard,0,92)||1===t.pollInput(n.Yi.Keyboard,0,93)),a=i&&1===t.pollInput(n.Yi.Keyboard,0,16);e.altKey=r,e.ctrlKey=s,e.metaKey=o,e.shiftKey=a}static _CreateEvent(e){const t={preventDefault:()=>{}};return t.target=e,t}}class a{constructor(e,t,i){this._nativeInput=_native.DeviceInputSystem?new _native.DeviceInputSystem(e,t,((e,t,n,r)=>{const s=o.CreateDeviceEvent(e,t,n,r,this);i(e,t,s)})):this._createDummyNativeInput()}pollInput(e,t,i){return this._nativeInput.pollInput(e,t,i)}isDeviceAvailable(e){return e===n.Yi.Mouse||e===n.Yi.Touch}dispose(){this._nativeInput.dispose()}_createDummyNativeInput(){return{pollInput:()=>0,isDeviceAvailable:()=>!1,dispose:()=>{}}}}var l=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js"),c=i("../../../node_modules/@babylonjs/core/Misc/tools.js");const h=Object.keys(n.Fz).length/2;class _{constructor(e,t,i,n){this._inputs=[],this._keyboardActive=!1,this._pointerActive=!1,this._usingSafari=c.w1.IsSafari(),this._usingMacOS=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),this._keyboardDownEvent=e=>{},this._keyboardUpEvent=e=>{},this._keyboardBlurEvent=e=>{},this._pointerMoveEvent=e=>{},this._pointerDownEvent=e=>{},this._pointerUpEvent=e=>{},this._pointerCancelEvent=e=>{},this._pointerWheelEvent=e=>{},this._pointerBlurEvent=e=>{},this._eventsAttached=!1,this._mouseId=-1,this._isUsingFirefox=l.MZ.IsNavigatorAvailable()&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Firefox"),this._maxTouchPoints=0,this._pointerInputClearObserver=null,this._gamepadConnectedEvent=e=>{},this._gamepadDisconnectedEvent=e=>{},this._eventPrefix=c.w1.GetPointerPrefix(e),this._engine=e,this._onDeviceConnected=t,this._onDeviceDisconnected=i,this._onInputChanged=n,this._enableEvents(),this._usingMacOS&&(this._metaKeys=[]),this._engine._onEngineViewChanged||(this._engine._onEngineViewChanged=()=>{this._enableEvents()})}pollInput(e,t,i){const r=this._inputs[e][t];if(!r)throw`Unable to find device ${n.Yi[e]}`;e>=n.Yi.DualShock&&e<=n.Yi.DualSense&&this._updateDevice(e,t,i);const s=r[i];if(void 0===s)throw`Unable to find input ${i} for device ${n.Yi[e]} in slot ${t}`;return i===n.Fz.Move&&c.w1.Warn("Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data."),s}isDeviceAvailable(e){return void 0!==this._inputs[e]}dispose(){this._onDeviceConnected=()=>{},this._onDeviceDisconnected=()=>{},this._onInputChanged=()=>{},delete this._engine._onEngineViewChanged,this._elementToAttachTo&&this._disableEvents()}_enableEvents(){const e=null==this?void 0:this._engine.getInputElement();if(e&&(!this._eventsAttached||this._elementToAttachTo!==e)){if(this._disableEvents(),this._inputs)for(const e of this._inputs)if(e)for(const t in e){const i=e[+t];if(i)for(let e=0;e{this._keyboardActive||(this._keyboardActive=!0,this._registerDevice(n.Yi.Keyboard,0,255));const t=this._inputs[n.Yi.Keyboard][0];if(t){t[e.keyCode]=1;const i=e;i.inputIndex=e.keyCode,this._usingMacOS&&e.metaKey&&"Meta"!==e.key&&(this._metaKeys.includes(e.keyCode)||this._metaKeys.push(e.keyCode)),this._onInputChanged(n.Yi.Keyboard,0,i)}},this._keyboardUpEvent=e=>{this._keyboardActive||(this._keyboardActive=!0,this._registerDevice(n.Yi.Keyboard,0,255));const t=this._inputs[n.Yi.Keyboard][0];if(t){t[e.keyCode]=0;const i=e;if(i.inputIndex=e.keyCode,this._usingMacOS&&"Meta"===e.key&&this._metaKeys.length>0){for(const e of this._metaKeys){const i=o.CreateDeviceEvent(n.Yi.Keyboard,0,e,0,this,this._elementToAttachTo);t[e]=0,this._onInputChanged(n.Yi.Keyboard,0,i)}this._metaKeys.splice(0,this._metaKeys.length)}this._onInputChanged(n.Yi.Keyboard,0,i)}},this._keyboardBlurEvent=()=>{if(this._keyboardActive){const e=this._inputs[n.Yi.Keyboard][0];for(let t=0;t{const t=this._getPointerType(e),i=t===n.Yi.Mouse?0:this._activeTouchIds.indexOf(e.pointerId);this._inputs[t]||(this._inputs[t]={}),this._inputs[t][i]||this._addPointerDevice(t,i,e.clientX,e.clientY);const r=this._inputs[t][i];if(r){const s=e;s.inputIndex=n.Fz.Move,r[n.Fz.Horizontal]=e.clientX,r[n.Fz.Vertical]=e.clientY,this._onInputChanged(t,i,s),this._usingSafari||-1===e.button||(s.inputIndex=e.button+2,r[e.button+2]=r[e.button+2]?0:1,this._onInputChanged(t,i,s))}},this._pointerDownEvent=e=>{const t=this._getPointerType(e);let i=t===n.Yi.Mouse?0:e.pointerId;if(t===n.Yi.Touch){const t=this._activeTouchIds.indexOf(-1);if(!(t>=0))return void c.w1.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);i=t,this._activeTouchIds[t]=e.pointerId}this._inputs[t]||(this._inputs[t]={}),this._inputs[t][i]?t===n.Yi.Touch&&this._onDeviceConnected(t,i):this._addPointerDevice(t,i,e.clientX,e.clientY);const r=this._inputs[t][i];if(r){const s=r[n.Fz.Horizontal],o=r[n.Fz.Vertical];if(t===n.Yi.Mouse){if(-1===this._mouseId&&(void 0===e.pointerId?this._mouseId=this._isUsingFirefox?0:1:this._mouseId=e.pointerId),!document.pointerLockElement)try{this._elementToAttachTo.setPointerCapture(this._mouseId)}catch(e){}}else if(e.pointerId&&!document.pointerLockElement)try{this._elementToAttachTo.setPointerCapture(e.pointerId)}catch(e){}r[n.Fz.Horizontal]=e.clientX,r[n.Fz.Vertical]=e.clientY,r[e.button+2]=1;const a=e;a.inputIndex=e.button+2,this._onInputChanged(t,i,a),s===e.clientX&&o===e.clientY||(a.inputIndex=n.Fz.Move,this._onInputChanged(t,i,a))}},this._pointerUpEvent=e=>{var t,i,r,s,o;const a=this._getPointerType(e),l=a===n.Yi.Mouse?0:this._activeTouchIds.indexOf(e.pointerId);if(a===n.Yi.Touch){if(-1===l)return;this._activeTouchIds[l]=-1}const c=null===(t=this._inputs[a])||void 0===t?void 0:t[l];if(c&&0!==c[e.button+2]){const t=c[n.Fz.Horizontal],h=c[n.Fz.Vertical];c[n.Fz.Horizontal]=e.clientX,c[n.Fz.Vertical]=e.clientY,c[e.button+2]=0;const _=e;t===e.clientX&&h===e.clientY||(_.inputIndex=n.Fz.Move,this._onInputChanged(a,l,_)),_.inputIndex=e.button+2,a===n.Yi.Mouse&&this._mouseId>=0&&(null===(r=(i=this._elementToAttachTo).hasPointerCapture)||void 0===r?void 0:r.call(i,this._mouseId))?this._elementToAttachTo.releasePointerCapture(this._mouseId):e.pointerId&&(null===(o=(s=this._elementToAttachTo).hasPointerCapture)||void 0===o?void 0:o.call(s,e.pointerId))&&this._elementToAttachTo.releasePointerCapture(e.pointerId),this._onInputChanged(a,l,_),a===n.Yi.Touch&&this._onDeviceDisconnected(a,l)}},this._pointerCancelEvent=e=>{var t,i,r,s;if("mouse"===e.pointerType){const e=this._inputs[n.Yi.Mouse][0];this._mouseId>=0&&(null===(i=(t=this._elementToAttachTo).hasPointerCapture)||void 0===i?void 0:i.call(t,this._mouseId))&&this._elementToAttachTo.releasePointerCapture(this._mouseId);for(let t=n.Fz.LeftClick;t<=n.Fz.BrowserForward;t++)if(1===e[t]){e[t]=0;const i=o.CreateDeviceEvent(n.Yi.Mouse,0,t,0,this,this._elementToAttachTo);this._onInputChanged(n.Yi.Mouse,0,i)}}else{const t=this._activeTouchIds.indexOf(e.pointerId);(null===(s=(r=this._elementToAttachTo).hasPointerCapture)||void 0===s?void 0:s.call(r,e.pointerId))&&this._elementToAttachTo.releasePointerCapture(e.pointerId),this._inputs[n.Yi.Touch][t][n.Fz.LeftClick]=0;const i=o.CreateDeviceEvent(n.Yi.Touch,t,n.Fz.LeftClick,0,this,this._elementToAttachTo);this._onInputChanged(n.Yi.Touch,t,i),this._activeTouchIds[t]=-1,this._onDeviceDisconnected(n.Yi.Touch,t)}},this._wheelEventName="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";let e=!1;const t=function(){};try{const i=Object.defineProperty({},"passive",{get:function(){e=!0}});this._elementToAttachTo.addEventListener("test",t,i),this._elementToAttachTo.removeEventListener("test",t,i)}catch(e){}this._pointerBlurEvent=()=>{var e,t,i,r,s;if(this.isDeviceAvailable(n.Yi.Mouse)){const i=this._inputs[n.Yi.Mouse][0];this._mouseId>=0&&(null===(t=(e=this._elementToAttachTo).hasPointerCapture)||void 0===t?void 0:t.call(e,this._mouseId))&&this._elementToAttachTo.releasePointerCapture(this._mouseId);for(let e=n.Fz.LeftClick;e<=n.Fz.BrowserForward;e++)if(1===i[e]){i[e]=0;const t=o.CreateDeviceEvent(n.Yi.Mouse,0,e,0,this,this._elementToAttachTo);this._onInputChanged(n.Yi.Mouse,0,t)}}if(this.isDeviceAvailable(n.Yi.Touch)){const e=this._inputs[n.Yi.Touch];for(let t=0;t{const t=n.Yi.Mouse;this._inputs[t]||(this._inputs[t]=[]),this._inputs[t][0]||(this._pointerActive=!0,this._registerDevice(t,0,h));const i=this._inputs[t][0];if(i){i[n.Fz.MouseWheelX]=e.deltaX||0,i[n.Fz.MouseWheelY]=e.deltaY||e.wheelDelta||0,i[n.Fz.MouseWheelZ]=e.deltaZ||0;const r=e;0!==i[n.Fz.MouseWheelX]&&(r.inputIndex=n.Fz.MouseWheelX,this._onInputChanged(t,0,r)),0!==i[n.Fz.MouseWheelY]&&(r.inputIndex=n.Fz.MouseWheelY,this._onInputChanged(t,0,r)),0!==i[n.Fz.MouseWheelZ]&&(r.inputIndex=n.Fz.MouseWheelZ,this._onInputChanged(t,0,r))}},this._elementToAttachTo.addEventListener(this._eventPrefix+"move",this._pointerMoveEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"down",this._pointerDownEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"up",this._pointerUpEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"cancel",this._pointerCancelEvent),this._elementToAttachTo.addEventListener("blur",this._pointerBlurEvent),this._elementToAttachTo.addEventListener(this._wheelEventName,this._pointerWheelEvent,!!e&&{passive:!1}),this._pointerInputClearObserver=this._engine.onEndFrameObservable.add((()=>{if(this.isDeviceAvailable(n.Yi.Mouse)){const e=this._inputs[n.Yi.Mouse][0];e[n.Fz.MouseWheelX]=0,e[n.Fz.MouseWheelY]=0,e[n.Fz.MouseWheelZ]=0}}))}_handleGamepadActions(){this._gamepadConnectedEvent=e=>{this._addGamePad(e.gamepad)},this._gamepadDisconnectedEvent=e=>{if(this._gamepads){const t=this._getGamepadDeviceType(e.gamepad.id),i=e.gamepad.index;this._unregisterDevice(t,i),delete this._gamepads[i]}},window.addEventListener("gamepadconnected",this._gamepadConnectedEvent),window.addEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)}_updateDevice(e,t,i){const n=navigator.getGamepads()[t];if(n&&e===this._gamepads[t]){const r=this._inputs[e][t];i>=n.buttons.length?r[i]=n.axes[i-n.buttons.length].valueOf():r[i]=n.buttons[i].value}}_getGamepadDeviceType(e){return-1!==e.indexOf("054c")?-1!==e.indexOf("0ce6")?n.Yi.DualSense:n.Yi.DualShock:-1!==e.indexOf("Xbox One")||-1!==e.search("Xbox 360")||-1!==e.search("xinput")?n.Yi.Xbox:-1!==e.indexOf("057e")?n.Yi.Switch:n.Yi.Generic}_getPointerType(e){let t=n.Yi.Mouse;return("touch"===e.pointerType||"pen"===e.pointerType||e.touches)&&(t=n.Yi.Touch),t}}var d=i("../../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceSource.js");class u{constructor(e){this._registeredManagers=new Array,this._refCount=0,this.registerManager=e=>{for(let t=0;t{const t=this._registeredManagers.indexOf(e);t>-1&&this._registeredManagers.splice(t,1)};const t=Object.keys(n.Yi).length/2;this._devices=new Array(t);const i=(e,t)=>{this._devices[e]||(this._devices[e]=new Array),this._devices[e][t]||(this._devices[e][t]=t);for(const i of this._registeredManagers){const n=new d.p(this._deviceInputSystem,e,t);i._addDevice(n)}},r=(e,t)=>{var i;(null===(i=this._devices[e])||void 0===i?void 0:i[t])&&delete this._devices[e][t];for(const i of this._registeredManagers)i._removeDevice(e,t)},s=(e,t,i)=>{if(i)for(const n of this._registeredManagers)n._onInputChanged(e,t,i)};"undefined"!=typeof _native?this._deviceInputSystem=new a(i,r,s):this._deviceInputSystem=new _(e,i,r,s)}dispose(){this._deviceInputSystem.dispose()}}class p{constructor(e){const t=Object.keys(n.Yi).length/2;this._devices=new Array(t),this._firstDevice=new Array(t),this._engine=e,this._engine._deviceSourceManager||(this._engine._deviceSourceManager=new u(e)),this._engine._deviceSourceManager._refCount++,this.onDeviceConnectedObservable=new r.y$((e=>{for(const t of this._devices)if(t)for(const i of t)i&&this.onDeviceConnectedObservable.notifyObserver(e,i)})),this.onDeviceDisconnectedObservable=new r.y$,this._engine._deviceSourceManager.registerManager(this),this._onDisposeObserver=e.onDisposeObservable.add((()=>{this.dispose()}))}getDeviceSource(e,t){if(void 0===t){if(void 0===this._firstDevice[e])return null;t=this._firstDevice[e]}return this._devices[e]&&void 0!==this._devices[e][t]?this._devices[e][t]:null}getDeviceSources(e){return this._devices[e]?this._devices[e].filter((e=>!!e)):[]}dispose(){this.onDeviceConnectedObservable.clear(),this.onDeviceDisconnectedObservable.clear(),this._engine._deviceSourceManager&&(this._engine._deviceSourceManager.unregisterManager(this),--this._engine._deviceSourceManager._refCount<1&&(this._engine._deviceSourceManager.dispose(),delete this._engine._deviceSourceManager)),this._engine.onDisposeObservable.remove(this._onDisposeObserver)}_addDevice(e){this._devices[e.deviceType]||(this._devices[e.deviceType]=new Array),this._devices[e.deviceType][e.deviceSlot]||(this._devices[e.deviceType][e.deviceSlot]=e,this._updateFirstDevices(e.deviceType)),this.onDeviceConnectedObservable.notifyObservers(e)}_removeDevice(e,t){var i,n;const r=null===(i=this._devices[e])||void 0===i?void 0:i[t];this.onDeviceDisconnectedObservable.notifyObservers(r),(null===(n=this._devices[e])||void 0===n?void 0:n[t])&&delete this._devices[e][t],this._updateFirstDevices(e)}_onInputChanged(e,t,i){var n,r;null===(r=null===(n=this._devices[e])||void 0===n?void 0:n[t])||void 0===r||r.onInputChangedObservable.notifyObservers(i)}_updateFirstDevices(e){switch(e){case n.Yi.Keyboard:case n.Yi.Mouse:this._firstDevice[e]=0;break;case n.Yi.Touch:case n.Yi.DualSense:case n.Yi.DualShock:case n.Yi.Xbox:case n.Yi.Switch:case n.Yi.Generic:{delete this._firstDevice[e];const t=this._devices[e];if(t)for(let i=0;i{i[t]=e,i._internalCount++,6===i._internalCount&&n(i)}),void 0,void 0,!0,((e,t)=>{r&&e&&r(e.status+" "+e.statusText,t)}))},n.B.prototype._cascadeLoadFiles=function(e,t,i,n=null){const r=[];r._internalCount=0;for(let e=0;e<6;e++)this._partialLoadFile(i[e],e,r,t,n)},n.B.prototype._cascadeLoadImgs=function(e,t,i,n,r=null,s){const o=[];o._internalCount=0;for(let a=0;a<6;a++)this._partialLoadImg(n[a],a,o,e,t,i,r,s)},n.B.prototype._partialLoadImg=function(e,t,i,n,r,s,l=null,c){const h=(0,a.f)();(0,o.r6)(e,(e=>{i[t]=e,i._internalCount++,n&&n.removePendingData(h),6===i._internalCount&&s&&s(r,i)}),((e,t)=>{n&&n.removePendingData(h),l&&l(e,t)}),n?n.offlineProvider:null,c),n&&n.addPendingData(h)},n.B.prototype._setCubeMapTextureParams=function(e,t,i){const n=this._gl;n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,t?n.LINEAR_MIPMAP_LINEAR:n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),e.samplingMode=t?3:2,t&&this.getCaps().textureMaxLevel&&void 0!==i&&i>0&&(n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_LEVEL,i),e._maxLodLevel=i),this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,null)},n.B.prototype.createCubeTextureBase=function(e,t,i,o,a=null,l=null,c,h=null,_=!1,d=0,u=0,p=null,f=null,m=null,g=!1){const b=p||new r.l(this,r.S.Cube);b.isCube=!0,b.url=e,b.generateMipMaps=!o,b._lodGenerationScale=d,b._lodGenerationOffset=u,b._useSRGBBuffer=!!g&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU||!!o),this._doNotHandleContextLost||(b._extension=h,b._files=i);const y=e;this._transformTextureUrl&&!p&&(e=this._transformTextureUrl(e));const v=e.split("?")[0],A=v.lastIndexOf("."),C=h||(A>-1?v.substring(A).toLowerCase():"");let S=null;for(const e of n.B._TextureLoaders)if(e.canLoad(C)){S=e;break}const x=(n,r)=>{e===y?l&&n&&l(n.status+" "+n.statusText,r):(s.Y.Warn(`Failed to load ${e}, falling back to the ${y}`),this.createCubeTextureBase(y,t,i,!!o,a,l,c,h,_,d,u,b,f,m,g))};if(S){const n=e=>{f&&f(b,e),S.loadCubeData(e,b,_,a,l)};i&&6===i.length?S.supportCascades?this._cascadeLoadFiles(t,(e=>n(e.map((e=>new Uint8Array(e))))),i,l):l?l("Textures type does not support cascades."):s.Y.Warn("Texture loader does not support cascades."):this._loadFile(e,(e=>n(new Uint8Array(e))),void 0,void 0,!0,x)}else{if(!i)throw new Error("Cannot load cubemap because files were not defined");this._cascadeLoadImgs(t,b,((e,t)=>{m&&m(e,t)}),i,l)}return this._internalTexturesCache.push(b),b},n.B.prototype.createCubeTexture=function(e,t,i,r,o=null,a=null,l,c=null,h=!1,_=0,d=0,u=null,p,f=!1){const m=this._gl;return this.createCubeTextureBase(e,t,i,!!r,o,a,l,c,h,_,d,u,(e=>this._bindTextureDirectly(m.TEXTURE_CUBE_MAP,e,!0)),((e,t)=>{const i=this.needPOTTextures?n.B.GetExponentOfTwo(t[0].width,this._caps.maxCubemapTextureSize):t[0].width,a=i,c=[m.TEXTURE_CUBE_MAP_POSITIVE_X,m.TEXTURE_CUBE_MAP_POSITIVE_Y,m.TEXTURE_CUBE_MAP_POSITIVE_Z,m.TEXTURE_CUBE_MAP_NEGATIVE_X,m.TEXTURE_CUBE_MAP_NEGATIVE_Y,m.TEXTURE_CUBE_MAP_NEGATIVE_Z];this._bindTextureDirectly(m.TEXTURE_CUBE_MAP,e,!0),this._unpackFlipY(!1);const h=l?this._getInternalFormat(l,e._useSRGBBuffer):e._useSRGBBuffer?m.SRGB8_ALPHA8:m.RGBA;let _=l?this._getInternalFormat(l):m.RGBA;e._useSRGBBuffer&&1===this.webGLVersion&&(_=h);for(let e=0;e=r&&0===i?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,new Float32Array(t).subarray(i,i+n)):(t=t instanceof ArrayBuffer?new Uint8Array(t,i,n):new Uint8Array(t.buffer,t.byteOffset+i,n),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t)),this._resetVertexBufferBinding()}},"../../../node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicTexture.js":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Engines/thinEngine.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js");n.B.prototype.createDynamicTexture=function(e,t,i,s){const o=new r.l(this,r.S.Dynamic);return o.baseWidth=e,o.baseHeight=t,i&&(e=this.needPOTTextures?n.B.GetExponentOfTwo(e,this._caps.maxTextureSize):e,t=this.needPOTTextures?n.B.GetExponentOfTwo(t,this._caps.maxTextureSize):t),o.width=e,o.height=t,o.isReady=!1,o.generateMipMaps=i,o.samplingMode=s,this.updateTextureSamplingMode(s,o),this._internalTexturesCache.push(o),o},n.B.prototype.updateDynamicTexture=function(e,t,i,n=!1,r,s=!1,o=!1){if(!e)return;const a=this._gl,l=a.TEXTURE_2D,c=this._bindTextureDirectly(l,e,!0,s);this._unpackFlipY(void 0===i?e.invertY:i),n&&a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);const h=this._getWebGLTextureType(e.type),_=this._getInternalFormat(r||e.format),d=this._getRGBABufferInternalSizedFormat(e.type,_);a.texImage2D(l,0,d,_,h,t),e.generateMipMaps&&a.generateMipmap(l),c||this._bindTextureDirectly(l,null),n&&a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0}},"../../../node_modules/@babylonjs/core/Engines/Extensions/engine.rawTexture.js":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js"),r=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),s=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),o=i("../../../node_modules/@babylonjs/core/Engines/thinEngine.js");function a(e,t,i,n){let r,s=1;1===n?r=new Float32Array(t*i*4):2===n?(r=new Uint16Array(t*i*4),s=15360):r=7===n?new Uint32Array(t*i*4):new Uint8Array(t*i*4);for(let n=0;n{const i=p.width,s=o(e);if(s){if(l){const e=this._getWebGLTextureType(r);let t=this._getInternalFormat(n);const o=this._getRGBABufferInternalSizedFormat(r);let c=!1;t===u.RGB&&(t=u.RGBA,c=!0),this._bindTextureDirectly(u.TEXTURE_CUBE_MAP,p,!0),this._unpackFlipY(!1);const h=l(s);for(let n=0;n>n;for(let i=0;i<6;i++){let l=h[n][i];c&&(l=a(l,s,s,r)),u.texImage2D(i,n,o,s,s,0,t,e,l)}}this._bindTextureDirectly(u.TEXTURE_CUBE_MAP,null)}else this.updateRawCubeTexture(p,s,n,r,d);p.isReady=!0,null==t||t.removePendingData(p),p.onLoadedObservable.notifyObservers(p),p.onLoadedObservable.clear(),c&&c()}};return this._loadFile(e,(e=>{f(e)}),void 0,null==t?void 0:t.offlineProvider,!0,((e,i)=>{null==t||t.removePendingData(p),h&&e&&h(e.status+" "+e.statusText,i)})),p},o.B.prototype.createRawTexture2DArray=l(!1),o.B.prototype.createRawTexture3D=l(!0),o.B.prototype.updateRawTexture2DArray=c(!1),o.B.prototype.updateRawTexture3D=c(!0)},"../../../node_modules/@babylonjs/core/Engines/Extensions/engine.readTexture.js":function(e,t,i){"use strict";i.d(t,{A:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Engines/thinEngine.js");function r(e,t,i=!1,n){switch(e){case 3:{const e=(ArrayBuffer,new Int8Array(t));return n&&e.set(new Int8Array(n)),e}case 0:{const e=(ArrayBuffer,new Uint8Array(t));return n&&e.set(new Uint8Array(n)),e}case 4:{const e=t instanceof ArrayBuffer?new Int16Array(t):new Int16Array(i?t/2:t);return n&&e.set(new Int16Array(n)),e}case 5:case 8:case 9:case 10:case 2:{const e=t instanceof ArrayBuffer?new Uint16Array(t):new Uint16Array(i?t/2:t);return n&&e.set(new Uint16Array(n)),e}case 6:{const e=t instanceof ArrayBuffer?new Int32Array(t):new Int32Array(i?t/4:t);return n&&e.set(new Int32Array(n)),e}case 7:case 11:case 12:case 13:case 14:case 15:{const e=t instanceof ArrayBuffer?new Uint32Array(t):new Uint32Array(i?t/4:t);return n&&e.set(new Uint32Array(n)),e}case 1:{const e=t instanceof ArrayBuffer?new Float32Array(t):new Float32Array(i?t/4:t);return n&&e.set(new Float32Array(n)),e}}const r=(ArrayBuffer,new Uint8Array(t));return n&&r.set(new Uint8Array(n)),r}n.B.prototype._readTexturePixelsSync=function(e,t,i,n=-1,s=0,o=null,a=!0,l=!1,c=0,h=0){var _,d;const u=this._gl;if(!u)throw new Error("Engine does not have gl rendering context.");if(!this._dummyFramebuffer){const e=u.createFramebuffer();if(!e)throw new Error("Unable to create dummy framebuffer");this._dummyFramebuffer=e}u.bindFramebuffer(u.FRAMEBUFFER,this._dummyFramebuffer),n>-1?u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_CUBE_MAP_POSITIVE_X+n,null===(_=e._hardwareTexture)||void 0===_?void 0:_.underlyingResource,s):u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_2D,null===(d=e._hardwareTexture)||void 0===d?void 0:d.underlyingResource,s);let p=void 0!==e.type?this._getWebGLTextureType(e.type):u.UNSIGNED_BYTE;return l?o||(o=r(e.type,4*t*i)):p===u.UNSIGNED_BYTE?(o||(o=new Uint8Array(4*t*i)),p=u.UNSIGNED_BYTE):(o||(o=new Float32Array(4*t*i)),p=u.FLOAT),a&&this.flushFramebuffer(),u.readPixels(c,h,t,i,u.RGBA,p,o),u.bindFramebuffer(u.FRAMEBUFFER,this._currentFramebuffer),o},n.B.prototype._readTexturePixels=function(e,t,i,n=-1,r=0,s=null,o=!0,a=!1,l=0,c=0){return Promise.resolve(this._readTexturePixelsSync(e,t,i,n,r,s,o,a,l,c))}},"../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.js":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js"),r=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),s=i("../../../node_modules/@babylonjs/core/Engines/thinEngine.js"),o=i("../../../node_modules/@babylonjs/core/Engines/renderTargetWrapper.js");class a extends o.r{constructor(e,t,i,n,r){super(e,t,i,n),this._framebuffer=null,this._depthStencilBuffer=null,this._MSAAFramebuffer=null,this._colorTextureArray=null,this._depthStencilTextureArray=null,this._context=r}_cloneRenderTargetWrapper(){let e=null;return this._colorTextureArray&&this._depthStencilTextureArray?(e=this._engine.createMultiviewRenderTargetTexture(this.width,this.height),e.texture.isReady=!0):e=super._cloneRenderTargetWrapper(),e}_swapRenderTargetWrapper(e){super._swapRenderTargetWrapper(e),e._framebuffer=this._framebuffer,e._depthStencilBuffer=this._depthStencilBuffer,e._MSAAFramebuffer=this._MSAAFramebuffer,e._colorTextureArray=this._colorTextureArray,e._depthStencilTextureArray=this._depthStencilTextureArray,this._framebuffer=this._depthStencilBuffer=this._MSAAFramebuffer=this._colorTextureArray=this._depthStencilTextureArray=null}_shareDepth(e){super._shareDepth(e);const t=this._context,i=this._depthStencilBuffer,n=e._MSAAFramebuffer||e._framebuffer;e._depthStencilBuffer&&t.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=this._depthStencilBuffer,this._engine._bindUnboundFramebuffer(n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,i),this._engine._bindUnboundFramebuffer(null)}_bindTextureRenderTarget(e,t=0,i=-1,n=0){if(!e._hardwareTexture)return;const r=this._context,s=this._framebuffer,o=this._engine._currentFramebuffer;this._engine._bindUnboundFramebuffer(s);const a=r[this._engine.webGLVersion>1?"COLOR_ATTACHMENT"+t:"COLOR_ATTACHMENT"+t+"_WEBGL"],l=-1!==i?r.TEXTURE_CUBE_MAP_POSITIVE_X+i:r.TEXTURE_2D;r.framebufferTexture2D(r.FRAMEBUFFER,a,l,e._hardwareTexture.underlyingResource,n),this._engine._bindUnboundFramebuffer(o)}setTexture(e,t=0,i=!0){super.setTexture(e,t,i),this._bindTextureRenderTarget(e,t)}dispose(e=!1){const t=this._context;e||(this._colorTextureArray&&(this._context.deleteTexture(this._colorTextureArray),this._colorTextureArray=null),this._depthStencilTextureArray&&(this._context.deleteTexture(this._depthStencilTextureArray),this._depthStencilTextureArray=null)),this._framebuffer&&(t.deleteFramebuffer(this._framebuffer),this._framebuffer=null),this._depthStencilBuffer&&(t.deleteRenderbuffer(this._depthStencilBuffer),this._depthStencilBuffer=null),this._MSAAFramebuffer&&(t.deleteFramebuffer(this._MSAAFramebuffer),this._MSAAFramebuffer=null),super.dispose(e)}}s.B.prototype._createHardwareRenderTargetWrapper=function(e,t,i){const n=new a(e,t,i,this,this._gl);return this._renderTargetWrapperCache.push(n),n},s.B.prototype.createRenderTargetTexture=function(e,t){const i=this._createHardwareRenderTargetWrapper(!1,!1,e),r={};void 0!==t&&"object"==typeof t?(r.generateDepthBuffer=!!t.generateDepthBuffer,r.generateStencilBuffer=!!t.generateStencilBuffer,r.noColorTarget=!!t.noColorTarget):(r.generateDepthBuffer=!0,r.generateStencilBuffer=!1,r.noColorTarget=!1);const s=r.noColorTarget?null:this._createInternalTexture(e,t,!0,n.S.RenderTarget),o=e.width||e,a=e.height||e,l=this._currentFramebuffer,c=this._gl,h=c.createFramebuffer();return this._bindUnboundFramebuffer(h),i._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!r.generateStencilBuffer,r.generateDepthBuffer,o,a),s&&!s.is2DArray&&c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,s._hardwareTexture.underlyingResource,0),this._bindUnboundFramebuffer(l),i._framebuffer=h,i._generateDepthBuffer=r.generateDepthBuffer,i._generateStencilBuffer=!!r.generateStencilBuffer,i.setTextures(s),i},s.B.prototype.createDepthStencilTexture=function(e,t,i){if(t.isCube){const n=e.width||e;return this._createDepthStencilCubeTexture(n,t,i)}return this._createDepthStencilTexture(e,t,i)},s.B.prototype._createDepthStencilTexture=function(e,t,i){const s=this._gl,o=e.layers||0,a=0!==o?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D,l=new n.l(this,n.S.DepthStencil);if(!this._caps.depthTextureExtension)return r.Y.Error("Depth texture is not supported by your browser or hardware."),l;const c={bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1,...t};if(this._bindTextureDirectly(a,l,!0),this._setupDepthStencilTexture(l,e,c.generateStencil,0!==c.comparisonFunction&&c.bilinearFiltering,c.comparisonFunction),void 0!==c.depthTextureFormat){if(15!==c.depthTextureFormat&&16!==c.depthTextureFormat&&17!==c.depthTextureFormat&&13!==c.depthTextureFormat&&14!==c.depthTextureFormat&&18!==c.depthTextureFormat)return r.Y.Error("Depth texture format is not supported."),l;l.format=c.depthTextureFormat}else l.format=c.generateStencil?13:16;const h=17===l.format||13===l.format||18===l.format;i._depthStencilTexture=l,i._depthStencilTextureWithStencil=h;let _=s.UNSIGNED_INT;15===l.format?_=s.UNSIGNED_SHORT:17===l.format||13===l.format?_=s.UNSIGNED_INT_24_8:14===l.format?_=s.FLOAT:18===l.format&&(_=s.FLOAT_32_UNSIGNED_INT_24_8_REV);const d=h?s.DEPTH_STENCIL:s.DEPTH_COMPONENT;let u=d;this.webGLVersion>1&&(15===l.format?u=s.DEPTH_COMPONENT16:16===l.format?u=s.DEPTH_COMPONENT24:17===l.format||13===l.format?u=s.DEPTH24_STENCIL8:14===l.format?u=s.DEPTH_COMPONENT32F:18===l.format&&(u=s.DEPTH32F_STENCIL8)),l.is2DArray?s.texImage3D(a,0,u,l.width,l.height,o,0,d,_,null):s.texImage2D(a,0,u,l.width,l.height,0,d,_,null),this._bindTextureDirectly(a,null),this._internalTexturesCache.push(l);const p=i;if(p._depthStencilBuffer){const e=this._currentFramebuffer;this._bindUnboundFramebuffer(p._framebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,null),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,null),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.STENCIL_ATTACHMENT,s.RENDERBUFFER,null),this._bindUnboundFramebuffer(e),s.deleteRenderbuffer(p._depthStencilBuffer),p._depthStencilBuffer=null}return l},s.B.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e||!e.texture)return 1;if(e.samples===t)return t;const i=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null);const n=e.texture._hardwareTexture;if(n._MSAARenderBuffer&&(i.deleteRenderbuffer(n._MSAARenderBuffer),n._MSAARenderBuffer=null),t>1&&i.renderbufferStorageMultisample){const r=i.createFramebuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=r,this._bindUnboundFramebuffer(e._MSAAFramebuffer);const s=this._createRenderBuffer(e.texture.width,e.texture.height,t,-1,this._getRGBAMultiSampleBufferFormat(e.texture.type),i.COLOR_ATTACHMENT0,!1);if(!s)throw new Error("Unable to create multi sampled framebuffer");n._MSAARenderBuffer=s}else this._bindUnboundFramebuffer(e._framebuffer);return e.texture.samples=t,e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.texture.width,e.texture.height,t),this._bindUnboundFramebuffer(null),t}},"../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTargetCube.js":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js"),r=i("../../../node_modules/@babylonjs/core/Misc/logger.js");i("../../../node_modules/@babylonjs/core/Engines/thinEngine.js").B.prototype.createRenderTargetCubeTexture=function(e,t){const i=this._createHardwareRenderTargetWrapper(!1,!0,e),s={generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:0,samplingMode:3,format:5,...t};s.generateStencilBuffer=s.generateDepthBuffer&&s.generateStencilBuffer,(1!==s.type||this._caps.textureFloatLinearFiltering)&&(2!==s.type||this._caps.textureHalfFloatLinearFiltering)||(s.samplingMode=1);const o=this._gl,a=new n.l(this,n.S.RenderTarget);this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,a,!0);const l=this._getSamplingParameters(s.samplingMode,s.generateMipMaps);1!==s.type||this._caps.textureFloat||(s.type=0,r.Y.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,l.mag),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,l.min),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE);for(let t=0;t<6;t++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,this._getRGBABufferInternalSizedFormat(s.type,s.format),e,e,0,this._getInternalFormat(s.format),this._getWebGLTextureType(s.type),null);const c=o.createFramebuffer();return this._bindUnboundFramebuffer(c),i._depthStencilBuffer=this._setupFramebufferDepthAttachments(s.generateStencilBuffer,s.generateDepthBuffer,e,e),s.generateMipMaps&&o.generateMipmap(o.TEXTURE_CUBE_MAP),this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,null),this._bindUnboundFramebuffer(null),i._framebuffer=c,i._generateDepthBuffer=s.generateDepthBuffer,i._generateStencilBuffer=s.generateStencilBuffer,a.width=e,a.height=e,a.isReady=!0,a.isCube=!0,a.samples=1,a.generateMipMaps=s.generateMipMaps,a.samplingMode=s.samplingMode,a.type=s.type,a.format=s.format,this._internalTexturesCache.push(a),i.setTextures(a),i}},"../../../node_modules/@babylonjs/core/Engines/Extensions/engine.uniformBuffer.js":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Engines/thinEngine.js"),r=i("../../../node_modules/@babylonjs/core/Meshes/WebGL/webGLDataBuffer.js");n.B.prototype.createUniformBuffer=function(e){const t=this._gl.createBuffer();if(!t)throw new Error("Unable to create uniform buffer");const i=new r.M(t);return this.bindUniformBuffer(i),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW),this.bindUniformBuffer(null),i.references=1,i},n.B.prototype.createDynamicUniformBuffer=function(e){const t=this._gl.createBuffer();if(!t)throw new Error("Unable to create dynamic uniform buffer");const i=new r.M(t);return this.bindUniformBuffer(i),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW),this.bindUniformBuffer(null),i.references=1,i},n.B.prototype.updateUniformBuffer=function(e,t,i,n){this.bindUniformBuffer(e),void 0===i&&(i=0),void 0===n?t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,t):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,new Float32Array(t)):t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,t.subarray(i,i+n)):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,new Float32Array(t).subarray(i,i+n)),this.bindUniformBuffer(null)},n.B.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},n.B.prototype.bindUniformBufferBase=function(e,t,i){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},n.B.prototype.bindUniformBlock=function(e,t,i){const n=e.program,r=this._gl.getUniformBlockIndex(n,t);4294967295!==r&&this._gl.uniformBlockBinding(n,r,i)}},"../../../node_modules/@babylonjs/core/Engines/Processors/shaderProcessor.js":function(e,t,i){"use strict";i.d(t,{L:function(){return g}});class n{constructor(){this.children=[]}isValid(e){return!0}process(e,t){let i="";if(this.line){let n=this.line;const r=t.processor;r&&(r.lineProcessor&&(n=r.lineProcessor(n,t.isFragment,t.processingContext)),r.attributeProcessor&&this.line.startsWith("attribute")?n=r.attributeProcessor(this.line,e,t.processingContext):r.varyingProcessor&&this.line.startsWith("varying")?n=r.varyingProcessor(this.line,t.isFragment,e,t.processingContext):r.uniformProcessor&&r.uniformRegexp&&r.uniformRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(n=r.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):r.uniformBufferProcessor&&r.uniformBufferRegexp&&r.uniformBufferRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(n=r.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0):r.textureProcessor&&r.textureRegexp&&r.textureRegexp.test(this.line)?n=r.textureProcessor(this.line,t.isFragment,e,t.processingContext):(r.uniformProcessor||r.uniformBufferProcessor)&&this.line.startsWith("uniform")&&!t.lookForClosingBracketForUniformBuffer&&(/uniform\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/.test(this.line)?r.uniformProcessor&&(n=r.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):r.uniformBufferProcessor&&(n=r.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0)),t.lookForClosingBracketForUniformBuffer&&-1!==this.line.indexOf("}")&&(t.lookForClosingBracketForUniformBuffer=!1,r.endOfUniformBufferProcessor&&(n=r.endOfUniformBufferProcessor(this.line,t.isFragment,t.processingContext)))),i+=n+"\r\n"}return this.children.forEach((n=>{i+=n.process(e,t)})),this.additionalDefineKey&&(e[this.additionalDefineKey]=this.additionalDefineValue||"true"),i}}class r{constructor(){this._lines=[]}get currentLine(){return this._lines[this.lineIndex]}get canRead(){return this.lineIndex{c=c.trim(),""!==c&&(t.push(c),c="")},r=e=>{ia._Stack[i],o=()=>-1===i?"!!INVALID EXPRESSION!!":a._Stack[i--];let l=0,c="";for(;l1){for(n();-1!==i&&a._OperatorPriority[s()]>=a._OperatorPriority[_];)t.push(o());r(_),l++}else c+=h;l++}for(n();-1!==i;)"("===s()?o():t.push(o());return t}}a._OperatorPriority={")":0,"(":1,"||":2,"&&":3},a._Stack=["","","","","","","","","","","","","","","","","","","",""];class l extends a{constructor(e,t=!1){super(),this.define=e,this.not=t}isTrue(e){let t=void 0!==e[this.define];return this.not&&(t=!t),t}}class c extends a{isTrue(e){return this.leftOperand.isTrue(e)||this.rightOperand.isTrue(e)}}class h extends a{isTrue(e){return this.leftOperand.isTrue(e)&&this.rightOperand.isTrue(e)}}class _ extends a{constructor(e,t,i){super(),this.define=e,this.operand=t,this.testValue=i}isTrue(e){let t=e[this.define];void 0===t&&(t=this.define);let i=!1;const n=parseInt(t),r=parseInt(this.testValue);switch(this.operand){case">":i=n>r;break;case"<":i=n=":i=n>=r;break;case"==":i=n===r}return i}}var d=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),u=i("../../../node_modules/@babylonjs/core/Materials/shaderLanguage.js");const p=/defined\s*?\((.+?)\)/g,f=/defined\s*?\[(.+?)\]/g,m=/#include\s?<(.+)>(\((.*)\))*(\[(.*)\])*/g;class g{static Initialize(e){e.processor&&e.processor.initializeShaders&&e.processor.initializeShaders(e.processingContext)}static Process(e,t,i,n){var r;(null===(r=t.processor)||void 0===r?void 0:r.preProcessShaderCode)&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),this._ProcessIncludes(e,t,(e=>{t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?"fragment":"vertex",e));const r=this._ProcessShaderConversion(e,t,n);i(r)}))}static PreProcess(e,t,i,n){var r;(null===(r=t.processor)||void 0===r?void 0:r.preProcessShaderCode)&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),this._ProcessIncludes(e,t,(e=>{t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?"fragment":"vertex",e));const r=this._ApplyPreProcessing(e,t,n);i(r)}))}static Finalize(e,t,i){return i.processor&&i.processor.finalizeShaders?i.processor.finalizeShaders(e,t,i.processingContext):{vertexCode:e,fragmentCode:t}}static _ProcessPrecision(e,t){var i;if(null===(i=t.processor)||void 0===i?void 0:i.noPrecision)return e;const n=t.shouldUseHighPrecisionShader;return-1===e.indexOf("precision highp float")?e=n?"precision highp float;\n"+e:"precision mediump float;\n"+e:n||(e=e.replace("precision highp float","precision mediump float")),e}static _ExtractOperation(e){const t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new l(t[1].trim(),"!"===e[0]);const i=["==",">=","<=","<",">"];let n="",r=0;for(n of i)if(r=e.indexOf(n),r>-1)break;if(-1===r)return new l(e);const s=e.substring(0,r).trim(),o=e.substring(r+n.length).trim();return new _(s,n,o)}static _BuildSubExpression(e){e=e.replace(p,"defined[$1]");const t=a.infixToPostfix(e),i=[];for(const e of t)if("||"!==e&&"&&"!==e)i.push(e);else if(i.length>=2){let t=i[i.length-1],n=i[i.length-2];i.length-=2;const r="&&"==e?new h:new c;"string"==typeof t&&(t=t.replace(f,"defined($1)")),"string"==typeof n&&(n=n.replace(f,"defined($1)")),r.leftOperand="string"==typeof n?this._ExtractOperation(n):n,r.rightOperand="string"==typeof t?this._ExtractOperation(t):t,i.push(r)}let n=i[i.length-1];return"string"==typeof n&&(n=n.replace(f,"defined($1)")),"string"==typeof n?this._ExtractOperation(n):n}static _BuildExpression(e,t){const i=new o,n=e.substring(0,t);let r=e.substring(t);return r=r.substring(0,(r.indexOf("//")+1||r.length+1)-1).trim(),i.testExpression="#ifdef"===n?new l(r):"#ifndef"===n?new l(r,!0):this._BuildSubExpression(r),i}static _MoveCursorWithinIf(e,t,i){let r=e.currentLine;for(;this._MoveCursor(e,i);){r=e.currentLine;const s=r.substring(0,5).toLowerCase();if("#else"===s){const i=new n;return t.children.push(i),void this._MoveCursor(e,i)}if("#elif"===s){const e=this._BuildExpression(r,5);t.children.push(e),i=e}}}static _MoveCursor(e,t){for(;e.canRead;){e.lineIndex++;const i=e.currentLine,r=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/.exec(i);if(r&&r.length)switch(r[0]){case"#ifdef":{const n=new s;t.children.push(n);const r=this._BuildExpression(i,6);n.children.push(r),this._MoveCursorWithinIf(e,n,r);break}case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":{const n=new s;t.children.push(n);const r=this._BuildExpression(i,7);n.children.push(r),this._MoveCursorWithinIf(e,n,r);break}case"#if":{const n=new s,r=this._BuildExpression(i,3);t.children.push(n),n.children.push(r),this._MoveCursorWithinIf(e,n,r);break}}else{const e=new n;if(e.line=i,t.children.push(e),"#"===i[0]&&"d"===i[1]){const t=i.replace(";","").split(" ");e.additionalDefineKey=t[1],3===t.length&&(e.additionalDefineValue=t[2])}}}return!1}static _EvaluatePreProcessors(e,t,i){const s=new n,o=new r;return o.lineIndex=-1,o.lines=e.split("\n"),this._MoveCursor(o,s),s.process(t,i)}static _PreparePreProcessors(e,t){var i;const n=e.defines,r={};for(const e of n){const t=e.replace("#define","").replace(";","").trim().split(" ");r[t[0]]=t.length>1?t[1]:""}return(null===(i=e.processor)||void 0===i?void 0:i.shaderLanguage)===u.x.GLSL&&(r.GL_ES="true"),r.__VERSION__=e.version,r[e.platformName]="true",t._getGlobalDefines(r),r}static _ProcessShaderConversion(e,t,i){let n=this._ProcessPrecision(e,t);if(!t.processor)return n;if(t.processor.shaderLanguage===u.x.GLSL&&-1!==n.indexOf("#version 3"))return n.replace("#version 300 es","");const r=t.defines,s=this._PreparePreProcessors(t,i);return t.processor.preProcessor&&(n=t.processor.preProcessor(n,r,t.isFragment,t.processingContext)),n=this._EvaluatePreProcessors(n,s,t),t.processor.postProcessor&&(n=t.processor.postProcessor(n,r,t.isFragment,t.processingContext,i)),i._features.needShaderCodeInlining&&(n=i.inlineShaderCode(n)),n}static _ApplyPreProcessing(e,t,i){var n,r;let s=e;const o=t.defines,a=this._PreparePreProcessors(t,i);return(null===(n=t.processor)||void 0===n?void 0:n.preProcessor)&&(s=t.processor.preProcessor(s,o,t.isFragment,t.processingContext)),s=this._EvaluatePreProcessors(s,a,t),(null===(r=t.processor)||void 0===r?void 0:r.postProcessor)&&(s=t.processor.postProcessor(s,o,t.isFragment,t.processingContext,i)),i._features.needShaderCodeInlining&&(s=i.inlineShaderCode(s)),s}static _ProcessIncludes(e,t,i){let n=m.exec(e),r=new String(e),s=!1;for(;null!=n;){let o=n[1];if(-1!==o.indexOf("__decl__")&&(o=o.replace(/__decl__/,""),t.supportsUniformBuffers&&(o=o.replace(/Vertex/,"Ubo"),o=o.replace(/Fragment/,"Ubo")),o+="Declaration"),!t.includesShadersStore[o]){const e=t.shadersRepository+"ShadersInclude/"+o+".fx";return void g._FileToolsLoadFile(e,(e=>{t.includesShadersStore[o]=e,this._ProcessIncludes(r,t,i)}))}{let e=t.includesShadersStore[o];if(n[2]){const t=n[3].split(",");for(let i=0;it+"{X}"))),e+=o.replace(/\{X\}/g,i.toString())+"\n"}else t.supportsUniformBuffers||(e=e.replace(/light\{X\}.(\w*)/g,((e,t)=>t+"{X}"))),e=e.replace(/\{X\}/g,i)}r=r.replace(n[0],e),s=s||e.indexOf("#include<")>=0||e.indexOf("#include <")>=0}n=m.exec(e)}s?this._ProcessIncludes(r.toString(),t,i):i(r)}static _FileToolsLoadFile(e,t,i,n,r,s){throw(0,d.S)("FileTools")}}},"../../../node_modules/@babylonjs/core/Engines/WebGL/webGL2ShaderProcessors.js":function(e,t,i){"use strict";i.d(t,{C:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Materials/shaderLanguage.js");class r{constructor(){this.shaderLanguage=n.x.GLSL}attributeProcessor(e){return e.replace("attribute","in")}varyingProcessor(e,t){return e.replace("varying",t?"in":"out")}postProcessor(e,t,i){const n=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),i)e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(n?"":"out vec4 glFragColor;\n")+"void main(");else if(-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e}}},"../../../node_modules/@babylonjs/core/Engines/WebGL/webGLHardwareTexture.js":function(e,t,i){"use strict";i.d(t,{B:function(){return n}});class n{constructor(e=null,t){if(this._MSAARenderBuffer=null,this._context=t,!e&&!(e=t.createTexture()))throw new Error("Unable to create webGL texture");this.set(e)}get underlyingResource(){return this._webGLTexture}setUsage(){}set(e){this._webGLTexture=e}reset(){this._webGLTexture=null,this._MSAARenderBuffer=null}release(){this._MSAARenderBuffer&&(this._context.deleteRenderbuffer(this._MSAARenderBuffer),this._MSAARenderBuffer=null),this._webGLTexture&&this._context.deleteTexture(this._webGLTexture),this.reset()}}},"../../../node_modules/@babylonjs/core/Engines/WebGL/webGLPipelineContext.js":function(e,t,i){"use strict";i.d(t,{y:function(){return r}});const n=["Int2","Int","Int3","Int4","Vector2","Vector3","Vector4","Float2","Float","Float3","Float4","Quaternion","Color3","Color4","DirectColor4"];class r{constructor(){this._valueCache={},this.vertexCompilationError=null,this.fragmentCompilationError=null,this.programLinkError=null,this.programValidationError=null;const e=[],t=function(){e.length=0,Array.prototype.push.apply(e,arguments),e[0]=this._uniforms[e[0]]},i=i=>{const r=n.includes(i.substring(3))&&"FloatN";if(r){const n=this[`_cache${r}`];return function(){const r=this.engine[i];t.apply(this,arguments),n.apply(this,arguments)&&(r.apply(this.engine,e)||(this._valueCache[arguments[0]]=null))}}return function(){const n=this.engine[i];t.apply(this,arguments),void 0!==arguments[1]&&(this._valueCache[arguments[0]]=null,n.apply(this.engine,e))}};["Int?","IntArray?","Array?","Float?","Matrices","Matrix3x3","Matrix2x2"].forEach((e=>{const t=`set${e}`;this[t]||(t.endsWith("?")?["",2,3,4].forEach((e=>{this[t.slice(0,-1)+e]=this[t.slice(0,-1)+e]||i(t.slice(0,-1)+e).bind(this)})):this[t]=this[t]||i(t).bind(this))}))}get isAsync(){return this.isParallelCompiled}get isReady(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))}_handlesSpectorRebuildCallback(e){e&&this.program&&e(this.program)}_fillEffectInformation(e,t,i,n,r,s,o,a){const l=this.engine;if(l.supportsUniformBuffers)for(const i in t)e.bindUniformBlock(i,t[i]);let c;for(this.engine.getUniforms(this,i).forEach(((e,t)=>{n[i[t]]=e})),this._uniforms=n,c=0;c{s[e]=t}));for(const e of l.getAttributes(this,o))a.push(e)}dispose(){this._uniforms={}}_cacheMatrix(e,t){const i=this._valueCache[e],n=t.updateFlag;return(void 0===i||i!==n)&&(this._valueCache[e]=n,!0)}_cacheFloatN(e,t,i,n,r){let s=this._valueCache[arguments[0]];if(!s||s.length!==arguments.length-1)return s=Array.prototype.slice.call(arguments,1),this._valueCache[arguments[0]]=s,!0;let o=!1;for(let e=0;e{this.isFullscreen=!!document.fullscreenElement,this.isFullscreen&&this._pointerLockRequested&&t&&p._RequestPointerlock(t)},document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",this._onFullscreenChange,!1),this._onPointerLockChange=()=>{this.isPointerLock=document.pointerLockElement===t},document.addEventListener("pointerlockchange",this._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",this._onPointerLockChange,!1),!p.audioEngine&&i.audioEngine&&p.AudioEngineFactory&&(p.audioEngine=p.AudioEngineFactory(this.getRenderingCanvas(),this.getAudioContext(),this.getAudioDestination()))),this._connectVREvents(),this.enableOfflineSupport=void 0!==p.OfflineProviderFactory,this._deterministicLockstep=!!i.deterministicLockstep,this._lockstepMaxSteps=i.lockstepMaxSteps||0,this._timeStep=i.timeStep||1/60}this._prepareVRComponent(),i.autoEnableWebVR&&this.initWebVR()}}static get NpmPackage(){return l.B.NpmPackage}static get Version(){return l.B.Version}static get Instances(){return o.l.Instances}static get LastCreatedEngine(){return o.l.LastCreatedEngine}static get LastCreatedScene(){return o.l.LastCreatedScene}_createImageBitmapFromSource(e,t){return new Promise(((i,n)=>{const r=new Image;r.onload=()=>{r.decode().then((()=>{this.createImageBitmap(r,t).then((e=>{i(e)}))}))},r.onerror=()=>{n(`Error loading image ${r.src}`)},r.src=e}))}createImageBitmap(e,t){return createImageBitmap(e,t)}resizeImageBitmap(e,t,i){const n=this.createCanvas(t,i).getContext("2d");if(!n)throw new Error("Unable to get 2d context for resizeImageBitmap");return n.drawImage(e,0,0),n.getImageData(0,0,t,i).data}static MarkAllMaterialsAsDirty(e,t){for(let i=0;i{this.onCanvasFocusObservable.notifyObservers(this)},this._onCanvasBlur=()=>{this.onCanvasBlurObservable.notifyObservers(this)},this._onCanvasContextMenu=e=>{this.disableContextMenu&&e.preventDefault()},e.addEventListener("focus",this._onCanvasFocus),e.addEventListener("blur",this._onCanvasBlur),e.addEventListener("contextmenu",this._onCanvasContextMenu),this._onBlur=()=>{this.disablePerformanceMonitorInBackground&&this._performanceMonitor.disable(),this._windowIsBackground=!0},this._onFocus=()=>{this.disablePerformanceMonitorInBackground&&this._performanceMonitor.enable(),this._windowIsBackground=!1},this._onCanvasPointerOut=t=>{document.elementFromPoint(t.clientX,t.clientY)!==e&&this.onCanvasPointerOutObservable.notifyObservers(t)},(0,s.CG)()){const e=this.getHostWindow();e&&(e.addEventListener("blur",this._onBlur),e.addEventListener("focus",this._onFocus))}e.addEventListener("pointerout",this._onCanvasPointerOut),t||this._disableTouchAction(),!p.audioEngine&&i&&p.AudioEngineFactory&&(p.audioEngine=p.AudioEngineFactory(this.getRenderingCanvas(),this.getAudioContext(),this.getAudioDestination()))}getAspectRatio(e,t=!1){const i=e.viewport;return this.getRenderWidth(t)*i.width/(this.getRenderHeight(t)*i.height)}getScreenAspectRatio(){return this.getRenderWidth(!0)/this.getRenderHeight(!0)}getRenderingCanvasClientRect(){return this._renderingCanvas?this._renderingCanvas.getBoundingClientRect():null}getInputElementClientRect(){return this._renderingCanvas?this.getInputElement().getBoundingClientRect():null}isDeterministicLockStep(){return this._deterministicLockstep}getLockstepMaxSteps(){return this._lockstepMaxSteps}getTimeStep(){return 1e3*this._timeStep}generateMipMapsForCubemap(e,t=!0){if(e.generateMipMaps){const i=this._gl;this._bindTextureDirectly(i.TEXTURE_CUBE_MAP,e,!0),i.generateMipmap(i.TEXTURE_CUBE_MAP),t&&this._bindTextureDirectly(i.TEXTURE_CUBE_MAP,null)}}getDepthWrite(){return this._depthCullingState.depthMask}setDepthWrite(e){this._depthCullingState.depthMask=e}getStencilBuffer(){return this._stencilState.stencilTest}setStencilBuffer(e){this._stencilState.stencilTest=e}getStencilMask(){return this._stencilState.stencilMask}setStencilMask(e){this._stencilState.stencilMask=e}getStencilFunction(){return this._stencilState.stencilFunc}getStencilFunctionReference(){return this._stencilState.stencilFuncRef}getStencilFunctionMask(){return this._stencilState.stencilFuncMask}setStencilFunction(e){this._stencilState.stencilFunc=e}setStencilFunctionReference(e){this._stencilState.stencilFuncRef=e}setStencilFunctionMask(e){this._stencilState.stencilFuncMask=e}getStencilOperationFail(){return this._stencilState.stencilOpStencilFail}getStencilOperationDepthFail(){return this._stencilState.stencilOpDepthFail}getStencilOperationPass(){return this._stencilState.stencilOpStencilDepthPass}setStencilOperationFail(e){this._stencilState.stencilOpStencilFail=e}setStencilOperationDepthFail(e){this._stencilState.stencilOpDepthFail=e}setStencilOperationPass(e){this._stencilState.stencilOpStencilDepthPass=e}setDitheringState(e){e?this._gl.enable(this._gl.DITHER):this._gl.disable(this._gl.DITHER)}setRasterizerState(e){e?this._gl.disable(this._gl.RASTERIZER_DISCARD):this._gl.enable(this._gl.RASTERIZER_DISCARD)}getDepthFunction(){return this._depthCullingState.depthFunc}setDepthFunction(e){this._depthCullingState.depthFunc=e}setDepthFunctionToGreater(){this.setDepthFunction(516)}setDepthFunctionToGreaterOrEqual(){this.setDepthFunction(518)}setDepthFunctionToLess(){this.setDepthFunction(513)}setDepthFunctionToLessOrEqual(){this.setDepthFunction(515)}cacheStencilState(){this._cachedStencilBuffer=this.getStencilBuffer(),this._cachedStencilFunction=this.getStencilFunction(),this._cachedStencilMask=this.getStencilMask(),this._cachedStencilOperationPass=this.getStencilOperationPass(),this._cachedStencilOperationFail=this.getStencilOperationFail(),this._cachedStencilOperationDepthFail=this.getStencilOperationDepthFail(),this._cachedStencilReference=this.getStencilFunctionReference()}restoreStencilState(){this.setStencilFunction(this._cachedStencilFunction),this.setStencilMask(this._cachedStencilMask),this.setStencilBuffer(this._cachedStencilBuffer),this.setStencilOperationPass(this._cachedStencilOperationPass),this.setStencilOperationFail(this._cachedStencilOperationFail),this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail),this.setStencilFunctionReference(this._cachedStencilReference)}setDirectViewport(e,t,i,n){const r=this._cachedViewport;return this._cachedViewport=null,this._viewport(e,t,i,n),r}scissorClear(e,t,i,n,r){this.enableScissor(e,t,i,n),this.clear(r,!0,!0,!0),this.disableScissor()}enableScissor(e,t,i,n){const r=this._gl;r.enable(r.SCISSOR_TEST),r.scissor(e,t,i,n)}disableScissor(){const e=this._gl;e.disable(e.SCISSOR_TEST)}_reportDrawCall(e=1){this._drawCalls.addCount(e,!1)}initWebVR(){throw(0,a.S)("WebVRCamera")}_prepareVRComponent(){}_connectVREvents(e,t){}_submitVRFrame(){}disableVR(){}isVRPresenting(){return!1}_requestVRFrame(){}_loadFileAsync(e,t,i){return new Promise(((n,r)=>{this._loadFile(e,(e=>{n(e)}),void 0,t,i,((e,t)=>{r(t)}))}))}getVertexShaderSource(e){const t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[0]):null}getFragmentShaderSource(e){const t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[1]):null}setDepthStencilTexture(e,t,i,n){void 0!==e&&(t&&(this._boundUniforms[e]=t),i&&i.depthStencilTexture?this._setTexture(e,i,!1,!0,n):this._setTexture(e,null,void 0,void 0,n))}setTextureFromPostProcess(e,t,i){var n;let r=null;t&&(t._textures.data[t._currentRenderTextureInd]?r=t._textures.data[t._currentRenderTextureInd]:t._forcedOutputTexture&&(r=t._forcedOutputTexture)),this._bindTexture(e,null!==(n=null==r?void 0:r.texture)&&void 0!==n?n:null,i)}setTextureFromPostProcessOutput(e,t,i){var n,r;this._bindTexture(e,null!==(r=null===(n=null==t?void 0:t._outputTexture)||void 0===n?void 0:n.texture)&&void 0!==r?r:null,i)}_rebuildBuffers(){for(const e of this.scenes)e.resetCachedMaterial(),e._rebuildGeometries(),e._rebuildTextures();for(const e of this._virtualScenes)e.resetCachedMaterial(),e._rebuildGeometries(),e._rebuildTextures();super._rebuildBuffers()}_renderFrame(){for(let e=0;e0?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1}_renderViews(){return!1}switchFullscreen(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)}enterFullscreen(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&p._RequestFullscreen(this._renderingCanvas))}exitFullscreen(){this.isFullscreen&&p._ExitFullscreen()}enterPointerlock(){this._renderingCanvas&&p._RequestPointerlock(this._renderingCanvas)}exitPointerlock(){p._ExitPointerlock()}beginFrame(){this._measureFps(),this.onBeginFrameObservable.notifyObservers(this),super.beginFrame()}endFrame(){super.endFrame(),this._submitVRFrame(),this.onEndFrameObservable.notifyObservers(this)}resize(e=!1){this.isVRPresenting()||super.resize(e)}setSize(e,t,i=!1){if(!this._renderingCanvas)return!1;if(!super.setSize(e,t,i))return!1;if(this.scenes){for(let e=0;e1&&r){const t=this.createTransformFeedback();this.bindTransformFeedback(t),this.setTranformFeedbackVaryings(s,r),e.transformFeedback=t}return n.linkProgram(s),this.webGLVersion>1&&r&&this.bindTransformFeedback(null),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),s}_releaseTexture(e){super._releaseTexture(e)}_releaseRenderTargetWrapper(e){super._releaseRenderTargetWrapper(e),this.scenes.forEach((t=>{t.postProcesses.forEach((t=>{t._outputTexture===e&&(t._outputTexture=null)})),t.cameras.forEach((t=>{t._postProcesses.forEach((t=>{t&&t._outputTexture===e&&(t._outputTexture=null)}))}))}))}getRenderPassNames(){return this._renderPassNames}getCurrentRenderPassName(){return this._renderPassNames[this.currentRenderPassId]}createRenderPassId(e){const t=++p._RenderPassIdCounter;return this._renderPassNames[t]=null!=e?e:"NONAME",t}releaseRenderPassId(e){this._renderPassNames[e]=void 0;for(let t=0;t{this._rescalePostProcess.onApply=function(t){t._bindTexture("textureSampler",e)};let o=i;o||(o=this.scenes[this.scenes.length-1]),o.postProcessManager.directRender([this._rescalePostProcess],s,!0),this._bindTextureDirectly(this._gl.TEXTURE_2D,t,!0),this._gl.copyTexImage2D(this._gl.TEXTURE_2D,0,n,0,0,t.width,t.height,0),this.unBindFramebuffer(s),s.dispose(),r&&r()}))}getFps(){return this._fps}getDeltaTime(){return this._deltaTime}_measureFps(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0}wrapWebGLTexture(e){const t=new u.B(e,this._gl),i=new r.l(this,r.S.Unknown,!0);return i._hardwareTexture=t,i.isReady=!0,i}_uploadImageToTexture(e,t,i=0,n=0){const r=this._gl,s=this._getWebGLTextureType(e.type),o=this._getInternalFormat(e.format),a=this._getRGBABufferInternalSizedFormat(e.type,o),l=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(l,e,!0),this._unpackFlipY(e.invertY);let c=r.TEXTURE_2D;e.isCube&&(c=r.TEXTURE_CUBE_MAP_POSITIVE_X+i),r.texImage2D(c,n,a,o,s,t),this._bindTextureDirectly(l,null,!0)}updateTextureComparisonFunction(e,t){if(1===this.webGLVersion)return void d.Y.Error("WebGL 1 does not support texture comparison.");const i=this._gl;e.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,e,!0),0===t?(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),0===t?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,515),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),e._comparisonFunction=t}createInstancesBuffer(e){const t=this._gl.createBuffer();if(!t)throw new Error("Unable to create instance buffer");const i=new _.M(t);return i.capacity=e,this.bindArrayBuffer(i),this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),i.references=1,i}deleteInstancesBuffer(e){this._gl.deleteBuffer(e)}_clientWaitAsync(e,t=0,i=10){const n=this._gl;return new Promise(((r,s)=>{const o=()=>{const a=n.clientWaitSync(e,t,0);a!=n.WAIT_FAILED?a!=n.TIMEOUT_EXPIRED?r():setTimeout(o,i):s()};o()}))}_readPixelsAsync(e,t,i,n,r,s,o){if(this._webGLVersion<2)throw new Error("_readPixelsAsync only work on WebGL2+");const a=this._gl,l=a.createBuffer();a.bindBuffer(a.PIXEL_PACK_BUFFER,l),a.bufferData(a.PIXEL_PACK_BUFFER,o.byteLength,a.STREAM_READ),a.readPixels(e,t,i,n,r,s,0),a.bindBuffer(a.PIXEL_PACK_BUFFER,null);const c=a.fenceSync(a.SYNC_GPU_COMMANDS_COMPLETE,0);return c?(a.flush(),this._clientWaitAsync(c,0,10).then((()=>(a.deleteSync(c),a.bindBuffer(a.PIXEL_PACK_BUFFER,l),a.getBufferSubData(a.PIXEL_PACK_BUFFER,0,o),a.bindBuffer(a.PIXEL_PACK_BUFFER,null),a.deleteBuffer(l),o)))):null}dispose(){for(this.hideLoadingUI(),this.onNewSceneAddedObservable.clear();this.postProcesses.length;)this.postProcesses[0].dispose();for(this._rescalePostProcess&&this._rescalePostProcess.dispose();this.scenes.length;)this.scenes[0].dispose();for(;this._virtualScenes.length;)this._virtualScenes[0].dispose();1===p.Instances.length&&p.audioEngine&&(p.audioEngine.dispose(),p.audioEngine=null),this.disableVR(),(0,s.CG)()&&(window.removeEventListener("blur",this._onBlur),window.removeEventListener("focus",this._onFocus),this._renderingCanvas&&(this._renderingCanvas.removeEventListener("focus",this._onCanvasFocus),this._renderingCanvas.removeEventListener("blur",this._onCanvasBlur),this._renderingCanvas.removeEventListener("pointerout",this._onCanvasPointerOut),this._renderingCanvas.removeEventListener("contextmenu",this._onCanvasContextMenu)),(0,s.n5)()&&(document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("msfullscreenchange",this._onFullscreenChange),document.removeEventListener("pointerlockchange",this._onPointerLockChange),document.removeEventListener("mspointerlockchange",this._onPointerLockChange),document.removeEventListener("mozpointerlockchange",this._onPointerLockChange),document.removeEventListener("webkitpointerlockchange",this._onPointerLockChange))),super.dispose();const e=p.Instances.indexOf(this);e>=0&&p.Instances.splice(e,1),this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()}_disableTouchAction(){this._renderingCanvas&&this._renderingCanvas.setAttribute&&(this._renderingCanvas.setAttribute("touch-action","none"),this._renderingCanvas.style.touchAction="none",this._renderingCanvas.style.webkitTapHighlightColor="transparent")}displayLoadingUI(){if(!(0,s.CG)())return;const e=this.loadingScreen;e&&e.displayLoadingUI()}hideLoadingUI(){if(!(0,s.CG)())return;const e=this._loadingScreen;e&&e.hideLoadingUI()}get loadingScreen(){return!this._loadingScreen&&this._renderingCanvas&&(this._loadingScreen=p.DefaultLoadingScreenFactory(this._renderingCanvas)),this._loadingScreen}set loadingScreen(e){this._loadingScreen=e}set loadingUIText(e){this.loadingScreen.loadingUIText=e}set loadingUIBackgroundColor(e){this.loadingScreen.loadingUIBackgroundColor=e}createVideoElement(e){return document.createElement("video")}static _RequestPointerlock(e){e.requestPointerLock&&(e.requestPointerLock(),e.focus())}static _ExitPointerlock(){document.exitPointerLock&&document.exitPointerLock()}static _RequestFullscreen(e){const t=e.requestFullscreen||e.webkitRequestFullscreen;t&&t.call(e)}static _ExitFullscreen(){const e=document;document.exitFullscreen?document.exitFullscreen():e.webkitCancelFullScreen&&e.webkitCancelFullScreen()}getFontOffset(e){const t=document.createElement("span");t.innerHTML="Hg",t.setAttribute("style",`font: ${e} !important`);const i=document.createElement("div");i.style.display="inline-block",i.style.width="1px",i.style.height="0px",i.style.verticalAlign="bottom";const n=document.createElement("div");n.style.whiteSpace="nowrap",n.appendChild(t),n.appendChild(i),document.body.appendChild(n);let r=0,s=0;try{s=i.getBoundingClientRect().top-t.getBoundingClientRect().top,i.style.verticalAlign="baseline",r=i.getBoundingClientRect().top-t.getBoundingClientRect().top}finally{document.body.removeChild(n)}return{ascent:r,height:s,descent:s-r}}}p.ALPHA_DISABLE=0,p.ALPHA_ADD=1,p.ALPHA_COMBINE=2,p.ALPHA_SUBTRACT=3,p.ALPHA_MULTIPLY=4,p.ALPHA_MAXIMIZED=5,p.ALPHA_ONEONE=6,p.ALPHA_PREMULTIPLIED=7,p.ALPHA_PREMULTIPLIED_PORTERDUFF=8,p.ALPHA_INTERPOLATE=9,p.ALPHA_SCREENMODE=10,p.DELAYLOADSTATE_NONE=0,p.DELAYLOADSTATE_LOADED=1,p.DELAYLOADSTATE_LOADING=2,p.DELAYLOADSTATE_NOTLOADED=4,p.NEVER=512,p.ALWAYS=519,p.LESS=513,p.EQUAL=514,p.LEQUAL=515,p.GREATER=516,p.GEQUAL=518,p.NOTEQUAL=517,p.KEEP=7680,p.REPLACE=7681,p.INCR=7682,p.DECR=7683,p.INVERT=5386,p.INCR_WRAP=34055,p.DECR_WRAP=34056,p.TEXTURE_CLAMP_ADDRESSMODE=0,p.TEXTURE_WRAP_ADDRESSMODE=1,p.TEXTURE_MIRROR_ADDRESSMODE=2,p.TEXTUREFORMAT_ALPHA=0,p.TEXTUREFORMAT_LUMINANCE=1,p.TEXTUREFORMAT_LUMINANCE_ALPHA=2,p.TEXTUREFORMAT_RGB=4,p.TEXTUREFORMAT_RGBA=5,p.TEXTUREFORMAT_RED=6,p.TEXTUREFORMAT_R=6,p.TEXTUREFORMAT_RG=7,p.TEXTUREFORMAT_RED_INTEGER=8,p.TEXTUREFORMAT_R_INTEGER=8,p.TEXTUREFORMAT_RG_INTEGER=9,p.TEXTUREFORMAT_RGB_INTEGER=10,p.TEXTUREFORMAT_RGBA_INTEGER=11,p.TEXTURETYPE_UNSIGNED_BYTE=0,p.TEXTURETYPE_UNSIGNED_INT=0,p.TEXTURETYPE_FLOAT=1,p.TEXTURETYPE_HALF_FLOAT=2,p.TEXTURETYPE_BYTE=3,p.TEXTURETYPE_SHORT=4,p.TEXTURETYPE_UNSIGNED_SHORT=5,p.TEXTURETYPE_INT=6,p.TEXTURETYPE_UNSIGNED_INTEGER=7,p.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,p.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,p.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,p.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,p.TEXTURETYPE_UNSIGNED_INT_24_8=12,p.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,p.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,p.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,p.TEXTURE_NEAREST_SAMPLINGMODE=1,p.TEXTURE_BILINEAR_SAMPLINGMODE=2,p.TEXTURE_TRILINEAR_SAMPLINGMODE=3,p.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,p.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,p.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,p.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,p.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,p.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,p.TEXTURE_NEAREST_LINEAR=7,p.TEXTURE_NEAREST_NEAREST=1,p.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,p.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,p.TEXTURE_LINEAR_LINEAR=2,p.TEXTURE_LINEAR_NEAREST=12,p.TEXTURE_EXPLICIT_MODE=0,p.TEXTURE_SPHERICAL_MODE=1,p.TEXTURE_PLANAR_MODE=2,p.TEXTURE_CUBIC_MODE=3,p.TEXTURE_PROJECTION_MODE=4,p.TEXTURE_SKYBOX_MODE=5,p.TEXTURE_INVCUBIC_MODE=6,p.TEXTURE_EQUIRECTANGULAR_MODE=7,p.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,p.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,p.SCALEMODE_FLOOR=1,p.SCALEMODE_NEAREST=2,p.SCALEMODE_CEILING=3,p._RescalePostProcessFactory=null,p._RenderPassIdCounter=0},"../../../node_modules/@babylonjs/core/Engines/engineStore.js":function(e,t,i){"use strict";i.d(t,{l:function(){return n}});class n{static get LastCreatedEngine(){return 0===this.Instances.length?null:this.Instances[this.Instances.length-1]}static get LastCreatedScene(){return this._LastCreatedScene}}n.Instances=new Array,n._LastCreatedScene=null,n.UseFallbackTexture=!0,n.FallbackTexture=""},"../../../node_modules/@babylonjs/core/Engines/performanceConfigurator.js":function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});class n{static SetMatrixPrecision(e){if(n.MatrixTrackPrecisionChange=!1,e&&!n.MatrixUse64Bits&&n.MatrixTrackedMatrices)for(let e=0;e0}get size(){return this.width}get width(){return this._size.width||this._size}get height(){return this._size.height||this._size}get layers(){return this._size.layers||0}get texture(){var e,t;return null!==(t=null===(e=this._textures)||void 0===e?void 0:e[0])&&void 0!==t?t:null}get textures(){return this._textures}get samples(){return this._samples}setSamples(e,t=!0,i=!1){if(this.samples===e&&!i)return e;const n=this._isMulti?this._engine.updateMultipleRenderTargetTextureSampleCount(this,e,t):this._engine.updateRenderTargetTextureSampleCount(this,e);return this._samples=e,n}setTextures(e){Array.isArray(e)?this._textures=e:this._textures=e?[e]:null}setTexture(e,t=0,i=!0){this._textures||(this._textures=[]),this._textures[t]&&i&&this._textures[t].dispose(),this._textures[t]=e}createDepthStencilTexture(e=0,t=!0,i=!1,n=1,r=14){var s;return null===(s=this._depthStencilTexture)||void 0===s||s.dispose(),this._depthStencilTextureWithStencil=i,this._depthStencilTexture=this._engine.createDepthStencilTexture(this._size,{bilinearFiltering:t,comparisonFunction:e,generateStencil:i,isCube:this._isCube,samples:n,depthTextureFormat:r},this),this._depthStencilTexture}_shareDepth(e){this._depthStencilTexture&&(e._depthStencilTexture&&e._depthStencilTexture.dispose(),e._depthStencilTexture=this._depthStencilTexture,this._depthStencilTexture.incrementReferences())}_swapAndDie(e){this.texture&&this.texture._swapAndDie(e),this._textures=null,this.dispose(!0)}_cloneRenderTargetWrapper(){var e,t,i,r,s,o;let a=null;if(this._isMulti){const e=this.textures;if(e&&e.length>0){let t=!1,i=e.length;const r=e[e.length-1]._source;r!==n.S.Depth&&r!==n.S.DepthStencil||(t=!0,i--);const s=[],o=[];for(let t=0;t1&&e.setSamples(this.samples),e._swapRenderTargetWrapper(this),e.dispose()}}releaseTextures(){var e,t;if(this._textures)for(let i=0;null!==(t=i<(null===(e=this._textures)||void 0===e?void 0:e.length))&&void 0!==t&&t;++i)this._textures[i].dispose();this._textures=null}dispose(e=!1){var t;e||(null===(t=this._depthStencilTexture)||void 0===t||t.dispose(),this._depthStencilTexture=null,this.releaseTextures()),this._engine._releaseRenderTargetWrapper(this)}}},"../../../node_modules/@babylonjs/core/Engines/shaderStore.js":function(e,t,i){"use strict";i.d(t,{v:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Materials/shaderLanguage.js");class r{static GetShadersRepository(e=n.x.GLSL){return e===n.x.GLSL?r.ShadersRepository:r.ShadersRepositoryWGSL}static GetShadersStore(e=n.x.GLSL){return e===n.x.GLSL?r.ShadersStore:r.ShadersStoreWGSL}static GetIncludesShadersStore(e=n.x.GLSL){return e===n.x.GLSL?r.IncludesShadersStore:r.IncludesShadersStoreWGSL}}r.ShadersRepository="src/Shaders/",r.ShadersStore={},r.IncludesShadersStore={},r.ShadersRepositoryWGSL="src/ShadersWGSL/",r.ShadersStoreWGSL={},r.IncludesShadersStoreWGSL={}},"../../../node_modules/@babylonjs/core/Engines/thinEngine.js":function(e,t,i){"use strict";i.d(t,{B:function(){return S}});var n=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),r=i("../../../node_modules/@babylonjs/core/Materials/effect.js"),s=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),o=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),a=i("../../../node_modules/@babylonjs/core/States/depthCullingState.js"),l=i("../../../node_modules/@babylonjs/core/States/stencilState.js"),c=i("../../../node_modules/@babylonjs/core/States/alphaCullingState.js"),h=i("../../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js"),_=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),d=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js"),u=i("../../../node_modules/@babylonjs/core/Materials/shaderLanguage.js");class p{constructor(){this.shaderLanguage=u.x.GLSL}postProcessor(e,t,i,n,r){if(!r.getCaps().drawBuffersExtension){const t=/#extension.+GL_EXT_draw_buffers.+(enable|require)/g;e=e.replace(t,"")}return e}}var f=i("../../../node_modules/@babylonjs/core/Engines/WebGL/webGL2ShaderProcessors.js"),m=i("../../../node_modules/@babylonjs/core/Meshes/WebGL/webGLDataBuffer.js"),g=i("../../../node_modules/@babylonjs/core/Engines/WebGL/webGLPipelineContext.js"),b=i("../../../node_modules/@babylonjs/core/Engines/performanceConfigurator.js"),y=i("../../../node_modules/@babylonjs/core/Engines/WebGL/webGLHardwareTexture.js"),v=i("../../../node_modules/@babylonjs/core/Materials/drawWrapper.js"),A=i("../../../node_modules/@babylonjs/core/States/stencilStateComposer.js");class C{}class S{constructor(e,t,i,n){this._name="WebGL",this.forcePOTTextures=!1,this.isFullscreen=!1,this.cullBackFaces=null,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this.validateShaderPrograms=!1,this._useReverseDepthBuffer=!1,this.isNDCHalfZRange=!1,this.hasOriginBottomLeft=!0,this.disableUniformBuffers=!1,this.onDisposeObservable=new o.y$,this._frameId=0,this._uniformBuffers=new Array,this._storageBuffers=new Array,this._webGLVersion=1,this._windowIsBackground=!1,this._highPrecisionShadersAllowed=!0,this._badOS=!1,this._badDesktopOS=!1,this._renderingQueueLaunched=!1,this._activeRenderLoops=new Array,this.onContextLostObservable=new o.y$,this.onContextRestoredObservable=new o.y$,this._contextWasLost=!1,this._doNotHandleContextLost=!1,this.disableVertexArrayObjects=!1,this._colorWrite=!0,this._colorWriteChanged=!0,this._depthCullingState=new a.k,this._stencilStateComposer=new A.C,this._stencilState=new l.s,this._alphaState=new c.Q,this._alphaMode=1,this._alphaEquation=0,this._internalTexturesCache=new Array,this._renderTargetWrapperCache=new Array,this._activeChannel=0,this._currentTextureChannel=-1,this._boundTexturesCache={},this._compiledEffects={},this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=new Array,this._currentFramebuffer=null,this._dummyFramebuffer=null,this._currentBufferPointers=new Array,this._currentInstanceLocations=new Array,this._currentInstanceBuffers=new Array,this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=new Array,this._maxSimultaneousTextures=0,this._maxMSAASamplesOverride=null,this._activeRequests=new Array,this.adaptToDeviceRatio=!1,this._lastDevicePixelRatio=1,this._transformTextureUrl=null,this.hostInformation={isMobile:!1},this.premultipliedAlpha=!0,this.onBeforeTextureInitObservable=new o.y$,this._isWebGPU=!1,this._snapshotRenderingMode=0,this._useExactSrgbConversions=!1,this._viewportCached={x:0,y:0,z:0,w:0},this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._boundUniforms={};let r=null;if(i=i||{},this._creationOptions=i,this.adaptToDeviceRatio=null!=n&&n,this._stencilStateComposer.stencilGlobal=this._stencilState,b.Z.SetMatrixPrecision(!!i.useHighPrecisionMatrix),!e)return;if(n=n||i.adaptToDeviceRatio||!1,e.getContext){if(r=e,this._renderingCanvas=r,void 0!==t&&(i.antialias=t),void 0===i.deterministicLockstep&&(i.deterministicLockstep=!1),void 0===i.lockstepMaxSteps&&(i.lockstepMaxSteps=4),void 0===i.timeStep&&(i.timeStep=1/60),void 0===i.preserveDrawingBuffer&&(i.preserveDrawingBuffer=!1),void 0===i.audioEngine&&(i.audioEngine=!0),void 0!==i.audioEngineOptions&&void 0!==i.audioEngineOptions.audioContext&&(this._audioContext=i.audioEngineOptions.audioContext),void 0!==i.audioEngineOptions&&void 0!==i.audioEngineOptions.audioDestination&&(this._audioDestination=i.audioEngineOptions.audioDestination),void 0===i.stencil&&(i.stencil=!0),!1===i.premultipliedAlpha&&(this.premultipliedAlpha=!1),void 0===i.xrCompatible&&(i.xrCompatible=!0),void 0!==i.useExactSrgbConversions&&(this._useExactSrgbConversions=i.useExactSrgbConversions),this._doNotHandleContextLost=!!i.doNotHandleContextLost,navigator&&navigator.userAgent){this._checkForMobile=()=>{const e=navigator.userAgent;this.hostInformation.isMobile=-1!==e.indexOf("Mobile")||-1!==e.indexOf("Mac")&&(0,d.n5)()&&"ontouchend"in document},this._checkForMobile(),(0,d.CG)()&&window.addEventListener("resize",this._checkForMobile);const e=navigator.userAgent;for(const t of S.ExceptionList){const n=t.key,r=t.targets;if(new RegExp(n).test(e)){if(t.capture&&t.captureConstraint){const i=t.capture,n=t.captureConstraint,r=new RegExp(i).exec(e);if(r&&r.length>0&&parseInt(r[r.length-1])>=n)continue}for(const e of r)switch(e){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"vao":this.disableVertexArrayObjects=!0;break;case"antialias":i.antialias=!1;break;case"maxMSAASamples":this._maxMSAASamplesOverride=1}}}}if(this._doNotHandleContextLost||(this._onContextLost=e=>{e.preventDefault(),this._contextWasLost=!0,_.Y.Warn("WebGL context lost."),this.onContextLostObservable.notifyObservers(this)},this._onContextRestored=()=>{this._restoreEngineAfterContextLost(this._initGLContext.bind(this))},r.addEventListener("webglcontextlost",this._onContextLost,!1),r.addEventListener("webglcontextrestored",this._onContextRestored,!1),i.powerPreference="high-performance"),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),this._badDesktopOS&&(i.xrCompatible=!1),!i.disableWebGL2Support)try{this._gl=r.getContext("webgl2",i)||r.getContext("experimental-webgl2",i),this._gl&&(this._webGLVersion=2,this._shaderPlatformName="WEBGL2",this._gl.deleteQuery||(this._webGLVersion=1,this._shaderPlatformName="WEBGL1"))}catch(e){}if(!this._gl){if(!r)throw new Error("The provided canvas is null or undefined.");try{this._gl=r.getContext("webgl",i)||r.getContext("experimental-webgl",i)}catch(e){throw new Error("WebGL not supported")}}if(!this._gl)throw new Error("WebGL not supported")}else{this._gl=e,this._renderingCanvas=this._gl.canvas,this._gl.renderbufferStorageMultisample?(this._webGLVersion=2,this._shaderPlatformName="WEBGL2"):this._shaderPlatformName="WEBGL1";const t=this._gl.getContextAttributes();t&&(i.stencil=t.stencil)}this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),void 0!==i.useHighPrecisionFloats&&(this._highPrecisionShadersAllowed=i.useHighPrecisionFloats);const s=(0,d.CG)()&&window.devicePixelRatio||1,h=i.limitDeviceRatio||s;this._hardwareScalingLevel=n?1/Math.min(h,s):1,this._lastDevicePixelRatio=s,this.resize(),this._isStencilEnable=!!i.stencil,this._initGLContext(),this._initFeatures();for(let e=0;e1?new f.C:new p,this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent);const u=`Babylon.js v${S.Version}`;console.log(u+` - ${this.description}`),this._renderingCanvas&&this._renderingCanvas.setAttribute&&this._renderingCanvas.setAttribute("data-engine",u)}static get NpmPackage(){return"babylonjs@5.28.0"}static get Version(){return"5.28.0"}get description(){let e=this.name+this.webGLVersion;return this._caps.parallelShaderCompile&&(e+=" - Parallel shader compilation"),e}get name(){return this._name}set name(e){this._name=e}get version(){return this._webGLVersion}static get ShadersRepository(){return r.Q.ShadersRepository}static set ShadersRepository(e){r.Q.ShadersRepository=e}_getShaderProcessor(e){return this._shaderProcessor}get useReverseDepthBuffer(){return this._useReverseDepthBuffer}set useReverseDepthBuffer(e){e!==this._useReverseDepthBuffer&&(this._useReverseDepthBuffer=e,this._depthCullingState.depthFunc=e?518:515)}get frameId(){return this._frameId}get supportsUniformBuffers(){return this.webGLVersion>1&&!this.disableUniformBuffers}getCreationOptions(){return this._creationOptions}get _shouldUseHighPrecisionShader(){return!(!this._caps.highPrecisionShaderSupported||!this._highPrecisionShadersAllowed)}get needPOTTextures(){return this._webGLVersion<2||this.forcePOTTextures}get activeRenderLoops(){return this._activeRenderLoops}get doNotHandleContextLost(){return this._doNotHandleContextLost}set doNotHandleContextLost(e){this._doNotHandleContextLost=e}get _supportsHardwareTextureRescaling(){return!1}set framebufferDimensionsObject(e){this._framebufferDimensionsObject=e}get currentViewport(){return this._cachedViewport}get emptyTexture(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,5,!1,!1,1)),this._emptyTexture}get emptyTexture3D(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture3D}get emptyTexture2DArray(){return this._emptyTexture2DArray||(this._emptyTexture2DArray=this.createRawTexture2DArray(new Uint8Array(4),1,1,1,5,!1,!1,1)),this._emptyTexture2DArray}get emptyCubeTexture(){if(!this._emptyCubeTexture){const e=new Uint8Array(4),t=[e,e,e,e,e,e];this._emptyCubeTexture=this.createRawCubeTexture(t,1,5,0,!1,!1,1)}return this._emptyCubeTexture}get isWebGPU(){return this._isWebGPU}get shaderPlatformName(){return this._shaderPlatformName}get snapshotRendering(){return!1}set snapshotRendering(e){}get snapshotRenderingMode(){return this._snapshotRenderingMode}set snapshotRenderingMode(e){this._snapshotRenderingMode=e}get useExactSrgbConversions(){return this._useExactSrgbConversions}snapshotRenderingReset(){this.snapshotRendering=!1}static _CreateCanvas(e,t){if("undefined"==typeof document)return new OffscreenCanvas(e,t);const i=document.createElement("canvas");return i.width=e,i.height=t,i}createCanvas(e,t){return S._CreateCanvas(e,t)}createCanvasImage(){return document.createElement("img")}_restoreEngineAfterContextLost(e){setTimeout((async()=>{var t;this._dummyFramebuffer=null;const i=this._depthCullingState.depthTest,n=this._depthCullingState.depthFunc,r=this._depthCullingState.depthMask,s=this._stencilState.stencilTest;await e(),this._rebuildEffects(),null===(t=this._rebuildComputeEffects)||void 0===t||t.call(this),this._rebuildInternalTextures(),this._rebuildRenderTargetWrappers(),this._rebuildBuffers(),this.wipeCaches(!0),this._depthCullingState.depthTest=i,this._depthCullingState.depthFunc=n,this._depthCullingState.depthMask=r,this._stencilState.stencilTest=s,_.Y.Warn(this.name+" context successfully restored."),this.onContextRestoredObservable.notifyObservers(this),this._contextWasLost=!1}),0)}_sharedInit(e,t,i){this._renderingCanvas=e}_getShaderProcessingContext(e){return null}_rebuildInternalTextures(){const e=this._internalTexturesCache.slice();for(const t of e)t._rebuild()}_rebuildRenderTargetWrappers(){const e=this._renderTargetWrapperCache.slice();for(const t of e)t._rebuild()}_rebuildEffects(){for(const e in this._compiledEffects){const t=this._compiledEffects[e];t._pipelineContext=null,t._wasPreviouslyReady=!1,t._prepareEffect()}r.Q.ResetCache()}areAllEffectsReady(){for(const e in this._compiledEffects)if(!this._compiledEffects[e].isReady())return!1;return!0}_rebuildBuffers(){for(const e of this._uniformBuffers)e._rebuild();for(const e of this._storageBuffers)e._rebuild()}_initGLContext(){var e;this._caps={maxTexturesImageUnits:this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),maxCombinedTexturesImageUnits:this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),maxSamples:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile")||void 0,standardDerivatives:this._webGLVersion>1||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),s3tc_srgb:this._gl.getExtension("WEBGL_compressed_texture_s3tc_srgb")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc_srgb"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:this._webGLVersion>1||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:this._webGLVersion>1||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),supportOcclusionQuery:this._webGLVersion>1,canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float")),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1,canUseGLInstanceID:this._webGLVersion>1,canUseGLVertexID:this._webGLVersion>1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:this._webGLVersion>1,textureMaxLevel:this._webGLVersion>1,texture2DArrayMaxLayerCount:this._webGLVersion>1?256:128},this._glVersion=this._gl.getParameter(this._gl.VERSION);const t=this._gl.getExtension("WEBGL_debug_renderer_info");if(null!=t&&(this._glRenderer=this._gl.getParameter(t.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(t.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor=this._gl.getParameter(this._gl.VENDOR)||"Unknown vendor"),this._glRenderer||(this._glRenderer=this._gl.getParameter(this._gl.RENDERER)||"Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=(null!==(e=this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT))&&void 0!==e?e:0)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!(!this._caps.textureFloat||!this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!(!this._caps.textureFloat||!this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._caps.astc&&(this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR),this._caps.bptc&&(this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT),this._caps.s3tc_srgb&&(this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT),this._caps.etc2&&(this._gl.COMPRESSED_SRGB8_ETC2=this._caps.etc2.COMPRESSED_SRGB8_ETC2,this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC),this._webGLVersion>1&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=null!==this._maxMSAASamplesOverride?this._maxMSAASamplesOverride:this._gl.getParameter(this._gl.MAX_SAMPLES);else{const e=this._gl.getExtension("WEBGL_draw_buffers");if(null!==e){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=e.drawBuffersWEBGL.bind(e),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(let t=0;t<16;t++)this._gl["COLOR_ATTACHMENT"+t+"_WEBGL"]=e["COLOR_ATTACHMENT"+t+"_WEBGL"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{const e=this._gl.getExtension("WEBGL_depth_texture");null!=e&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=e.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{const e=this._gl.getExtension("OES_vertex_array_object");null!=e&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=e.createVertexArrayOES.bind(e),this._gl.bindVertexArray=e.bindVertexArrayOES.bind(e),this._gl.deleteVertexArray=e.deleteVertexArrayOES.bind(e))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{const e=this._gl.getExtension("ANGLE_instanced_arrays");null!=e?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=e.drawArraysInstancedANGLE.bind(e),this._gl.drawElementsInstanced=e.drawElementsInstancedANGLE.bind(e),this._gl.vertexAttribDivisor=e.vertexAttribDivisorANGLE.bind(e)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){const e=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),t=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);e&&t&&(this._caps.highPrecisionShaderSupported=0!==e.precision&&0!==t.precision)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{const e=this._gl.getExtension("EXT_blend_minmax");null!=e&&(this._caps.blendMinMax=!0,this._gl.MAX=e.MAX_EXT,this._gl.MIN=e.MIN_EXT)}if(!this._caps.supportSRGBBuffers){if(this._webGLVersion>1)this._caps.supportSRGBBuffers=!0;else{const e=this._gl.getExtension("EXT_sRGB");null!=e&&(this._caps.supportSRGBBuffers=!0,this._gl.SRGB=e.SRGB_EXT,this._gl.SRGB8=e.SRGB_ALPHA_EXT,this._gl.SRGB8_ALPHA8=e.SRGB_ALPHA_EXT)}this._caps.supportSRGBBuffers=this._caps.supportSRGBBuffers&&!(!this._creationOptions||!this._creationOptions.forceSRGBBufferSupportState)}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(let e=0;e=0&&this._activeRenderLoops.splice(t,1)}_renderLoop(){if(!this._contextWasLost){let e=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(e=!1),e){this.beginFrame();for(let e=0;e0?this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1}getRenderingCanvas(){return this._renderingCanvas}getAudioContext(){return this._audioContext}getAudioDestination(){return this._audioDestination}getHostWindow(){return(0,d.CG)()?this._renderingCanvas&&this._renderingCanvas.ownerDocument&&this._renderingCanvas.ownerDocument.defaultView?this._renderingCanvas.ownerDocument.defaultView:window:null}getRenderWidth(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth}getRenderHeight(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight}_queueNewFrame(e,t){return S.QueueNewFrame(e,t)}runRenderLoop(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._boundRenderFunction=this._renderLoop.bind(this),this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow())))}clear(e,t,i,n=!1){const r=this.stencilStateComposer.useStencilGlobalOnly;this.stencilStateComposer.useStencilGlobalOnly=!0,this.applyStates(),this.stencilStateComposer.useStencilGlobalOnly=r;let s=0;t&&e&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),s|=this._gl.COLOR_BUFFER_BIT),i&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GEQUAL,this._gl.clearDepth(0)):this._gl.clearDepth(1),s|=this._gl.DEPTH_BUFFER_BIT),n&&(this._gl.clearStencil(0),s|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(s)}_viewport(e,t,i,n){e===this._viewportCached.x&&t===this._viewportCached.y&&i===this._viewportCached.z&&n===this._viewportCached.w||(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=n,this._gl.viewport(e,t,i,n))}setViewport(e,t,i){const n=t||this.getRenderWidth(),r=i||this.getRenderHeight(),s=e.x||0,o=e.y||0;this._cachedViewport=e,this._viewport(s*n,o*r,n*e.width,r*e.height)}beginFrame(){}endFrame(){this._badOS&&this.flushFramebuffer(),this._frameId++}resize(e=!1){let t,i;if(this.adaptToDeviceRatio){const e=(0,d.CG)()&&window.devicePixelRatio||1,t=this._lastDevicePixelRatio/e;this._lastDevicePixelRatio=e,this._hardwareScalingLevel*=t}(0,d.CG)()?(t=this._renderingCanvas?this._renderingCanvas.clientWidth||this._renderingCanvas.width:window.innerWidth,i=this._renderingCanvas?this._renderingCanvas.clientHeight||this._renderingCanvas.height:window.innerHeight):(t=this._renderingCanvas?this._renderingCanvas.width:100,i=this._renderingCanvas?this._renderingCanvas.height:100),this.setSize(t/this._hardwareScalingLevel,i/this._hardwareScalingLevel,e)}setSize(e,t,i=!1){return!(!this._renderingCanvas||(e|=0,t|=0,!i&&this._renderingCanvas.width===e&&this._renderingCanvas.height===t||(this._renderingCanvas.width=e,this._renderingCanvas.height=t,0)))}bindFramebuffer(e,t=0,i,n,r,s=0,o=0){var a,l,c,h,_;const d=e;this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(d._MSAAFramebuffer?d._MSAAFramebuffer:d._framebuffer);const u=this._gl;e.is2DArray?u.framebufferTextureLayer(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,null===(a=e.texture._hardwareTexture)||void 0===a?void 0:a.underlyingResource,s,o):e.isCube&&u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_CUBE_MAP_POSITIVE_X+t,null===(l=e.texture._hardwareTexture)||void 0===l?void 0:l.underlyingResource,s);const p=e._depthStencilTexture;if(p){const i=e._depthStencilTextureWithStencil?u.DEPTH_STENCIL_ATTACHMENT:u.DEPTH_ATTACHMENT;e.is2DArray?u.framebufferTextureLayer(u.FRAMEBUFFER,i,null===(c=p._hardwareTexture)||void 0===c?void 0:c.underlyingResource,s,o):e.isCube?u.framebufferTexture2D(u.FRAMEBUFFER,i,u.TEXTURE_CUBE_MAP_POSITIVE_X+t,null===(h=p._hardwareTexture)||void 0===h?void 0:h.underlyingResource,s):u.framebufferTexture2D(u.FRAMEBUFFER,i,u.TEXTURE_2D,null===(_=p._hardwareTexture)||void 0===_?void 0:_.underlyingResource,s)}this._cachedViewport&&!r?this.setViewport(this._cachedViewport,i,n):(i||(i=e.width,s&&(i/=Math.pow(2,s))),n||(n=e.height,s&&(n/=Math.pow(2,s))),this._viewport(0,0,i,n)),this.wipeCaches()}setState(e,t=0,i,n=!1,r,s,o=0){var a,l;(this._depthCullingState.cull!==e||i)&&(this._depthCullingState.cull=e);const c=null===(l=null!==(a=this.cullBackFaces)&&void 0!==a?a:r)||void 0===l||l?this._gl.BACK:this._gl.FRONT;(this._depthCullingState.cullFace!==c||i)&&(this._depthCullingState.cullFace=c),this.setZOffset(t),this.setZOffsetUnits(o);const h=n?this._gl.CW:this._gl.CCW;(this._depthCullingState.frontFace!==h||i)&&(this._depthCullingState.frontFace=h),this._stencilStateComposer.stencilMaterial=s}getDepthBuffer(){return this._depthCullingState.depthTest}setDepthBuffer(e){this._depthCullingState.depthTest=e}setZOffset(e){this._depthCullingState.zOffset=this.useReverseDepthBuffer?-e:e}getZOffset(){const e=this._depthCullingState.zOffset;return this.useReverseDepthBuffer?-e:e}setZOffsetUnits(e){this._depthCullingState.zOffsetUnits=this.useReverseDepthBuffer?-e:e}getZOffsetUnits(){const e=this._depthCullingState.zOffsetUnits;return this.useReverseDepthBuffer?-e:e}_bindUnboundFramebuffer(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)}_currentFrameBufferIsDefaultFrameBuffer(){return null===this._currentFramebuffer}generateMipmaps(e){this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)}unBindFramebuffer(e,t=!1,i){var n;const r=e;this._currentRenderTarget=null;const s=this._gl;if(r._MSAAFramebuffer){if(e.isMulti)return void this.unBindMultiColorAttachmentFramebuffer(e,t,i);s.bindFramebuffer(s.READ_FRAMEBUFFER,r._MSAAFramebuffer),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,r._framebuffer),s.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,s.COLOR_BUFFER_BIT,s.NEAREST)}!(null===(n=e.texture)||void 0===n?void 0:n.generateMipMaps)||t||e.isCube||this.generateMipmaps(e.texture),i&&(r._MSAAFramebuffer&&this._bindUnboundFramebuffer(r._framebuffer),i()),this._bindUnboundFramebuffer(null)}flushFramebuffer(){this._gl.flush()}restoreDefaultFramebuffer(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()}_resetVertexBufferBinding(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null}createVertexBuffer(e){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)}_createVertexBuffer(e,t){const i=this._gl.createBuffer();if(!i)throw new Error("Unable to create vertex buffer");const n=new m.M(i);return this.bindArrayBuffer(n),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),t):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,t),this._resetVertexBufferBinding(),n.references=1,n}createDynamicVertexBuffer(e){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)}_resetIndexBufferBinding(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null}createIndexBuffer(e,t){const i=this._gl.createBuffer(),n=new m.M(i);if(!i)throw new Error("Unable to create index buffer");this.bindIndexBuffer(n);const r=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,r,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),n.references=1,n.is32Bits=4===r.BYTES_PER_ELEMENT,n}_normalizeIndexData(e){if(2===e.BYTES_PER_ELEMENT)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;for(let t=0;t=65535)return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)}bindArrayBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ARRAY_BUFFER)}bindUniformBlock(e,t,i){const n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)}bindIndexBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)}_bindBuffer(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)}updateArrayBuffer(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)}_vertexAttribPointer(e,t,i,n,r,s,o){const a=this._currentBufferPointers[t];if(!a)return;let l=!1;a.active?(a.buffer!==e&&(a.buffer=e,l=!0),a.size!==i&&(a.size=i,l=!0),a.type!==n&&(a.type=n,l=!0),a.normalized!==r&&(a.normalized=r,l=!0),a.stride!==s&&(a.stride=s,l=!0),a.offset!==o&&(a.offset=o,l=!0)):(l=!0,a.active=!0,a.index=t,a.size=i,a.type=n,a.normalized=r,a.stride=s,a.offset=o,a.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),n===this._gl.UNSIGNED_INT||n===this._gl.INT?this._gl.vertexAttribIPointer(t,i,n,s,o):this._gl.vertexAttribPointer(t,i,n,r,s,o))}_bindIndexBufferWithCache(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)}_bindVertexBuffersAttributes(e,t,i){const n=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(let r=0;r=0){const t=n[r];let o=null;if(i&&(o=i[t]),o||(o=e[t]),!o)continue;this._gl.enableVertexAttribArray(s),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[s]=!0);const a=o.getBuffer();a&&(this._vertexAttribPointer(a,s,o.getSize(),o.type,o.normalized,o.byteStride,o.byteOffset),o.getIsInstanced()&&(this._gl.vertexAttribDivisor(s,o.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(s),this._currentInstanceBuffers.push(a))))}}}recordVertexArrayObject(e,t,i,n){const r=this._gl.createVertexArray();if(!r)throw new Error("Unable to create VAO");return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(r),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i,n),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),r}bindVertexArrayObject(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)}bindBuffersDirectly(e,t,i,n,r){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r;const t=r.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();let s=0;for(let o=0;o=0&&(this._gl.enableVertexAttribArray(t),this._vertexAttribArraysEnabled[t]=!0,this._vertexAttribPointer(e,t,i[o],this._gl.FLOAT,!1,n,s)),s+=4*i[o]}}this._bindIndexBufferWithCache(t)}_unbindVertexArrayObject(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))}bindBuffers(e,t,i,n){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===i||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i,n)),this._bindIndexBufferWithCache(t)}unbindInstanceAttributes(){let e;for(let t=0,i=this._currentInstanceLocations.length;t1?"#version 300 es\n#define WEBGL2 \n":"",a=this._compileShader(t,"vertex",n,o),l=this._compileShader(i,"fragment",n,o);return this._createShaderProgram(e,a,l,r,s)}inlineShaderCode(e){return e}createPipelineContext(e){const t=new g.y;return t.engine=this,this._caps.parallelShaderCompile&&(t.isParallelCompiled=!0),t}createMaterialContext(){}createDrawContext(){}_createShaderProgram(e,t,i,n,r=null){const s=n.createProgram();if(e.program=s,!s)throw new Error("Unable to create program");return n.attachShader(s,t),n.attachShader(s,i),n.linkProgram(s),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),s}_finalizePipelineContext(e){const t=e.context,i=e.vertexShader,n=e.fragmentShader,r=e.program;if(!t.getProgramParameter(r,t.LINK_STATUS)){if(!this._gl.getShaderParameter(i,this._gl.COMPILE_STATUS)){const t=this._gl.getShaderInfoLog(i);if(t)throw e.vertexCompilationError=t,new Error("VERTEX SHADER "+t)}if(!this._gl.getShaderParameter(n,this._gl.COMPILE_STATUS)){const t=this._gl.getShaderInfoLog(n);if(t)throw e.fragmentCompilationError=t,new Error("FRAGMENT SHADER "+t)}const s=t.getProgramInfoLog(r);if(s)throw e.programLinkError=s,new Error(s)}if(this.validateShaderPrograms&&(t.validateProgram(r),!t.getProgramParameter(r,t.VALIDATE_STATUS))){const i=t.getProgramInfoLog(r);if(i)throw e.programValidationError=i,new Error(i)}t.deleteShader(i),t.deleteShader(n),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)}_preparePipelineContext(e,t,i,n,r,s,o,a,l,c){const h=e;h.program=n?this.createRawShaderProgram(h,t,i,void 0,l):this.createShaderProgram(h,t,i,a,void 0,l),h.program.__SPECTOR_rebuildProgram=o}_isRenderingStateCompiled(e){const t=e;return!!this._gl.getProgramParameter(t.program,this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)&&(this._finalizePipelineContext(t),!0)}_executeWhenRenderingStateIsCompiled(e,t){const i=e;if(!i.isParallelCompiled)return void t();const n=i.onCompiled;i.onCompiled=n?()=>{n(),t()}:t}getUniforms(e,t){const i=new Array,n=e;for(let e=0;e1||this.isWebGPU),(1!==r.type||this._caps.textureFloatLinearFiltering)&&(2!==r.type||this._caps.textureHalfFloatLinearFiltering)||(r.samplingMode=1),1!==r.type||this._caps.textureFloat||(r.type=0,_.Y.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));const s=this._gl,o=new h.l(this,n);o._useSRGBBuffer=!!r.useSRGBBuffer;const a=e.width||e,l=e.height||e,c=e.layers||0,d=this._getSamplingParameters(r.samplingMode,!!r.generateMipMaps),u=0!==c?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D,p=this._getRGBABufferInternalSizedFormat(r.type,r.format,r.useSRGBBuffer),f=this._getInternalFormat(r.format),m=this._getWebGLTextureType(r.type);return this._bindTextureDirectly(u,o),0!==c?(o.is2DArray=!0,s.texImage3D(u,0,p,a,l,c,0,f,m,null)):s.texImage2D(u,0,p,a,l,0,f,m,null),s.texParameteri(u,s.TEXTURE_MAG_FILTER,d.mag),s.texParameteri(u,s.TEXTURE_MIN_FILTER,d.min),s.texParameteri(u,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(u,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),r.generateMipMaps&&this._gl.generateMipmap(u),this._bindTextureDirectly(u,null),o.baseWidth=a,o.baseHeight=l,o.width=a,o.height=l,o.depth=c,o.isReady=!0,o.samples=1,o.generateMipMaps=!!r.generateMipMaps,o.samplingMode=r.samplingMode,o.type=r.type,o.format=r.format,this._internalTexturesCache.push(o),o}_getUseSRGBBuffer(e,t){return e&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU||t)}_createTextureBase(e,t,i,r,s=3,o=null,a=null,l,c,d=null,u=null,p=null,f=null,m,g,b){const y="data:"===(e=e||"").substr(0,5),v="blob:"===e.substr(0,5),A=y&&-1!==e.indexOf(";base64,"),C=u||new h.l(this,h.S.Url),x=e;!this._transformTextureUrl||A||u||d||(e=this._transformTextureUrl(e)),x!==e&&(C._originalUrl=x);const T=e.lastIndexOf(".");let E=f||(T>-1?e.substring(T).toLowerCase():""),R=null;E.indexOf("?")>-1&&(E=E.split("?")[0]);for(const e of S._TextureLoaders)if(e.canLoad(E,m)){R=e;break}r&&r.addPendingData(C),C.url=e,C.generateMipMaps=!t,C.samplingMode=s,C.invertY=i,C._useSRGBBuffer=this._getUseSRGBBuffer(!!b,t),this._doNotHandleContextLost||(C._buffer=d);let P=null;o&&!u&&(P=C.onLoadedObservable.add(o)),u||this._internalTexturesCache.push(C);const I=(i,h)=>{r&&r.removePendingData(C),e===x?(P&&C.onLoadedObservable.remove(P),n.l.UseFallbackTexture&&this._createTextureBase(n.l.FallbackTexture,t,C.invertY,r,s,null,a,l,c,d,C),i=(i||"Unknown error")+(n.l.UseFallbackTexture?" - Fallback texture was used":""),C.onErrorObservable.notifyObservers({message:i,exception:h}),a&&a(i,h)):(_.Y.Warn(`Failed to load ${e}, falling back to ${x}`),this._createTextureBase(x,t,C.invertY,r,s,o,a,l,c,d,C,p,f,m,g,b))};if(R){const t=e=>{R.loadData(e,C,((e,t,i,n,o,a)=>{a?I("TextureLoader failed to load data"):l(C,E,r,{width:e,height:t},C.invertY,!i,n,(()=>(o(),!1)),s)}),g)};d?d instanceof ArrayBuffer?t(new Uint8Array(d)):ArrayBuffer.isView(d)?t(d):a&&a("Unable to load: only ArrayBuffer or ArrayBufferView is supported",null):this._loadFile(e,(e=>t(new Uint8Array(e))),void 0,r?r.offlineProvider:void 0,!0,((e,t)=>{I("Unable to load "+(e&&e.responseURL,t))}))}else{const i=e=>{v&&!this._doNotHandleContextLost&&(C._buffer=e),l(C,E,r,e,C.invertY,t,!1,c,s)};!y||A?d&&("string"==typeof d.decoding||d.close)?i(d):S._FileToolsLoadImage(e,i,I,r?r.offlineProvider:null,m,C.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0):"string"==typeof d||d instanceof ArrayBuffer||ArrayBuffer.isView(d)||d instanceof Blob?S._FileToolsLoadImage(d,i,I,r?r.offlineProvider:null,m,C.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0):d&&i(d)}return C}createTexture(e,t,i,n,r=3,s=null,o=null,a=null,l=null,c=null,_=null,d,u,p,f){return this._createTextureBase(e,t,i,n,r,s,o,this._prepareWebGLTexture.bind(this),((e,t,i,r,s,o)=>{const a=this._gl,l=i.width===e&&i.height===t,_=c?this._getInternalFormat(c,s._useSRGBBuffer):".jpg"!==r||s._useSRGBBuffer?s._useSRGBBuffer?a.SRGB8_ALPHA8:a.RGBA:a.RGB;let d=c?this._getInternalFormat(c):".jpg"!==r||s._useSRGBBuffer?a.RGBA:a.RGB;if(s._useSRGBBuffer&&1===this.webGLVersion&&(d=_),l)return a.texImage2D(a.TEXTURE_2D,0,_,d,a.UNSIGNED_BYTE,i),!1;const u=this._caps.maxTextureSize;if(i.width>u||i.height>u||!this._supportsHardwareTextureRescaling)return this._prepareWorkingCanvas(),!(!this._workingCanvas||!this._workingContext||(this._workingCanvas.width=e,this._workingCanvas.height=t,this._workingContext.drawImage(i,0,0,i.width,i.height,0,0,e,t),a.texImage2D(a.TEXTURE_2D,0,_,d,a.UNSIGNED_BYTE,this._workingCanvas),s.width=e,s.height=t,1));{const e=new h.l(this,h.S.Temp);this._bindTextureDirectly(a.TEXTURE_2D,e,!0),a.texImage2D(a.TEXTURE_2D,0,_,d,a.UNSIGNED_BYTE,i),this._rescaleTexture(e,s,n,_,(()=>{this._releaseTexture(e),this._bindTextureDirectly(a.TEXTURE_2D,s,!0),o()}))}return!0}),a,l,c,_,d,u,f)}static _FileToolsLoadImage(e,t,i,n,r,o){throw(0,s.S)("FileTools")}_rescaleTexture(e,t,i,n,r){}createRawTexture(e,t,i,n,r,o,a,l=null,c=0,h=0,_=!1){throw(0,s.S)("Engine.RawTexture")}createRawCubeTexture(e,t,i,n,r,o,a,l=null){throw(0,s.S)("Engine.RawTexture")}createRawTexture3D(e,t,i,n,r,o,a,l,c=null,h=0){throw(0,s.S)("Engine.RawTexture")}createRawTexture2DArray(e,t,i,n,r,o,a,l,c=null,h=0){throw(0,s.S)("Engine.RawTexture")}_unpackFlipY(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))}_getUnpackAlignement(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)}_getTextureTarget(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D}updateTextureSamplingMode(e,t,i=!1){const n=this._getTextureTarget(t),r=this._getSamplingParameters(e,t.generateMipMaps||i);this._setTextureParameterInteger(n,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(n,this._gl.TEXTURE_MIN_FILTER,r.min),i&&(t.generateMipMaps=!0,this._gl.generateMipmap(n)),this._bindTextureDirectly(n,null),t.samplingMode=e}updateTextureDimensions(e,t,i,n=1){}updateTextureWrappingMode(e,t,i=null,n=null){const r=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==i&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i),e),e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==n&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(n),e),e._cachedWrapR=n),this._bindTextureDirectly(r,null)}_setupDepthStencilTexture(e,t,i,n,r,s=1){const o=t.width||t,a=t.height||t,l=t.layers||0;e.baseWidth=o,e.baseHeight=a,e.width=o,e.height=a,e.is2DArray=l>0,e.depth=l,e.isReady=!0,e.samples=s,e.generateMipMaps=!1,e.samplingMode=n?2:1,e.type=0,e._comparisonFunction=r;const c=this._gl,h=this._getTextureTarget(e),_=this._getSamplingParameters(e.samplingMode,!1);c.texParameteri(h,c.TEXTURE_MAG_FILTER,_.mag),c.texParameteri(h,c.TEXTURE_MIN_FILTER,_.min),c.texParameteri(h,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(h,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),this.webGLVersion>1&&(0===r?(c.texParameteri(h,c.TEXTURE_COMPARE_FUNC,515),c.texParameteri(h,c.TEXTURE_COMPARE_MODE,c.NONE)):(c.texParameteri(h,c.TEXTURE_COMPARE_FUNC,r),c.texParameteri(h,c.TEXTURE_COMPARE_MODE,c.COMPARE_REF_TO_TEXTURE)))}_uploadCompressedDataToTextureDirectly(e,t,i,n,r,s=0,o=0){const a=this._gl;let l=a.TEXTURE_2D;if(e.isCube&&(l=a.TEXTURE_CUBE_MAP_POSITIVE_X+s),e._useSRGBBuffer)switch(t){case 37492:case 36196:this._caps.etc2?t=a.COMPRESSED_SRGB8_ETC2:e._useSRGBBuffer=!1;break;case 37496:this._caps.etc2?t=a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e._useSRGBBuffer=!1;break;case 36492:t=a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;break;case 37808:t=a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;break;case 33776:this._caps.s3tc_srgb?t=a.COMPRESSED_SRGB_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33777:this._caps.s3tc_srgb?t=a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33779:this._caps.s3tc_srgb?t=a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:e._useSRGBBuffer=!1;break;default:e._useSRGBBuffer=!1}this._gl.compressedTexImage2D(l,o,t,i,n,0,r)}_uploadDataToTextureDirectly(e,t,i=0,n=0,r,s=!1){const o=this._gl,a=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),c=void 0===r?this._getRGBABufferInternalSizedFormat(e.type,e.format,e._useSRGBBuffer):this._getInternalFormat(r,e._useSRGBBuffer);this._unpackFlipY(e.invertY);let h=o.TEXTURE_2D;e.isCube&&(h=o.TEXTURE_CUBE_MAP_POSITIVE_X+i);const _=Math.round(Math.log(e.width)*Math.LOG2E),d=Math.round(Math.log(e.height)*Math.LOG2E),u=s?e.width:Math.pow(2,Math.max(_-n,0)),p=s?e.height:Math.pow(2,Math.max(d-n,0));o.texImage2D(h,n,c,u,p,0,l,a,t)}updateTextureData(e,t,i,n,r,s,o=0,a=0,l=!1){const c=this._gl,h=this._getWebGLTextureType(e.type),_=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);let d=c.TEXTURE_2D;e.isCube&&(d=c.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._bindTextureDirectly(d,e,!0),c.texSubImage2D(d,a,i,n,r,s,_,h,t),l&&this._gl.generateMipmap(d),this._bindTextureDirectly(d,null)}_uploadArrayBufferViewToTexture(e,t,i=0,n=0){const r=this._gl,s=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(s,e,!0),this._uploadDataToTextureDirectly(e,t,i,n),this._bindTextureDirectly(s,null,!0)}_prepareWebGLTextureContinuation(e,t,i,n,r){const s=this._gl;if(!s)return;const o=this._getSamplingParameters(r,!i);s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,o.mag),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,o.min),i||n||s.generateMipmap(s.TEXTURE_2D),this._bindTextureDirectly(s.TEXTURE_2D,null),t&&t.removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}_prepareWebGLTexture(e,t,i,n,r,s,o,a,l=3){const c=this.getCaps().maxTextureSize,h=Math.min(c,this.needPOTTextures?S.GetExponentOfTwo(n.width,c):n.width),_=Math.min(c,this.needPOTTextures?S.GetExponentOfTwo(n.height,c):n.height),d=this._gl;d&&(e._hardwareTexture?(this._bindTextureDirectly(d.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===r||!!r),e.baseWidth=n.width,e.baseHeight=n.height,e.width=h,e.height=_,e.isReady=!0,a(h,_,n,t,e,(()=>{this._prepareWebGLTextureContinuation(e,i,s,o,l)}))||this._prepareWebGLTextureContinuation(e,i,s,o,l)):i&&i.removePendingData(e))}_setupFramebufferDepthAttachments(e,t,i,n,r=1){const s=this._gl;if(e&&t)return this._createRenderBuffer(i,n,r,s.DEPTH_STENCIL,s.DEPTH24_STENCIL8,s.DEPTH_STENCIL_ATTACHMENT);if(t){let e=s.DEPTH_COMPONENT16;return this._webGLVersion>1&&(e=s.DEPTH_COMPONENT32F),this._createRenderBuffer(i,n,r,e,e,s.DEPTH_ATTACHMENT)}return e?this._createRenderBuffer(i,n,r,s.STENCIL_INDEX8,s.STENCIL_INDEX8,s.STENCIL_ATTACHMENT):null}_createRenderBuffer(e,t,i,n,r,s,o=!0){const a=this._gl.createRenderbuffer();return this._updateRenderBuffer(a,e,t,i,n,r,s,o)}_updateRenderBuffer(e,t,i,n,r,s,o,a=!0){const l=this._gl;return l.bindRenderbuffer(l.RENDERBUFFER,e),n>1&&l.renderbufferStorageMultisample?l.renderbufferStorageMultisample(l.RENDERBUFFER,n,s,t,i):l.renderbufferStorage(l.RENDERBUFFER,r,t,i),l.framebufferRenderbuffer(l.FRAMEBUFFER,o,l.RENDERBUFFER,e),a&&l.bindRenderbuffer(l.RENDERBUFFER,null),e}_releaseTexture(e){var t;this._deleteTexture(null===(t=e._hardwareTexture)||void 0===t?void 0:t.underlyingResource),this.unbindAllTextures();const i=this._internalTexturesCache.indexOf(e);-1!==i&&this._internalTexturesCache.splice(i,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()}_releaseRenderTargetWrapper(e){const t=this._renderTargetWrapperCache.indexOf(e);-1!==t&&this._renderTargetWrapperCache.splice(t,1)}_deleteTexture(e){e&&this._gl.deleteTexture(e)}_setProgram(e){this._currentProgram!==e&&(this._gl.useProgram(e),this._currentProgram=e)}bindSamplers(e){const t=e.getPipelineContext();this._setProgram(t.program);const i=e.getSamplers();for(let t=0;t-1;if(i&&a&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||n){if(this._activateCurrentTexture(),t&&t.isMultiview)throw console.error(e,t),"_bindTextureDirectly called with a multiview texture!";this._gl.bindTexture(e,null!==(s=null===(r=null==t?void 0:t._hardwareTexture)||void 0===r?void 0:r.underlyingResource)&&void 0!==s?s:null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)}else i&&(o=!0,this._activateCurrentTexture());return a&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),o}_bindTexture(e,t,i){if(void 0===e)return;t&&(t._associatedChannel=e),this._activeChannel=e;const n=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(n,t)}unbindAllTextures(){for(let e=0;e1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))}setTexture(e,t,i,n){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))}_bindSamplerUniformToChannel(e,t){const i=this._boundUniforms[e];i&&i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)}_getTextureWrapMode(e){switch(e){case 1:return this._gl.REPEAT;case 0:return this._gl.CLAMP_TO_EDGE;case 2:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT}_setTexture(e,t,i=!1,n=!1,r=""){if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video)this._activeChannel=e,t.update();else if(4===t.delayLoadState)return t.delayLoad(),!1;let s;s=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!i&&s&&(s._associatedChannel=e);let o=!0;this._boundTexturesCache[e]===s&&(i||this._bindSamplerUniformToChannel(s._associatedChannel,e),o=!1),this._activeChannel=e;const a=this._getTextureTarget(s);if(o&&this._bindTextureDirectly(a,s,i),s&&!s.isMultiview){if(s.isCube&&s._cachedCoordinatesMode!==t.coordinatesMode){s._cachedCoordinatesMode=t.coordinatesMode;const e=3!==t.coordinatesMode&&5!==t.coordinatesMode?1:0;t.wrapU=e,t.wrapV=e}s._cachedWrapU!==t.wrapU&&(s._cachedWrapU=t.wrapU,this._setTextureParameterInteger(a,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),s)),s._cachedWrapV!==t.wrapV&&(s._cachedWrapV=t.wrapV,this._setTextureParameterInteger(a,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),s)),s.is3D&&s._cachedWrapR!==t.wrapR&&(s._cachedWrapR=t.wrapR,this._setTextureParameterInteger(a,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),s)),this._setAnisotropicLevel(a,s,t.anisotropicFilteringLevel)}return!0}setTextureArray(e,t,i,n){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===i.length||(this._textureUnits=new Int32Array(i.length));for(let t=0;t=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||this.disableAttributeByIndex(e)}releaseEffects(){for(const e in this._compiledEffects){const t=this._compiledEffects[e].getPipelineContext();this._deletePipelineContext(t)}this._compiledEffects={}}dispose(){var e;this.stopRenderLoop(),this.onBeforeTextureInitObservable&&this.onBeforeTextureInitObservable.clear(),this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.releaseEffects(),null===(e=this.releaseComputeEffects)||void 0===e||e.call(this),this.unbindAllAttributes(),this._boundUniforms={},(0,d.CG)()&&this._renderingCanvas&&(this._doNotHandleContextLost||(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored)),window.removeEventListener("resize",this._checkForMobile)),this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers.length=0,this._renderingCanvas=null,this._currentProgram=null,this._boundRenderFunction=null,r.Q.ResetCache();for(const e of this._activeRequests)e.abort();this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()}attachContextLostEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)}attachContextRestoredEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)}getError(){return this._gl.getError()}_canRenderToFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(1)}_canRenderToHalfFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(2)}_canRenderToFramebuffer(e){const t=this._gl;for(;t.getError()!==t.NO_ERROR;);let i=!0;const n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);const s=t.checkFramebufferStatus(t.FRAMEBUFFER);if(i=i&&s===t.FRAMEBUFFER_COMPLETE,i=i&&t.getError()===t.NO_ERROR,i&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i){t.bindFramebuffer(t.FRAMEBUFFER,null);const e=t.RGBA,n=t.UNSIGNED_BYTE,r=new Uint8Array(4);t.readPixels(0,0,1,1,e,n,r),i=i&&t.getError()===t.NO_ERROR}for(t.deleteTexture(n),t.deleteFramebuffer(r),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i}_getWebGLTextureType(e){if(1===this._webGLVersion){switch(e){case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT_OES;case 0:return this._gl.UNSIGNED_BYTE;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case 3:return this._gl.BYTE;case 0:return this._gl.UNSIGNED_BYTE;case 4:return this._gl.SHORT;case 5:return this._gl.UNSIGNED_SHORT;case 6:return this._gl.INT;case 7:return this._gl.UNSIGNED_INT;case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5;case 11:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case 12:return this._gl.UNSIGNED_INT_24_8;case 13:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case 14:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case 15:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE}_getInternalFormat(e,t=!1){let i=t?this._gl.SRGB8_ALPHA8:this._gl.RGBA;switch(e){case 0:i=this._gl.ALPHA;break;case 1:i=this._gl.LUMINANCE;break;case 2:i=this._gl.LUMINANCE_ALPHA;break;case 6:i=this._gl.RED;break;case 7:i=this._gl.RG;break;case 4:i=t?this._gl.SRGB:this._gl.RGB;break;case 5:i=t?this._gl.SRGB8_ALPHA8:this._gl.RGBA}if(this._webGLVersion>1)switch(e){case 8:i=this._gl.RED_INTEGER;break;case 9:i=this._gl.RG_INTEGER;break;case 10:i=this._gl.RGB_INTEGER;break;case 11:i=this._gl.RGBA_INTEGER}return i}_getRGBABufferInternalSizedFormat(e,t,i=!1){if(1===this._webGLVersion){if(void 0!==t)switch(t){case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;case 4:return i?this._gl.SRGB:this._gl.RGB}return this._gl.RGBA}switch(e){case 3:switch(t){case 6:return this._gl.R8_SNORM;case 7:return this._gl.RG8_SNORM;case 4:return this._gl.RGB8_SNORM;case 8:return this._gl.R8I;case 9:return this._gl.RG8I;case 10:return this._gl.RGB8I;case 11:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case 0:switch(t){case 6:return this._gl.R8;case 7:return this._gl.RG8;case 4:return i?this._gl.SRGB8:this._gl.RGB8;case 5:return i?this._gl.SRGB8_ALPHA8:this._gl.RGBA8;case 8:return this._gl.R8UI;case 9:return this._gl.RG8UI;case 10:return this._gl.RGB8UI;case 11:return this._gl.RGBA8UI;case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case 4:switch(t){case 8:return this._gl.R16I;case 9:return this._gl.RG16I;case 10:return this._gl.RGB16I;default:return this._gl.RGBA16I}case 5:switch(t){case 8:return this._gl.R16UI;case 9:return this._gl.RG16UI;case 10:return this._gl.RGB16UI;default:return this._gl.RGBA16UI}case 6:switch(t){case 8:return this._gl.R32I;case 9:return this._gl.RG32I;case 10:return this._gl.RGB32I;default:return this._gl.RGBA32I}case 7:switch(t){case 8:return this._gl.R32UI;case 9:return this._gl.RG32UI;case 10:return this._gl.RGB32UI;default:return this._gl.RGBA32UI}case 1:switch(t){case 6:return this._gl.R32F;case 7:return this._gl.RG32F;case 4:return this._gl.RGB32F;default:return this._gl.RGBA32F}case 2:switch(t){case 6:return this._gl.R16F;case 7:return this._gl.RG16F;case 4:return this._gl.RGB16F;default:return this._gl.RGBA16F}case 10:return this._gl.RGB565;case 13:return this._gl.R11F_G11F_B10F;case 14:return this._gl.RGB9_E5;case 8:return this._gl.RGBA4;case 9:return this._gl.RGB5_A1;case 11:switch(t){case 5:default:return this._gl.RGB10_A2;case 11:return this._gl.RGB10_A2UI}}return i?this._gl.SRGB8_ALPHA8:this._gl.RGBA8}_getRGBAMultiSampleBufferFormat(e){return 1===e?this._gl.RGBA32F:2===e?this._gl.RGBA16F:this._gl.RGBA8}_loadFile(e,t,i,n,r,s){const o=S._FileToolsLoadFile(e,t,i,n,r,s);return this._activeRequests.push(o),o.onCompleteObservable.add((e=>{this._activeRequests.splice(this._activeRequests.indexOf(e),1)})),o}static _FileToolsLoadFile(e,t,i,n,r,o){throw(0,s.S)("FileTools")}readPixels(e,t,i,n,r=!0,s=!0){const o=r?4:3,a=r?this._gl.RGBA:this._gl.RGB,l=new Uint8Array(n*i*o);return s&&this.flushFramebuffer(),this._gl.readPixels(e,t,i,n,a,this._gl.UNSIGNED_BYTE,l),Promise.resolve(l)}static get IsSupportedAsync(){return Promise.resolve(this.isSupported())}static get IsSupported(){return this.isSupported()}static isSupported(){if(null!==this._HasMajorPerformanceCaveat)return!this._HasMajorPerformanceCaveat;if(null===this._IsSupported)try{const e=this._CreateCanvas(1,1),t=e.getContext("webgl")||e.getContext("experimental-webgl");this._IsSupported=null!=t&&!!window.WebGLRenderingContext}catch(e){this._IsSupported=!1}return this._IsSupported}static get HasMajorPerformanceCaveat(){if(null===this._HasMajorPerformanceCaveat)try{const e=this._CreateCanvas(1,1),t=e.getContext("webgl",{failIfMajorPerformanceCaveat:!0})||e.getContext("experimental-webgl",{failIfMajorPerformanceCaveat:!0});this._HasMajorPerformanceCaveat=!t}catch(e){this._HasMajorPerformanceCaveat=!1}return this._HasMajorPerformanceCaveat}static CeilingPOT(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e}static FloorPOT(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)}static NearestPOT(e){const t=S.CeilingPOT(e),i=S.FloorPOT(e);return t-e>e-i?i:t}static GetExponentOfTwo(e,t,i=2){let n;switch(i){case 1:n=S.FloorPOT(e);break;case 2:n=S.NearestPOT(e);break;default:n=S.CeilingPOT(e)}return Math.min(n,t)}static QueueNewFrame(e,t){return(0,d.CG)()?(t||(t=window),t.requestPostAnimationFrame?t.requestPostAnimationFrame(e):t.requestAnimationFrame?t.requestAnimationFrame(e):window.setTimeout(e,16)):"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(e):setTimeout(e,16)}getHostDocument(){return this._renderingCanvas&&this._renderingCanvas.ownerDocument?this._renderingCanvas.ownerDocument:(0,d.n5)()?document:null}}S.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:".*AppleWebKit.*(15.4).*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]},{key:".*(15.4).*AppleWebKit.*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]}],S._TextureLoaders=[],S.CollisionsEpsilon=.001,S._IsSupported=null,S._HasMajorPerformanceCaveat=null},"../../../node_modules/@babylonjs/core/Events/clipboardEvents.js":function(e,t,i){"use strict";i.d(t,{o:function(){return r},p:function(){return n}});class n{}n.COPY=1,n.CUT=2,n.PASTE=3;class r{constructor(e,t){this.type=e,this.event=t}static GetTypeFromCharacter(e){switch(e){case 67:return n.COPY;case 86:return n.PASTE;case 88:return n.CUT;default:return-1}}}},"../../../node_modules/@babylonjs/core/Events/deviceInputEvents.js":function(e,t,i){"use strict";var n;i.d(t,{G:function(){return r}}),function(e){e[e.PointerMove=0]="PointerMove",e[e.PointerDown=1]="PointerDown",e[e.PointerUp=2]="PointerUp"}(n||(n={}));class r{}r.DOM_DELTA_PIXEL=0,r.DOM_DELTA_LINE=1,r.DOM_DELTA_PAGE=2},"../../../node_modules/@babylonjs/core/Events/keyboardEvents.js":function(e,t,i){"use strict";i.d(t,{NG:function(){return r},OG:function(){return n},WZ:function(){return s}});class n{}n.KEYDOWN=1,n.KEYUP=2;class r{constructor(e,t){this.type=e,this.event=t}}class s extends r{constructor(e,t){super(e,t),this.type=e,this.event=t,this.skipOnKeyboardObservable=!1}get skipOnPointerObservable(){return this.skipOnKeyboardObservable}set skipOnPointerObservable(e){this.skipOnKeyboardObservable=e}}},"../../../node_modules/@babylonjs/core/Events/pointerEvents.js":function(e,t,i){"use strict";i.d(t,{FV:function(){return o},R5:function(){return a},kD:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js");class r{}r.POINTERDOWN=1,r.POINTERUP=2,r.POINTERMOVE=4,r.POINTERWHEEL=8,r.POINTERPICK=16,r.POINTERTAP=32,r.POINTERDOUBLETAP=64;class s{constructor(e,t){this.type=e,this.event=t}}class o extends s{constructor(e,t,i,r){super(e,t),this.ray=null,this.originalPickingInfo=null,this.skipOnPointerObservable=!1,this.localPosition=new n.FM(i,r)}}class a extends s{constructor(e,t,i){super(e,t),this.pickInfo=i}}},"../../../node_modules/@babylonjs/core/Gizmos/gizmo.js":function(e,t,i){"use strict";i.d(t,{t:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),s=i("../../../node_modules/@babylonjs/core/Cameras/camera.js"),o=i("../../../node_modules/@babylonjs/core/Rendering/utilityLayerRenderer.js"),a=i("../../../node_modules/@babylonjs/core/Events/pointerEvents.js"),l=i("../../../node_modules/@babylonjs/core/Lights/light.js");class c{constructor(e=o.x.DefaultUtilityLayer){this.gizmoLayer=e,this._attachedMesh=null,this._attachedNode=null,this._customRotationQuaternion=null,this._scaleRatio=1,this._isHovered=!1,this._customMeshSet=!1,this._updateGizmoRotationToMatchAttachedMesh=!0,this.updateGizmoPositionToMatchAttachedMesh=!0,this.updateScale=!0,this._interactionsEnabled=!0,this._tempQuaternion=new n._f(0,0,0,1),this._tempVector=new n.P,this._tempVector2=new n.P,this._tempMatrix1=new n.y3,this._tempMatrix2=new n.y3,this._rightHandtoLeftHandMatrix=n.y3.RotationY(Math.PI),this._rootMesh=new r.Kj("gizmoRootNode",e.utilityLayerScene),this._rootMesh.rotationQuaternion=n._f.Identity(),this._beforeRenderObserver=this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add((()=>{this._update()}))}set scaleRatio(e){this._scaleRatio=e}get scaleRatio(){return this._scaleRatio}get isHovered(){return this._isHovered}get attachedMesh(){return this._attachedMesh}set attachedMesh(e){this._attachedMesh=e,e&&(this._attachedNode=e),this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)}get attachedNode(){return this._attachedNode}set attachedNode(e){this._attachedNode=e,this._attachedMesh=null,this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)}setCustomMesh(e){if(e.getScene()!=this.gizmoLayer.utilityLayerScene)throw"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)";this._rootMesh.getChildMeshes().forEach((e=>{e.dispose()})),e.parent=this._rootMesh,this._customMeshSet=!0}set updateGizmoRotationToMatchAttachedMesh(e){this._updateGizmoRotationToMatchAttachedMesh=e}get updateGizmoRotationToMatchAttachedMesh(){return this._updateGizmoRotationToMatchAttachedMesh}_attachedNodeChanged(e){}get customRotationQuaternion(){return this._customRotationQuaternion}set customRotationQuaternion(e){this._customRotationQuaternion=e}_update(){if(this.attachedNode){let e=this.attachedNode;if(this.attachedMesh&&(e=this.attachedMesh||this.attachedNode),this.updateGizmoPositionToMatchAttachedMesh){const t=e.getWorldMatrix().getRow(3),i=t?t.toVector3():new n.P(0,0,0);this._rootMesh.position.copyFrom(i)}if(this.updateGizmoRotationToMatchAttachedMesh){const t=e._isMesh||"AbstractMesh"===e.getClassName()||"TransformNode"===e.getClassName()||"InstancedMesh"===e.getClassName()?e:void 0;e.getWorldMatrix().decompose(void 0,this._rootMesh.rotationQuaternion,void 0,c.PreserveScaling?t:void 0)}else this._customRotationQuaternion?this._rootMesh.rotationQuaternion.copyFrom(this._customRotationQuaternion):this._rootMesh.rotationQuaternion.set(0,0,0,1);if(this.updateScale){const t=this.gizmoLayer.utilityLayerScene.activeCamera;let i=t.globalPosition;t.devicePosition&&(i=t.devicePosition),this._rootMesh.position.subtractToRef(i,this._tempVector);let r=this.scaleRatio;if(t.mode==s.V.ORTHOGRAPHIC_CAMERA)t.orthoTop&&t.orthoBottom&&(r*=t.orthoTop-t.orthoBottom);else{const e=t.getScene().useRightHandedSystem?n.P.RightHandedForwardReadOnly:n.P.LeftHandedForwardReadOnly,i=t.getDirection(e);r*=n.P.Dot(this._tempVector,i)}this._rootMesh.scaling.setAll(r),e._getWorldMatrixDeterminant()<0&&!c.PreserveScaling&&(this._rootMesh.scaling.y*=-1)}else this._rootMesh.scaling.setAll(this.scaleRatio)}}_handlePivot(){const e=this._attachedNode;e.isUsingPivotMatrix&&e.isUsingPivotMatrix()&&e.position&&e.getWorldMatrix().setTranslation(e.position)}_matrixChanged(){if(this._attachedNode)if(this._attachedNode._isCamera){const e=this._attachedNode;let t,i;if(e.parent){const i=this._tempMatrix2;e.parent._worldMatrix.invertToRef(i),this._attachedNode._worldMatrix.multiplyToRef(i,this._tempMatrix1),t=this._tempMatrix1}else t=this._attachedNode._worldMatrix;if(e.getScene().useRightHandedSystem?(this._rightHandtoLeftHandMatrix.multiplyToRef(t,this._tempMatrix2),i=this._tempMatrix2):i=t,i.decompose(this._tempVector2,this._tempQuaternion,this._tempVector),"FreeCamera"===this._attachedNode.getClassName()||"FlyCamera"===this._attachedNode.getClassName()||"ArcFollowCamera"===this._attachedNode.getClassName()||"TargetCamera"===this._attachedNode.getClassName()||"TouchCamera"===this._attachedNode.getClassName()||"UniversalCamera"===this._attachedNode.getClassName()){const e=this._attachedNode;e.rotation=this._tempQuaternion.toEulerAngles(),e.rotationQuaternion&&(e.rotationQuaternion.copyFrom(this._tempQuaternion),e.rotationQuaternion.normalize())}e.position.copyFrom(this._tempVector)}else if(this._attachedNode._isMesh||"AbstractMesh"===this._attachedNode.getClassName()||"TransformNode"===this._attachedNode.getClassName()||"InstancedMesh"===this._attachedNode.getClassName()){const e=this._attachedNode;if(e.parent){const t=this._tempMatrix1,i=this._tempMatrix2;e.parent.getWorldMatrix().invertToRef(t),this._attachedNode.getWorldMatrix().multiplyToRef(t,i),i.decompose(this._tempVector,this._tempQuaternion,e.position,c.PreserveScaling?e:void 0)}else this._attachedNode._worldMatrix.decompose(this._tempVector,this._tempQuaternion,e.position,c.PreserveScaling?e:void 0);e.scaling.copyFrom(this._tempVector),e.billboardMode||(e.rotationQuaternion?(e.rotationQuaternion.copyFrom(this._tempQuaternion),e.rotationQuaternion.normalize()):e.rotation=this._tempQuaternion.toEulerAngles())}else if("Bone"===this._attachedNode.getClassName()){const e=this._attachedNode,t=e.getParent();if(t){const i=this._tempMatrix1,n=this._tempMatrix2;t.getWorldMatrix().invertToRef(i),e.getWorldMatrix().multiplyToRef(i,n),e.getLocalMatrix().copyFrom(n)}else e.getLocalMatrix().copyFrom(e.getWorldMatrix());e.markAsDirty()}else{const e=this._attachedNode;if(e.getTypeID){const t=e.getTypeID();if(t===l._.LIGHTTYPEID_DIRECTIONALLIGHT||t===l._.LIGHTTYPEID_SPOTLIGHT||t===l._.LIGHTTYPEID_POINTLIGHT){const t=e.parent;if(t){const i=this._tempMatrix1,n=this._tempMatrix2;t.getWorldMatrix().invertToRef(i),e.getWorldMatrix().multiplyToRef(i,n),n.decompose(void 0,this._tempQuaternion,this._tempVector)}else this._attachedNode._worldMatrix.decompose(void 0,this._tempQuaternion,this._tempVector);e.position=new n.P(this._tempVector.x,this._tempVector.y,this._tempVector.z),e.direction&&(e.direction=new n.P(e.direction.x,e.direction.y,e.direction.z))}}}}_setGizmoMeshMaterial(e,t){e&&e.forEach((e=>{e.material=t,e.color&&(e.color=t.diffuseColor)}))}static GizmoAxisPointerObserver(e,t){let i=!1;return e.utilityLayerScene.onPointerObservable.add((e=>{var n,r;if(e.pickInfo){if(e.type===a.kD.POINTERMOVE){if(i)return;t.forEach((t=>{var i,n;if(t.colliderMeshes&&t.gizmoMeshes){const r=-1!=(null===(i=t.colliderMeshes)||void 0===i?void 0:i.indexOf(null===(n=null==e?void 0:e.pickInfo)||void 0===n?void 0:n.pickedMesh)),s=t.dragBehavior.enabled?r||t.active?t.hoverMaterial:t.material:t.disableMaterial;t.gizmoMeshes.forEach((e=>{e.material=s,e.color&&(e.color=s.diffuseColor)}))}}))}e.type===a.kD.POINTERDOWN&&t.has(null===(n=e.pickInfo.pickedMesh)||void 0===n?void 0:n.parent)&&(i=!0,t.get(null===(r=e.pickInfo.pickedMesh)||void 0===r?void 0:r.parent).active=!0,t.forEach((t=>{var i,n;const r=(-1!=(null===(i=t.colliderMeshes)||void 0===i?void 0:i.indexOf(null===(n=null==e?void 0:e.pickInfo)||void 0===n?void 0:n.pickedMesh))||t.active)&&t.dragBehavior.enabled?t.hoverMaterial:t.disableMaterial;t.gizmoMeshes.forEach((e=>{e.material=r,e.color&&(e.color=r.diffuseColor)}))}))),e.type===a.kD.POINTERUP&&t.forEach((e=>{e.active=!1,i=!1,e.gizmoMeshes.forEach((t=>{t.material=e.dragBehavior.enabled?e.material:e.disableMaterial,t.color&&(t.color=e.material.diffuseColor)}))}))}}))}dispose(){this._rootMesh.dispose(),this._beforeRenderObserver&&this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver)}}c.PreserveScaling=!1},"../../../node_modules/@babylonjs/core/Layers/layer.js":function(e,t,i){"use strict";i.d(t,{m:function(){return p}});var n=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),o=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),a=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),l=i("../../../node_modules/@babylonjs/core/Materials/material.js"),c=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),h=i("../../../node_modules/@babylonjs/core/sceneComponent.js"),_=i("../../../node_modules/@babylonjs/core/Layers/layerSceneComponent.js"),d=i("../../../node_modules/@babylonjs/core/Materials/drawWrapper.js"),u=i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js");i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js");u.v.ShadersStore.layerPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec4 color;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef LINEAR\nbaseColor.rgb=toGammaSpace(baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";u.v.ShadersStore.layerVertexShader="attribute vec2 position;\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";class p{constructor(e,t,i,l,u){this.name=e,this._applyPostProcess=!0,this.scale=new r.FM(1,1),this.offset=new r.FM(0,0),this.alphaBlendingMode=2,this.layerMask=268435455,this.renderTargetTextures=[],this.renderOnlyInRenderTargetTextures=!1,this.isEnabled=!0,this._vertexBuffers={},this.onDisposeObservable=new n.y$,this.onBeforeRenderObservable=new n.y$,this.onAfterRenderObservable=new n.y$,this.texture=t?new c.x(t,i,!0):null,this.isBackground=void 0===l||l,this.color=void 0===u?new s.HE(1,1,1,1):u,this._scene=i||o.l.LastCreatedScene;let p=this._scene._getComponent(h.l.NAME_LAYER);p||(p=new _.N(this._scene),this._scene._addComponent(p)),this._scene.layers.push(this);const f=this._scene.getEngine();this._drawWrapper=new d.q(f);const m=[];m.push(1,1),m.push(-1,1),m.push(-1,-1),m.push(1,-1);const g=new a.o(f,m,a.o.PositionKind,!1,!1,2);this._vertexBuffers[a.o.PositionKind]=g,this._createIndexBuffer()}set applyPostProcess(e){this._applyPostProcess=e}get applyPostProcess(){return this.isBackground||this._applyPostProcess}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}set onBeforeRender(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)}set onAfterRender(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)}_createIndexBuffer(){const e=this._scene.getEngine(),t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)}_rebuild(){const e=this._vertexBuffers[a.o.PositionKind];e&&e._rebuild(),this._createIndexBuffer()}render(){if(!this.isEnabled)return;const e=this._scene.getEngine();let t="";this.alphaTest&&(t="#define ALPHATEST"),this.texture&&!this.texture.gammaSpace&&(t+="\r\n#define LINEAR"),this._previousDefines!==t&&(this._previousDefines=t,this._drawWrapper.effect=e.createEffect("layer",[a.o.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],t));const i=this._drawWrapper.effect;i&&i.isReady()&&this.texture&&this.texture.isReady()&&(this.onBeforeRenderObservable.notifyObservers(this),e.enableEffect(this._drawWrapper),e.setState(!1),i.setTexture("textureSampler",this.texture),i.setMatrix("textureMatrix",this.texture.getTextureMatrix()),i.setFloat4("color",this.color.r,this.color.g,this.color.b,this.color.a),i.setVector2("offset",this.offset),i.setVector2("scale",this.scale),e.bindBuffers(this._vertexBuffers,this._indexBuffer,i),this.alphaTest?e.drawElementsType(l.F.TriangleFillMode,0,6):(e.setAlphaMode(this.alphaBlendingMode),e.drawElementsType(l.F.TriangleFillMode,0,6),e.setAlphaMode(0)),this.onAfterRenderObservable.notifyObservers(this))}dispose(){const e=this._vertexBuffers[a.o.PositionKind];e&&(e.dispose(),this._vertexBuffers[a.o.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this.texture&&(this.texture.dispose(),this.texture=null),this.renderTargetTextures=[];const t=this._scene.layers.indexOf(this);this._scene.layers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderObservable.clear()}}},"../../../node_modules/@babylonjs/core/Layers/layerSceneComponent.js":function(e,t,i){"use strict";i.d(t,{N:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/sceneComponent.js"),r=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js");class s{constructor(e){this.name=n.l.NAME_LAYER,this.scene=e||r.l.LastCreatedScene,this.scene&&(this._engine=this.scene.getEngine(),this.scene.layers=new Array)}register(){this.scene._beforeCameraDrawStage.registerStep(n.l.STEP_BEFORECAMERADRAW_LAYER,this,this._drawCameraBackground),this.scene._afterCameraDrawStage.registerStep(n.l.STEP_AFTERCAMERADRAW_LAYER,this,this._drawCameraForegroundWithPostProcessing),this.scene._afterCameraPostProcessStage.registerStep(n.l.STEP_AFTERCAMERAPOSTPROCESS_LAYER,this,this._drawCameraForegroundWithoutPostProcessing),this.scene._beforeRenderTargetDrawStage.registerStep(n.l.STEP_BEFORERENDERTARGETDRAW_LAYER,this,this._drawRenderTargetBackground),this.scene._afterRenderTargetDrawStage.registerStep(n.l.STEP_AFTERRENDERTARGETDRAW_LAYER,this,this._drawRenderTargetForegroundWithPostProcessing),this.scene._afterRenderTargetPostProcessStage.registerStep(n.l.STEP_AFTERRENDERTARGETPOSTPROCESS_LAYER,this,this._drawRenderTargetForegroundWithoutPostProcessing)}rebuild(){const e=this.scene.layers;for(const t of e)t._rebuild()}dispose(){const e=this.scene.layers;for(;e.length;)e[0].dispose()}_draw(e){const t=this.scene.layers;if(t.length){this._engine.setDepthBuffer(!1);for(const i of t)e(i)&&i.render();this._engine.setDepthBuffer(!0)}}_drawCameraPredicate(e,t,i,n){return!e.renderOnlyInRenderTargetTextures&&e.isBackground===t&&e.applyPostProcess===i&&0!=(e.layerMask&n)}_drawCameraBackground(e){this._draw((t=>this._drawCameraPredicate(t,!0,!0,e.layerMask)))}_drawCameraForegroundWithPostProcessing(e){this._draw((t=>this._drawCameraPredicate(t,!1,!0,e.layerMask)))}_drawCameraForegroundWithoutPostProcessing(e){this._draw((t=>this._drawCameraPredicate(t,!1,!1,e.layerMask)))}_drawRenderTargetPredicate(e,t,i,n,r){return e.renderTargetTextures.length>0&&e.isBackground===t&&e.applyPostProcess===i&&e.renderTargetTextures.indexOf(r)>-1&&0!=(e.layerMask&n)}_drawRenderTargetBackground(e){this._draw((t=>this._drawRenderTargetPredicate(t,!0,!0,this.scene.activeCamera.layerMask,e)))}_drawRenderTargetForegroundWithPostProcessing(e){this._draw((t=>this._drawRenderTargetPredicate(t,!1,!0,this.scene.activeCamera.layerMask,e)))}_drawRenderTargetForegroundWithoutPostProcessing(e){this._draw((t=>this._drawRenderTargetPredicate(t,!1,!1,this.scene.activeCamera.layerMask,e)))}addFromContainer(e){e.layers&&e.layers.forEach((e=>{this.scene.layers.push(e)}))}removeFromContainer(e,t=!1){e.layers&&e.layers.forEach((e=>{const i=this.scene.layers.indexOf(e);-1!==i&&this.scene.layers.splice(i,1),t&&e.dispose()}))}}},"../../../node_modules/@babylonjs/core/Lights/directionalLight.js":function(e,t,i){"use strict";i.d(t,{O:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/node.js"),a=i("../../../node_modules/@babylonjs/core/Lights/light.js"),l=i("../../../node_modules/@babylonjs/core/Lights/shadowLight.js");o.N.AddNodeConstructor("Light_Type_1",((e,t)=>()=>new c(e,s.P.Zero(),t)));class c extends l.O{constructor(e,t,i){super(e,i),this._shadowFrustumSize=0,this._shadowOrthoScale=.1,this.autoUpdateExtends=!0,this.autoCalcShadowZBounds=!1,this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE,this.position=t.scale(-1),this.direction=t}get shadowFrustumSize(){return this._shadowFrustumSize}set shadowFrustumSize(e){this._shadowFrustumSize=e,this.forceProjectionMatrixCompute()}get shadowOrthoScale(){return this._shadowOrthoScale}set shadowOrthoScale(e){this._shadowOrthoScale=e,this.forceProjectionMatrixCompute()}get orthoLeft(){return this._orthoLeft}set orthoLeft(e){this._orthoLeft=e}get orthoRight(){return this._orthoRight}set orthoRight(e){this._orthoRight=e}get orthoTop(){return this._orthoTop}set orthoTop(e){this._orthoTop=e}get orthoBottom(){return this._orthoBottom}set orthoBottom(e){this._orthoBottom=e}getClassName(){return"DirectionalLight"}getTypeID(){return a._.LIGHTTYPEID_DIRECTIONALLIGHT}_setDefaultShadowProjectionMatrix(e,t,i){this.shadowFrustumSize>0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)}_setDefaultFixedFrustumShadowProjectionMatrix(e){const t=this.getScene().activeCamera;t&&s.y3.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:t.maxZ,e,this.getScene().getEngine().isNDCHalfZRange)}_setDefaultAutoExtendShadowProjectionMatrix(e,t,i){const n=this.getScene().activeCamera;if(!n)return;if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){const e=s.P.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;let n=Number.MAX_VALUE,r=Number.MIN_VALUE;for(let o=0;othis._orthoRight&&(this._orthoRight=e.x),e.y>this._orthoTop&&(this._orthoTop=e.y),this.autoCalcShadowZBounds&&(e.zr&&(r=e.z))}this.autoCalcShadowZBounds&&(this._shadowMinZ=n,this._shadowMaxZ=r)}const r=this._orthoRight-this._orthoLeft,o=this._orthoTop-this._orthoBottom,a=void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,l=void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,c=this.getScene().getEngine().useReverseDepthBuffer;s.y3.OrthoOffCenterLHToRef(this._orthoLeft-r*this.shadowOrthoScale,this._orthoRight+r*this.shadowOrthoScale,this._orthoBottom-o*this.shadowOrthoScale,this._orthoTop+o*this.shadowOrthoScale,c?l:a,c?a:l,e,this.getScene().getEngine().isNDCHalfZRange)}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}transferToEffect(e,t){return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t),this):(this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this)}transferToNodeMaterialEffect(e,t){return this.computeTransformedInformation()?(e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z),this):(e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),this)}getDepthMinZ(e){const t=this._scene.getEngine();return!t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1}getDepthMaxZ(e){const t=this._scene.getEngine();return t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1}prepareLightSpecificDefines(e,t){e["DIRLIGHT"+t]=!0}}(0,n.gn)([(0,r.qC)()],c.prototype,"shadowFrustumSize",null),(0,n.gn)([(0,r.qC)()],c.prototype,"shadowOrthoScale",null),(0,n.gn)([(0,r.qC)()],c.prototype,"autoUpdateExtends",void 0),(0,n.gn)([(0,r.qC)()],c.prototype,"autoCalcShadowZBounds",void 0),(0,n.gn)([(0,r.qC)("orthoLeft")],c.prototype,"_orthoLeft",void 0),(0,n.gn)([(0,r.qC)("orthoRight")],c.prototype,"_orthoRight",void 0),(0,n.gn)([(0,r.qC)("orthoTop")],c.prototype,"_orthoTop",void 0),(0,n.gn)([(0,r.qC)("orthoBottom")],c.prototype,"_orthoBottom",void 0)},"../../../node_modules/@babylonjs/core/Lights/hemisphericLight.js":function(e,t,i){"use strict";i.d(t,{e:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),a=i("../../../node_modules/@babylonjs/core/node.js"),l=i("../../../node_modules/@babylonjs/core/Lights/light.js");a.N.AddNodeConstructor("Light_Type_3",((e,t)=>()=>new c(e,s.P.Zero(),t)));class c extends l._{constructor(e,t,i){super(e,i),this.groundColor=new o.Wo(0,0,0),this.direction=t||s.P.Up()}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightGround",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}getClassName(){return"HemisphericLight"}setDirectionToTarget(e){return this.direction=s.P.Normalize(e.subtract(s.P.Zero())),this.direction}getShadowGenerator(){return null}transferToEffect(e,t){const i=s.P.Normalize(this.direction);return this._uniformBuffer.updateFloat4("vLightData",i.x,i.y,i.z,0,t),this._uniformBuffer.updateColor3("vLightGround",this.groundColor.scale(this.intensity),t),this}transferToNodeMaterialEffect(e,t){const i=s.P.Normalize(this.direction);return e.setFloat3(t,i.x,i.y,i.z),this}computeWorldMatrix(){return this._worldMatrix||(this._worldMatrix=s.y3.Identity()),this._worldMatrix}getTypeID(){return l._.LIGHTTYPEID_HEMISPHERICLIGHT}prepareLightSpecificDefines(e,t){e["HEMILIGHT"+t]=!0}}(0,n.gn)([(0,r.n9)()],c.prototype,"groundColor",void 0),(0,n.gn)([(0,r.hd)()],c.prototype,"direction",void 0)},"../../../node_modules/@babylonjs/core/Lights/light.js":function(e,t,i){"use strict";i.d(t,{_:function(){return _}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),a=i("../../../node_modules/@babylonjs/core/node.js"),l=i("../../../node_modules/@babylonjs/core/Materials/uniformBuffer.js"),c=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),h=i("../../../node_modules/@babylonjs/core/Lights/lightConstants.js");class _ extends a.N{constructor(e,t){super(e,t),this.diffuse=new o.Wo(1,1,1),this.specular=new o.Wo(1,1,1),this.falloffType=_.FALLOFF_DEFAULT,this.intensity=1,this._range=Number.MAX_VALUE,this._inverseSquaredRange=0,this._photometricScale=1,this._intensityMode=_.INTENSITYMODE_AUTOMATIC,this._radius=1e-5,this.renderPriority=0,this._shadowEnabled=!0,this._excludeWithLayerMask=0,this._includeOnlyWithLayerMask=0,this._lightmapMode=0,this._excludedMeshesIds=new Array,this._includedOnlyMeshesIds=new Array,this._isLight=!0,this.getScene().addLight(this),this._uniformBuffer=new l.M(this.getScene().getEngine(),void 0,void 0,e),this._buildUniformLayout(),this.includedOnlyMeshes=new Array,this.excludedMeshes=new Array,this._resyncMeshes()}get range(){return this._range}set range(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)}get intensityMode(){return this._intensityMode}set intensityMode(e){this._intensityMode=e,this._computePhotometricScale()}get radius(){return this._radius}set radius(e){this._radius=e,this._computePhotometricScale()}get shadowEnabled(){return this._shadowEnabled}set shadowEnabled(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())}get includedOnlyMeshes(){return this._includedOnlyMeshes}set includedOnlyMeshes(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)}get excludedMeshes(){return this._excludedMeshes}set excludedMeshes(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)}get excludeWithLayerMask(){return this._excludeWithLayerMask}set excludeWithLayerMask(e){this._excludeWithLayerMask=e,this._resyncMeshes()}get includeOnlyWithLayerMask(){return this._includeOnlyWithLayerMask}set includeOnlyWithLayerMask(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()}get lightmapMode(){return this._lightmapMode}set lightmapMode(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())}transferTexturesToEffect(e,t){return this}_bindLight(e,t,i,n,r=!0){const s=e.toString();let a=!1;if(this._uniformBuffer.bindToEffect(i,"Light"+s),this._renderId!==t.getRenderId()||this._lastUseSpecular!==n||!this._uniformBuffer.useUbo){this._renderId=t.getRenderId(),this._lastUseSpecular=n;const e=this.getScaledIntensity();this.transferToEffect(i,s),this.diffuse.scaleToRef(e,o.zZ.Color3[0]),this._uniformBuffer.updateColor4("vLightDiffuse",o.zZ.Color3[0],this.range,s),n&&(this.specular.scaleToRef(e,o.zZ.Color3[1]),this._uniformBuffer.updateColor4("vLightSpecular",o.zZ.Color3[1],this.radius,s)),a=!0}if(this.transferTexturesToEffect(i,s),t.shadowsEnabled&&this.shadowEnabled&&r){const e=this.getShadowGenerator();e&&(e.bindShadowLight(s,i),a=!0)}a?this._uniformBuffer.update():this._uniformBuffer.bindUniformBuffer()}getClassName(){return"Light"}toString(e){let t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric"][this.getTypeID()],this.animations)for(let i=0;i0&&-1===this.includedOnlyMeshes.indexOf(e)||this.excludedMeshes&&this.excludedMeshes.length>0&&-1!==this.excludedMeshes.indexOf(e)||0!==this.includeOnlyWithLayerMask&&0==(this.includeOnlyWithLayerMask&e.layerMask)||0!==this.excludeWithLayerMask&&this.excludeWithLayerMask&e.layerMask))}dispose(e,t=!1){if(this._shadowGenerator&&(this._shadowGenerator.dispose(),this._shadowGenerator=null),this.getScene().stopAnimation(this),this._parentContainer){const e=this._parentContainer.lights.indexOf(this);e>-1&&this._parentContainer.lights.splice(e,1),this._parentContainer=null}for(const e of this.getScene().meshes)e._removeLightSource(this,!0);this._uniformBuffer.dispose(),this.getScene().removeLight(this),super.dispose(e,t)}getTypeID(){return 0}getScaledIntensity(){return this._photometricScale*this.intensity}clone(e,t=null){const i=_.GetConstructorFromName(this.getTypeID(),e,this.getScene());if(!i)return null;const n=r.p4.Clone(i,this);return e&&(n.name=e),t&&(n.parent=t),n.setEnabled(this.isEnabled()),this.onClonedObservable.notifyObservers(n),n}serialize(){const e=r.p4.Serialize(this);return e.uniqueId=this.uniqueId,e.type=this.getTypeID(),this.parent&&this.parent._serializeAsParent(e),this.excludedMeshes.length>0&&(e.excludedMeshesIds=[],this.excludedMeshes.forEach((t=>{e.excludedMeshesIds.push(t.id)}))),this.includedOnlyMeshes.length>0&&(e.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach((t=>{e.includedOnlyMeshesIds.push(t.id)}))),r.p4.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.isEnabled=this.isEnabled(),e}static GetConstructorFromName(e,t,i){return a.N.Construct("Light_Type_"+e,t,i)||null}static Parse(e,t){const i=_.GetConstructorFromName(e.type,e.name,t);if(!i)return null;const n=r.p4.Parse(i,e,t);if(e.excludedMeshesIds&&(n._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(n._includedOnlyMeshesIds=e.includedOnlyMeshesIds),void 0!==e.parentId&&(n._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(n._waitingParentInstanceIndex=e.parentInstanceIndex),void 0!==e.falloffType&&(n.falloffType=e.falloffType),void 0!==e.lightmapMode&&(n.lightmapMode=e.lightmapMode),e.animations){for(let t=0;t{const n=t.apply(e,i);for(const e of i)e._resyncLightSource(this);return n};const i=e.splice;e.splice=(t,n)=>{const r=i.apply(e,[t,n]);for(const e of r)e._resyncLightSource(this);return r};for(const t of e)t._resyncLightSource(this)}_hookArrayForIncludedOnly(e){const t=e.push;e.push=(...i)=>{const n=t.apply(e,i);return this._resyncMeshes(),n};const i=e.splice;e.splice=(t,n)=>{const r=i.apply(e,[t,n]);return this._resyncMeshes(),r},this._resyncMeshes()}_resyncMeshes(){for(const e of this.getScene().meshes)e._resyncLightSource(this)}_markMeshesAsLightDirty(){for(const e of this.getScene().meshes)-1!==e.lightSources.indexOf(this)&&e._markSubMeshesAsLightDirty()}_computePhotometricScale(){this._photometricScale=this._getPhotometricScale(),this.getScene().resetCachedMaterial()}_getPhotometricScale(){let e=0;const t=this.getTypeID();let i=this.intensityMode;switch(i===_.INTENSITYMODE_AUTOMATIC&&(i=t===_.LIGHTTYPEID_DIRECTIONALLIGHT?_.INTENSITYMODE_ILLUMINANCE:_.INTENSITYMODE_LUMINOUSINTENSITY),t){case _.LIGHTTYPEID_POINTLIGHT:case _.LIGHTTYPEID_SPOTLIGHT:switch(i){case _.INTENSITYMODE_LUMINOUSPOWER:e=1/(4*Math.PI);break;case _.INTENSITYMODE_LUMINOUSINTENSITY:e=1;break;case _.INTENSITYMODE_LUMINANCE:e=this.radius*this.radius}break;case _.LIGHTTYPEID_DIRECTIONALLIGHT:switch(i){case _.INTENSITYMODE_ILLUMINANCE:e=1;break;case _.INTENSITYMODE_LUMINANCE:{let t=this.radius;t=Math.max(t,.001),e=2*Math.PI*(1-Math.cos(t));break}}break;case _.LIGHTTYPEID_HEMISPHERICLIGHT:e=1}return e}_reorderLightsInScene(){const e=this.getScene();0!=this._renderPriority&&(e.requireLightSorting=!0),this.getScene().sortLightsByPriority()}}_.FALLOFF_DEFAULT=h.m.FALLOFF_DEFAULT,_.FALLOFF_PHYSICAL=h.m.FALLOFF_PHYSICAL,_.FALLOFF_GLTF=h.m.FALLOFF_GLTF,_.FALLOFF_STANDARD=h.m.FALLOFF_STANDARD,_.LIGHTMAP_DEFAULT=h.m.LIGHTMAP_DEFAULT,_.LIGHTMAP_SPECULAR=h.m.LIGHTMAP_SPECULAR,_.LIGHTMAP_SHADOWSONLY=h.m.LIGHTMAP_SHADOWSONLY,_.INTENSITYMODE_AUTOMATIC=h.m.INTENSITYMODE_AUTOMATIC,_.INTENSITYMODE_LUMINOUSPOWER=h.m.INTENSITYMODE_LUMINOUSPOWER,_.INTENSITYMODE_LUMINOUSINTENSITY=h.m.INTENSITYMODE_LUMINOUSINTENSITY,_.INTENSITYMODE_ILLUMINANCE=h.m.INTENSITYMODE_ILLUMINANCE,_.INTENSITYMODE_LUMINANCE=h.m.INTENSITYMODE_LUMINANCE,_.LIGHTTYPEID_POINTLIGHT=h.m.LIGHTTYPEID_POINTLIGHT,_.LIGHTTYPEID_DIRECTIONALLIGHT=h.m.LIGHTTYPEID_DIRECTIONALLIGHT,_.LIGHTTYPEID_SPOTLIGHT=h.m.LIGHTTYPEID_SPOTLIGHT,_.LIGHTTYPEID_HEMISPHERICLIGHT=h.m.LIGHTTYPEID_HEMISPHERICLIGHT,(0,n.gn)([(0,r.n9)()],_.prototype,"diffuse",void 0),(0,n.gn)([(0,r.n9)()],_.prototype,"specular",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"falloffType",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"intensity",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"range",null),(0,n.gn)([(0,r.qC)()],_.prototype,"intensityMode",null),(0,n.gn)([(0,r.qC)()],_.prototype,"radius",null),(0,n.gn)([(0,r.qC)()],_.prototype,"_renderPriority",void 0),(0,n.gn)([(0,r.wz)("_reorderLightsInScene")],_.prototype,"renderPriority",void 0),(0,n.gn)([(0,r.qC)("shadowEnabled")],_.prototype,"_shadowEnabled",void 0),(0,n.gn)([(0,r.qC)("excludeWithLayerMask")],_.prototype,"_excludeWithLayerMask",void 0),(0,n.gn)([(0,r.qC)("includeOnlyWithLayerMask")],_.prototype,"_includeOnlyWithLayerMask",void 0),(0,n.gn)([(0,r.qC)("lightmapMode")],_.prototype,"_lightmapMode",void 0)},"../../../node_modules/@babylonjs/core/Lights/lightConstants.js":function(e,t,i){"use strict";i.d(t,{m:function(){return n}});class n{static CompareLightsPriority(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority}}n.FALLOFF_DEFAULT=0,n.FALLOFF_PHYSICAL=1,n.FALLOFF_GLTF=2,n.FALLOFF_STANDARD=3,n.LIGHTMAP_DEFAULT=0,n.LIGHTMAP_SPECULAR=1,n.LIGHTMAP_SHADOWSONLY=2,n.INTENSITYMODE_AUTOMATIC=0,n.INTENSITYMODE_LUMINOUSPOWER=1,n.INTENSITYMODE_LUMINOUSINTENSITY=2,n.INTENSITYMODE_ILLUMINANCE=3,n.INTENSITYMODE_LUMINANCE=4,n.LIGHTTYPEID_POINTLIGHT=0,n.LIGHTTYPEID_DIRECTIONALLIGHT=1,n.LIGHTTYPEID_SPOTLIGHT=2,n.LIGHTTYPEID_HEMISPHERICLIGHT=3},"../../../node_modules/@babylonjs/core/Lights/pointLight.js":function(e,t,i){"use strict";i.d(t,{c:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/node.js"),a=i("../../../node_modules/@babylonjs/core/Lights/light.js"),l=i("../../../node_modules/@babylonjs/core/Lights/shadowLight.js");o.N.AddNodeConstructor("Light_Type_0",((e,t)=>()=>new c(e,s.P.Zero(),t)));class c extends l.O{constructor(e,t,i){super(e,i),this._shadowAngle=Math.PI/2,this.position=t}get shadowAngle(){return this._shadowAngle}set shadowAngle(e){this._shadowAngle=e,this.forceProjectionMatrixCompute()}get direction(){return this._direction}set direction(e){const t=this.needCube();this._direction=e,this.needCube()!==t&&this._shadowGenerator&&this._shadowGenerator.recreateShadowMap()}getClassName(){return"PointLight"}getTypeID(){return a._.LIGHTTYPEID_POINTLIGHT}needCube(){return!this.direction}getShadowDirection(e){if(this.direction)return super.getShadowDirection(e);switch(e){case 0:return new s.P(1,0,0);case 1:return new s.P(-1,0,0);case 2:return new s.P(0,-1,0);case 3:return new s.P(0,1,0);case 4:return new s.P(0,0,1);case 5:return new s.P(0,0,-1)}return s.P.Zero()}_setDefaultShadowProjectionMatrix(e,t,i){const n=this.getScene().activeCamera;if(!n)return;const r=void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,o=void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,a=this.getScene().getEngine().useReverseDepthBuffer;s.y3.PerspectiveFovLHToRef(this.shadowAngle,1,a?o:r,a?r:o,e,!0,this._scene.getEngine().isNDCHalfZRange,void 0,a)}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}transferToEffect(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,0,t):this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,0,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,0,0,t),this}transferToNodeMaterialEffect(e,t){return this.computeTransformedInformation()?e.setFloat3(t,this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z):e.setFloat3(t,this.position.x,this.position.y,this.position.z),this}prepareLightSpecificDefines(e,t){e["POINTLIGHT"+t]=!0}}(0,n.gn)([(0,r.qC)()],c.prototype,"shadowAngle",null)},"../../../node_modules/@babylonjs/core/Lights/shadowLight.js":function(e,t,i){"use strict";i.d(t,{O:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Lights/light.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js");class l extends o._{constructor(){super(...arguments),this._needProjectionMatrixCompute=!0}_setPosition(e){this._position=e}get position(){return this._position}set position(e){this._setPosition(e)}_setDirection(e){this._direction=e}get direction(){return this._direction}set direction(e){this._setDirection(e)}get shadowMinZ(){return this._shadowMinZ}set shadowMinZ(e){this._shadowMinZ=e,this.forceProjectionMatrixCompute()}get shadowMaxZ(){return this._shadowMaxZ}set shadowMaxZ(e){this._shadowMaxZ=e,this.forceProjectionMatrixCompute()}computeTransformedInformation(){return!(!this.parent||!this.parent.getWorldMatrix||(this.transformedPosition||(this.transformedPosition=s.P.Zero()),s.P.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),this.transformedPosition),this.direction&&(this.transformedDirection||(this.transformedDirection=s.P.Zero()),s.P.TransformNormalToRef(this.direction,this.parent.getWorldMatrix(),this.transformedDirection)),0))}getDepthScale(){return 50}getShadowDirection(e){return this.transformedDirection?this.transformedDirection:this.direction}getAbsolutePosition(){return this.transformedPosition?this.transformedPosition:this.position}setDirectionToTarget(e){return this.direction=s.P.Normalize(e.subtract(this.position)),this.direction}getRotation(){this.direction.normalize();const e=s.P.Cross(this.direction,a.RD.Y),t=s.P.Cross(e,this.direction);return s.P.RotationFromAxis(e,t,this.direction)}needCube(){return!1}needProjectionMatrixCompute(){return this._needProjectionMatrixCompute}forceProjectionMatrixCompute(){this._needProjectionMatrixCompute=!0}_initCache(){super._initCache(),this._cache.position=s.P.Zero()}_isSynchronized(){return!!this._cache.position.equals(this.position)}computeWorldMatrix(e){return!e&&this.isSynchronized()?(this._currentRenderId=this.getScene().getRenderId(),this._worldMatrix):(this._updateCache(),this._cache.position.copyFrom(this.position),this._worldMatrix||(this._worldMatrix=s.y3.Identity()),s.y3.TranslationToRef(this.position.x,this.position.y,this.position.z,this._worldMatrix),this.parent&&this.parent.getWorldMatrix&&(this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()),this._worldMatrixDeterminantIsDirty=!0,this._worldMatrix)}getDepthMinZ(e){return void 0!==this.shadowMinZ?this.shadowMinZ:e.minZ}getDepthMaxZ(e){return void 0!==this.shadowMaxZ?this.shadowMaxZ:e.maxZ}setShadowProjectionMatrix(e,t,i){return this.customProjectionMatrixBuilder?this.customProjectionMatrixBuilder(t,i,e):this._setDefaultShadowProjectionMatrix(e,t,i),this}_syncParentEnabledState(){super._syncParentEnabledState(),this.parent&&this.parent.getWorldMatrix||(this.transformedPosition=null,this.transformedDirection=null)}}(0,n.gn)([(0,r.hd)()],l.prototype,"position",null),(0,n.gn)([(0,r.hd)()],l.prototype,"direction",null),(0,n.gn)([(0,r.qC)()],l.prototype,"shadowMinZ",null),(0,n.gn)([(0,r.qC)()],l.prototype,"shadowMaxZ",null)},"../../../node_modules/@babylonjs/core/Lights/spotLight.js":function(e,t,i){"use strict";i.d(t,{P:function(){return h}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/node.js"),a=i("../../../node_modules/@babylonjs/core/Lights/light.js"),l=i("../../../node_modules/@babylonjs/core/Lights/shadowLight.js"),c=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js");o.N.AddNodeConstructor("Light_Type_2",((e,t)=>()=>new h(e,s.P.Zero(),s.P.Zero(),0,0,t)));class h extends l.O{constructor(e,t,i,n,r,o){super(e,o),this._innerAngle=0,this._projectionTextureMatrix=s.y3.Zero(),this._projectionTextureLightNear=1e-6,this._projectionTextureLightFar=1e3,this._projectionTextureUpDirection=s.P.Up(),this._projectionTextureViewLightDirty=!0,this._projectionTextureProjectionLightDirty=!0,this._projectionTextureDirty=!0,this._projectionTextureViewTargetVector=s.P.Zero(),this._projectionTextureViewLightMatrix=s.y3.Zero(),this._projectionTextureProjectionLightMatrix=s.y3.Zero(),this._projectionTextureScalingMatrix=s.y3.FromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),this.position=t,this.direction=i,this.angle=n,this.exponent=r}get angle(){return this._angle}set angle(e){this._angle=e,this._cosHalfAngle=Math.cos(.5*e),this._projectionTextureProjectionLightDirty=!0,this.forceProjectionMatrixCompute(),this._computeAngleValues()}get innerAngle(){return this._innerAngle}set innerAngle(e){this._innerAngle=e,this._computeAngleValues()}get shadowAngleScale(){return this._shadowAngleScale}set shadowAngleScale(e){this._shadowAngleScale=e,this.forceProjectionMatrixCompute()}get projectionTextureMatrix(){return this._projectionTextureMatrix}get projectionTextureLightNear(){return this._projectionTextureLightNear}set projectionTextureLightNear(e){this._projectionTextureLightNear=e,this._projectionTextureProjectionLightDirty=!0}get projectionTextureLightFar(){return this._projectionTextureLightFar}set projectionTextureLightFar(e){this._projectionTextureLightFar=e,this._projectionTextureProjectionLightDirty=!0}get projectionTextureUpDirection(){return this._projectionTextureUpDirection}set projectionTextureUpDirection(e){this._projectionTextureUpDirection=e,this._projectionTextureProjectionLightDirty=!0}get projectionTexture(){return this._projectionTexture}set projectionTexture(e){this._projectionTexture!==e&&(this._projectionTexture=e,this._projectionTextureDirty=!0,this._projectionTexture&&!this._projectionTexture.isReady()&&(h._IsProceduralTexture(this._projectionTexture)?this._projectionTexture.getEffect().executeWhenCompiled((()=>{this._markMeshesAsLightDirty()})):h._IsTexture(this._projectionTexture)&&this._projectionTexture.onLoadObservable.addOnce((()=>{this._markMeshesAsLightDirty()}))))}static _IsProceduralTexture(e){return void 0!==e.onGeneratedObservable}static _IsTexture(e){return void 0!==e.onLoadObservable}get projectionTextureProjectionLightMatrix(){return this._projectionTextureProjectionLightMatrix}set projectionTextureProjectionLightMatrix(e){this._projectionTextureProjectionLightMatrix=e,this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0}getClassName(){return"SpotLight"}getTypeID(){return a._.LIGHTTYPEID_SPOTLIGHT}_setDirection(e){super._setDirection(e),this._projectionTextureViewLightDirty=!0}_setPosition(e){super._setPosition(e),this._projectionTextureViewLightDirty=!0}_setDefaultShadowProjectionMatrix(e,t,i){const n=this.getScene().activeCamera;if(!n)return;this._shadowAngleScale=this._shadowAngleScale||1;const r=this._shadowAngleScale*this._angle,o=void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,a=void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,l=this.getScene().getEngine().useReverseDepthBuffer;s.y3.PerspectiveFovLHToRef(r,1,l?a:o,l?o:a,e,!0,this._scene.getEngine().isNDCHalfZRange,void 0,l)}_computeProjectionTextureViewLightMatrix(){this._projectionTextureViewLightDirty=!1,this._projectionTextureDirty=!0,this.position.addToRef(this.direction,this._projectionTextureViewTargetVector),s.y3.LookAtLHToRef(this.position,this._projectionTextureViewTargetVector,this._projectionTextureUpDirection,this._projectionTextureViewLightMatrix)}_computeProjectionTextureProjectionLightMatrix(){this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0;const e=this.projectionTextureLightFar,t=this.projectionTextureLightNear,i=e/(e-t),n=-i*t,r=1/Math.tan(this._angle/2);s.y3.FromValuesToRef(r/1,0,0,0,0,r,0,0,0,0,i,1,0,0,n,0,this._projectionTextureProjectionLightMatrix)}_computeProjectionTextureMatrix(){if(this._projectionTextureDirty=!1,this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix,this._projectionTextureMatrix),this._projectionTexture instanceof c.x){const e=this._projectionTexture.uScale/2,t=this._projectionTexture.vScale/2;s.y3.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,.5,0,.5,.5,.5,1,this._projectionTextureScalingMatrix)}this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix,this._projectionTextureMatrix)}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightDirection",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}_computeAngleValues(){this._lightAngleScale=1/Math.max(.001,Math.cos(.5*this._innerAngle)-this._cosHalfAngle),this._lightAngleOffset=-this._cosHalfAngle*this._lightAngleScale}transferTexturesToEffect(e,t){return this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),e.setMatrix("textureProjectionMatrix"+t,this._projectionTextureMatrix),e.setTexture("projectionLightSampler"+t,this.projectionTexture)),this}transferToEffect(e,t){let i;return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,this.exponent,t),i=s.P.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,this.exponent,t),i=s.P.Normalize(this.direction)),this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,t),this}transferToNodeMaterialEffect(e,t){let i;return i=this.computeTransformedInformation()?s.P.Normalize(this.transformedDirection):s.P.Normalize(this.direction),this.getScene().useRightHandedSystem?e.setFloat3(t,-i.x,-i.y,-i.z):e.setFloat3(t,i.x,i.y,i.z),this}dispose(){super.dispose(),this._projectionTexture&&this._projectionTexture.dispose()}getDepthMinZ(e){const t=this._scene.getEngine(),i=void 0!==this.shadowMinZ?this.shadowMinZ:e.minZ;return t.useReverseDepthBuffer&&t.isNDCHalfZRange?i:this._scene.getEngine().isNDCHalfZRange?0:i}getDepthMaxZ(e){const t=this._scene.getEngine(),i=void 0!==this.shadowMaxZ?this.shadowMaxZ:e.maxZ;return t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:i}prepareLightSpecificDefines(e,t){e["SPOTLIGHT"+t]=!0,e["PROJECTEDLIGHTTEXTURE"+t]=!(!this.projectionTexture||!this.projectionTexture.isReady())}}(0,n.gn)([(0,r.qC)()],h.prototype,"angle",null),(0,n.gn)([(0,r.qC)()],h.prototype,"innerAngle",null),(0,n.gn)([(0,r.qC)()],h.prototype,"shadowAngleScale",null),(0,n.gn)([(0,r.qC)()],h.prototype,"exponent",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"projectionTextureLightNear",null),(0,n.gn)([(0,r.qC)()],h.prototype,"projectionTextureLightFar",null),(0,n.gn)([(0,r.qC)()],h.prototype,"projectionTextureUpDirection",null),(0,n.gn)([(0,r.oU)("projectedLightTexture")],h.prototype,"_projectionTexture",void 0)},"../../../node_modules/@babylonjs/core/Loading/sceneLoader.js":function(e,t,i){"use strict";i.d(t,{n:function(){return u}});var n,r=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),s=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),o=i("../../../node_modules/@babylonjs/core/scene.js"),a=i("../../../node_modules/@babylonjs/core/Engines/engine.js"),l=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),c=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),h=i("../../../node_modules/@babylonjs/core/Loading/sceneLoaderFlags.js"),_=i("../../../node_modules/@babylonjs/core/Misc/fileTools.js"),d=i("../../../node_modules/@babylonjs/core/Misc/error.js");!function(e){e[e.Clean=0]="Clean",e[e.Stop=1]="Stop",e[e.Sync=2]="Sync",e[e.NoSync=3]="NoSync"}(n||(n={}));class u{static get ForceFullSceneLoadingForIncremental(){return h.Z.ForceFullSceneLoadingForIncremental}static set ForceFullSceneLoadingForIncremental(e){h.Z.ForceFullSceneLoadingForIncremental=e}static get ShowLoadingScreen(){return h.Z.ShowLoadingScreen}static set ShowLoadingScreen(e){h.Z.ShowLoadingScreen=e}static get loggingLevel(){return h.Z.loggingLevel}static set loggingLevel(e){h.Z.loggingLevel=e}static get CleanBoneMatrixWeights(){return h.Z.CleanBoneMatrixWeights}static set CleanBoneMatrixWeights(e){h.Z.CleanBoneMatrixWeights=e}static GetDefaultPlugin(){return u._RegisteredPlugins[".babylon"]}static _GetPluginForExtension(e){return u._RegisteredPlugins[e]||(c.Y.Warn("Unable to find a plugin to load "+e+" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes"),u.GetDefaultPlugin())}static _GetPluginForDirectLoad(e){for(const t in u._RegisteredPlugins){const i=u._RegisteredPlugins[t].plugin;if(i.canDirectLoad&&i.canDirectLoad(e))return u._RegisteredPlugins[t]}return u.GetDefaultPlugin()}static _GetPluginForFilename(e){const t=e.indexOf("?");-1!==t&&(e=e.substring(0,t));const i=e.lastIndexOf("."),n=e.substring(i,e.length).toLowerCase();return u._GetPluginForExtension(n)}static _GetDirectLoad(e){return"data:"===e.substr(0,5)?e.substr(5):null}static _FormatErrorMessage(e,t,i){let n="Unable to load from "+e.url;return t?n+=`: ${t}`:i&&(n+=`: ${i}`),n}static _LoadData(e,t,i,n,r,s,o){const l=u._GetDirectLoad(e.url),c=o?u._GetPluginForExtension(o):l?u._GetPluginForDirectLoad(e.url):u._GetPluginForFilename(e.url);let h;if(h=void 0!==c.plugin.createPlugin?c.plugin.createPlugin():c.plugin,!h)throw"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.";if(u.OnPluginActivatedObservable.notifyObservers(h),l&&(h.canDirectLoad&&h.canDirectLoad(e.url)||!(0,_.VL)(e.url))){if(h.directLoad){const e=h.directLoad(t,l);e.then?e.then((e=>{i(h,e)})).catch((e=>{r("Error in directLoad of _loadData: "+e,e)})):i(h,e)}else i(h,l);return h}const d=c.isBinary,p=(e,n)=>{t.isDisposed?r("Scene has been disposed"):i(h,e,n)};let f=null,m=!1;const g=h.onDisposeObservable;g&&g.add((()=>{m=!0,f&&(f.abort(),f=null),s()}));const b=()=>{if(m)return;const i=(e,t)=>{r(null==e?void 0:e.statusText,t)},s=e.file||e.url;f=h.loadFile?h.loadFile(t,s,p,n,d,i):t._loadFile(s,p,n,!0,d,i)},y=t.getEngine();let v=y.enableOfflineSupport;if(v){let i=!1;for(const n of t.disableOfflineSupportExceptionRules)if(n.test(e.url)){i=!0;break}v=!i}return v&&a.D.OfflineProviderFactory?t.offlineProvider=a.D.OfflineProviderFactory(e.url,b,y.disableManifestCheck):b(),h}static _GetFileInfo(e,t){let i,n,s=null;if(t)if(t.name){const e=t;i=`file:${e.name}`,n=e.name,s=e}else if("string"==typeof t&&t.startsWith("data:"))i=t,n="";else{const s=t;if("/"===s.substr(0,1))return r.w1.Error("Wrong sceneFilename parameter"),null;i=e+s,n=s}else i=e,n=r.w1.GetFilename(e),e=r.w1.GetFolderPath(e);return{url:i,rootUrl:e,name:n,file:s}}static GetPluginForExtension(e){return u._GetPluginForExtension(e).plugin}static IsPluginForExtensionAvailable(e){return!!u._RegisteredPlugins[e]}static RegisterPlugin(e){if("string"==typeof e.extensions){const t=e.extensions;u._RegisteredPlugins[t.toLowerCase()]={plugin:e,isBinary:!1}}else{const t=e.extensions;Object.keys(t).forEach((i=>{u._RegisteredPlugins[i.toLowerCase()]={plugin:e,isBinary:t[i].isBinary}}))}}static ImportMesh(e,t,i="",n=l.l.LastCreatedScene,r=null,s=null,o=null,a=null){if(!n)return c.Y.Error("No scene available to import mesh to"),null;const h=u._GetFileInfo(t,i);if(!h)return null;const _={};n.addPendingData(_);const p=()=>{n.removePendingData(_)},f=(e,t)=>{const i=u._FormatErrorMessage(h,e,t);o?o(n,i,new d.LH(i,d.SM.SceneLoaderError,t)):c.Y.Error(i),p()},m=s?e=>{try{s(e)}catch(e){f("Error in onProgress callback: "+e,e)}}:void 0,g=(e,t,i,s,o,a,l)=>{if(n.importedMeshesFiles.push(h.url),r)try{r(e,t,i,s,o,a,l)}catch(e){f("Error in onSuccess callback: "+e,e)}n.removePendingData(_)};return u._LoadData(h,n,((t,i,r)=>{if(t.rewriteRootURL&&(h.rootUrl=t.rewriteRootURL(h.rootUrl,r)),t.importMesh){const r=t,s=new Array,o=new Array,a=new Array;if(!r.importMesh(e,n,i,h.rootUrl,s,o,a,f))return;n.loadingPluginName=t.name,g(s,o,a,[],[],[],[])}else t.importMeshAsync(e,n,i,h.rootUrl,m,h.name).then((e=>{n.loadingPluginName=t.name,g(e.meshes,e.particleSystems,e.skeletons,e.animationGroups,e.transformNodes,e.geometries,e.lights)})).catch((e=>{f(e.message,e)}))}),m,f,p,a)}static ImportMeshAsync(e,t,i="",n=l.l.LastCreatedScene,r=null,s=null){return new Promise(((o,a)=>{u.ImportMesh(e,t,i,n,((e,t,i,n,r,s,a)=>{o({meshes:e,particleSystems:t,skeletons:i,animationGroups:n,transformNodes:r,geometries:s,lights:a})}),r,((e,t,i)=>{a(i||new Error(t))}),s)}))}static Load(e,t="",i=l.l.LastCreatedEngine,n=null,s=null,a=null,c=null){return i?u.Append(e,t,new o.x(i),n,s,a,c):(r.w1.Error("No engine available"),null)}static LoadAsync(e,t="",i=l.l.LastCreatedEngine,n=null,r=null){return new Promise(((s,o)=>{u.Load(e,t,i,(e=>{s(e)}),n,((e,t,i)=>{o(i||new Error(t))}),r)}))}static Append(e,t="",i=l.l.LastCreatedScene,n=null,r=null,s=null,o=null){if(!i)return c.Y.Error("No scene available to append to"),null;const a=u._GetFileInfo(e,t);if(!a)return null;const h={};i.addPendingData(h);const _=()=>{i.removePendingData(h)};u.ShowLoadingScreen&&!this._ShowingLoadingScreen&&(this._ShowingLoadingScreen=!0,i.getEngine().displayLoadingUI(),i.executeWhenReady((()=>{i.getEngine().hideLoadingUI(),this._ShowingLoadingScreen=!1})));const p=(e,t)=>{const n=u._FormatErrorMessage(a,e,t);s?s(i,n,new d.LH(n,d.SM.SceneLoaderError,t)):c.Y.Error(n),_()},f=r?e=>{try{r(e)}catch(e){p("Error in onProgress callback",e)}}:void 0,m=()=>{if(n)try{n(i)}catch(e){p("Error in onSuccess callback",e)}i.removePendingData(h)};return u._LoadData(a,i,((e,t)=>{if(e.load){if(!e.load(i,t,a.rootUrl,p))return;i.loadingPluginName=e.name,m()}else e.loadAsync(i,t,a.rootUrl,f,a.name).then((()=>{i.loadingPluginName=e.name,m()})).catch((e=>{p(e.message,e)}))}),f,p,_,o)}static AppendAsync(e,t="",i=l.l.LastCreatedScene,n=null,r=null){return new Promise(((s,o)=>{u.Append(e,t,i,(e=>{s(e)}),n,((e,t,i)=>{o(i||new Error(t))}),r)}))}static LoadAssetContainer(e,t="",i=l.l.LastCreatedScene,n=null,r=null,s=null,o=null){if(!i)return c.Y.Error("No scene available to load asset container to"),null;const a=u._GetFileInfo(e,t);if(!a)return null;const h={};i.addPendingData(h);const _=()=>{i.removePendingData(h)},p=(e,t)=>{const n=u._FormatErrorMessage(a,e,t);s?s(i,n,new d.LH(n,d.SM.SceneLoaderError,t)):c.Y.Error(n),_()},f=r?e=>{try{r(e)}catch(e){p("Error in onProgress callback",e)}}:void 0,m=e=>{if(n)try{n(e)}catch(e){p("Error in onSuccess callback",e)}i.removePendingData(h)};return u._LoadData(a,i,((e,t)=>{if(e.loadAssetContainer){const n=e.loadAssetContainer(i,t,a.rootUrl,p);if(!n)return;i.loadingPluginName=e.name,m(n)}else e.loadAssetContainerAsync?e.loadAssetContainerAsync(i,t,a.rootUrl,f,a.name).then((t=>{i.loadingPluginName=e.name,m(t)})).catch((e=>{p(e.message,e)})):p("LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.")}),f,p,_,o)}static LoadAssetContainerAsync(e,t="",i=l.l.LastCreatedScene,n=null,r=null){return new Promise(((s,o)=>{u.LoadAssetContainer(e,t,i,(e=>{s(e)}),n,((e,t,i)=>{o(i||new Error(t))}),r)}))}static ImportAnimations(e,t="",i=l.l.LastCreatedScene,r=!0,s=n.Clean,o=null,a=null,h=null,_=null,d=null){if(!i)return void c.Y.Error("No scene available to load animations to");if(r){for(const e of i.animatables)e.reset();i.stopAllAnimations(),i.animationGroups.slice().forEach((e=>{e.dispose()})),i.getNodes().forEach((e=>{e.animations&&(e.animations=[])}))}else switch(s){case n.Clean:i.animationGroups.slice().forEach((e=>{e.dispose()}));break;case n.Stop:i.animationGroups.forEach((e=>{e.stop()}));break;case n.Sync:i.animationGroups.forEach((e=>{e.reset(),e.restart()}));break;case n.NoSync:break;default:return void c.Y.Error("Unknown animation group loading mode value '"+s+"'")}const u=i.animatables.length;this.LoadAssetContainer(e,t,i,(e=>{e.mergeAnimationsTo(i,i.animatables.slice(u),o),e.dispose(),i.onAnimationFileImportedObservable.notifyObservers(i),a&&a(i)}),h,_,d)}static ImportAnimationsAsync(e,t="",i=l.l.LastCreatedScene,r=!0,s=n.Clean,o=null,a=null,c=null,h=null,_=null){return new Promise(((n,a)=>{u.ImportAnimations(e,t,i,r,s,o,(e=>{n(e)}),c,((e,t,i)=>{a(i||new Error(t))}),_)}))}}u.NO_LOGGING=0,u.MINIMAL_LOGGING=1,u.SUMMARY_LOGGING=2,u.DETAILED_LOGGING=3,u.OnPluginActivatedObservable=new s.y$,u._RegisteredPlugins={},u._ShowingLoadingScreen=!1},"../../../node_modules/@babylonjs/core/Loading/sceneLoaderFlags.js":function(e,t,i){"use strict";i.d(t,{Z:function(){return n}});class n{static get ForceFullSceneLoadingForIncremental(){return n._ForceFullSceneLoadingForIncremental}static set ForceFullSceneLoadingForIncremental(e){n._ForceFullSceneLoadingForIncremental=e}static get ShowLoadingScreen(){return n._ShowLoadingScreen}static set ShowLoadingScreen(e){n._ShowLoadingScreen=e}static get loggingLevel(){return n._LoggingLevel}static set loggingLevel(e){n._LoggingLevel=e}static get CleanBoneMatrixWeights(){return n._CleanBoneMatrixWeights}static set CleanBoneMatrixWeights(e){n._CleanBoneMatrixWeights=e}}n._ForceFullSceneLoadingForIncremental=!1,n._ShowLoadingScreen=!0,n._CleanBoneMatrixWeights=!1,n._LoggingLevel=0},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Dual/currentScreenBlock.js":function(e,t,i){"use strict";i.d(t,{K:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),a=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js");class l extends n.k{constructor(e){super(e,s.u.VertexAndFragment),this._samplerName="textureSampler",this.convertToGammaSpace=!1,this.convertToLinearSpace=!1,this._isUnique=!1,this.registerInput("uv",r.E.Vector2,!1,s.u.VertexAndFragment),this.registerOutput("rgba",r.E.Color4,s.u.Neutral),this.registerOutput("rgb",r.E.Color3,s.u.Neutral),this.registerOutput("r",r.E.Float,s.u.Neutral),this.registerOutput("g",r.E.Float,s.u.Neutral),this.registerOutput("b",r.E.Float,s.u.Neutral),this.registerOutput("a",r.E.Float,s.u.Neutral),this._inputs[0].acceptedConnectionPointTypes.push(r.E.Vector3),this._inputs[0].acceptedConnectionPointTypes.push(r.E.Vector4),this._inputs[0]._prioritizeVertex=!1}getClassName(){return"CurrentScreenBlock"}get uv(){return this._inputs[0]}get rgba(){return this._outputs[0]}get rgb(){return this._outputs[1]}get r(){return this._outputs[2]}get g(){return this._outputs[3]}get b(){return this._outputs[4]}get a(){return this._outputs[5]}initialize(e){e._excludeVariableName("textureSampler")}get target(){return this.uv.isConnected?this.uv.sourceBlock.isInput?s.u.VertexAndFragment:s.u.Fragment:s.u.VertexAndFragment}prepareDefines(e,t,i){i.setValue(this._linearDefineName,this.convertToGammaSpace,!0),i.setValue(this._gammaDefineName,this.convertToLinearSpace,!0)}isReady(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())}_injectVertexCode(e){const t=this.uv;if(t.connectedPoint.ownerBlock.isInput&&(t.connectedPoint.ownerBlock.isAttribute||e._emitUniformFromString(t.associatedVariableName,"vec2")),this._mainUVName="vMain"+t.associatedVariableName,e._emitVaryingFromString(this._mainUVName,"vec2"),e.compilationString+=`${this._mainUVName} = ${t.associatedVariableName}.xy;\r\n`,this._outputs.some((e=>e.isConnectedInVertexShader))){this._writeTextureRead(e,!0);for(const t of this._outputs)t.hasEndpoints&&this._writeOutput(e,t,t.name,!0)}}_writeTextureRead(e,t=!1){const i=this.uv;if(t){if(e.target===s.u.Fragment)return;e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${this._samplerName}, ${i.associatedVariableName});\r\n`}else this.uv.ownerBlock.target!==s.u.Fragment?e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${this._samplerName}, ${this._mainUVName});\r\n`:e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${this._samplerName}, ${i.associatedVariableName});\r\n`}_writeOutput(e,t,i,n=!1){if(n){if(e.target===s.u.Fragment)return;e.compilationString+=`${this._declareOutput(t,e)} = ${this._tempTextureRead}.${i};\r\n`}else this.uv.ownerBlock.target!==s.u.Fragment?(e.compilationString+=`${this._declareOutput(t,e)} = ${this._tempTextureRead}.${i};\r\n`,e.compilationString+=`#ifdef ${this._linearDefineName}\r\n`,e.compilationString+=`${t.associatedVariableName} = toGammaSpace(${t.associatedVariableName});\r\n`,e.compilationString+="#endif\r\n",e.compilationString+=`#ifdef ${this._gammaDefineName}\r\n`,e.compilationString+=`${t.associatedVariableName} = toLinearSpace(${t.associatedVariableName});\r\n`,e.compilationString+="#endif\r\n"):e.compilationString+=`${this._declareOutput(t,e)} = ${this._tempTextureRead}.${i};\r\n`}_buildBlock(e){if(super._buildBlock(e),this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),e.sharedData.blockingBlocks.indexOf(this)<0&&e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.indexOf(this)<0&&e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.indexOf(this)<0&&e.sharedData.blocksWithDefines.push(this),e.target!==s.u.Fragment)return e._emit2DSampler(this._samplerName),void this._injectVertexCode(e);if(!this._outputs.some((e=>e.isConnectedInFragmentShader)))return;e._emit2DSampler(this._samplerName),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA");const t=`//${this.name}`;e._emitFunctionFromInclude("helperFunctions",t),this._writeTextureRead(e);for(const t of this._outputs)t.hasEndpoints&&this._writeOutput(e,t,t.name);return this}serialize(){const e=super.serialize();return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,this.texture&&!this.texture.isRenderTarget&&(e.texture=this.texture.serialize()),e}_deserialize(e,t,i){super._deserialize(e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=a.x.Parse(e.texture,t,i))}}(0,o.H)("BABYLON.CurrentScreenBlock",l)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js":function(e,t,i){"use strict";i.d(t,{g:function(){return h}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),o=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),l=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialDecorator.js"),c=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js");class h extends r.k{constructor(e){super(e,o.u.Fragment,!0),this.convertToGammaSpace=!1,this.convertToLinearSpace=!1,this.useLogarithmicDepth=!1,this.registerInput("rgba",s.E.Color4,!0),this.registerInput("rgb",s.E.Color3,!0),this.registerInput("a",s.E.Float,!0),this.rgb.acceptedConnectionPointTypes.push(s.E.Float)}getClassName(){return"FragmentOutputBlock"}initialize(e){e._excludeVariableName("logarithmicDepthConstant"),e._excludeVariableName("vFragmentDepth")}get rgba(){return this._inputs[0]}get rgb(){return this._inputs[1]}get a(){return this._inputs[2]}prepareDefines(e,t,i){i.setValue(this._linearDefineName,this.convertToLinearSpace,!0),i.setValue(this._gammaDefineName,this.convertToGammaSpace,!0)}bind(e,t,i){this.useLogarithmicDepth&&i&&c.G.BindLogDepth(void 0,e,i.getScene())}_buildBlock(e){super._buildBlock(e);const t=this.rgba,i=this.rgb,n=this.a;e.sharedData.hints.needAlphaBlending=t.isConnected||n.isConnected,e.sharedData.blocksWithDefines.push(this),this.useLogarithmicDepth&&(e._emitUniformFromString("logarithmicDepthConstant","float"),e._emitVaryingFromString("vFragmentDepth","float"),e.sharedData.bindableBlocks.push(this)),this._linearDefineName=e._getFreeDefineName("CONVERTTOLINEAR"),this._gammaDefineName=e._getFreeDefineName("CONVERTTOGAMMA");const r=`//${this.name}`;if(e._emitFunctionFromInclude("helperFunctions",r),t.connectedPoint)n.isConnected?e.compilationString+=`gl_FragColor = vec4(${t.associatedVariableName}.rgb, ${n.associatedVariableName});\r\n`:e.compilationString+=`gl_FragColor = ${t.associatedVariableName};\r\n`;else if(i.connectedPoint){let t="1.0";n.connectedPoint&&(t=n.associatedVariableName),i.connectedPoint.type===s.E.Float?e.compilationString+=`gl_FragColor = vec4(${i.associatedVariableName}, ${i.associatedVariableName}, ${i.associatedVariableName}, ${t});\r\n`:e.compilationString+=`gl_FragColor = vec4(${i.associatedVariableName}, ${t});\r\n`}else e.sharedData.checks.notConnectedNonOptionalInputs.push(t);return e.compilationString+=`#ifdef ${this._linearDefineName}\r\n`,e.compilationString+="gl_FragColor = toLinearSpace(gl_FragColor);\r\n",e.compilationString+="#endif\r\n",e.compilationString+=`#ifdef ${this._gammaDefineName}\r\n`,e.compilationString+="gl_FragColor = toGammaSpace(gl_FragColor);\r\n",e.compilationString+="#endif\r\n",this.useLogarithmicDepth&&(e.compilationString+="gl_FragDepthEXT = log2(vFragmentDepth) * logarithmicDepthConstant * 0.5;\r\n"),this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode();return e+=`${this._codeVariableName}.convertToGammaSpace = ${this.convertToGammaSpace};\r\n`,e+=`${this._codeVariableName}.convertToLinearSpace = ${this.convertToLinearSpace};\r\n`,e+=`${this._codeVariableName}.useLogarithmicDepth = ${this.useLogarithmicDepth};\r\n`,e}serialize(){const e=super.serialize();return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,e.useLogarithmicDepth=this.useLogarithmicDepth,e}_deserialize(e,t,i){var n;super._deserialize(e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=e.convertToLinearSpace,this.useLogarithmicDepth=null!==(n=e.useLogarithmicDepth)&&void 0!==n&&n}}(0,n.gn)([(0,l.p)("Convert to gamma space",l.U.Boolean,"PROPERTIES",{notifiers:{update:!0}})],h.prototype,"convertToGammaSpace",void 0),(0,n.gn)([(0,l.p)("Convert to linear space",l.U.Boolean,"PROPERTIES",{notifiers:{update:!0}})],h.prototype,"convertToLinearSpace",void 0),(0,n.gn)([(0,l.p)("Use logarithmic depth",l.U.Boolean,"PROPERTIES")],h.prototype,"useLogarithmicDepth",void 0),(0,a.H)("BABYLON.FragmentOutputBlock",h)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Input/animatedInputBlockTypes.js":function(e,t,i){"use strict";var n;i.d(t,{c:function(){return n}}),function(e){e[e.None=0]="None",e[e.Time=1]="Time"}(n||(n={}))},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Input/inputBlock.js":function(e,t,i){"use strict";i.d(t,{S:function(){return m}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.js"),o=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialSystemValues.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),l=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),c=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),h=i("../../../node_modules/@babylonjs/core/Maths/math.js"),_=i("../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Input/animatedInputBlockTypes.js"),d=i("../../../node_modules/@babylonjs/core/Misc/observable.js");const u={position2d:"position",particle_uv:"vUV",particle_color:"vColor",particle_texturemask:"textureMask",particle_positionw:"vPositionW"},p={particle_uv:!0,particle_color:!0,particle_texturemask:!0,particle_positionw:!0},f={particle_texturemask:!0};class m extends n.k{constructor(e,t=l.u.Vertex,i=r.E.AutoDetect){super(e,t,!1,!0),this._mode=s.M.Undefined,this._animationType=_.c.None,this.min=0,this.max=0,this.isBoolean=!1,this.matrixMode=0,this._systemValue=null,this.isConstant=!1,this.groupInInspector="",this.onValueChangedObservable=new d.y$,this.convertToGammaSpace=!1,this.convertToLinearSpace=!1,this._type=i,this.setDefaultValue(),this.registerOutput("output",i)}get type(){if(this._type===r.E.AutoDetect){if(this.isUniform&&null!=this.value){if(!isNaN(this.value))return this._type=r.E.Float,this._type;switch(this.value.getClassName()){case"Vector2":return this._type=r.E.Vector2,this._type;case"Vector3":return this._type=r.E.Vector3,this._type;case"Vector4":return this._type=r.E.Vector4,this._type;case"Color3":return this._type=r.E.Color3,this._type;case"Color4":return this._type=r.E.Color4,this._type;case"Matrix":return this._type=r.E.Matrix,this._type}}if(this.isAttribute)switch(this.name){case"position":case"normal":case"particle_positionw":return this._type=r.E.Vector3,this._type;case"uv":case"uv2":case"uv3":case"uv4":case"uv5":case"uv6":case"position2d":case"particle_uv":return this._type=r.E.Vector2,this._type;case"matricesIndices":case"matricesWeights":case"world0":case"world1":case"world2":case"world3":case"tangent":return this._type=r.E.Vector4,this._type;case"color":case"instanceColor":case"particle_color":case"particle_texturemask":return this._type=r.E.Color4,this._type}if(this.isSystemValue)switch(this._systemValue){case o.$.World:case o.$.WorldView:case o.$.WorldViewProjection:case o.$.View:case o.$.ViewProjection:case o.$.Projection:return this._type=r.E.Matrix,this._type;case o.$.CameraPosition:return this._type=r.E.Vector3,this._type;case o.$.FogColor:return this._type=r.E.Color3,this._type;case o.$.DeltaTime:case o.$.MaterialAlpha:return this._type=r.E.Float,this._type;case o.$.CameraParameters:return this._type=r.E.Vector4,this._type}}return this._type}validateBlockName(e){return!!this.isAttribute||super.validateBlockName(e)}get output(){return this._outputs[0]}setAsAttribute(e){return this._mode=s.M.Attribute,e&&(this.name=e),this}setAsSystemValue(e){return this.systemValue=e,this}get value(){return this._storedValue}set value(e){this.type===r.E.Float&&(this.isBoolean?e=e?1:0:this.min!==this.max&&(e=Math.max(this.min,e),e=Math.min(this.max,e))),this._storedValue=e,this._mode=s.M.Uniform,this.onValueChangedObservable.notifyObservers(this)}get valueCallback(){return this._valueCallback}set valueCallback(e){this._valueCallback=e,this._mode=s.M.Uniform}get associatedVariableName(){return this._associatedVariableName}set associatedVariableName(e){this._associatedVariableName=e}get animationType(){return this._animationType}set animationType(e){this._animationType=e}get isUndefined(){return this._mode===s.M.Undefined}get isUniform(){return this._mode===s.M.Uniform}set isUniform(e){this._mode=e?s.M.Uniform:s.M.Undefined,this.associatedVariableName=""}get isAttribute(){return this._mode===s.M.Attribute}set isAttribute(e){this._mode=e?s.M.Attribute:s.M.Undefined,this.associatedVariableName=""}get isVarying(){return this._mode===s.M.Varying}set isVarying(e){this._mode=e?s.M.Varying:s.M.Undefined,this.associatedVariableName=""}get isSystemValue(){return null!=this._systemValue}get systemValue(){return this._systemValue}set systemValue(e){this._mode=s.M.Uniform,this.associatedVariableName="",this._systemValue=e}getClassName(){return"InputBlock"}animate(e){this._animationType===_.c.Time&&this.type===r.E.Float&&(this.value+=.01*e.getAnimationRatio())}_emitDefine(e){return"!"===e[0]?`#ifndef ${e.substring(1)}\r\n`:`#ifdef ${e}\r\n`}initialize(){this.associatedVariableName=""}setDefaultValue(){switch(this.type){case r.E.Float:this.value=0;break;case r.E.Vector2:this.value=a.FM.Zero();break;case r.E.Vector3:this.value=a.P.Zero();break;case r.E.Vector4:this.value=a.Lt.Zero();break;case r.E.Color3:this.value=h.Wo.White();break;case r.E.Color4:this.value=new h.HE(1,1,1,1);break;case r.E.Matrix:this.value=a.y3.Identity()}}_emitConstant(e){switch(this.type){case r.E.Float:return`${e._emitFloat(this.value)}`;case r.E.Vector2:return`vec2(${this.value.x}, ${this.value.y})`;case r.E.Vector3:return`vec3(${this.value.x}, ${this.value.y}, ${this.value.z})`;case r.E.Vector4:return`vec4(${this.value.x}, ${this.value.y}, ${this.value.z}, ${this.value.w})`;case r.E.Color3:return h.zZ.Color3[0].set(this.value.r,this.value.g,this.value.b),this.convertToGammaSpace&&h.zZ.Color3[0].toGammaSpaceToRef(h.zZ.Color3[0]),this.convertToLinearSpace&&h.zZ.Color3[0].toLinearSpaceToRef(h.zZ.Color3[0]),`vec3(${h.zZ.Color3[0].r}, ${h.zZ.Color3[0].g}, ${h.zZ.Color3[0].b})`;case r.E.Color4:return h.zZ.Color4[0].set(this.value.r,this.value.g,this.value.b,this.value.a),this.convertToGammaSpace&&h.zZ.Color4[0].toGammaSpaceToRef(h.zZ.Color4[0]),this.convertToLinearSpace&&h.zZ.Color4[0].toLinearSpaceToRef(h.zZ.Color4[0]),`vec4(${h.zZ.Color4[0].r}, ${h.zZ.Color4[0].g}, ${h.zZ.Color4[0].b}, ${h.zZ.Color4[0].a})`}return""}get _noContextSwitch(){return p[this.name]}_emit(e,t){var i;if(this.isUniform){if(this.associatedVariableName||(this.associatedVariableName=e._getFreeVariableName("u_"+this.name)),this.isConstant){if(-1!==e.constants.indexOf(this.associatedVariableName))return;return e.constants.push(this.associatedVariableName),void(e._constantDeclaration+=this._declareOutput(this.output,e)+` = ${this._emitConstant(e)};\r\n`)}if(-1!==e.uniforms.indexOf(this.associatedVariableName))return;e.uniforms.push(this.associatedVariableName),t&&(e._uniformDeclaration+=this._emitDefine(t)),e._uniformDeclaration+=`uniform ${e._getGLType(this.type)} ${this.associatedVariableName};\r\n`,t&&(e._uniformDeclaration+="#endif\r\n");const i=e.sharedData.hints;if(null!==this._systemValue&&void 0!==this._systemValue)switch(this._systemValue){case o.$.WorldView:i.needWorldViewMatrix=!0;break;case o.$.WorldViewProjection:i.needWorldViewProjectionMatrix=!0}else this._animationType!==_.c.None&&e.sharedData.animatedInputs.push(this)}else if(this.isAttribute){if(this.associatedVariableName=null!==(i=u[this.name])&&void 0!==i?i:this.name,this.target===l.u.Vertex&&e._vertexState)return void(p[this.name]?f[this.name]?e._emitUniformFromString(this.associatedVariableName,e._getGLType(this.type),t):e._emitVaryingFromString(this.associatedVariableName,e._getGLType(this.type),t):this._emit(e._vertexState,t));if(-1!==e.attributes.indexOf(this.associatedVariableName))return;e.attributes.push(this.associatedVariableName),p[this.name]?f[this.name]?e._emitUniformFromString(this.associatedVariableName,e._getGLType(this.type),t):e._emitVaryingFromString(this.associatedVariableName,e._getGLType(this.type),t):(t&&(e._attributeDeclaration+=this._emitDefine(t)),e._attributeDeclaration+=`attribute ${e._getGLType(this.type)} ${this.associatedVariableName};\r\n`,t&&(e._attributeDeclaration+="#endif\r\n"))}}_transmitWorld(e,t,i,n){if(!this._systemValue)return;const r=this.associatedVariableName;switch(this._systemValue){case o.$.World:e.setMatrix(r,t);break;case o.$.WorldView:e.setMatrix(r,i);break;case o.$.WorldViewProjection:e.setMatrix(r,n)}}_transmit(e,t,i){if(this.isAttribute)return;const n=this.associatedVariableName;if(this._systemValue){switch(this._systemValue){case o.$.World:case o.$.WorldView:case o.$.WorldViewProjection:return;case o.$.View:e.setMatrix(n,t.getViewMatrix());break;case o.$.Projection:e.setMatrix(n,t.getProjectionMatrix());break;case o.$.ViewProjection:e.setMatrix(n,t.getTransformMatrix());break;case o.$.CameraPosition:t.bindEyePosition(e,n,!0);break;case o.$.FogColor:e.setColor3(n,t.fogColor);break;case o.$.DeltaTime:e.setFloat(n,t.deltaTime/1e3);break;case o.$.CameraParameters:t.activeCamera&&e.setFloat4(n,t.getEngine().hasOriginBottomLeft?-1:1,t.activeCamera.minZ,t.activeCamera.maxZ,1/t.activeCamera.maxZ);break;case o.$.MaterialAlpha:e.setFloat(n,i.alpha)}return}const s=this._valueCallback?this._valueCallback():this._storedValue;if(null!==s)switch(this.type){case r.E.Float:e.setFloat(n,s);break;case r.E.Int:e.setInt(n,s);break;case r.E.Color3:h.zZ.Color3[0].set(this.value.r,this.value.g,this.value.b),this.convertToGammaSpace&&h.zZ.Color3[0].toGammaSpaceToRef(h.zZ.Color3[0]),this.convertToLinearSpace&&h.zZ.Color3[0].toLinearSpaceToRef(h.zZ.Color3[0]),e.setColor3(n,h.zZ.Color3[0]);break;case r.E.Color4:h.zZ.Color4[0].set(this.value.r,this.value.g,this.value.b,this.value.a),this.convertToGammaSpace&&h.zZ.Color4[0].toGammaSpaceToRef(h.zZ.Color4[0]),this.convertToLinearSpace&&h.zZ.Color4[0].toLinearSpaceToRef(h.zZ.Color4[0]),e.setDirectColor4(n,h.zZ.Color4[0]);break;case r.E.Vector2:e.setVector2(n,s);break;case r.E.Vector3:e.setVector3(n,s);break;case r.E.Vector4:e.setVector4(n,s);break;case r.E.Matrix:e.setMatrix(n,s)}}_buildBlock(e){super._buildBlock(e),(this.isUniform||this.isSystemValue)&&e.sharedData.inputBlocks.push(this),this._emit(e)}_dumpPropertiesCode(){const e=this._codeVariableName;if(this.isAttribute)return super._dumpPropertiesCode()+`${e}.setAsAttribute("${this.name}");\r\n`;if(this.isSystemValue)return super._dumpPropertiesCode()+`${e}.setAsSystemValue(BABYLON.NodeMaterialSystemValues.${o.$[this._systemValue]});\r\n`;if(this.isUniform){const t=[];let i="";switch(this.type){case r.E.Float:i=`${this.value}`;break;case r.E.Vector2:i=`new BABYLON.Vector2(${this.value.x}, ${this.value.y})`;break;case r.E.Vector3:i=`new BABYLON.Vector3(${this.value.x}, ${this.value.y}, ${this.value.z})`;break;case r.E.Vector4:i=`new BABYLON.Vector4(${this.value.x}, ${this.value.y}, ${this.value.z}, ${this.value.w})`;break;case r.E.Color3:i=`new BABYLON.Color3(${this.value.r}, ${this.value.g}, ${this.value.b})`,this.convertToGammaSpace&&(i+=".toGammaSpace()"),this.convertToLinearSpace&&(i+=".toLinearSpace()");break;case r.E.Color4:i=`new BABYLON.Color4(${this.value.r}, ${this.value.g}, ${this.value.b}, ${this.value.a})`,this.convertToGammaSpace&&(i+=".toGammaSpace()"),this.convertToLinearSpace&&(i+=".toLinearSpace()");break;case r.E.Matrix:i=`BABYLON.Matrix.FromArray([${this.value.m}])`}return t.push(`${e}.value = ${i}`),this.type===r.E.Float&&t.push(`${e}.min = ${this.min}`,`${e}.max = ${this.max}`,`${e}.isBoolean = ${this.isBoolean}`,`${e}.matrixMode = ${this.matrixMode}`,`${e}.animationType = BABYLON.AnimatedInputBlockTypes.${_.c[this.animationType]}`),t.push(`${e}.isConstant = ${this.isConstant}`),t.push(""),super._dumpPropertiesCode()+t.join(";\r\n")}return super._dumpPropertiesCode()}dispose(){this.onValueChangedObservable.clear(),super.dispose()}serialize(){const e=super.serialize();return e.type=this.type,e.mode=this._mode,e.systemValue=this._systemValue,e.animationType=this._animationType,e.min=this.min,e.max=this.max,e.isBoolean=this.isBoolean,e.matrixMode=this.matrixMode,e.isConstant=this.isConstant,e.groupInInspector=this.groupInInspector,e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,null!=this._storedValue&&this._mode===s.M.Uniform&&(this._storedValue.asArray?(e.valueType="BABYLON."+this._storedValue.getClassName(),e.value=this._storedValue.asArray()):(e.valueType="number",e.value=this._storedValue)),e}_deserialize(e,t,i){if(this._mode=e.mode,super._deserialize(e,t,i),this._type=e.type,this._systemValue=e.systemValue||e.wellKnownValue,this._animationType=e.animationType,this.min=e.min||0,this.max=e.max||0,this.isBoolean=!!e.isBoolean,this.matrixMode=e.matrixMode||0,this.isConstant=!!e.isConstant,this.groupInInspector=e.groupInInspector||"",this.convertToGammaSpace=!!e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,"tangent"===e.name&&e.mode===s.M.Attribute&&e.type===r.E.Vector3&&(this._type=r.E.Vector4),e.valueType)if("number"===e.valueType)this._storedValue=e.value;else{const t=(0,c.q)(e.valueType);t&&(this._storedValue=t.FromArray(e.value))}}}(0,c.H)("BABYLON.InputBlock",m)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js":function(e,t,i){"use strict";i.d(t,{D:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class a extends n.k{constructor(e){super(e,s.u.Fragment),this._isUnique=!0,this.registerInput("color",r.E.Color4,!1,s.u.Fragment),this.registerInput("alphaTexture",r.E.Float,!1,s.u.Fragment),this.registerInput("alphaColor",r.E.Float,!1,s.u.Fragment),this.registerOutput("blendColor",r.E.Color4,s.u.Fragment)}getClassName(){return"ParticleBlendMultiplyBlock"}get color(){return this._inputs[0]}get alphaTexture(){return this._inputs[1]}get alphaColor(){return this._inputs[2]}get blendColor(){return this._outputs[0]}initialize(e){e._excludeVariableName("sourceAlpha")}_buildBlock(e){if(super._buildBlock(e),e.target!==s.u.Vertex)return e.compilationString+=`\n #ifdef BLENDMULTIPLYMODE\n ${this._declareOutput(this.blendColor,e)};\n float sourceAlpha = ${this.alphaColor.associatedVariableName} * ${this.alphaTexture.associatedVariableName};\n ${this.blendColor.associatedVariableName}.rgb = ${this.color.associatedVariableName}.rgb * sourceAlpha + vec3(1.0) * (1.0 - sourceAlpha);\n ${this.blendColor.associatedVariableName}.a = ${this.color.associatedVariableName}.a;\n #else\n ${this._declareOutput(this.blendColor,e)} = ${this.color.associatedVariableName};\n #endif\n `,this}}(0,o.H)("BABYLON.ParticleBlendMultiplyBlock",a)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Particle/particleRampGradientBlock.js":function(e,t,i){"use strict";i.d(t,{p:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class a extends n.k{constructor(e){super(e,s.u.Fragment),this._isUnique=!0,this.registerInput("color",r.E.Color4,!1,s.u.Fragment),this.registerOutput("rampColor",r.E.Color4,s.u.Fragment)}getClassName(){return"ParticleRampGradientBlock"}get color(){return this._inputs[0]}get rampColor(){return this._outputs[0]}initialize(e){e._excludeVariableName("remapRanges"),e._excludeVariableName("rampSampler"),e._excludeVariableName("baseColor"),e._excludeVariableName("alpha"),e._excludeVariableName("remappedColorIndex"),e._excludeVariableName("rampColor"),e._excludeVariableName("finalAlpha")}_buildBlock(e){if(super._buildBlock(e),e.target!==s.u.Vertex)return e._emit2DSampler("rampSampler"),e._emitVaryingFromString("remapRanges","vec4","RAMPGRADIENT"),e.compilationString+=`\n #ifdef RAMPGRADIENT\n vec4 baseColor = ${this.color.associatedVariableName};\n float alpha = ${this.color.associatedVariableName}.a;\n\n float remappedColorIndex = clamp((alpha - remapRanges.x) / remapRanges.y, 0.0, 1.0);\n\n vec4 rampColor = texture2D(rampSampler, vec2(1.0 - remappedColorIndex, 0.));\n baseColor.rgb *= rampColor.rgb;\n\n // Remapped alpha\n float finalAlpha = baseColor.a;\n baseColor.a = clamp((alpha * rampColor.a - remapRanges.z) / remapRanges.w, 0.0, 1.0);\n\n ${this._declareOutput(this.rampColor,e)} = baseColor;\n #else\n ${this._declareOutput(this.rampColor,e)} = ${this.color.associatedVariableName};\n #endif\n `,this}}(0,o.H)("BABYLON.ParticleRampGradientBlock",a)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Particle/particleTextureBlock.js":function(e,t,i){"use strict";i.d(t,{P:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Input/inputBlock.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),l=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js");class c extends n.k{constructor(e){super(e,s.u.Fragment),this._samplerName="diffuseSampler",this.convertToGammaSpace=!1,this.convertToLinearSpace=!1,this._isUnique=!1,this.registerInput("uv",r.E.Vector2,!1,s.u.VertexAndFragment),this.registerOutput("rgba",r.E.Color4,s.u.Neutral),this.registerOutput("rgb",r.E.Color3,s.u.Neutral),this.registerOutput("r",r.E.Float,s.u.Neutral),this.registerOutput("g",r.E.Float,s.u.Neutral),this.registerOutput("b",r.E.Float,s.u.Neutral),this.registerOutput("a",r.E.Float,s.u.Neutral),this._inputs[0].acceptedConnectionPointTypes.push(r.E.Vector3),this._inputs[0].acceptedConnectionPointTypes.push(r.E.Vector4)}getClassName(){return"ParticleTextureBlock"}get uv(){return this._inputs[0]}get rgba(){return this._outputs[0]}get rgb(){return this._outputs[1]}get r(){return this._outputs[2]}get g(){return this._outputs[3]}get b(){return this._outputs[4]}get a(){return this._outputs[5]}initialize(e){e._excludeVariableName("diffuseSampler")}autoConfigure(e){if(!this.uv.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"particle_uv"===e.name));t||(t=new o.S("uv"),t.setAsAttribute("particle_uv")),t.output.connectTo(this.uv)}}prepareDefines(e,t,i){i.setValue(this._linearDefineName,this.convertToGammaSpace,!0),i.setValue(this._gammaDefineName,this.convertToLinearSpace,!0)}isReady(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())}_writeOutput(e,t,i){e.compilationString+=`${this._declareOutput(t,e)} = ${this._tempTextureRead}.${i};\r\n`,e.compilationString+=`#ifdef ${this._linearDefineName}\r\n`,e.compilationString+=`${t.associatedVariableName} = toGammaSpace(${t.associatedVariableName});\r\n`,e.compilationString+="#endif\r\n",e.compilationString+=`#ifdef ${this._gammaDefineName}\r\n`,e.compilationString+=`${t.associatedVariableName} = toLinearSpace(${t.associatedVariableName});\r\n`,e.compilationString+="#endif\r\n"}_buildBlock(e){if(super._buildBlock(e),e.target===s.u.Vertex)return;this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),e._emit2DSampler(this._samplerName),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.push(this),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA");const t=`//${this.name}`;e._emitFunctionFromInclude("helperFunctions",t),e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${this._samplerName}, ${this.uv.associatedVariableName});\r\n`;for(const t of this._outputs)t.hasEndpoints&&this._writeOutput(e,t,t.name);return this}serialize(){const e=super.serialize();return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,this.texture&&!this.texture.isRenderTarget&&(e.texture=this.texture.serialize()),e}_deserialize(e,t,i){super._deserialize(e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=l.x.Parse(e.texture,t,i))}}(0,a.H)("BABYLON.ParticleTextureBlock",c)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Vertex/vertexOutputBlock.js":function(e,t,i){"use strict";i.d(t,{t:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class a extends n.k{constructor(e){super(e,s.u.Vertex,!0),this.registerInput("vector",r.E.Vector4)}getClassName(){return"VertexOutputBlock"}get vector(){return this._inputs[0]}_isLogarithmicDepthEnabled(e){for(const t of e)if(t.useLogarithmicDepth)return!0;return!1}_buildBlock(e){super._buildBlock(e);const t=this.vector;return e.compilationString+=`gl_Position = ${t.associatedVariableName};\r\n`,this._isLogarithmicDepthEnabled(e.sharedData.fragmentOutputNodes)&&(e._emitUniformFromString("logarithmicDepthConstant","float"),e._emitVaryingFromString("vFragmentDepth","float"),e.compilationString+="vFragmentDepth = 1.0 + gl_Position.w;\r\n",e.compilationString+="gl_Position.z = log2(max(0.000001, vFragmentDepth)) * logarithmicDepthConstant;\r\n"),this}}(0,o.H)("BABYLON.VertexOutputBlock",a)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/colorSplitterBlock.js":function(e,t,i){"use strict";i.d(t,{v:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class a extends n.k{constructor(e){super(e,s.u.Neutral),this.registerInput("rgba",r.E.Color4,!0),this.registerInput("rgb ",r.E.Color3,!0),this.registerOutput("rgb",r.E.Color3),this.registerOutput("r",r.E.Float),this.registerOutput("g",r.E.Float),this.registerOutput("b",r.E.Float),this.registerOutput("a",r.E.Float),this.inputsAreExclusive=!0}getClassName(){return"ColorSplitterBlock"}get rgba(){return this._inputs[0]}get rgbIn(){return this._inputs[1]}get rgbOut(){return this._outputs[0]}get r(){return this._outputs[1]}get g(){return this._outputs[2]}get b(){return this._outputs[3]}get a(){return this._outputs[4]}_inputRename(e){return"rgb "===e?"rgbIn":e}_outputRename(e){return"rgb"===e?"rgbOut":e}_buildBlock(e){super._buildBlock(e);const t=this.rgba.isConnected?this.rgba:this.rgbIn;if(!t.isConnected)return;const i=this._outputs[0],n=this._outputs[1],r=this._outputs[2],s=this._outputs[3],o=this._outputs[4];return i.hasEndpoints&&(e.compilationString+=this._declareOutput(i,e)+` = ${t.associatedVariableName}.rgb;\r\n`),n.hasEndpoints&&(e.compilationString+=this._declareOutput(n,e)+` = ${t.associatedVariableName}.r;\r\n`),r.hasEndpoints&&(e.compilationString+=this._declareOutput(r,e)+` = ${t.associatedVariableName}.g;\r\n`),s.hasEndpoints&&(e.compilationString+=this._declareOutput(s,e)+` = ${t.associatedVariableName}.b;\r\n`),o.hasEndpoints&&(e.compilationString+=this._declareOutput(o,e)+` = ${t.associatedVariableName}.a;\r\n`),this}}(0,o.H)("BABYLON.ColorSplitterBlock",a)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/multiplyBlock.js":function(e,t,i){"use strict";i.d(t,{U:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class a extends n.k{constructor(e){super(e,s.u.Neutral),this.registerInput("left",r.E.AutoDetect),this.registerInput("right",r.E.AutoDetect),this.registerOutput("output",r.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._linkConnectionTypes(0,1)}getClassName(){return"MultiplyBlock"}get left(){return this._inputs[0]}get right(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = ${this.left.associatedVariableName} * ${this.right.associatedVariableName};\r\n`,this}}(0,o.H)("BABYLON.MultiplyBlock",a)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/remapBlock.js":function(e,t,i){"use strict";i.d(t,{w:function(){return h}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),o=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),l=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),c=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialDecorator.js");class h extends r.k{constructor(e){super(e,o.u.Neutral),this.sourceRange=new l.FM(-1,1),this.targetRange=new l.FM(0,1),this.registerInput("input",s.E.AutoDetect),this.registerInput("sourceMin",s.E.Float,!0),this.registerInput("sourceMax",s.E.Float,!0),this.registerInput("targetMin",s.E.Float,!0),this.registerInput("targetMax",s.E.Float,!0),this.registerOutput("output",s.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0]}getClassName(){return"RemapBlock"}get input(){return this._inputs[0]}get sourceMin(){return this._inputs[1]}get sourceMax(){return this._inputs[2]}get targetMin(){return this._inputs[3]}get targetMax(){return this._inputs[4]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0],i=this.sourceMin.isConnected?this.sourceMin.associatedVariableName:this._writeFloat(this.sourceRange.x),n=this.sourceMax.isConnected?this.sourceMax.associatedVariableName:this._writeFloat(this.sourceRange.y),r=this.targetMin.isConnected?this.targetMin.associatedVariableName:this._writeFloat(this.targetRange.x),s=this.targetMax.isConnected?this.targetMax.associatedVariableName:this._writeFloat(this.targetRange.y);return e.compilationString+=this._declareOutput(t,e)+` = ${r} + (${this._inputs[0].associatedVariableName} - ${i}) * (${s} - ${r}) / (${n} - ${i});\r\n`,this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode()+`${this._codeVariableName}.sourceRange = new BABYLON.Vector2(${this.sourceRange.x}, ${this.sourceRange.y});\r\n`;return e+=`${this._codeVariableName}.targetRange = new BABYLON.Vector2(${this.targetRange.x}, ${this.targetRange.y});\r\n`,e}serialize(){const e=super.serialize();return e.sourceRange=this.sourceRange.asArray(),e.targetRange=this.targetRange.asArray(),e}_deserialize(e,t,i){super._deserialize(e,t,i),this.sourceRange=l.FM.FromArray(e.sourceRange),this.targetRange=l.FM.FromArray(e.targetRange)}}(0,n.gn)([(0,c.p)("From",c.U.Vector2)],h.prototype,"sourceRange",void 0),(0,n.gn)([(0,c.p)("To",c.U.Vector2)],h.prototype,"targetRange",void 0),(0,a.H)("BABYLON.RemapBlock",h)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/transformBlock.js":function(e,t,i){"use strict";i.d(t,{m:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class a extends n.k{constructor(e){super(e,s.u.Neutral),this.complementW=1,this.complementZ=0,this.target=s.u.Vertex,this.registerInput("vector",r.E.AutoDetect),this.registerInput("transform",r.E.Matrix),this.registerOutput("output",r.E.Vector4),this.registerOutput("xyz",r.E.Vector3),this._inputs[0].onConnectionObservable.add((e=>{if(e.ownerBlock.isInput){const t=e.ownerBlock;"normal"!==t.name&&"tangent"!==t.name||(this.complementW=0)}}))}getClassName(){return"TransformBlock"}get vector(){return this._inputs[0]}get output(){return this._outputs[0]}get xyz(){return this._outputs[1]}get transform(){return this._inputs[1]}_buildBlock(e){super._buildBlock(e);const t=this.vector,i=this.transform;if(t.connectedPoint){if(0===this.complementW){const n=`//${this.name}`;e._emitFunctionFromInclude("helperFunctions",n),e.sharedData.blocksWithDefines.push(this);const s=e._getFreeVariableName(`${i.associatedVariableName}_NUS`);switch(e.compilationString+=`mat3 ${s} = mat3(${i.associatedVariableName});\r\n`,e.compilationString+="#ifdef NONUNIFORMSCALING\r\n",e.compilationString+=`${s} = transposeMat3(inverseMat3(${s}));\r\n`,e.compilationString+="#endif\r\n",t.connectedPoint.type){case r.E.Vector2:e.compilationString+=this._declareOutput(this.output,e)+` = vec4(${s} * vec3(${t.associatedVariableName}, ${this._writeFloat(this.complementZ)}), ${this._writeFloat(this.complementW)});\r\n`;break;case r.E.Vector3:case r.E.Color3:e.compilationString+=this._declareOutput(this.output,e)+` = vec4(${s} * ${t.associatedVariableName}, ${this._writeFloat(this.complementW)});\r\n`;break;default:e.compilationString+=this._declareOutput(this.output,e)+` = vec4(${s} * ${t.associatedVariableName}.xyz, ${this._writeFloat(this.complementW)});\r\n`}}else{const n=i.associatedVariableName;switch(t.connectedPoint.type){case r.E.Vector2:e.compilationString+=this._declareOutput(this.output,e)+` = ${n} * vec4(${t.associatedVariableName}, ${this._writeFloat(this.complementZ)}, ${this._writeFloat(this.complementW)});\r\n`;break;case r.E.Vector3:case r.E.Color3:e.compilationString+=this._declareOutput(this.output,e)+` = ${n} * vec4(${t.associatedVariableName}, ${this._writeFloat(this.complementW)});\r\n`;break;default:e.compilationString+=this._declareOutput(this.output,e)+` = ${n} * ${t.associatedVariableName};\r\n`}}this.xyz.hasEndpoints&&(e.compilationString+=this._declareOutput(this.xyz,e)+` = ${this.output.associatedVariableName}.xyz;\r\n`)}return this}prepareDefines(e,t,i){e.nonUniformScaling&&i.setValue("NONUNIFORMSCALING",!0)}serialize(){const e=super.serialize();return e.complementZ=this.complementZ,e.complementW=this.complementW,e}_deserialize(e,t,i){super._deserialize(e,t,i),this.complementZ=void 0!==e.complementZ?e.complementZ:0,this.complementW=void 0!==e.complementW?e.complementW:1}_dumpPropertiesCode(){let e=super._dumpPropertiesCode()+`${this._codeVariableName}.complementZ = ${this.complementZ};\r\n`;return e+=`${this._codeVariableName}.complementW = ${this.complementW};\r\n`,e}}(0,o.H)("BABYLON.TransformBlock",a)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/trigonometryBlock.js":function(e,t,i){"use strict";i.d(t,{S:function(){return l},p:function(){return n}});var n,r=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),o=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");!function(e){e[e.Cos=0]="Cos",e[e.Sin=1]="Sin",e[e.Abs=2]="Abs",e[e.Exp=3]="Exp",e[e.Exp2=4]="Exp2",e[e.Round=5]="Round",e[e.Floor=6]="Floor",e[e.Ceiling=7]="Ceiling",e[e.Sqrt=8]="Sqrt",e[e.Log=9]="Log",e[e.Tan=10]="Tan",e[e.ArcTan=11]="ArcTan",e[e.ArcCos=12]="ArcCos",e[e.ArcSin=13]="ArcSin",e[e.Fract=14]="Fract",e[e.Sign=15]="Sign",e[e.Radians=16]="Radians",e[e.Degrees=17]="Degrees"}(n||(n={}));class l extends r.k{constructor(e){super(e,o.u.Neutral),this.operation=n.Cos,this.registerInput("input",s.E.AutoDetect),this.registerOutput("output",s.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0]}getClassName(){return"TrigonometryBlock"}get input(){return this._inputs[0]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];let i="";switch(this.operation){case n.Cos:i="cos";break;case n.Sin:i="sin";break;case n.Abs:i="abs";break;case n.Exp:i="exp";break;case n.Exp2:i="exp2";break;case n.Round:i="round";break;case n.Floor:i="floor";break;case n.Ceiling:i="ceil";break;case n.Sqrt:i="sqrt";break;case n.Log:i="log";break;case n.Tan:i="tan";break;case n.ArcTan:i="atan";break;case n.ArcCos:i="acos";break;case n.ArcSin:i="asin";break;case n.Fract:i="fract";break;case n.Sign:i="sign";break;case n.Radians:i="radians";break;case n.Degrees:i="degrees"}return e.compilationString+=this._declareOutput(t,e)+` = ${i}(${this.input.associatedVariableName});\r\n`,this}serialize(){const e=super.serialize();return e.operation=this.operation,e}_deserialize(e,t,i){super._deserialize(e,t,i),this.operation=e.operation}_dumpPropertiesCode(){return super._dumpPropertiesCode()+`${this._codeVariableName}.operation = BABYLON.TrigonometryBlockOperations.${n[this.operation]};\r\n`}}(0,a.H)("BABYLON.TrigonometryBlock",l)},"../../../node_modules/@babylonjs/core/Materials/Node/Blocks/vectorMergerBlock.js":function(e,t,i){"use strict";i.d(t,{t:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class a extends n.k{constructor(e){super(e,s.u.Neutral),this.xSwizzle="x",this.ySwizzle="y",this.zSwizzle="z",this.wSwizzle="w",this.registerInput("xyzw ",r.E.Vector4,!0),this.registerInput("xyz ",r.E.Vector3,!0),this.registerInput("xy ",r.E.Vector2,!0),this.registerInput("zw ",r.E.Vector2,!0),this.registerInput("x",r.E.Float,!0),this.registerInput("y",r.E.Float,!0),this.registerInput("z",r.E.Float,!0),this.registerInput("w",r.E.Float,!0),this.registerOutput("xyzw",r.E.Vector4),this.registerOutput("xyz",r.E.Vector3),this.registerOutput("xy",r.E.Vector2),this.registerOutput("zw",r.E.Vector2)}getClassName(){return"VectorMergerBlock"}get xyzwIn(){return this._inputs[0]}get xyzIn(){return this._inputs[1]}get xyIn(){return this._inputs[2]}get zwIn(){return this._inputs[3]}get x(){return this._inputs[4]}get y(){return this._inputs[5]}get z(){return this._inputs[6]}get w(){return this._inputs[7]}get xyzw(){return this._outputs[0]}get xyzOut(){return this._outputs[1]}get xyOut(){return this._outputs[2]}get zwOut(){return this._outputs[3]}get xy(){return this.xyOut}get xyz(){return this.xyzOut}_inputRename(e){return"xyzw "===e?"xyzwIn":"xyz "===e?"xyzIn":"xy "===e?"xyIn":"zw "===e?"zwIn":e}_buildSwizzle(e){return"."+(this.xSwizzle+this.ySwizzle+this.zSwizzle+this.wSwizzle).substr(0,e)}_buildBlock(e){super._buildBlock(e);const t=this.x,i=this.y,n=this.z,r=this.w,s=this.xyIn,o=this.zwIn,a=this.xyzIn,l=this.xyzwIn,c=this._outputs[0],h=this._outputs[1],_=this._outputs[2],d=this._outputs[3];return l.isConnected?(c.hasEndpoints&&(e.compilationString+=this._declareOutput(c,e)+` = ${l.associatedVariableName}${this._buildSwizzle(4)};\r\n`),h.hasEndpoints&&(e.compilationString+=this._declareOutput(h,e)+` = ${l.associatedVariableName}${this._buildSwizzle(3)};\r\n`),_.hasEndpoints&&(e.compilationString+=this._declareOutput(_,e)+` = ${l.associatedVariableName}${this._buildSwizzle(2)};\r\n`)):a.isConnected?(c.hasEndpoints&&(e.compilationString+=this._declareOutput(c,e)+` = vec4(${a.associatedVariableName}, ${r.isConnected?this._writeVariable(r):"0.0"})${this._buildSwizzle(4)};\r\n`),h.hasEndpoints&&(e.compilationString+=this._declareOutput(h,e)+` = ${a.associatedVariableName}${this._buildSwizzle(3)};\r\n`),_.hasEndpoints&&(e.compilationString+=this._declareOutput(_,e)+` = ${a.associatedVariableName}${this._buildSwizzle(2)};\r\n`)):s.isConnected?(c.hasEndpoints&&(o.isConnected?e.compilationString+=this._declareOutput(c,e)+` = vec4(${s.associatedVariableName}, ${o.associatedVariableName})${this._buildSwizzle(4)};\r\n`:e.compilationString+=this._declareOutput(c,e)+` = vec4(${s.associatedVariableName}, ${n.isConnected?this._writeVariable(n):"0.0"}, ${r.isConnected?this._writeVariable(r):"0.0"})${this._buildSwizzle(4)};\r\n`),h.hasEndpoints&&(e.compilationString+=this._declareOutput(h,e)+` = vec3(${s.associatedVariableName}, ${n.isConnected?this._writeVariable(n):"0.0"})${this._buildSwizzle(3)};\r\n`),_.hasEndpoints&&(e.compilationString+=this._declareOutput(_,e)+` = ${s.associatedVariableName}${this._buildSwizzle(2)};\r\n`),d.hasEndpoints&&(o.isConnected?e.compilationString+=this._declareOutput(d,e)+` = ${o.associatedVariableName}${this._buildSwizzle(2)};\r\n`:e.compilationString+=this._declareOutput(d,e)+` = vec2(${n.isConnected?this._writeVariable(n):"0.0"}, ${r.isConnected?this._writeVariable(r):"0.0"})${this._buildSwizzle(2)};\r\n`)):(c.hasEndpoints&&(o.isConnected?e.compilationString+=this._declareOutput(c,e)+` = vec4(${t.isConnected?this._writeVariable(t):"0.0"}, ${i.isConnected?this._writeVariable(i):"0.0"}, ${o.associatedVariableName})${this._buildSwizzle(4)};\r\n`:e.compilationString+=this._declareOutput(c,e)+` = vec4(${t.isConnected?this._writeVariable(t):"0.0"}, ${i.isConnected?this._writeVariable(i):"0.0"}, ${n.isConnected?this._writeVariable(n):"0.0"}, ${r.isConnected?this._writeVariable(r):"0.0"})${this._buildSwizzle(4)};\r\n`),h.hasEndpoints&&(e.compilationString+=this._declareOutput(h,e)+` = vec3(${t.isConnected?this._writeVariable(t):"0.0"}, ${i.isConnected?this._writeVariable(i):"0.0"}, ${n.isConnected?this._writeVariable(n):"0.0"})${this._buildSwizzle(3)};\r\n`),_.hasEndpoints&&(e.compilationString+=this._declareOutput(_,e)+` = vec2(${t.isConnected?this._writeVariable(t):"0.0"}, ${i.isConnected?this._writeVariable(i):"0.0"})${this._buildSwizzle(2)};\r\n`),d.hasEndpoints&&(o.isConnected?e.compilationString+=this._declareOutput(d,e)+` = ${o.associatedVariableName}${this._buildSwizzle(2)};\r\n`:e.compilationString+=this._declareOutput(d,e)+` = vec2(${n.isConnected?this._writeVariable(n):"0.0"}, ${r.isConnected?this._writeVariable(r):"0.0"})${this._buildSwizzle(2)};\r\n`)),this}serialize(){const e=super.serialize();return e.xSwizzle=this.xSwizzle,e.ySwizzle=this.ySwizzle,e.zSwizzle=this.zSwizzle,e.wSwizzle=this.wSwizzle,e}_deserialize(e,t,i){var n,r,s,o;super._deserialize(e,t,i),this.xSwizzle=null!==(n=e.xSwizzle)&&void 0!==n?n:"x",this.ySwizzle=null!==(r=e.ySwizzle)&&void 0!==r?r:"y",this.zSwizzle=null!==(s=e.zSwizzle)&&void 0!==s?s:"z",this.wSwizzle=null!==(o=e.wSwizzle)&&void 0!==o?o:"w"}_dumpPropertiesCode(){let e=super._dumpPropertiesCode();return e+=`${this._codeVariableName}.xSwizzle = "${this.xSwizzle}";\r\n`,e+=`${this._codeVariableName}.ySwizzle = "${this.ySwizzle}";\r\n`,e+=`${this._codeVariableName}.zSwizzle = "${this.zSwizzle}";\r\n`,e+=`${this._codeVariableName}.wSwizzle = "${this.wSwizzle}";\r\n`,e}}(0,o.H)("BABYLON.VectorMergerBlock",a)},"../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.js":function(e,t,i){"use strict";var n;i.d(t,{M:function(){return n}}),function(e){e[e.Uniform=0]="Uniform",e[e.Attribute=1]="Attribute",e[e.Varying=2]="Varying",e[e.Undefined=3]="Undefined"}(n||(n={}))},"../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js":function(e,t,i){"use strict";var n;i.d(t,{E:function(){return n}}),function(e){e[e.Float=1]="Float",e[e.Int=2]="Int",e[e.Vector2=4]="Vector2",e[e.Vector3=8]="Vector3",e[e.Vector4=16]="Vector4",e[e.Color3=32]="Color3",e[e.Color4=64]="Color4",e[e.Matrix=128]="Matrix",e[e.Object=256]="Object",e[e.AutoDetect=1024]="AutoDetect",e[e.BasedOnInput=2048]="BasedOnInput"}(n||(n={}))},"../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js":function(e,t,i){"use strict";var n;i.d(t,{u:function(){return n}}),function(e){e[e.Vertex=1]="Vertex",e[e.Fragment=2]="Fragment",e[e.Neutral=4]="Neutral",e[e.VertexAndFragment=3]="VertexAndFragment"}(n||(n={}))},"../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialModes.js":function(e,t,i){"use strict";var n;i.d(t,{a:function(){return n}}),function(e){e[e.Material=0]="Material",e[e.PostProcess=1]="PostProcess",e[e.Particle=2]="Particle",e[e.ProceduralTexture=3]="ProceduralTexture"}(n||(n={}))},"../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialSystemValues.js":function(e,t,i){"use strict";var n;i.d(t,{$:function(){return n}}),function(e){e[e.World=1]="World",e[e.View=2]="View",e[e.Projection=3]="Projection",e[e.ViewProjection=4]="ViewProjection",e[e.WorldView=5]="WorldView",e[e.WorldViewProjection=6]="WorldViewProjection",e[e.CameraPosition=7]="CameraPosition",e[e.FogColor=8]="FogColor",e[e.DeltaTime=9]="DeltaTime",e[e.CameraParameters=10]="CameraParameters",e[e.MaterialAlpha=11]="MaterialAlpha"}(n||(n={}))},"../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterial.js":function(e,t,i){"use strict";i.d(t,{O:function(){return Y}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Materials/pushMaterial.js"),s=i("../../../node_modules/@babylonjs/core/scene.js"),o=i("../../../node_modules/@babylonjs/core/Meshes/abstractMesh.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),l=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),c=i("../../../node_modules/@babylonjs/core/Engines/engine.js"),h=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),_=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),d=i("../../../node_modules/@babylonjs/core/Materials/effect.js");class u{constructor(){this.supportUniformBuffers=!1,this.attributes=new Array,this.uniforms=new Array,this.constants=new Array,this.samplers=new Array,this.functions={},this.extensions={},this.counters={},this._attributeDeclaration="",this._uniformDeclaration="",this._constantDeclaration="",this._samplerDeclaration="",this._varyingTransfer="",this._injectAtEnd="",this._repeatableContentAnchorIndex=0,this._builtCompilationString="",this.compilationString=""}finalize(e){const t=e.sharedData.emitComments,i=this.target===_.u.Fragment;this.compilationString=`\r\n${t?"//Entry point\r\n":""}void main(void) {\r\n${this.compilationString}`,this._constantDeclaration&&(this.compilationString=`\r\n${t?"//Constants\r\n":""}${this._constantDeclaration}\r\n${this.compilationString}`);let n="";for(const e in this.functions)n+=this.functions[e]+"\r\n";this.compilationString=`\r\n${n}\r\n${this.compilationString}`,!i&&this._varyingTransfer&&(this.compilationString=`${this.compilationString}\r\n${this._varyingTransfer}`),this._injectAtEnd&&(this.compilationString=`${this.compilationString}\r\n${this._injectAtEnd}`),this.compilationString=`${this.compilationString}\r\n}`,this.sharedData.varyingDeclaration&&(this.compilationString=`\r\n${t?"//Varyings\r\n":""}${this.sharedData.varyingDeclaration}\r\n${this.compilationString}`),this._samplerDeclaration&&(this.compilationString=`\r\n${t?"//Samplers\r\n":""}${this._samplerDeclaration}\r\n${this.compilationString}`),this._uniformDeclaration&&(this.compilationString=`\r\n${t?"//Uniforms\r\n":""}${this._uniformDeclaration}\r\n${this.compilationString}`),this._attributeDeclaration&&!i&&(this.compilationString=`\r\n${t?"//Attributes\r\n":""}${this._attributeDeclaration}\r\n${this.compilationString}`),this.compilationString="precision highp float;\r\n"+this.compilationString;for(const e in this.extensions){const t=this.extensions[e];this.compilationString=`\r\n${t}\r\n${this.compilationString}`}this._builtCompilationString=this.compilationString}get _repeatableContentAnchor(){return`###___ANCHOR${this._repeatableContentAnchorIndex++}___###`}_getFreeVariableName(e){return e=e.replace(/[^a-zA-Z_]+/g,""),void 0===this.sharedData.variableNames[e]?(this.sharedData.variableNames[e]=0,"output"===e||"texture"===e?e+this.sharedData.variableNames[e]:e):(this.sharedData.variableNames[e]++,e+this.sharedData.variableNames[e])}_getFreeDefineName(e){return void 0===this.sharedData.defineNames[e]?this.sharedData.defineNames[e]=0:this.sharedData.defineNames[e]++,e+this.sharedData.defineNames[e]}_excludeVariableName(e){this.sharedData.variableNames[e]=0}_emit2DSampler(e){this.samplers.indexOf(e)<0&&(this._samplerDeclaration+=`uniform sampler2D ${e};\r\n`,this.samplers.push(e))}_getGLType(e){switch(e){case h.E.Float:return"float";case h.E.Int:return"int";case h.E.Vector2:return"vec2";case h.E.Color3:case h.E.Vector3:return"vec3";case h.E.Color4:case h.E.Vector4:return"vec4";case h.E.Matrix:return"mat4"}return""}_emitExtension(e,t,i=""){this.extensions[e]||(i&&(t=`#if ${i}\r\n${t}\r\n#endif`),this.extensions[e]=t)}_emitFunction(e,t,i){this.functions[e]||(this.sharedData.emitComments&&(t=i+"\r\n"+t),this.functions[e]=t)}_emitCodeFromInclude(e,t,i){if(i&&i.repeatKey)return`#include<${e}>[0..${i.repeatKey}]\r\n`;let n=d.Q.IncludesShadersStore[e]+"\r\n";if(this.sharedData.emitComments&&(n=t+"\r\n"+n),!i)return n;if(i.replaceStrings)for(let e=0;e[0..${i.repeatKey}]\r\n`:this.functions[r]=`#include<${e}>\r\n`,void(this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]));if(this.functions[r]=d.Q.IncludesShadersStore[e],this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]),i.removeIfDef&&(this.functions[r]=this.functions[r].replace(/^\s*?#ifdef.+$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#endif.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#else.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#elif.*$/gm,"")),i.removeAttributes&&(this.functions[r]=this.functions[r].replace(/^\s*?attribute.+$/gm,"")),i.removeUniforms&&(this.functions[r]=this.functions[r].replace(/^\s*?uniform.+$/gm,"")),i.removeVaryings&&(this.functions[r]=this.functions[r].replace(/^\s*?varying.+$/gm,"")),i.replaceStrings)for(let e=0;e{this._markAllSubMeshesAsImageProcessingDirty()}))))}getBlockByName(e){let t=null;for(const i of this.attachedBlocks)if(i.name===e){if(t)return b.w1.Warn("More than one block was found with the name `"+e+"`"),t;t=i}return t}getBlockByPredicate(e){for(const t of this.attachedBlocks)if(e(t))return t;return null}getInputBlockByPredicate(e){for(const t of this.attachedBlocks)if(t.isInput&&e(t))return t;return null}getInputBlocks(){const e=[];for(const t of this.attachedBlocks)t.isInput&&e.push(t);return e}registerOptimizer(e){if(!(this._optimizers.indexOf(e)>-1))return this._optimizers.push(e),this}unregisterOptimizer(e){const t=this._optimizers.indexOf(e);if(-1!==t)return this._optimizers.splice(t,1),this}addOutputNode(e){if(null===e.target)throw"This node is not meant to be an output node. You may want to explicitly set its target value.";return 0!=(e.target&_.u.Vertex)&&this._addVertexOutputNode(e),0!=(e.target&_.u.Fragment)&&this._addFragmentOutputNode(e),this}removeOutputNode(e){return null===e.target||(0!=(e.target&_.u.Vertex)&&this._removeVertexOutputNode(e),0!=(e.target&_.u.Fragment)&&this._removeFragmentOutputNode(e)),this}_addVertexOutputNode(e){if(-1===this._vertexOutputNodes.indexOf(e))return e.target=_.u.Vertex,this._vertexOutputNodes.push(e),this}_removeVertexOutputNode(e){const t=this._vertexOutputNodes.indexOf(e);if(-1!==t)return this._vertexOutputNodes.splice(t,1),this}_addFragmentOutputNode(e){if(-1===this._fragmentOutputNodes.indexOf(e))return e.target=_.u.Fragment,this._fragmentOutputNodes.push(e),this}_removeFragmentOutputNode(e){const t=this._fragmentOutputNodes.indexOf(e);if(-1!==t)return this._fragmentOutputNodes.splice(t,1),this}needAlphaBlending(){return!this.ignoreAlpha&&(this.forceAlphaBlending||this.alpha<1||this._sharedData&&this._sharedData.hints.needAlphaBlending)}needAlphaTesting(){return this._sharedData&&this._sharedData.hints.needAlphaTesting}_initializeBlock(e,t,i,n=!0){if(e.initialize(t),n&&e.autoConfigure(this),e._preparationId=this._buildId,-1===this.attachedBlocks.indexOf(e)){if(e.isUnique){const t=e.getClassName();for(const e of this.attachedBlocks)if(e.getClassName()===t)throw`Cannot have multiple blocks of type ${t} in the same NodeMaterial`}this.attachedBlocks.push(e)}for(const r of e.inputs){r.associatedVariableName="";const s=r.connectedPoint;if(s){const r=s.ownerBlock;r!==e&&((r.target===_.u.VertexAndFragment||t.target===_.u.Fragment&&r.target===_.u.Vertex&&r._preparationId!==this._buildId)&&i.push(r),this._initializeBlock(r,t,i,n))}}for(const t of e.outputs)t.associatedVariableName=""}_resetDualBlocks(e,t){e.target===_.u.VertexAndFragment&&(e.buildId=t);for(const i of e.inputs){const n=i.connectedPoint;if(n){const i=n.ownerBlock;i!==e&&this._resetDualBlocks(i,t)}}}removeBlock(e){const t=this.attachedBlocks.indexOf(e);t>-1&&this.attachedBlocks.splice(t,1),e.isFinalMerger&&this.removeOutputNode(e)}build(e=!1,t=!0,i=!0){this._buildWasSuccessful=!1;const n=this.getScene().getEngine(),r=this._mode===B.a.Particle;if(0===this._vertexOutputNodes.length&&!r)throw"You must define at least one vertexOutputNode";if(0===this._fragmentOutputNodes.length)throw"You must define at least one fragmentOutputNode";this._vertexCompilationState=new u,this._vertexCompilationState.supportUniformBuffers=n.supportsUniformBuffers,this._vertexCompilationState.target=_.u.Vertex,this._fragmentCompilationState=new u,this._fragmentCompilationState.supportUniformBuffers=n.supportsUniformBuffers,this._fragmentCompilationState.target=_.u.Fragment,this._sharedData=new f,this._sharedData.fragmentOutputNodes=this._fragmentOutputNodes,this._vertexCompilationState.sharedData=this._sharedData,this._fragmentCompilationState.sharedData=this._sharedData,this._sharedData.buildId=this._buildId,this._sharedData.emitComments=this._options.emitComments,this._sharedData.verbose=e,this._sharedData.scene=this.getScene(),this._sharedData.allowEmptyVertexProgram=r;const s=[],o=[];for(const e of this._vertexOutputNodes)s.push(e),this._initializeBlock(e,this._vertexCompilationState,o,i);for(const e of this._fragmentOutputNodes)o.push(e),this._initializeBlock(e,this._fragmentCompilationState,s,i);this.optimize();for(const e of s)e.build(this._vertexCompilationState,s);this._fragmentCompilationState.uniforms=this._vertexCompilationState.uniforms.slice(0),this._fragmentCompilationState._uniformDeclaration=this._vertexCompilationState._uniformDeclaration,this._fragmentCompilationState._constantDeclaration=this._vertexCompilationState._constantDeclaration,this._fragmentCompilationState._vertexState=this._vertexCompilationState;for(const e of o)this._resetDualBlocks(e,this._buildId-1);for(const e of o)e.build(this._fragmentCompilationState,o);this._vertexCompilationState.finalize(this._vertexCompilationState),this._fragmentCompilationState.finalize(this._fragmentCompilationState),t&&(this._buildId=Y._BuildIdGenerator++),this._sharedData.emitErrors(),e&&(console.log("Vertex shader:"),console.log(this._vertexCompilationState.compilationString),console.log("Fragment shader:"),console.log(this._fragmentCompilationState.compilationString)),this._buildWasSuccessful=!0,this.onBuildObservable.notifyObservers(this);const a=this.getScene().meshes;for(const e of a)if(e.subMeshes)for(const t of e.subMeshes){if(t.getMaterial()!==this)continue;if(!t.materialDefines)continue;const e=t.materialDefines;e.markAllAsDirty(),e.reset()}}optimize(){for(const e of this._optimizers)e.optimize(this._vertexOutputNodes,this._fragmentOutputNodes)}_prepareDefinesForAttributes(e,t){const i=t.NORMAL,n=t.TANGENT;t.NORMAL=e.isVerticesDataPresent(g.o.NormalKind),t.TANGENT=e.isVerticesDataPresent(g.o.TangentKind);let r=!1;for(let i=1;i<=6;++i){const n=t["UV"+i];t["UV"+i]=e.isVerticesDataPresent(`uv${1===i?"":i}`),r=r||t["UV"+i]!==n}(i!==t.NORMAL||n!==t.TANGENT||r)&&t.markAsAttributesDirty()}createPostProcess(e,t=1,i=1,n,r,s=0,o=5){return this.mode!==B.a.PostProcess?(console.log("Incompatible material mode"),null):this._createEffectForPostProcess(null,e,t,i,n,r,s,o)}createEffectForPostProcess(e){this._createEffectForPostProcess(e)}_createEffectForPostProcess(e,t,i=1,n=1,r,s,a=0,l=5){let c=this.name+this._buildId;const h=new X,_=new o.x(c+"PostProcess",this.getScene());let u=this._buildId;return this._processDefines(_,h),d.Q.RegisterShader(c,this._fragmentCompilationState._builtCompilationString,this._vertexCompilationState._builtCompilationString),e?e.updateEffect(h.toString(),this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,{maxSimultaneousLights:this.maxSimultaneousLights},void 0,void 0,c,c):e=new D.D(this.name+"PostProcess",c,this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,i,t,n,r,s,h.toString(),a,c,{maxSimultaneousLights:this.maxSimultaneousLights},!1,l),e.nodeMaterialSource=this,e.onApplyObservable.add((t=>{u!==this._buildId&&(delete d.Q.ShadersStore[c+"VertexShader"],delete d.Q.ShadersStore[c+"PixelShader"],c=this.name+this._buildId,h.markAllAsDirty(),u=this._buildId),this._processDefines(_,h)&&(d.Q.RegisterShader(c,this._fragmentCompilationState._builtCompilationString,this._vertexCompilationState._builtCompilationString),V.Q.SetImmediate((()=>e.updateEffect(h.toString(),this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,{maxSimultaneousLights:this.maxSimultaneousLights},void 0,void 0,c,c)))),this._checkInternals(t)})),e}createProceduralTexture(e,t){if(this.mode!==B.a.ProceduralTexture)return console.log("Incompatible material mode"),null;let i=this.name+this._buildId;const n=new U.g(i,e,null,t),r=new o.x(i+"Procedural",this.getScene());r.reservedDataStore={hidden:!0};const s=new X,a=this._processDefines(r,s);d.Q.RegisterShader(i,this._fragmentCompilationState._builtCompilationString,this._vertexCompilationState._builtCompilationString);let l=this.getScene().getEngine().createEffect({vertexElement:i,fragmentElement:i},[g.o.PositionKind],this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,s.toString(),null==a?void 0:a.fallbacks,void 0);n.nodeMaterialSource=this,n._setEffect(l);let c=this._buildId;return n.onBeforeGenerationObservable.add((()=>{c!==this._buildId&&(delete d.Q.ShadersStore[i+"VertexShader"],delete d.Q.ShadersStore[i+"PixelShader"],i=this.name+this._buildId,s.markAllAsDirty(),c=this._buildId);const e=this._processDefines(r,s);e&&(d.Q.RegisterShader(i,this._fragmentCompilationState._builtCompilationString,this._vertexCompilationState._builtCompilationString),V.Q.SetImmediate((()=>{l=this.getScene().getEngine().createEffect({vertexElement:i,fragmentElement:i},[g.o.PositionKind],this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,s.toString(),null==e?void 0:e.fallbacks,void 0),n._setEffect(l)}))),this._checkInternals(l)})),n}_createEffectForParticles(e,t,i,n,r,s,a,l=""){let c=this.name+this._buildId+"_"+t;s||(s=new X),a||(a=this.getScene().getMeshByName(this.name+"Particle"))||((a=new o.x(this.name+"Particle",this.getScene())).reservedDataStore={hidden:!0});let h=this._buildId;const _=[];let u=l;if(!r){const o=this._processDefines(a,s);d.Q.RegisterShader(c,this._fragmentCompilationState._builtCompilationString),e.fillDefines(_,t),u=_.join("\n"),r=this.getScene().getEngine().createEffectForParticles(c,this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,s.toString()+"\n"+u,null==o?void 0:o.fallbacks,i,n,e),e.setCustomEffect(r,t)}r.onBindObservable.add((r=>{h!==this._buildId&&(delete d.Q.ShadersStore[c+"PixelShader"],c=this.name+this._buildId+"_"+t,s.markAllAsDirty(),h=this._buildId),_.length=0,e.fillDefines(_,t);const o=_.join("\n");o!==u&&(s.markAllAsDirty(),u=o);const p=this._processDefines(a,s);if(p)return d.Q.RegisterShader(c,this._fragmentCompilationState._builtCompilationString),r=this.getScene().getEngine().createEffectForParticles(c,this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,s.toString()+"\n"+u,null==p?void 0:p.fallbacks,i,n,e),e.setCustomEffect(r,t),void this._createEffectForParticles(e,t,i,n,r,s,a,l);this._checkInternals(r)}))}_checkInternals(e){if(this._sharedData.animatedInputs){const e=this.getScene(),t=e.getFrameId();if(this._animationFrame!==t){for(const t of this._sharedData.animatedInputs)t.animate(e);this._animationFrame=t}}for(const t of this._sharedData.bindableBlocks)t.bind(e,this);for(const t of this._sharedData.inputBlocks)t._transmit(e,this.getScene(),this)}createEffectForParticles(e,t,i){this.mode===B.a.Particle?(this._createEffectForParticles(e,L.U.BLENDMODE_ONEONE,t,i),this._createEffectForParticles(e,L.U.BLENDMODE_MULTIPLY,t,i)):console.log("Incompatible material mode")}createAsShadowDepthWrapper(e){this.mode===B.a.Material?e.shadowDepthWrapper=new BABYLON.ShadowDepthWrapper(this,this.getScene()):console.log("Incompatible material mode")}_processDefines(e,t,i=!1,n){let r=null;if(this._sharedData.blocksWithDefines.forEach((n=>{n.initializeDefines(e,this,t,i)})),this._sharedData.blocksWithDefines.forEach((r=>{r.prepareDefines(e,this,t,i,n)})),t.isDirty){const i=t._areLightsDisposed;t.markAsProcessed(),this._vertexCompilationState.compilationString=this._vertexCompilationState._builtCompilationString,this._fragmentCompilationState.compilationString=this._fragmentCompilationState._builtCompilationString,this._sharedData.repeatableContentBlocks.forEach((i=>{i.replaceRepeatableContent(this._vertexCompilationState,this._fragmentCompilationState,e,t)}));const n=[];this._sharedData.dynamicUniformBlocks.forEach((e=>{e.updateUniformsAndSamples(this._vertexCompilationState,this,t,n)}));const s=this._vertexCompilationState.uniforms;this._fragmentCompilationState.uniforms.forEach((e=>{-1===s.indexOf(e)&&s.push(e)}));const o=this._vertexCompilationState.samplers;this._fragmentCompilationState.samplers.forEach((e=>{-1===o.indexOf(e)&&o.push(e)}));const a=new I.L;this._sharedData.blocksWithFallbacks.forEach((t=>{t.provideFallbacks(e,a)})),r={lightDisposed:i,uniformBuffers:n,mergedUniforms:s,mergedSamplers:o,fallbacks:a}}return r}isReadyForSubMesh(e,t,i=!1){if(!this._buildWasSuccessful)return!1;const n=this.getScene();if(this._sharedData.animatedInputs){const e=n.getFrameId();if(this._animationFrame!==e){for(const e of this._sharedData.animatedInputs)e.animate(n);this._animationFrame=e}}if(t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new X);const r=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;const o=n.getEngine();if(this._prepareDefinesForAttributes(e,r),this._sharedData.blockingBlocks.some((t=>!t.isReady(e,this,r,i))))return!1;const a=this._processDefines(e,r,i,t);if(a){const e=t.effect,i=r.toString();let s=o.createEffect({vertex:"nodeMaterial"+this._buildId,fragment:"nodeMaterial"+this._buildId,vertexSource:this._vertexCompilationState.compilationString,fragmentSource:this._fragmentCompilationState.compilationString},{attributes:this._vertexCompilationState.attributes,uniformsNames:a.mergedUniforms,uniformBuffersNames:a.uniformBuffers,samplers:a.mergedSamplers,defines:i,fallbacks:a.fallbacks,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights,maxSimultaneousMorphTargets:r.NUM_MORPH_INFLUENCERS}},o);if(s)if(this._onEffectCreatedObservable&&(H.effect=s,H.subMesh=t,this._onEffectCreatedObservable.notifyObservers(H)),this.allowShaderHotSwapping&&e&&!s.isReady()){if(s=e,r.markAsUnprocessed(),a.lightDisposed)return r._areLightsDisposed=!0,!1}else n.resetCachedMaterial(),t.setEffect(s,r,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(r._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=i,n.performancePriority!==s.a.BackwardCompatible&&(this.checkReadyOnlyOnce=!0),0))}get compiledShaders(){return`// Vertex shader\r\n${this._vertexCompilationState.compilationString}\r\n\r\n// Fragment shader\r\n${this._fragmentCompilationState.compilationString}`}bindOnlyWorldMatrix(e){const t=this.getScene();if(!this._activeEffect)return;const i=this._sharedData.hints;i.needWorldViewMatrix&&e.multiplyToRef(t.getViewMatrix(),this._cachedWorldViewMatrix),i.needWorldViewProjectionMatrix&&e.multiplyToRef(t.getTransformMatrix(),this._cachedWorldViewProjectionMatrix);for(const t of this._sharedData.inputBlocks)t._transmitWorld(this._activeEffect,e,this._cachedWorldViewMatrix,this._cachedWorldViewProjectionMatrix)}bindForSubMesh(e,t,i){const n=this.getScene(),r=i.effect;if(!r)return;this._activeEffect=r,this.bindOnlyWorldMatrix(e);const s=this._mustRebind(n,r,t.visibility),o=this._sharedData;if(s){for(const e of o.bindableBlocks)e.bind(r,this,t,i);for(const e of o.forcedBindableBlocks)e.bind(r,this,t,i);for(const e of o.inputBlocks)e._transmit(r,n,this)}else if(!this.isFrozen)for(const e of o.forcedBindableBlocks)e.bind(r,this,t,i);this._afterBind(t,this._activeEffect)}getActiveTextures(){const e=super.getActiveTextures();return this._sharedData&&e.push(...this._sharedData.textureBlocks.filter((e=>e.texture)).map((e=>e.texture))),e}getTextureBlocks(){return this._sharedData?this._sharedData.textureBlocks:[]}hasTexture(e){if(super.hasTexture(e))return!0;if(!this._sharedData)return!1;for(const t of this._sharedData.textureBlocks)if(t.texture===e)return!0;return!1}dispose(e,t,i){if(t)for(const e of this.getTextureBlocks().filter((e=>e.texture)).map((e=>e.texture)))e.dispose();for(const e of this.attachedBlocks)e.dispose();this.attachedBlocks.length=0,this._sharedData=null,this._vertexCompilationState=null,this._fragmentCompilationState=null,this.onBuildObservable.clear(),this._imageProcessingObserver&&(this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingObserver=null),super.dispose(e,t,i)}_createNodeEditor(){this.BJSNODEMATERIALEDITOR.NodeEditor.Show({nodeMaterial:this})}edit(e){return new Promise((t=>{if(this.BJSNODEMATERIALEDITOR=this.BJSNODEMATERIALEDITOR||this._getGlobalNodeMaterialEditor(),void 0===this.BJSNODEMATERIALEDITOR){const i=e&&e.editorURL?e.editorURL:Y.EditorURL;b.w1.LoadScript(i,(()=>{this.BJSNODEMATERIALEDITOR=this.BJSNODEMATERIALEDITOR||this._getGlobalNodeMaterialEditor(),this._createNodeEditor(),t()}))}else this._createNodeEditor(),t()}))}clear(){this._vertexOutputNodes.length=0,this._fragmentOutputNodes.length=0,this.attachedBlocks.length=0}setToDefault(){this.clear(),this.editorData=null;const e=new C.S("Position");e.setAsAttribute("position");const t=new C.S("World");t.setAsSystemValue(W.$.World);const i=new y.m("WorldPos");e.connectTo(i),t.connectTo(i);const n=new C.S("ViewProjection");n.setAsSystemValue(W.$.ViewProjection);const r=new y.m("WorldPos * ViewProjectionTransform");i.connectTo(r),n.connectTo(r);const s=new v.t("VertexOutput");r.connectTo(s);const o=new C.S("color");o.value=new l.HE(.8,.8,.8,1);const a=new A.g("FragmentOutput");o.connectTo(a),this.addOutputNode(s),this.addOutputNode(a),this._mode=B.a.Material}setToDefaultPostProcess(){this.clear(),this.editorData=null;const e=new C.S("Position");e.setAsAttribute("position2d");const t=new C.S("Constant1");t.isConstant=!0,t.value=1;const i=new O.t("Position3D");e.connectTo(i),t.connectTo(i,{input:"w"});const n=new v.t("VertexOutput");i.connectTo(n);const r=new C.S("Scale");r.visibleInInspector=!0,r.value=new a.FM(1,1);const s=new w.w("uv0");e.connectTo(s);const o=new F.U("UV scale");s.connectTo(o),r.connectTo(o);const l=new T.K("CurrentScreen");o.connectTo(l),l.texture=new N.x("https://assets.babylonjs.com/nme/currentScreenPostProcess.png",this.getScene());const c=new A.g("FragmentOutput");l.connectTo(c,{output:"rgba"}),this.addOutputNode(n),this.addOutputNode(c),this._mode=B.a.PostProcess}setToDefaultProceduralTexture(){this.clear(),this.editorData=null;const e=new C.S("Position");e.setAsAttribute("position2d");const t=new C.S("Constant1");t.isConstant=!0,t.value=1;const i=new O.t("Position3D");e.connectTo(i),t.connectTo(i,{input:"w"});const n=new v.t("VertexOutput");i.connectTo(n);const r=new C.S("Time");r.value=0,r.min=0,r.max=0,r.isBoolean=!1,r.matrixMode=0,r.animationType=G.c.Time,r.isConstant=!1;const s=new C.S("Color3");s.value=new l.Wo(1,1,1),s.isConstant=!1;const o=new A.g("FragmentOutput"),a=new O.t("VectorMerger");a.visibleInInspector=!1;const c=new j.S("Cos");c.operation=j.p.Cos,e.connectTo(a),r.output.connectTo(c.input),c.output.connectTo(a.z),a.xyzOut.connectTo(o.rgb),this.addOutputNode(n),this.addOutputNode(o),this._mode=B.a.ProceduralTexture}setToDefaultParticle(){this.clear(),this.editorData=null;const e=new C.S("uv");e.setAsAttribute("particle_uv");const t=new E.P("ParticleTexture");e.connectTo(t);const i=new C.S("Color");i.setAsAttribute("particle_color");const n=new F.U("Texture * Color");t.connectTo(n),i.connectTo(n);const r=new R.p("ParticleRampGradient");n.connectTo(r);const s=new k.v("ColorSplitter");i.connectTo(s);const o=new P.D("ParticleBlendMultiply");r.connectTo(o),t.connectTo(o,{output:"a"}),s.connectTo(o,{output:"a"});const a=new A.g("FragmentOutput");o.connectTo(a),this.addOutputNode(a),this._mode=B.a.Particle}async loadAsync(e,t=""){return Y.ParseFromFileAsync("",e,this.getScene(),t,!0,this)}_gatherBlocks(e,t){if(-1===t.indexOf(e)){t.push(e);for(const i of e.inputs){const n=i.connectedPoint;if(n){const i=n.ownerBlock;i!==e&&this._gatherBlocks(i,t)}}}}generateCode(){let e=[];const t=[],i=["const","var","let"];for(const e of this._vertexOutputNodes)this._gatherBlocks(e,t);const n=[];for(const e of this._fragmentOutputNodes)this._gatherBlocks(e,n);let r=`var nodeMaterial = new BABYLON.NodeMaterial("${this.name||"node material"}");\r\n`;for(const n of t)n.isInput&&-1===e.indexOf(n)&&(r+=n._dumpCode(i,e));for(const t of n)t.isInput&&-1===e.indexOf(t)&&(r+=t._dumpCode(i,e));e=[],r+="\r\n// Connections\r\n";for(const t of this._vertexOutputNodes)r+=t._dumpCodeForOutputConnections(e);for(const t of this._fragmentOutputNodes)r+=t._dumpCodeForOutputConnections(e);r+="\r\n// Output nodes\r\n";for(const e of this._vertexOutputNodes)r+=`nodeMaterial.addOutputNode(${e._codeVariableName});\r\n`;for(const e of this._fragmentOutputNodes)r+=`nodeMaterial.addOutputNode(${e._codeVariableName});\r\n`;return r+="nodeMaterial.build();\r\n",r}serialize(e){const t=e?{}:x.p4.Serialize(this);t.editorData=JSON.parse(JSON.stringify(this.editorData));let i=[];if(e)i=e;else{t.customType="BABYLON.NodeMaterial",t.outputNodes=[];for(const e of this._vertexOutputNodes)this._gatherBlocks(e,i),t.outputNodes.push(e.uniqueId);for(const e of this._fragmentOutputNodes)this._gatherBlocks(e,i),-1===t.outputNodes.indexOf(e.uniqueId)&&t.outputNodes.push(e.uniqueId)}t.blocks=[];for(const e of i)t.blocks.push(e.serialize());if(!e)for(const e of this.attachedBlocks)-1===i.indexOf(e)&&t.blocks.push(e.serialize());return t}_restoreConnections(e,t,i){for(const n of e.outputs)for(const r of t.blocks){const s=i[r.id];if(s)for(const o of r.inputs)if(i[o.targetBlockId]!==e||o.targetConnectionName!==n.name);else{const e=s.getInputByName(o.inputName);if(!e||e.isConnected)continue;n.connectTo(e,!0),this._restoreConnections(s,t,i)}}}parseSerializedObject(e,t="",i=!1){var n;i||this.clear();const r={};for(const i of e.blocks){const e=(0,S.q)(i.customType);if(e){const n=new e;n._deserialize(i,this.getScene(),t),r[i.id]=n,this.attachedBlocks.push(n)}}for(let t=0;tnew Y(e,this.getScene(),this.options)),this);return n.id=e,n.name=e,n.parseSerializedObject(i),n._buildId=this._buildId,n.build(!1,!t),n}static Parse(e,t,i=""){const n=x.p4.Parse((()=>new Y(e.name,t)),e,t,i);return n.parseSerializedObject(e,i),n.build(),n}static async ParseFromFileAsync(e,t,i,n="",r=!1,s){const o=null!=s?s:new Y(e,i),a=await i._loadFileAsync(t),l=JSON.parse(a);return o.parseSerializedObject(l,n),r||o.build(),o}static ParseFromSnippetAsync(e,t=z.l.LastCreatedScene,i="",n,r=!1){return"_BLANK"===e?Promise.resolve(Y.CreateDefault("blank",t)):new Promise(((s,o)=>{const a=new M.g;a.addEventListener("readystatechange",(()=>{if(4==a.readyState)if(200==a.status){const l=JSON.parse(JSON.parse(a.responseText).jsonPayload),c=JSON.parse(l.nodeMaterial);n||((n=x.p4.Parse((()=>new Y(e,t)),c,t,i)).uniqueId=t.getUniqueId()),n.parseSerializedObject(c),n.snippetId=e;try{r||n.build(),s(n)}catch(e){o(e)}}else o("Unable to load the snippet "+e)})),a.open("GET",this.SnippetUrl+"/"+e.replace(/#/g,"/")),a.send()}))}static CreateDefault(e,t){const i=new Y(e,t);return i.setToDefault(),i.build(),i}}Y._BuildIdGenerator=0,Y.EditorURL=`https://unpkg.com/babylonjs-node-editor@${c.D.Version}/babylon.nodeEditor.js`,Y.SnippetUrl="https://snippet.babylonjs.com",Y.IgnoreTexturesAtLoadTime=!1,(0,n.gn)([(0,x.qC)()],Y.prototype,"ignoreAlpha",void 0),(0,n.gn)([(0,x.qC)()],Y.prototype,"maxSimultaneousLights",void 0),(0,n.gn)([(0,x.qC)("mode")],Y.prototype,"_mode",void 0),(0,n.gn)([(0,x.qC)("comment")],Y.prototype,"comment",void 0),(0,n.gn)([(0,x.qC)()],Y.prototype,"forceAlphaBlending",void 0),(0,S.H)("BABYLON.NodeMaterial",Y)},"../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlock.js":function(e,t,i){"use strict";i.d(t,{k:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlockConnectionPoint.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),o=i("../../../node_modules/@babylonjs/core/Misc/uniqueIdGenerator.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class l{constructor(e,t=s.u.Vertex,i=!1,n=!1){this._isFinalMerger=!1,this._isInput=!1,this._name="",this._isUnique=!1,this.inputsAreExclusive=!1,this._codeVariableName="",this._inputs=new Array,this._outputs=new Array,this.comments="",this.visibleInInspector=!1,this.visibleOnFrame=!1,this._target=t,this._originalTargetIsNeutral=t===s.u.Neutral,this._isFinalMerger=i,this._isInput=n,this._name=e,this.uniqueId=o.K.UniqueId}get name(){return this._name}set name(e){this.validateBlockName(e)&&(this._name=e)}get isUnique(){return this._isUnique}get isFinalMerger(){return this._isFinalMerger}get isInput(){return this._isInput}get buildId(){return this._buildId}set buildId(e){this._buildId=e}get target(){return this._target}set target(e){0==(this._target&e)&&(this._target=e)}get inputs(){return this._inputs}get outputs(){return this._outputs}getInputByName(e){const t=this._inputs.filter((t=>t.name===e));return t.length?t[0]:null}getOutputByName(e){const t=this._outputs.filter((t=>t.name===e));return t.length?t[0]:null}initialize(e){}bind(e,t,i,n){}_declareOutput(e,t){return`${t._getGLType(e.type)} ${e.associatedVariableName}`}_writeVariable(e){return e.connectedPoint?`${e.associatedVariableName}`:"0."}_writeFloat(e){let t=e.toString();return-1===t.indexOf(".")&&(t+=".0"),`${t}`}getClassName(){return"NodeMaterialBlock"}registerInput(e,t,i=!1,n,s){return(s=null!=s?s:new r.VT(e,this,r.Ab.Input)).type=t,s.isOptional=i,n&&(s.target=n),this._inputs.push(s),this}registerOutput(e,t,i,n){return(n=null!=n?n:new r.VT(e,this,r.Ab.Output)).type=t,i&&(n.target=i),this._outputs.push(n),this}getFirstAvailableInput(e=null){for(const t of this._inputs)if(!(t.connectedPoint||e&&e.type!==t.type&&t.type!==n.E.AutoDetect))return t;return null}getFirstAvailableOutput(e=null){for(const t of this._outputs)if(!e||!e.target||e.target===s.u.Neutral||0!=(e.target&t.target))return t;return null}getSiblingOutput(e){const t=this._outputs.indexOf(e);return-1===t||t>=this._outputs.length?null:this._outputs[t+1]}isAnAncestorOf(e){for(const t of this._outputs)if(t.hasEndpoints)for(const i of t.endpoints){if(i.ownerBlock===e)return!0;if(i.ownerBlock.isAnAncestorOf(e))return!0}return!1}connectTo(e,t){if(0===this._outputs.length)return;let i=t&&t.output?this.getOutputByName(t.output):this.getFirstAvailableOutput(e),n=!0;for(;n;){const r=t&&t.input?e.getInputByName(t.input):e.getFirstAvailableInput(i);if(i&&r&&i.canConnectTo(r))i.connectTo(r),n=!1;else{if(!i)throw"Unable to find a compatible match";i=this.getSiblingOutput(i)}}return this}_buildBlock(e){}updateUniformsAndSamples(e,t,i,n){}provideFallbacks(e,t){}initializeDefines(e,t,i,n=!1){}prepareDefines(e,t,i,n=!1,r){}autoConfigure(e){}replaceRepeatableContent(e,t,i,n){}get willBeGeneratedIntoVertexShaderFromFragmentShader(){return!(this.isInput||this.isFinalMerger||this._outputs.some((e=>e.isDirectlyConnectedToVertexOutput))||this.target===s.u.Vertex||this.target!==s.u.VertexAndFragment&&this.target!==s.u.Neutral||!this._outputs.some((e=>e.isConnectedInVertexShader)))}isReady(e,t,i,n=!1){return!0}_linkConnectionTypes(e,t,i=!1){i?this._inputs[t]._acceptedConnectionPointType=this._inputs[e]:this._inputs[e]._linkedConnectionSource=this._inputs[t],this._inputs[t]._linkedConnectionSource=this._inputs[e]}_processBuild(e,t,i,n){e.build(t,n);const r=null!=t._vertexState,o=e._buildTarget===s.u.Vertex&&e.target!==s.u.VertexAndFragment;if(r&&(0==(e.target&e._buildTarget)||0==(e.target&i.target)||this.target!==s.u.VertexAndFragment&&o)&&(!e.isInput&&t.target!==e._buildTarget||e.isInput&&e.isAttribute&&!e._noContextSwitch)){const e=i.connectedPoint;t._vertexState._emitVaryingFromString("v_"+e.associatedVariableName,t._getGLType(e.type))&&(t._vertexState.compilationString+=`${"v_"+e.associatedVariableName} = ${e.associatedVariableName};\r\n`),i.associatedVariableName="v_"+e.associatedVariableName,i._enforceAssociatedVariableName=!0}}validateBlockName(e){const t=["position","normal","tangent","particle_positionw","uv","uv2","uv3","uv4","uv5","uv6","position2d","particle_uv","matricesIndices","matricesWeights","world0","world1","world2","world3","particle_color","particle_texturemask"];for(const i of t)if(e===i)return!1;return!0}build(e,t){if(this._buildId===e.sharedData.buildId)return!0;if(!this.isInput)for(const t of this._outputs)t.associatedVariableName||(t.associatedVariableName=e._getFreeVariableName(t.name));for(const i of this._inputs){if(!i.connectedPoint){i.isOptional||e.sharedData.checks.notConnectedNonOptionalInputs.push(i);continue}if(this.target!==s.u.Neutral){if(0==(i.target&this.target))continue;if(0==(i.target&e.target))continue}const n=i.connectedPoint.ownerBlock;n&&n!==this&&this._processBuild(n,e,i,t)}if(this._buildId===e.sharedData.buildId)return!0;if(e.sharedData.verbose&&console.log(`${e.target===s.u.Vertex?"Vertex shader":"Fragment shader"}: Building ${this.name} [${this.getClassName()}]`),this.isFinalMerger)switch(e.target){case s.u.Vertex:e.sharedData.checks.emitVertex=!0;break;case s.u.Fragment:e.sharedData.checks.emitFragment=!0}!this.isInput&&e.sharedData.emitComments&&(e.compilationString+=`\r\n//${this.name}\r\n`),this._buildBlock(e),this._buildId=e.sharedData.buildId,this._buildTarget=e.target;for(const i of this._outputs)if(0!=(i.target&e.target))for(const n of i.endpoints){const i=n.ownerBlock;i&&0!=(i.target&e.target)&&-1!==t.indexOf(i)&&this._processBuild(i,e,n,t)}return!1}_inputRename(e){return e}_outputRename(e){return e}_dumpPropertiesCode(){const e=this._codeVariableName;return`${e}.visibleInInspector = ${this.visibleInInspector};\r\n${e}.visibleOnFrame = ${this.visibleOnFrame};\r\n${e}.target = ${this.target};\r\n`}_dumpCode(e,t){let i;t.push(this);const n=this.name.replace(/[^A-Za-z_]+/g,"");if(this._codeVariableName=n||`${this.getClassName()}_${this.uniqueId}`,-1!==e.indexOf(this._codeVariableName)){let t=0;do{t++,this._codeVariableName=n+t}while(-1!==e.indexOf(this._codeVariableName))}e.push(this._codeVariableName),i=`\r\n// ${this.getClassName()}\r\n`,this.comments&&(i+=`// ${this.comments}\r\n`),i+=`var ${this._codeVariableName} = new BABYLON.${this.getClassName()}("${this.name}");\r\n`,i+=this._dumpPropertiesCode();for(const n of this.inputs){if(!n.isConnected)continue;const r=n.connectedPoint.ownerBlock;-1===t.indexOf(r)&&(i+=r._dumpCode(e,t))}for(const n of this.outputs)if(n.hasEndpoints)for(const r of n.endpoints){const n=r.ownerBlock;n&&-1===t.indexOf(n)&&(i+=n._dumpCode(e,t))}return i}_dumpCodeForOutputConnections(e){let t="";if(-1!==e.indexOf(this))return t;e.push(this);for(const i of this.inputs){if(!i.isConnected)continue;const n=i.connectedPoint,r=n.ownerBlock;t+=r._dumpCodeForOutputConnections(e),t+=`${r._codeVariableName}.${r._outputRename(n.name)}.connectTo(${this._codeVariableName}.${this._inputRename(i.name)});\r\n`}return t}clone(e,t=""){const i=this.serialize(),n=(0,a.q)(i.customType);if(n){const r=new n;return r._deserialize(i,e,t),r}return null}serialize(){const e={};e.customType="BABYLON."+this.getClassName(),e.id=this.uniqueId,e.name=this.name,e.comments=this.comments,e.visibleInInspector=this.visibleInInspector,e.visibleOnFrame=this.visibleOnFrame,e.target=this.target,e.inputs=[],e.outputs=[];for(const t of this.inputs)e.inputs.push(t.serialize());for(const t of this.outputs)e.outputs.push(t.serialize(!1));return e}_deserialize(e,t,i){var n;this.name=e.name,this.comments=e.comments,this.visibleInInspector=!!e.visibleInInspector,this.visibleOnFrame=!!e.visibleOnFrame,this._target=null!==(n=e.target)&&void 0!==n?n:this.target,this._deserializePortDisplayNamesAndExposedOnFrame(e)}_deserializePortDisplayNamesAndExposedOnFrame(e){const t=e.inputs,i=e.outputs;t&&t.forEach(((e,t)=>{e.displayName&&(this.inputs[t].displayName=e.displayName),e.isExposedOnFrame&&(this.inputs[t].isExposedOnFrame=e.isExposedOnFrame,this.inputs[t].exposedPortPosition=e.exposedPortPosition)})),i&&i.forEach(((e,t)=>{e.displayName&&(this.outputs[t].displayName=e.displayName),e.isExposedOnFrame&&(this.outputs[t].isExposedOnFrame=e.isExposedOnFrame,this.outputs[t].exposedPortPosition=e.exposedPortPosition)}))}dispose(){for(const e of this.inputs)e.dispose();for(const e of this.outputs)e.dispose()}}},"../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialBlockConnectionPoint.js":function(e,t,i){"use strict";i.d(t,{Ab:function(){return r},VT:function(){return l},WS:function(){return n}});var n,r,s=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockConnectionPointTypes.js"),o=i("../../../node_modules/@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets.js"),a=i("../../../node_modules/@babylonjs/core/Misc/observable.js");!function(e){e[e.Compatible=0]="Compatible",e[e.TypeIncompatible=1]="TypeIncompatible",e[e.TargetIncompatible=2]="TargetIncompatible",e[e.HierarchyIssue=3]="HierarchyIssue"}(n||(n={})),function(e){e[e.Input=0]="Input",e[e.Output=1]="Output"}(r||(r={}));class l{constructor(e,t,i){this._connectedPoint=null,this._endpoints=new Array,this._typeConnectionSource=null,this._defaultConnectionPointType=null,this._linkedConnectionSource=null,this._acceptedConnectionPointType=null,this._type=s.E.Float,this._enforceAssociatedVariableName=!1,this.needDualDirectionValidation=!1,this.acceptedConnectionPointTypes=new Array,this.excludedConnectionPointTypes=new Array,this.onConnectionObservable=new a.y$,this.isExposedOnFrame=!1,this.exposedPortPosition=-1,this._prioritizeVertex=!1,this._target=o.u.VertexAndFragment,this._ownerBlock=t,this.name=e,this._direction=i}static AreEquivalentTypes(e,t){switch(e){case s.E.Vector3:if(t===s.E.Color3)return!0;break;case s.E.Vector4:if(t===s.E.Color4)return!0;break;case s.E.Color3:if(t===s.E.Vector3)return!0;break;case s.E.Color4:if(t===s.E.Vector4)return!0}return!1}get direction(){return this._direction}get associatedVariableName(){return this._ownerBlock.isInput?this._ownerBlock.associatedVariableName:this._enforceAssociatedVariableName&&this._associatedVariableName||!this._connectedPoint?this._associatedVariableName:this._connectedPoint.associatedVariableName}set associatedVariableName(e){this._associatedVariableName=e}get innerType(){return this._linkedConnectionSource&&this._linkedConnectionSource.isConnected?this.type:this._type}get type(){if(this._type===s.E.AutoDetect){if(this._ownerBlock.isInput)return this._ownerBlock.type;if(this._connectedPoint)return this._connectedPoint.type;if(this._linkedConnectionSource&&this._linkedConnectionSource.isConnected)return this._linkedConnectionSource.type}if(this._type===s.E.BasedOnInput){if(this._typeConnectionSource)return!this._typeConnectionSource.isConnected&&this._defaultConnectionPointType?this._defaultConnectionPointType:this._typeConnectionSource.type;if(this._defaultConnectionPointType)return this._defaultConnectionPointType}return this._type}set type(e){this._type=e}get target(){return this._prioritizeVertex&&this._ownerBlock?this._target!==o.u.VertexAndFragment?this._target:this._ownerBlock.target===o.u.Fragment?o.u.Fragment:o.u.Vertex:this._target}set target(e){this._target=e}get isConnected(){return null!==this.connectedPoint||this.hasEndpoints}get isConnectedToInputBlock(){return null!==this.connectedPoint&&this.connectedPoint.ownerBlock.isInput}get connectInputBlock(){return this.isConnectedToInputBlock?this.connectedPoint.ownerBlock:null}get connectedPoint(){return this._connectedPoint}get ownerBlock(){return this._ownerBlock}get sourceBlock(){return this._connectedPoint?this._connectedPoint.ownerBlock:null}get connectedBlocks(){return 0===this._endpoints.length?[]:this._endpoints.map((e=>e.ownerBlock))}get endpoints(){return this._endpoints}get hasEndpoints(){return this._endpoints&&this._endpoints.length>0}get isDirectlyConnectedToVertexOutput(){if(!this.hasEndpoints)return!1;for(const e of this._endpoints){if(e.ownerBlock.target===o.u.Vertex)return!0;if((e.ownerBlock.target===o.u.Neutral||e.ownerBlock.target===o.u.VertexAndFragment)&&e.ownerBlock.outputs.some((e=>e.isDirectlyConnectedToVertexOutput)))return!0}return!1}get isConnectedInVertexShader(){if(this.target===o.u.Vertex)return!0;if(!this.hasEndpoints)return!1;for(const e of this._endpoints){if(e.ownerBlock.target===o.u.Vertex)return!0;if(e.target===o.u.Vertex)return!0;if((e.ownerBlock.target===o.u.Neutral||e.ownerBlock.target===o.u.VertexAndFragment)&&e.ownerBlock.outputs.some((e=>e.isConnectedInVertexShader)))return!0}return!1}get isConnectedInFragmentShader(){if(this.target===o.u.Fragment)return!0;if(!this.hasEndpoints)return!1;for(const e of this._endpoints){if(e.ownerBlock.target===o.u.Fragment)return!0;if((e.ownerBlock.target===o.u.Neutral||e.ownerBlock.target===o.u.VertexAndFragment)&&e.ownerBlock.outputs.some((e=>e.isConnectedInFragmentShader)))return!0}return!1}createCustomInputBlock(){return null}getClassName(){return"NodeMaterialConnectionPoint"}canConnectTo(e){return this.checkCompatibilityState(e)===n.Compatible}checkCompatibilityState(e){const t=this._ownerBlock,i=e.ownerBlock;if(t.target===o.u.Fragment){if(i.target===o.u.Vertex)return n.TargetIncompatible;for(const e of i.outputs)if(e.ownerBlock.target!=o.u.Neutral&&e.isConnectedInVertexShader)return n.TargetIncompatible}if(this.type!==e.type&&e.innerType!==s.E.AutoDetect)return l.AreEquivalentTypes(this.type,e.type)||e.acceptedConnectionPointTypes&&-1!==e.acceptedConnectionPointTypes.indexOf(this.type)||e._acceptedConnectionPointType&&l.AreEquivalentTypes(e._acceptedConnectionPointType.type,this.type)?n.Compatible:n.TypeIncompatible;if(e.excludedConnectionPointTypes&&-1!==e.excludedConnectionPointTypes.indexOf(this.type))return n.TypeIncompatible;let a=i,c=t;return this.direction===r.Input&&(a=t,c=i),a.isAnAncestorOf(c)?n.HierarchyIssue:n.Compatible}connectTo(e,t=!1){if(!t&&!this.canConnectTo(e))throw"Cannot connect these two connectors.";return this._endpoints.push(e),e._connectedPoint=this,this._enforceAssociatedVariableName=!1,this.onConnectionObservable.notifyObservers(e),e.onConnectionObservable.notifyObservers(this),this}disconnectFrom(e){const t=this._endpoints.indexOf(e);return-1===t||(this._endpoints.splice(t,1),e._connectedPoint=null,this._enforceAssociatedVariableName=!1,e._enforceAssociatedVariableName=!1),this}serialize(e=!0){const t={};return t.name=this.name,t.displayName=this.displayName,e&&this.connectedPoint&&(t.inputName=this.name,t.targetBlockId=this.connectedPoint.ownerBlock.uniqueId,t.targetConnectionName=this.connectedPoint.name,t.isExposedOnFrame=!0,t.exposedPortPosition=this.exposedPortPosition),(this.isExposedOnFrame||this.exposedPortPosition>=0)&&(t.isExposedOnFrame=!0,t.exposedPortPosition=this.exposedPortPosition),t}dispose(){this.onConnectionObservable.clear()}}},"../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterialDecorator.js":function(e,t,i){"use strict";var n;function r(e,t=n.Boolean,i="PROPERTIES",r){return(n,s)=>{let o=n._propStore;o||(o=[],n._propStore=o),o.push({propertyName:s,displayName:e,type:t,groupName:i,options:null!=r?r:{}})}}i.d(t,{U:function(){return n},p:function(){return r}}),function(e){e[e.Boolean=0]="Boolean",e[e.Float=1]="Float",e[e.Int=2]="Int",e[e.Vector2=3]="Vector2",e[e.List=4]="List"}(n||(n={}))},"../../../node_modules/@babylonjs/core/Materials/PBR/pbrAnisotropicConfiguration.js":function(e,t,i){"use strict";i.d(t,{u:function(){return d}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),a=i("../../../node_modules/@babylonjs/core/Materials/materialFlags.js"),l=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),c=i("../../../node_modules/@babylonjs/core/Materials/materialPluginBase.js"),h=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js");class _ extends h.H{constructor(){super(...arguments),this.ANISOTROPIC=!1,this.ANISOTROPIC_TEXTURE=!1,this.ANISOTROPIC_TEXTUREDIRECTUV=0,this.MAINUV1=!1}}class d extends c.n{constructor(e,t=!0){super(e,"PBRAnisotropic",110,new _,t),this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.direction=new o.FM(1,0),this._texture=null,this.texture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isReadyForSubMesh(e,t){return!this._isEnabled||!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&a.k.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())}prepareDefinesBeforeAttributes(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!i.isVerticesDataPresent(s.o.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&a.k.AnisotropicTextureEnabled?l.G.PrepareDefinesForMergedUV(this._texture,e,"ANISOTROPIC_TEXTURE"):e.ANISOTROPIC_TEXTURE=!1)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1,e.ANISOTROPIC_TEXTUREDIRECTUV=0,e.MAINUV1=!1)}bindForSubMesh(e,t){if(!this._isEnabled)return;const i=this._material.isFrozen;e.useUbo&&i&&e.isSync||(this._texture&&a.k.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),l.G.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&a.k.AnisotropicTextureEnabled&&e.setTexture("anisotropySampler",this._texture)}hasTexture(e){return this._texture===e}getActiveTextures(e){this._texture&&e.push(this._texture)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)}dispose(e){e&&this._texture&&this._texture.dispose()}getClassName(){return"PBRAnisotropicConfiguration"}addFallbacks(e,t,i){return e.ANISOTROPIC&&t.addFallback(i++,"ANISOTROPIC"),i}getSamplers(e){e.push("anisotropySampler")}getUniforms(){return{ubo:[{name:"vAnisotropy",size:3,type:"vec3"},{name:"vAnisotropyInfos",size:2,type:"vec2"},{name:"anisotropyMatrix",size:16,type:"mat4"}]}}}(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],d.prototype,"isEnabled",void 0),(0,n.gn)([(0,r.qC)()],d.prototype,"intensity",void 0),(0,n.gn)([(0,r.QC)()],d.prototype,"direction",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],d.prototype,"texture",void 0)},"../../../node_modules/@babylonjs/core/Materials/PBR/pbrBRDFConfiguration.js":function(e,t,i){"use strict";i.d(t,{d:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js"),o=i("../../../node_modules/@babylonjs/core/Materials/materialPluginBase.js");class a extends s.H{constructor(){super(...arguments),this.BRDF_V_HEIGHT_CORRELATED=!1,this.MS_BRDF_ENERGY_CONSERVATION=!1,this.SPHERICAL_HARMONICS=!1,this.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=!1}}class l extends o.n{constructor(e,t=!0){super(e,"PBRBRDF",90,new a,t),this._useEnergyConservation=l.DEFAULT_USE_ENERGY_CONSERVATION,this.useEnergyConservation=l.DEFAULT_USE_ENERGY_CONSERVATION,this._useSmithVisibilityHeightCorrelated=l.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this.useSmithVisibilityHeightCorrelated=l.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this._useSphericalHarmonics=l.DEFAULT_USE_SPHERICAL_HARMONICS,this.useSphericalHarmonics=l.DEFAULT_USE_SPHERICAL_HARMONICS,this._useSpecularGlossinessInputEnergyConservation=l.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this.useSpecularGlossinessInputEnergyConservation=l.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,this._internalMarkAllSubMeshesAsMiscDirty=e._dirtyCallbacks[16],this._enable(!0)}_markAllSubMeshesAsMiscDirty(){this._internalMarkAllSubMeshesAsMiscDirty()}prepareDefines(e){e.BRDF_V_HEIGHT_CORRELATED=this._useSmithVisibilityHeightCorrelated,e.MS_BRDF_ENERGY_CONSERVATION=this._useEnergyConservation&&this._useSmithVisibilityHeightCorrelated,e.SPHERICAL_HARMONICS=this._useSphericalHarmonics,e.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=this._useSpecularGlossinessInputEnergyConservation}getClassName(){return"PBRBRDFConfiguration"}}l.DEFAULT_USE_ENERGY_CONSERVATION=!0,l.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED=!0,l.DEFAULT_USE_SPHERICAL_HARMONICS=!0,l.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION=!0,(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsMiscDirty")],l.prototype,"useEnergyConservation",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsMiscDirty")],l.prototype,"useSmithVisibilityHeightCorrelated",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsMiscDirty")],l.prototype,"useSphericalHarmonics",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsMiscDirty")],l.prototype,"useSpecularGlossinessInputEnergyConservation",void 0)},"../../../node_modules/@babylonjs/core/Materials/PBR/pbrBaseMaterial.js":function(e,t,i){"use strict";i.d(t,{m:function(){return w}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),o=i("../../../node_modules/@babylonjs/core/Misc/smartArray.js"),a=i("../../../node_modules/@babylonjs/core/Misc/brdfTextureTools.js"),l=i("../../../node_modules/@babylonjs/core/scene.js"),c=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),h=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),_=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrBRDFConfiguration.js"),d=i("../../../node_modules/@babylonjs/core/Materials/prePassConfiguration.js"),u=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),p=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js"),f=i("../../../node_modules/@babylonjs/core/Materials/imageProcessingConfiguration.js"),m=i("../../../node_modules/@babylonjs/core/Materials/material.js"),g=i("../../../node_modules/@babylonjs/core/Materials/materialPluginEvent.js"),b=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js"),y=i("../../../node_modules/@babylonjs/core/Materials/pushMaterial.js"),v=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),A=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),C=i("../../../node_modules/@babylonjs/core/Materials/materialFlags.js"),S=(i("../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.polynomial.js"),i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js"));i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/oitDeclaration.js");S.v.IncludesShadersStore.pbrFragmentDeclaration="uniform vec4 vEyePosition;\nuniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\nuniform vec4 vLightingIntensity;\nuniform vec4 vReflectivityColor;\nuniform vec4 vMetallicReflectanceFactors;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\nuniform vec3 vAmbientColor;\n#ifdef ALBEDO\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REALTIME_FILTERING\nuniform vec2 vReflectionFilteringInfo;\n#endif\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize; \n#endif\n#endif\n#if defined(SS_REFRACTION) && defined(SS_USE_LOCAL_REFRACTIONMAP_CUBIC)\nuniform vec3 vRefractionPosition;\nuniform vec3 vRefractionSize; \n#endif\n#ifdef CLEARCOAT\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nuniform vec4 vClearCoatInfos;\n#endif\n#ifdef CLEARCOAT_TEXTURE\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\nuniform mat4 clearCoatRoughnessMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#endif\n#ifdef IRIDESCENCE\nuniform vec4 vIridescenceParams;\n#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)\nuniform vec4 vIridescenceInfos;\n#endif\n#ifdef IRIDESCENCE_TEXTURE\nuniform mat4 iridescenceMatrix;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nuniform mat4 iridescenceThicknessMatrix;\n#endif\n#endif\n#ifdef ANISOTROPIC\nuniform vec3 vAnisotropy;\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n#ifdef SHEEN\nuniform vec4 vSheenColor;\n#ifdef SHEEN_ROUGHNESS\nuniform float vSheenRoughness;\n#endif\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\nuniform vec4 vSheenInfos;\n#endif\n#ifdef SHEEN_TEXTURE\nuniform mat4 sheenMatrix;\n#endif\n#ifdef SHEEN_TEXTURE_ROUGHNESS\nuniform mat4 sheenRoughnessMatrix;\n#endif\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#ifdef REALTIME_FILTERING\nuniform vec2 vRefractionFilteringInfo;\n#endif\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nuniform vec2 vRefractionIntensityInfos;\nuniform mat4 refractionIntensityMatrix;\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nuniform vec2 vTranslucencyIntensityInfos;\nuniform mat4 translucencyIntensityMatrix;\n#endif\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n#endif\n#ifdef PREPASS\n#ifdef SS_SCATTERING\nuniform float scatteringDiffusionProfile;\n#endif\n#endif\n#if DEBUGMODE>0\nuniform vec2 vDebugMode;\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;\nuniform vec3 vSphericalL1_1;\nuniform vec3 vSphericalL10;\nuniform vec3 vSphericalL11;\nuniform vec3 vSphericalL2_2;\nuniform vec3 vSphericalL2_1;\nuniform vec3 vSphericalL20;\nuniform vec3 vSphericalL21;\nuniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX_ZZ;\nuniform vec3 vSphericalYY_ZZ;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\n#endif\n#endif\n#define ADDITIONAL_FRAGMENT_DECLARATION\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/sceneUboDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/meshUboDeclaration.js");S.v.IncludesShadersStore.pbrUboDeclaration="layout(std140,column_major) uniform;\nuniform Material {\nvec2 vAlbedoInfos;\nvec4 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec3 vReflectivityInfos;\nvec2 vMicroSurfaceSamplerInfos;\nvec2 vReflectionInfos;\nvec2 vReflectionFilteringInfo;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec3 vBumpInfos;\nmat4 albedoMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 reflectivityMatrix;\nmat4 microSurfaceSamplerMatrix;\nmat4 bumpMatrix;\nvec2 vTangentSpaceParams;\nmat4 reflectionMatrix;\nvec3 vReflectionColor;\nvec4 vAlbedoColor;\nvec4 vLightingIntensity;\nvec3 vReflectionMicrosurfaceInfos;\nfloat pointSize;\nvec4 vReflectivityColor;\nvec3 vEmissiveColor;\nvec3 vAmbientColor;\nvec2 vDebugMode;\nvec4 vMetallicReflectanceFactors;\nvec2 vMetallicReflectanceInfos;\nmat4 metallicReflectanceMatrix;\nvec2 vReflectanceInfos;\nmat4 reflectanceMatrix;\nvec3 vSphericalL00;\nvec3 vSphericalL1_1;\nvec3 vSphericalL10;\nvec3 vSphericalL11;\nvec3 vSphericalL2_2;\nvec3 vSphericalL2_1;\nvec3 vSphericalL20;\nvec3 vSphericalL21;\nvec3 vSphericalL22;\nvec3 vSphericalX;\nvec3 vSphericalY;\nvec3 vSphericalZ;\nvec3 vSphericalXX_ZZ;\nvec3 vSphericalYY_ZZ;\nvec3 vSphericalZZ;\nvec3 vSphericalXY;\nvec3 vSphericalYZ;\nvec3 vSphericalZX;\n#define ADDITIONAL_UBO_DECLARATION\n};\n#include\n#include\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/mainUVVaryingDeclaration.js");S.v.IncludesShadersStore.pbrFragmentExtraDeclaration="varying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#include[1..7]\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerFragmentDeclaration.js");S.v.IncludesShadersStore.samplerFragmentAlternateDeclaration="#ifdef _DEFINENAME_\n#if _DEFINENAME_DIRECTUV==1\n#define v_VARYINGNAME_UV vMainUV1\n#elif _DEFINENAME_DIRECTUV==2\n#define v_VARYINGNAME_UV vMainUV2\n#elif _DEFINENAME_DIRECTUV==3\n#define v_VARYINGNAME_UV vMainUV3\n#elif _DEFINENAME_DIRECTUV==4\n#define v_VARYINGNAME_UV vMainUV4\n#elif _DEFINENAME_DIRECTUV==5\n#define v_VARYINGNAME_UV vMainUV5\n#elif _DEFINENAME_DIRECTUV==6\n#define v_VARYINGNAME_UV vMainUV6\n#else\nvarying vec2 v_VARYINGNAME_UV;\n#endif\n#endif\n";S.v.IncludesShadersStore.pbrFragmentSamplersDeclaration="#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL)\nuniform sampler2D clearCoatRoughnessSampler;\n#endif\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL)\nuniform sampler2D sheenRoughnessSampler;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy)\n#endif\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform samplerCube irradianceSampler;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D reflectionSamplerLow;\nuniform sampler2D reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform sampler2D irradianceSampler;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D refractionSamplerLow;\nuniform sampler2D refractionSamplerHigh;\n#endif\n#endif\n#endif\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity)\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/subSurfaceScatteringFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/importanceSampling.js");S.v.IncludesShadersStore.pbrHelperFunctions="#define RECIPROCAL_PI2 0.15915494\n#define RECIPROCAL_PI 0.31830988618\n#define MINIMUMVARIANCE 0.0005\nfloat convertRoughnessToAverageSlope(float roughness)\n{\nreturn square(roughness)+MINIMUMVARIANCE;\n}\nfloat fresnelGrazingReflectance(float reflectance0) {\nfloat reflectance90=saturate(reflectance0*25.0);\nreturn reflectance90;\n}\nvec2 getAARoughnessFactors(vec3 normalVector) {\n#ifdef SPECULARAA\nvec3 nDfdx=dFdx(normalVector.xyz);\nvec3 nDfdy=dFdy(normalVector.xyz);\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\nfloat geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\ngeometricAlphaGFactor*=0.75;\nreturn vec2(geometricRoughnessFactor,geometricAlphaGFactor);\n#else\nreturn vec2(0.);\n#endif\n}\n#ifdef ANISOTROPIC\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {\nfloat alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);\nfloat alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);\nreturn vec2(alphaT,alphaB);\n}\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {\nvec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);\nvec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);\nvec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));\nreturn anisotropicNormal;\n}\n#endif\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\nvec3 cocaLambert(vec3 alpha,float distance) {\nreturn exp(-alpha*distance);\n}\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {\nreturn cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));\n}\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {\nreturn -log(color)/distance;\n}\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 clearCoatAbsorption=mix(vec3(1.0),\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\nclearCoatIntensity);\nreturn clearCoatAbsorption;\n}\n#endif\n#ifdef MICROSURFACEAUTOMATIC\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\nreturn microSurface;\n}\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js");S.v.IncludesShadersStore.harmonicsFunctions="#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nvec3 computeEnvironmentIrradiance(vec3 normal) {\nreturn vSphericalL00\n+ vSphericalL1_1*(normal.y)\n+ vSphericalL10*(normal.z)\n+ vSphericalL11*(normal.x)\n+ vSphericalL2_2*(normal.y*normal.x)\n+ vSphericalL2_1*(normal.y*normal.z)\n+ vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+ vSphericalL21*(normal.z*normal.x)\n+ vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));\n}\n#else\nvec3 computeEnvironmentIrradiance(vec3 normal) {\nfloat Nx=normal.x;\nfloat Ny=normal.y;\nfloat Nz=normal.z;\nvec3 C1=vSphericalZZ.rgb;\nvec3 Cx=vSphericalX.rgb;\nvec3 Cy=vSphericalY.rgb;\nvec3 Cz=vSphericalZ.rgb;\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\nvec3 Cxy=vSphericalXY.rgb;\nvec3 Cyz=vSphericalYZ.rgb;\nvec3 Czx=vSphericalZX.rgb;\nvec3 a1=Cyy_zz*Ny+Cy;\nvec3 a2=Cyz*Nz+a1;\nvec3 b1=Czx*Nz+Cx;\nvec3 b2=Cxy*Ny+b1;\nvec3 b3=Cxx_zz*Nx+b2;\nvec3 t1=Cz *Nz+C1;\nvec3 t2=a2 *Ny+t1;\nvec3 t3=b3 *Nx+t2;\nreturn t3;\n}\n#endif\n#endif\n";S.v.IncludesShadersStore.pbrDirectLightingSetupFunctions="struct preLightingInfo\n{\nvec3 lightOffset;\nfloat lightDistanceSquared;\nfloat lightDistance;\nfloat attenuation;\nvec3 L;\nvec3 H;\nfloat NdotV;\nfloat NdotLUnclamped;\nfloat NdotL;\nfloat VdotH;\nfloat roughness;\n#ifdef IRIDESCENCE\nfloat iridescenceIntensity;\n#endif\n};\npreLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\nresult.lightOffset=lightData.xyz-vPositionW;\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\nresult.lightDistance=sqrt(result.lightDistanceSquared);\nresult.L=normalize(result.lightOffset);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\nresult.lightDistance=length(-lightData.xyz);\nresult.L=normalize(-lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\nresult.NdotL=dot(N,lightData.xyz)*0.5+0.5;\nresult.NdotL=saturateEps(result.NdotL);\nresult.NdotLUnclamped=result.NdotL;\n#ifdef SPECULARTERM\nresult.L=normalize(lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\n#endif\nreturn result;\n}";S.v.IncludesShadersStore.pbrDirectLightingFalloffFunctions="float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{\nreturn max(0.,1.0-length(lightOffset)/range);\n}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{\nreturn 1.0/maxEps(lightDistanceSquared);\n}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{\nfloat lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);\nfloat factor=lightDistanceSquared*inverseSquaredRange;\nfloat attenuation=saturate(1.0-factor*factor);\nattenuation*=attenuation;\nlightDistanceFalloff*=attenuation;\nreturn lightDistanceFalloff;\n}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{\nfloat falloff=0.0;\nfloat cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));\nif (cosAngle>=cosHalfAngle)\n{\nfalloff=max(0.,pow(cosAngle,exponent));\n}\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977; \nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{\nfloat cd=dot(-lightDirection,directionToLightCenterW);\nfloat falloff=saturate(cd*lightAngleScale+lightAngleOffset);\nfalloff*=falloff;\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBRDFFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/hdrFilteringFunctions.js");S.v.IncludesShadersStore.pbrDirectLightingFunctions="#define CLEARCOATREFLECTANCE90 1.0\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef CLEARCOAT\nvec4 clearCoat;\n#endif\n#ifdef SHEEN\nvec3 sheen;\n#endif\n};\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\nfloat lightRoughness=lightRadius/lightDistance;\nfloat totalRoughness=saturate(lightRoughness+roughness);\nreturn totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {\nreturn mix(groundColor,lightColor,info.NdotL);\n}\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {\nfloat diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;\n}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn toLinearSpace(textureColor);\n}\n#ifdef SS_TRANSLUCENCY\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {\nfloat NdotL=absEps(info.NdotLUnclamped);\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);\nfloat trAdapt=step(0.,info.NdotLUnclamped);\nvec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\n}\n#endif\n#ifdef SPECULARTERM\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\n#ifdef IRIDESCENCE\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfloat smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nfloat smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvec3 specTerm=fresnel*distribution*smithVisibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef ANISOTROPIC\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat TdotH=dot(T,info.H);\nfloat BdotH=dot(B,info.H);\nfloat TdotV=dot(T,V);\nfloat BdotV=dot(B,V);\nfloat TdotL=dot(T,info.L);\nfloat BdotL=dot(B,info.L);\nfloat alphaG=convertRoughnessToAverageSlope(info.roughness);\nvec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);\nalphaTB=max(alphaTB,square(geometricRoughnessFactor));\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\n#ifdef IRIDESCENCE\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);\nfloat smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\nvec3 specTerm=fresnel*distribution*smithVisibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef CLEARCOAT\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {\nfloat NccdotL=saturateEps(dot(Ncc,info.L));\nfloat NccdotH=saturateEps(dot(Ncc,info.H));\nfloat clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\nfloat fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnel*=clearCoatIntensity;\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);\nfloat kelemenVisibility=visibility_Kelemen(info.VdotH);\nfloat clearCoatTerm=fresnel*distribution*kelemenVisibility;\nreturn vec4(\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\n1.0-fresnel\n);\n}\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);\nfloat NdotLRefract=saturateEps(dot(Ncc,LRefract));\nvec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\nreturn absorption;\n}\n#endif\n#ifdef SHEEN\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nfloat fresnel=1.;\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\n/*#ifdef SHEEN_SOFTER\nfloat visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);\n#else */\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\n/* #endif */\nfloat sheenTerm=fresnel*distribution*visibility;\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n";S.v.IncludesShadersStore.pbrIBLFunctions="#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\nfloat microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;\nfloat lod=log2(microsurfaceAverageSlopeTexels);\nreturn lod;\n}\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {\nfloat lod=log2(cubeMapDimensionPixels)*roughness;\nreturn lod;\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\nfloat temp=NdotVUnclamped+ambientOcclusion;\nreturn saturate(square(temp)-1.0+ambientOcclusion);\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {\nvec3 reflection=reflect(view,normal);\nfloat temp=saturate(1.0+1.1*dot(reflection,geometricNormal));\nreturn square(temp);\n}\n#endif\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\n#define UNPACK_LOD(x) (1.0-x)*255.0\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\nfloat microsurfaceAverageSlope=alphaG;\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\nreturn getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);\n}\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentMainFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/reflectionFunction.js");S.v.IncludesShadersStore.pbrBlockAlbedoOpacity="struct albedoOpacityOutParams\n{\nvec3 surfaceAlbedo;\nfloat alpha;\n};\n#define pbr_inline\nvoid albedoOpacityBlock(\nin vec4 vAlbedoColor,\n#ifdef ALBEDO\nin vec4 albedoTexture,\nin vec2 albedoInfos,\n#endif\n#ifdef OPACITY\nin vec4 opacityMap,\nin vec2 vOpacityInfos,\n#endif\n#ifdef DETAIL\nin vec4 detailColor,\nin vec4 vDetailInfos,\n#endif\nout albedoOpacityOutParams outParams\n)\n{\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\nfloat alpha=vAlbedoColor.a;\n#ifdef ALBEDO\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\nalpha*=albedoTexture.a;\n#endif\n#ifdef GAMMAALBEDO\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\n#else\nsurfaceAlbedo*=albedoTexture.rgb;\n#endif\nsurfaceAlbedo*=albedoInfos.y;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nsurfaceAlbedo*=vColor.rgb;\n#endif\n#ifdef DETAIL\nfloat detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);\nsurfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo; \n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\n#ifdef OPACITY\n#ifdef OPACITYRGB\nalpha=getLuminance(opacityMap.rgb);\n#else\nalpha*=opacityMap.a;\n#endif\nalpha*=vOpacityInfos.y;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\n#ifdef ALPHATEST\nif (alpha0\nvec4 surfaceMetallicColorMap;\nvec4 surfaceReflectivityColorMap;\nvec2 metallicRoughness;\nvec3 metallicF0;\n#endif\n};\n#define pbr_inline\nvoid reflectivityBlock(\nin vec4 vReflectivityColor,\n#ifdef METALLICWORKFLOW\nin vec3 surfaceAlbedo,\nin vec4 metallicReflectanceFactors,\n#endif\n#ifdef REFLECTIVITY\nin vec3 reflectivityInfos,\nin vec4 surfaceMetallicOrReflectivityColorMap,\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\nin vec3 ambientOcclusionColorIn,\n#endif\n#ifdef MICROSURFACEMAP\nin vec4 microSurfaceTexel,\n#endif\n#ifdef DETAIL\nin vec4 detailColor,\nin vec4 vDetailInfos,\n#endif\nout reflectivityOutParams outParams\n)\n{\nfloat microSurface=vReflectivityColor.a;\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\n#ifdef REFLECTIVITY\n#if DEBUGMODE>0\noutParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;\n#endif\n#ifdef AOSTOREINMETALMAPRED\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);\noutParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);\n#endif\n#ifdef METALLNESSSTOREINMETALMAPBLUE\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;\n#else\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;\n#endif\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;\n#else\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;\n#endif\n#endif\n#endif\n#ifdef DETAIL\nfloat detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);\nfloat loLerp=mix(0.,metallicRoughness.g,detailRoughness*2.);\nfloat hiLerp=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);\nmetallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5));\n#endif\n#ifdef MICROSURFACEMAP\nmetallicRoughness.g*=microSurfaceTexel.r;\n#endif\n#if DEBUGMODE>0\noutParams.metallicRoughness=metallicRoughness;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\nmicroSurface=1.0-metallicRoughness.g;\nvec3 baseColor=surfaceAlbedo;\n#ifdef FROSTBITE_REFLECTANCE\noutParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);\nsurfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\n#else\nvec3 metallicF0=metallicReflectanceFactors.rgb;\n#if DEBUGMODE>0\noutParams.metallicF0=metallicF0;\n#endif\noutParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0),vec3(0.,0.,0.),metallicRoughness.r);\nsurfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);\n#endif\n#else\n#ifdef REFLECTIVITY\nsurfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;\n#if DEBUGMODE>0\noutParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;\n#endif\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\nmicroSurface*=surfaceMetallicOrReflectivityColorMap.a;\nmicroSurface*=reflectivityInfos.z;\n#else\n#ifdef MICROSURFACEAUTOMATIC\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\n#endif\n#ifdef MICROSURFACEMAP\nmicroSurface*=microSurfaceTexel.r;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\n#endif\n#endif\n#endif\nmicroSurface=saturate(microSurface);\nfloat roughness=1.-microSurface;\noutParams.microSurface=microSurface;\noutParams.roughness=roughness;\noutParams.surfaceReflectivityColor=surfaceReflectivityColor;\n}\n";S.v.IncludesShadersStore.pbrBlockAmbientOcclusion="struct ambientOcclusionOutParams\n{\nvec3 ambientOcclusionColor;\n#if DEBUGMODE>0\nvec3 ambientOcclusionColorMap;\n#endif\n};\n#define pbr_inline\nvoid ambientOcclusionBlock(\n#ifdef AMBIENT\nin vec3 ambientOcclusionColorMap_,\nin vec4 vAmbientInfos,\n#endif\nout ambientOcclusionOutParams outParams\n)\n{\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y;\n#ifdef AMBIENTINGRAYSCALE\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\n#endif\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\n#if DEBUGMODE>0\noutParams.ambientOcclusionColorMap=ambientOcclusionColorMap;\n#endif\n#endif\noutParams.ambientOcclusionColor=ambientOcclusionColor;\n}\n";S.v.IncludesShadersStore.pbrBlockAlphaFresnel="#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\nstruct alphaFresnelOutParams\n{\nfloat alpha;\n};\n#define pbr_inline\nvoid alphaFresnelBlock(\nin vec3 normalW,\nin vec3 viewDirectionW,\nin float alpha,\nin float microSurface,\nout alphaFresnelOutParams outParams\n)\n{\nfloat opacityPerceptual=alpha;\n#ifdef LINEARALPHAFRESNEL\nfloat opacity0=opacityPerceptual;\n#else\nfloat opacity0=opacityPerceptual*opacityPerceptual;\n#endif\nfloat opacity90=fresnelGrazingReflectance(opacity0);\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\noutParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\n#ifdef ALPHATEST\nif (outParams.alpha0\nvec3 anisotropyMapData;\n#endif\n};\n#define pbr_inline\nvoid anisotropicBlock(\nin vec3 vAnisotropy,\n#ifdef ANISOTROPIC_TEXTURE\nin vec3 anisotropyMapData,\n#endif\nin mat3 TBN,\nin vec3 normalW,\nin vec3 viewDirectionW,\nout anisotropicOutParams outParams\n)\n{\nfloat anisotropy=vAnisotropy.b;\nvec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);\n#ifdef ANISOTROPIC_TEXTURE\nanisotropy*=anisotropyMapData.b;\nanisotropyDirection.rg*=anisotropyMapData.rg*2.0-1.0;\n#if DEBUGMODE>0\noutParams.anisotropyMapData=anisotropyMapData;\n#endif\n#endif\nmat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));\nvec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);\nvec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));\noutParams.anisotropy=anisotropy;\noutParams.anisotropicTangent=anisotropicTangent;\noutParams.anisotropicBitangent=anisotropicBitangent;\noutParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy);\n}\n#endif\n";S.v.IncludesShadersStore.pbrBlockReflection="#ifdef REFLECTION\nstruct reflectionOutParams\n{\nvec4 environmentRadiance;\nvec3 environmentIrradiance;\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords;\n#else\nvec2 reflectionCoords;\n#endif\n#ifdef SS_TRANSLUCENCY\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nvec3 irradianceVector;\n#endif\n#endif\n#endif\n};\n#define pbr_inline\nvoid createReflectionCoords(\nin vec3 vPositionW,\nin vec3 normalW,\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#ifdef REFLECTIONMAP_3D\nout vec3 reflectionCoords\n#else\nout vec2 reflectionCoords\n#endif\n)\n{\n#ifdef ANISOTROPIC\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal);\n#else\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nreflectionCoords=reflectionVector;\n#else\nreflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n}\n#define pbr_inline\n#define inline\nvoid sampleReflectionTexture(\nin float alphaG,\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nin float NdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nin float roughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\nconst vec3 reflectionCoords,\n#else\nin sampler2D reflectionSampler,\nconst vec2 reflectionCoords,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\nout vec4 environmentRadiance\n)\n{\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\n#elif defined(LINEARSPECULARREFLECTION)\nfloat reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);\n#else\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);\n#endif\n#ifdef LODBASEDMICROSFURACE\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\n#ifdef LODINREFLECTIONALPHA\nfloat automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);\nfloat requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);\n#else\nfloat requestedReflectionLOD=reflectionLOD;\n#endif\n#ifdef REALTIME_FILTERING\nenvironmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);\n#else\nenvironmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#endif\n#else\nfloat lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);\nif (lodReflectionNormalizedDoubled<1.0){\nenvironmentRadiance=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nenvironmentMid,\nlodReflectionNormalizedDoubled\n);\n} else {\nenvironmentRadiance=mix(\nenvironmentMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#ifdef RGBDREFLECTION\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\n#endif\nenvironmentRadiance.rgb*=vReflectionInfos.x;\nenvironmentRadiance.rgb*=vReflectionColor.rgb;\n}\n#define pbr_inline\n#define inline\nvoid reflectionBlock(\nin vec3 vPositionW,\nin vec3 normalW,\nin float alphaG,\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nin float NdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nin float roughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\n#else\nin sampler2D reflectionSampler,\n#endif\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nin vec3 vEnvironmentIrradiance,\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nin mat4 reflectionMatrix,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nin samplerCube irradianceSampler,\n#else\nin sampler2D irradianceSampler,\n#endif\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\nout reflectionOutParams outParams\n)\n{\nvec4 environmentRadiance=vec4(0.,0.,0.,0.);\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=vec3(0.);\n#else\nvec2 reflectionCoords=vec2(0.);\n#endif\ncreateReflectionCoords(\nvPositionW,\nnormalW,\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\nreflectionCoords\n);\nsampleReflectionTexture(\nalphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nroughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nreflectionSampler,\nreflectionCoords,\n#else\nreflectionSampler,\nreflectionCoords,\n#endif\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentRadiance\n);\nvec3 environmentIrradiance=vec3(0.,0.,0.);\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nenvironmentIrradiance=vEnvironmentIrradiance;\n#else\n#ifdef ANISOTROPIC\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz;\n#else\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#if defined(REALTIME_FILTERING)\nenvironmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo);\n#else\nenvironmentIrradiance=computeEnvironmentIrradiance(irradianceVector);\n#endif\n#ifdef SS_TRANSLUCENCY\noutParams.irradianceVector=irradianceVector;\n#endif\n#endif\n#elif defined(USEIRRADIANCEMAP)\nvec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords);\nenvironmentIrradiance=environmentIrradiance4.rgb;\n#ifdef RGBDREFLECTION\nenvironmentIrradiance.rgb=fromRGBD(environmentIrradiance4);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);\n#endif\n#endif\nenvironmentIrradiance*=vReflectionColor.rgb;\noutParams.environmentRadiance=environmentRadiance;\noutParams.environmentIrradiance=environmentIrradiance;\noutParams.reflectionCoords=reflectionCoords;\n}\n#endif\n";S.v.IncludesShadersStore.pbrBlockSheen="#ifdef SHEEN\nstruct sheenOutParams\n{\nfloat sheenIntensity;\nvec3 sheenColor;\nfloat sheenRoughness;\n#ifdef SHEEN_LINKWITHALBEDO\nvec3 surfaceAlbedo;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfloat sheenAlbedoScaling;\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nvec3 finalSheenRadianceScaled;\n#endif\n#if DEBUGMODE>0\nvec4 sheenMapData;\nvec3 sheenEnvironmentReflectance;\n#endif\n};\n#define pbr_inline\n#define inline\nvoid sheenBlock(\nin vec4 vSheenColor,\n#ifdef SHEEN_ROUGHNESS\nin float vSheenRoughness,\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\nin vec4 sheenMapRoughnessData,\n#endif\n#endif\nin float roughness,\n#ifdef SHEEN_TEXTURE\nin vec4 sheenMapData,\nin float sheenMapLevel,\n#endif\nin float reflectance,\n#ifdef SHEEN_LINKWITHALBEDO\nin vec3 baseColor,\nin vec3 surfaceAlbedo,\n#endif\n#ifdef ENVIRONMENTBRDF\nin float NdotV,\nin vec3 environmentBrdf,\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nin vec2 AARoughnessFactors,\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\nin vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\nin vec3 reflectionCoords,\n#else\nin sampler2D reflectionSampler,\nin vec2 reflectionCoords,\n#endif\nin float NdotVUnclamped,\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nin float seo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\nin float eho,\n#endif\n#endif\nout sheenOutParams outParams\n)\n{\nfloat sheenIntensity=vSheenColor.a;\n#ifdef SHEEN_TEXTURE\n#if DEBUGMODE>0\noutParams.sheenMapData=sheenMapData;\n#endif\n#endif\n#ifdef SHEEN_LINKWITHALBEDO\nfloat sheenFactor=pow5(1.0-sheenIntensity);\nvec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);\nfloat sheenRoughness=sheenIntensity;\noutParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;\n#ifdef SHEEN_TEXTURE\nsheenIntensity*=sheenMapData.a;\n#endif\n#else\nvec3 sheenColor=vSheenColor.rgb;\n#ifdef SHEEN_TEXTURE\n#ifdef SHEEN_GAMMATEXTURE\nsheenColor.rgb*=toLinearSpace(sheenMapData.rgb);\n#else\nsheenColor.rgb*=sheenMapData.rgb;\n#endif\nsheenColor.rgb*=sheenMapLevel;\n#endif\n#ifdef SHEEN_ROUGHNESS\nfloat sheenRoughness=vSheenRoughness;\n#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE\n#if defined(SHEEN_TEXTURE)\nsheenRoughness*=sheenMapData.a;\n#endif\n#elif defined(SHEEN_TEXTURE_ROUGHNESS)\n#ifdef SHEEN_TEXTURE_ROUGHNESS_IDENTICAL\nsheenRoughness*=sheenMapData.a;\n#else\nsheenRoughness*=sheenMapRoughnessData.a;\n#endif\n#endif\n#else\nfloat sheenRoughness=roughness;\n#ifdef SHEEN_TEXTURE\nsheenIntensity*=sheenMapData.a;\n#endif\n#endif\n#if !defined(SHEEN_ALBEDOSCALING)\nsheenIntensity*=(1.-reflectance);\n#endif\nsheenColor*=sheenIntensity;\n#endif\n#ifdef ENVIRONMENTBRDF\n/*#ifdef SHEEN_SOFTER\nvec3 environmentSheenBrdf=vec3(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness));\n#else*/\n#ifdef SHEEN_ROUGHNESS\nvec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);\n#else\nvec3 environmentSheenBrdf=environmentBrdf;\n#endif\n/*#endif*/\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nfloat sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);\n#ifdef SPECULARAA\nsheenAlphaG+=AARoughnessFactors.y;\n#endif\nvec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);\nsampleReflectionTexture(\nsheenAlphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nsheenRoughness,\n#endif\nreflectionSampler,\nreflectionCoords,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentSheenRadiance\n);\nvec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nsheenEnvironmentReflectance*=seo;\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\nsheenEnvironmentReflectance*=eho;\n#endif\n#if DEBUGMODE>0\noutParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;\n#endif\noutParams.finalSheenRadianceScaled=\nenvironmentSheenRadiance.rgb *\nsheenEnvironmentReflectance *\nvLightingIntensity.z;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\noutParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;\n#endif\noutParams.sheenIntensity=sheenIntensity;\noutParams.sheenColor=sheenColor;\noutParams.sheenRoughness=sheenRoughness;\n}\n#endif\n";S.v.IncludesShadersStore.pbrBlockClearcoat="struct clearcoatOutParams\n{\nvec3 specularEnvironmentR0;\nfloat conservationFactor;\nvec3 clearCoatNormalW;\nvec2 clearCoatAARoughnessFactors;\nfloat clearCoatIntensity;\nfloat clearCoatRoughness;\n#ifdef REFLECTION\nvec3 finalClearCoatRadianceScaled;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 absorption;\nfloat clearCoatNdotVRefract;\nvec3 clearCoatColor;\nfloat clearCoatThickness;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nvec3 energyConservationFactorClearCoat;\n#endif\n#if DEBUGMODE>0\nmat3 TBNClearCoat;\nvec2 clearCoatMapData;\nvec4 clearCoatTintMapData;\nvec4 environmentClearCoatRadiance;\nfloat clearCoatNdotV;\nvec3 clearCoatEnvironmentReflectance;\n#endif\n};\n#ifdef CLEARCOAT\n#define pbr_inline\n#define inline\nvoid clearcoatBlock(\nin vec3 vPositionW,\nin vec3 geometricNormalW,\nin vec3 viewDirectionW,\nin vec2 vClearCoatParams,\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nin vec4 clearCoatMapRoughnessData,\n#endif\nin vec3 specularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nin vec2 clearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nin vec4 vClearCoatTintParams,\nin float clearCoatColorAtDistance,\nin vec4 vClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nin vec4 clearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nin vec2 vClearCoatBumpInfos,\nin vec4 clearCoatBumpMapData,\nin vec2 vClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nin mat3 vTBN,\n#else\nin vec2 vClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nin mat4 normalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nin vec3 faceNormal,\n#endif\n#ifdef REFLECTION\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\nin vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\n#else\nin sampler2D reflectionSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nin float ambientMonochrome,\n#endif\n#endif\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\nin float frontFacingMultiplier,\n#endif\nout clearcoatOutParams outParams\n)\n{\nfloat clearCoatIntensity=vClearCoatParams.x;\nfloat clearCoatRoughness=vClearCoatParams.y;\n#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\n#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\nclearCoatRoughness*=clearCoatMapData.y;\n#endif\n#if DEBUGMODE>0\noutParams.clearCoatMapData=clearCoatMapData;\n#endif\n#endif\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL\nclearCoatRoughness*=clearCoatMapData.y;\n#else\nclearCoatRoughness*=clearCoatMapRoughnessData.y;\n#endif\n#endif\noutParams.clearCoatIntensity=clearCoatIntensity;\noutParams.clearCoatRoughness=clearCoatRoughness;\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatColor=vClearCoatTintParams.rgb;\nfloat clearCoatThickness=vClearCoatTintParams.a;\n#ifdef CLEARCOAT_TINT_TEXTURE\n#ifdef CLEARCOAT_TINT_GAMMATEXTURE\nclearCoatColor*=toLinearSpace(clearCoatTintMapData.rgb);\n#else\nclearCoatColor*=clearCoatTintMapData.rgb;\n#endif\nclearCoatThickness*=clearCoatTintMapData.a;\n#if DEBUGMODE>0\noutParams.clearCoatTintMapData=clearCoatTintMapData;\n#endif\n#endif\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);\noutParams.clearCoatThickness=clearCoatThickness;\n#endif\n#ifdef CLEARCOAT_REMAP_F0\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\n#else\nvec3 specularEnvironmentR0Updated=specularEnvironmentR0;\n#endif\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);\nvec3 clearCoatNormalW=geometricNormalW;\n#ifdef CLEARCOAT_BUMP\n#ifdef NORMALXYSCALE\nfloat clearCoatNormalScale=1.0;\n#else\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBNClearCoat=vTBN;\n#else\nvec2 TBNClearCoatUV=vClearCoatBumpUV*frontFacingMultiplier;\nmat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);\n#endif\n#if DEBUGMODE>0\noutParams.TBNClearCoat=TBNClearCoat;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);\nclearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\n#else\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nclearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;\n#endif\noutParams.clearCoatNormalW=clearCoatNormalW;\noutParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);\nfloat clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);\nfloat clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\n#if DEBUGMODE>0\noutParams.clearCoatNdotV=clearCoatNdotV;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatVRefract=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);\noutParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));\n#endif\n#if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION))\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\n#endif\n#if defined(REFLECTION)\nfloat clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\n#ifdef SPECULARAA\nclearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;\n#endif\nvec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);\nvec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nclearCoatReflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nvec3 clearCoatReflectionCoords=clearCoatReflectionVector;\n#else\nvec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nclearCoatReflectionCoords/=clearCoatReflectionVector.z;\n#endif\nclearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;\n#endif\nsampleReflectionTexture(\nclearCoatAlphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nclearCoatNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nclearCoatRoughness,\n#endif\nreflectionSampler,\nclearCoatReflectionCoords,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentClearCoatRadiance\n);\n#if DEBUGMODE>0\noutParams.environmentClearCoatRadiance=environmentClearCoatRadiance;\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\n#ifdef RADIANCEOCCLUSION\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\nclearCoatEnvironmentReflectance*=clearCoatSeo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);\nclearCoatEnvironmentReflectance*=clearCoatEho;\n#endif\n#endif\n#endif\n#else\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\n#endif\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\n#if DEBUGMODE>0\noutParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;\n#endif\noutParams.finalClearCoatRadianceScaled=\nenvironmentClearCoatRadiance.rgb *\nclearCoatEnvironmentReflectance *\nvLightingIntensity.z;\n#endif\n#if defined(CLEARCOAT_TINT)\noutParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);\n#endif\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnelIBLClearCoat*=clearCoatIntensity;\noutParams.conservationFactor=(1.-fresnelIBLClearCoat);\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\noutParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);\n#endif\n}\n#endif\n";S.v.IncludesShadersStore.pbrBlockIridescence="struct iridescenceOutParams\n{\nfloat iridescenceIntensity;\nfloat iridescenceIOR;\nfloat iridescenceThickness;\nvec3 specularEnvironmentR0;\n};\n#ifdef IRIDESCENCE\n#define pbr_inline\n#define inline\nvoid iridescenceBlock(\nin vec4 vIridescenceParams,\nin float viewAngle,\nin vec3 specularEnvironmentR0,\n#ifdef IRIDESCENCE_TEXTURE\nin vec2 iridescenceMapData,\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nin vec2 iridescenceThicknessMapData,\n#endif\n#ifdef CLEARCOAT\nin float NdotVUnclamped,\n#ifdef CLEARCOAT_TEXTURE\nin vec2 clearCoatMapData,\n#endif\n#endif\nout iridescenceOutParams outParams\n)\n{\nfloat iridescenceIntensity=vIridescenceParams.x;\nfloat iridescenceIOR=vIridescenceParams.y;\nfloat iridescenceThicknessMin=vIridescenceParams.z;\nfloat iridescenceThicknessMax=vIridescenceParams.w;\nfloat iridescenceThicknessWeight=1.;\n#ifdef IRIDESCENCE_TEXTURE\niridescenceIntensity*=iridescenceMapData.x;\n#ifdef IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE\niridescenceThicknessWeight=iridescenceMapData.g;\n#endif\n#endif\n#if defined(IRIDESCENCE_THICKNESS_TEXTURE)\niridescenceThicknessWeight=iridescenceThicknessMapData.g;\n#endif\nfloat iridescenceThickness=mix(iridescenceThicknessMin,iridescenceThicknessMax,iridescenceThicknessWeight);\nfloat topIor=1.; \n#ifdef CLEARCOAT\nfloat clearCoatIntensity=vClearCoatParams.x;\n#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\n#endif\ntopIor=mix(1.0,vClearCoatRefractionParams.w-1.,clearCoatIntensity);\nviewAngle=sqrt(1.0+square(1.0/topIor)*(square(NdotVUnclamped)-1.0));\n#endif\nvec3 iridescenceFresnel=evalIridescence(topIor,iridescenceIOR,viewAngle,iridescenceThickness,specularEnvironmentR0);\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,iridescenceFresnel,iridescenceIntensity);\noutParams.iridescenceIntensity=iridescenceIntensity;\noutParams.iridescenceThickness=iridescenceThickness;\noutParams.iridescenceIOR=iridescenceIOR;\n}\n#endif\n";S.v.IncludesShadersStore.pbrBlockSubSurface="struct subSurfaceOutParams\n{\nvec3 specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nvec3 finalRefraction;\nvec3 surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nfloat alpha;\n#endif\n#ifdef REFLECTION\nfloat refractionFactorForIrradiance;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvec3 transmittance;\nfloat translucencyIntensity;\n#ifdef REFLECTION\nvec3 refractionIrradiance;\n#endif\n#endif\n#if DEBUGMODE>0\nvec4 thicknessMap;\nvec4 environmentRefraction;\nvec3 refractionTransmittance;\n#endif\n};\n#ifdef SUBSURFACE\n#define pbr_inline\n#define inline\nvoid subSurfaceBlock(\nin vec3 vSubSurfaceIntensity,\nin vec2 vThicknessParam,\nin vec4 vTintColor,\nin vec3 normalW,\nin vec3 specularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nin vec4 thicknessMap,\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nin vec4 refractionIntensityMap,\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nin vec4 translucencyIntensityMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nin mat4 reflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nin vec3 irradianceVector_,\n#endif\n#if defined(REALTIME_FILTERING)\nin samplerCube reflectionSampler,\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nin samplerCube irradianceSampler,\n#else\nin sampler2D irradianceSampler,\n#endif\n#endif\n#endif\n#endif\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\nin vec3 surfaceAlbedo,\n#endif\n#ifdef SS_REFRACTION\nin vec3 vPositionW,\nin vec3 viewDirectionW,\nin mat4 view,\nin vec4 vRefractionInfos,\nin mat4 refractionMatrix,\nin vec4 vRefractionMicrosurfaceInfos,\nin vec4 vLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nin float alpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nin float NdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nin float roughness,\n#endif\nin float alphaG,\n#ifdef SS_REFRACTIONMAP_3D\nin samplerCube refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin samplerCube refractionSamplerLow,\nin samplerCube refractionSamplerHigh,\n#endif\n#else\nin sampler2D refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin sampler2D refractionSamplerLow,\nin sampler2D refractionSamplerHigh,\n#endif\n#endif\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vRefractionFilteringInfo,\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nin vec3 refractionPosition,\nin vec3 refractionSize,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nin vec3 vDiffusionDistance,\n#endif\nout subSurfaceOutParams outParams\n)\n{\noutParams.specularEnvironmentReflectance=specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nfloat refractionIntensity=vSubSurfaceIntensity.x;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nrefractionIntensity*=(1.0-alpha);\noutParams.alpha=1.0;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nfloat translucencyIntensity=vSubSurfaceIntensity.y;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\n#if defined(SS_USE_GLTF_TEXTURES)\nfloat thickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;\n#else\nfloat thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;\n#endif\n#if DEBUGMODE>0\noutParams.thicknessMap=thicknessMap;\n#endif\n#ifdef SS_MASK_FROM_THICKNESS_TEXTURE\n#if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE)\n#if defined(SS_USE_GLTF_TEXTURES)\nrefractionIntensity*=thicknessMap.r;\n#else\nrefractionIntensity*=thicknessMap.g;\n#endif\n#endif\n#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE)\ntranslucencyIntensity*=thicknessMap.b;\n#endif\n#endif\n#else\nfloat thickness=vThicknessParam.y;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\n#ifdef SS_USE_GLTF_TEXTURES\nrefractionIntensity*=refractionIntensityMap.r;\n#else\nrefractionIntensity*=refractionIntensityMap.g;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\ntranslucencyIntensity*=translucencyIntensityMap.b;\n#endif\n#ifdef SS_TRANSLUCENCY\nthickness=maxEps(thickness);\nvec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);\ntransmittance*=translucencyIntensity;\noutParams.transmittance=transmittance;\noutParams.translucencyIntensity=translucencyIntensity;\n#endif\n#ifdef SS_REFRACTION\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\n#ifdef ANISOTROPIC\nvec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,vRefractionInfos.y);\n#else\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\n#endif\n#ifdef SS_REFRACTIONMAP_OPPOSITEZ\nrefractionVector.z*=-1.0;\n#endif\n#ifdef SS_REFRACTIONMAP_3D\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nvec3 refractionCoords=refractionVector;\nrefractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\n#else\n#ifdef SS_USE_THICKNESS_AS_DEPTH\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*thickness,1.0)));\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\n#endif\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\n#endif\n#ifdef SS_HAS_THICKNESS\nfloat ior=vRefractionInfos.y;\n#else\nfloat ior=vRefractionMicrosurfaceInfos.w;\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nfloat refractionAlphaG=alphaG;\nrefractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped);\n#elif defined(SS_LINEARSPECULARREFRACTION)\nfloat refractionRoughness=alphaG;\nrefractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));\nfloat refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness);\n#else\nfloat refractionAlphaG=alphaG;\nrefractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG);\n#endif\n#ifdef LODBASEDMICROSFURACE\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\n#ifdef SS_LODINREFRACTIONALPHA\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);\nfloat requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\n#else\nfloat requestedRefractionLOD=refractionLOD;\n#endif\n#ifdef REALTIME_FILTERING\nenvironmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);\n#else\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\n#endif\n#else\nfloat lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));\nfloat lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;\nvec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);\nif (lodRefractionNormalizedDoubled<1.0){\nenvironmentRefraction=mix(\nsampleRefraction(refractionSamplerHigh,refractionCoords),\nenvironmentRefractionMid,\nlodRefractionNormalizedDoubled\n);\n} else {\nenvironmentRefraction=mix(\nenvironmentRefractionMid,\nsampleRefraction(refractionSamplerLow,refractionCoords),\nlodRefractionNormalizedDoubled-1.0\n);\n}\n#endif\n#ifdef SS_RGBDREFRACTION\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\n#endif\n#ifdef SS_GAMMAREFRACTION\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\n#endif\nenvironmentRefraction.rgb*=vRefractionInfos.x;\n#endif\n#ifdef SS_REFRACTION\nvec3 refractionTransmittance=vec3(refractionIntensity);\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\nrefractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);\nvec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);\nenvironmentRefraction.rgb*=volumeAlbedo;\n#else\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\nrefractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\n#endif\n#ifdef SS_ALBEDOFORREFRACTIONTINT\nenvironmentRefraction.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);\n#ifdef REFLECTION\noutParams.refractionFactorForIrradiance=(1.-refractionIntensity);\n#endif\n#ifdef UNUSED_MULTIPLEBOUNCES\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\noutParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\n#endif\nrefractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;\n#if DEBUGMODE>0\noutParams.refractionTransmittance=refractionTransmittance;\n#endif\noutParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;\n#if DEBUGMODE>0\noutParams.environmentRefraction=environmentRefraction;\n#endif\n#endif\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#else\nvec3 irradianceVector=irradianceVector_;\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP)\n#if defined(REALTIME_FILTERING)\nvec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);\n#else\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\n#endif\n#elif defined(USEIRRADIANCEMAP)\n#ifdef REFLECTIONMAP_3D\nvec3 irradianceCoords=irradianceVector;\n#else\nvec2 irradianceCoords=irradianceVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nirradianceCoords/=irradianceVector.z;\n#endif\nirradianceCoords.y=1.0-irradianceCoords.y;\n#endif\nvec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);\n#ifdef RGBDREFLECTION\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\n#endif\n#ifdef GAMMAREFLECTION\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\n#endif\n#else\nvec4 refractionIrradiance=vec4(0.);\n#endif\nrefractionIrradiance.rgb*=transmittance;\n#ifdef SS_ALBEDOFORTRANSLUCENCYTINT\nrefractionIrradiance.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.refractionIrradiance=refractionIrradiance.rgb;\n#endif\n}\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js");S.v.IncludesShadersStore.pbrBlockNormalGeometric="vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#endif\nvec3 geometricNormalW=normalW;\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\ngeometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragment.js");S.v.IncludesShadersStore.pbrBlockNormalFinal="#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#if defined(TWOSIDEDLIGHTING)\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\n#endif\nnormalW*=sign(dot(normalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js");S.v.IncludesShadersStore.pbrBlockLightmapInit="#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\n#ifdef GAMMALIGHTMAP\nlightmapColor.rgb=toLinearSpace(lightmapColor.rgb);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n";S.v.IncludesShadersStore.pbrBlockGeometryInfo="float NdotVUnclamped=dot(normalW,viewDirectionW);\nfloat NdotV=absEps(NdotVUnclamped);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nvec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz);\n#ifdef SPECULARAA\nalphaG+=AARoughnessFactors.y;\n#endif\n#if defined(ENVIRONMENTBRDF)\nvec3 environmentBrdf=getBRDFLookup(NdotV,roughness);\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\n#ifdef AMBIENTINGRAYSCALE\nfloat ambientMonochrome=aoOut.ambientOcclusionColor.r;\n#else\nfloat ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor);\n#endif\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);\n#endif\n#endif\n#endif\n#endif\n";S.v.IncludesShadersStore.pbrBlockReflectance0="float reflectance=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);\nvec3 specularEnvironmentR0=reflectivityOut.surfaceReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec3 specularEnvironmentR90=vec3(metallicReflectanceFactors.a);\n#else \nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0);\n#endif\n#ifdef ALPHAFRESNEL\nfloat reflectance90=fresnelGrazingReflectance(reflectance);\nspecularEnvironmentR90=specularEnvironmentR90*reflectance90;\n#endif\n";S.v.IncludesShadersStore.pbrBlockReflectance="#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);\n#ifdef RADIANCEOCCLUSION\nspecularEnvironmentReflectance*=seo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nspecularEnvironmentReflectance*=eho;\n#endif\n#endif\n#endif\n#else\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\n#endif\n#ifdef CLEARCOAT\nspecularEnvironmentReflectance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nspecularEnvironmentReflectance*=clearcoatOut.absorption;\n#endif\n#endif\n";S.v.IncludesShadersStore.pbrBlockDirectLighting="vec3 diffuseBase=vec3(0.,0.,0.);\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#ifdef CLEARCOAT\nvec3 clearCoatBase=vec3(0.,0.,0.);\n#endif\n#ifdef SHEEN\nvec3 sheenBase=vec3(0.,0.,0.);\n#endif\npreLightingInfo preInfo;\nlightingInfo info;\nfloat shadow=1.; \n#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\nvec3 absorption=vec3(0.);\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragment.js");S.v.IncludesShadersStore.pbrBlockFinalLitComponents="#if defined(ENVIRONMENTBRDF)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nvec3 energyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);\n#endif\n#endif\n#ifndef METALLICWORKFLOW\n#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\n#endif\n#endif\n#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)\nsurfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;\n#endif\n#ifdef REFLECTION\nvec3 finalIrradiance=reflectionOut.environmentIrradiance;\n#if defined(CLEARCOAT)\nfinalIrradiance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nfinalIrradiance*=clearcoatOut.absorption;\n#endif\n#endif\n#if defined(SS_REFRACTION)\nfinalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;\n#endif\n#if defined(SS_TRANSLUCENCY)\nfinalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);\nfinalIrradiance+=subSurfaceOut.refractionIrradiance;\n#endif\nfinalIrradiance*=surfaceAlbedo.rgb;\nfinalIrradiance*=vLightingIntensity.z;\nfinalIrradiance*=aoOut.ambientOcclusionColor;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase;\nfinalSpecular=max(finalSpecular,0.0);\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalSpecularScaled*=energyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalSpecularScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef REFLECTION\nvec3 finalRadiance=reflectionOut.environmentRadiance.rgb;\nfinalRadiance*=subSurfaceOut.specularEnvironmentReflectance;\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalRadianceScaled*=energyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalRadianceScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef SHEEN\nvec3 finalSheen=sheenBase*sheenOut.sheenColor;\nfinalSheen=max(finalSheen,0.0);\nvec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef CLEARCOAT\nvec3 finalClearCoat=clearCoatBase;\nfinalClearCoat=max(finalClearCoat,0.0);\nvec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;\n#ifdef CLEARCOAT_TINT\nsubSurfaceOut.finalRefraction*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef ALPHABLEND\nfloat luminanceOverAlpha=0.0;\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\n#if defined(CLEARCOAT)\nluminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);\n#endif\n#endif\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\n#endif\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\n#endif\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\n#endif\n#endif\n";S.v.IncludesShadersStore.pbrBlockFinalUnlitComponents="vec3 finalDiffuse=diffuseBase;\nfinalDiffuse*=surfaceAlbedo.rgb;\nfinalDiffuse=max(finalDiffuse,0.0);\nfinalDiffuse*=vLightingIntensity.x;\nvec3 finalAmbient=vAmbientColor;\nfinalAmbient*=surfaceAlbedo.rgb;\nvec3 finalEmissive=vEmissiveColor;\n#ifdef EMISSIVE\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\n#ifdef GAMMAEMISSIVE\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\n#else\nfinalEmissive*=emissiveColorTex.rgb;\n#endif\nfinalEmissive*= vEmissiveInfos.y;\n#endif\nfinalEmissive*=vLightingIntensity.y;\n#ifdef AMBIENT\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w);\n#else\nvec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor;\n#endif\nfinalAmbient*=aoOut.ambientOcclusionColor;\nfinalDiffuse*=ambientOcclusionForDirectDiffuse;\n";S.v.IncludesShadersStore.pbrBlockFinalColorComposition="vec4 finalColor=vec4(\nfinalAmbient +\nfinalDiffuse +\n#ifndef UNLIT\n#ifdef REFLECTION\nfinalIrradiance +\n#endif\n#ifdef SPECULARTERM\nfinalSpecularScaled +\n#endif\n#ifdef SHEEN\nfinalSheenScaled +\n#endif\n#ifdef CLEARCOAT\nfinalClearCoatScaled +\n#endif\n#ifdef REFLECTION\nfinalRadianceScaled +\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled +\n#endif\n#ifdef CLEARCOAT\nclearcoatOut.finalClearCoatRadianceScaled +\n#endif\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction +\n#endif\n#endif\nfinalEmissive,\nalpha);\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\nfinalColor.rgb*=lightmapColor.rgb;\n#else\nfinalColor.rgb+=lightmapColor.rgb;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\nfinalColor=max(finalColor,0.0);\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragment.js");S.v.IncludesShadersStore.pbrBlockImageProcessing="#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)\n#if !defined(SKIPFINALCOLORCLAMP)\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\n#endif\n#else\nfinalColor=applyImageProcessing(finalColor);\n#endif\nfinalColor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\nfinalColor.rgb*=finalColor.a;\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/oitFragment.js");S.v.IncludesShadersStore.pbrDebug="#if DEBUGMODE>0\nif (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {\n#if DEBUGMODE==1\ngl_FragColor.rgb=vPositionW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==2 && defined(NORMAL)\ngl_FragColor.rgb=vNormalW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)\ngl_FragColor.rgb=TBN[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)\ngl_FragColor.rgb=TBN[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==5\ngl_FragColor.rgb=normalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==6 && defined(MAINUV1)\ngl_FragColor.rgb=vec3(vMainUV1,0.0);\n#elif DEBUGMODE==7 && defined(MAINUV2)\ngl_FragColor.rgb=vec3(vMainUV2,0.0);\n#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==10 && defined(CLEARCOAT)\ngl_FragColor.rgb=clearcoatOut.clearCoatNormalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==11 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicNormal;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==12 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicTangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==13 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicBitangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==20 && defined(ALBEDO)\ngl_FragColor.rgb=albedoTexture.rgb;\n#elif DEBUGMODE==21 && defined(AMBIENT)\ngl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;\n#elif DEBUGMODE==22 && defined(OPACITY)\ngl_FragColor.rgb=opacityMap.rgb;\n#elif DEBUGMODE==23 && defined(EMISSIVE)\ngl_FragColor.rgb=emissiveColorTex.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==24 && defined(LIGHTMAP)\ngl_FragColor.rgb=lightmapColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;\n#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);\n#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\ngl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;\n#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)\ngl_FragColor.rgb=sheenOut.sheenMapData.rgb;\n#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)\ngl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;\n#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)\ngl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;\n#elif DEBUGMODE==40 && defined(SS_REFRACTION)\ngl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==41 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)\ngl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==50\ngl_FragColor.rgb=diffuseBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==51 && defined(SPECULARTERM)\ngl_FragColor.rgb=specularBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==52 && defined(CLEARCOAT)\ngl_FragColor.rgb=clearCoatBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==53 && defined(SHEEN)\ngl_FragColor.rgb=sheenBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==54 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==60\ngl_FragColor.rgb=surfaceAlbedo.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==61\ngl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==62 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=vec3(reflectivityOut.metallicRoughness.r);\n#elif DEBUGMODE==71 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.metallicF0;\n#elif DEBUGMODE==63\ngl_FragColor.rgb=vec3(roughness);\n#elif DEBUGMODE==64\ngl_FragColor.rgb=vec3(alphaG);\n#elif DEBUGMODE==65\ngl_FragColor.rgb=vec3(NdotV);\n#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\ngl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==67 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);\n#elif DEBUGMODE==68 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);\n#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)\ngl_FragColor.rgb=subSurfaceOut.transmittance;\n#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)\ngl_FragColor.rgb=subSurfaceOut.refractionTransmittance;\n#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)\ngl_FragColor.rgb=vec3(seo);\n#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION)\ngl_FragColor.rgb=vec3(eho);\n#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)\ngl_FragColor.rgb=vec3(energyConservationFactor);\n#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=specularEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)\ngl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==86 && defined(ALPHABLEND)\ngl_FragColor.rgb=vec3(luminanceOverAlpha);\n#elif DEBUGMODE==87\ngl_FragColor.rgb=vec3(alpha);\n#endif\ngl_FragColor.rgb*=vDebugMode.y;\n#ifdef DEBUGMODE_NORMALIZE\ngl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;\n#endif\n#ifdef DEBUGMODE_GAMMA\ngl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);\n#endif\ngl_FragColor.a=1.0;\n#ifdef PREPASS\ngl_FragData[0]=toLinearSpace(gl_FragColor); \ngl_FragData[1]=vec4(0.,0.,0.,0.); \n#endif\nreturn;\n}\n#endif\n";S.v.ShadersStore.pbrPixelShader="#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LODBASEDMICROSFURACE\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include[SCENE_MRT_COUNT]\nprecision highp float;\n#include\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE\n#endif\n#include<__decl__pbrFragment>\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#ifdef REFLECTION\n#include\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#include\n#include\n#include\nalbedoOpacityOutParams albedoOpacityOut;\n#ifdef ALBEDO\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#endif\nalbedoOpacityBlock(\nvAlbedoColor,\n#ifdef ALBEDO\nalbedoTexture,\nvAlbedoInfos,\n#endif\n#ifdef OPACITY\nopacityMap,\nvOpacityInfos,\n#endif\n#ifdef DETAIL\ndetailColor,\nvDetailInfos,\n#endif\nalbedoOpacityOut\n);\nvec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;\nfloat alpha=albedoOpacityOut.alpha;\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\n#include\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\nambientOcclusionOutParams aoOut;\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb;\n#endif\nambientOcclusionBlock(\n#ifdef AMBIENT\nambientOcclusionColorMap,\nvAmbientInfos,\n#endif\naoOut\n);\n#include\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\nvec3 baseColor=surfaceAlbedo;\nreflectivityOutParams reflectivityOut;\n#if defined(REFLECTIVITY)\nvec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\nvec4 baseReflectivity=surfaceMetallicOrReflectivityColorMap;\n#ifndef METALLICWORKFLOW\n#ifdef REFLECTIVITY_GAMMA\nsurfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap);\n#endif\nsurfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y;\n#endif\n#endif\n#if defined(MICROSURFACEMAP)\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\n#endif\n#ifdef METALLICWORKFLOW\nvec4 metallicReflectanceFactors=vMetallicReflectanceFactors;\n#ifdef REFLECTANCE\nvec4 reflectanceFactorsMap=texture2D(reflectanceSampler,vReflectanceUV+uvOffset);\n#ifdef REFLECTANCE_GAMMA\nreflectanceFactorsMap=toLinearSpace(reflectanceFactorsMap);\n#endif\nmetallicReflectanceFactors.rgb*=reflectanceFactorsMap.rgb;\n#endif\n#ifdef METALLIC_REFLECTANCE\nvec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset);\n#ifdef METALLIC_REFLECTANCE_GAMMA\nmetallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap);\n#endif\n#ifndef METALLIC_REFLECTANCE_USE_ALPHA_ONLY\nmetallicReflectanceFactors.rgb*=metallicReflectanceFactorsMap.rgb;\n#endif\nmetallicReflectanceFactors*=metallicReflectanceFactorsMap.a;\n#endif\n#endif\nreflectivityBlock(\nvReflectivityColor,\n#ifdef METALLICWORKFLOW\nsurfaceAlbedo,\nmetallicReflectanceFactors,\n#endif\n#ifdef REFLECTIVITY\nvReflectivityInfos,\nsurfaceMetallicOrReflectivityColorMap,\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\naoOut.ambientOcclusionColor,\n#endif\n#ifdef MICROSURFACEMAP\nmicroSurfaceTexel,\n#endif\n#ifdef DETAIL\ndetailColor,\nvDetailInfos,\n#endif\nreflectivityOut\n);\nfloat microSurface=reflectivityOut.microSurface;\nfloat roughness=reflectivityOut.roughness;\n#ifdef METALLICWORKFLOW\nsurfaceAlbedo=reflectivityOut.surfaceAlbedo;\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\naoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;\n#endif\n#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\nalphaFresnelOutParams alphaFresnelOut;\nalphaFresnelBlock(\nnormalW,\nviewDirectionW,\nalpha,\nmicroSurface,\nalphaFresnelOut\n);\nalpha=alphaFresnelOut.alpha;\n#endif\n#endif\n#include\n#ifdef ANISOTROPIC\nanisotropicOutParams anisotropicOut;\n#ifdef ANISOTROPIC_TEXTURE\nvec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y;\n#endif\nanisotropicBlock(\nvAnisotropy,\n#ifdef ANISOTROPIC_TEXTURE\nanisotropyMapData,\n#endif\nTBN,\nnormalW,\nviewDirectionW,\nanisotropicOut\n);\n#endif\n#ifdef REFLECTION\nreflectionOutParams reflectionOut;\n#ifndef USE_CUSTOM_REFLECTION\nreflectionBlock(\nvPositionW,\nnormalW,\nalphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nroughness,\n#endif\nreflectionSampler,\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nvEnvironmentIrradiance,\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nreflectionMatrix,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\nirradianceSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nreflectionOut\n);\n#else\n#define CUSTOM_REFLECTION\n#endif\n#endif\n#include\n#ifdef SHEEN\nsheenOutParams sheenOut;\n#ifdef SHEEN_TEXTURE\nvec4 sheenMapData=texture2D(sheenSampler,vSheenUV+uvOffset);\n#endif\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\nvec4 sheenMapRoughnessData=texture2D(sheenRoughnessSampler,vSheenRoughnessUV+uvOffset)*vSheenInfos.w;\n#endif\nsheenBlock(\nvSheenColor,\n#ifdef SHEEN_ROUGHNESS\nvSheenRoughness,\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\nsheenMapRoughnessData,\n#endif\n#endif\nroughness,\n#ifdef SHEEN_TEXTURE\nsheenMapData,\nvSheenInfos.y,\n#endif\nreflectance,\n#ifdef SHEEN_LINKWITHALBEDO\nbaseColor,\nsurfaceAlbedo,\n#endif\n#ifdef ENVIRONMENTBRDF\nNdotV,\nenvironmentBrdf,\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nAARoughnessFactors,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\nvLightingIntensity,\nreflectionSampler,\nreflectionOut.reflectionCoords,\nNdotVUnclamped,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nseo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\neho,\n#endif\n#endif\nsheenOut\n);\n#ifdef SHEEN_LINKWITHALBEDO\nsurfaceAlbedo=sheenOut.surfaceAlbedo;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\nvec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y;\n#endif\n#endif\n#ifdef IRIDESCENCE\niridescenceOutParams iridescenceOut;\n#ifdef IRIDESCENCE_TEXTURE\nvec2 iridescenceMapData=texture2D(iridescenceSampler,vIridescenceUV+uvOffset).rg*vIridescenceInfos.y;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nvec2 iridescenceThicknessMapData=texture2D(iridescenceThicknessSampler,vIridescenceThicknessUV+uvOffset).rg*vIridescenceInfos.w;\n#endif\niridescenceBlock(\nvIridescenceParams,\nNdotV,\nspecularEnvironmentR0,\n#ifdef IRIDESCENCE_TEXTURE\niridescenceMapData,\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\niridescenceThicknessMapData,\n#endif\n#ifdef CLEARCOAT\nNdotVUnclamped,\n#ifdef CLEARCOAT_TEXTURE\nclearCoatMapData,\n#endif\n#endif\niridescenceOut\n);\nfloat iridescenceIntensity=iridescenceOut.iridescenceIntensity;\nspecularEnvironmentR0=iridescenceOut.specularEnvironmentR0;\n#endif\nclearcoatOutParams clearcoatOut;\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nvec4 clearCoatMapRoughnessData=texture2D(clearCoatRoughnessSampler,vClearCoatRoughnessUV+uvOffset)*vClearCoatInfos.w;\n#endif\n#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\nvec4 clearCoatTintMapData=texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset);\n#endif\n#ifdef CLEARCOAT_BUMP\nvec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset);\n#endif\nclearcoatBlock(\nvPositionW,\ngeometricNormalW,\nviewDirectionW,\nvClearCoatParams,\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nclearCoatMapRoughnessData,\n#endif\nspecularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nclearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nvClearCoatTintParams,\nclearCoatColorAtDistance,\nvClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nclearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nvClearCoatBumpInfos,\nclearCoatBumpMapData,\nvClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nvTBN,\n#else\nvClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nnormalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nfaceNormal,\n#endif\n#ifdef REFLECTION\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\nvLightingIntensity,\nreflectionSampler,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nambientMonochrome,\n#endif\n#endif\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\n(gl_FrontFacing ? 1. : -1.),\n#endif\nclearcoatOut\n);\n#else\nclearcoatOut.specularEnvironmentR0=specularEnvironmentR0;\n#endif\n#include\nsubSurfaceOutParams subSurfaceOut;\n#ifdef SUBSURFACE\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset);\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nvec4 refractionIntensityMap=texture2D(refractionIntensitySampler,vRefractionIntensityUV+uvOffset);\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nvec4 translucencyIntensityMap=texture2D(translucencyIntensitySampler,vTranslucencyIntensityUV+uvOffset);\n#endif\nsubSurfaceBlock(\nvSubSurfaceIntensity,\nvThicknessParam,\nvTintColor,\nnormalW,\nspecularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nthicknessMap,\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nrefractionIntensityMap,\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\ntranslucencyIntensityMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nreflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nreflectionOut.irradianceVector,\n#endif\n#if defined(REALTIME_FILTERING)\nreflectionSampler,\nvReflectionFilteringInfo,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\nirradianceSampler,\n#endif\n#endif\n#endif\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\nsurfaceAlbedo,\n#endif\n#ifdef SS_REFRACTION\nvPositionW,\nviewDirectionW,\nview,\nvRefractionInfos,\nrefractionMatrix,\nvRefractionMicrosurfaceInfos,\nvLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nalpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nNdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nroughness,\n#endif\nalphaG,\nrefractionSampler,\n#ifndef LODBASEDMICROSFURACE\nrefractionSamplerLow,\nrefractionSamplerHigh,\n#endif\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\n#ifdef REALTIME_FILTERING\nvRefractionFilteringInfo,\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nvRefractionPosition,\nvRefractionSize,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvDiffusionDistance,\n#endif\nsubSurfaceOut\n);\n#ifdef SS_REFRACTION\nsurfaceAlbedo=subSurfaceOut.surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nalpha=subSurfaceOut.alpha;\n#endif\n#endif\n#else\nsubSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;\n#endif\n#include\n#include[0..maxSimultaneousLights]\n#include\n#endif \n#include\n#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\n#include\n#include\n#include(color,finalColor)\n#include\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\nfloat writeGeometryInfo=finalColor.a>0.4 ? 1.0 : 0.0;\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\nvec3 sqAlbedo=sqrt(surfaceAlbedo); \n#endif\n#ifdef PREPASS_IRRADIANCE\nvec3 irradiance=finalDiffuse;\n#ifndef UNLIT\n#ifdef REFLECTION\nirradiance+=finalIrradiance;\n#endif\n#endif\n#ifdef SS_SCATTERING\ngl_FragData[0]=vec4(finalColor.rgb-irradiance,finalColor.a); \nirradiance/=sqAlbedo;\n#else\ngl_FragData[0]=finalColor; \nfloat scatteringDiffusionProfile=255.;\n#endif\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(clamp(irradiance,vec3(0.),vec3(1.)),writeGeometryInfo*scatteringDiffusionProfile/255.); \n#else\ngl_FragData[0]=vec4(finalColor.rgb,finalColor.a);\n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_NORMAL\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4((view*vec4(normalW,0.0)).rgb,writeGeometryInfo); \n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo); \n#endif\n#ifdef PREPASS_REFLECTIVITY\n#ifndef UNLIT\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toGammaSpace(specularEnvironmentR0),microSurface)*writeGeometryInfo;\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4( 0.0,0.0,0.0,1.0 )*writeGeometryInfo;\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=finalColor;\n#endif\n#include\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {\nfrontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;\nfrontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);\n} else {\nbackColor+=finalColor;\n}\n#endif\n#include\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";S.v.IncludesShadersStore.pbrVertexDeclaration="uniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef ALBEDO\nuniform mat4 albedoMatrix;\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#ifdef REFLECTIVITY \nuniform vec3 vReflectivityInfos;\nuniform mat4 reflectivityMatrix;\n#endif\n#ifdef METALLIC_REFLECTANCE\nuniform vec2 vMetallicReflectanceInfos;\nuniform mat4 metallicReflectanceMatrix;\n#endif\n#ifdef REFLECTANCE\nuniform vec2 vReflectanceInfos;\nuniform mat4 reflectanceMatrix;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform mat4 microSurfaceSamplerMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nuniform vec4 vClearCoatInfos;\n#endif\n#ifdef CLEARCOAT_TEXTURE\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\nuniform mat4 clearCoatRoughnessMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#ifdef IRIDESCENCE\n#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)\nuniform vec4 vIridescenceInfos;\n#endif\n#ifdef IRIDESCENCE_TEXTURE\nuniform mat4 iridescenceMatrix;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nuniform mat4 iridescenceThicknessMatrix;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\nuniform vec4 vSheenInfos;\n#endif\n#ifdef SHEEN_TEXTURE\nuniform mat4 sheenMatrix;\n#endif\n#ifdef SHEEN_TEXTURE_ROUGHNESS\nuniform mat4 sheenRoughnessMatrix;\n#endif\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nuniform vec2 vRefractionIntensityInfos;\nuniform mat4 refractionIntensityMatrix;\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nuniform vec2 vTranslucencyIntensityInfos;\nuniform mat4 translucencyIntensityMatrix;\n#endif\n#endif\n#ifdef NORMAL\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;\nuniform vec3 vSphericalL1_1;\nuniform vec3 vSphericalL10;\nuniform vec3 vSphericalL11;\nuniform vec3 vSphericalL2_2;\nuniform vec3 vSphericalL2_1;\nuniform vec3 vSphericalL20;\nuniform vec3 vSphericalL21;\nuniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX_ZZ;\nuniform vec3 vSphericalYY_ZZ;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\n#endif\n#endif\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\nuniform mat4 detailMatrix;\n#endif\n#define ADDITIONAL_VERTEX_DECLARATION\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/uvAttributeDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxUboDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobal.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/uvVariableDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerVertexImplementation.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js");S.v.ShadersStore.pbrVertexShader="precision highp float;\n#include<__decl__pbrVertex>\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#include[2..7]\n#include[1..7]\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy)\n#endif\n#ifdef SUBSURFACE\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity)\n#endif\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#include\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#include\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\nvNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#if DEBUGMODE>0\nvClipSpacePosition=gl_Position;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#include[2..7]\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_MATRIXNAME_,reflectivity,_INFONAME_,ReflectivityInfos.x)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_MATRIXNAME_,microSurfaceSampler,_INFONAME_,MicroSurfaceSamplerInfos.x)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_MATRIXNAME_,metallicReflectance,_INFONAME_,MetallicReflectanceInfos.x)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_MATRIXNAME_,reflectance,_INFONAME_,ReflectanceInfos.x)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_MATRIXNAME_,clearCoat,_INFONAME_,ClearCoatInfos.x)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness,_MATRIXNAME_,clearCoatRoughness,_INFONAME_,ClearCoatInfos.z)\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_MATRIXNAME_,clearCoatBump,_INFONAME_,ClearCoatBumpInfos.x)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_MATRIXNAME_,clearCoatTint,_INFONAME_,ClearCoatTintInfos.x)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_MATRIXNAME_,iridescence,_INFONAME_,IridescenceInfos.x)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_MATRIXNAME_,iridescenceThickness,_INFONAME_,IridescenceInfos.z)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.x)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.z)\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_MATRIXNAME_,anisotropy,_INFONAME_,AnisotropyInfos.x)\n#endif\n#ifdef SUBSURFACE\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_MATRIXNAME_,thickness,_INFONAME_,ThicknessInfos.x)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_MATRIXNAME_,refractionIntensity,_INFONAME_,RefractionIntensityInfos.x)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_MATRIXNAME_,translucencyIntensity,_INFONAME_,TranslucencyIntensityInfos.x)\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";var x=i("../../../node_modules/@babylonjs/core/Materials/effectFallbacks.js"),T=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrClearCoatConfiguration.js"),E=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrIridescenceConfiguration.js"),R=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrAnisotropicConfiguration.js"),P=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrSheenConfiguration.js"),I=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrSubSurfaceConfiguration.js"),M=i("../../../node_modules/@babylonjs/core/Materials/material.detailMapConfiguration.js");const D={effect:null,subMesh:null};class O extends b.H{constructor(e){super(e),this.PBR=!0,this.NUM_SAMPLES="0",this.REALTIME_FILTERING=!1,this.MAINUV1=!1,this.MAINUV2=!1,this.MAINUV3=!1,this.MAINUV4=!1,this.MAINUV5=!1,this.MAINUV6=!1,this.UV1=!1,this.UV2=!1,this.UV3=!1,this.UV4=!1,this.UV5=!1,this.UV6=!1,this.ALBEDO=!1,this.GAMMAALBEDO=!1,this.ALBEDODIRECTUV=0,this.VERTEXCOLOR=!1,this.BAKED_VERTEX_ANIMATION_TEXTURE=!1,this.AMBIENT=!1,this.AMBIENTDIRECTUV=0,this.AMBIENTINGRAYSCALE=!1,this.OPACITY=!1,this.VERTEXALPHA=!1,this.OPACITYDIRECTUV=0,this.OPACITYRGB=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.ALPHABLEND=!1,this.ALPHAFROMALBEDO=!1,this.ALPHATESTVALUE="0.5",this.SPECULAROVERALPHA=!1,this.RADIANCEOVERALPHA=!1,this.ALPHAFRESNEL=!1,this.LINEARALPHAFRESNEL=!1,this.PREMULTIPLYALPHA=!1,this.EMISSIVE=!1,this.EMISSIVEDIRECTUV=0,this.GAMMAEMISSIVE=!1,this.REFLECTIVITY=!1,this.REFLECTIVITY_GAMMA=!1,this.REFLECTIVITYDIRECTUV=0,this.SPECULARTERM=!1,this.MICROSURFACEFROMREFLECTIVITYMAP=!1,this.MICROSURFACEAUTOMATIC=!1,this.LODBASEDMICROSFURACE=!1,this.MICROSURFACEMAP=!1,this.MICROSURFACEMAPDIRECTUV=0,this.METALLICWORKFLOW=!1,this.ROUGHNESSSTOREINMETALMAPALPHA=!1,this.ROUGHNESSSTOREINMETALMAPGREEN=!1,this.METALLNESSSTOREINMETALMAPBLUE=!1,this.AOSTOREINMETALMAPRED=!1,this.METALLIC_REFLECTANCE=!1,this.METALLIC_REFLECTANCE_GAMMA=!1,this.METALLIC_REFLECTANCEDIRECTUV=0,this.METALLIC_REFLECTANCE_USE_ALPHA_ONLY=!1,this.REFLECTANCE=!1,this.REFLECTANCE_GAMMA=!1,this.REFLECTANCEDIRECTUV=0,this.ENVIRONMENTBRDF=!1,this.ENVIRONMENTBRDF_RGBD=!1,this.NORMAL=!1,this.TANGENT=!1,this.BUMP=!1,this.BUMPDIRECTUV=0,this.OBJECTSPACE_NORMALMAP=!1,this.PARALLAX=!1,this.PARALLAXOCCLUSION=!1,this.NORMALXYSCALE=!0,this.LIGHTMAP=!1,this.LIGHTMAPDIRECTUV=0,this.USELIGHTMAPASSHADOWMAP=!1,this.GAMMALIGHTMAP=!1,this.RGBDLIGHTMAP=!1,this.REFLECTION=!1,this.REFLECTIONMAP_3D=!1,this.REFLECTIONMAP_SPHERICAL=!1,this.REFLECTIONMAP_PLANAR=!1,this.REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,this.REFLECTIONMAP_PROJECTION=!1,this.REFLECTIONMAP_SKYBOX=!1,this.REFLECTIONMAP_EXPLICIT=!1,this.REFLECTIONMAP_EQUIRECTANGULAR=!1,this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,this.INVERTCUBICMAP=!1,this.USESPHERICALFROMREFLECTIONMAP=!1,this.USEIRRADIANCEMAP=!1,this.USESPHERICALINVERTEX=!1,this.REFLECTIONMAP_OPPOSITEZ=!1,this.LODINREFLECTIONALPHA=!1,this.GAMMAREFLECTION=!1,this.RGBDREFLECTION=!1,this.LINEARSPECULARREFLECTION=!1,this.RADIANCEOCCLUSION=!1,this.HORIZONOCCLUSION=!1,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.INSTANCESCOLOR=!1,this.PREPASS=!1,this.PREPASS_IRRADIANCE=!1,this.PREPASS_IRRADIANCE_INDEX=-1,this.PREPASS_ALBEDO_SQRT=!1,this.PREPASS_ALBEDO_SQRT_INDEX=-1,this.PREPASS_DEPTH=!1,this.PREPASS_DEPTH_INDEX=-1,this.PREPASS_NORMAL=!1,this.PREPASS_NORMAL_INDEX=-1,this.PREPASS_POSITION=!1,this.PREPASS_POSITION_INDEX=-1,this.PREPASS_VELOCITY=!1,this.PREPASS_VELOCITY_INDEX=-1,this.PREPASS_REFLECTIVITY=!1,this.PREPASS_REFLECTIVITY_INDEX=-1,this.SCENE_MRT_COUNT=0,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.BONETEXTURE=!1,this.BONES_VELOCITY_ENABLED=!1,this.NONUNIFORMSCALING=!1,this.MORPHTARGETS=!1,this.MORPHTARGETS_NORMAL=!1,this.MORPHTARGETS_TANGENT=!1,this.MORPHTARGETS_UV=!1,this.NUM_MORPH_INFLUENCERS=0,this.MORPHTARGETS_TEXTURE=!1,this.IMAGEPROCESSING=!1,this.VIGNETTE=!1,this.VIGNETTEBLENDMODEMULTIPLY=!1,this.VIGNETTEBLENDMODEOPAQUE=!1,this.TONEMAPPING=!1,this.TONEMAPPING_ACES=!1,this.CONTRAST=!1,this.COLORCURVES=!1,this.COLORGRADING=!1,this.COLORGRADING3D=!1,this.SAMPLER3DGREENDEPTH=!1,this.SAMPLER3DBGRMAP=!1,this.DITHER=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.EXPOSURE=!1,this.MULTIVIEW=!1,this.ORDER_INDEPENDENT_TRANSPARENCY=!1,this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,this.USEPHYSICALLIGHTFALLOFF=!1,this.USEGLTFLIGHTFALLOFF=!1,this.TWOSIDEDLIGHTING=!1,this.SHADOWFLOAT=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.LOGARITHMICDEPTH=!1,this.FORCENORMALFORWARD=!1,this.SPECULARAA=!1,this.UNLIT=!1,this.DEBUGMODE=0,this.rebuild()}reset(){super.reset(),this.ALPHATESTVALUE="0.5",this.PBR=!0,this.NORMALXYSCALE=!0}}class w extends y.a{constructor(e,t){super(e,t),this._directIntensity=1,this._emissiveIntensity=1,this._environmentIntensity=1,this._specularIntensity=1,this._lightingInfos=new c.Lt(this._directIntensity,this._emissiveIntensity,this._environmentIntensity,this._specularIntensity),this._disableBumpMap=!1,this._albedoTexture=null,this._ambientTexture=null,this._ambientTextureStrength=1,this._ambientTextureImpactOnAnalyticalLights=w.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,this._opacityTexture=null,this._reflectionTexture=null,this._emissiveTexture=null,this._reflectivityTexture=null,this._metallicTexture=null,this._metallic=null,this._roughness=null,this._metallicF0Factor=1,this._metallicReflectanceColor=u.Wo.White(),this._useOnlyMetallicFromMetallicReflectanceTexture=!1,this._metallicReflectanceTexture=null,this._reflectanceTexture=null,this._microSurfaceTexture=null,this._bumpTexture=null,this._lightmapTexture=null,this._ambientColor=new u.Wo(0,0,0),this._albedoColor=new u.Wo(1,1,1),this._reflectivityColor=new u.Wo(1,1,1),this._reflectionColor=new u.Wo(1,1,1),this._emissiveColor=new u.Wo(0,0,0),this._microSurface=.9,this._useLightmapAsShadowmap=!1,this._useHorizonOcclusion=!0,this._useRadianceOcclusion=!0,this._useAlphaFromAlbedoTexture=!1,this._useSpecularOverAlpha=!0,this._useMicroSurfaceFromReflectivityMapAlpha=!1,this._useRoughnessFromMetallicTextureAlpha=!0,this._useRoughnessFromMetallicTextureGreen=!1,this._useMetallnessFromMetallicTextureBlue=!1,this._useAmbientOcclusionFromMetallicTextureRed=!1,this._useAmbientInGrayScale=!1,this._useAutoMicroSurfaceFromReflectivityMap=!1,this._lightFalloff=w.LIGHTFALLOFF_PHYSICAL,this._useRadianceOverAlpha=!0,this._useObjectSpaceNormalMap=!1,this._useParallax=!1,this._useParallaxOcclusion=!1,this._parallaxScaleBias=.05,this._disableLighting=!1,this._maxSimultaneousLights=4,this._invertNormalMapX=!1,this._invertNormalMapY=!1,this._twoSidedLighting=!1,this._alphaCutOff=.4,this._forceAlphaTest=!1,this._useAlphaFresnel=!1,this._useLinearAlphaFresnel=!1,this._environmentBRDFTexture=null,this._forceIrradianceInFragment=!1,this._realTimeFiltering=!1,this._realTimeFilteringQuality=8,this._forceNormalForward=!1,this._enableSpecularAntiAliasing=!1,this._imageProcessingObserver=null,this._renderTargets=new o.t(16),this._globalAmbientColor=new u.Wo(0,0,0),this._useLogarithmicDepth=!1,this._unlit=!1,this._debugMode=0,this.debugMode=0,this._debugLimit=-1,this._debugFactor=1,this._cacheHasRenderTargetTextures=!1,this.brdf=new _.d(this),this.clearCoat=new T.Y(this),this.iridescence=new E.B(this),this.anisotropy=new R.u(this),this.sheen=new P.B(this),this.subSurface=new I.u(this),this.detailMap=new M.p(this),this._attachImageProcessingConfiguration(null),this.getRenderTargetTextures=()=>(this._renderTargets.reset(),C.k.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._renderTargets.push(this._reflectionTexture),this._eventInfo.renderTargets=this._renderTargets,this._callbackPluginEventFillRenderTargetTextures(this._eventInfo),this._renderTargets),this._environmentBRDFTexture=(0,a.$)(this.getScene()),this.prePassConfiguration=new d.o}get realTimeFiltering(){return this._realTimeFiltering}set realTimeFiltering(e){this._realTimeFiltering=e,this.markAsDirty(1)}get realTimeFilteringQuality(){return this._realTimeFilteringQuality}set realTimeFilteringQuality(e){this._realTimeFilteringQuality=e,this.markAsDirty(1)}get canRenderToMRT(){return!0}_attachImageProcessingConfiguration(e){e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((()=>{this._markAllSubMeshesAsImageProcessingDirty()}))))}get hasRenderTargetTextures(){return!!(C.k.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||this._cacheHasRenderTargetTextures}get isPrePassCapable(){return!this.disableDepthWrite}getClassName(){return"PBRBaseMaterial"}get useLogarithmicDepth(){return this._useLogarithmicDepth}set useLogarithmicDepth(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported}get _disableAlphaBlending(){var e;return this._transparencyMode===w.PBRMATERIAL_OPAQUE||this._transparencyMode===w.PBRMATERIAL_ALPHATEST||(null===(e=this.subSurface)||void 0===e?void 0:e.disableAlphaBlending)}needAlphaBlending(){return!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromAlbedoTexture())}needAlphaTesting(){var e;return!!this._forceAlphaTest||!(null===(e=this.subSurface)||void 0===e?void 0:e.disableAlphaBlending)&&this._hasAlphaChannel()&&(null==this._transparencyMode||this._transparencyMode===w.PBRMATERIAL_ALPHATEST)}_shouldUseAlphaFromAlbedoTexture(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&this._useAlphaFromAlbedoTexture&&this._transparencyMode!==w.PBRMATERIAL_OPAQUE}_hasAlphaChannel(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha||null!=this._opacityTexture}getAlphaTestTexture(){return this._albedoTexture}isReadyForSubMesh(e,t,i){if(this._uniformBufferLayoutBuilt||this.buildUniformLayout(),t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(this._callbackPluginEventGeneric(g.S.GetDefineNames,this._eventInfo),t.materialDefines=new O(this._eventInfo.defineNames));const n=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;const r=this.getScene(),o=r.getEngine();if(n._areTexturesDirty&&(this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,r.texturesEnabled)){if(this._albedoTexture&&C.k.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&C.k.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&C.k.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;const e=this._getReflectionTexture();if(e&&C.k.ReflectionTextureEnabled){if(!e.isReadyOrNotBlocking())return!1;if(e.irradianceTexture&&!e.irradianceTexture.isReadyOrNotBlocking())return!1}if(this._lightmapTexture&&C.k.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&C.k.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(C.k.SpecularTextureEnabled){if(this._metallicTexture){if(!this._metallicTexture.isReadyOrNotBlocking())return!1}else if(this._reflectivityTexture&&!this._reflectivityTexture.isReadyOrNotBlocking())return!1;if(this._metallicReflectanceTexture&&!this._metallicReflectanceTexture.isReadyOrNotBlocking())return!1;if(this._reflectanceTexture&&!this._reflectanceTexture.isReadyOrNotBlocking())return!1;if(this._microSurfaceTexture&&!this._microSurfaceTexture.isReadyOrNotBlocking())return!1}if(o.getCaps().standardDerivatives&&this._bumpTexture&&C.k.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&C.k.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady())return!1}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=n,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(n._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;o.getCaps().standardDerivatives||e.isVerticesDataPresent(h.o.NormalKind)||(e.createNormals(!0),s.Y.Warn("PBRMaterial: Normals have been created for the mesh: "+e.name));const a=t.effect,c=n._areLightsDisposed;let _=this._prepareEffect(e,n,this.onCompiled,this.onError,i,null,t.getRenderingMesh().hasThinInstances);if(_)if(this._onEffectCreatedObservable&&(D.effect=_,D.subMesh=t,this._onEffectCreatedObservable.notifyObservers(D)),this.allowShaderHotSwapping&&a&&!_.isReady()){if(_=a,n.markAsUnprocessed(),c)return n._areLightsDisposed=!0,!1}else r.resetCachedMaterial(),t.setEffect(_,n,this._materialContext);return!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,r.performancePriority!==l.a.BackwardCompatible&&(this.checkReadyOnlyOnce=!0),0))}isMetallicWorkflow(){return!(null==this._metallic&&null==this._roughness&&!this._metallicTexture)}_prepareEffect(e,t,i=null,n=null,r=null,s=null,o){if(this._prepareDefines(e,t,r,s,o),!t.isDirty)return null;t.markAsProcessed();const a=this.getScene().getEngine(),l=new x.L;let c=0;t.USESPHERICALINVERTEX&&l.addFallback(c++,"USESPHERICALINVERTEX"),t.FOG&&l.addFallback(c,"FOG"),t.SPECULARAA&&l.addFallback(c,"SPECULARAA"),t.POINTSIZE&&l.addFallback(c,"POINTSIZE"),t.LOGARITHMICDEPTH&&l.addFallback(c,"LOGARITHMICDEPTH"),t.PARALLAX&&l.addFallback(c,"PARALLAX"),t.PARALLAXOCCLUSION&&l.addFallback(c++,"PARALLAXOCCLUSION"),t.ENVIRONMENTBRDF&&l.addFallback(c++,"ENVIRONMENTBRDF"),t.TANGENT&&l.addFallback(c++,"TANGENT"),t.BUMP&&l.addFallback(c++,"BUMP"),c=v.G.HandleFallbacksForShadows(t,l,this._maxSimultaneousLights,c++),t.SPECULARTERM&&l.addFallback(c++,"SPECULARTERM"),t.USESPHERICALFROMREFLECTIONMAP&&l.addFallback(c++,"USESPHERICALFROMREFLECTIONMAP"),t.USEIRRADIANCEMAP&&l.addFallback(c++,"USEIRRADIANCEMAP"),t.LIGHTMAP&&l.addFallback(c++,"LIGHTMAP"),t.NORMAL&&l.addFallback(c++,"NORMAL"),t.AMBIENT&&l.addFallback(c++,"AMBIENT"),t.EMISSIVE&&l.addFallback(c++,"EMISSIVE"),t.VERTEXCOLOR&&l.addFallback(c++,"VERTEXCOLOR"),t.MORPHTARGETS&&l.addFallback(c++,"MORPHTARGETS"),t.MULTIVIEW&&l.addFallback(0,"MULTIVIEW");const _=[h.o.PositionKind];t.NORMAL&&_.push(h.o.NormalKind),t.TANGENT&&_.push(h.o.TangentKind);for(let e=1;e<=6;++e)t["UV"+e]&&_.push(`uv${1===e?"":e}`);t.VERTEXCOLOR&&_.push(h.o.ColorKind),t.INSTANCESCOLOR&&_.push(h.o.ColorInstanceKind),v.G.PrepareAttributesForBones(_,e,t,l),v.G.PrepareAttributesForInstances(_,t),v.G.PrepareAttributesForMorphTargets(_,e,t),v.G.PrepareAttributesForBakedVertexAnimation(_,e,t);let u="pbr";const p=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vAlbedoColor","vReflectivityColor","vMetallicReflectanceFactors","vEmissiveColor","visibility","vReflectionColor","vFogInfos","vFogColor","pointSize","vAlbedoInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vReflectionPosition","vReflectionSize","vEmissiveInfos","vReflectivityInfos","vReflectionFilteringInfo","vMetallicReflectanceInfos","vReflectanceInfos","vMicroSurfaceSamplerInfos","vBumpInfos","vLightmapInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","albedoMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","reflectivityMatrix","normalMatrix","microSurfaceSamplerMatrix","bumpMatrix","lightmapMatrix","metallicReflectanceMatrix","reflectanceMatrix","vLightingIntensity","logarithmicDepthConstant","vSphericalX","vSphericalY","vSphericalZ","vSphericalXX_ZZ","vSphericalYY_ZZ","vSphericalZZ","vSphericalXY","vSphericalYZ","vSphericalZX","vSphericalL00","vSphericalL1_1","vSphericalL10","vSphericalL11","vSphericalL2_2","vSphericalL2_1","vSphericalL20","vSphericalL21","vSphericalL22","vReflectionMicrosurfaceInfos","vTangentSpaceParams","boneTextureWidth","vDebugMode","morphTargetTextureInfo","morphTargetTextureIndices"],m=["albedoSampler","reflectivitySampler","ambientSampler","emissiveSampler","bumpSampler","lightmapSampler","opacitySampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh","irradianceSampler","microSurfaceSampler","environmentBrdfSampler","boneSampler","metallicReflectanceSampler","reflectanceSampler","morphTargets","oitDepthSampler","oitFrontColorSampler"],b=["Material","Scene","Mesh"];this._eventInfo.fallbacks=l,this._eventInfo.fallbackRank=c,this._eventInfo.defines=t,this._eventInfo.uniforms=p,this._eventInfo.attributes=_,this._eventInfo.samplers=m,this._eventInfo.uniformBuffersNames=b,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._callbackPluginEventGeneric(g.S.PrepareEffect,this._eventInfo),d.o.AddUniforms(p),d.o.AddSamplers(m),f.$&&(f.$.PrepareUniforms(p,t),f.$.PrepareSamplers(m,t)),v.G.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:b,samplers:m,defines:t,maxSimultaneousLights:this._maxSimultaneousLights});const y={};this.customShaderNameResolve&&(u=this.customShaderNameResolve(u,p,b,m,t,_,y));const A=t.toString();return a.createEffect(u,{attributes:_,uniformsNames:p,uniformBuffersNames:b,samplers:m,defines:A,fallbacks:l,onCompiled:i,onError:n,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:t.NUM_MORPH_INFLUENCERS},processFinalCode:y.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:t.PREPASS},a)}_prepareDefines(e,t,i=null,n=null,r=!1){var s;const o=this.getScene(),a=o.getEngine();v.G.PrepareDefinesForLights(o,e,t,!0,this._maxSimultaneousLights,this._disableLighting),t._needNormals=!0,v.G.PrepareDefinesForMultiview(o,t);const l=this.needAlphaBlendingForMesh(e)&&this.getScene().useOrderIndependentTransparency;if(v.G.PrepareDefinesForPrePass(o,t,this.canRenderToMRT&&!l),v.G.PrepareDefinesForOIT(o,t,l),t.METALLICWORKFLOW=this.isMetallicWorkflow(),t._areTexturesDirty){if(t._needUVs=!1,o.texturesEnabled){t.ALBEDODIRECTUV=0,t.AMBIENTDIRECTUV=0,t.OPACITYDIRECTUV=0,t.EMISSIVEDIRECTUV=0,t.REFLECTIVITYDIRECTUV=0,t.MICROSURFACEMAPDIRECTUV=0,t.METALLIC_REFLECTANCEDIRECTUV=0,t.REFLECTANCEDIRECTUV=0,t.BUMPDIRECTUV=0,t.LIGHTMAPDIRECTUV=0,a.getCaps().textureLOD&&(t.LODBASEDMICROSFURACE=!0),this._albedoTexture&&C.k.DiffuseTextureEnabled?(v.G.PrepareDefinesForMergedUV(this._albedoTexture,t,"ALBEDO"),t.GAMMAALBEDO=this._albedoTexture.gammaSpace):t.ALBEDO=!1,this._ambientTexture&&C.k.AmbientTextureEnabled?(v.G.PrepareDefinesForMergedUV(this._ambientTexture,t,"AMBIENT"),t.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):t.AMBIENT=!1,this._opacityTexture&&C.k.OpacityTextureEnabled?(v.G.PrepareDefinesForMergedUV(this._opacityTexture,t,"OPACITY"),t.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):t.OPACITY=!1;const e=this._getReflectionTexture();if(e&&C.k.ReflectionTextureEnabled){switch(t.REFLECTION=!0,t.GAMMAREFLECTION=e.gammaSpace,t.RGBDREFLECTION=e.isRGBD,t.LODINREFLECTIONALPHA=e.lodLevelInAlpha,t.LINEARSPECULARREFLECTION=e.linearSpecularLOD,this.realTimeFiltering&&this.realTimeFilteringQuality>0?(t.NUM_SAMPLES=""+this.realTimeFilteringQuality,a._features.needTypeSuffixInShaderConstants&&(t.NUM_SAMPLES=t.NUM_SAMPLES+"u"),t.REALTIME_FILTERING=!0):t.REALTIME_FILTERING=!1,e.coordinatesMode===A.x.INVCUBIC_MODE&&(t.INVERTCUBICMAP=!0),t.REFLECTIONMAP_3D=e.isCube,t.REFLECTIONMAP_OPPOSITEZ=t.REFLECTIONMAP_3D&&this.getScene().useRightHandedSystem?!e.invertZ:e.invertZ,t.REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.coordinatesMode){case A.x.EXPLICIT_MODE:t.REFLECTIONMAP_EXPLICIT=!0;break;case A.x.PLANAR_MODE:t.REFLECTIONMAP_PLANAR=!0;break;case A.x.PROJECTION_MODE:t.REFLECTIONMAP_PROJECTION=!0;break;case A.x.SKYBOX_MODE:t.REFLECTIONMAP_SKYBOX=!0;break;case A.x.SPHERICAL_MODE:t.REFLECTIONMAP_SPHERICAL=!0;break;case A.x.EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case A.x.FIXED_EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case A.x.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case A.x.CUBIC_MODE:case A.x.INVCUBIC_MODE:default:t.REFLECTIONMAP_CUBIC=!0,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!!e.boundingBoxSize}e.coordinatesMode!==A.x.SKYBOX_MODE&&(e.irradianceTexture?(t.USEIRRADIANCEMAP=!0,t.USESPHERICALFROMREFLECTIONMAP=!1):e.isCube&&(t.USESPHERICALFROMREFLECTIONMAP=!0,t.USEIRRADIANCEMAP=!1,this._forceIrradianceInFragment||this.realTimeFiltering||a.getCaps().maxVaryingVectors<=8?t.USESPHERICALINVERTEX=!1:t.USESPHERICALINVERTEX=!0))}else t.REFLECTION=!1,t.REFLECTIONMAP_3D=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_CUBIC=!1,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.INVERTCUBICMAP=!1,t.USESPHERICALFROMREFLECTIONMAP=!1,t.USEIRRADIANCEMAP=!1,t.USESPHERICALINVERTEX=!1,t.REFLECTIONMAP_OPPOSITEZ=!1,t.LODINREFLECTIONALPHA=!1,t.GAMMAREFLECTION=!1,t.RGBDREFLECTION=!1,t.LINEARSPECULARREFLECTION=!1;if(this._lightmapTexture&&C.k.LightmapTextureEnabled?(v.G.PrepareDefinesForMergedUV(this._lightmapTexture,t,"LIGHTMAP"),t.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,t.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace,t.RGBDLIGHTMAP=this._lightmapTexture.isRGBD):t.LIGHTMAP=!1,this._emissiveTexture&&C.k.EmissiveTextureEnabled?(v.G.PrepareDefinesForMergedUV(this._emissiveTexture,t,"EMISSIVE"),t.GAMMAEMISSIVE=this._emissiveTexture.gammaSpace):t.EMISSIVE=!1,C.k.SpecularTextureEnabled){if(this._metallicTexture?(v.G.PrepareDefinesForMergedUV(this._metallicTexture,t,"REFLECTIVITY"),t.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,t.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,t.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,t.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed,t.REFLECTIVITY_GAMMA=!1):this._reflectivityTexture?(v.G.PrepareDefinesForMergedUV(this._reflectivityTexture,t,"REFLECTIVITY"),t.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,t.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap,t.REFLECTIVITY_GAMMA=this._reflectivityTexture.gammaSpace):t.REFLECTIVITY=!1,this._metallicReflectanceTexture||this._reflectanceTexture){const e=null!==this._metallicReflectanceTexture&&this._metallicReflectanceTexture._texture===(null===(s=this._reflectanceTexture)||void 0===s?void 0:s._texture)&&this._metallicReflectanceTexture.checkTransformsAreIdentical(this._reflectanceTexture);t.METALLIC_REFLECTANCE_USE_ALPHA_ONLY=this._useOnlyMetallicFromMetallicReflectanceTexture&&!e,this._metallicReflectanceTexture?(v.G.PrepareDefinesForMergedUV(this._metallicReflectanceTexture,t,"METALLIC_REFLECTANCE"),t.METALLIC_REFLECTANCE_GAMMA=this._metallicReflectanceTexture.gammaSpace):t.METALLIC_REFLECTANCE=!1,this._reflectanceTexture&&!e&&(!this._metallicReflectanceTexture||this._metallicReflectanceTexture&&this._useOnlyMetallicFromMetallicReflectanceTexture)?(v.G.PrepareDefinesForMergedUV(this._reflectanceTexture,t,"REFLECTANCE"),t.REFLECTANCE_GAMMA=this._reflectanceTexture.gammaSpace):t.REFLECTANCE=!1}else t.METALLIC_REFLECTANCE=!1,t.REFLECTANCE=!1;this._microSurfaceTexture?v.G.PrepareDefinesForMergedUV(this._microSurfaceTexture,t,"MICROSURFACEMAP"):t.MICROSURFACEMAP=!1}else t.REFLECTIVITY=!1,t.MICROSURFACEMAP=!1;a.getCaps().standardDerivatives&&this._bumpTexture&&C.k.BumpTextureEnabled&&!this._disableBumpMap?(v.G.PrepareDefinesForMergedUV(this._bumpTexture,t,"BUMP"),this._useParallax&&this._albedoTexture&&C.k.DiffuseTextureEnabled?(t.PARALLAX=!0,t.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):t.PARALLAX=!1,t.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):(t.BUMP=!1,t.PARALLAX=!1,t.PARALLAXOCCLUSION=!1,t.PARALLAOBJECTSPACE_NORMALMAP=!1),this._environmentBRDFTexture&&C.k.ReflectionTextureEnabled?(t.ENVIRONMENTBRDF=!0,t.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(t.ENVIRONMENTBRDF=!1,t.ENVIRONMENTBRDF_RGBD=!1),this._shouldUseAlphaFromAlbedoTexture()?t.ALPHAFROMALBEDO=!0:t.ALPHAFROMALBEDO=!1}t.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===w.LIGHTFALLOFF_STANDARD?(t.USEPHYSICALLIGHTFALLOFF=!1,t.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===w.LIGHTFALLOFF_GLTF?(t.USEPHYSICALLIGHTFALLOFF=!1,t.USEGLTFLIGHTFALLOFF=!0):(t.USEPHYSICALLIGHTFALLOFF=!0,t.USEGLTFLIGHTFALLOFF=!1),t.RADIANCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?t.TWOSIDEDLIGHTING=!0:t.TWOSIDEDLIGHTING=!1,t.SPECULARAA=a.getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(t._areTexturesDirty||t._areMiscDirty)&&(t.ALPHATESTVALUE=`${this._alphaCutOff}${this._alphaCutOff%1==0?".":""}`,t.PREMULTIPLYALPHA=7===this.alphaMode||8===this.alphaMode,t.ALPHABLEND=this.needAlphaBlendingForMesh(e),t.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,t.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel),t._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(t),t.FORCENORMALFORWARD=this._forceNormalForward,t.RADIANCEOCCLUSION=this._useRadianceOcclusion,t.HORIZONOCCLUSION=this._useHorizonOcclusion,t._areMiscDirty&&(v.G.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,t),t.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(h.o.NormalKind),t.DEBUGMODE=this._debugMode),v.G.PrepareDefinesForFrameBoundValues(o,a,t,!!i,n,r),this._eventInfo.defines=t,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),v.G.PrepareDefinesForAttributes(e,t,!0,!0,!0,this._transparencyMode!==w.PBRMATERIAL_OPAQUE),this._callbackPluginEventPrepareDefines(this._eventInfo)}forceCompilation(e,t,i){const n={clipPlane:!1,useInstances:!1,...i};this._uniformBufferLayoutBuilt||this.buildUniformLayout(),this._callbackPluginEventGeneric(g.S.GetDefineNames,this._eventInfo);const r=new O(this._eventInfo.defineNames),s=this._prepareEffect(e,r,void 0,void 0,n.useInstances,n.clipPlane,e.hasThinInstances);this._onEffectCreatedObservable&&(D.effect=s,D.subMesh=null,this._onEffectCreatedObservable.notifyObservers(D)),s.isReady()?t&&t(this):s.onCompileObservable.add((()=>{t&&t(this)}))}buildUniformLayout(){const e=this._uniformBuffer;e.addUniform("vAlbedoInfos",2),e.addUniform("vAmbientInfos",4),e.addUniform("vOpacityInfos",2),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vReflectivityInfos",3),e.addUniform("vMicroSurfaceSamplerInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionFilteringInfo",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vBumpInfos",3),e.addUniform("albedoMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("reflectivityMatrix",16),e.addUniform("microSurfaceSamplerMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("reflectionMatrix",16),e.addUniform("vReflectionColor",3),e.addUniform("vAlbedoColor",4),e.addUniform("vLightingIntensity",4),e.addUniform("vReflectionMicrosurfaceInfos",3),e.addUniform("pointSize",1),e.addUniform("vReflectivityColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("vAmbientColor",3),e.addUniform("vDebugMode",2),e.addUniform("vMetallicReflectanceFactors",4),e.addUniform("vMetallicReflectanceInfos",2),e.addUniform("metallicReflectanceMatrix",16),e.addUniform("vReflectanceInfos",2),e.addUniform("reflectanceMatrix",16),e.addUniform("vSphericalL00",3),e.addUniform("vSphericalL1_1",3),e.addUniform("vSphericalL10",3),e.addUniform("vSphericalL11",3),e.addUniform("vSphericalL2_2",3),e.addUniform("vSphericalL2_1",3),e.addUniform("vSphericalL20",3),e.addUniform("vSphericalL21",3),e.addUniform("vSphericalL22",3),e.addUniform("vSphericalX",3),e.addUniform("vSphericalY",3),e.addUniform("vSphericalZ",3),e.addUniform("vSphericalXX_ZZ",3),e.addUniform("vSphericalYY_ZZ",3),e.addUniform("vSphericalZZ",3),e.addUniform("vSphericalXY",3),e.addUniform("vSphericalYZ",3),e.addUniform("vSphericalZX",3),super.buildUniformLayout()}bindForSubMesh(e,t,i){var n,r,s,o;const a=this.getScene(),c=i.materialDefines;if(!c)return;const h=i.effect;if(!h)return;this._activeEffect=h,t.getMeshUniformBuffer().bindToEffect(h,"Mesh"),t.transferToEffect(e);const _=a.getEngine();this._uniformBuffer.bindToEffect(h,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,a,t,e,this.isFrozen),this._eventInfo.subMesh=i,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),c.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));const d=this._mustRebind(a,h,t.visibility);v.G.BindBonesParameters(t,this._activeEffect,this.prePassConfiguration);let f=null;const m=this._uniformBuffer;if(d){if(this.bindViewProjection(h),f=this._getReflectionTexture(),!m.useUbo||!this.isFrozen||!m.isSync){if(a.texturesEnabled){if(this._albedoTexture&&C.k.DiffuseTextureEnabled&&(m.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),v.G.BindTextureMatrix(this._albedoTexture,m,"albedo")),this._ambientTexture&&C.k.AmbientTextureEnabled&&(m.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),v.G.BindTextureMatrix(this._ambientTexture,m,"ambient")),this._opacityTexture&&C.k.OpacityTextureEnabled&&(m.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),v.G.BindTextureMatrix(this._opacityTexture,m,"opacity")),f&&C.k.ReflectionTextureEnabled){if(m.updateMatrix("reflectionMatrix",f.getReflectionTextureMatrix()),m.updateFloat2("vReflectionInfos",f.level,0),f.boundingBoxSize){const e=f;m.updateVector3("vReflectionPosition",e.boundingBoxPosition),m.updateVector3("vReflectionSize",e.boundingBoxSize)}if(this.realTimeFiltering){const e=f.getSize().width;m.updateFloat2("vReflectionFilteringInfo",e,p.R.Log2(e))}if(!c.USEIRRADIANCEMAP){const e=f.sphericalPolynomial;if(c.USESPHERICALFROMREFLECTIONMAP&&e)if(c.SPHERICAL_HARMONICS){const t=e.preScaledHarmonics;m.updateVector3("vSphericalL00",t.l00),m.updateVector3("vSphericalL1_1",t.l1_1),m.updateVector3("vSphericalL10",t.l10),m.updateVector3("vSphericalL11",t.l11),m.updateVector3("vSphericalL2_2",t.l2_2),m.updateVector3("vSphericalL2_1",t.l2_1),m.updateVector3("vSphericalL20",t.l20),m.updateVector3("vSphericalL21",t.l21),m.updateVector3("vSphericalL22",t.l22)}else m.updateFloat3("vSphericalX",e.x.x,e.x.y,e.x.z),m.updateFloat3("vSphericalY",e.y.x,e.y.y,e.y.z),m.updateFloat3("vSphericalZ",e.z.x,e.z.y,e.z.z),m.updateFloat3("vSphericalXX_ZZ",e.xx.x-e.zz.x,e.xx.y-e.zz.y,e.xx.z-e.zz.z),m.updateFloat3("vSphericalYY_ZZ",e.yy.x-e.zz.x,e.yy.y-e.zz.y,e.yy.z-e.zz.z),m.updateFloat3("vSphericalZZ",e.zz.x,e.zz.y,e.zz.z),m.updateFloat3("vSphericalXY",e.xy.x,e.xy.y,e.xy.z),m.updateFloat3("vSphericalYZ",e.yz.x,e.yz.y,e.yz.z),m.updateFloat3("vSphericalZX",e.zx.x,e.zx.y,e.zx.z)}m.updateFloat3("vReflectionMicrosurfaceInfos",f.getSize().width,f.lodGenerationScale,f.lodGenerationOffset)}this._emissiveTexture&&C.k.EmissiveTextureEnabled&&(m.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),v.G.BindTextureMatrix(this._emissiveTexture,m,"emissive")),this._lightmapTexture&&C.k.LightmapTextureEnabled&&(m.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),v.G.BindTextureMatrix(this._lightmapTexture,m,"lightmap")),C.k.SpecularTextureEnabled&&(this._metallicTexture?(m.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),v.G.BindTextureMatrix(this._metallicTexture,m,"reflectivity")):this._reflectivityTexture&&(m.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),v.G.BindTextureMatrix(this._reflectivityTexture,m,"reflectivity")),this._metallicReflectanceTexture&&(m.updateFloat2("vMetallicReflectanceInfos",this._metallicReflectanceTexture.coordinatesIndex,this._metallicReflectanceTexture.level),v.G.BindTextureMatrix(this._metallicReflectanceTexture,m,"metallicReflectance")),this._reflectanceTexture&&c.REFLECTANCE&&(m.updateFloat2("vReflectanceInfos",this._reflectanceTexture.coordinatesIndex,this._reflectanceTexture.level),v.G.BindTextureMatrix(this._reflectanceTexture,m,"reflectance")),this._microSurfaceTexture&&(m.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),v.G.BindTextureMatrix(this._microSurfaceTexture,m,"microSurfaceSampler"))),this._bumpTexture&&_.getCaps().standardDerivatives&&C.k.BumpTextureEnabled&&!this._disableBumpMap&&(m.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),v.G.BindTextureMatrix(this._bumpTexture,m,"bump"),a._mirroredCameraPosition?m.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):m.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1))}if(this.pointsCloud&&m.updateFloat("pointSize",this.pointSize),c.METALLICWORKFLOW){u.zZ.Color3[0].r=void 0===this._metallic||null===this._metallic?1:this._metallic,u.zZ.Color3[0].g=void 0===this._roughness||null===this._roughness?1:this._roughness,m.updateColor4("vReflectivityColor",u.zZ.Color3[0],1);const e=null!==(r=null===(n=this.subSurface)||void 0===n?void 0:n._indexOfRefraction)&&void 0!==r?r:1.5,t=1,i=Math.pow((e-t)/(e+t),2);this._metallicReflectanceColor.scaleToRef(i*this._metallicF0Factor,u.zZ.Color3[0]);const s=this._metallicF0Factor;m.updateColor4("vMetallicReflectanceFactors",u.zZ.Color3[0],s)}else m.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface);m.updateColor3("vEmissiveColor",C.k.EmissiveTextureEnabled?this._emissiveColor:u.Wo.BlackReadOnly),m.updateColor3("vReflectionColor",this._reflectionColor),!c.SS_REFRACTION&&(null===(s=this.subSurface)||void 0===s?void 0:s._linkRefractionWithTransparency)?m.updateColor4("vAlbedoColor",this._albedoColor,1):m.updateColor4("vAlbedoColor",this._albedoColor,this.alpha),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity*a.environmentIntensity,this._lightingInfos.w=this._specularIntensity,m.updateVector4("vLightingIntensity",this._lightingInfos),a.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor),m.updateColor3("vAmbientColor",this._globalAmbientColor),m.updateFloat2("vDebugMode",this._debugLimit,this._debugFactor)}a.texturesEnabled&&(this._albedoTexture&&C.k.DiffuseTextureEnabled&&m.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&C.k.AmbientTextureEnabled&&m.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&C.k.OpacityTextureEnabled&&m.setTexture("opacitySampler",this._opacityTexture),f&&C.k.ReflectionTextureEnabled&&(c.LODBASEDMICROSFURACE?m.setTexture("reflectionSampler",f):(m.setTexture("reflectionSampler",f._lodTextureMid||f),m.setTexture("reflectionSamplerLow",f._lodTextureLow||f),m.setTexture("reflectionSamplerHigh",f._lodTextureHigh||f)),c.USEIRRADIANCEMAP&&m.setTexture("irradianceSampler",f.irradianceTexture)),c.ENVIRONMENTBRDF&&m.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),this._emissiveTexture&&C.k.EmissiveTextureEnabled&&m.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&C.k.LightmapTextureEnabled&&m.setTexture("lightmapSampler",this._lightmapTexture),C.k.SpecularTextureEnabled&&(this._metallicTexture?m.setTexture("reflectivitySampler",this._metallicTexture):this._reflectivityTexture&&m.setTexture("reflectivitySampler",this._reflectivityTexture),this._metallicReflectanceTexture&&m.setTexture("metallicReflectanceSampler",this._metallicReflectanceTexture),this._reflectanceTexture&&c.REFLECTANCE&&m.setTexture("reflectanceSampler",this._reflectanceTexture),this._microSurfaceTexture&&m.setTexture("microSurfaceSampler",this._microSurfaceTexture)),this._bumpTexture&&_.getCaps().standardDerivatives&&C.k.BumpTextureEnabled&&!this._disableBumpMap&&m.setTexture("bumpSampler",this._bumpTexture)),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(t)&&this.getScene().depthPeelingRenderer.bind(h),this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),v.G.BindClipPlane(this._activeEffect,a),this.bindEyePosition(h)}else a.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0);!d&&this.isFrozen||(a.lightsEnabled&&!this._disableLighting&&v.G.BindLights(a,t,this._activeEffect,c,this._maxSimultaneousLights),(a.fogEnabled&&t.applyFog&&a.fogMode!==l.x.FOGMODE_NONE||f||t.receiveShadows||c.PREPASS)&&this.bindView(h),v.G.BindFogParameters(a,t,this._activeEffect,!0),c.NUM_MORPH_INFLUENCERS&&v.G.BindMorphTargetParameters(t,this._activeEffect),c.BAKED_VERTEX_ANIMATION_TEXTURE&&(null===(o=t.bakedVertexAnimationManager)||void 0===o||o.bind(h,c.INSTANCES)),this._imageProcessingConfiguration.bind(this._activeEffect),v.G.BindLogDepth(c,this._activeEffect,a)),this._afterBind(t,this._activeEffect),m.update()}getAnimatables(){const e=super.getAnimatables();return this._albedoTexture&&this._albedoTexture.animations&&this._albedoTexture.animations.length>0&&e.push(this._albedoTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._metallicTexture&&this._metallicTexture.animations&&this._metallicTexture.animations.length>0?e.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&this._reflectivityTexture.animations.length>0&&e.push(this._reflectivityTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),e}_getReflectionTexture(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture}getActiveTextures(){const e=super.getActiveTextures();return this._albedoTexture&&e.push(this._albedoTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._reflectivityTexture&&e.push(this._reflectivityTexture),this._metallicTexture&&e.push(this._metallicTexture),this._metallicReflectanceTexture&&e.push(this._metallicReflectanceTexture),this._reflectanceTexture&&e.push(this._reflectanceTexture),this._microSurfaceTexture&&e.push(this._microSurfaceTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),e}hasTexture(e){return!!super.hasTexture(e)||this._albedoTexture===e||this._ambientTexture===e||this._opacityTexture===e||this._reflectionTexture===e||this._reflectivityTexture===e||this._metallicTexture===e||this._metallicReflectanceTexture===e||this._reflectanceTexture===e||this._microSurfaceTexture===e||this._bumpTexture===e||this._lightmapTexture===e}setPrePassRenderer(){var e;if(null===(e=this.subSurface)||void 0===e?void 0:e.isScatteringEnabled){const e=this.getScene().enableSubSurfaceForPrePass();return e&&(e.enabled=!0),!0}return!1}dispose(e,t){var i,n,r,s,o,a,l,c,h,_,d,u;t&&(this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),null===(i=this._albedoTexture)||void 0===i||i.dispose(),null===(n=this._ambientTexture)||void 0===n||n.dispose(),null===(r=this._opacityTexture)||void 0===r||r.dispose(),null===(s=this._reflectionTexture)||void 0===s||s.dispose(),null===(o=this._emissiveTexture)||void 0===o||o.dispose(),null===(a=this._metallicTexture)||void 0===a||a.dispose(),null===(l=this._reflectivityTexture)||void 0===l||l.dispose(),null===(c=this._bumpTexture)||void 0===c||c.dispose(),null===(h=this._lightmapTexture)||void 0===h||h.dispose(),null===(_=this._metallicReflectanceTexture)||void 0===_||_.dispose(),null===(d=this._reflectanceTexture)||void 0===d||d.dispose(),null===(u=this._microSurfaceTexture)||void 0===u||u.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e,t)}}w.PBRMATERIAL_OPAQUE=m.F.MATERIAL_OPAQUE,w.PBRMATERIAL_ALPHATEST=m.F.MATERIAL_ALPHATEST,w.PBRMATERIAL_ALPHABLEND=m.F.MATERIAL_ALPHABLEND,w.PBRMATERIAL_ALPHATESTANDBLEND=m.F.MATERIAL_ALPHATESTANDBLEND,w.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0,w.LIGHTFALLOFF_PHYSICAL=0,w.LIGHTFALLOFF_GLTF=1,w.LIGHTFALLOFF_STANDARD=2,(0,n.gn)([(0,r.rX)()],w.prototype,"_imageProcessingConfiguration",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsMiscDirty")],w.prototype,"debugMode",void 0),(0,n.gn)([(0,r.qC)()],w.prototype,"useLogarithmicDepth",null)},"../../../node_modules/@babylonjs/core/Materials/PBR/pbrClearCoatConfiguration.js":function(e,t,i){"use strict";i.d(t,{Y:function(){return _}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),o=i("../../../node_modules/@babylonjs/core/Materials/materialFlags.js"),a=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),l=i("../../../node_modules/@babylonjs/core/Materials/materialPluginBase.js"),c=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js");class h extends c.H{constructor(){super(...arguments),this.CLEARCOAT=!1,this.CLEARCOAT_DEFAULTIOR=!1,this.CLEARCOAT_TEXTURE=!1,this.CLEARCOAT_TEXTURE_ROUGHNESS=!1,this.CLEARCOAT_TEXTUREDIRECTUV=0,this.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV=0,this.CLEARCOAT_BUMP=!1,this.CLEARCOAT_BUMPDIRECTUV=0,this.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,this.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=!1,this.CLEARCOAT_REMAP_F0=!1,this.CLEARCOAT_TINT=!1,this.CLEARCOAT_TINT_TEXTURE=!1,this.CLEARCOAT_TINT_TEXTUREDIRECTUV=0,this.CLEARCOAT_TINT_GAMMATEXTURE=!1}}class _ extends l.n{constructor(e,t=!0){super(e,"PBRClearCoat",100,new h,t),this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.roughness=0,this._indexOfRefraction=_._DefaultIndexOfRefraction,this.indexOfRefraction=_._DefaultIndexOfRefraction,this._texture=null,this.texture=null,this._useRoughnessFromMainTexture=!0,this.useRoughnessFromMainTexture=!0,this._textureRoughness=null,this.textureRoughness=null,this._remapF0OnInterfaceChange=!0,this.remapF0OnInterfaceChange=!0,this._bumpTexture=null,this.bumpTexture=null,this._isTintEnabled=!1,this.isTintEnabled=!1,this.tintColor=s.Wo.White(),this.tintColorAtDistance=1,this.tintThickness=1,this._tintTexture=null,this.tintTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isReadyForSubMesh(e,t,i){if(!this._isEnabled)return!0;const n=this._material._disableBumpMap;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&o.k.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&o.k.ClearCoatTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1;if(i.getCaps().standardDerivatives&&this._bumpTexture&&o.k.ClearCoatBumpTextureEnabled&&!n&&!this._bumpTexture.isReady())return!1;if(this._isTintEnabled&&this._tintTexture&&o.k.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking())return!1}return!0}prepareDefinesBeforeAttributes(e,t){var i;this._isEnabled?(e.CLEARCOAT=!0,e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(i=this._textureRoughness)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),e.CLEARCOAT_REMAP_F0=this._remapF0OnInterfaceChange,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&o.k.ClearCoatTextureEnabled?a.G.PrepareDefinesForMergedUV(this._texture,e,"CLEARCOAT_TEXTURE"):e.CLEARCOAT_TEXTURE=!1,this._textureRoughness&&o.k.ClearCoatTextureEnabled?a.G.PrepareDefinesForMergedUV(this._textureRoughness,e,"CLEARCOAT_TEXTURE_ROUGHNESS"):e.CLEARCOAT_TEXTURE_ROUGHNESS=!1,this._bumpTexture&&o.k.ClearCoatBumpTextureEnabled?a.G.PrepareDefinesForMergedUV(this._bumpTexture,e,"CLEARCOAT_BUMP"):e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_DEFAULTIOR=this._indexOfRefraction===_._DefaultIndexOfRefraction,this._isTintEnabled?(e.CLEARCOAT_TINT=!0,this._tintTexture&&o.k.ClearCoatTintTextureEnabled?(a.G.PrepareDefinesForMergedUV(this._tintTexture,e,"CLEARCOAT_TINT_TEXTURE"),e.CLEARCOAT_TINT_GAMMATEXTURE=this._tintTexture.gammaSpace):e.CLEARCOAT_TINT_TEXTURE=!1):(e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1))):(e.CLEARCOAT=!1,e.CLEARCOAT_TEXTURE=!1,e.CLEARCOAT_TEXTURE_ROUGHNESS=!1,e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1,e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=!1,e.CLEARCOAT_DEFAULTIOR=!1,e.CLEARCOAT_TEXTUREDIRECTUV=0,e.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV=0,e.CLEARCOAT_BUMPDIRECTUV=0,e.CLEARCOAT_REMAP_F0=!1,e.CLEARCOAT_TINT_TEXTUREDIRECTUV=0,e.CLEARCOAT_TINT_GAMMATEXTURE=!1)}bindForSubMesh(e,t,i,n){var r,s,l,c,h,_,d,u;if(!this._isEnabled)return;const p=n.materialDefines,f=this._material.isFrozen,m=this._material._disableBumpMap,g=this._material._invertNormalMapX,b=this._material._invertNormalMapY,y=p.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL;if(!e.useUbo||!f||!e.isSync){y&&o.k.ClearCoatTextureEnabled?(e.updateFloat4("vClearCoatInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),a.G.BindTextureMatrix(this._texture,e,"clearCoat")):(this._texture||this._textureRoughness)&&o.k.ClearCoatTextureEnabled&&(e.updateFloat4("vClearCoatInfos",null!==(s=null===(r=this._texture)||void 0===r?void 0:r.coordinatesIndex)&&void 0!==s?s:0,null!==(c=null===(l=this._texture)||void 0===l?void 0:l.level)&&void 0!==c?c:0,null!==(_=null===(h=this._textureRoughness)||void 0===h?void 0:h.coordinatesIndex)&&void 0!==_?_:0,null!==(u=null===(d=this._textureRoughness)||void 0===d?void 0:d.level)&&void 0!==u?u:0),this._texture&&a.G.BindTextureMatrix(this._texture,e,"clearCoat"),!this._textureRoughness||y||p.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE||a.G.BindTextureMatrix(this._textureRoughness,e,"clearCoatRoughness")),this._bumpTexture&&i.getCaps().standardDerivatives&&o.k.ClearCoatTextureEnabled&&!m&&(e.updateFloat2("vClearCoatBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),a.G.BindTextureMatrix(this._bumpTexture,e,"clearCoatBump"),t._mirroredCameraPosition?e.updateFloat2("vClearCoatTangentSpaceParams",g?1:-1,b?1:-1):e.updateFloat2("vClearCoatTangentSpaceParams",g?-1:1,b?-1:1)),this._tintTexture&&o.k.ClearCoatTintTextureEnabled&&(e.updateFloat2("vClearCoatTintInfos",this._tintTexture.coordinatesIndex,this._tintTexture.level),a.G.BindTextureMatrix(this._tintTexture,e,"clearCoatTint")),e.updateFloat2("vClearCoatParams",this.intensity,this.roughness);const n=1-this._indexOfRefraction,f=1+this._indexOfRefraction,v=Math.pow(-n/f,2),A=1/this._indexOfRefraction;e.updateFloat4("vClearCoatRefractionParams",v,A,n,f),this._isTintEnabled&&(e.updateFloat4("vClearCoatTintParams",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat("clearCoatColorAtDistance",Math.max(1e-5,this.tintColorAtDistance)))}t.texturesEnabled&&(this._texture&&o.k.ClearCoatTextureEnabled&&e.setTexture("clearCoatSampler",this._texture),this._textureRoughness&&!y&&!p.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE&&o.k.ClearCoatTextureEnabled&&e.setTexture("clearCoatRoughnessSampler",this._textureRoughness),this._bumpTexture&&i.getCaps().standardDerivatives&&o.k.ClearCoatBumpTextureEnabled&&!m&&e.setTexture("clearCoatBumpSampler",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&o.k.ClearCoatTintTextureEnabled&&e.setTexture("clearCoatTintSampler",this._tintTexture))}hasTexture(e){return this._texture===e||this._textureRoughness===e||this._bumpTexture===e||this._tintTexture===e}getActiveTextures(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&this._tintTexture.animations.length>0&&e.push(this._tintTexture)}dispose(e){var t,i,n,r;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._textureRoughness)||void 0===i||i.dispose(),null===(n=this._bumpTexture)||void 0===n||n.dispose(),null===(r=this._tintTexture)||void 0===r||r.dispose())}getClassName(){return"PBRClearCoatConfiguration"}addFallbacks(e,t,i){return e.CLEARCOAT_BUMP&&t.addFallback(i++,"CLEARCOAT_BUMP"),e.CLEARCOAT_TINT&&t.addFallback(i++,"CLEARCOAT_TINT"),e.CLEARCOAT&&t.addFallback(i++,"CLEARCOAT"),i}getSamplers(e){e.push("clearCoatSampler","clearCoatRoughnessSampler","clearCoatBumpSampler","clearCoatTintSampler")}getUniforms(){return{ubo:[{name:"vClearCoatParams",size:2,type:"vec2"},{name:"vClearCoatRefractionParams",size:4,type:"vec4"},{name:"vClearCoatInfos",size:4,type:"vec4"},{name:"clearCoatMatrix",size:16,type:"mat4"},{name:"clearCoatRoughnessMatrix",size:16,type:"mat4"},{name:"vClearCoatBumpInfos",size:2,type:"vec2"},{name:"vClearCoatTangentSpaceParams",size:2,type:"vec2"},{name:"clearCoatBumpMatrix",size:16,type:"mat4"},{name:"vClearCoatTintParams",size:4,type:"vec4"},{name:"clearCoatColorAtDistance",size:1,type:"float"},{name:"vClearCoatTintInfos",size:2,type:"vec2"},{name:"clearCoatTintMatrix",size:16,type:"mat4"}]}}}_._DefaultIndexOfRefraction=1.5,(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"isEnabled",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"intensity",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"roughness",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"indexOfRefraction",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"texture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"useRoughnessFromMainTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"textureRoughness",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"remapF0OnInterfaceChange",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"bumpTexture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"isTintEnabled",void 0),(0,n.gn)([(0,r.n9)()],_.prototype,"tintColor",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"tintColorAtDistance",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"tintThickness",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"tintTexture",void 0)},"../../../node_modules/@babylonjs/core/Materials/PBR/pbrIridescenceConfiguration.js":function(e,t,i){"use strict";i.d(t,{B:function(){return h}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Materials/materialFlags.js"),o=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),a=i("../../../node_modules/@babylonjs/core/Materials/materialPluginBase.js"),l=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js");class c extends l.H{constructor(){super(...arguments),this.IRIDESCENCE=!1,this.IRIDESCENCE_TEXTURE=!1,this.IRIDESCENCE_TEXTUREDIRECTUV=0,this.IRIDESCENCE_THICKNESS_TEXTURE=!1,this.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV=0,this.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE=!1}}class h extends a.n{constructor(e,t=!0){super(e,"PBRIridescence",110,new c,t),this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.minimumThickness=h._DefaultMinimumThickness,this.maximumThickness=h._DefaultMaximumThickness,this.indexOfRefraction=h._DefaultIndexOfRefraction,this._texture=null,this.texture=null,this._thicknessTexture=null,this.thicknessTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isReadyForSubMesh(e,t){if(!this._isEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&s.k.IridescenceTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._thicknessTexture&&s.k.IridescenceTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1}return!0}prepareDefinesBeforeAttributes(e,t){var i;this._isEnabled?(e.IRIDESCENCE=!0,e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE=null!==this._texture&&this._texture._texture===(null===(i=this._thicknessTexture)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._thicknessTexture),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&s.k.IridescenceTextureEnabled?o.G.PrepareDefinesForMergedUV(this._texture,e,"IRIDESCENCE_TEXTURE"):e.IRIDESCENCE_TEXTURE=!1,!e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE&&this._thicknessTexture&&s.k.IridescenceTextureEnabled?o.G.PrepareDefinesForMergedUV(this._thicknessTexture,e,"IRIDESCENCE_THICKNESS_TEXTURE"):e.IRIDESCENCE_THICKNESS_TEXTURE=!1)):(e.IRIDESCENCE=!1,e.IRIDESCENCE_TEXTURE=!1,e.IRIDESCENCE_THICKNESS_TEXTURE=!1,e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE=!1,e.IRIDESCENCE_TEXTUREDIRECTUV=0,e.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV=0)}bindForSubMesh(e,t,i,n){var r,a,l,c,h,_,d,u;if(!this._isEnabled)return;const p=n.materialDefines,f=this._material.isFrozen,m=p.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE;e.useUbo&&f&&e.isSync||(m&&s.k.IridescenceTextureEnabled?(e.updateFloat4("vIridescenceInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),o.G.BindTextureMatrix(this._texture,e,"iridescence")):(this._texture||this._thicknessTexture)&&s.k.IridescenceTextureEnabled&&(e.updateFloat4("vIridescenceInfos",null!==(a=null===(r=this._texture)||void 0===r?void 0:r.coordinatesIndex)&&void 0!==a?a:0,null!==(c=null===(l=this._texture)||void 0===l?void 0:l.level)&&void 0!==c?c:0,null!==(_=null===(h=this._thicknessTexture)||void 0===h?void 0:h.coordinatesIndex)&&void 0!==_?_:0,null!==(u=null===(d=this._thicknessTexture)||void 0===d?void 0:d.level)&&void 0!==u?u:0),this._texture&&o.G.BindTextureMatrix(this._texture,e,"iridescence"),!this._thicknessTexture||m||p.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE||o.G.BindTextureMatrix(this._thicknessTexture,e,"iridescenceThickness")),e.updateFloat4("vIridescenceParams",this.intensity,this.indexOfRefraction,this.minimumThickness,this.maximumThickness)),t.texturesEnabled&&(this._texture&&s.k.IridescenceTextureEnabled&&e.setTexture("iridescenceSampler",this._texture),this._thicknessTexture&&!m&&!p.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE&&s.k.IridescenceTextureEnabled&&e.setTexture("iridescenceThicknessSampler",this._thicknessTexture))}hasTexture(e){return this._texture===e||this._thicknessTexture===e}getActiveTextures(e){this._texture&&e.push(this._texture),this._thicknessTexture&&e.push(this._thicknessTexture)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture)}dispose(e){var t,i;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._thicknessTexture)||void 0===i||i.dispose())}getClassName(){return"PBRIridescenceConfiguration"}addFallbacks(e,t,i){return e.IRIDESCENCE&&t.addFallback(i++,"IRIDESCENCE"),i}getSamplers(e){e.push("iridescenceSampler","iridescenceThicknessSampler")}getUniforms(){return{ubo:[{name:"vIridescenceParams",size:4,type:"vec4"},{name:"vIridescenceInfos",size:4,type:"vec4"},{name:"iridescenceMatrix",size:16,type:"mat4"},{name:"iridescenceThicknessMatrix",size:16,type:"mat4"}]}}}h._DefaultMinimumThickness=100,h._DefaultMaximumThickness=400,h._DefaultIndexOfRefraction=1.3,(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"isEnabled",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"intensity",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"minimumThickness",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"maximumThickness",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"indexOfRefraction",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"texture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],h.prototype,"thicknessTexture",void 0)},"../../../node_modules/@babylonjs/core/Materials/PBR/pbrMaterial.js":function(e,t,i){"use strict";i.d(t,{Y:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Misc/brdfTextureTools.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),a=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrBaseMaterial.js"),l=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class c extends a.m{constructor(e,t){super(e,t),this.directIntensity=1,this.emissiveIntensity=1,this.environmentIntensity=1,this.specularIntensity=1,this.disableBumpMap=!1,this.ambientTextureStrength=1,this.ambientTextureImpactOnAnalyticalLights=c.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,this.metallicF0Factor=1,this.metallicReflectanceColor=o.Wo.White(),this.useOnlyMetallicFromMetallicReflectanceTexture=!1,this.ambientColor=new o.Wo(0,0,0),this.albedoColor=new o.Wo(1,1,1),this.reflectivityColor=new o.Wo(1,1,1),this.reflectionColor=new o.Wo(1,1,1),this.emissiveColor=new o.Wo(0,0,0),this.microSurface=1,this.useLightmapAsShadowmap=!1,this.useAlphaFromAlbedoTexture=!1,this.forceAlphaTest=!1,this.alphaCutOff=.4,this.useSpecularOverAlpha=!0,this.useMicroSurfaceFromReflectivityMapAlpha=!1,this.useRoughnessFromMetallicTextureAlpha=!0,this.useRoughnessFromMetallicTextureGreen=!1,this.useMetallnessFromMetallicTextureBlue=!1,this.useAmbientOcclusionFromMetallicTextureRed=!1,this.useAmbientInGrayScale=!1,this.useAutoMicroSurfaceFromReflectivityMap=!1,this.useRadianceOverAlpha=!0,this.useObjectSpaceNormalMap=!1,this.useParallax=!1,this.useParallaxOcclusion=!1,this.parallaxScaleBias=.05,this.disableLighting=!1,this.forceIrradianceInFragment=!1,this.maxSimultaneousLights=4,this.invertNormalMapX=!1,this.invertNormalMapY=!1,this.twoSidedLighting=!1,this.useAlphaFresnel=!1,this.useLinearAlphaFresnel=!1,this.environmentBRDFTexture=null,this.forceNormalForward=!1,this.enableSpecularAntiAliasing=!1,this.useHorizonOcclusion=!0,this.useRadianceOcclusion=!0,this.unlit=!1,this._environmentBRDFTexture=(0,s.$)(this.getScene())}get refractionTexture(){return this.subSurface.refractionTexture}set refractionTexture(e){this.subSurface.refractionTexture=e,e?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)}get indexOfRefraction(){return this.subSurface.indexOfRefraction}set indexOfRefraction(e){this.subSurface.indexOfRefraction=e}get invertRefractionY(){return this.subSurface.invertRefractionY}set invertRefractionY(e){this.subSurface.invertRefractionY=e}get linkRefractionWithTransparency(){return this.subSurface.linkRefractionWithTransparency}set linkRefractionWithTransparency(e){this.subSurface.linkRefractionWithTransparency=e,e&&(this.subSurface.isRefractionEnabled=!0)}get usePhysicalLightFalloff(){return this._lightFalloff===a.m.LIGHTFALLOFF_PHYSICAL}set usePhysicalLightFalloff(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?a.m.LIGHTFALLOFF_PHYSICAL:a.m.LIGHTFALLOFF_STANDARD)}get useGLTFLightFalloff(){return this._lightFalloff===a.m.LIGHTFALLOFF_GLTF}set useGLTFLightFalloff(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?a.m.LIGHTFALLOFF_GLTF:a.m.LIGHTFALLOFF_STANDARD)}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}set imageProcessingConfiguration(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()}get cameraColorCurvesEnabled(){return this.imageProcessingConfiguration.colorCurvesEnabled}set cameraColorCurvesEnabled(e){this.imageProcessingConfiguration.colorCurvesEnabled=e}get cameraColorGradingEnabled(){return this.imageProcessingConfiguration.colorGradingEnabled}set cameraColorGradingEnabled(e){this.imageProcessingConfiguration.colorGradingEnabled=e}get cameraToneMappingEnabled(){return this._imageProcessingConfiguration.toneMappingEnabled}set cameraToneMappingEnabled(e){this._imageProcessingConfiguration.toneMappingEnabled=e}get cameraExposure(){return this._imageProcessingConfiguration.exposure}set cameraExposure(e){this._imageProcessingConfiguration.exposure=e}get cameraContrast(){return this._imageProcessingConfiguration.contrast}set cameraContrast(e){this._imageProcessingConfiguration.contrast=e}get cameraColorGradingTexture(){return this._imageProcessingConfiguration.colorGradingTexture}set cameraColorGradingTexture(e){this._imageProcessingConfiguration.colorGradingTexture=e}get cameraColorCurves(){return this._imageProcessingConfiguration.colorCurves}set cameraColorCurves(e){this._imageProcessingConfiguration.colorCurves=e}getClassName(){return"PBRMaterial"}clone(e){const t=r.p4.Clone((()=>new c(e,this.getScene())),this);return t.id=e,t.name=e,this.stencil.copyTo(t.stencil),this.clearCoat.copyTo(t.clearCoat),this.anisotropy.copyTo(t.anisotropy),this.brdf.copyTo(t.brdf),this.sheen.copyTo(t.sheen),this.subSurface.copyTo(t.subSurface),t}serialize(){const e=super.serialize();return e.customType="BABYLON.PBRMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e.iridescence=this.iridescence.serialize(),e}static Parse(e,t,i){const n=r.p4.Parse((()=>new c(e.name,t)),e,t,i);return e.stencil&&n.stencil.parse(e.stencil,t,i),e.clearCoat&&n.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&n.anisotropy.parse(e.anisotropy,t,i),e.brdf&&n.brdf.parse(e.brdf,t,i),e.sheen&&n.sheen.parse(e.sheen,t,i),e.subSurface&&n.subSurface.parse(e.subSurface,t,i),e.iridescence&&n.iridescence.parse(e.iridescence,t,i),n}}c.PBRMATERIAL_OPAQUE=a.m.PBRMATERIAL_OPAQUE,c.PBRMATERIAL_ALPHATEST=a.m.PBRMATERIAL_ALPHATEST,c.PBRMATERIAL_ALPHABLEND=a.m.PBRMATERIAL_ALPHABLEND,c.PBRMATERIAL_ALPHATESTANDBLEND=a.m.PBRMATERIAL_ALPHATESTANDBLEND,c.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=a.m.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"directIntensity",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"emissiveIntensity",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"environmentIntensity",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"specularIntensity",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"disableBumpMap",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"albedoTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"ambientTexture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"ambientTextureStrength",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],c.prototype,"opacityTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"reflectionTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"emissiveTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"reflectivityTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"metallicTexture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"metallic",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"roughness",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"metallicF0Factor",void 0),(0,n.gn)([(0,r.n9)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"metallicReflectanceColor",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useOnlyMetallicFromMetallicReflectanceTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"metallicReflectanceTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"reflectanceTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"microSurfaceTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"bumpTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty",null)],c.prototype,"lightmapTexture",void 0),(0,n.gn)([(0,r.n9)("ambient"),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"ambientColor",void 0),(0,n.gn)([(0,r.n9)("albedo"),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"albedoColor",void 0),(0,n.gn)([(0,r.n9)("reflectivity"),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"reflectivityColor",void 0),(0,n.gn)([(0,r.n9)("reflection"),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"reflectionColor",void 0),(0,n.gn)([(0,r.n9)("emissive"),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"emissiveColor",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"microSurface",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useLightmapAsShadowmap",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],c.prototype,"useAlphaFromAlbedoTexture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],c.prototype,"forceAlphaTest",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],c.prototype,"alphaCutOff",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useSpecularOverAlpha",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useRoughnessFromMetallicTextureGreen",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useMetallnessFromMetallicTextureBlue",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useAmbientInGrayScale",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),(0,n.gn)([(0,r.qC)()],c.prototype,"usePhysicalLightFalloff",null),(0,n.gn)([(0,r.qC)()],c.prototype,"useGLTFLightFalloff",null),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useRadianceOverAlpha",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useObjectSpaceNormalMap",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useParallax",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useParallaxOcclusion",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"parallaxScaleBias",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsLightsDirty")],c.prototype,"disableLighting",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"forceIrradianceInFragment",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsLightsDirty")],c.prototype,"maxSimultaneousLights",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"invertNormalMapX",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"invertNormalMapY",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"twoSidedLighting",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useAlphaFresnel",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useLinearAlphaFresnel",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"environmentBRDFTexture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"forceNormalForward",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"enableSpecularAntiAliasing",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useHorizonOcclusion",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],c.prototype,"useRadianceOcclusion",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsMiscDirty")],c.prototype,"unlit",void 0),(0,l.H)("BABYLON.PBRMaterial",c)},"../../../node_modules/@babylonjs/core/Materials/PBR/pbrSheenConfiguration.js":function(e,t,i){"use strict";i.d(t,{B:function(){return _}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),o=i("../../../node_modules/@babylonjs/core/Materials/materialFlags.js"),a=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),l=i("../../../node_modules/@babylonjs/core/Materials/materialPluginBase.js"),c=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js");class h extends c.H{constructor(){super(...arguments),this.SHEEN=!1,this.SHEEN_TEXTURE=!1,this.SHEEN_GAMMATEXTURE=!1,this.SHEEN_TEXTURE_ROUGHNESS=!1,this.SHEEN_TEXTUREDIRECTUV=0,this.SHEEN_TEXTURE_ROUGHNESSDIRECTUV=0,this.SHEEN_LINKWITHALBEDO=!1,this.SHEEN_ROUGHNESS=!1,this.SHEEN_ALBEDOSCALING=!1,this.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,this.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=!1}}class _ extends l.n{constructor(e,t=!0){super(e,"Sheen",120,new h,t),this._isEnabled=!1,this.isEnabled=!1,this._linkSheenWithAlbedo=!1,this.linkSheenWithAlbedo=!1,this.intensity=1,this.color=s.Wo.White(),this._texture=null,this.texture=null,this._useRoughnessFromMainTexture=!0,this.useRoughnessFromMainTexture=!0,this._roughness=null,this.roughness=null,this._textureRoughness=null,this.textureRoughness=null,this._albedoScaling=!1,this.albedoScaling=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isReadyForSubMesh(e,t){if(!this._isEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&o.k.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&o.k.SheenTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1}return!0}prepareDefinesBeforeAttributes(e,t){var i;this._isEnabled?(e.SHEEN=!0,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e.SHEEN_ROUGHNESS=null!==this._roughness,e.SHEEN_ALBEDOSCALING=this._albedoScaling,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(i=this._textureRoughness)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&o.k.SheenTextureEnabled?(a.G.PrepareDefinesForMergedUV(this._texture,e,"SHEEN_TEXTURE"),e.SHEEN_GAMMATEXTURE=this._texture.gammaSpace):e.SHEEN_TEXTURE=!1,this._textureRoughness&&o.k.SheenTextureEnabled?a.G.PrepareDefinesForMergedUV(this._textureRoughness,e,"SHEEN_TEXTURE_ROUGHNESS"):e.SHEEN_TEXTURE_ROUGHNESS=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS=!1,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=!1,e.SHEEN_GAMMATEXTURE=!1,e.SHEEN_TEXTUREDIRECTUV=0,e.SHEEN_TEXTURE_ROUGHNESSDIRECTUV=0)}bindForSubMesh(e,t,i,n){var r,s,l,c,h,_,d,u;if(!this._isEnabled)return;const p=n.materialDefines,f=this._material.isFrozen,m=p.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL;e.useUbo&&f&&e.isSync||(m&&o.k.SheenTextureEnabled?(e.updateFloat4("vSheenInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),a.G.BindTextureMatrix(this._texture,e,"sheen")):(this._texture||this._textureRoughness)&&o.k.SheenTextureEnabled&&(e.updateFloat4("vSheenInfos",null!==(s=null===(r=this._texture)||void 0===r?void 0:r.coordinatesIndex)&&void 0!==s?s:0,null!==(c=null===(l=this._texture)||void 0===l?void 0:l.level)&&void 0!==c?c:0,null!==(_=null===(h=this._textureRoughness)||void 0===h?void 0:h.coordinatesIndex)&&void 0!==_?_:0,null!==(u=null===(d=this._textureRoughness)||void 0===d?void 0:d.level)&&void 0!==u?u:0),this._texture&&a.G.BindTextureMatrix(this._texture,e,"sheen"),!this._textureRoughness||m||p.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE||a.G.BindTextureMatrix(this._textureRoughness,e,"sheenRoughness")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity),null!==this._roughness&&e.updateFloat("vSheenRoughness",this._roughness)),t.texturesEnabled&&(this._texture&&o.k.SheenTextureEnabled&&e.setTexture("sheenSampler",this._texture),this._textureRoughness&&!m&&!p.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE&&o.k.SheenTextureEnabled&&e.setTexture("sheenRoughnessSampler",this._textureRoughness))}hasTexture(e){return this._texture===e||this._textureRoughness===e}getActiveTextures(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness)}dispose(e){var t,i;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._textureRoughness)||void 0===i||i.dispose())}getClassName(){return"PBRSheenConfiguration"}addFallbacks(e,t,i){return e.SHEEN&&t.addFallback(i++,"SHEEN"),i}getSamplers(e){e.push("sheenSampler","sheenRoughnessSampler")}getUniforms(){return{ubo:[{name:"vSheenColor",size:4,type:"vec4"},{name:"vSheenRoughness",size:1,type:"float"},{name:"vSheenInfos",size:4,type:"vec4"},{name:"sheenMatrix",size:16,type:"mat4"},{name:"sheenRoughnessMatrix",size:16,type:"mat4"}]}}}(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"isEnabled",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"linkSheenWithAlbedo",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"intensity",void 0),(0,n.gn)([(0,r.n9)()],_.prototype,"color",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"texture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"useRoughnessFromMainTexture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"roughness",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"textureRoughness",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"albedoScaling",void 0)},"../../../node_modules/@babylonjs/core/Materials/PBR/pbrSubSurfaceConfiguration.js":function(e,t,i){"use strict";i.d(t,{u:function(){return u}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),o=i("../../../node_modules/@babylonjs/core/Materials/materialFlags.js"),a=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),l=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js"),c=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),h=i("../../../node_modules/@babylonjs/core/Materials/materialPluginBase.js"),_=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js");class d extends _.H{constructor(){super(...arguments),this.SUBSURFACE=!1,this.SS_REFRACTION=!1,this.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=!1,this.SS_TRANSLUCENCY=!1,this.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=!1,this.SS_SCATTERING=!1,this.SS_THICKNESSANDMASK_TEXTURE=!1,this.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,this.SS_HAS_THICKNESS=!1,this.SS_REFRACTIONINTENSITY_TEXTURE=!1,this.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV=0,this.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,this.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV=0,this.SS_REFRACTIONMAP_3D=!1,this.SS_REFRACTIONMAP_OPPOSITEZ=!1,this.SS_LODINREFRACTIONALPHA=!1,this.SS_GAMMAREFRACTION=!1,this.SS_RGBDREFRACTION=!1,this.SS_LINEARSPECULARREFRACTION=!1,this.SS_LINKREFRACTIONTOTRANSPARENCY=!1,this.SS_ALBEDOFORREFRACTIONTINT=!1,this.SS_ALBEDOFORTRANSLUCENCYTINT=!1,this.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,this.SS_USE_THICKNESS_AS_DEPTH=!1,this.SS_MASK_FROM_THICKNESS_TEXTURE=!1,this.SS_USE_GLTF_TEXTURES=!1}}class u extends h.n{constructor(e,t=!0){super(e,"PBRSubSurface",130,new d,t),this._isRefractionEnabled=!1,this.isRefractionEnabled=!1,this._isTranslucencyEnabled=!1,this.isTranslucencyEnabled=!1,this._isScatteringEnabled=!1,this.isScatteringEnabled=!1,this._scatteringDiffusionProfileIndex=0,this.refractionIntensity=1,this.translucencyIntensity=1,this.useAlbedoToTintRefraction=!1,this.useAlbedoToTintTranslucency=!1,this._thicknessTexture=null,this.thicknessTexture=null,this._refractionTexture=null,this.refractionTexture=null,this._indexOfRefraction=1.5,this.indexOfRefraction=1.5,this._volumeIndexOfRefraction=-1,this._invertRefractionY=!1,this.invertRefractionY=!1,this._linkRefractionWithTransparency=!1,this.linkRefractionWithTransparency=!1,this.minimumThickness=0,this.maximumThickness=1,this.useThicknessAsDepth=!1,this.tintColor=s.Wo.White(),this.tintColorAtDistance=1,this.diffusionDistance=s.Wo.White(),this._useMaskFromThicknessTexture=!1,this.useMaskFromThicknessTexture=!1,this._refractionIntensityTexture=null,this.refractionIntensityTexture=null,this._translucencyIntensityTexture=null,this.translucencyIntensityTexture=null,this._useGltfStyleTextures=!1,this.useGltfStyleTextures=!1,this._scene=e.getScene(),this.registerForExtraEvents=!0,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1],this._internalMarkScenePrePassDirty=e._dirtyCallbacks[32]}get scatteringDiffusionProfile(){return this._scene.subSurfaceConfiguration?this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex]:null}set scatteringDiffusionProfile(e){this._scene.enableSubSurfaceForPrePass()&&e&&(this._scatteringDiffusionProfileIndex=this._scene.subSurfaceConfiguration.addDiffusionProfile(e))}get volumeIndexOfRefraction(){return this._volumeIndexOfRefraction>=1?this._volumeIndexOfRefraction:this._indexOfRefraction}set volumeIndexOfRefraction(e){this._volumeIndexOfRefraction=e>=1?e:-1}_markAllSubMeshesAsTexturesDirty(){this._enable(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}_markScenePrePassDirty(){this._internalMarkAllSubMeshesAsTexturesDirty(),this._internalMarkScenePrePassDirty()}isReadyForSubMesh(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&o.k.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;const e=this._getRefractionTexture(t);if(e&&o.k.RefractionTextureEnabled&&!e.isReadyOrNotBlocking())return!1}return!0}prepareDefinesBeforeAttributes(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return e.SUBSURFACE=!1,e.SS_TRANSLUCENCY=!1,e.SS_SCATTERING=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,e.SS_HAS_THICKNESS=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV=0,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV=0,e.SS_REFRACTIONMAP_3D=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,void(e.SS_USE_GLTF_TEXTURES=!1);if(e._areTexturesDirty){e.SUBSURFACE=!0,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_SCATTERING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_HAS_THICKNESS=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.SS_USE_GLTF_TEXTURES=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1;const i=!!this._thicknessTexture&&!!this._refractionIntensityTexture&&this._refractionIntensityTexture.checkTransformsAreIdentical(this._thicknessTexture)&&this._refractionIntensityTexture._texture===this._thicknessTexture._texture,n=!!this._thicknessTexture&&!!this._translucencyIntensityTexture&&this._translucencyIntensityTexture.checkTransformsAreIdentical(this._thicknessTexture)&&this._translucencyIntensityTexture._texture===this._thicknessTexture._texture,r=(i||!this._refractionIntensityTexture)&&(n||!this._translucencyIntensityTexture);if(e._areTexturesDirty&&t.texturesEnabled&&(this._thicknessTexture&&o.k.ThicknessTextureEnabled&&a.G.PrepareDefinesForMergedUV(this._thicknessTexture,e,"SS_THICKNESSANDMASK_TEXTURE"),this._refractionIntensityTexture&&o.k.RefractionIntensityTextureEnabled&&!r&&a.G.PrepareDefinesForMergedUV(this._refractionIntensityTexture,e,"SS_REFRACTIONINTENSITY_TEXTURE"),this._translucencyIntensityTexture&&o.k.TranslucencyIntensityTextureEnabled&&!r&&a.G.PrepareDefinesForMergedUV(this._translucencyIntensityTexture,e,"SS_TRANSLUCENCYINTENSITY_TEXTURE")),e.SS_HAS_THICKNESS=this.maximumThickness-this.minimumThickness!=0,e.SS_MASK_FROM_THICKNESS_TEXTURE=(this._useMaskFromThicknessTexture||!!this._refractionIntensityTexture||!!this._translucencyIntensityTexture)&&r,e.SS_USE_GLTF_TEXTURES=this._useGltfStyleTextures,e.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=(this._useMaskFromThicknessTexture||!!this._refractionIntensityTexture)&&r,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=(this._useMaskFromThicknessTexture||!!this._translucencyIntensityTexture)&&r,this._isRefractionEnabled&&t.texturesEnabled){const i=this._getRefractionTexture(t);i&&o.k.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=i.isCube,e.SS_GAMMAREFRACTION=i.gammaSpace,e.SS_RGBDREFRACTION=i.isRGBD,e.SS_LINEARSPECULARREFRACTION=i.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=i.invertZ,e.SS_LODINREFRACTIONALPHA=i.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency,e.SS_ALBEDOFORREFRACTIONTINT=this.useAlbedoToTintRefraction,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=i.isCube&&i.boundingBoxSize,e.SS_USE_THICKNESS_AS_DEPTH=this.useThicknessAsDepth)}this._isTranslucencyEnabled&&(e.SS_ALBEDOFORTRANSLUCENCYTINT=this.useAlbedoToTintTranslucency)}}hardBindForSubMesh(e,t,i,n){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return;n.getRenderingMesh().getWorldMatrix().decompose(c.jp.Vector3[0]);const r=Math.max(Math.abs(c.jp.Vector3[0].x),Math.abs(c.jp.Vector3[0].y),Math.abs(c.jp.Vector3[0].z));e.updateFloat2("vThicknessParam",this.minimumThickness*r,(this.maximumThickness-this.minimumThickness)*r)}bindForSubMesh(e,t,i,n){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return;const r=n.materialDefines,s=this._material.isFrozen,c=this._material.realTimeFiltering,h=r.LODBASEDMICROSFURACE,_=this._getRefractionTexture(t);if(!e.useUbo||!s||!e.isSync){if(this._thicknessTexture&&o.k.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),a.G.BindTextureMatrix(this._thicknessTexture,e,"thickness")),this._refractionIntensityTexture&&o.k.RefractionIntensityTextureEnabled&&r.SS_REFRACTIONINTENSITY_TEXTURE&&(e.updateFloat2("vRefractionIntensityInfos",this._refractionIntensityTexture.coordinatesIndex,this._refractionIntensityTexture.level),a.G.BindTextureMatrix(this._refractionIntensityTexture,e,"refractionIntensity")),this._translucencyIntensityTexture&&o.k.TranslucencyIntensityTextureEnabled&&r.SS_TRANSLUCENCYINTENSITY_TEXTURE&&(e.updateFloat2("vTranslucencyIntensityInfos",this._translucencyIntensityTexture.coordinatesIndex,this._translucencyIntensityTexture.level),a.G.BindTextureMatrix(this._translucencyIntensityTexture,e,"translucencyIntensity")),_&&o.k.RefractionTextureEnabled){e.updateMatrix("refractionMatrix",_.getReflectionTextureMatrix());let t=1;_.isCube||_.depth&&(t=_.depth);const i=_.getSize().width,n=this.volumeIndexOfRefraction;if(e.updateFloat4("vRefractionInfos",_.level,1/n,t,this._invertRefractionY?-1:1),e.updateFloat4("vRefractionMicrosurfaceInfos",i,_.lodGenerationScale,_.lodGenerationOffset,1/this.indexOfRefraction),c&&e.updateFloat2("vRefractionFilteringInfo",i,l.R.Log2(i)),_.boundingBoxSize){const t=_;e.updateVector3("vRefractionPosition",t.boundingBoxPosition),e.updateVector3("vRefractionSize",t.boundingBoxSize)}}this._isScatteringEnabled&&e.updateFloat("scatteringDiffusionProfile",this._scatteringDiffusionProfileIndex),e.updateColor3("vDiffusionDistance",this.diffusionDistance),e.updateFloat4("vTintColor",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintColorAtDistance)),e.updateFloat3("vSubSurfaceIntensity",this.refractionIntensity,this.translucencyIntensity,0)}t.texturesEnabled&&(this._thicknessTexture&&o.k.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),this._refractionIntensityTexture&&o.k.RefractionIntensityTextureEnabled&&r.SS_REFRACTIONINTENSITY_TEXTURE&&e.setTexture("refractionIntensitySampler",this._refractionIntensityTexture),this._translucencyIntensityTexture&&o.k.TranslucencyIntensityTextureEnabled&&r.SS_TRANSLUCENCYINTENSITY_TEXTURE&&e.setTexture("translucencyIntensitySampler",this._translucencyIntensityTexture),_&&o.k.RefractionTextureEnabled&&(h?e.setTexture("refractionSampler",_):(e.setTexture("refractionSampler",_._lodTextureMid||_),e.setTexture("refractionSamplerLow",_._lodTextureLow||_),e.setTexture("refractionSamplerHigh",_._lodTextureHigh||_))))}_getRefractionTexture(e){return this._refractionTexture?this._refractionTexture:this._isRefractionEnabled?e.environmentTexture:null}get disableAlphaBlending(){return this._isRefractionEnabled&&this._linkRefractionWithTransparency}fillRenderTargetTextures(e){o.k.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)}hasTexture(e){return this._thicknessTexture===e||this._refractionTexture===e}hasRenderTargetTextures(){return!!(o.k.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)}getActiveTextures(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture)}getAnimatables(e){this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture)}dispose(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose())}getClassName(){return"PBRSubSurfaceConfiguration"}addFallbacks(e,t,i){return e.SS_SCATTERING&&t.addFallback(i++,"SS_SCATTERING"),e.SS_TRANSLUCENCY&&t.addFallback(i++,"SS_TRANSLUCENCY"),i}getSamplers(e){e.push("thicknessSampler","refractionIntensitySampler","translucencyIntensitySampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh")}getUniforms(){return{ubo:[{name:"vRefractionMicrosurfaceInfos",size:4,type:"vec4"},{name:"vRefractionFilteringInfo",size:2,type:"vec2"},{name:"vTranslucencyIntensityInfos",size:2,type:"vec2"},{name:"vRefractionInfos",size:4,type:"vec4"},{name:"refractionMatrix",size:16,type:"mat4"},{name:"vThicknessInfos",size:2,type:"vec2"},{name:"vRefractionIntensityInfos",size:2,type:"vec2"},{name:"thicknessMatrix",size:16,type:"mat4"},{name:"refractionIntensityMatrix",size:16,type:"mat4"},{name:"translucencyIntensityMatrix",size:16,type:"mat4"},{name:"vThicknessParam",size:2,type:"vec2"},{name:"vDiffusionDistance",size:3,type:"vec3"},{name:"vTintColor",size:4,type:"vec4"},{name:"vSubSurfaceIntensity",size:3,type:"vec3"},{name:"vRefractionPosition",size:3,type:"vec3"},{name:"vRefractionSize",size:3,type:"vec3"},{name:"scatteringDiffusionProfile",size:1,type:"float"}]}}}(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"isRefractionEnabled",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"isTranslucencyEnabled",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markScenePrePassDirty")],u.prototype,"isScatteringEnabled",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"_scatteringDiffusionProfileIndex",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"refractionIntensity",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"translucencyIntensity",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"useAlbedoToTintRefraction",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"useAlbedoToTintTranslucency",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"thicknessTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"refractionTexture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"indexOfRefraction",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"_volumeIndexOfRefraction",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"volumeIndexOfRefraction",null),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"invertRefractionY",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"linkRefractionWithTransparency",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"minimumThickness",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"maximumThickness",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"useThicknessAsDepth",void 0),(0,n.gn)([(0,r.n9)()],u.prototype,"tintColor",void 0),(0,n.gn)([(0,r.qC)()],u.prototype,"tintColorAtDistance",void 0),(0,n.gn)([(0,r.n9)()],u.prototype,"diffusionDistance",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"useMaskFromThicknessTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"refractionIntensityTexture",void 0),(0,n.gn)([(0,r.oU)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"translucencyIntensityTexture",void 0),(0,n.gn)([(0,r.qC)(),(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],u.prototype,"useGltfStyleTextures",void 0)},"../../../node_modules/@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js":function(e,t,i){"use strict";i.d(t,{g:function(){return f}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),o=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),a=i("../../../node_modules/@babylonjs/core/sceneComponent.js"),l=i("../../../node_modules/@babylonjs/core/Materials/material.js"),c=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),h=i("../../../node_modules/@babylonjs/core/Materials/Textures/renderTargetTexture.js"),_=i("../../../node_modules/@babylonjs/core/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js");i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.js"),i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTargetCube.js");i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.ShadersStore.proceduralVertexShader="attribute vec2 position;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvPosition=position;\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";var d=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),u=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),p=i("../../../node_modules/@babylonjs/core/Materials/drawWrapper.js");class f extends c.x{constructor(e,t,i,n,r=null,l=!0,c=!1,h=0){super(null,n,!l),this.isEnabled=!0,this.autoClear=!0,this.onGeneratedObservable=new s.y$,this.onBeforeGenerationObservable=new s.y$,this.nodeMaterialSource=null,this._textures={},this._currentRefreshId=-1,this._frameId=-1,this._refreshRate=1,this._vertexBuffers={},this._uniforms=new Array,this._samplers=new Array,this._floats={},this._ints={},this._floatsArrays={},this._colors3={},this._colors4={},this._vectors2={},this._vectors3={},this._matrices={},this._fallbackTextureUsed=!1,this._cachedDefines=null,this._contentUpdateId=-1,this._rtWrapper=null;let d=(n=this.getScene()||u.l.LastCreatedScene)._getComponent(a.l.NAME_PROCEDURALTEXTURE);d||(d=new _.O(n),n._addComponent(d)),n.proceduralTextures.push(this),this._fullEngine=n.getEngine(),this.name=e,this.isRenderTarget=!0,this._size=t,this._textureType=h,this._generateMipMaps=l,this._drawWrapper=new p.q(this._fullEngine),this.setFragment(i),this._fallbackTexture=r;const f=this._createRtWrapper(c,t,l,h);this._texture=f.texture;const m=[];m.push(1,1),m.push(-1,1),m.push(-1,-1),m.push(1,-1),this._vertexBuffers[o.o.PositionKind]=new o.o(this._fullEngine,m,o.o.PositionKind,!1,!1,2),this._createIndexBuffer()}_createRtWrapper(e,t,i,n){return e?(this._rtWrapper=this._fullEngine.createRenderTargetCubeTexture(t,{generateMipMaps:i,generateDepthBuffer:!1,generateStencilBuffer:!1,type:n}),this.setFloat("face",0)):this._rtWrapper=this._fullEngine.createRenderTargetTexture(t,{generateMipMaps:i,generateDepthBuffer:!1,generateStencilBuffer:!1,type:n}),this._rtWrapper}getEffect(){return this._drawWrapper.effect}_setEffect(e){this._drawWrapper.effect=e}getContent(){return this._contentData&&this._frameId===this._contentUpdateId||(this._contentData?this._contentData.then((e=>{this._contentData=this.readPixels(0,0,e),this._contentUpdateId=this._frameId})):(this._contentData=this.readPixels(0,0),this._contentUpdateId=this._frameId)),this._contentData}_createIndexBuffer(){const e=this._fullEngine,t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)}_rebuild(){const e=this._vertexBuffers[o.o.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===h._.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=h._.REFRESHRATE_RENDER_ONCE)}reset(){var e;null===(e=this._drawWrapper.effect)||void 0===e||e.dispose()}_getDefines(){return""}isReady(){const e=this._fullEngine;let t;if(this.nodeMaterialSource)return this._drawWrapper.effect.isReady();if(!this._fragment)return!1;if(this._fallbackTextureUsed)return!0;if(!this._texture)return!1;const i=this._getDefines();return!(!this._drawWrapper.effect||i!==this._cachedDefines||!this._drawWrapper.effect.isReady())||(t=void 0!==this._fragment.fragmentElement?{vertex:"procedural",fragmentElement:this._fragment.fragmentElement}:{vertex:"procedural",fragment:this._fragment},this._cachedDefines!==i&&(this._cachedDefines=i,this._drawWrapper.effect=e.createEffect(t,[o.o.PositionKind],this._uniforms,this._samplers,i,void 0,void 0,(()=>{var e;null===(e=this._rtWrapper)||void 0===e||e.dispose(),this._rtWrapper=this._texture=null,this._fallbackTexture&&(this._texture=this._fallbackTexture._texture,this._texture&&this._texture.incrementReferences()),this._fallbackTextureUsed=!0}))),this._drawWrapper.effect.isReady())}resetRefreshCounter(){this._currentRefreshId=-1}setFragment(e){this._fragment=e}get refreshRate(){return this._refreshRate}set refreshRate(e){this._refreshRate=e,this.resetRefreshCounter()}_shouldRender(){return this.isEnabled&&this.isReady()&&this._texture?!this._fallbackTextureUsed&&(-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,this._frameId++,!0):(this._currentRefreshId++,!1)):(this._texture&&(this._texture.isReady=!1),!1)}getRenderSize(){return this._size}resize(e,t){if(this._fallbackTextureUsed||!this._rtWrapper||!this._texture)return;const i=this._texture.isCube;this._rtWrapper.dispose();const n=this._createRtWrapper(i,e,t,this._textureType);this._texture=n.texture,this._size=e,this._generateMipMaps=t}_checkUniform(e){-1===this._uniforms.indexOf(e)&&this._uniforms.push(e)}setTexture(e,t){return-1===this._samplers.indexOf(e)&&this._samplers.push(e),this._textures[e]=t,this}setFloat(e,t){return this._checkUniform(e),this._floats[e]=t,this}setInt(e,t){return this._checkUniform(e),this._ints[e]=t,this}setFloats(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this}setColor3(e,t){return this._checkUniform(e),this._colors3[e]=t,this}setColor4(e,t){return this._checkUniform(e),this._colors4[e]=t,this}setVector2(e,t){return this._checkUniform(e),this._vectors2[e]=t,this}setVector3(e,t){return this._checkUniform(e),this._vectors3[e]=t,this}setMatrix(e,t){return this._checkUniform(e),this._matrices[e]=t,this}render(e){var t,i;const n=this.getScene();if(!n)return;const r=this._fullEngine;if(r.enableEffect(this._drawWrapper),this.onBeforeGenerationObservable.notifyObservers(this),r.setState(!1),!this.nodeMaterialSource){for(const e in this._textures)this._drawWrapper.effect.setTexture(e,this._textures[e]);for(const e in this._ints)this._drawWrapper.effect.setInt(e,this._ints[e]);for(const e in this._floats)this._drawWrapper.effect.setFloat(e,this._floats[e]);for(const e in this._floatsArrays)this._drawWrapper.effect.setArray(e,this._floatsArrays[e]);for(const e in this._colors3)this._drawWrapper.effect.setColor3(e,this._colors3[e]);for(const e in this._colors4){const t=this._colors4[e];this._drawWrapper.effect.setFloat4(e,t.r,t.g,t.b,t.a)}for(const e in this._vectors2)this._drawWrapper.effect.setVector2(e,this._vectors2[e]);for(const e in this._vectors3)this._drawWrapper.effect.setVector3(e,this._vectors3[e]);for(const e in this._matrices)this._drawWrapper.effect.setMatrix(e,this._matrices[e])}if(!this._texture||!this._rtWrapper)return;null===(t=r._debugPushGroup)||void 0===t||t.call(r,`procedural texture generation for ${this.name}`,1);const s=r.currentViewport;if(this.isCube)for(let e=0;e<6;e++)r.bindFramebuffer(this._rtWrapper,e,void 0,void 0,!0),r.bindBuffers(this._vertexBuffers,this._indexBuffer,this._drawWrapper.effect),this._drawWrapper.effect.setFloat("face",e),this.autoClear&&r.clear(n.clearColor,!0,!1,!1),r.drawElementsType(l.F.TriangleFillMode,0,6);else r.bindFramebuffer(this._rtWrapper,0,void 0,void 0,!0),r.bindBuffers(this._vertexBuffers,this._indexBuffer,this._drawWrapper.effect),this.autoClear&&r.clear(n.clearColor,!0,!1,!1),r.drawElementsType(l.F.TriangleFillMode,0,6);r.unBindFramebuffer(this._rtWrapper,this.isCube),s&&r.setViewport(s),this.isCube&&r.generateMipMapsForCubemap(this._texture),null===(i=r._debugPopGroup)||void 0===i||i.call(r,1),this.onGenerated&&this.onGenerated(),this.onGeneratedObservable.notifyObservers(this)}clone(){const e=this.getSize(),t=new f(this.name,e.width,this._fragment,this.getScene(),this._fallbackTexture,this._generateMipMaps);return t.hasAlpha=this.hasAlpha,t.level=this.level,t.coordinatesMode=this.coordinatesMode,t}dispose(){const e=this.getScene();if(!e)return;const t=e.proceduralTextures.indexOf(this);t>=0&&e.proceduralTextures.splice(t,1);const i=this._vertexBuffers[o.o.PositionKind];i&&(i.dispose(),this._vertexBuffers[o.o.PositionKind]=null),this._indexBuffer&&this._fullEngine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),this.onGeneratedObservable.clear(),this.onBeforeGenerationObservable.clear(),super.dispose()}}(0,n.gn)([(0,r.qC)()],f.prototype,"isEnabled",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"autoClear",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"_generateMipMaps",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"_size",void 0),(0,n.gn)([(0,r.qC)()],f.prototype,"refreshRate",null),(0,d.H)("BABYLON.ProceduralTexture",f)},"../../../node_modules/@babylonjs/core/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js":function(e,t,i){"use strict";i.d(t,{O:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),r=i("../../../node_modules/@babylonjs/core/sceneComponent.js");class s{constructor(e){this.name=r.l.NAME_PROCEDURALTEXTURE,this.scene=e,this.scene.proceduralTextures=new Array}register(){this.scene._beforeClearStage.registerStep(r.l.STEP_BEFORECLEAR_PROCEDURALTEXTURE,this,this._beforeClear)}rebuild(){}dispose(){}_beforeClear(){if(this.scene.proceduralTexturesEnabled){n.w1.StartPerformanceCounter("Procedural textures",this.scene.proceduralTextures.length>0);for(let e=0;e0)}}}},"../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.js":function(e,t,i){"use strict";i.d(t,{V:function(){return h}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),a=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),l=i("../../../node_modules/@babylonjs/core/Misc/guid.js"),c=(i("../../../node_modules/@babylonjs/core/Misc/fileTools.js"),i("../../../node_modules/@babylonjs/core/Materials/Textures/thinTexture.js"));class h extends c.g{constructor(e,t=null){super(null),this.metadata=null,this.reservedDataStore=null,this._hasAlpha=!1,this._getAlphaFromRGB=!1,this.level=1,this._coordinatesIndex=0,this.optimizeUVAllocation=!0,this._coordinatesMode=0,this.wrapR=1,this.anisotropicFilteringLevel=h.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this._isCube=!1,this._gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this.isRenderTarget=!1,this._prefiltered=!1,this._forceSerialize=!1,this.animations=new Array,this.onDisposeObservable=new s.y$,this._onDisposeObserver=null,this._scene=null,this._uid=null,this._parentContainer=null,this._loadingError=!1,e?h._IsScene(e)?this._scene=e:this._engine=e:this._scene=a.l.LastCreatedScene,this._scene&&(this.uniqueId=this._scene.getUniqueId(),this._scene.addTexture(this),this._engine=this._scene.getEngine()),this._texture=t,this._uid=null}set hasAlpha(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this))))}get hasAlpha(){return this._hasAlpha}set getAlphaFromRGB(e){this._getAlphaFromRGB!==e&&(this._getAlphaFromRGB=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this))))}get getAlphaFromRGB(){return this._getAlphaFromRGB}set coordinatesIndex(e){this._coordinatesIndex!==e&&(this._coordinatesIndex=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this))))}get coordinatesIndex(){return this._coordinatesIndex}set coordinatesMode(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this))))}get coordinatesMode(){return this._coordinatesMode}get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get isCube(){return this._texture?this._texture.isCube:this._isCube}set isCube(e){this._texture?this._texture.isCube=e:this._isCube=e}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}get gammaSpace(){return this._texture?(null===this._texture._gammaSpace&&(this._texture._gammaSpace=this._gammaSpace),this._texture._gammaSpace&&!this._texture._useSRGBBuffer):this._gammaSpace}set gammaSpace(e){if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}this._markAllSubMeshesAsTexturesDirty()}get isRGBD(){return null!=this._texture&&this._texture._isRGBD}set isRGBD(e){this._texture&&(this._texture._isRGBD=e)}get noMipmap(){return!1}get lodGenerationOffset(){return this._texture?this._texture._lodGenerationOffset:0}set lodGenerationOffset(e){this._texture&&(this._texture._lodGenerationOffset=e)}get lodGenerationScale(){return this._texture?this._texture._lodGenerationScale:0}set lodGenerationScale(e){this._texture&&(this._texture._lodGenerationScale=e)}get linearSpecularLOD(){return!!this._texture&&this._texture._linearSpecularLOD}set linearSpecularLOD(e){this._texture&&(this._texture._linearSpecularLOD=e)}get irradianceTexture(){return this._texture?this._texture._irradianceTexture:null}set irradianceTexture(e){this._texture&&(this._texture._irradianceTexture=e)}get uid(){return this._uid||(this._uid=(0,l.f)()),this._uid}toString(){return this.name}getClassName(){return"BaseTexture"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get isBlocking(){return!0}get loadingError(){return this._loadingError}get errorObject(){return this._errorObject}getScene(){return this._scene}_getEngine(){return this._engine}checkTransformsAreIdentical(e){return null!==e}getTextureMatrix(){return o.y3.IdentityReadOnly}getReflectionTextureMatrix(){return o.y3.IdentityReadOnly}isReadyOrNotBlocking(){return!this.isBlocking||this.isReady()||this.loadingError}scale(e){}get canRescale(){return!1}_getFromCache(e,t,i,n,r,s){const o=this._getEngine();if(!o)return null;const a=o._getUseSRGBBuffer(!!r,t),l=o.getLoadedTexturesCache();for(let o=0;o=0&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null,this._parentContainer){const e=this._parentContainer.textures.indexOf(this);e>-1&&this._parentContainer.textures.splice(e,1),this._parentContainer=null}}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null,super.dispose()}serialize(){if(!this.name)return null;const e=r.p4.Serialize(this);return r.p4.AppendSerializedAnimations(this,e),e}static WhenAllReady(e,t){let i=e.length;if(0!==i)for(let n=0;n{0==--i&&t()})):0==--i&&t()}}else t()}static _IsScene(e){return"Scene"===e.getClassName()}}h.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4,(0,n.gn)([(0,r.qC)()],h.prototype,"uniqueId",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"name",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"metadata",void 0),(0,n.gn)([(0,r.qC)("hasAlpha")],h.prototype,"_hasAlpha",void 0),(0,n.gn)([(0,r.qC)("getAlphaFromRGB")],h.prototype,"_getAlphaFromRGB",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"level",void 0),(0,n.gn)([(0,r.qC)("coordinatesIndex")],h.prototype,"_coordinatesIndex",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"optimizeUVAllocation",void 0),(0,n.gn)([(0,r.qC)("coordinatesMode")],h.prototype,"_coordinatesMode",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"wrapU",null),(0,n.gn)([(0,r.qC)()],h.prototype,"wrapV",null),(0,n.gn)([(0,r.qC)()],h.prototype,"wrapR",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"anisotropicFilteringLevel",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"isCube",null),(0,n.gn)([(0,r.qC)()],h.prototype,"is3D",null),(0,n.gn)([(0,r.qC)()],h.prototype,"is2DArray",null),(0,n.gn)([(0,r.qC)()],h.prototype,"gammaSpace",null),(0,n.gn)([(0,r.qC)()],h.prototype,"invertZ",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"lodLevelInAlpha",void 0),(0,n.gn)([(0,r.qC)()],h.prototype,"lodGenerationOffset",null),(0,n.gn)([(0,r.qC)()],h.prototype,"lodGenerationScale",null),(0,n.gn)([(0,r.qC)()],h.prototype,"linearSpecularLOD",null),(0,n.gn)([(0,r.oU)()],h.prototype,"irradianceTexture",null),(0,n.gn)([(0,r.qC)()],h.prototype,"isRenderTarget",void 0)},"../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.polynomial.js":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.js");r.V.prototype.forceSphericalPolynomialsRecompute=function(){this._texture&&(this._texture._sphericalPolynomial=null,this._texture._sphericalPolynomialPromise=null,this._texture._sphericalPolynomialComputed=!1)},Object.defineProperty(r.V.prototype,"sphericalPolynomial",{get:function(){if(this._texture){if(this._texture._sphericalPolynomial||this._texture._sphericalPolynomialComputed)return this._texture._sphericalPolynomial;if(this._texture.isReady)return this._texture._sphericalPolynomialPromise||(this._texture._sphericalPolynomialPromise=n.$.ConvertCubeMapTextureToSphericalPolynomial(this),null===this._texture._sphericalPolynomialPromise?this._texture._sphericalPolynomialComputed=!0:this._texture._sphericalPolynomialPromise.then((e=>{this._texture._sphericalPolynomial=e,this._texture._sphericalPolynomialComputed=!0}))),null}return null},set:function(e){this._texture&&(this._texture._sphericalPolynomial=e)},enumerable:!0,configurable:!0})},"../../../node_modules/@babylonjs/core/Materials/Textures/cubeTexture.js":function(e,t,i){"use strict";i.d(t,{B:function(){return _}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),a=i("../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.js"),l=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),c=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),h=(i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.cubeTexture.js"),i("../../../node_modules/@babylonjs/core/Misc/observable.js"));class _ extends a.V{constructor(e,t,i=null,n=!1,r=null,s=null,a=null,c=5,_=!1,d=null,u=!1,p=.8,f=0,m,g){var b;super(t),this._lodScale=.8,this._lodOffset=0,this.onLoadObservable=new h.y$,this.boundingBoxPosition=o.P.Zero(),this._rotationY=0,this._files=null,this._forcedExtension=null,this._extensions=null,this.name=e,this.url=e,this._noMipmap=n,this.hasAlpha=!1,this._format=c,this.isCube=!0,this._textureMatrix=o.y3.Identity(),this._createPolynomials=u,this.coordinatesMode=l.x.CUBIC_MODE,this._extensions=i,this._files=r,this._forcedExtension=d,this._loaderOptions=m,this._useSRGBBuffer=g,this._lodScale=p,this._lodOffset=f,(e||r)&&this.updateURL(e,d,s,_,a,i,null===(b=this.getScene())||void 0===b?void 0:b.useDelayedTextureLoading,r)}set boundingBoxSize(e){if(this._boundingBoxSize&&this._boundingBoxSize.equals(e))return;this._boundingBoxSize=e;const t=this.getScene();t&&t.markAllMaterialsAsDirty(1)}get boundingBoxSize(){return this._boundingBoxSize}set rotationY(e){this._rotationY=e,this.setReflectionTextureMatrix(o.y3.RotationY(this._rotationY))}get rotationY(){return this._rotationY}get noMipmap(){return this._noMipmap}get forcedExtension(){return this._forcedExtension}static CreateFromImages(e,t,i){let n="";return e.forEach((e=>n+=e)),new _(n,t,null,i,e)}static CreateFromPrefilteredData(e,t,i=null,n=!0){const r=t.useDelayedTextureLoading;t.useDelayedTextureLoading=!1;const s=new _(e,t,null,!1,null,null,null,void 0,!0,i,n);return t.useDelayedTextureLoading=r,s}getClassName(){return"CubeTexture"}updateURL(e,t,i=null,n=!1,r=null,s=null,o=!1,a=null){this.name&&!this.name.startsWith("data:")||(this.name=e),this.url=e,t&&(this._forcedExtension=t);const l=e.lastIndexOf("."),c=t||(l>-1?e.substring(l).toLowerCase():""),h=0===c.indexOf(".dds"),_=0===c.indexOf(".env"),d=0===c.indexOf(".basis");if(_?(this.gammaSpace=!1,this._prefiltered=!1,this.anisotropicFilteringLevel=1):(this._prefiltered=n,n&&(this.gammaSpace=!1,this.anisotropicFilteringLevel=1)),a)this._files=a;else if(d||_||h||s||(s=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),this._files=this._files||[],this._files.length=0,s){for(let t=0;t-1!==e.getActiveTextures().indexOf(this)))),this._textureMatrix=e)}_loadTexture(e=null,t=null){var i;const n=this.getScene(),r=this._texture;this._texture=this._getFromCache(this.url,this._noMipmap,void 0,void 0,this._useSRGBBuffer,this.isCube);const o=()=>{var t;this.onLoadObservable.notifyObservers(this),r&&(r.dispose(),null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(1)),e&&e()},a=(e,i)=>{this._loadingError=!0,this._errorObject={message:e,exception:i},t&&t(e,i),l.x.OnTextureLoadErrorObservable.notifyObservers(this)};this._texture?this._texture.isReady?s.w1.SetImmediate((()=>o())):this._texture.onLoadedObservable.add((()=>o())):(this._prefiltered?this._texture=this._getEngine().createPrefilteredCubeTexture(this.url,n,this._lodScale,this._lodOffset,e,a,this._format,this._forcedExtension,this._createPolynomials):this._texture=this._getEngine().createCubeTexture(this.url,n,this._files,this._noMipmap,e,a,this._format,this._forcedExtension,!1,this._lodScale,this._lodOffset,null,this._loaderOptions,!!this._useSRGBBuffer),null===(i=this._texture)||void 0===i||i.onLoadedObservable.add((()=>this.onLoadObservable.notifyObservers(this))))}static Parse(e,t,i){const n=r.p4.Parse((()=>{let n=!1;return e.prefiltered&&(n=e.prefiltered),new _(i+e.name,t,e.extensions,!1,e.files||null,null,null,void 0,n,e.forcedExtension)}),e,t);if(e.boundingBoxPosition&&(n.boundingBoxPosition=o.P.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(n.boundingBoxSize=o.P.FromArray(e.boundingBoxSize)),e.animations)for(let t=0;t{const t=new _(this.url,this.getScene()||this._getEngine(),this._extensions,this._noMipmap,this._files);return e=t.uniqueId,t}),this);return t.uniqueId=e,t}}(0,n.gn)([(0,r.qC)()],_.prototype,"url",void 0),(0,n.gn)([(0,r.qC)("rotationY")],_.prototype,"rotationY",null),(0,n.gn)([(0,r.qC)("files")],_.prototype,"_files",void 0),(0,n.gn)([(0,r.qC)("forcedExtension")],_.prototype,"_forcedExtension",void 0),(0,n.gn)([(0,r.qC)("extensions")],_.prototype,"_extensions",void 0),(0,n.gn)([(0,r.oQ)("textureMatrix")],_.prototype,"_textureMatrix",void 0),l.x._CubeTextureParser=_.Parse,(0,c.H)("BABYLON.CubeTexture",_)},"../../../node_modules/@babylonjs/core/Materials/Textures/dynamicTexture.js":function(e,t,i){"use strict";i.d(t,{c:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js");i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicTexture.js");class s extends r.x{constructor(e,t,i=null,n=!1,s=3,o=5,a){super(null,i,!n,a,s,void 0,void 0,void 0,void 0,o),this.name=e,this.wrapU=r.x.CLAMP_ADDRESSMODE,this.wrapV=r.x.CLAMP_ADDRESSMODE,this._generateMipMaps=n;const l=this._getEngine();if(!l)return;t.getContext?(this._canvas=t,this._texture=l.createDynamicTexture(t.width,t.height,n,s)):(this._canvas=l.createCanvas(1,1),t.width||0===t.width?this._texture=l.createDynamicTexture(t.width,t.height,n,s):this._texture=l.createDynamicTexture(t,t,n,s));const c=this.getSize();this._canvas.width!==c.width&&(this._canvas.width=c.width),this._canvas.height!==c.height&&(this._canvas.height=c.height),this._context=this._canvas.getContext("2d")}getClassName(){return"DynamicTexture"}get canRescale(){return!0}_recreate(e){this._canvas.width=e.width,this._canvas.height=e.height,this.releaseInternalTexture(),this._texture=this._getEngine().createDynamicTexture(e.width,e.height,this._generateMipMaps,this.samplingMode)}scale(e){const t=this.getSize();t.width*=e,t.height*=e,this._recreate(t)}scaleTo(e,t){const i=this.getSize();i.width=e,i.height=t,this._recreate(i)}getContext(){return this._context}clear(){const e=this.getSize();this._context.fillRect(0,0,e.width,e.height)}update(e,t=!1,i=!1){this._getEngine().updateDynamicTexture(this._texture,this._canvas,void 0===e||e,t,this._format||void 0,void 0,i)}drawText(e,t,i,n,r,s,o,a=!0){const l=this.getSize();if(s&&(this._context.fillStyle=s,this._context.fillRect(0,0,l.width,l.height)),this._context.font=n,null==t){const i=this._context.measureText(e);t=(l.width-i.width)/2}if(null==i){const e=parseInt(n.replace(/\D/g,""));i=l.height/2+e/3.65}this._context.fillStyle=r||"",this._context.fillText(e,t,i),a&&this.update(o)}clone(){const e=this.getScene();if(!e)return this;const t=this.getSize(),i=new s(this.name,t,e,this._generateMipMaps);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.wrapU=this.wrapU,i.wrapV=this.wrapV,i}serialize(){const e=this.getScene();e&&!e.isReady()&&n.Y.Warn("The scene must be ready before serializing the dynamic texture");const t=super.serialize();return s._IsCanvasElement(this._canvas)&&(t.base64String=this._canvas.toDataURL()),t.invertY=this._invertY,t.samplingMode=this.samplingMode,t}static _IsCanvasElement(e){return void 0!==e.toDataURL}_rebuild(){this.update()}}},"../../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js":function(e,t,i){"use strict";i.d(t,{S:function(){return n},l:function(){return o}});var n,r=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Textures/textureSampler.js");!function(e){e[e.Unknown=0]="Unknown",e[e.Url=1]="Url",e[e.Temp=2]="Temp",e[e.Raw=3]="Raw",e[e.Dynamic=4]="Dynamic",e[e.RenderTarget=5]="RenderTarget",e[e.MultiRenderTarget=6]="MultiRenderTarget",e[e.Cube=7]="Cube",e[e.CubeRaw=8]="CubeRaw",e[e.CubePrefiltered=9]="CubePrefiltered",e[e.Raw3D=10]="Raw3D",e[e.Raw2DArray=11]="Raw2DArray",e[e.DepthStencil=12]="DepthStencil",e[e.CubeRawRGBD=13]="CubeRawRGBD",e[e.Depth=14]="Depth"}(n||(n={}));class o extends s.a{constructor(e,t,i=!1){super(),this.isReady=!1,this.isCube=!1,this.is3D=!1,this.is2DArray=!1,this.isMultiview=!1,this.url="",this.generateMipMaps=!1,this.samples=0,this.type=-1,this.format=-1,this.onLoadedObservable=new r.y$,this.onErrorObservable=new r.y$,this.onRebuildCallback=null,this.width=0,this.height=0,this.depth=0,this.baseWidth=0,this.baseHeight=0,this.baseDepth=0,this.invertY=!1,this._invertVScale=!1,this._associatedChannel=-1,this._source=n.Unknown,this._buffer=null,this._bufferView=null,this._bufferViewArray=null,this._bufferViewArrayArray=null,this._size=0,this._extension="",this._files=null,this._workingCanvas=null,this._workingContext=null,this._cachedCoordinatesMode=null,this._isDisabled=!1,this._compression=null,this._sphericalPolynomial=null,this._sphericalPolynomialPromise=null,this._sphericalPolynomialComputed=!1,this._lodGenerationScale=0,this._lodGenerationOffset=0,this._useSRGBBuffer=!1,this._lodTextureHigh=null,this._lodTextureMid=null,this._lodTextureLow=null,this._isRGBD=!1,this._linearSpecularLOD=!1,this._irradianceTexture=null,this._hardwareTexture=null,this._maxLodLevel=null,this._references=1,this._gammaSpace=null,this._engine=e,this._source=t,this._uniqueId=o._Counter++,i||(this._hardwareTexture=e._createHardwareTexture())}get useMipMaps(){return this.generateMipMaps}set useMipMaps(e){this.generateMipMaps=e}get uniqueId(){return this._uniqueId}getEngine(){return this._engine}get source(){return this._source}incrementReferences(){this._references++}updateSize(e,t,i=1){this._engine.updateTextureDimensions(this,e,t,i),this.width=e,this.height=t,this.depth=i,this.baseWidth=e,this.baseHeight=t,this.baseDepth=i,this._size=e*t*i}_rebuild(){var e;if(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this.onRebuildCallback){const e=this.onRebuildCallback(this),t=t=>{t._swapAndDie(this,!1),this.isReady=e.isReady};return void(e.isAsync?e.proxy.then(t):t(e.proxy))}let t;switch(this.source){case n.Temp:break;case n.Url:return void(t=this._engine.createTexture(null!==(e=this._originalUrl)&&void 0!==e?e:this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,(()=>{t._swapAndDie(this,!1),this.isReady=!0}),null,this._buffer,void 0,this.format,this._extension,void 0,void 0,void 0,this._useSRGBBuffer));case n.Raw:t=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type,void 0,this._useSRGBBuffer),t._swapAndDie(this,!1),this.isReady=!0;break;case n.Raw3D:t=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type),t._swapAndDie(this,!1),this.isReady=!0;break;case n.Raw2DArray:t=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type),t._swapAndDie(this,!1),this.isReady=!0;break;case n.Dynamic:t=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode),t._swapAndDie(this,!1),this._engine.updateDynamicTexture(this,this._engine.getRenderingCanvas(),this.invertY,void 0,void 0,!0);break;case n.Cube:return void(t=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,(()=>{t._swapAndDie(this,!1),this.isReady=!0}),null,this.format,this._extension,!1,0,0,null,void 0,this._useSRGBBuffer));case n.CubeRaw:t=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression),t._swapAndDie(this,!1),this.isReady=!0;break;case n.CubeRawRGBD:return;case n.CubePrefiltered:return t=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,(e=>{e&&e._swapAndDie(this,!1),this.isReady=!0}),null,this.format,this._extension),void(t._sphericalPolynomial=this._sphericalPolynomial)}}_swapAndDie(e,t=!0){var i;null===(i=this._hardwareTexture)||void 0===i||i.setUsage(e._source,this.generateMipMaps,this.isCube,this.width,this.height),e._hardwareTexture=this._hardwareTexture,t&&(e._isRGBD=this._isRGBD),this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);const n=this._engine.getLoadedTexturesCache();let r=n.indexOf(this);-1!==r&&n.splice(r,1),r=n.indexOf(e),-1===r&&n.push(e)}dispose(){this._references--,this.onLoadedObservable.clear(),this.onErrorObservable.clear(),0===this._references&&(this._engine._releaseTexture(this),this._hardwareTexture=null)}}o._Counter=0},"../../../node_modules/@babylonjs/core/Materials/Textures/rawCubeTexture.js":function(e,t,i){"use strict";i.d(t,{N:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),r=i("../../../node_modules/@babylonjs/core/Misc/environmentTextureTools.js"),s=i("../../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js"),o=i("../../../node_modules/@babylonjs/core/Materials/Textures/cubeTexture.js");i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.rawTexture.js");class a extends o.B{constructor(e,t,i,n=5,r=0,s=!1,o=!1,a=3,l=null){super("",e),this._texture=e.getEngine().createRawCubeTexture(t,i,n,r,s,o,a,l)}update(e,t,i,n,r=null){this._texture.getEngine().updateRawCubeTexture(this._texture,e,t,i,n,r)}updateRGBDAsync(e,t=null,i=.8,n=0){return(0,r.Lf)(this._texture,e,t,i,n).then((()=>{}))}clone(){return n.p4.Clone((()=>{const e=this.getScene(),t=this._texture,i=new a(e,t._bufferViewArray,t.width,t.format,t.type,t.generateMipMaps,t.invertY,t.samplingMode,t._compression);return t.source===s.S.CubeRawRGBD&&i.updateRGBDAsync(t._bufferViewArrayArray,t._sphericalPolynomial,t._lodGenerationScale,t._lodGenerationOffset),i}),this)}}},"../../../node_modules/@babylonjs/core/Materials/Textures/rawTexture.js":function(e,t,i){"use strict";i.d(t,{l:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js");i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.rawTexture.js");class r extends n.x{constructor(e,t,i,r,s,o=!0,a=!1,l=3,c=0,h,_){super(null,s,!o,a,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,h),this.format=r,this._engine&&(this._engine._caps.textureFloatLinearFiltering||1!==c||(l=1),this._engine._caps.textureHalfFloatLinearFiltering||2!==c||(l=1),this._texture=this._engine.createRawTexture(e,t,i,r,o,a,l,null,c,null!=h?h:0,null!=_&&_),this.wrapU=n.x.CLAMP_ADDRESSMODE,this.wrapV=n.x.CLAMP_ADDRESSMODE)}update(e){this._getEngine().updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type,this._texture._useSRGBBuffer)}static CreateLuminanceTexture(e,t,i,n,s=!0,o=!1,a=3){return new r(e,t,i,1,n,s,o,a)}static CreateLuminanceAlphaTexture(e,t,i,n,s=!0,o=!1,a=3){return new r(e,t,i,2,n,s,o,a)}static CreateAlphaTexture(e,t,i,n,s=!0,o=!1,a=3){return new r(e,t,i,0,n,s,o,a)}static CreateRGBTexture(e,t,i,n,s=!0,o=!1,a=3,l=0,c=0,h=!1){return new r(e,t,i,4,n,s,o,a,l,c,h)}static CreateRGBATexture(e,t,i,n,s=!0,o=!1,a=3,l=0,c=0,h=!1){return new r(e,t,i,5,n,s,o,a,l,c,h)}static CreateRGBAStorageTexture(e,t,i,n,s=!0,o=!1,a=3,l=0,c=!1){return new r(e,t,i,5,n,s,o,a,l,1,c)}static CreateRTexture(e,t,i,s,o=!0,a=!1,l=n.x.TRILINEAR_SAMPLINGMODE,c=1){return new r(e,t,i,6,s,o,a,l,c)}static CreateRStorageTexture(e,t,i,s,o=!0,a=!1,l=n.x.TRILINEAR_SAMPLINGMODE,c=1){return new r(e,t,i,6,s,o,a,l,c,1)}}},"../../../node_modules/@babylonjs/core/Materials/Textures/rawTexture2DArray.js":function(e,t,i){"use strict";i.d(t,{e:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js");i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.rawTexture.js");class r extends n.x{constructor(e,t,i,r,s,o,a=!0,l=!1,c=n.x.TRILINEAR_SAMPLINGMODE,h=0){super(null,o,!a,l),this.format=s,this._texture=o.getEngine().createRawTexture2DArray(e,t,i,r,s,a,l,c,null,h),this._depth=r,this.is2DArray=!0}get depth(){return this._depth}update(e){this._texture&&this._getEngine().updateRawTexture2DArray(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)}static CreateRGBATexture(e,t,i,n,s,o=!0,a=!1,l=3,c=0){return new r(e,t,i,n,5,s,o,a,l,c)}}},"../../../node_modules/@babylonjs/core/Materials/Textures/renderTargetTexture.js":function(e,t,i){"use strict";i.d(t,{_:function(){return _}});var n=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),r=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),a=i("../../../node_modules/@babylonjs/core/PostProcesses/postProcessManager.js"),l=i("../../../node_modules/@babylonjs/core/Rendering/renderingManager.js"),c=(i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.js"),i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTargetCube.js"),i("../../../node_modules/@babylonjs/core/Engines/engine.js")),h=i("../../../node_modules/@babylonjs/core/Misc/arrayTools.js");class _ extends o.x{constructor(e,t,i,r,a=!0,c=0,h=!1,_=o.x.TRILINEAR_SAMPLINGMODE,d=!0,u=!1,p=!1,f=5,m=!1,g,b,y=!1,v=!1){var A;if(super(null,i,!r,void 0,_,void 0,void 0,void 0,void 0,f),this._unObserveRenderList=null,this._renderListHasChanged=(e,t)=>{var i;const n=this._renderList?this._renderList.length:0;(0===t&&n>0||0===n)&&(null===(i=this.getScene())||void 0===i||i.meshes.forEach((e=>{e._markSubMeshesAsLightDirty()})))},this.renderParticles=!0,this.renderSprites=!1,this.ignoreCameraViewport=!1,this.onBeforeBindObservable=new n.y$,this.onAfterUnbindObservable=new n.y$,this.onBeforeRenderObservable=new n.y$,this.onAfterRenderObservable=new n.y$,this.onClearObservable=new n.y$,this.onResizeObservable=new n.y$,this._cleared=!1,this.skipInitialClear=!1,this._currentRefreshId=-1,this._refreshRate=1,this._samples=1,this._canRescale=!0,this._renderTarget=null,this.boundingBoxPosition=s.P.Zero(),!(i=this.getScene()))return;const C=this.getScene().getEngine();this._coordinatesMode=o.x.PROJECTION_MODE,this.renderList=new Array,this.name=e,this.isRenderTarget=!0,this._initialSizeParameter=t,this._renderPassIds=[],this._isCubeData=h,this._processSizeParameter(t),this.renderPassId=this._renderPassIds[0],this._resizeObserver=C.onResizeObservable.add((()=>{})),this._generateMipMaps=!!r,this._doNotChangeAspectRatio=a,this._renderingManager=new l.$(i),this._renderingManager._useSceneAutoClearSetup=!0,p||(this._renderTargetOptions={generateMipMaps:r,type:c,format:null!==(A=this._format)&&void 0!==A?A:void 0,samplingMode:this.samplingMode,generateDepthBuffer:d,generateStencilBuffer:u,samples:g,creationFlags:b,noColorTarget:y,useSRGBBuffer:v},this.samplingMode===o.x.NEAREST_SAMPLINGMODE&&(this.wrapU=o.x.CLAMP_ADDRESSMODE,this.wrapV=o.x.CLAMP_ADDRESSMODE),m||(h?(this._renderTarget=i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions),this.coordinatesMode=o.x.INVCUBIC_MODE,this._textureMatrix=s.y3.Identity()):this._renderTarget=i.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this._texture=this._renderTarget.texture,void 0!==g&&(this.samples=g)))}get renderList(){return this._renderList}set renderList(e){this._unObserveRenderList&&(this._unObserveRenderList(),this._unObserveRenderList=null),e&&(this._unObserveRenderList=(0,h.M)(e,this._renderListHasChanged)),this._renderList=e}get postProcesses(){return this._postProcesses}get _prePassEnabled(){return!!this._prePassRenderTarget&&this._prePassRenderTarget.enabled}set onAfterUnbind(e){this._onAfterUnbindObserver&&this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=this.onAfterUnbindObservable.add(e)}set onBeforeRender(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)}set onAfterRender(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)}set onClear(e){this._onClearObserver&&this.onClearObservable.remove(this._onClearObserver),this._onClearObserver=this.onClearObservable.add(e)}get renderPassIds(){return this._renderPassIds}get currentRefreshId(){return this._currentRefreshId}setMaterialForRendering(e,t){let i;i=Array.isArray(e)?e:[e];for(let e=0;e0&&(this._postProcesses[0].autoClear=!1))}_shouldRender(){return-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)}getRenderSize(){return this.getRenderWidth()}getRenderWidth(){return this._size.width?this._size.width:this._size}getRenderHeight(){return this._size.width?this._size.height:this._size}getRenderLayers(){return this._size.layers||0}disableRescaling(){this._canRescale=!1}get canRescale(){return this._canRescale}scale(e){const t=Math.max(1,this.getRenderSize()*e);this.resize(t)}getReflectionTextureMatrix(){return this.isCube?this._textureMatrix:super.getReflectionTextureMatrix()}resize(e){var t;const i=this.isCube;null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=null;const n=this.getScene();n&&(this._processSizeParameter(e),this._renderTarget=i?n.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):n.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this._texture=this._renderTarget.texture,void 0!==this._renderTargetOptions.samples&&(this.samples=this._renderTargetOptions.samples),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))}render(e=!1,t=!1){this._render(e,t)}isReadyForRendering(){return this._render(!1,!1,!0)}_render(e=!1,t=!1,i=!1){var n;const r=this.getScene();if(!r)return i;const s=r.getEngine();if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._waitingRenderList){this.renderList=[];for(let e=0;e1||this.activeCamera&&this.activeCamera!==r.activeCamera)&&r.setTransformMatrix(r.activeCamera.getViewMatrix(),r.activeCamera.getProjectionMatrix(!0)),s.setViewport(r.activeCamera.viewport)),r.resetCachedMaterial(),c}_bestReflectionRenderTargetDimension(e,t){const i=e*t,n=c.D.NearestPOT(i+16384/(128+i));return Math.min(c.D.FloorPOT(e),n)}_prepareRenderingManager(e,t,i,n){const r=this.getScene();if(!r)return;this._renderingManager.reset();const s=r.getRenderId();for(let o=0;o=0&&this._renderingManager.dispatchParticles(i)}}_bindFrameBuffer(e=0,t=0){const i=this.getScene();if(!i)return;const n=i.getEngine();this._renderTarget&&n.bindFramebuffer(this._renderTarget,this.isCube?e:void 0,void 0,void 0,this.ignoreCameraViewport,0,t)}_unbindFrameBuffer(e,t){this._renderTarget&&e.unBindFramebuffer(this._renderTarget,this.isCube,(()=>{this.onAfterRenderObservable.notifyObservers(t)}))}_prepareFrame(e,t,i,n){this._postProcessManager?this._prePassEnabled||this._postProcessManager._prepareFrame(this._texture,this._postProcesses):n&&e.postProcessManager._prepareFrame(this._texture)||this._bindFrameBuffer(t,i)}_renderToTarget(e,t,i,n=0,s=null){var o,a,l,c,h,_;const d=this.getScene();if(!d)return;const u=d.getEngine();if(null===(o=u._debugPushGroup)||void 0===o||o.call(u,`render to face #${e} layer #${n}`,1),this._prepareFrame(d,e,n,t),this.is2DArray?(u.currentRenderPassId=this._renderPassIds[n],this.onBeforeRenderObservable.notifyObservers(n)):(u.currentRenderPassId=this._renderPassIds[e],this.onBeforeRenderObservable.notifyObservers(e)),u.snapshotRendering&&1===u.snapshotRenderingMode)this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(u):this.skipInitialClear||u.clear(this.clearColor||d.clearColor,!0,!0,!0);else{let o=null;const _=this.renderList?this.renderList:d.getActiveMeshes().data,p=this.renderList?this.renderList.length:d.getActiveMeshes().length;this.getCustomRenderList&&(o=this.getCustomRenderList(this.is2DArray?n:e,_,p)),o?this._prepareRenderingManager(o,o.length,s,!1):(this._defaultRenderListPrepared||(this._prepareRenderingManager(_,p,s,!this.renderList),this._defaultRenderListPrepared=!0),o=_);for(const t of d._beforeRenderTargetClearStage)t.action(this,e,n);this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(u):this.skipInitialClear||u.clear(this.clearColor||d.clearColor,!0,!0,!0),this._doNotChangeAspectRatio||d.updateTransformMatrix(!0);for(const t of d._beforeRenderTargetDrawStage)t.action(this,e,n);this._renderingManager.render(this.customRenderFunction,o,this.renderParticles,this.renderSprites);for(const t of d._afterRenderTargetDrawStage)t.action(this,e,n);const f=null!==(l=null===(a=this._texture)||void 0===a?void 0:a.generateMipMaps)&&void 0!==l&&l;this._texture&&(this._texture.generateMipMaps=!1),this._postProcessManager?this._postProcessManager._finalizeFrame(!1,null!==(c=this._renderTarget)&&void 0!==c?c:void 0,e,this._postProcesses,this.ignoreCameraViewport):t&&d.postProcessManager._finalizeFrame(!1,null!==(h=this._renderTarget)&&void 0!==h?h:void 0,e);for(const t of d._afterRenderTargetPostProcessStage)t.action(this,e,n);this._texture&&(this._texture.generateMipMaps=f),this._doNotChangeAspectRatio||d.updateTransformMatrix(!0),i&&r.w1.DumpFramebuffer(this.getRenderWidth(),this.getRenderHeight(),u)}this._unbindFrameBuffer(u,e),this._texture&&this.isCube&&5===e&&u.generateMipMapsForCubemap(this._texture),null===(_=u._debugPopGroup)||void 0===_||_.call(u,1)}setRenderingOrder(e,t=null,i=null,n=null){this._renderingManager.setRenderingOrder(e,t,i,n)}setRenderingAutoClearDepthStencil(e,t){this._renderingManager.setRenderingAutoClearDepthStencil(e,t),this._renderingManager._useSceneAutoClearSetup=!1}clone(){const e=this.getSize(),t=new _(this.name,e,this.getScene(),this._renderTargetOptions.generateMipMaps,this._doNotChangeAspectRatio,this._renderTargetOptions.type,this.isCube,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer,this._renderTargetOptions.generateStencilBuffer,void 0,this._renderTargetOptions.format,void 0,this._renderTargetOptions.samples);return t.hasAlpha=this.hasAlpha,t.level=this.level,t.coordinatesMode=this.coordinatesMode,this.renderList&&(t.renderList=this.renderList.slice(0)),t}serialize(){if(!this.name)return null;const e=super.serialize();if(e.renderTargetSize=this.getRenderSize(),e.renderList=[],this.renderList)for(let t=0;t=0&&t.customRenderTargets.splice(i,1);for(const e of t.cameras)i=e.customRenderTargets.indexOf(this),i>=0&&e.customRenderTargets.splice(i,1);null===(e=this._renderTarget)||void 0===e||e.dispose(),this._renderTarget=null,this._texture=null,super.dispose()}_rebuild(){this.refreshRate===_.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=_.REFRESHRATE_RENDER_ONCE),this._postProcessManager&&this._postProcessManager._rebuild()}freeRenderingGroups(){this._renderingManager&&this._renderingManager.freeRenderingGroups()}getViewCount(){return 1}}_.REFRESHRATE_RENDER_ONCE=0,_.REFRESHRATE_RENDER_ONEVERYFRAME=1,_.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=2,o.x._CreateRenderTargetTexture=(e,t,i,n,r)=>new _(e,t,i,n)},"../../../node_modules/@babylonjs/core/Materials/Textures/texture.js":function(e,t,i){"use strict";i.d(t,{x:function(){return m}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),a=i("../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.js"),l=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),c=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),h=i("../../../node_modules/@babylonjs/core/Misc/timingTools.js"),_=i("../../../node_modules/@babylonjs/core/Misc/instantiationTools.js"),d=i("../../../node_modules/@babylonjs/core/Maths/math.plane.js"),u=i("../../../node_modules/@babylonjs/core/Misc/stringTools.js"),p=i("../../../node_modules/@babylonjs/core/Misc/copyTools.js"),f=i("../../../node_modules/@babylonjs/core/Compat/compatibilityOptions.js");class m extends a.V{constructor(e,t,i,n,r=m.TRILINEAR_SAMPLINGMODE,o=null,a=null,l=null,c=!1,_,d,u,p,g){var b,y,v,A,C,S,x,T,E;let R;super(t),this.url=null,this.uOffset=0,this.vOffset=0,this.uScale=1,this.vScale=1,this.uAng=0,this.vAng=0,this.wAng=0,this.uRotationCenter=.5,this.vRotationCenter=.5,this.wRotationCenter=.5,this.homogeneousRotationInUVTransform=!1,this.inspectableCustomProperties=null,this._noMipmap=!1,this._invertY=!1,this._rowGenerationMatrix=null,this._cachedTextureMatrix=null,this._projectionModeMatrix=null,this._t0=null,this._t1=null,this._t2=null,this._cachedUOffset=-1,this._cachedVOffset=-1,this._cachedUScale=0,this._cachedVScale=0,this._cachedUAng=-1,this._cachedVAng=-1,this._cachedWAng=-1,this._cachedReflectionProjectionMatrixId=-1,this._cachedURotationCenter=-1,this._cachedVRotationCenter=-1,this._cachedWRotationCenter=-1,this._cachedHomogeneousRotationInUVTransform=!1,this._cachedReflectionTextureMatrix=null,this._cachedReflectionUOffset=-1,this._cachedReflectionVOffset=-1,this._cachedReflectionUScale=0,this._cachedReflectionVScale=0,this._cachedReflectionCoordinatesMode=-1,this._buffer=null,this._deleteBuffer=!1,this._format=null,this._delayedOnLoad=null,this._delayedOnError=null,this.onLoadObservable=new s.y$,this._isBlocking=!0,this.name=e||"",this.url=e;let P=!1,I=null;"object"==typeof i&&null!==i?(R=null!==(b=i.noMipmap)&&void 0!==b&&b,n=null!==(y=i.invertY)&&void 0!==y?y:!f.e.UseOpenGLOrientationForUV,r=null!==(v=i.samplingMode)&&void 0!==v?v:m.TRILINEAR_SAMPLINGMODE,o=null!==(A=i.onLoad)&&void 0!==A?A:null,a=null!==(C=i.onError)&&void 0!==C?C:null,l=null!==(S=i.buffer)&&void 0!==S?S:null,c=null!==(x=i.deleteBuffer)&&void 0!==x&&x,_=i.format,d=i.mimeType,u=i.loaderOptions,p=i.creationFlags,P=null!==(T=i.useSRGBBuffer)&&void 0!==T&&T,I=null!==(E=i.internalTexture)&&void 0!==E?E:null):R=!!i,this._noMipmap=R,this._invertY=void 0===n?!f.e.UseOpenGLOrientationForUV:n,this._initialSamplingMode=r,this._buffer=l,this._deleteBuffer=c,this._mimeType=d,this._loaderOptions=u,this._creationFlags=p,this._useSRGBBuffer=P,this._forcedExtension=g,_&&(this._format=_);const M=this.getScene(),D=this._getEngine();if(!D)return;D.onBeforeTextureInitObservable.notifyObservers(this);const O=()=>{this._texture&&(this._texture._invertVScale&&(this.vScale*=-1,this.vOffset+=1),null!==this._texture._cachedWrapU&&(this.wrapU=this._texture._cachedWrapU,this._texture._cachedWrapU=null),null!==this._texture._cachedWrapV&&(this.wrapV=this._texture._cachedWrapV,this._texture._cachedWrapV=null),null!==this._texture._cachedWrapR&&(this.wrapR=this._texture._cachedWrapR,this._texture._cachedWrapR=null)),this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this),o&&o(),!this.isBlocking&&M&&M.resetCachedMaterial()},w=(e,t)=>{this._loadingError=!0,this._errorObject={message:e,exception:t},a&&a(e,t),m.OnTextureLoadErrorObservable.notifyObservers(this)};if(!this.url)return this._delayedOnLoad=O,void(this._delayedOnError=w);if(this._texture=null!=I?I:this._getFromCache(this.url,R,r,this._invertY,P),this._texture)if(this._texture.isReady)h.Q.SetImmediate((()=>O()));else{const e=this._texture.onLoadedObservable.add(O);this._texture.onErrorObservable.add((t=>{var i;w(t.message,t.exception),null===(i=this._texture)||void 0===i||i.onLoadedObservable.remove(e)}))}else if(M&&M.useDelayedTextureLoading)this.delayLoadState=4,this._delayedOnLoad=O,this._delayedOnError=w;else{try{this._texture=D.createTexture(this.url,R,this._invertY,M,r,O,w,this._buffer,void 0,this._format,this._forcedExtension,d,u,p,P)}catch(e){throw w("error loading",e),e}c&&(this._buffer=null)}}get noMipmap(){return this._noMipmap}get mimeType(){return this._mimeType}set isBlocking(e){this._isBlocking=e}get isBlocking(){return this._isBlocking}get invertY(){return this._invertY}updateURL(e,t=null,i,n){this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(1)),this.name&&!this.name.startsWith("data:")||(this.name=e),this.url=e,this._buffer=t,this._forcedExtension=n,this.delayLoadState=4,i&&(this._delayedOnLoad=i),this.delayLoad()}delayLoad(){if(4!==this.delayLoadState)return;const e=this.getScene();e&&(this.delayLoadState=1,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY,this._useSRGBBuffer),this._texture?this._delayedOnLoad&&(this._texture.isReady?h.Q.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,this._forcedExtension,this._mimeType,this._loaderOptions,this._creationFlags,this._useSRGBBuffer),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null)}_prepareRowForTextureGeneration(e,t,i,n){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,o.P.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,n.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,n.z+=this.wRotationCenter}checkTransformsAreIdentical(e){return null!==e&&this.uOffset===e.uOffset&&this.vOffset===e.vOffset&&this.uScale===e.uScale&&this.vScale===e.vScale&&this.uAng===e.uAng&&this.vAng===e.vAng&&this.wAng===e.wAng}getTextureMatrix(e=1){if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,this._cachedTextureMatrix&&this._rowGenerationMatrix||(this._cachedTextureMatrix=o.y3.Zero(),this._rowGenerationMatrix=new o.y3,this._t0=o.P.Zero(),this._t1=o.P.Zero(),this._t2=o.P.Zero()),o.y3.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(o.y3.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,o.jp.Matrix[0]),o.y3.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,o.jp.Matrix[1]),o.y3.ScalingToRef(this._cachedUScale,this._cachedVScale,0,o.jp.Matrix[2]),o.y3.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,o.jp.Matrix[3]),o.jp.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(o.jp.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(o.jp.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(o.jp.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),o.y3.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix));const t=this.getScene();return t?(this.optimizeUVAllocation&&t.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this))),this._cachedTextureMatrix):this._cachedTextureMatrix}getReflectionTextureMatrix(){const e=this.getScene();if(!e)return this._cachedReflectionTextureMatrix;if(this.uOffset===this._cachedReflectionUOffset&&this.vOffset===this._cachedReflectionVOffset&&this.uScale===this._cachedReflectionUScale&&this.vScale===this._cachedReflectionVScale&&this.coordinatesMode===this._cachedReflectionCoordinatesMode){if(this.coordinatesMode!==m.PROJECTION_MODE)return this._cachedReflectionTextureMatrix;if(this._cachedReflectionProjectionMatrixId===e.getProjectionMatrix().updateFlag)return this._cachedReflectionTextureMatrix}this._cachedReflectionTextureMatrix||(this._cachedReflectionTextureMatrix=o.y3.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=o.y3.Zero());const t=this._cachedReflectionCoordinatesMode!==this.coordinatesMode;switch(this._cachedReflectionUOffset=this.uOffset,this._cachedReflectionVOffset=this.vOffset,this._cachedReflectionUScale=this.uScale,this._cachedReflectionVScale=this.vScale,this._cachedReflectionCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case m.PLANAR_MODE:o.y3.IdentityToRef(this._cachedReflectionTextureMatrix),this._cachedReflectionTextureMatrix[0]=this.uScale,this._cachedReflectionTextureMatrix[5]=this.vScale,this._cachedReflectionTextureMatrix[12]=this.uOffset,this._cachedReflectionTextureMatrix[13]=this.vOffset;break;case m.PROJECTION_MODE:{o.y3.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);const t=e.getProjectionMatrix();this._cachedReflectionProjectionMatrixId=t.updateFlag,t.multiplyToRef(this._projectionModeMatrix,this._cachedReflectionTextureMatrix);break}default:o.y3.IdentityToRef(this._cachedReflectionTextureMatrix)}return t&&e.markAllMaterialsAsDirty(1,(e=>-1!==e.getActiveTextures().indexOf(this))),this._cachedReflectionTextureMatrix}clone(){const e={noMipmap:this._noMipmap,invertY:this._invertY,samplingMode:this.samplingMode,onLoad:void 0,onError:void 0,buffer:this._texture?this._texture._buffer:void 0,deleteBuffer:this._deleteBuffer,format:this.textureFormat,mimeType:this.mimeType,loaderOptions:this._loaderOptions,creationFlags:this._creationFlags,useSRGBBuffer:this._useSRGBBuffer};return r.p4.Clone((()=>new m(this._texture?this._texture.url:null,this.getScene(),e)),this)}serialize(){const e=this.name;m.SerializeBuffers||this.name.startsWith("data:")&&(this.name=""),this.name.startsWith("data:")&&this.url===this.name&&(this.url="");const t=super.serialize();return t?((m.SerializeBuffers||m.ForceSerializeBuffers)&&("string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)?(t.base64String=this._buffer,t.name=t.name.replace("data:","")):this.url&&this.url.startsWith("data:")&&this._buffer instanceof Uint8Array?t.base64String="data:image/png;base64,"+(0,u.Gh)(this._buffer):(m.ForceSerializeBuffers||this.url&&this.url.startsWith("blob:")||this._forceSerialize)&&(t.base64String=!this._engine||this._engine._features.supportSyncTextureRead?(0,p._u)(this):(0,p.Jj)(this))),t.invertY=this._invertY,t.samplingMode=this.samplingMode,t._creationFlags=this._creationFlags,t._useSRGBBuffer=this._useSRGBBuffer,this.name=e,t):null}getClassName(){return"Texture"}dispose(){super.dispose(),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null}static Parse(e,t,i){if(e.customType){const n=_.K.Instantiate(e.customType).Parse(e,t,i);return e.samplingMode&&n.updateSamplingMode&&n._samplingMode&&n._samplingMode!==e.samplingMode&&n.updateSamplingMode(e.samplingMode),n}if(e.isCube&&!e.isRenderTarget)return m._CubeTextureParser(e,t,i);if(!e.name&&!e.isRenderTarget)return null;const n=t=>{if(t&&t._texture&&(t._texture._cachedWrapU=null,t._texture._cachedWrapV=null,t._texture._cachedWrapR=null),e.samplingMode){const i=e.samplingMode;t&&t.samplingMode!==i&&t.updateSamplingMode(i)}if(t&&e.animations)for(let i=0;i{var r,s,o;let a=!0;if(e.noMipmap&&(a=!1),e.mirrorPlane){const i=m._CreateMirror(e.name,e.renderTargetSize,t,a);return i._waitingRenderList=e.renderList,i.mirrorPlane=d.J.FromArray(e.mirrorPlane),n(i),i}if(e.isRenderTarget){let i=null;if(e.isCube){if(t.reflectionProbes)for(let i=0;i{n(r)}),null!==(s=e._creationFlags)&&void 0!==s?s:0,null!==(o=e._useSRGBBuffer)&&void 0!==o&&o),r.name=e.name;else{let s;s=e.name&&e.name.indexOf("://")>0?e.name:i+e.name,e.url&&(e.url.startsWith("data:")||m.UseSerializedUrlIfAny)&&(s=e.url),r=new m(s,t,!a,e.invertY,e.samplingMode,(()=>{n(r)}))}return r}}),e,t)}static CreateFromBase64String(e,t,i,n,r,s=m.TRILINEAR_SAMPLINGMODE,o=null,a=null,l=5,c){return new m("data:"+t,i,n,r,s,o,a,e,!1,l,void 0,void 0,c)}static LoadFromDataString(e,t,i,n=!1,r,s=!0,o=m.TRILINEAR_SAMPLINGMODE,a=null,l=null,c=5,h){return"data:"!==e.substr(0,5)&&(e="data:"+e),new m(e,i,r,s,o,a,l,t,n,c,void 0,void 0,h)}}m.SerializeBuffers=!0,m.ForceSerializeBuffers=!1,m.OnTextureLoadErrorObservable=new s.y$,m._CubeTextureParser=(e,t,i)=>{throw(0,c.S)("CubeTexture")},m._CreateMirror=(e,t,i,n)=>{throw(0,c.S)("MirrorTexture")},m._CreateRenderTargetTexture=(e,t,i,n,r)=>{throw(0,c.S)("RenderTargetTexture")},m.NEAREST_SAMPLINGMODE=1,m.NEAREST_NEAREST_MIPLINEAR=8,m.BILINEAR_SAMPLINGMODE=2,m.LINEAR_LINEAR_MIPNEAREST=11,m.TRILINEAR_SAMPLINGMODE=3,m.LINEAR_LINEAR_MIPLINEAR=3,m.NEAREST_NEAREST_MIPNEAREST=4,m.NEAREST_LINEAR_MIPNEAREST=5,m.NEAREST_LINEAR_MIPLINEAR=6,m.NEAREST_LINEAR=7,m.NEAREST_NEAREST=1,m.LINEAR_NEAREST_MIPNEAREST=9,m.LINEAR_NEAREST_MIPLINEAR=10,m.LINEAR_LINEAR=2,m.LINEAR_NEAREST=12,m.EXPLICIT_MODE=0,m.SPHERICAL_MODE=1,m.PLANAR_MODE=2,m.CUBIC_MODE=3,m.PROJECTION_MODE=4,m.SKYBOX_MODE=5,m.INVCUBIC_MODE=6,m.EQUIRECTANGULAR_MODE=7,m.FIXED_EQUIRECTANGULAR_MODE=8,m.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,m.CLAMP_ADDRESSMODE=0,m.WRAP_ADDRESSMODE=1,m.MIRROR_ADDRESSMODE=2,m.UseSerializedUrlIfAny=!1,(0,n.gn)([(0,r.qC)()],m.prototype,"url",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"uOffset",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"vOffset",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"uScale",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"vScale",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"uAng",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"vAng",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"wAng",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"uRotationCenter",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"vRotationCenter",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"wRotationCenter",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"homogeneousRotationInUVTransform",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"isBlocking",null),(0,l.H)("BABYLON.Texture",m),r.p4._TextureParser=m.Parse},"../../../node_modules/@babylonjs/core/Materials/Textures/textureSampler.js":function(e,t,i){"use strict";i.d(t,{a:function(){return n}});class n{constructor(){this.samplingMode=-1,this._useMipMaps=!0,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this._comparisonFunction=0}get wrapU(){return this._cachedWrapU}set wrapU(e){this._cachedWrapU=e}get wrapV(){return this._cachedWrapV}set wrapV(e){this._cachedWrapV=e}get wrapR(){return this._cachedWrapR}set wrapR(e){this._cachedWrapR=e}get anisotropicFilteringLevel(){return this._cachedAnisotropicFilteringLevel}set anisotropicFilteringLevel(e){this._cachedAnisotropicFilteringLevel=e}get comparisonFunction(){return this._comparisonFunction}set comparisonFunction(e){this._comparisonFunction=e}get useMipMaps(){return this._useMipMaps}set useMipMaps(e){this._useMipMaps=e}setParameters(e=1,t=1,i=1,n=1,r=2,s=0){return this._cachedWrapU=e,this._cachedWrapV=t,this._cachedWrapR=i,this._cachedAnisotropicFilteringLevel=n,this.samplingMode=r,this._comparisonFunction=s,this}compareSampler(e){return this._cachedWrapU===e._cachedWrapU&&this._cachedWrapV===e._cachedWrapV&&this._cachedWrapR===e._cachedWrapR&&this._cachedAnisotropicFilteringLevel===e._cachedAnisotropicFilteringLevel&&this.samplingMode===e.samplingMode&&this._comparisonFunction===e._comparisonFunction&&this._useMipMaps===e._useMipMaps}}},"../../../node_modules/@babylonjs/core/Materials/Textures/thinTexture.js":function(e,t,i){"use strict";i.d(t,{g:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.size.js");class r{constructor(e){this._wrapU=1,this._wrapV=1,this.wrapR=1,this.anisotropicFilteringLevel=4,this.delayLoadState=0,this._texture=null,this._engine=null,this._cachedSize=n.$.Zero(),this._cachedBaseSize=n.$.Zero(),this._initialSamplingMode=2,this._texture=e,this._texture&&(this._engine=this._texture.getEngine())}get wrapU(){return this._wrapU}set wrapU(e){this._wrapU=e}get wrapV(){return this._wrapV}set wrapV(e){this._wrapV=e}get coordinatesMode(){return 0}get isCube(){return!!this._texture&&this._texture.isCube}set isCube(e){this._texture&&(this._texture.isCube=e)}get is3D(){return!!this._texture&&this._texture.is3D}set is3D(e){this._texture&&(this._texture.is3D=e)}get is2DArray(){return!!this._texture&&this._texture.is2DArray}set is2DArray(e){this._texture&&(this._texture.is2DArray=e)}getClassName(){return"ThinTexture"}isReady(){return 4===this.delayLoadState?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady}delayLoad(){}getInternalTexture(){return this._texture}getSize(){if(this._texture){if(this._texture.width)return this._cachedSize.width=this._texture.width,this._cachedSize.height=this._texture.height,this._cachedSize;if(this._texture._size)return this._cachedSize.width=this._texture._size,this._cachedSize.height=this._texture._size,this._cachedSize}return this._cachedSize}getBaseSize(){return this.isReady()&&this._texture?this._texture._size?(this._cachedBaseSize.width=this._texture._size,this._cachedBaseSize.height=this._texture._size,this._cachedBaseSize):(this._cachedBaseSize.width=this._texture.baseWidth,this._cachedBaseSize.height=this._texture.baseHeight,this._cachedBaseSize):(this._cachedBaseSize.width=0,this._cachedBaseSize.height=0,this._cachedBaseSize)}get samplingMode(){return this._texture?this._texture.samplingMode:this._initialSamplingMode}updateSamplingMode(e){this._texture&&this._engine&&this._engine.updateTextureSamplingMode(e,this._texture)}releaseInternalTexture(){this._texture&&(this._texture.dispose(),this._texture=null)}dispose(){this._texture&&(this.releaseInternalTexture(),this._engine=null)}}},"../../../node_modules/@babylonjs/core/Materials/colorCurves.js":function(e,t,i){"use strict";i.d(t,{U:function(){return o}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.color.js");class o{constructor(){this._dirty=!0,this._tempColor=new s.HE(0,0,0,0),this._globalCurve=new s.HE(0,0,0,0),this._highlightsCurve=new s.HE(0,0,0,0),this._midtonesCurve=new s.HE(0,0,0,0),this._shadowsCurve=new s.HE(0,0,0,0),this._positiveCurve=new s.HE(0,0,0,0),this._negativeCurve=new s.HE(0,0,0,0),this._globalHue=30,this._globalDensity=0,this._globalSaturation=0,this._globalExposure=0,this._highlightsHue=30,this._highlightsDensity=0,this._highlightsSaturation=0,this._highlightsExposure=0,this._midtonesHue=30,this._midtonesDensity=0,this._midtonesSaturation=0,this._midtonesExposure=0,this._shadowsHue=30,this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}get globalHue(){return this._globalHue}set globalHue(e){this._globalHue=e,this._dirty=!0}get globalDensity(){return this._globalDensity}set globalDensity(e){this._globalDensity=e,this._dirty=!0}get globalSaturation(){return this._globalSaturation}set globalSaturation(e){this._globalSaturation=e,this._dirty=!0}get globalExposure(){return this._globalExposure}set globalExposure(e){this._globalExposure=e,this._dirty=!0}get highlightsHue(){return this._highlightsHue}set highlightsHue(e){this._highlightsHue=e,this._dirty=!0}get highlightsDensity(){return this._highlightsDensity}set highlightsDensity(e){this._highlightsDensity=e,this._dirty=!0}get highlightsSaturation(){return this._highlightsSaturation}set highlightsSaturation(e){this._highlightsSaturation=e,this._dirty=!0}get highlightsExposure(){return this._highlightsExposure}set highlightsExposure(e){this._highlightsExposure=e,this._dirty=!0}get midtonesHue(){return this._midtonesHue}set midtonesHue(e){this._midtonesHue=e,this._dirty=!0}get midtonesDensity(){return this._midtonesDensity}set midtonesDensity(e){this._midtonesDensity=e,this._dirty=!0}get midtonesSaturation(){return this._midtonesSaturation}set midtonesSaturation(e){this._midtonesSaturation=e,this._dirty=!0}get midtonesExposure(){return this._midtonesExposure}set midtonesExposure(e){this._midtonesExposure=e,this._dirty=!0}get shadowsHue(){return this._shadowsHue}set shadowsHue(e){this._shadowsHue=e,this._dirty=!0}get shadowsDensity(){return this._shadowsDensity}set shadowsDensity(e){this._shadowsDensity=e,this._dirty=!0}get shadowsSaturation(){return this._shadowsSaturation}set shadowsSaturation(e){this._shadowsSaturation=e,this._dirty=!0}get shadowsExposure(){return this._shadowsExposure}set shadowsExposure(e){this._shadowsExposure=e,this._dirty=!0}getClassName(){return"ColorCurves"}static Bind(e,t,i="vCameraColorCurvePositive",n="vCameraColorCurveNeutral",r="vCameraColorCurveNegative"){e._dirty&&(e._dirty=!1,e._getColorGradingDataToRef(e._globalHue,e._globalDensity,e._globalSaturation,e._globalExposure,e._globalCurve),e._getColorGradingDataToRef(e._highlightsHue,e._highlightsDensity,e._highlightsSaturation,e._highlightsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._highlightsCurve),e._getColorGradingDataToRef(e._midtonesHue,e._midtonesDensity,e._midtonesSaturation,e._midtonesExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._midtonesCurve),e._getColorGradingDataToRef(e._shadowsHue,e._shadowsDensity,e._shadowsSaturation,e._shadowsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._shadowsCurve),e._highlightsCurve.subtractToRef(e._midtonesCurve,e._positiveCurve),e._midtonesCurve.subtractToRef(e._shadowsCurve,e._negativeCurve)),t&&(t.setFloat4(i,e._positiveCurve.r,e._positiveCurve.g,e._positiveCurve.b,e._positiveCurve.a),t.setFloat4(n,e._midtonesCurve.r,e._midtonesCurve.g,e._midtonesCurve.b,e._midtonesCurve.a),t.setFloat4(r,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))}static PrepareUniforms(e){e.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")}_getColorGradingDataToRef(e,t,i,n,r){null!=e&&(e=o._Clamp(e,0,360),t=o._Clamp(t,-100,100),i=o._Clamp(i,-100,100),n=o._Clamp(n,-100,100),t=o._ApplyColorGradingSliderNonlinear(t),t*=.5,n=o._ApplyColorGradingSliderNonlinear(n),t<0&&(t*=-1,e=(e+180)%360),o._FromHSBToRef(e,t,50+.25*n,r),r.scaleToRef(2,r),r.a=1+.01*i)}static _ApplyColorGradingSliderNonlinear(e){e/=100;let t=Math.abs(e);return t=Math.pow(t,2),e<0&&(t*=-1),t*=100,t}static _FromHSBToRef(e,t,i,n){let r=o._Clamp(e,0,360);const s=o._Clamp(t/100,0,1),a=o._Clamp(i/100,0,1);if(0===s)n.r=a,n.g=a,n.b=a;else{r/=60;const e=Math.floor(r),t=r-e,i=a*(1-s),o=a*(1-s*t),l=a*(1-s*(1-t));switch(e){case 0:n.r=a,n.g=l,n.b=i;break;case 1:n.r=o,n.g=a,n.b=i;break;case 2:n.r=i,n.g=a,n.b=l;break;case 3:n.r=i,n.g=o,n.b=a;break;case 4:n.r=l,n.g=i,n.b=a;break;default:n.r=a,n.g=i,n.b=o}}n.a=1}static _Clamp(e,t,i){return Math.min(Math.max(e,t),i)}clone(){return r.p4.Clone((()=>new o),this)}serialize(){return r.p4.Serialize(this)}static Parse(e){return r.p4.Parse((()=>new o),e,null,null)}}(0,n.gn)([(0,r.qC)()],o.prototype,"_globalHue",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_globalDensity",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_globalSaturation",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_globalExposure",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_highlightsHue",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_highlightsDensity",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_highlightsSaturation",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_highlightsExposure",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_midtonesHue",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_midtonesDensity",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_midtonesSaturation",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"_midtonesExposure",void 0),r.p4._ColorCurvesParser=o.Parse},"../../../node_modules/@babylonjs/core/Materials/drawWrapper.js":function(e,t,i){"use strict";i.d(t,{q:function(){return n}});class n{constructor(e,t=!0){this.effect=null,this.defines=null,this.drawContext=e.createDrawContext(),t&&(this.materialContext=e.createMaterialContext())}static IsWrapper(e){return void 0===e.getPipelineContext}static GetEffect(e){return void 0===e.getPipelineContext?e.effect:e}setEffect(e,t,i=!0){var n;this.effect=e,void 0!==t&&(this.defines=t),i&&(null===(n=this.drawContext)||void 0===n||n.reset())}dispose(){var e;null===(e=this.drawContext)||void 0===e||e.dispose()}}},"../../../node_modules/@babylonjs/core/Materials/effect.js":function(e,t,i){"use strict";i.d(t,{Q:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),r=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js"),s=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),o=i("../../../node_modules/@babylonjs/core/Engines/Processors/shaderProcessor.js"),a=i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js"),l=i("../../../node_modules/@babylonjs/core/Materials/shaderLanguage.js");class c{constructor(e,t,i,s=null,h,_=null,d=null,u=null,p=null,f,m="",g=l.x.GLSL){var b,y,v;let A;this.name=null,this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new n.y$,this.onErrorObservable=new n.y$,this._onBindObservable=null,this._wasPreviouslyReady=!1,this._wasPreviouslyUsingInstances=null,this._isDisposed=!1,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._multiTarget=!1,this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._pipelineContext=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._rawVertexSourceCode="",this._rawFragmentSourceCode="",this.name=e,this._key=m;let C,S,x=null;if(t.attributes){const e=t;if(this._engine=i,this._attributesNames=e.attributes,this._uniformsNames=e.uniformsNames.concat(e.samplers),this._samplerList=e.samplers.slice(),this.defines=e.defines,this.onError=e.onError,this.onCompiled=e.onCompiled,this._fallbacks=e.fallbacks,this._indexParameters=e.indexParameters,this._transformFeedbackVaryings=e.transformFeedbackVaryings||null,this._multiTarget=!!e.multiTarget,this._shaderLanguage=null!==(b=e.shaderLanguage)&&void 0!==b?b:l.x.GLSL,e.uniformBuffersNames){this._uniformBuffersNamesList=e.uniformBuffersNames.slice();for(let t=0;t{if(R[0]&&R[1]){E.isFragment=!0;const[t,i]=R;o.L.Process(i,E,(i=>{x&&(i=x("fragment",i));const n=o.L.Finalize(t,i,E);this._useFinalCode(n.vertexCode,n.fragmentCode,e)}),this._engine)}};this._loadShader(C,"Vertex","",(e=>{o.L.Initialize(E),o.L.Process(e,E,(t=>{this._rawVertexSourceCode=e,x&&(t=x("vertex",t)),R[0]=t,P()}),this._engine)})),this._loadShader(S,"Fragment","Pixel",(e=>{this._rawFragmentSourceCode=e,R[1]=e,P()}));const I=function(e){return function(){return this._pipelineContext&&this._pipelineContext[e].apply(this._pipelineContext,arguments),this}};["Int?","IntArray?","Array?","Color?","Vector?","Float?","Matrices","Matrix","Matrix3x3","Matrix2x2","Quaternion","DirectColor4"].forEach((e=>{const t=`set${e}`;t.endsWith("?")?["",2,3,4].forEach((e=>{this[t.slice(0,-1)+e]=this[t.slice(0,-1)+e]||I(t.slice(0,-1)+e).bind(this)})):this[t]=this[t]||I(t).bind(this)}))}static get ShadersRepository(){return a.v.ShadersRepository}static set ShadersRepository(e){a.v.ShadersRepository=e}get onBindObservable(){return this._onBindObservable||(this._onBindObservable=new n.y$),this._onBindObservable}_useFinalCode(e,t,i){if(i){const n=i.vertexElement||i.vertex||i.spectorName||i,r=i.fragmentElement||i.fragment||i.spectorName||i;this._vertexSourceCode=(this._shaderLanguage===l.x.WGSL?"//":"")+"#define SHADER_NAME vertex:"+n+"\n"+e,this._fragmentSourceCode=(this._shaderLanguage===l.x.WGSL?"//":"")+"#define SHADER_NAME fragment:"+r+"\n"+t}else this._vertexSourceCode=e,this._fragmentSourceCode=t;this._prepareEffect()}get key(){return this._key}isReady(){try{return this._isReadyInternal()}catch(e){return!1}}_isReadyInternal(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady}getEngine(){return this._engine}getPipelineContext(){return this._pipelineContext}getAttributesNames(){return this._attributesNames}getAttributeLocation(e){return this._attributes[e]}getAttributeLocationByName(e){return this._attributeLocationByName[e]}getAttributesCount(){return this._attributes.length}getUniformIndex(e){return this._uniformsNames.indexOf(e)}getUniform(e){return this._uniforms[e]}getSamplers(){return this._samplerList}getUniformNames(){return this._uniformsNames}getUniformBuffersNames(){return this._uniformBuffersNamesList}getIndexParameters(){return this._indexParameters}getCompilationError(){return this._compilationError}allFallbacksProcessed(){return this._allFallbacksProcessed}executeWhenCompiled(e){this.isReady()?e(this):(this.onCompileObservable.add((t=>{e(t)})),this._pipelineContext&&!this._pipelineContext.isAsync||setTimeout((()=>{this._checkIsReady(null)}),16))}_checkIsReady(e){try{if(this._isReadyInternal())return}catch(t){return void this._processCompilationErrors(t,e)}this._isDisposed||setTimeout((()=>{this._checkIsReady(e)}),16)}_loadShader(e,t,i,n){if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return void n((0,r.v)(e));if("source:"===e.substr(0,7))return void n(e.substr(7));if("base64:"===e.substr(0,7))return void n(window.atob(e.substr(7)));const s=a.v.GetShadersStore(this._shaderLanguage);if(s[e+t+"Shader"])return void n(s[e+t+"Shader"]);if(i&&s[e+i+"Shader"])return void n(s[e+i+"Shader"]);let o;o="."===e[0]||"/"===e[0]||e.indexOf("http")>-1?e:a.v.GetShadersRepository(this._shaderLanguage)+e,this._engine._loadFile(o+"."+t.toLowerCase()+".fx",n)}get vertexSourceCode(){var e,t;return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._vertexSourceCodeOverride:null!==(t=null===(e=this._pipelineContext)||void 0===e?void 0:e._getVertexShaderCode())&&void 0!==t?t:this._vertexSourceCode}get fragmentSourceCode(){var e,t;return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._fragmentSourceCodeOverride:null!==(t=null===(e=this._pipelineContext)||void 0===e?void 0:e._getFragmentShaderCode())&&void 0!==t?t:this._fragmentSourceCode}get rawVertexSourceCode(){return this._rawVertexSourceCode}get rawFragmentSourceCode(){return this._rawFragmentSourceCode}_rebuildProgram(e,t,i,n){this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=(e,t)=>{n&&n(t)},this.onCompiled=()=>{const e=this.getEngine().scenes;if(e)for(let t=0;t{if(this._attributes=[],this._pipelineContext._fillEffectInformation(this,this._uniformBuffersNames,this._uniformsNames,this._uniforms,this._samplerList,this._samplers,e,this._attributes),e)for(let t=0;t=t&&(r=`Offending line [${t}] in ${i?"fragment":"vertex"} code: ${n[t-1]}`)}}return[e,r]}_processCompilationErrors(e,t=null){var i,n,r;this._compilationError=e.message;const o=this._attributesNames,a=this._fallbacks;if(s.Y.Error("Unable to compile effect:"),s.Y.Error("Uniforms: "+this._uniformsNames.map((function(e){return" "+e}))),s.Y.Error("Attributes: "+o.map((function(e){return" "+e}))),s.Y.Error("Defines:\r\n"+this.defines),c.LogShaderCodeOnCompilationError){let e=null,t=null,o=null;(null===(i=this._pipelineContext)||void 0===i?void 0:i._getVertexShaderCode())&&([o,e]=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1),o&&(s.Y.Error("Vertex code:"),s.Y.Error(o))),(null===(n=this._pipelineContext)||void 0===n?void 0:n._getFragmentShaderCode())&&([o,t]=this._getShaderCodeAndErrorLine(null===(r=this._pipelineContext)||void 0===r?void 0:r._getFragmentShaderCode(),this._compilationError,!0),o&&(s.Y.Error("Fragment code:"),s.Y.Error(o))),e&&s.Y.Error(e),t&&s.Y.Error(t)}s.Y.Error("Error: "+this._compilationError);const l=()=>{this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this)};t&&(this._pipelineContext=t,this._isReady=!0,l()),a?(this._pipelineContext=null,a.hasMoreFallbacks?(this._allFallbacksProcessed=!1,s.Y.Error("Trying next fallback."),this.defines=a.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,l(),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):(this._allFallbacksProcessed=!0,t||l())}get isSupported(){return""===this._compilationError}_bindTexture(e,t){this._engine._bindTexture(this._samplers[e],t,e)}setTexture(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t,e)}setDepthStencilTexture(e,t){this._engine.setDepthStencilTexture(this._samplers[e],this._uniforms[e],t,e)}setTextureArray(e,t){const i=e+"Ex";if(-1===this._samplerList.indexOf(i+"0")){const n=this._samplerList.indexOf(e);for(let e=1;ethis._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)}addCPUSkinningFallback(e,t){this._mesh=t,ethis._maxRank&&(this._maxRank=e)}get hasMoreFallbacks(){return this._currentRank<=this._maxRank}reduce(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&this._mesh.numBoneInfluencers>0){this._mesh.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;const i=this._mesh.getScene();for(let e=0;e0&&(n.computeBonesUsingShaders=!1)}}else{const t=this._defines[this._currentRank];if(t)for(let i=0;inew _),this)}serialize(){return r.p4.Serialize(this)}static Parse(e){return r.p4.Parse((()=>new _),e,null,null)}static get VIGNETTEMODE_MULTIPLY(){return this._VIGNETTEMODE_MULTIPLY}static get VIGNETTEMODE_OPAQUE(){return this._VIGNETTEMODE_OPAQUE}}_.TONEMAPPING_STANDARD=0,_.TONEMAPPING_ACES=1,_._VIGNETTEMODE_MULTIPLY=0,_._VIGNETTEMODE_OPAQUE=1,(0,n.gn)([(0,r.N$)()],_.prototype,"colorCurves",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_colorCurvesEnabled",void 0),(0,n.gn)([(0,r.oU)("colorGradingTexture")],_.prototype,"_colorGradingTexture",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_colorGradingEnabled",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_colorGradingWithGreenDepth",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_colorGradingBGR",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_exposure",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_toneMappingEnabled",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_toneMappingType",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_contrast",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"vignetteStretch",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"vignetteCentreX",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"vignetteCentreY",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"vignetteWeight",void 0),(0,n.gn)([(0,r.XX)()],_.prototype,"vignetteColor",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"vignetteCameraFov",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_vignetteBlendMode",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_vignetteEnabled",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_ditheringEnabled",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_ditheringIntensity",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_skipFinalColorClamp",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_applyByPostProcess",void 0),(0,n.gn)([(0,r.qC)()],_.prototype,"_isEnabled",void 0),r.p4._ImageProcessingConfigurationParser=_.Parse},"../../../node_modules/@babylonjs/core/Materials/material.detailMapConfiguration.js":function(e,t,i){"use strict";i.d(t,{p:function(){return _}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Materials/material.js"),s=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),o=i("../../../node_modules/@babylonjs/core/Materials/materialFlags.js"),a=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),l=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js"),c=i("../../../node_modules/@babylonjs/core/Materials/materialPluginBase.js");class h extends l.H{constructor(){super(...arguments),this.DETAIL=!1,this.DETAILDIRECTUV=0,this.DETAIL_NORMALBLENDMETHOD=0}}class _ extends c.n{constructor(e,t=!0){super(e,"DetailMap",140,new h,t),this._texture=null,this.diffuseBlendLevel=1,this.roughnessBlendLevel=1,this.bumpLevel=1,this._normalBlendMethod=r.F.MATERIAL_NORMALBLENDMETHOD_WHITEOUT,this._isEnabled=!1,this.isEnabled=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[1]}_markAllSubMeshesAsTexturesDirty(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()}isReadyForSubMesh(e,t,i){return!this._isEnabled||!(e._areTexturesDirty&&t.texturesEnabled&&i.getCaps().standardDerivatives&&this._texture&&o.k.DetailTextureEnabled&&!this._texture.isReady())}prepareDefines(e,t){if(this._isEnabled){e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod;const i=t.getEngine();e._areTexturesDirty&&(i.getCaps().standardDerivatives&&this._texture&&o.k.DetailTextureEnabled&&this._isEnabled?(a.G.PrepareDefinesForMergedUV(this._texture,e,"DETAIL"),e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod):e.DETAIL=!1)}else e.DETAIL=!1}bindForSubMesh(e,t){if(!this._isEnabled)return;const i=this._material.isFrozen;e.useUbo&&i&&e.isSync||this._texture&&o.k.DetailTextureEnabled&&(e.updateFloat4("vDetailInfos",this._texture.coordinatesIndex,this.diffuseBlendLevel,this.bumpLevel,this.roughnessBlendLevel),a.G.BindTextureMatrix(this._texture,e,"detail")),t.texturesEnabled&&this._texture&&o.k.DetailTextureEnabled&&e.setTexture("detailSampler",this._texture)}hasTexture(e){return this._texture===e}getActiveTextures(e){this._texture&&e.push(this._texture)}getAnimatables(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)}dispose(e){var t;e&&(null===(t=this._texture)||void 0===t||t.dispose())}getClassName(){return"DetailMapConfiguration"}getSamplers(e){e.push("detailSampler")}getUniforms(){return{ubo:[{name:"vDetailInfos",size:4,type:"vec4"},{name:"detailMatrix",size:16,type:"mat4"}]}}}(0,n.gn)([(0,s.oU)("detailTexture"),(0,s.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"texture",void 0),(0,n.gn)([(0,s.qC)()],_.prototype,"diffuseBlendLevel",void 0),(0,n.gn)([(0,s.qC)()],_.prototype,"roughnessBlendLevel",void 0),(0,n.gn)([(0,s.qC)()],_.prototype,"bumpLevel",void 0),(0,n.gn)([(0,s.qC)(),(0,s.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"normalBlendMethod",void 0),(0,n.gn)([(0,s.qC)(),(0,s.wz)("_markAllSubMeshesAsTexturesDirty")],_.prototype,"isEnabled",void 0)},"../../../node_modules/@babylonjs/core/Materials/material.js":function(e,t,i){"use strict";i.d(t,{F:function(){return m}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),o=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),a=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),l=i("../../../node_modules/@babylonjs/core/Meshes/subMesh.js"),c=i("../../../node_modules/@babylonjs/core/Materials/uniformBuffer.js"),h=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),_=i("../../../node_modules/@babylonjs/core/Maths/math.plane.js"),d=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),u=i("../../../node_modules/@babylonjs/core/Materials/drawWrapper.js");class p{constructor(){this.reset()}reset(){this.enabled=!1,this.mask=255,this.func=519,this.funcRef=1,this.funcMask=255,this.opStencilFail=7680,this.opDepthFail=7680,this.opStencilDepthPass=7681}get func(){return this._func}set func(e){this._func=e}get funcRef(){return this._funcRef}set funcRef(e){this._funcRef=e}get funcMask(){return this._funcMask}set funcMask(e){this._funcMask=e}get opStencilFail(){return this._opStencilFail}set opStencilFail(e){this._opStencilFail=e}get opDepthFail(){return this._opDepthFail}set opDepthFail(e){this._opDepthFail=e}get opStencilDepthPass(){return this._opStencilDepthPass}set opStencilDepthPass(e){this._opStencilDepthPass=e}get mask(){return this._mask}set mask(e){this._mask=e}get enabled(){return this._enabled}set enabled(e){this._enabled=e}getClassName(){return"MaterialStencilState"}copyTo(e){r.p4.Clone((()=>e),this)}serialize(){return r.p4.Serialize(this)}parse(e,t,i){r.p4.Parse((()=>this),e,t,i)}}(0,n.gn)([(0,r.qC)()],p.prototype,"func",null),(0,n.gn)([(0,r.qC)()],p.prototype,"funcRef",null),(0,n.gn)([(0,r.qC)()],p.prototype,"funcMask",null),(0,n.gn)([(0,r.qC)()],p.prototype,"opStencilFail",null),(0,n.gn)([(0,r.qC)()],p.prototype,"opDepthFail",null),(0,n.gn)([(0,r.qC)()],p.prototype,"opStencilDepthPass",null),(0,n.gn)([(0,r.qC)()],p.prototype,"mask",null),(0,n.gn)([(0,r.qC)()],p.prototype,"enabled",null);var f=i("../../../node_modules/@babylonjs/core/Materials/materialPluginEvent.js");class m{constructor(e,t,i){this.shadowDepthWrapper=null,this.allowShaderHotSwapping=!0,this.metadata=null,this.reservedDataStore=null,this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state="",this._alpha=1,this._backFaceCulling=!0,this._cullBackFaces=!0,this._blockDirtyMechanism=!1,this.onCompiled=null,this.onError=null,this.getRenderTargetTextures=null,this.doNotSerialize=!1,this._storeEffectOnSubMeshes=!1,this.animations=null,this.onDisposeObservable=new o.y$,this._onDisposeObserver=null,this._onUnBindObservable=null,this._onBindObserver=null,this._alphaMode=2,this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.disableColorWrite=!1,this.forceDepthWrite=!1,this.depthFunction=0,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this.zOffsetUnits=0,this.stencil=new p,this._useUBO=!1,this._fillMode=m.TriangleFillMode,this._cachedDepthWriteState=!1,this._cachedColorWriteState=!1,this._cachedDepthFunctionState=0,this._indexInSceneMaterialArray=-1,this.meshMap=null,this._parentContainer=null,this._uniformBufferLayoutBuilt=!1,this._eventInfo={},this._callbackPluginEventGeneric=()=>{},this._callbackPluginEventIsReadyForSubMesh=()=>{},this._callbackPluginEventPrepareDefines=()=>{},this._callbackPluginEventPrepareDefinesBeforeAttributes=()=>{},this._callbackPluginEventHardBindForSubMesh=()=>{},this._callbackPluginEventBindForSubMesh=()=>{},this._callbackPluginEventHasRenderTargetTextures=()=>{},this._callbackPluginEventFillRenderTargetTextures=()=>{},this._forceAlphaTest=!1,this._transparencyMode=null,this.name=e;const n=t||a.l.LastCreatedScene;n&&(this._scene=n,this._dirtyCallbacks={},this._dirtyCallbacks[1]=this._markAllSubMeshesAsTexturesDirty.bind(this),this._dirtyCallbacks[2]=this._markAllSubMeshesAsLightsDirty.bind(this),this._dirtyCallbacks[4]=this._markAllSubMeshesAsFresnelDirty.bind(this),this._dirtyCallbacks[8]=this._markAllSubMeshesAsAttributesDirty.bind(this),this._dirtyCallbacks[16]=this._markAllSubMeshesAsMiscDirty.bind(this),this._dirtyCallbacks[32]=this._markAllSubMeshesAsPrePassDirty.bind(this),this._dirtyCallbacks[63]=this._markAllSubMeshesAsAllDirty.bind(this),this.id=e||s.w1.RandomId(),this.uniqueId=this._scene.getUniqueId(),this._materialContext=this._scene.getEngine().createMaterialContext(),this._drawWrapper=new u.q(this._scene.getEngine(),!1),this._drawWrapper.materialContext=this._materialContext,this._scene.useRightHandedSystem?this.sideOrientation=m.ClockWiseSideOrientation:this.sideOrientation=m.CounterClockWiseSideOrientation,this._uniformBuffer=new c.M(this._scene.getEngine(),void 0,void 0,e),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,i||this._scene.addMaterial(this),this._scene.useMaterialMeshMap&&(this.meshMap={}),m.OnEventObservable.notifyObservers(this,f.S.Created))}get canRenderToMRT(){return!1}set alpha(e){if(this._alpha===e)return;const t=this._alpha;this._alpha=e,1!==t&&1!==e||this.markAsDirty(m.MiscDirtyFlag)}get alpha(){return this._alpha}set backFaceCulling(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,this.markAsDirty(m.TextureDirtyFlag))}get backFaceCulling(){return this._backFaceCulling}set cullBackFaces(e){this._cullBackFaces!==e&&(this._cullBackFaces=e,this.markAsDirty(m.TextureDirtyFlag))}get cullBackFaces(){return this._cullBackFaces}get blockDirtyMechanism(){return this._blockDirtyMechanism}set blockDirtyMechanism(e){this._blockDirtyMechanism!==e&&(this._blockDirtyMechanism=e,e||this.markDirty())}atomicMaterialsUpdate(e){this.blockDirtyMechanism=!0;try{e(this)}finally{this.blockDirtyMechanism=!1}}get hasRenderTargetTextures(){return this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._eventInfo.hasRenderTargetTextures}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get onBindObservable(){return this._onBindObservable||(this._onBindObservable=new o.y$),this._onBindObservable}set onBind(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)}get onUnBindObservable(){return this._onUnBindObservable||(this._onUnBindObservable=new o.y$),this._onUnBindObservable}get onEffectCreatedObservable(){return this._onEffectCreatedObservable||(this._onEffectCreatedObservable=new o.y$),this._onEffectCreatedObservable}set alphaMode(e){this._alphaMode!==e&&(this._alphaMode=e,this.markAsDirty(m.TextureDirtyFlag))}get alphaMode(){return this._alphaMode}set needDepthPrePass(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))}get needDepthPrePass(){return this._needDepthPrePass}get isPrePassCapable(){return!1}set fogEnabled(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAsDirty(m.MiscDirtyFlag))}get fogEnabled(){return this._fogEnabled}get wireframe(){switch(this._fillMode){case m.WireFrameFillMode:case m.LineListDrawMode:case m.LineLoopDrawMode:case m.LineStripDrawMode:return!0}return this._scene.forceWireframe}set wireframe(e){this.fillMode=e?m.WireFrameFillMode:m.TriangleFillMode}get pointsCloud(){switch(this._fillMode){case m.PointFillMode:case m.PointListDrawMode:return!0}return this._scene.forcePointsCloud}set pointsCloud(e){this.fillMode=e?m.PointFillMode:m.TriangleFillMode}get fillMode(){return this._fillMode}set fillMode(e){this._fillMode!==e&&(this._fillMode=e,this.markAsDirty(m.MiscDirtyFlag))}_getDrawWrapper(){return this._drawWrapper}_setDrawWrapper(e){this._drawWrapper=e}toString(e){return"Name: "+this.name}getClassName(){return"Material"}get isFrozen(){return this.checkReadyOnlyOnce}freeze(){this.markDirty(),this.checkReadyOnlyOnce=!0}unfreeze(){this.markDirty(),this.checkReadyOnlyOnce=!1}isReady(e,t){return!0}isReadyForSubMesh(e,t,i){const n=t.materialDefines;return!!n&&(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=n,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),this._eventInfo.isReadyForSubMesh)}getEffect(){return this._drawWrapper.effect}getScene(){return this._scene}get transparencyMode(){return this._transparencyMode}set transparencyMode(e){this._transparencyMode!==e&&(this._transparencyMode=e,this._forceAlphaTest=e===m.MATERIAL_ALPHATESTANDBLEND,this._markAllSubMeshesAsTexturesAndMiscDirty())}get _disableAlphaBlending(){return this._transparencyMode===m.MATERIAL_OPAQUE||this._transparencyMode===m.MATERIAL_ALPHATEST}needAlphaBlending(){return!this._disableAlphaBlending&&this.alpha<1}needAlphaBlendingForMesh(e){return e.visibility<1||!this._disableAlphaBlending&&(e.hasVertexAlpha||this.needAlphaBlending())}needAlphaTesting(){return!!this._forceAlphaTest}_shouldTurnAlphaTestOn(e){return!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()}getAlphaTestTexture(){return null}markDirty(){const e=this.getScene().meshes;for(const t of e)if(t.subMeshes)for(const e of t.subMeshes)e.getMaterial()===this&&e.effect&&(e.effect._wasPreviouslyReady=!1,e.effect._wasPreviouslyUsingInstances=null)}_preBind(e,t=null){const i=this._scene.getEngine(),n=(null==t?this.sideOrientation:t)===m.ClockWiseSideOrientation;return i.enableEffect(e||this._getDrawWrapper()),i.setState(this.backFaceCulling,this.zOffset,!1,n,this.cullBackFaces,this.stencil,this.zOffsetUnits),n}bind(e,t){}buildUniformLayout(){const e=this._uniformBuffer;this._eventInfo.ubo=e,this._callbackPluginEventGeneric(f.S.PrepareUniformBuffer,this._eventInfo),e.create(),this._uniformBufferLayoutBuilt=!0}bindForSubMesh(e,t,i){i.effect&&(this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo))}bindOnlyWorldMatrix(e){}bindView(e){this._useUBO?this._needToBindSceneUbo=!0:e.setMatrix("view",this.getScene().getViewMatrix())}bindViewProjection(e){this._useUBO?this._needToBindSceneUbo=!0:(e.setMatrix("viewProjection",this.getScene().getTransformMatrix()),e.setMatrix("projection",this.getScene().getProjectionMatrix()))}bindEyePosition(e,t){this._useUBO?this._needToBindSceneUbo=!0:this._scene.bindEyePosition(e,t)}_afterBind(e,t=null){if(this._scene._cachedMaterial=this,this._needToBindSceneUbo&&t&&(this._needToBindSceneUbo=!1,d.G.BindSceneUniformBuffer(t,this.getScene().getSceneUniformBuffer()),this._scene.finalizeSceneUbo()),this._scene._cachedVisibility=e?e.visibility:1,this._onBindObservable&&e&&this._onBindObservable.notifyObservers(e),this.disableDepthWrite){const e=this._scene.getEngine();this._cachedDepthWriteState=e.getDepthWrite(),e.setDepthWrite(!1)}if(this.disableColorWrite){const e=this._scene.getEngine();this._cachedColorWriteState=e.getColorWrite(),e.setColorWrite(!1)}if(0!==this.depthFunction){const e=this._scene.getEngine();this._cachedDepthFunctionState=e.getDepthFunction()||0,e.setDepthFunction(this.depthFunction)}}unbind(){this._onUnBindObservable&&this._onUnBindObservable.notifyObservers(this),0!==this.depthFunction&&this._scene.getEngine().setDepthFunction(this._cachedDepthFunctionState),this.disableDepthWrite&&this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState),this.disableColorWrite&&this._scene.getEngine().setColorWrite(this._cachedColorWriteState)}getAnimatables(){return this._eventInfo.animatables=[],this._callbackPluginEventGeneric(f.S.GetAnimatables,this._eventInfo),this._eventInfo.animatables}getActiveTextures(){return this._eventInfo.activeTextures=[],this._callbackPluginEventGeneric(f.S.GetActiveTextures,this._eventInfo),this._eventInfo.activeTextures}hasTexture(e){return this._eventInfo.hasTexture=!1,this._eventInfo.texture=e,this._callbackPluginEventGeneric(f.S.HasTexture,this._eventInfo),this._eventInfo.hasTexture}clone(e){return null}getBindedMeshes(){if(this.meshMap){const e=new Array;for(const t in this.meshMap){const i=this.meshMap[t];i&&e.push(i)}return e}return this._scene.meshes.filter((e=>e.material===this))}forceCompilation(e,t,i,n){const r={clipPlane:!1,useInstances:!1,...i},s=this.getScene(),o=this.allowShaderHotSwapping;this.allowShaderHotSwapping=!1;const a=()=>{if(!this._scene||!this._scene.getEngine())return;const i=s.clipPlane;if(r.clipPlane&&(s.clipPlane=new _.J(0,0,0,1)),this._storeEffectOnSubMeshes){let i=!0,s=null;if(e.subMeshes){const t=new l.P(0,0,0,0,0,e,void 0,!1,!1);t.materialDefines&&(t.materialDefines._renderId=-1),this.isReadyForSubMesh(e,t,r.useInstances)||(t.effect&&t.effect.getCompilationError()&&t.effect.allFallbacksProcessed()?s=t.effect.getCompilationError():(i=!1,setTimeout(a,16)))}i&&(this.allowShaderHotSwapping=o,s&&n&&n(s),t&&t(this))}else this.isReady()?(this.allowShaderHotSwapping=o,t&&t(this)):setTimeout(a,16);r.clipPlane&&(s.clipPlane=i)};a()}forceCompilationAsync(e,t){return new Promise(((i,n)=>{this.forceCompilation(e,(()=>{i()}),t,(e=>{n(e)}))}))}markAsDirty(e){this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism||(m._DirtyCallbackArray.length=0,e&m.TextureDirtyFlag&&m._DirtyCallbackArray.push(m._TextureDirtyCallBack),e&m.LightDirtyFlag&&m._DirtyCallbackArray.push(m._LightsDirtyCallBack),e&m.FresnelDirtyFlag&&m._DirtyCallbackArray.push(m._FresnelDirtyCallBack),e&m.AttributesDirtyFlag&&m._DirtyCallbackArray.push(m._AttributeDirtyCallBack),e&m.MiscDirtyFlag&&m._DirtyCallbackArray.push(m._MiscDirtyCallBack),e&m.PrePassDirtyFlag&&m._DirtyCallbackArray.push(m._PrePassDirtyCallBack),m._DirtyCallbackArray.length&&this._markAllSubMeshesAsDirty(m._RunDirtyCallBacks),this.getScene().resetCachedMaterial())}resetDrawCache(){const e=this.getScene().meshes;for(const t of e)if(t.subMeshes)for(const e of t.subMeshes)e.getMaterial()===this&&e.resetDrawCache()}_markAllSubMeshesAsDirty(e){if(this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism)return;const t=this.getScene().meshes;for(const i of t)if(i.subMeshes)for(const t of i.subMeshes)if(t.getMaterial(!1)===this)for(const i of t._drawWrappers)i&&i.defines&&i.defines.markAllAsDirty&&this._materialContext===i.materialContext&&e(i.defines)}_markScenePrePassDirty(){if(this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism)return;const e=this.getScene().enablePrePassRenderer();e&&e.markAsDirty()}_markAllSubMeshesAsAllDirty(){this._markAllSubMeshesAsDirty(m._AllDirtyCallBack)}_markAllSubMeshesAsImageProcessingDirty(){this._markAllSubMeshesAsDirty(m._ImageProcessingDirtyCallBack)}_markAllSubMeshesAsTexturesDirty(){this._markAllSubMeshesAsDirty(m._TextureDirtyCallBack)}_markAllSubMeshesAsFresnelDirty(){this._markAllSubMeshesAsDirty(m._FresnelDirtyCallBack)}_markAllSubMeshesAsFresnelAndMiscDirty(){this._markAllSubMeshesAsDirty(m._FresnelAndMiscDirtyCallBack)}_markAllSubMeshesAsLightsDirty(){this._markAllSubMeshesAsDirty(m._LightsDirtyCallBack)}_markAllSubMeshesAsAttributesDirty(){this._markAllSubMeshesAsDirty(m._AttributeDirtyCallBack)}_markAllSubMeshesAsMiscDirty(){this._markAllSubMeshesAsDirty(m._MiscDirtyCallBack)}_markAllSubMeshesAsPrePassDirty(){this._markAllSubMeshesAsDirty(m._MiscDirtyCallBack)}_markAllSubMeshesAsTexturesAndMiscDirty(){this._markAllSubMeshesAsDirty(m._TextureAndMiscDirtyCallBack)}setPrePassRenderer(e){return!1}dispose(e,t,i){const n=this.getScene();if(n.stopAnimation(this),n.freeProcessedMaterials(),n.removeMaterial(this),this._eventInfo.forceDisposeTextures=t,this._callbackPluginEventGeneric(f.S.Disposed,this._eventInfo),this._parentContainer){const e=this._parentContainer.materials.indexOf(this);e>-1&&this._parentContainer.materials.splice(e,1),this._parentContainer=null}if(!0!==i)if(this.meshMap)for(const t in this.meshMap){const i=this.meshMap[t];i&&(i.material=null,this.releaseVertexArrayObject(i,e))}else{const t=n.meshes;for(const i of t)i.material!==this||i.sourceMesh||(i.material=null,this.releaseVertexArrayObject(i,e))}this._uniformBuffer.dispose(),e&&this._drawWrapper.effect&&(this._storeEffectOnSubMeshes||this._drawWrapper.effect.dispose(),this._drawWrapper.effect=null),this.metadata=null,this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._onBindObservable&&this._onBindObservable.clear(),this._onUnBindObservable&&this._onUnBindObservable.clear(),this._onEffectCreatedObservable&&this._onEffectCreatedObservable.clear()}releaseVertexArrayObject(e,t){if(e.geometry){const i=e.geometry;if(this._storeEffectOnSubMeshes)for(const n of e.subMeshes)i._releaseVertexArrayObject(n.effect),t&&n.effect&&n.effect.dispose();else i._releaseVertexArrayObject(this._drawWrapper.effect)}}serialize(){const e=r.p4.Serialize(this);return e.stencil=this.stencil.serialize(),e.uniqueId=this.uniqueId,e}static Parse(e,t,i){if(e.customType){if("BABYLON.PBRMaterial"===e.customType&&e.overloadedAlbedo&&(e.customType="BABYLON.LegacyPBRMaterial",!BABYLON.LegacyPBRMaterial))return h.Y.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library."),null}else e.customType="BABYLON.StandardMaterial";const n=s.w1.Instantiate(e.customType).Parse(e,t,i);return n._loadedUniqueId=e.uniqueId,n}}m.TriangleFillMode=0,m.WireFrameFillMode=1,m.PointFillMode=2,m.PointListDrawMode=3,m.LineListDrawMode=4,m.LineLoopDrawMode=5,m.LineStripDrawMode=6,m.TriangleStripDrawMode=7,m.TriangleFanDrawMode=8,m.ClockWiseSideOrientation=0,m.CounterClockWiseSideOrientation=1,m.TextureDirtyFlag=1,m.LightDirtyFlag=2,m.FresnelDirtyFlag=4,m.AttributesDirtyFlag=8,m.MiscDirtyFlag=16,m.PrePassDirtyFlag=32,m.AllDirtyFlag=63,m.MATERIAL_OPAQUE=0,m.MATERIAL_ALPHATEST=1,m.MATERIAL_ALPHABLEND=2,m.MATERIAL_ALPHATESTANDBLEND=3,m.MATERIAL_NORMALBLENDMETHOD_WHITEOUT=0,m.MATERIAL_NORMALBLENDMETHOD_RNM=1,m.OnEventObservable=new o.y$,m._AllDirtyCallBack=e=>e.markAllAsDirty(),m._ImageProcessingDirtyCallBack=e=>e.markAsImageProcessingDirty(),m._TextureDirtyCallBack=e=>e.markAsTexturesDirty(),m._FresnelDirtyCallBack=e=>e.markAsFresnelDirty(),m._MiscDirtyCallBack=e=>e.markAsMiscDirty(),m._PrePassDirtyCallBack=e=>e.markAsPrePassDirty(),m._LightsDirtyCallBack=e=>e.markAsLightDirty(),m._AttributeDirtyCallBack=e=>e.markAsAttributesDirty(),m._FresnelAndMiscDirtyCallBack=e=>{m._FresnelDirtyCallBack(e),m._MiscDirtyCallBack(e)},m._TextureAndMiscDirtyCallBack=e=>{m._TextureDirtyCallBack(e),m._MiscDirtyCallBack(e)},m._DirtyCallbackArray=[],m._RunDirtyCallBacks=e=>{for(const t of m._DirtyCallbackArray)t(e)},(0,n.gn)([(0,r.qC)()],m.prototype,"id",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"uniqueId",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"name",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"metadata",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"checkReadyOnEveryCall",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"checkReadyOnlyOnce",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"state",void 0),(0,n.gn)([(0,r.qC)("alpha")],m.prototype,"_alpha",void 0),(0,n.gn)([(0,r.qC)("backFaceCulling")],m.prototype,"_backFaceCulling",void 0),(0,n.gn)([(0,r.qC)("cullBackFaces")],m.prototype,"_cullBackFaces",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"sideOrientation",void 0),(0,n.gn)([(0,r.qC)("alphaMode")],m.prototype,"_alphaMode",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"_needDepthPrePass",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"disableDepthWrite",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"disableColorWrite",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"forceDepthWrite",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"depthFunction",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"separateCullingPass",void 0),(0,n.gn)([(0,r.qC)("fogEnabled")],m.prototype,"_fogEnabled",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"pointSize",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"zOffset",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"zOffsetUnits",void 0),(0,n.gn)([(0,r.qC)()],m.prototype,"pointsCloud",null),(0,n.gn)([(0,r.qC)()],m.prototype,"fillMode",null),(0,n.gn)([(0,r.qC)()],m.prototype,"transparencyMode",null)},"../../../node_modules/@babylonjs/core/Materials/materialDefines.js":function(e,t,i){"use strict";i.d(t,{H:function(){return n}});class n{constructor(e){if(this._keys=[],this._isDirty=!0,this._areLightsDirty=!0,this._areLightsDisposed=!1,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1,this._externalProperties=e,e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this._setDefaultValue(t)}get isDirty(){return this._isDirty}markAsProcessed(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areLightsDisposed=!1,this._areMiscDirty=!1,this._arePrePassDirty=!1,this._areImageProcessingDirty=!1}markAsUnprocessed(){this._isDirty=!0}markAllAsDirty(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._isDirty=!0}markAsImageProcessingDirty(){this._areImageProcessingDirty=!0,this._isDirty=!0}markAsLightDirty(e=!1){this._areLightsDirty=!0,this._areLightsDisposed=this._areLightsDisposed||e,this._isDirty=!0}markAsAttributesDirty(){this._areAttributesDirty=!0,this._isDirty=!0}markAsTexturesDirty(){this._areTexturesDirty=!0,this._isDirty=!0}markAsFresnelDirty(){this._areFresnelDirty=!0,this._isDirty=!0}markAsMiscDirty(){this._areMiscDirty=!0,this._isDirty=!0}markAsPrePassDirty(){this._arePrePassDirty=!0,this._isDirty=!0}rebuild(){this._keys.length=0;for(const e of Object.keys(this))"_"!==e[0]&&this._keys.push(e);if(this._externalProperties)for(const e in this._externalProperties)-1===this._keys.indexOf(e)&&this._keys.push(e)}isEqual(e){if(this._keys.length!==e._keys.length)return!1;for(let t=0;tthis._setDefaultValue(e)))}_setDefaultValue(e){var t,i,n,r,s;const o=null!==(n=null===(i=null===(t=this._externalProperties)||void 0===t?void 0:t[e])||void 0===i?void 0:i.type)&&void 0!==n?n:typeof this[e],a=null===(s=null===(r=this._externalProperties)||void 0===r?void 0:r[e])||void 0===s?void 0:s.default;switch(o){case"number":this[e]=null!=a?a:0;break;case"string":this[e]=null!=a?a:"";break;default:this[e]=null!=a&&a}}toString(){let e="";for(let t=0;t0,t.NUM_MORPH_INFLUENCERS=i.numInfluencers,t.MORPHTARGETS_TEXTURE=i.isUsingTextureForTargets):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)}static PrepareDefinesForBakedVertexAnimation(e,t){const i=e.bakedVertexAnimationManager;t.BAKED_VERTEX_ANIMATION_TEXTURE=!(!i||!i.isEnabled)}static PrepareDefinesForAttributes(e,t,i,n,r=!1,s=!0,o=!0){if(!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(a.o.NormalKind),t._needNormals&&e.isVerticesDataPresent(a.o.TangentKind)&&(t.TANGENT=!0);for(let i=1;i<=6;++i)t["UV"+i]=!!t._needUVs&&e.isVerticesDataPresent(`uv${1===i?"":i}`);if(i){const i=e.useVertexColors&&e.isVerticesDataPresent(a.o.ColorKind);t.VERTEXCOLOR=i,t.VERTEXALPHA=e.hasVertexAlpha&&i&&s}return e.isVerticesDataPresent(a.o.ColorInstanceKind)&&(e.hasInstances||e.hasThinInstances)&&(t.INSTANCESCOLOR=!0),n&&this.PrepareDefinesForBones(e,t),r&&this.PrepareDefinesForMorphTargets(e,t),o&&this.PrepareDefinesForBakedVertexAnimation(e,t),!0}static PrepareDefinesForMultiview(e,t){if(e.activeCamera){const i=t.MULTIVIEW;t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&e.activeCamera.outputRenderTarget.getViewCount()>1,t.MULTIVIEW!=i&&t.markAsUnprocessed()}}static PrepareDefinesForOIT(e,t,i){const n=t.ORDER_INDEPENDENT_TRANSPARENCY,r=t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS;t.ORDER_INDEPENDENT_TRANSPARENCY=e.useOrderIndependentTransparency&&i,t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!e.getEngine().getCaps().textureFloatLinearFiltering,n===t.ORDER_INDEPENDENT_TRANSPARENCY&&r===t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS||t.markAsUnprocessed()}static PrepareDefinesForPrePass(e,t,i){const n=t.PREPASS;if(!t._arePrePassDirty)return;const r=[{type:1,define:"PREPASS_POSITION",index:"PREPASS_POSITION_INDEX"},{type:2,define:"PREPASS_VELOCITY",index:"PREPASS_VELOCITY_INDEX"},{type:3,define:"PREPASS_REFLECTIVITY",index:"PREPASS_REFLECTIVITY_INDEX"},{type:0,define:"PREPASS_IRRADIANCE",index:"PREPASS_IRRADIANCE_INDEX"},{type:7,define:"PREPASS_ALBEDO_SQRT",index:"PREPASS_ALBEDO_SQRT_INDEX"},{type:5,define:"PREPASS_DEPTH",index:"PREPASS_DEPTH_INDEX"},{type:6,define:"PREPASS_NORMAL",index:"PREPASS_NORMAL_INDEX"}];if(e.prePassRenderer&&e.prePassRenderer.enabled&&i){t.PREPASS=!0,t.SCENE_MRT_COUNT=e.prePassRenderer.mrtCount;for(let i=0;i0&&(o.shadowEnabled=!0,e.prepareDefines(r,n))}}i.lightmapMode!=l.m.LIGHTMAP_DEFAULT?(o.lightmapMode=!0,r["LIGHTMAPEXCLUDED"+n]=!0,r["LIGHTMAPNOSPECULAR"+n]=i.lightmapMode==l.m.LIGHTMAP_SHADOWSONLY):(r["LIGHTMAPEXCLUDED"+n]=!1,r["LIGHTMAPNOSPECULAR"+n]=!1)}static PrepareDefinesForLights(e,t,i,n,r=4,s=!1){if(!i._areLightsDirty)return i._needNormals;let o=0;const a={needNormals:i._needNormals,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!s)for(const s of t.lightSources)if(this.PrepareDefinesForLight(e,t,s,o,i,n,a),o++,o===r)break;i.SPECULARTERM=a.specularEnabled,i.SHADOWS=a.shadowEnabled;for(let e=o;e0&&(r=n+s,t.addFallback(r,"LIGHT"+s)),e.SHADOWS||(e["SHADOW"+s]&&t.addFallback(n,"SHADOW"+s),e["SHADOWPCF"+s]&&t.addFallback(n,"SHADOWPCF"+s),e["SHADOWPCSS"+s]&&t.addFallback(n,"SHADOWPCSS"+s),e["SHADOWPOISSON"+s]&&t.addFallback(n,"SHADOWPOISSON"+s),e["SHADOWESM"+s]&&t.addFallback(n,"SHADOWESM"+s),e["SHADOWCLOSEESM"+s]&&t.addFallback(n,"SHADOWCLOSEESM"+s));return r++}static PrepareAttributesForMorphTargetsInfluencers(e,t,i){this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS=i,this.PrepareAttributesForMorphTargets(e,t,this._TmpMorphInfluencers)}static PrepareAttributesForMorphTargets(e,t,i){const r=i.NUM_MORPH_INFLUENCERS;if(r>0&&o.l.LastCreatedEngine){const s=o.l.LastCreatedEngine.getCaps().maxVertexAttribs,l=t.morphTargetManager;if(null==l?void 0:l.isUsingTextureForTargets)return;const c=l&&l.supportsNormals&&i.NORMAL,h=l&&l.supportsTangents&&i.TANGENT,_=l&&l.supportsUVs&&i.UV1;for(let i=0;is&&n.Y.Error("Cannot add more vertex attributes for mesh "+t.name)}}static PrepareAttributesForBakedVertexAnimation(e,t,i){i.BAKED_VERTEX_ANIMATION_TEXTURE&&i.INSTANCES&&e.push("bakedVertexAnimationSettingsInstanced")}static PrepareAttributesForBones(e,t,i,n){i.NUM_BONE_INFLUENCERS>0&&(n.addCPUSkinningFallback(0,t),e.push(a.o.MatricesIndicesKind),e.push(a.o.MatricesWeightsKind),i.NUM_BONE_INFLUENCERS>4&&(e.push(a.o.MatricesIndicesExtraKind),e.push(a.o.MatricesWeightsExtraKind)))}static PrepareAttributesForInstances(e,t){(t.INSTANCES||t.THIN_INSTANCES)&&this.PushAttributesForInstances(e,!!t.PREPASS_VELOCITY),t.INSTANCESCOLOR&&e.push(a.o.ColorInstanceKind)}static PushAttributesForInstances(e,t=!1){e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3"),t&&(e.push("previousWorld0"),e.push("previousWorld1"),e.push("previousWorld2"),e.push("previousWorld3"))}static BindLightProperties(e,t,i){e.transferToEffect(t,i+"")}static BindLight(e,t,i,n,r,s=!0){e._bindLight(t,i,n,r,s)}static BindLights(e,t,i,n,r=4){const s=Math.min(t.lightSources.length,r);for(let r=0;r-1){const i=n.getTransformMatrixTexture(e);t.setTexture("boneSampler",i),t.setFloat("boneTextureWidth",4*(n.bones.length+1))}else{const r=n.getTransformMatrices(e);r&&(t.setMatrices("mBones",r),i&&e.getScene().prePassRenderer&&e.getScene().prePassRenderer.getIndex(2)&&(i.previousBones[e.uniqueId]||(i.previousBones[e.uniqueId]=r.slice()),t.setMatrices("mPreviousBones",i.previousBones[e.uniqueId]),_._CopyBonesTransformationMatrices(r,i.previousBones[e.uniqueId])))}}}static _CopyBonesTransformationMatrices(e,t){return t.set(e),t}static BindMorphTargetParameters(e,t){const i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)}static BindLogDepth(e,t,i){if(!e||e.LOGARITHMICDEPTH||e.indexOf&&e.indexOf("LOGARITHMICDEPTH")>=0){const e=i.activeCamera;e.mode===r.V.ORTHOGRAPHIC_CAMERA&&n.Y.Error("Logarithmic depth is not compatible with orthographic cameras!",20),t.setFloat("logarithmicDepthConstant",2/(Math.log(e.maxZ+1)/Math.LN2))}}static BindClipPlane(e,t){h.O.BindClipPlane(e,t)}}_._TmpMorphInfluencers={NUM_MORPH_INFLUENCERS:0},_._TempFogColor=c.Wo.Black()},"../../../node_modules/@babylonjs/core/Materials/materialPluginBase.js":function(e,t,i){"use strict";i.d(t,{n:function(){return o}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Materials/materialPluginManager.js");class o{constructor(e,t,i,n,r=!0,o=!1){this.priority=500,this.registerForExtraEvents=!1,this._material=e,this.name=t,this.priority=i,e.pluginManager||(e.pluginManager=new s.BK(e)),this._pluginDefineNames=n,this._pluginManager=e.pluginManager,r&&this._pluginManager._addPlugin(this),o&&this._enable(!0),this.markAllDefinesAsDirty=e._dirtyCallbacks[63]}_enable(e){e&&this._pluginManager._activatePlugin(this)}getClassName(){return"MaterialPluginBase"}isReadyForSubMesh(e,t,i,n){return!0}hardBindForSubMesh(e,t,i,n){}bindForSubMesh(e,t,i,n){}dispose(e){}getCustomCode(e){return null}collectDefines(e){if(this._pluginDefineNames)for(const t of Object.keys(this._pluginDefineNames)){if("_"===t[0])continue;const i=typeof this._pluginDefineNames[t];e[t]={type:"number"===i?"number":"string"===i?"string":"boolean"===i?"boolean":"object",default:this._pluginDefineNames[t]}}}prepareDefinesBeforeAttributes(e,t,i){}prepareDefines(e,t,i){}hasTexture(e){return!1}hasRenderTargetTextures(){return!1}fillRenderTargetTextures(e){}getActiveTextures(e){}getAnimatables(e){}addFallbacks(e,t,i){return i}getSamplers(e){}getAttributes(e,t,i){}getUniformBuffersNames(e){}getUniforms(){return{}}copyTo(e){r.p4.Clone((()=>e),this)}serialize(){return r.p4.Serialize(this)}parse(e,t,i){r.p4.Parse((()=>this),e,t,i)}}(0,n.gn)([(0,r.qC)()],o.prototype,"name",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"priority",void 0),(0,n.gn)([(0,r.qC)()],o.prototype,"registerForExtraEvents",void 0)},"../../../node_modules/@babylonjs/core/Materials/materialPluginEvent.js":function(e,t,i){"use strict";var n;i.d(t,{S:function(){return n}}),function(e){e[e.Created=1]="Created",e[e.Disposed=2]="Disposed",e[e.GetDefineNames=4]="GetDefineNames",e[e.PrepareUniformBuffer=8]="PrepareUniformBuffer",e[e.IsReadyForSubMesh=16]="IsReadyForSubMesh",e[e.PrepareDefines=32]="PrepareDefines",e[e.BindForSubMesh=64]="BindForSubMesh",e[e.PrepareEffect=128]="PrepareEffect",e[e.GetAnimatables=256]="GetAnimatables",e[e.GetActiveTextures=512]="GetActiveTextures",e[e.HasTexture=1024]="HasTexture",e[e.FillRenderTargetTextures=2048]="FillRenderTargetTextures",e[e.HasRenderTargetTextures=4096]="HasRenderTargetTextures",e[e.HardBindForSubMesh=8192]="HardBindForSubMesh"}(n||(n={}))},"../../../node_modules/@babylonjs/core/Materials/materialPluginManager.js":function(e,t,i){"use strict";i.d(t,{BK:function(){return r}}),i("../../../node_modules/@babylonjs/core/Materials/material.js");var n=i("../../../node_modules/@babylonjs/core/Materials/materialPluginEvent.js");class r{constructor(e){this._plugins=[],this._activePlugins=[],this._activePluginsForExtraEvents=[],this._material=e,this._scene=e.getScene(),this._engine=this._scene.getEngine()}_addPlugin(e){for(let t=0;te.priority-t.priority)),this._codeInjectionPoints={};const i={};i[r._MaterialPluginClassToMainDefine[t]]={type:"boolean",default:!0};for(const e of this._plugins)e.collectDefines(i),this._collectPointNames("vertex",e.getCustomCode("vertex")),this._collectPointNames("fragment",e.getCustomCode("fragment"));this._defineNamesFromPlugins=i}_activatePlugin(e){-1===this._activePlugins.indexOf(e)&&(this._activePlugins.push(e),this._activePlugins.sort(((e,t)=>e.priority-t.priority)),this._material._callbackPluginEventIsReadyForSubMesh=this._handlePluginEventIsReadyForSubMesh.bind(this),this._material._callbackPluginEventPrepareDefinesBeforeAttributes=this._handlePluginEventPrepareDefinesBeforeAttributes.bind(this),this._material._callbackPluginEventPrepareDefines=this._handlePluginEventPrepareDefines.bind(this),this._material._callbackPluginEventBindForSubMesh=this._handlePluginEventBindForSubMesh.bind(this),e.registerForExtraEvents&&(this._activePluginsForExtraEvents.push(e),this._activePluginsForExtraEvents.sort(((e,t)=>e.priority-t.priority)),this._material._callbackPluginEventHasRenderTargetTextures=this._handlePluginEventHasRenderTargetTextures.bind(this),this._material._callbackPluginEventFillRenderTargetTextures=this._handlePluginEventFillRenderTargetTextures.bind(this),this._material._callbackPluginEventHardBindForSubMesh=this._handlePluginEventHardBindForSubMesh.bind(this)))}getPlugin(e){for(let t=0;t0&&e.uniforms.push(...this._uniformList),this._samplerList.length>0&&e.samplers.push(...this._samplerList),this._uboList.length>0&&e.uniformBuffersNames.push(...this._uboList),e.customCode=this._injectCustomCode(e.customCode);break}case n.S.PrepareUniformBuffer:{const e=t;this._uboDeclaration="",this._vertexDeclaration="",this._fragmentDeclaration="",this._uniformList=[],this._samplerList=[],this._uboList=[];for(const t of this._plugins){const i=t.getUniforms();if(i){if(i.ubo)for(const t of i.ubo)e.ubo.addUniform(t.name,t.size),this._uboDeclaration+=`${t.type} ${t.name};\r\n`,this._uniformList.push(t.name);i.vertex&&(this._vertexDeclaration+=i.vertex+"\r\n"),i.fragment&&(this._fragmentDeclaration+=i.fragment+"\r\n")}t.getSamplers(this._samplerList),t.getUniformBuffersNames(this._uboList)}break}}}_collectPointNames(e,t){if(t)for(const i in t)this._codeInjectionPoints[e]||(this._codeInjectionPoints[e]={}),this._codeInjectionPoints[e][i]=!0}_injectCustomCode(e){return(t,i)=>{var n;e&&(i=e(t,i)),this._uboDeclaration&&(i=i.replace("#define ADDITIONAL_UBO_DECLARATION",this._uboDeclaration)),this._vertexDeclaration&&(i=i.replace("#define ADDITIONAL_VERTEX_DECLARATION",this._vertexDeclaration)),this._fragmentDeclaration&&(i=i.replace("#define ADDITIONAL_FRAGMENT_DECLARATION",this._fragmentDeclaration));const r=null===(n=this._codeInjectionPoints)||void 0===n?void 0:n[t];if(!r)return i;for(const e in r){let n="";for(const i of this._activePlugins){const r=i.getCustomCode(t);(null==r?void 0:r[e])&&(n+=r[e]+"\r\n")}if(n.length>0)if("!"===e.charAt(0)){const t=new RegExp(e.substring(1),"g");let r=t.exec(i);for(;null!==r;){let e=n;for(let t=0;t{const n=t.apply(e,i);return this._markAllSubMeshesAsTexturesDirty(),n};const i=e.splice;e.splice=(t,n)=>{const r=i.apply(e,[t,n]);return this._markAllSubMeshesAsTexturesDirty(),r}}getSubMaterial(e){return e<0||e>=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]}getActiveTextures(){return super.getActiveTextures().concat(...this.subMaterials.map((e=>e?e.getActiveTextures():[])))}hasTexture(e){var t;if(super.hasTexture(e))return!0;for(let i=0;i=0&&n.multiMaterials.splice(r,1),super.dispose(e,t)}static ParseMultiMaterial(e,t){const i=new o(e.name,t);return i.id=e.id,i._loadedUniqueId=e.uniqueId,r.$&&r.$.AddTagsTo(i,e.tags),e.materialsUniqueIds?i._waitingSubMaterialsUniqueIds=e.materialsUniqueIds:e.materials.forEach((e=>i.subMaterials.push(t.getLastMaterialById(e)))),i}}(0,s.H)("BABYLON.MultiMaterial",o)},"../../../node_modules/@babylonjs/core/Materials/prePassConfiguration.js":function(e,t,i){"use strict";i.d(t,{o:function(){return n}});class n{constructor(){this.previousWorldMatrices={},this.previousBones={}}static AddUniforms(e){e.push("previousWorld","previousViewProjection","mPreviousBones")}static AddSamplers(e){}bindForSubMesh(e,t,i,n,r){if(t.prePassRenderer&&t.prePassRenderer.enabled&&t.prePassRenderer.currentRTisSceneRT&&-1!==t.prePassRenderer.getIndex(2)){this.previousWorldMatrices[i.uniqueId]||(this.previousWorldMatrices[i.uniqueId]=n.clone()),this.previousViewProjection||(this.previousViewProjection=t.getTransformMatrix().clone(),this.currentViewProjection=t.getTransformMatrix().clone());const r=t.getEngine();this.currentViewProjection.updateFlag!==t.getTransformMatrix().updateFlag?(this._lastUpdateFrameId=r.frameId,this.previousViewProjection.copyFrom(this.currentViewProjection),this.currentViewProjection.copyFrom(t.getTransformMatrix())):this._lastUpdateFrameId!==r.frameId&&(this._lastUpdateFrameId=r.frameId,this.previousViewProjection.copyFrom(this.currentViewProjection)),e.setMatrix("previousWorld",this.previousWorldMatrices[i.uniqueId]),e.setMatrix("previousViewProjection",this.previousViewProjection),this.previousWorldMatrices[i.uniqueId]=n.clone()}}}},"../../../node_modules/@babylonjs/core/Materials/pushMaterial.js":function(e,t,i){"use strict";i.d(t,{a:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Materials/material.js");class s extends r.F{constructor(e,t,i=!0){super(e,t),this._normalMatrix=new n.y3,this._storeEffectOnSubMeshes=i}getEffect(){return this._storeEffectOnSubMeshes?this._activeEffect:super.getEffect()}isReady(e,t){return!!e&&(!this._storeEffectOnSubMeshes||!e.subMeshes||0===e.subMeshes.length||this.isReadyForSubMesh(e,e.subMeshes[0],t))}_isReadyForSubMesh(e){const t=e.materialDefines;return!(this.checkReadyOnEveryCall||!e.effect||!t||t._renderId!==this.getScene().getRenderId())}bindOnlyWorldMatrix(e){this._activeEffect.setMatrix("world",e)}bindOnlyNormalMatrix(e){this._activeEffect.setMatrix("normalMatrix",e)}bind(e,t){t&&this.bindForSubMesh(e,t,t.subMeshes[0])}_afterBind(e,t=null){super._afterBind(e,t),this.getScene()._cachedEffect=t}_mustRebind(e,t,i=1){return e.isCachedMaterialInvalid(this,t,i)}}},"../../../node_modules/@babylonjs/core/Materials/shaderLanguage.js":function(e,t,i){"use strict";var n;i.d(t,{x:function(){return n}}),function(e){e[e.GLSL=0]="GLSL",e[e.WGSL=1]="WGSL"}(n||(n={}))},"../../../node_modules/@babylonjs/core/Materials/shaderMaterial.js":function(e,t,i){"use strict";i.d(t,{j:function(){return f}});var n=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),o=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),a=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),l=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),c=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),h=i("../../../node_modules/@babylonjs/core/Materials/effectFallbacks.js"),_=i("../../../node_modules/@babylonjs/core/Misc/webRequest.js"),d=i("../../../node_modules/@babylonjs/core/Materials/pushMaterial.js"),u=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js");const p={effect:null,subMesh:null};class f extends d.a{constructor(e,t,i,n={},s=!0){super(e,t,s),this._textures={},this._textureArrays={},this._externalTextures={},this._floats={},this._ints={},this._floatsArrays={},this._colors3={},this._colors3Arrays={},this._colors4={},this._colors4Arrays={},this._vectors2={},this._vectors3={},this._vectors4={},this._quaternions={},this._quaternionsArrays={},this._matrices={},this._matrixArrays={},this._matrices3x3={},this._matrices2x2={},this._vectors2Arrays={},this._vectors3Arrays={},this._vectors4Arrays={},this._uniformBuffers={},this._textureSamplers={},this._storageBuffers={},this._cachedWorldViewMatrix=new r.y3,this._cachedWorldViewProjectionMatrix=new r.y3,this._multiview=!1,this._shaderPath=i,this._options={needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],externalTextures:[],samplerObjects:[],storageBuffers:[],defines:[],useClipPlane:!1,...n}}get shaderPath(){return this._shaderPath}set shaderPath(e){this._shaderPath=e}get options(){return this._options}getClassName(){return"ShaderMaterial"}needAlphaBlending(){return this.alpha<1||this._options.needAlphaBlending}needAlphaTesting(){return this._options.needAlphaTesting}_checkUniform(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)}setTexture(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this}setTextureArray(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._checkUniform(e),this._textureArrays[e]=t,this}setExternalTexture(e,t){return-1===this._options.externalTextures.indexOf(e)&&this._options.externalTextures.push(e),this._externalTextures[e]=t,this}setFloat(e,t){return this._checkUniform(e),this._floats[e]=t,this}setInt(e,t){return this._checkUniform(e),this._ints[e]=t,this}setFloats(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this}setColor3(e,t){return this._checkUniform(e),this._colors3[e]=t,this}setColor3Array(e,t){return this._checkUniform(e),this._colors3Arrays[e]=t.reduce(((e,t)=>(t.toArray(e,e.length),e)),[]),this}setColor4(e,t){return this._checkUniform(e),this._colors4[e]=t,this}setColor4Array(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce(((e,t)=>(t.toArray(e,e.length),e)),[]),this}setVector2(e,t){return this._checkUniform(e),this._vectors2[e]=t,this}setVector3(e,t){return this._checkUniform(e),this._vectors3[e]=t,this}setVector4(e,t){return this._checkUniform(e),this._vectors4[e]=t,this}setQuaternion(e,t){return this._checkUniform(e),this._quaternions[e]=t,this}setQuaternionArray(e,t){return this._checkUniform(e),this._quaternionsArrays[e]=t.reduce(((e,t)=>(t.toArray(e,e.length),e)),[]),this}setMatrix(e,t){return this._checkUniform(e),this._matrices[e]=t,this}setMatrices(e,t){this._checkUniform(e);const i=new Float32Array(16*t.length);for(let e=0;e1&&(this._multiview=!0,u.push("#define MULTIVIEW"),-1!==this._options.uniforms.indexOf("viewProjection")&&-1===this._options.uniforms.indexOf("viewProjectionR")&&this._options.uniforms.push("viewProjectionR"));for(let e=0;e4&&(f.push(s.o.MatricesIndicesExtraKind),f.push(s.o.MatricesWeightsExtraKind));const t=e.skeleton;u.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),m.addCPUSkinningFallback(0,e),t.isUsingTextureForMatrices?(u.push("#define BONETEXTURE"),-1===this._options.uniforms.indexOf("boneTextureWidth")&&this._options.uniforms.push("boneTextureWidth"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(u.push("#define BonesPerMesh "+(t.bones.length+1)),-1===this._options.uniforms.indexOf("mBones")&&this._options.uniforms.push("mBones"))}else u.push("#define NUM_BONE_INFLUENCERS 0");let A=0;const C=e?e.morphTargetManager:null;if(C){const e=C.supportsUVs&&-1!==u.indexOf("#define UV1"),t=C.supportsTangents&&-1!==u.indexOf("#define TANGENT"),i=C.supportsNormals&&-1!==u.indexOf("#define NORMAL");A=C.numInfluencers,e&&u.push("#define MORPHTARGETS_UV"),t&&u.push("#define MORPHTARGETS_TANGENT"),i&&u.push("#define MORPHTARGETS_NORMAL"),A>0&&u.push("#define MORPHTARGETS"),C.isUsingTextureForTargets&&(u.push("#define MORPHTARGETS_TEXTURE"),-1===this._options.uniforms.indexOf("morphTargetTextureIndices")&&this._options.uniforms.push("morphTargetTextureIndices"),-1===this._options.samplers.indexOf("morphTargets")&&this._options.samplers.push("morphTargets")),u.push("#define NUM_MORPH_INFLUENCERS "+A);for(let n=0;n0&&(b=b.slice(),b.push("morphTargetInfluences"),b.push("morphTargetTextureInfo"),b.push("morphTargetTextureIndices"))}else u.push("#define NUM_MORPH_INFLUENCERS 0");if(e){const t=e.bakedVertexAnimationManager;t&&t.isEnabled&&(u.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),-1===this._options.uniforms.indexOf("bakedVertexAnimationSettings")&&this._options.uniforms.push("bakedVertexAnimationSettings"),-1===this._options.uniforms.indexOf("bakedVertexAnimationTextureSizeInverted")&&this._options.uniforms.push("bakedVertexAnimationTextureSizeInverted"),-1===this._options.uniforms.indexOf("bakedVertexAnimationTime")&&this._options.uniforms.push("bakedVertexAnimationTime"),-1===this._options.samplers.indexOf("bakedVertexAnimationTexture")&&this._options.samplers.push("bakedVertexAnimationTexture")),a.G.PrepareAttributesForBakedVertexAnimation(f,e,u)}for(const e in this._textures)if(!this._textures[e].isReady())return!1;e&&this._shouldTurnAlphaTestOn(e)&&u.push("#define ALPHATEST"),(null===this._options.useClipPlane&&_.clipPlane||this._options.useClipPlane)&&(u.push("#define CLIPPLANE"),-1===b.indexOf("vClipPlane")&&b.push("vClipPlane")),(null===this._options.useClipPlane&&_.clipPlane2||this._options.useClipPlane)&&(u.push("#define CLIPPLANE2"),-1===b.indexOf("vClipPlane2")&&b.push("vClipPlane2")),(null===this._options.useClipPlane&&_.clipPlane3||this._options.useClipPlane)&&(u.push("#define CLIPPLANE3"),-1===b.indexOf("vClipPlane3")&&b.push("vClipPlane3")),(null===this._options.useClipPlane&&_.clipPlane4||this._options.useClipPlane)&&(u.push("#define CLIPPLANE4"),-1===b.indexOf("vClipPlane4")&&b.push("vClipPlane4")),(null===this._options.useClipPlane&&_.clipPlane5||this._options.useClipPlane)&&(u.push("#define CLIPPLANE5"),-1===b.indexOf("vClipPlane5")&&b.push("vClipPlane5")),(null===this._options.useClipPlane&&_.clipPlane6||this._options.useClipPlane)&&(u.push("#define CLIPPLANE6"),-1===b.indexOf("vClipPlane6")&&b.push("vClipPlane6")),this.customShaderNameResolve&&(b=b.slice(),y=y.slice(),v=v.slice(),g=this.customShaderNameResolve(g,b,y,v,u,f));const S=c?i._getDrawWrapper():this._drawWrapper,x=null!==(n=null==S?void 0:S.effect)&&void 0!==n?n:null,T=null!==(r=null==S?void 0:S.defines)&&void 0!==r?r:null,E=u.join("\n");let R=x;return T!==E&&(R=d.createEffect(g,{attributes:f,uniformsNames:b,uniformBuffersNames:y,samplers:v,defines:E,fallbacks:m,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:A},shaderLanguage:this._options.shaderLanguage},d),c?i.setEffect(R,E,this._materialContext):S&&S.setEffect(R,E),this._onEffectCreatedObservable&&(p.effect=R,p.subMesh=null!==(o=null!=i?i:null==e?void 0:e.subMeshes[0])&&void 0!==o?o:null,this._onEffectCreatedObservable.notifyObservers(p))),R._wasPreviouslyUsingInstances=!!t,null!==(l=!(null==R?void 0:R.isReady()))&&void 0!==l&&!l&&(x!==R&&_.resetCachedMaterial(),R._wasPreviouslyReady=!0,!0)}bindOnlyWorldMatrix(e,t){const i=this.getScene(),n=null!=t?t:this.getEffect();n&&(-1!==this._options.uniforms.indexOf("world")&&n.setMatrix("world",e),-1!==this._options.uniforms.indexOf("worldView")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),n.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==this._options.uniforms.indexOf("worldViewProjection")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),n.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)))}bindForSubMesh(e,t,i){var n;this.bind(e,t,null===(n=i._drawWrapperOverride)||void 0===n?void 0:n.effect,i)}bind(e,t,i,n){var r;const s=n&&this._storeEffectOnSubMeshes,o=null!=i?i:s?n.effect:this.getEffect();if(!o)return;this._activeEffect=o,this.bindOnlyWorldMatrix(e,i);const l=this._options.uniformBuffers;let c=!1;if(o&&l&&l.length>0&&this.getScene().getEngine().supportsUniformBuffers)for(let i=0;i0&&a.G.BindMorphTargetParameters(t,o);const i=t.bakedVertexAnimationManager;i&&i.isEnabled&&(null===(r=t.bakedVertexAnimationManager)||void 0===r||r.bind(o,!!o._wasPreviouslyUsingInstances))}this._afterBind(t,o)}getActiveTextures(){const e=super.getActiveTextures();for(const t in this._textures)e.push(this._textures[t]);for(const t in this._textureArrays){const i=this._textureArrays[t];for(let t=0;tnew f(e,this.getScene(),this._shaderPath,this._options,this._storeEffectOnSubMeshes)),this);t.name=e,t.id=e,"object"==typeof t._shaderPath&&(t._shaderPath={...t._shaderPath}),this._options={...this._options},Object.keys(this._options).forEach((e=>{const t=this._options[e];Array.isArray(t)&&(this._options[e]=t.slice(0))})),this.stencil.copyTo(t.stencil);for(const e in this._textures)t.setTexture(e,this._textures[e]);for(const e in this._textureArrays)t.setTextureArray(e,this._textureArrays[e]);for(const e in this._externalTextures)t.setExternalTexture(e,this._externalTextures[e]);for(const e in this._ints)t.setInt(e,this._ints[e]);for(const e in this._floats)t.setFloat(e,this._floats[e]);for(const e in this._floatsArrays)t.setFloats(e,this._floatsArrays[e]);for(const e in this._colors3)t.setColor3(e,this._colors3[e]);for(const e in this._colors3Arrays)t._colors3Arrays[e]=this._colors3Arrays[e];for(const e in this._colors4)t.setColor4(e,this._colors4[e]);for(const e in this._colors4Arrays)t._colors4Arrays[e]=this._colors4Arrays[e];for(const e in this._vectors2)t.setVector2(e,this._vectors2[e]);for(const e in this._vectors3)t.setVector3(e,this._vectors3[e]);for(const e in this._vectors4)t.setVector4(e,this._vectors4[e]);for(const e in this._quaternions)t.setQuaternion(e,this._quaternions[e]);for(const e in this._quaternionsArrays)t._quaternionsArrays[e]=this._quaternionsArrays[e];for(const e in this._matrices)t.setMatrix(e,this._matrices[e]);for(const e in this._matrixArrays)t._matrixArrays[e]=this._matrixArrays[e].slice();for(const e in this._matrices3x3)t.setMatrix3x3(e,this._matrices3x3[e]);for(const e in this._matrices2x2)t.setMatrix2x2(e,this._matrices2x2[e]);for(const e in this._vectors2Arrays)t.setArray2(e,this._vectors2Arrays[e]);for(const e in this._vectors3Arrays)t.setArray3(e,this._vectors3Arrays[e]);for(const e in this._vectors4Arrays)t.setArray4(e,this._vectors4Arrays[e]);for(const e in this._uniformBuffers)t.setUniformBuffer(e,this._uniformBuffers[e]);for(const e in this._textureSamplers)t.setTextureSampler(e,this._textureSamplers[e]);for(const e in this._storageBuffers)t.setStorageBuffer(e,this._storageBuffers[e]);return t}dispose(e,t,i){if(t){let e;for(e in this._textures)this._textures[e].dispose();for(e in this._textureArrays){const t=this._textureArrays[e];for(let e=0;enew f(e.name,t,e.shaderPath,e.options,e.storeEffectOnSubMeshes)),e,t,i);let a;for(a in e.stencil&&s.stencil.parse(e.stencil,t,i),e.textures)s.setTexture(a,o.x.Parse(e.textures[a],t,i));for(a in e.textureArrays){const n=e.textureArrays[a],r=new Array;for(let e=0;e(i%3==0?e.push([t]):e[e.length-1].push(t),e)),[]).map((e=>c.Wo.FromArray(e)));s.setColor3Array(a,t)}for(a in e.colors4)s.setColor4(a,c.HE.FromArray(e.colors4[a]));for(a in e.colors4Arrays){const t=e.colors4Arrays[a].reduce(((e,t,i)=>(i%4==0?e.push([t]):e[e.length-1].push(t),e)),[]).map((e=>c.HE.FromArray(e)));s.setColor4Array(a,t)}for(a in e.vectors2)s.setVector2(a,r.FM.FromArray(e.vectors2[a]));for(a in e.vectors3)s.setVector3(a,r.P.FromArray(e.vectors3[a]));for(a in e.vectors4)s.setVector4(a,r.Lt.FromArray(e.vectors4[a]));for(a in e.quaternions)s.setQuaternion(a,r._f.FromArray(e.quaternions[a]));for(a in e.matrices)s.setMatrix(a,r.y3.FromArray(e.matrices[a]));for(a in e.matrixArray)s._matrixArrays[a]=new Float32Array(e.matrixArray[a]);for(a in e.matrices3x3)s.setMatrix3x3(a,e.matrices3x3[a]);for(a in e.matrices2x2)s.setMatrix2x2(a,e.matrices2x2[a]);for(a in e.vectors2Arrays)s.setArray2(a,e.vectors2Arrays[a]);for(a in e.vectors3Arrays)s.setArray3(a,e.vectors3Arrays[a]);for(a in e.vectors4Arrays)s.setArray4(a,e.vectors4Arrays[a]);for(a in e.quaternionsArrays)s.setArray4(a,e.quaternionsArrays[a]);return s}static ParseFromFileAsync(e,t,i,n=""){return new Promise(((r,s)=>{const o=new _.g;o.addEventListener("readystatechange",(()=>{if(4==o.readyState)if(200==o.status){const t=JSON.parse(o.responseText),s=this.Parse(t,i||u.l.LastCreatedScene,n);e&&(s.name=e),r(s)}else s("Unable to load the ShaderMaterial")})),o.open("GET",t),o.send()}))}static ParseFromSnippetAsync(e,t,i=""){return new Promise(((n,r)=>{const s=new _.g;s.addEventListener("readystatechange",(()=>{if(4==s.readyState)if(200==s.status){const r=JSON.parse(JSON.parse(s.responseText).jsonPayload),o=JSON.parse(r.shaderMaterial),a=this.Parse(o,t||u.l.LastCreatedScene,i);a.snippetId=e,n(a)}else r("Unable to load the snippet "+e)})),s.open("GET",this.SnippetUrl+"/"+e.replace(/#/g,"/")),s.send()}))}}f.SnippetUrl="https://snippet.babylonjs.com",f.CreateFromSnippetAsync=f.ParseFromSnippetAsync,(0,l.H)("BABYLON.ShaderMaterial",f)},"../../../node_modules/@babylonjs/core/Materials/standardMaterial.js":function(e,t,i){"use strict";i.d(t,{K:function(){return T}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),s=i("../../../node_modules/@babylonjs/core/Misc/smartArray.js"),o=i("../../../node_modules/@babylonjs/core/scene.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),l=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),c=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),h=i("../../../node_modules/@babylonjs/core/Materials/prePassConfiguration.js"),_=i("../../../node_modules/@babylonjs/core/Materials/imageProcessingConfiguration.js"),d=i("../../../node_modules/@babylonjs/core/Materials/material.js"),u=i("../../../node_modules/@babylonjs/core/Materials/materialPluginEvent.js"),p=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js"),f=i("../../../node_modules/@babylonjs/core/Materials/pushMaterial.js"),m=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),g=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),b=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),y=i("../../../node_modules/@babylonjs/core/Materials/materialFlags.js"),v=i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js");v.v.IncludesShadersStore.defaultFragmentDeclaration="uniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\nuniform vec3 vAmbientColor;\nuniform float visibility;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY \nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D)\nuniform vec3 vRefractionPosition;\nuniform vec3 vRefractionSize; \n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize; \n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#define ADDITIONAL_FRAGMENT_DECLARATION\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/sceneUboDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/meshUboDeclaration.js");v.v.IncludesShadersStore.defaultUboDeclaration="layout(std140,column_major) uniform;\nuniform Material\n{\nvec4 diffuseLeftColor;\nvec4 diffuseRightColor;\nvec4 opacityParts;\nvec4 reflectionLeftColor;\nvec4 reflectionRightColor;\nvec4 refractionLeftColor;\nvec4 refractionRightColor;\nvec4 emissiveLeftColor;\nvec4 emissiveRightColor;\nvec2 vDiffuseInfos;\nvec2 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vReflectionInfos;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix;\nvec2 vTangentSpaceParams;\nfloat pointSize;\nfloat alphaCutOff;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec3 vRefractionPosition;\nvec3 vRefractionSize;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nvec4 vDiffuseColor;\nvec3 vAmbientColor;\n#define ADDITIONAL_UBO_DECLARATION\n};\n#include\n#include\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/oitDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/mainUVVaryingDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fresnelFunction.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/reflectionFunction.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentMainFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragment.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragment.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragment.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/oitFragment.js");v.v.ShadersStore.defaultPixelShader="#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include[SCENE_MRT_COUNT]\n#include\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#define RECIPROCAL_PI2 0.15915494\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include[1..7]\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)\n#endif\n#include\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include[0..maxSimultaneousLights]\nvec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\n#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0) {\nrefractionColor=textureCube(refractionCubeSampler,refractionVector);\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nvReflectionUVW.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha\n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\nfloat writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;\ngl_FragData[0]=color; \n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_IRRADIANCE\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_NORMAL\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4((view*vec4(normalW,0.0)).rgb,writeGeometryInfo); \n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULARTERM)\n#if defined(SPECULAR)\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularMapColor)*writeGeometryInfo; \n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularColor,1.0)*writeGeometryInfo;\n#endif\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0)*writeGeometryInfo;\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=color;\n#endif\n#include\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {\nfrontColor.rgb+=color.rgb*color.a*alphaMultiplier;\nfrontColor.a=1.0-alphaMultiplier*(1.0-color.a);\n} else {\nbackColor+=color;\n}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";v.v.IncludesShadersStore.defaultVertexDeclaration="uniform mat4 viewProjection;\nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\nuniform mat4 detailMatrix;\n#endif\n#define ADDITIONAL_VERTEX_DECLARATION\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/uvAttributeDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxUboDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobal.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/uvVariableDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerVertexImplementation.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js");v.v.IncludesShadersStore.pointCloudVertex="#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js");v.v.ShadersStore.defaultVertexShader="#include<__decl__defaultVertex>\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#include[2..7]\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include[1..7]\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular)\n#endif\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\nvNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\nvPositionW=vec3(worldPos);\n#include\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#include[2..7]\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x)\n#endif\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";var A=i("../../../node_modules/@babylonjs/core/Materials/effectFallbacks.js"),C=i("../../../node_modules/@babylonjs/core/Materials/material.detailMapConfiguration.js");const S={effect:null,subMesh:null};class x extends p.H{constructor(e){super(e),this.MAINUV1=!1,this.MAINUV2=!1,this.MAINUV3=!1,this.MAINUV4=!1,this.MAINUV5=!1,this.MAINUV6=!1,this.DIFFUSE=!1,this.DIFFUSEDIRECTUV=0,this.BAKED_VERTEX_ANIMATION_TEXTURE=!1,this.AMBIENT=!1,this.AMBIENTDIRECTUV=0,this.OPACITY=!1,this.OPACITYDIRECTUV=0,this.OPACITYRGB=!1,this.REFLECTION=!1,this.EMISSIVE=!1,this.EMISSIVEDIRECTUV=0,this.SPECULAR=!1,this.SPECULARDIRECTUV=0,this.BUMP=!1,this.BUMPDIRECTUV=0,this.PARALLAX=!1,this.PARALLAXOCCLUSION=!1,this.SPECULAROVERALPHA=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.ALPHAFROMDIFFUSE=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.DIFFUSEFRESNEL=!1,this.OPACITYFRESNEL=!1,this.REFLECTIONFRESNEL=!1,this.REFRACTIONFRESNEL=!1,this.EMISSIVEFRESNEL=!1,this.FRESNEL=!1,this.NORMAL=!1,this.TANGENT=!1,this.UV1=!1,this.UV2=!1,this.UV3=!1,this.UV4=!1,this.UV5=!1,this.UV6=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.BONETEXTURE=!1,this.BONES_VELOCITY_ENABLED=!1,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.INSTANCESCOLOR=!1,this.GLOSSINESS=!1,this.ROUGHNESS=!1,this.EMISSIVEASILLUMINATION=!1,this.LINKEMISSIVEWITHDIFFUSE=!1,this.REFLECTIONFRESNELFROMSPECULAR=!1,this.LIGHTMAP=!1,this.LIGHTMAPDIRECTUV=0,this.OBJECTSPACE_NORMALMAP=!1,this.USELIGHTMAPASSHADOWMAP=!1,this.REFLECTIONMAP_3D=!1,this.REFLECTIONMAP_SPHERICAL=!1,this.REFLECTIONMAP_PLANAR=!1,this.REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,this.USE_LOCAL_REFRACTIONMAP_CUBIC=!1,this.REFLECTIONMAP_PROJECTION=!1,this.REFLECTIONMAP_SKYBOX=!1,this.REFLECTIONMAP_EXPLICIT=!1,this.REFLECTIONMAP_EQUIRECTANGULAR=!1,this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_OPPOSITEZ=!1,this.INVERTCUBICMAP=!1,this.LOGARITHMICDEPTH=!1,this.REFRACTION=!1,this.REFRACTIONMAP_3D=!1,this.REFLECTIONOVERALPHA=!1,this.TWOSIDEDLIGHTING=!1,this.SHADOWFLOAT=!1,this.MORPHTARGETS=!1,this.MORPHTARGETS_NORMAL=!1,this.MORPHTARGETS_TANGENT=!1,this.MORPHTARGETS_UV=!1,this.NUM_MORPH_INFLUENCERS=0,this.MORPHTARGETS_TEXTURE=!1,this.NONUNIFORMSCALING=!1,this.PREMULTIPLYALPHA=!1,this.ALPHATEST_AFTERALLALPHACOMPUTATIONS=!1,this.ALPHABLEND=!0,this.PREPASS=!1,this.PREPASS_IRRADIANCE=!1,this.PREPASS_IRRADIANCE_INDEX=-1,this.PREPASS_ALBEDO_SQRT=!1,this.PREPASS_ALBEDO_SQRT_INDEX=-1,this.PREPASS_DEPTH=!1,this.PREPASS_DEPTH_INDEX=-1,this.PREPASS_NORMAL=!1,this.PREPASS_NORMAL_INDEX=-1,this.PREPASS_POSITION=!1,this.PREPASS_POSITION_INDEX=-1,this.PREPASS_VELOCITY=!1,this.PREPASS_VELOCITY_INDEX=-1,this.PREPASS_REFLECTIVITY=!1,this.PREPASS_REFLECTIVITY_INDEX=-1,this.SCENE_MRT_COUNT=0,this.RGBDLIGHTMAP=!1,this.RGBDREFLECTION=!1,this.RGBDREFRACTION=!1,this.IMAGEPROCESSING=!1,this.VIGNETTE=!1,this.VIGNETTEBLENDMODEMULTIPLY=!1,this.VIGNETTEBLENDMODEOPAQUE=!1,this.TONEMAPPING=!1,this.TONEMAPPING_ACES=!1,this.CONTRAST=!1,this.COLORCURVES=!1,this.COLORGRADING=!1,this.COLORGRADING3D=!1,this.SAMPLER3DGREENDEPTH=!1,this.SAMPLER3DBGRMAP=!1,this.DITHER=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.MULTIVIEW=!1,this.ORDER_INDEPENDENT_TRANSPARENCY=!1,this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,this.IS_REFLECTION_LINEAR=!1,this.IS_REFRACTION_LINEAR=!1,this.EXPOSURE=!1,this.rebuild()}setReflectionMode(e){const t=["REFLECTIONMAP_CUBIC","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_PLANAR","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"];for(const i of t)this[i]=i===e}}class T extends f.a{constructor(e,t){super(e,t),this._diffuseTexture=null,this._ambientTexture=null,this._opacityTexture=null,this._reflectionTexture=null,this._emissiveTexture=null,this._specularTexture=null,this._bumpTexture=null,this._lightmapTexture=null,this._refractionTexture=null,this.ambientColor=new l.Wo(0,0,0),this.diffuseColor=new l.Wo(1,1,1),this.specularColor=new l.Wo(1,1,1),this.emissiveColor=new l.Wo(0,0,0),this.specularPower=64,this._useAlphaFromDiffuseTexture=!1,this._useEmissiveAsIllumination=!1,this._linkEmissiveWithDiffuse=!1,this._useSpecularOverAlpha=!1,this._useReflectionOverAlpha=!1,this._disableLighting=!1,this._useObjectSpaceNormalMap=!1,this._useParallax=!1,this._useParallaxOcclusion=!1,this.parallaxScaleBias=.05,this._roughness=0,this.indexOfRefraction=.98,this.invertRefractionY=!0,this.alphaCutOff=.4,this._useLightmapAsShadowmap=!1,this._useReflectionFresnelFromSpecular=!1,this._useGlossinessFromSpecularMapAlpha=!1,this._maxSimultaneousLights=4,this._invertNormalMapX=!1,this._invertNormalMapY=!1,this._twoSidedLighting=!1,this._renderTargets=new s.t(16),this._worldViewProjectionMatrix=a.y3.Zero(),this._globalAmbientColor=new l.Wo(0,0,0),this._cacheHasRenderTargetTextures=!1,this.detailMap=new C.p(this),this._attachImageProcessingConfiguration(null),this.prePassConfiguration=new h.o,this.getRenderTargetTextures=()=>(this._renderTargets.reset(),T.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._renderTargets.push(this._reflectionTexture),T.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&this._renderTargets.push(this._refractionTexture),this._eventInfo.renderTargets=this._renderTargets,this._callbackPluginEventFillRenderTargetTextures(this._eventInfo),this._renderTargets)}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}set imageProcessingConfiguration(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()}_attachImageProcessingConfiguration(e){e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((()=>{this._markAllSubMeshesAsImageProcessingDirty()}))))}get isPrePassCapable(){return!this.disableDepthWrite}get cameraColorCurvesEnabled(){return this.imageProcessingConfiguration.colorCurvesEnabled}set cameraColorCurvesEnabled(e){this.imageProcessingConfiguration.colorCurvesEnabled=e}get cameraColorGradingEnabled(){return this.imageProcessingConfiguration.colorGradingEnabled}set cameraColorGradingEnabled(e){this.imageProcessingConfiguration.colorGradingEnabled=e}get cameraToneMappingEnabled(){return this._imageProcessingConfiguration.toneMappingEnabled}set cameraToneMappingEnabled(e){this._imageProcessingConfiguration.toneMappingEnabled=e}get cameraExposure(){return this._imageProcessingConfiguration.exposure}set cameraExposure(e){this._imageProcessingConfiguration.exposure=e}get cameraContrast(){return this._imageProcessingConfiguration.contrast}set cameraContrast(e){this._imageProcessingConfiguration.contrast=e}get cameraColorGradingTexture(){return this._imageProcessingConfiguration.colorGradingTexture}set cameraColorGradingTexture(e){this._imageProcessingConfiguration.colorGradingTexture=e}get cameraColorCurves(){return this._imageProcessingConfiguration.colorCurves}set cameraColorCurves(e){this._imageProcessingConfiguration.colorCurves=e}get canRenderToMRT(){return!0}get hasRenderTargetTextures(){return!!(T.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||!!(T.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)||this._cacheHasRenderTargetTextures}getClassName(){return"StandardMaterial"}get useLogarithmicDepth(){return this._useLogarithmicDepth}set useLogarithmicDepth(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()}needAlphaBlending(){return!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromDiffuseTexture()||this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled)}needAlphaTesting(){return!!this._forceAlphaTest||this._hasAlphaChannel()&&(null==this._transparencyMode||this._transparencyMode===d.F.MATERIAL_ALPHATEST)}_shouldUseAlphaFromDiffuseTexture(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha&&this._useAlphaFromDiffuseTexture&&this._transparencyMode!==d.F.MATERIAL_OPAQUE}_hasAlphaChannel(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha||null!=this._opacityTexture}getAlphaTestTexture(){return this._diffuseTexture}isReadyForSubMesh(e,t,i=!1){if(this._uniformBufferLayoutBuilt||this.buildUniformLayout(),t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(this._callbackPluginEventGeneric(u.S.GetDefineNames,this._eventInfo),t.materialDefines=new x(this._eventInfo.defineNames));const n=this.getScene(),r=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;const s=n.getEngine();r._needNormals=m.G.PrepareDefinesForLights(n,e,r,!0,this._maxSimultaneousLights,this._disableLighting),m.G.PrepareDefinesForMultiview(n,r);const a=this.needAlphaBlendingForMesh(e)&&this.getScene().useOrderIndependentTransparency;if(m.G.PrepareDefinesForPrePass(n,r,this.canRenderToMRT&&!a),m.G.PrepareDefinesForOIT(n,r,a),r._areTexturesDirty){this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,r._needUVs=!1;for(let e=1;e<=6;++e)r["MAINUV"+e]=!1;if(n.texturesEnabled){if(r.DIFFUSEDIRECTUV=0,r.BUMPDIRECTUV=0,r.AMBIENTDIRECTUV=0,r.OPACITYDIRECTUV=0,r.EMISSIVEDIRECTUV=0,r.SPECULARDIRECTUV=0,r.LIGHTMAPDIRECTUV=0,this._diffuseTexture&&T.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;m.G.PrepareDefinesForMergedUV(this._diffuseTexture,r,"DIFFUSE")}else r.DIFFUSE=!1;if(this._ambientTexture&&T.AmbientTextureEnabled){if(!this._ambientTexture.isReadyOrNotBlocking())return!1;m.G.PrepareDefinesForMergedUV(this._ambientTexture,r,"AMBIENT")}else r.AMBIENT=!1;if(this._opacityTexture&&T.OpacityTextureEnabled){if(!this._opacityTexture.isReadyOrNotBlocking())return!1;m.G.PrepareDefinesForMergedUV(this._opacityTexture,r,"OPACITY"),r.OPACITYRGB=this._opacityTexture.getAlphaFromRGB}else r.OPACITY=!1;if(this._reflectionTexture&&T.ReflectionTextureEnabled){if(!this._reflectionTexture.isReadyOrNotBlocking())return!1;switch(r._needNormals=!0,r.REFLECTION=!0,r.ROUGHNESS=this._roughness>0,r.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,r.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===g.x.INVCUBIC_MODE,r.REFLECTIONMAP_3D=this._reflectionTexture.isCube,r.REFLECTIONMAP_OPPOSITEZ=r.REFLECTIONMAP_3D&&this.getScene().useRightHandedSystem?!this._reflectionTexture.invertZ:this._reflectionTexture.invertZ,r.RGBDREFLECTION=this._reflectionTexture.isRGBD,this._reflectionTexture.coordinatesMode){case g.x.EXPLICIT_MODE:r.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case g.x.PLANAR_MODE:r.setReflectionMode("REFLECTIONMAP_PLANAR");break;case g.x.PROJECTION_MODE:r.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case g.x.SKYBOX_MODE:r.setReflectionMode("REFLECTIONMAP_SKYBOX");break;case g.x.SPHERICAL_MODE:r.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case g.x.EQUIRECTANGULAR_MODE:r.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case g.x.FIXED_EQUIRECTANGULAR_MODE:r.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case g.x.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:r.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case g.x.CUBIC_MODE:case g.x.INVCUBIC_MODE:default:r.setReflectionMode("REFLECTIONMAP_CUBIC")}r.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else r.REFLECTION=!1,r.REFLECTIONMAP_OPPOSITEZ=!1;if(this._emissiveTexture&&T.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;m.G.PrepareDefinesForMergedUV(this._emissiveTexture,r,"EMISSIVE")}else r.EMISSIVE=!1;if(this._lightmapTexture&&T.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;m.G.PrepareDefinesForMergedUV(this._lightmapTexture,r,"LIGHTMAP"),r.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,r.RGBDLIGHTMAP=this._lightmapTexture.isRGBD}else r.LIGHTMAP=!1;if(this._specularTexture&&T.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;m.G.PrepareDefinesForMergedUV(this._specularTexture,r,"SPECULAR"),r.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else r.SPECULAR=!1;if(n.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&T.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;m.G.PrepareDefinesForMergedUV(this._bumpTexture,r,"BUMP"),r.PARALLAX=this._useParallax,r.PARALLAXOCCLUSION=this._useParallaxOcclusion,r.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else r.BUMP=!1,r.PARALLAX=!1,r.PARALLAXOCCLUSION=!1;if(this._refractionTexture&&T.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;r._needUVs=!0,r.REFRACTION=!0,r.REFRACTIONMAP_3D=this._refractionTexture.isCube,r.RGBDREFRACTION=this._refractionTexture.isRGBD,r.USE_LOCAL_REFRACTIONMAP_CUBIC=!!this._refractionTexture.boundingBoxSize}else r.REFRACTION=!1;r.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else r.DIFFUSE=!1,r.AMBIENT=!1,r.OPACITY=!1,r.REFLECTION=!1,r.EMISSIVE=!1,r.LIGHTMAP=!1,r.BUMP=!1,r.REFRACTION=!1;r.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),r.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,r.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,r.SPECULAROVERALPHA=this._useSpecularOverAlpha,r.PREMULTIPLYALPHA=7===this.alphaMode||8===this.alphaMode,r.ALPHATEST_AFTERALLALPHACOMPUTATIONS=null!==this.transparencyMode,r.ALPHABLEND=null===this.transparencyMode||this.needAlphaBlendingForMesh(e)}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=r,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(r._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(r),r.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,r.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(r._areFresnelDirty&&(T.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(r.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,r.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,r.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,r.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,r.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,r.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,r._needNormals=!0,r.FRESNEL=!0):r.FRESNEL=!1),m.G.PrepareDefinesForMisc(e,n,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,r),m.G.PrepareDefinesForFrameBoundValues(n,s,r,i,null,t.getRenderingMesh().hasThinInstances),this._eventInfo.defines=r,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),m.G.PrepareDefinesForAttributes(e,r,!0,!0,!0),this._callbackPluginEventPrepareDefines(this._eventInfo),r.isDirty){const i=r._areLightsDisposed;r.markAsProcessed();const o=new A.L;r.REFLECTION&&o.addFallback(0,"REFLECTION"),r.SPECULAR&&o.addFallback(0,"SPECULAR"),r.BUMP&&o.addFallback(0,"BUMP"),r.PARALLAX&&o.addFallback(1,"PARALLAX"),r.PARALLAXOCCLUSION&&o.addFallback(0,"PARALLAXOCCLUSION"),r.SPECULAROVERALPHA&&o.addFallback(0,"SPECULAROVERALPHA"),r.FOG&&o.addFallback(1,"FOG"),r.POINTSIZE&&o.addFallback(0,"POINTSIZE"),r.LOGARITHMICDEPTH&&o.addFallback(0,"LOGARITHMICDEPTH"),m.G.HandleFallbacksForShadows(r,o,this._maxSimultaneousLights),r.SPECULARTERM&&o.addFallback(0,"SPECULARTERM"),r.DIFFUSEFRESNEL&&o.addFallback(1,"DIFFUSEFRESNEL"),r.OPACITYFRESNEL&&o.addFallback(2,"OPACITYFRESNEL"),r.REFLECTIONFRESNEL&&o.addFallback(3,"REFLECTIONFRESNEL"),r.EMISSIVEFRESNEL&&o.addFallback(4,"EMISSIVEFRESNEL"),r.FRESNEL&&o.addFallback(4,"FRESNEL"),r.MULTIVIEW&&o.addFallback(0,"MULTIVIEW");const a=[c.o.PositionKind];r.NORMAL&&a.push(c.o.NormalKind),r.TANGENT&&a.push(c.o.TangentKind);for(let e=1;e<=6;++e)r["UV"+e]&&a.push(`uv${1===e?"":e}`);r.VERTEXCOLOR&&a.push(c.o.ColorKind),m.G.PrepareAttributesForBones(a,e,r,o),m.G.PrepareAttributesForInstances(a,r),m.G.PrepareAttributesForMorphTargets(a,e,r),m.G.PrepareAttributesForBakedVertexAnimation(a,e,r);let l="default";const d=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","visibility","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","diffuseMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vReflectionPosition","vReflectionSize","vRefractionPosition","vRefractionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff","boneTextureWidth","morphTargetTextureInfo","morphTargetTextureIndices"],p=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler","morphTargets","oitDepthSampler","oitFrontColorSampler"],f=["Material","Scene","Mesh"];this._eventInfo.fallbacks=o,this._eventInfo.fallbackRank=0,this._eventInfo.defines=r,this._eventInfo.uniforms=d,this._eventInfo.attributes=a,this._eventInfo.samplers=p,this._eventInfo.uniformBuffersNames=f,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._callbackPluginEventGeneric(u.S.PrepareEffect,this._eventInfo),h.o.AddUniforms(d),h.o.AddSamplers(p),_.$&&(_.$.PrepareUniforms(d,r),_.$.PrepareSamplers(p,r)),m.G.PrepareUniformsAndSamplersList({uniformsNames:d,uniformBuffersNames:f,samplers:p,defines:r,maxSimultaneousLights:this._maxSimultaneousLights});const g={};this.customShaderNameResolve&&(l=this.customShaderNameResolve(l,d,f,p,r,a,g));const b=r.toString(),y=t.effect;let v=n.getEngine().createEffect(l,{attributes:a,uniformsNames:d,uniformBuffersNames:f,samplers:p,defines:b,fallbacks:o,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:r.NUM_MORPH_INFLUENCERS},processFinalCode:g.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:r.PREPASS},s);if(v)if(this._onEffectCreatedObservable&&(S.effect=v,S.subMesh=t,this._onEffectCreatedObservable.notifyObservers(S)),this.allowShaderHotSwapping&&y&&!v.isReady()){if(v=y,r.markAsUnprocessed(),i)return r._areLightsDisposed=!0,!1}else n.resetCachedMaterial(),t.setEffect(v,r,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(r._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=i,n.performancePriority!==o.a.BackwardCompatible&&(this.checkReadyOnlyOnce=!0),0))}buildUniformLayout(){const e=this._uniformBuffer;e.addUniform("diffuseLeftColor",4),e.addUniform("diffuseRightColor",4),e.addUniform("opacityParts",4),e.addUniform("reflectionLeftColor",4),e.addUniform("reflectionRightColor",4),e.addUniform("refractionLeftColor",4),e.addUniform("refractionRightColor",4),e.addUniform("emissiveLeftColor",4),e.addUniform("emissiveRightColor",4),e.addUniform("vDiffuseInfos",2),e.addUniform("vAmbientInfos",2),e.addUniform("vOpacityInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vSpecularInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("diffuseMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("reflectionMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("specularMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("pointSize",1),e.addUniform("alphaCutOff",1),e.addUniform("refractionMatrix",16),e.addUniform("vRefractionInfos",4),e.addUniform("vRefractionPosition",3),e.addUniform("vRefractionSize",3),e.addUniform("vSpecularColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("vDiffuseColor",4),e.addUniform("vAmbientColor",3),super.buildUniformLayout()}bindForSubMesh(e,t,i){var n;const r=this.getScene(),s=i.materialDefines;if(!s)return;const a=i.effect;if(!a)return;this._activeEffect=a,t.getMeshUniformBuffer().bindToEffect(a,"Mesh"),t.transferToEffect(e),this._uniformBuffer.bindToEffect(a,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,r,t,e,this.isFrozen),this._eventInfo.subMesh=i,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),s.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));const c=this._mustRebind(r,a,t.visibility);m.G.BindBonesParameters(t,a);const h=this._uniformBuffer;if(c){if(this.bindViewProjection(a),!h.useUbo||!this.isFrozen||!h.isSync){if(T.FresnelEnabled&&s.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(h.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),h.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&h.updateColor4("opacityParts",new l.Wo(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(h.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),h.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(h.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),h.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(h.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),h.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),r.texturesEnabled){if(this._diffuseTexture&&T.DiffuseTextureEnabled&&(h.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),m.G.BindTextureMatrix(this._diffuseTexture,h,"diffuse")),this._ambientTexture&&T.AmbientTextureEnabled&&(h.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),m.G.BindTextureMatrix(this._ambientTexture,h,"ambient")),this._opacityTexture&&T.OpacityTextureEnabled&&(h.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),m.G.BindTextureMatrix(this._opacityTexture,h,"opacity")),this._hasAlphaChannel()&&h.updateFloat("alphaCutOff",this.alphaCutOff),this._reflectionTexture&&T.ReflectionTextureEnabled&&(h.updateFloat2("vReflectionInfos",this._reflectionTexture.level,this.roughness),h.updateMatrix("reflectionMatrix",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)){const e=this._reflectionTexture;h.updateVector3("vReflectionPosition",e.boundingBoxPosition),h.updateVector3("vReflectionSize",e.boundingBoxSize)}if(this._emissiveTexture&&T.EmissiveTextureEnabled&&(h.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),m.G.BindTextureMatrix(this._emissiveTexture,h,"emissive")),this._lightmapTexture&&T.LightmapTextureEnabled&&(h.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),m.G.BindTextureMatrix(this._lightmapTexture,h,"lightmap")),this._specularTexture&&T.SpecularTextureEnabled&&(h.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),m.G.BindTextureMatrix(this._specularTexture,h,"specular")),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&T.BumpTextureEnabled&&(h.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),m.G.BindTextureMatrix(this._bumpTexture,h,"bump"),r._mirroredCameraPosition?h.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):h.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&T.RefractionTextureEnabled){let e=1;if(this._refractionTexture.isCube||(h.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(e=this._refractionTexture.depth)),h.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,e,this.invertRefractionY?-1:1),this._refractionTexture.boundingBoxSize){const e=this._refractionTexture;h.updateVector3("vRefractionPosition",e.boundingBoxPosition),h.updateVector3("vRefractionSize",e.boundingBoxSize)}}}this.pointsCloud&&h.updateFloat("pointSize",this.pointSize),s.SPECULARTERM&&h.updateColor4("vSpecularColor",this.specularColor,this.specularPower),h.updateColor3("vEmissiveColor",T.EmissiveTextureEnabled?this.emissiveColor:l.Wo.BlackReadOnly),h.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha),r.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),h.updateColor3("vAmbientColor",this._globalAmbientColor)}r.texturesEnabled&&(this._diffuseTexture&&T.DiffuseTextureEnabled&&a.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&T.AmbientTextureEnabled&&a.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&T.OpacityTextureEnabled&&a.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&T.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?a.setTexture("reflectionCubeSampler",this._reflectionTexture):a.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&T.EmissiveTextureEnabled&&a.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&T.LightmapTextureEnabled&&a.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&T.SpecularTextureEnabled&&a.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&T.BumpTextureEnabled&&a.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&T.RefractionTextureEnabled&&(this._refractionTexture.isCube?a.setTexture("refractionCubeSampler",this._refractionTexture):a.setTexture("refraction2DSampler",this._refractionTexture))),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(t)&&this.getScene().depthPeelingRenderer.bind(a),this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),m.G.BindClipPlane(a,r),this.bindEyePosition(a)}else r.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0);!c&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&m.G.BindLights(r,t,a,s,this._maxSimultaneousLights),(r.fogEnabled&&t.applyFog&&r.fogMode!==o.x.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture||t.receiveShadows||s.PREPASS)&&this.bindView(a),m.G.BindFogParameters(r,t,a),s.NUM_MORPH_INFLUENCERS&&m.G.BindMorphTargetParameters(t,a),s.BAKED_VERTEX_ANIMATION_TEXTURE&&(null===(n=t.bakedVertexAnimationManager)||void 0===n||n.bind(a,s.INSTANCES)),this.useLogarithmicDepth&&m.G.BindLogDepth(s,a,r),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(t,this._activeEffect),h.update()}getAnimatables(){const e=super.getAnimatables();return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&this._specularTexture.animations.length>0&&e.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._specularTexture&&e.push(this._specularTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),this._refractionTexture&&e.push(this._refractionTexture),e}hasTexture(e){return!!super.hasTexture(e)||this._diffuseTexture===e||this._ambientTexture===e||this._opacityTexture===e||this._reflectionTexture===e||this._emissiveTexture===e||this._specularTexture===e||this._bumpTexture===e||this._lightmapTexture===e||this._refractionTexture===e}dispose(e,t){var i,n,r,s,o,a,l,c,h;t&&(null===(i=this._diffuseTexture)||void 0===i||i.dispose(),null===(n=this._ambientTexture)||void 0===n||n.dispose(),null===(r=this._opacityTexture)||void 0===r||r.dispose(),null===(s=this._reflectionTexture)||void 0===s||s.dispose(),null===(o=this._emissiveTexture)||void 0===o||o.dispose(),null===(a=this._specularTexture)||void 0===a||a.dispose(),null===(l=this._bumpTexture)||void 0===l||l.dispose(),null===(c=this._lightmapTexture)||void 0===c||c.dispose(),null===(h=this._refractionTexture)||void 0===h||h.dispose()),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e,t)}clone(e){const t=r.p4.Clone((()=>new T(e,this.getScene())),this);return t.name=e,t.id=e,this.stencil.copyTo(t.stencil),t}static Parse(e,t,i){const n=r.p4.Parse((()=>new T(e.name,t)),e,t,i);return e.stencil&&n.stencil.parse(e.stencil,t,i),n}static get DiffuseTextureEnabled(){return y.k.DiffuseTextureEnabled}static set DiffuseTextureEnabled(e){y.k.DiffuseTextureEnabled=e}static get DetailTextureEnabled(){return y.k.DetailTextureEnabled}static set DetailTextureEnabled(e){y.k.DetailTextureEnabled=e}static get AmbientTextureEnabled(){return y.k.AmbientTextureEnabled}static set AmbientTextureEnabled(e){y.k.AmbientTextureEnabled=e}static get OpacityTextureEnabled(){return y.k.OpacityTextureEnabled}static set OpacityTextureEnabled(e){y.k.OpacityTextureEnabled=e}static get ReflectionTextureEnabled(){return y.k.ReflectionTextureEnabled}static set ReflectionTextureEnabled(e){y.k.ReflectionTextureEnabled=e}static get EmissiveTextureEnabled(){return y.k.EmissiveTextureEnabled}static set EmissiveTextureEnabled(e){y.k.EmissiveTextureEnabled=e}static get SpecularTextureEnabled(){return y.k.SpecularTextureEnabled}static set SpecularTextureEnabled(e){y.k.SpecularTextureEnabled=e}static get BumpTextureEnabled(){return y.k.BumpTextureEnabled}static set BumpTextureEnabled(e){y.k.BumpTextureEnabled=e}static get LightmapTextureEnabled(){return y.k.LightmapTextureEnabled}static set LightmapTextureEnabled(e){y.k.LightmapTextureEnabled=e}static get RefractionTextureEnabled(){return y.k.RefractionTextureEnabled}static set RefractionTextureEnabled(e){y.k.RefractionTextureEnabled=e}static get ColorGradingTextureEnabled(){return y.k.ColorGradingTextureEnabled}static set ColorGradingTextureEnabled(e){y.k.ColorGradingTextureEnabled=e}static get FresnelEnabled(){return y.k.FresnelEnabled}static set FresnelEnabled(e){y.k.FresnelEnabled=e}}(0,n.gn)([(0,r.oU)("diffuseTexture")],T.prototype,"_diffuseTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],T.prototype,"diffuseTexture",void 0),(0,n.gn)([(0,r.oU)("ambientTexture")],T.prototype,"_ambientTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"ambientTexture",void 0),(0,n.gn)([(0,r.oU)("opacityTexture")],T.prototype,"_opacityTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],T.prototype,"opacityTexture",void 0),(0,n.gn)([(0,r.oU)("reflectionTexture")],T.prototype,"_reflectionTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"reflectionTexture",void 0),(0,n.gn)([(0,r.oU)("emissiveTexture")],T.prototype,"_emissiveTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"emissiveTexture",void 0),(0,n.gn)([(0,r.oU)("specularTexture")],T.prototype,"_specularTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"specularTexture",void 0),(0,n.gn)([(0,r.oU)("bumpTexture")],T.prototype,"_bumpTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"bumpTexture",void 0),(0,n.gn)([(0,r.oU)("lightmapTexture")],T.prototype,"_lightmapTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"lightmapTexture",void 0),(0,n.gn)([(0,r.oU)("refractionTexture")],T.prototype,"_refractionTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"refractionTexture",void 0),(0,n.gn)([(0,r.n9)("ambient")],T.prototype,"ambientColor",void 0),(0,n.gn)([(0,r.n9)("diffuse")],T.prototype,"diffuseColor",void 0),(0,n.gn)([(0,r.n9)("specular")],T.prototype,"specularColor",void 0),(0,n.gn)([(0,r.n9)("emissive")],T.prototype,"emissiveColor",void 0),(0,n.gn)([(0,r.qC)()],T.prototype,"specularPower",void 0),(0,n.gn)([(0,r.qC)("useAlphaFromDiffuseTexture")],T.prototype,"_useAlphaFromDiffuseTexture",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],T.prototype,"useAlphaFromDiffuseTexture",void 0),(0,n.gn)([(0,r.qC)("useEmissiveAsIllumination")],T.prototype,"_useEmissiveAsIllumination",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"useEmissiveAsIllumination",void 0),(0,n.gn)([(0,r.qC)("linkEmissiveWithDiffuse")],T.prototype,"_linkEmissiveWithDiffuse",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"linkEmissiveWithDiffuse",void 0),(0,n.gn)([(0,r.qC)("useSpecularOverAlpha")],T.prototype,"_useSpecularOverAlpha",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"useSpecularOverAlpha",void 0),(0,n.gn)([(0,r.qC)("useReflectionOverAlpha")],T.prototype,"_useReflectionOverAlpha",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"useReflectionOverAlpha",void 0),(0,n.gn)([(0,r.qC)("disableLighting")],T.prototype,"_disableLighting",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsLightsDirty")],T.prototype,"disableLighting",void 0),(0,n.gn)([(0,r.qC)("useObjectSpaceNormalMap")],T.prototype,"_useObjectSpaceNormalMap",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"useObjectSpaceNormalMap",void 0),(0,n.gn)([(0,r.qC)("useParallax")],T.prototype,"_useParallax",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"useParallax",void 0),(0,n.gn)([(0,r.qC)("useParallaxOcclusion")],T.prototype,"_useParallaxOcclusion",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"useParallaxOcclusion",void 0),(0,n.gn)([(0,r.qC)()],T.prototype,"parallaxScaleBias",void 0),(0,n.gn)([(0,r.qC)("roughness")],T.prototype,"_roughness",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"roughness",void 0),(0,n.gn)([(0,r.qC)()],T.prototype,"indexOfRefraction",void 0),(0,n.gn)([(0,r.qC)()],T.prototype,"invertRefractionY",void 0),(0,n.gn)([(0,r.qC)()],T.prototype,"alphaCutOff",void 0),(0,n.gn)([(0,r.qC)("useLightmapAsShadowmap")],T.prototype,"_useLightmapAsShadowmap",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"useLightmapAsShadowmap",void 0),(0,n.gn)([(0,r.qQ)("diffuseFresnelParameters")],T.prototype,"_diffuseFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],T.prototype,"diffuseFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("opacityFresnelParameters")],T.prototype,"_opacityFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelAndMiscDirty")],T.prototype,"opacityFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("reflectionFresnelParameters")],T.prototype,"_reflectionFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],T.prototype,"reflectionFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("refractionFresnelParameters")],T.prototype,"_refractionFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],T.prototype,"refractionFresnelParameters",void 0),(0,n.gn)([(0,r.qQ)("emissiveFresnelParameters")],T.prototype,"_emissiveFresnelParameters",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],T.prototype,"emissiveFresnelParameters",void 0),(0,n.gn)([(0,r.qC)("useReflectionFresnelFromSpecular")],T.prototype,"_useReflectionFresnelFromSpecular",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsFresnelDirty")],T.prototype,"useReflectionFresnelFromSpecular",void 0),(0,n.gn)([(0,r.qC)("useGlossinessFromSpecularMapAlpha")],T.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"useGlossinessFromSpecularMapAlpha",void 0),(0,n.gn)([(0,r.qC)("maxSimultaneousLights")],T.prototype,"_maxSimultaneousLights",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsLightsDirty")],T.prototype,"maxSimultaneousLights",void 0),(0,n.gn)([(0,r.qC)("invertNormalMapX")],T.prototype,"_invertNormalMapX",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"invertNormalMapX",void 0),(0,n.gn)([(0,r.qC)("invertNormalMapY")],T.prototype,"_invertNormalMapY",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"invertNormalMapY",void 0),(0,n.gn)([(0,r.qC)("twoSidedLighting")],T.prototype,"_twoSidedLighting",void 0),(0,n.gn)([(0,r.wz)("_markAllSubMeshesAsTexturesDirty")],T.prototype,"twoSidedLighting",void 0),(0,n.gn)([(0,r.qC)()],T.prototype,"useLogarithmicDepth",null),(0,b.H)("BABYLON.StandardMaterial",T),o.x.DefaultMaterialFactory=e=>new T("default material",e)},"../../../node_modules/@babylonjs/core/Materials/thinMaterialHelper.js":function(e,t,i){"use strict";i.d(t,{O:function(){return n}});class n{static BindClipPlane(e,t){if(t.clipPlane){const i=t.clipPlane;e.setFloat4("vClipPlane",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane2){const i=t.clipPlane2;e.setFloat4("vClipPlane2",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane3){const i=t.clipPlane3;e.setFloat4("vClipPlane3",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane4){const i=t.clipPlane4;e.setFloat4("vClipPlane4",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane5){const i=t.clipPlane5;e.setFloat4("vClipPlane5",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane6){const i=t.clipPlane6;e.setFloat4("vClipPlane6",i.normal.x,i.normal.y,i.normal.z,i.d)}}}},"../../../node_modules/@babylonjs/core/Materials/uniformBuffer.js":function(e,t,i){"use strict";i.d(t,{M:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),r=i("../../../node_modules/@babylonjs/core/Misc/tools.js");i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.uniformBuffer.js");class s{constructor(e,t,i,n,r=!1){this._valueCache={},this._engine=e,this._noUBO=!e.supportsUniformBuffers||r,this._dynamic=i,this._name=null!=n?n:"no-name",this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformArraySizes={},this._uniformLocationPointer=0,this._needSync=!1,this._engine._features.trackUbosInFrame&&(this._buffers=[],this._bufferIndex=-1,this._createBufferOnWrite=!1,this._currentFrameId=0),this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateFloatArray=this._updateFloatArrayForEffect,this.updateArray=this._updateArrayForEffect,this.updateIntArray=this._updateIntArrayForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateMatrices=this._updateMatricesForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect,this.updateDirectColor4=this._updateDirectColor4ForEffect,this.updateInt=this._updateIntForEffect,this.updateInt2=this._updateInt2ForEffect,this.updateInt3=this._updateInt3ForEffect,this.updateInt4=this._updateInt4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateFloatArray=this._updateFloatArrayForUniform,this.updateArray=this._updateArrayForUniform,this.updateIntArray=this._updateIntArrayForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateMatrices=this._updateMatricesForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform,this.updateDirectColor4=this._updateDirectColor4ForUniform,this.updateInt=this._updateIntForUniform,this.updateInt2=this._updateInt2ForUniform,this.updateInt3=this._updateInt3ForUniform,this.updateInt4=this._updateInt4ForUniform)}get useUbo(){return!this._noUBO}get isSync(){return!this._needSync}isDynamic(){return void 0!==this._dynamic}getData(){return this._bufferData}getBuffer(){return this._buffer}_fillAlignment(e){let t;if(t=e<=2?e:4,this._uniformLocationPointer%t!=0){const e=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;const i=this._uniformLocationPointer-e;for(let e=0;e0){if(t instanceof Array)throw"addUniform should not be use with Array in UBO: "+e;this._fillAlignment(4),this._uniformArraySizes[e]={strideSize:t,arraySize:i},16==t?t*=i:t=t*i+(4-t)*i,n=[];for(let e=0;e1&&this._buffers[this._bufferIndex][1]){if(this._buffersEqual(this._bufferData,this._buffers[this._bufferIndex][1]))return this._needSync=!1,void(this._createBufferOnWrite=this._engine._features.trackUbosInFrame);this._copyBuffer(this._bufferData,this._buffers[this._bufferIndex][1])}this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._engine._features._collectUbosUpdatedInFrame&&(s._UpdatedUbosInFrame[this._name]||(s._UpdatedUbosInFrame[this._name]=0),s._UpdatedUbosInFrame[this._name]++),this._needSync=!1,this._createBufferOnWrite=this._engine._features.trackUbosInFrame}else this._createBufferOnWrite=this._engine._features.trackUbosInFrame;else this.create()}_createNewBuffer(){this._bufferIndex+10?(this._needSync=0!==this._bufferIndex,this._bufferIndex=0,this._buffer=this._buffers[this._bufferIndex][0]):this._bufferIndex=-1)}updateUniform(e,t,i){this._checkNewFrame();let s=this._uniformLocations[e];if(void 0===s){if(this._buffer)return void n.Y.Error("Cannot add an uniform after UBO has been created.");this.addUniform(e,i),s=this._uniformLocations[e]}if(this._buffer||this.create(),this._dynamic)for(let e=0;e=0&&s<=1?(a=r,l=o):s>=1&&s<=2?(a=o,l=r):s>=2&&s<=3?(l=r,c=o):s>=3&&s<=4?(l=o,c=r):s>=4&&s<=5?(a=o,c=r):s>=5&&s<=6&&(a=r,c=o);const h=i-r;n.set(a+h,l+h,c+h)}static FromHSV(e,t,i){const n=new a(0,0,0);return a.HSVtoRGBToRef(e,t,i,n),n}static FromHexString(e){if("#"!==e.substring(0,1)||7!==e.length)return new a(0,0,0);const t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);return a.FromInts(t,i,n)}static FromArray(e,t=0){return new a(e[t],e[t+1],e[t+2])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2]}static FromInts(e,t,i){return new a(e/255,t/255,i/255)}static Lerp(e,t,i){const n=new a(0,0,0);return a.LerpToRef(e,t,i,n),n}static LerpToRef(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i}static Hermite(e,t,i,n,r){const s=r*r,o=r*s,l=2*o-3*s+1,c=-2*o+3*s,h=o-2*s+r,_=o-s,d=e.r*l+i.r*c+t.r*h+n.r*_,u=e.g*l+i.g*c+t.g*h+n.g*_,p=e.b*l+i.b*c+t.b*h+n.b*_;return new a(d,u,p)}static Hermite1stDerivative(e,t,i,n,r){const s=a.Black();return this.Hermite1stDerivativeToRef(e,t,i,n,r,s),s}static Hermite1stDerivativeToRef(e,t,i,n,r,s){const o=r*r;s.r=6*(o-r)*e.r+(3*o-4*r+1)*t.r+6*(-o+r)*i.r+(3*o-2*r)*n.r,s.g=6*(o-r)*e.g+(3*o-4*r+1)*t.g+6*(-o+r)*i.g+(3*o-2*r)*n.g,s.b=6*(o-r)*e.b+(3*o-4*r+1)*t.b+6*(-o+r)*i.b+(3*o-2*r)*n.b}static Red(){return new a(1,0,0)}static Green(){return new a(0,1,0)}static Blue(){return new a(0,0,1)}static Black(){return new a(0,0,0)}static get BlackReadOnly(){return a._BlackReadOnly}static White(){return new a(1,1,1)}static Purple(){return new a(.5,0,.5)}static Magenta(){return new a(1,0,1)}static Yellow(){return new a(1,1,0)}static Gray(){return new a(.5,.5,.5)}static Teal(){return new a(0,1,1)}static Random(){return new a(Math.random(),Math.random(),Math.random())}}a._BlackReadOnly=a.Black();class l{constructor(e=0,t=0,i=0,n=1){this.r=e,this.g=t,this.b=i,this.a=n}addInPlace(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this}asArray(){return[this.r,this.g,this.b,this.a]}toArray(e,t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this}fromArray(e,t=0){return l.FromArrayToRef(e,t,this),this}equals(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}add(e){return new l(this.r+e.r,this.g+e.g,this.b+e.b,this.a+e.a)}subtract(e){return new l(this.r-e.r,this.g-e.g,this.b-e.b,this.a-e.a)}subtractToRef(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,this}scale(e){return new l(this.r*e,this.g*e,this.b*e,this.a*e)}scaleInPlace(e){return this.r*=e,this.g*=e,this.b*=e,this.a*=e,this}scaleToRef(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,this}scaleAndAddToRef(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,this}clampToRef(e=0,t=1,i){return i.r=n.R.Clamp(this.r,e,t),i.g=n.R.Clamp(this.g,e,t),i.b=n.R.Clamp(this.b,e,t),i.a=n.R.Clamp(this.a,e,t),this}multiply(e){return new l(this.r*e.r,this.g*e.g,this.b*e.b,this.a*e.a)}multiplyToRef(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t}toString(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"}getClassName(){return"Color4"}getHashCode(){let e=255*this.r|0;return e=397*e^(255*this.g|0),e=397*e^(255*this.b|0),e=397*e^(255*this.a|0),e}clone(){return new l(this.r,this.g,this.b,this.a)}copyFrom(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}copyFromFloats(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this}set(e,t,i,n){return this.copyFromFloats(e,t,i,n)}toHexString(e=!1){const t=Math.round(255*this.r),i=Math.round(255*this.g),r=Math.round(255*this.b);if(e)return"#"+n.R.ToHex(t)+n.R.ToHex(i)+n.R.ToHex(r);const s=Math.round(255*this.a);return"#"+n.R.ToHex(t)+n.R.ToHex(i)+n.R.ToHex(r)+n.R.ToHex(s)}toLinearSpace(){const e=new l;return this.toLinearSpaceToRef(e),e}toLinearSpaceToRef(e){return e.r=Math.pow(this.r,r.Nn),e.g=Math.pow(this.g,r.Nn),e.b=Math.pow(this.b,r.Nn),e.a=this.a,this}toGammaSpace(){const e=new l;return this.toGammaSpaceToRef(e),e}toGammaSpaceToRef(e){return e.r=Math.pow(this.r,r.zp),e.g=Math.pow(this.g,r.zp),e.b=Math.pow(this.b,r.zp),e.a=this.a,this}static FromHexString(e){if("#"!==e.substring(0,1)||9!==e.length&&7!==e.length)return new l(0,0,0,0);const t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16),r=9===e.length?parseInt(e.substring(7,9),16):255;return l.FromInts(t,i,n,r)}static Lerp(e,t,i){const n=new l(0,0,0,0);return l.LerpToRef(e,t,i,n),n}static LerpToRef(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i,n.a=e.a+(t.a-e.a)*i}static Hermite(e,t,i,n,r){const s=r*r,o=r*s,a=2*o-3*s+1,c=-2*o+3*s,h=o-2*s+r,_=o-s,d=e.r*a+i.r*c+t.r*h+n.r*_,u=e.g*a+i.g*c+t.g*h+n.g*_,p=e.b*a+i.b*c+t.b*h+n.b*_,f=e.a*a+i.a*c+t.a*h+n.a*_;return new l(d,u,p,f)}static Hermite1stDerivative(e,t,i,n,r){const s=new l;return this.Hermite1stDerivativeToRef(e,t,i,n,r,s),s}static Hermite1stDerivativeToRef(e,t,i,n,r,s){const o=r*r;s.r=6*(o-r)*e.r+(3*o-4*r+1)*t.r+6*(-o+r)*i.r+(3*o-2*r)*n.r,s.g=6*(o-r)*e.g+(3*o-4*r+1)*t.g+6*(-o+r)*i.g+(3*o-2*r)*n.g,s.b=6*(o-r)*e.b+(3*o-4*r+1)*t.b+6*(-o+r)*i.b+(3*o-2*r)*n.b,s.a=6*(o-r)*e.a+(3*o-4*r+1)*t.a+6*(-o+r)*i.a+(3*o-2*r)*n.a}static FromColor3(e,t=1){return new l(e.r,e.g,e.b,t)}static FromArray(e,t=0){return new l(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t=0,i){i.r=e[t],i.g=e[t+1],i.b=e[t+2],i.a=e[t+3]}static FromInts(e,t,i,n){return new l(e/255,t/255,i/255,n/255)}static CheckColors4(e,t){if(e.length===3*t){const t=[];for(let i=0;inew l(0,0,0,0))),(0,o.H)("BABYLON.Color3",a),(0,o.H)("BABYLON.Color4",l)},"../../../node_modules/@babylonjs/core/Maths/math.constants.js":function(e,t,i){"use strict";i.d(t,{Nn:function(){return r},Q_:function(){return s},kn:function(){return o},zp:function(){return n}});const n=1/2.2,r=2.2,s=(1+Math.sqrt(5))/2,o=.001},"../../../node_modules/@babylonjs/core/Maths/math.frustum.js":function(e,t,i){"use strict";i.d(t,{i:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.plane.js");class r{static GetPlanes(e){const t=[];for(let e=0;e<6;e++)t.push(new n.J(0,0,0,0));return r.GetPlanesToRef(e,t),t}static GetNearPlaneToRef(e,t){const i=e.m;t.normal.x=i[3]+i[2],t.normal.y=i[7]+i[6],t.normal.z=i[11]+i[10],t.d=i[15]+i[14],t.normalize()}static GetFarPlaneToRef(e,t){const i=e.m;t.normal.x=i[3]-i[2],t.normal.y=i[7]-i[6],t.normal.z=i[11]-i[10],t.d=i[15]-i[14],t.normalize()}static GetLeftPlaneToRef(e,t){const i=e.m;t.normal.x=i[3]+i[0],t.normal.y=i[7]+i[4],t.normal.z=i[11]+i[8],t.d=i[15]+i[12],t.normalize()}static GetRightPlaneToRef(e,t){const i=e.m;t.normal.x=i[3]-i[0],t.normal.y=i[7]-i[4],t.normal.z=i[11]-i[8],t.d=i[15]-i[12],t.normalize()}static GetTopPlaneToRef(e,t){const i=e.m;t.normal.x=i[3]-i[1],t.normal.y=i[7]-i[5],t.normal.z=i[11]-i[9],t.d=i[15]-i[13],t.normalize()}static GetBottomPlaneToRef(e,t){const i=e.m;t.normal.x=i[3]+i[1],t.normal.y=i[7]+i[5],t.normal.z=i[11]+i[9],t.d=i[15]+i[13],t.normalize()}static GetPlanesToRef(e,t){r.GetNearPlaneToRef(e,t[0]),r.GetFarPlaneToRef(e,t[1]),r.GetLeftPlaneToRef(e,t[2]),r.GetRightPlaneToRef(e,t[3]),r.GetTopPlaneToRef(e,t[4]),r.GetBottomPlaneToRef(e,t[5])}}},"../../../node_modules/@babylonjs/core/Maths/math.functions.js":function(e,t,i){"use strict";i.d(t,{k:function(){return l},y:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Misc/decorators.js");class o{static extractMinAndMaxIndexed(e,t,i,n,r,s){for(let o=i;o!Array.isArray(e)&&!Array.isArray(t)))],o,"extractMinAndMaxIndexed",null),(0,n.gn)([s.G6.filter(((...[e])=>!Array.isArray(e)))],o,"extractMinAndMax",null)},"../../../node_modules/@babylonjs/core/Maths/math.js":function(e,t,i){"use strict";i.d(t,{FM:function(){return a.FM},HE:function(){return r.HE},JO:function(){return o.J},Lt:function(){return a.Lt},P:function(){return a.P},RD:function(){return n.RD},T:function(){return n.T},Wo:function(){return r.Wo},_f:function(){return a._f},jp:function(){return a.jp},kn:function(){return s.kn},l_:function(){return l.l},y3:function(){return a.y3},zZ:function(){return r.zZ}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js"),o=(i("../../../node_modules/@babylonjs/core/Maths/math.frustum.js"),i("../../../node_modules/@babylonjs/core/Maths/math.path.js"),i("../../../node_modules/@babylonjs/core/Maths/math.plane.js")),a=(i("../../../node_modules/@babylonjs/core/Maths/math.size.js"),i("../../../node_modules/@babylonjs/core/Maths/math.vector.js")),l=(i("../../../node_modules/@babylonjs/core/Maths/math.vertexFormat.js"),i("../../../node_modules/@babylonjs/core/Maths/math.viewport.js"))},"../../../node_modules/@babylonjs/core/Maths/math.path.js":function(e,t,i){"use strict";i.d(t,{$B:function(){return h},ZZ:function(){return c},j_:function(){return _}});var n,r=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js");!function(e){e[e.CW=0]="CW",e[e.CCW=1]="CCW"}(n||(n={}));class a{constructor(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}degrees(){return 180*this._radians/Math.PI}radians(){return this._radians}static BetweenTwoPoints(e,t){const i=t.subtract(e),n=Math.atan2(i.y,i.x);return new a(n)}static FromRadians(e){return new a(e)}static FromDegrees(e){return new a(e*Math.PI/180)}}class l{constructor(e,t,i){this.startPoint=e,this.midPoint=t,this.endPoint=i;const r=Math.pow(t.x,2)+Math.pow(t.y,2),o=(Math.pow(e.x,2)+Math.pow(e.y,2)-r)/2,l=(r-Math.pow(i.x,2)-Math.pow(i.y,2))/2,c=(e.x-t.x)*(t.y-i.y)-(t.x-i.x)*(e.y-t.y);this.centerPoint=new s.FM((o*(t.y-i.y)-l*(e.y-t.y))/c,((e.x-t.x)*l-(t.x-i.x)*o)/c),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=a.BetweenTwoPoints(this.centerPoint,this.startPoint);const h=this.startAngle.degrees();let _=a.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),d=a.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();_-h>180&&(_-=360),_-h<-180&&(_+=360),d-_>180&&(d-=360),d-_<-180&&(d+=360),this.orientation=_-h<0?n.CW:n.CCW,this.angle=a.FromDegrees(this.orientation===n.CW?h-d:d-h)}}class c{constructor(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new s.FM(e,t))}addLineTo(e,t){if(this.closed)return this;const i=new s.FM(e,t),n=this._points[this._points.length-1];return this._points.push(i),this._length+=i.subtract(n).length(),this}addArcTo(e,t,i,r,o=36){if(this.closed)return this;const a=this._points[this._points.length-1],c=new s.FM(e,t),h=new s.FM(i,r),_=new l(a,c,h);let d=_.angle.radians()/o;_.orientation===n.CW&&(d*=-1);let u=_.startAngle.radians()+d;for(let e=0;e1)return s.FM.Zero();const t=e*this.length();let i=0;for(let e=0;e=i&&t<=a){const e=o.normalize(),n=t-i;return new s.FM(r.x+e.x*n,r.y+e.y*n)}i=a}return s.FM.Zero()}static StartingAt(e,t){return new c(e,t)}}class h{constructor(e,t=null,i,n=!1){this.path=e,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array,this._pointAtData={id:0,point:s.P.Zero(),previousPointArrayIndex:0,position:0,subPosition:0,interpolateReady:!1,interpolationMatrix:s.y3.Identity()};for(let t=0;tt){const i=e;e=t,t=i}const i=this.getCurve(),n=this.getPointAt(e);let r=this.getPreviousPointIndexAt(e);const s=this.getPointAt(t),o=this.getPreviousPointIndexAt(t)+1,a=[];return 0!==e&&(r++,a.push(n)),a.push(...i.slice(r,o)),1===t&&1!==e||a.push(s),new h(a,this.getNormalAt(e),this._raw,this._alignTangentsWithPath)}update(e,t=null,i=!1){for(let t=0;tt+1;)t++,i=this._curve[e].subtract(this._curve[e-t]);return i}_normalVector(e,t){let i,n=e.length();if(0===n&&(n=1),null==t){let t;t=r.R.WithinEpsilon(Math.abs(e.y)/n,1,o.kn)?r.R.WithinEpsilon(Math.abs(e.x)/n,1,o.kn)?r.R.WithinEpsilon(Math.abs(e.z)/n,1,o.kn)?s.P.Zero():new s.P(0,0,1):new s.P(1,0,0):new s.P(0,-1,0),i=s.P.Cross(e,t)}else i=s.P.Cross(e,t),s.P.CrossToRef(i,e,i);return i.normalize(),i}_updatePointAtData(e,t=!1){if(this._pointAtData.id===e)return this._pointAtData.interpolateReady||this._updateInterpolationMatrix(),this._pointAtData;this._pointAtData.id=e;const i=this.getPoints();if(e<=0)return this._setPointAtData(0,0,i[0],0,t);if(e>=1)return this._setPointAtData(1,1,i[i.length-1],i.length-1,t);let n,r=i[0],o=0;const a=e*this.length();for(let l=1;la){const i=(o-a)/c,s=r.subtract(n),h=n.add(s.scaleInPlace(i));return this._setPointAtData(e,1-i,h,l-1,t)}r=n}return this._pointAtData}_setPointAtData(e,t,i,n,r){return this._pointAtData.point=i,this._pointAtData.position=e,this._pointAtData.subPosition=t,this._pointAtData.previousPointArrayIndex=n,this._pointAtData.interpolateReady=r,r&&this._updateInterpolationMatrix(),this._pointAtData}_updateInterpolationMatrix(){this._pointAtData.interpolationMatrix=s.y3.Identity();const e=this._pointAtData.previousPointArrayIndex;if(e!==this._tangents.length-1){const t=e+1,i=this._tangents[e].clone(),n=this._normals[e].clone(),r=this._binormals[e].clone(),o=this._tangents[t].clone(),a=this._normals[t].clone(),l=this._binormals[t].clone(),c=s._f.RotationQuaternionFromAxis(n,r,i),h=s._f.RotationQuaternionFromAxis(a,l,o);s._f.Slerp(c,h,this._pointAtData.subPosition).toRotationMatrix(this._pointAtData.interpolationMatrix)}}}class _{constructor(e){this._length=0,this._points=e,this._length=this._computeLength(e)}static CreateQuadraticBezier(e,t,i,n){n=n>2?n:3;const r=new Array,o=(e,t,i,n)=>(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*n;for(let a=0;a<=n;a++)r.push(new s.P(o(a/n,e.x,t.x,i.x),o(a/n,e.y,t.y,i.y),o(a/n,e.z,t.z,i.z)));return new _(r)}static CreateCubicBezier(e,t,i,n,r){r=r>3?r:4;const o=new Array,a=(e,t,i,n,r)=>(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*n+e*e*e*r;for(let l=0;l<=r;l++)o.push(new s.P(a(l/r,e.x,t.x,i.x,n.x),a(l/r,e.y,t.y,i.y,n.y),a(l/r,e.z,t.z,i.z,n.z)));return new _(o)}static CreateHermiteSpline(e,t,i,n,r){const o=new Array,a=1/r;for(let l=0;l<=r;l++)o.push(s.P.Hermite(e,t,i,n,l*a));return new _(o)}static CreateCatmullRomSpline(e,t,i){const n=new Array,r=1/t;let o=0;if(i){const i=e.length;for(let a=0;a0?1:-1}static Clamp(e,t=0,i=1){return Math.min(i,Math.max(t,e))}static Log2(e){return Math.log(e)*Math.LOG2E}static ILog2(e){if(Math.log2)return Math.floor(Math.log2(e));if(e<0)return NaN;if(0===e)return-1/0;let t=0;if(e<1){for(;e<1;)t++,e*=2;t=-t}else if(e>1)for(;e>1;)t++,e=Math.floor(e/2);return t}static Repeat(e,t){return e-Math.floor(e/t)*t}static Normalize(e,t,i){return(e-t)/(i-t)}static Denormalize(e,t,i){return e*(i-t)+t}static DeltaAngle(e,t){let i=n.Repeat(t-e,360);return i>180&&(i-=360),i}static PingPong(e,t){const i=n.Repeat(e,2*t);return t-Math.abs(i-t)}static SmoothStep(e,t,i){let r=n.Clamp(i);return r=-2*r*r*r+3*r*r,t*r+e*(1-r)}static MoveTowards(e,t,i){let r=0;return r=Math.abs(t-e)<=i?t:e+n.Sign(t-e)*i,r}static MoveTowardsAngle(e,t,i){const r=n.DeltaAngle(e,t);let s=0;return-i180&&(r-=360),e+r*n.Clamp(i)}static InverseLerp(e,t,i){let r=0;return r=e!=t?n.Clamp((i-e)/(t-e)):0,r}static Hermite(e,t,i,n,r){const s=r*r,o=r*s;return e*(2*o-3*s+1)+i*(-2*o+3*s)+t*(o-2*s+r)+n*(o-s)}static Hermite1stDerivative(e,t,i,n,r){const s=r*r;return 6*(s-r)*e+(3*s-4*r+1)*t+6*(-s+r)*i+(3*s-2*r)*n}static RandomRange(e,t){return e===t?e:Math.random()*(t-e)+e}static RangeToPercent(e,t,i){return(e-t)/(i-t)}static PercentToRange(e,t,i){return(i-t)*e+t}static NormalizeRadians(e){return e-n.TwoPi*Math.floor((e+Math.PI)/n.TwoPi)}static HCF(e,t){const i=e%t;return 0===i?t:n.HCF(t,i)}}n.TwoPi=2*Math.PI},"../../../node_modules/@babylonjs/core/Maths/math.size.js":function(e,t,i){"use strict";i.d(t,{$:function(){return n}});class n{constructor(e,t){this.width=e,this.height=t}toString(){return`{W: ${this.width}, H: ${this.height}}`}getClassName(){return"Size"}getHashCode(){let e=0|this.width;return e=397*e^(0|this.height),e}copyFrom(e){this.width=e.width,this.height=e.height}copyFromFloats(e,t){return this.width=e,this.height=t,this}set(e,t){return this.copyFromFloats(e,t)}multiplyByFloats(e,t){return new n(this.width*e,this.height*t)}clone(){return new n(this.width,this.height)}equals(e){return!!e&&this.width===e.width&&this.height===e.height}get surface(){return this.width*this.height}static Zero(){return new n(0,0)}add(e){return new n(this.width+e.width,this.height+e.height)}subtract(e){return new n(this.width-e.width,this.height-e.height)}static Lerp(e,t,i){const r=e.width+(t.width-e.width)*i,s=e.height+(t.height-e.height)*i;return new n(r,s)}}},"../../../node_modules/@babylonjs/core/Maths/math.vector.js":function(e,t,i){"use strict";i.d(t,{FM:function(){return h},Lt:function(){return d},P:function(){return _},_f:function(){return u},jp:function(){return m},y3:function(){return p}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js"),s=i("../../../node_modules/@babylonjs/core/Misc/arrayTools.js"),o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),a=i("../../../node_modules/@babylonjs/core/Engines/performanceConfigurator.js"),l=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js");const c=e=>parseInt(e.toString().replace(/\W/g,""));class h{constructor(e=0,t=0){this.x=e,this.y=t}toString(){return`{X: ${this.x} Y: ${this.y}}`}getClassName(){return"Vector2"}getHashCode(){let e=c(this.x);return e=397*e^c(this.y),e}toArray(e,t=0){return e[t]=this.x,e[t+1]=this.y,this}fromArray(e,t=0){return h.FromArrayToRef(e,t,this),this}asArray(){const e=new Array;return this.toArray(e,0),e}copyFrom(e){return this.x=e.x,this.y=e.y,this}copyFromFloats(e,t){return this.x=e,this.y=t,this}set(e,t){return this.copyFromFloats(e,t)}add(e){return new h(this.x+e.x,this.y+e.y)}addToRef(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}addVector3(e){return new h(this.x+e.x,this.y+e.y)}subtract(e){return new h(this.x-e.x,this.y-e.y)}subtractToRef(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e.x,this.y*=e.y,this}multiply(e){return new h(this.x*e.x,this.y*e.y)}multiplyToRef(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,this}multiplyByFloats(e,t){return new h(this.x*e,this.y*t)}divide(e){return new h(this.x/e.x,this.y/e.y)}divideToRef(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,this}divideInPlace(e){return this.divideToRef(e,this)}negate(){return new h(-this.x,-this.y)}negateInPlace(){return this.x*=-1,this.y*=-1,this}negateToRef(e){return e.copyFromFloats(-1*this.x,-1*this.y)}scaleInPlace(e){return this.x*=e,this.y*=e,this}scale(e){const t=new h(0,0);return this.scaleToRef(e,t),t}scaleToRef(e,t){return t.x=this.x*e,t.y=this.y*e,this}scaleAndAddToRef(e,t){return t.x+=this.x*e,t.y+=this.y*e,this}equals(e){return e&&this.x===e.x&&this.y===e.y}equalsWithEpsilon(e,t=r.kn){return e&&n.R.WithinEpsilon(this.x,e.x,t)&&n.R.WithinEpsilon(this.y,e.y,t)}floor(){return new h(Math.floor(this.x),Math.floor(this.y))}fract(){return new h(this.x-Math.floor(this.x),this.y-Math.floor(this.y))}rotateToRef(e,t){const i=Math.cos(e),n=Math.sin(e);return t.x=i*this.x-n*this.y,t.y=n*this.x+i*this.y,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return h.NormalizeToRef(this,this),this}clone(){return new h(this.x,this.y)}static Zero(){return new h(0,0)}static One(){return new h(1,1)}static get ZeroReadOnly(){return h._ZeroReadOnly}static FromArray(e,t=0){return new h(e[t],e[t+1])}static FromArrayToRef(e,t,i){i.x=e[t],i.y=e[t+1]}static CatmullRom(e,t,i,n,r){const s=r*r,o=r*s,a=.5*(2*t.x+(-e.x+i.x)*r+(2*e.x-5*t.x+4*i.x-n.x)*s+(-e.x+3*t.x-3*i.x+n.x)*o),l=.5*(2*t.y+(-e.y+i.y)*r+(2*e.y-5*t.y+4*i.y-n.y)*s+(-e.y+3*t.y-3*i.y+n.y)*o);return new h(a,l)}static Clamp(e,t,i){let n=e.x;n=n>i.x?i.x:n,n=ni.y?i.y:r,r=rt.x?e.x:t.x,n=e.y>t.y?e.y:t.y;return new h(i,n)}static Transform(e,t){const i=h.Zero();return h.TransformToRef(e,t,i),i}static TransformToRef(e,t,i){const n=t.m,r=e.x*n[0]+e.y*n[4]+n[12],s=e.x*n[1]+e.y*n[5]+n[13];i.x=r,i.y=s}static PointInTriangle(e,t,i,n){const r=.5*(-i.y*n.x+t.y*(-i.x+n.x)+t.x*(i.y-n.y)+i.x*n.y),s=r<0?-1:1,o=(t.y*n.x-t.x*n.y+(n.y-t.y)*e.x+(t.x-n.x)*e.y)*s,a=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*s;return o>0&&a>0&&o+a<2*r*s}static Distance(e,t){return Math.sqrt(h.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,n=e.y-t.y;return i*i+n*n}static Center(e,t){return h.CenterToRef(e,t,h.Zero())}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2)}static DistanceOfPointFromSegment(e,t,i){const n=h.DistanceSquared(t,i);if(0===n)return h.Distance(e,t);const r=i.subtract(t),s=Math.max(0,Math.min(1,h.Dot(e.subtract(t),r)/n)),o=t.add(r.multiplyByFloats(s,s));return h.Distance(e,o)}}h._ZeroReadOnly=h.Zero();class _{constructor(e=0,t=0,i=0){this._isDirty=!0,this._x=e,this._y=t,this._z=i}get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z}}`}getClassName(){return"Vector3"}getHashCode(){let e=c(this._x);return e=397*e^c(this._y),e=397*e^c(this._z),e}asArray(){const e=[];return this.toArray(e,0),e}toArray(e,t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this}fromArray(e,t=0){return _.FromArrayToRef(e,t,this),this}toQuaternion(){return u.RotationYawPitchRoll(this._y,this._x,this._z)}addInPlace(e){return this.addInPlaceFromFloats(e._x,e._y,e._z)}addInPlaceFromFloats(e,t,i){return this.x+=e,this.y+=t,this.z+=i,this}add(e){return new _(this._x+e._x,this._y+e._y,this._z+e._z)}addToRef(e,t){return t.copyFromFloats(this._x+e._x,this._y+e._y,this._z+e._z)}subtractInPlace(e){return this.x-=e._x,this.y-=e._y,this.z-=e._z,this}subtract(e){return new _(this._x-e._x,this._y-e._y,this._z-e._z)}subtractToRef(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)}subtractFromFloats(e,t,i){return new _(this._x-e,this._y-t,this._z-i)}subtractFromFloatsToRef(e,t,i,n){return n.copyFromFloats(this._x-e,this._y-t,this._z-i)}negate(){return new _(-this._x,-this._y,-this._z)}negateInPlace(){return this.x*=-1,this.y*=-1,this.z*=-1,this}negateToRef(e){return e.copyFromFloats(-1*this._x,-1*this._y,-1*this._z)}scaleInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this}scale(e){return new _(this._x*e,this._y*e,this._z*e)}scaleToRef(e,t){return t.copyFromFloats(this._x*e,this._y*e,this._z*e)}_getNormalToRef(e){const t=this.length();let i=Math.acos(this.y/t);const n=Math.atan2(this.z,this.x);i>Math.PI/2?i-=Math.PI/2:i+=Math.PI/2;const r=t*Math.sin(i)*Math.cos(n),s=t*Math.cos(i),o=t*Math.sin(i)*Math.sin(n);return e.set(r,s,o),e}applyRotationQuaternionToRef(e,t){const i=e.w*this.x+e.y*this.z-e.z*this.y,n=e.w*this.y+e.z*this.x-e.x*this.z,r=e.w*this.z+e.x*this.y-e.y*this.x,s=-e.x*this.x-e.y*this.y-e.z*this.z;return t.x=i*e.w+s*-e.x+n*-e.z-r*-e.y,t.y=n*e.w+s*-e.y+r*-e.x-i*-e.z,t.z=r*e.w+s*-e.z+i*-e.y-n*-e.x,t}applyRotationQuaternionInPlace(e){return this.applyRotationQuaternionToRef(e,this)}applyRotationQuaternion(e){return this.applyRotationQuaternionToRef(e,_.Zero())}scaleAndAddToRef(e,t){return t.addInPlaceFromFloats(this._x*e,this._y*e,this._z*e)}projectOnPlane(e,t){const i=_.Zero();return this.projectOnPlaneToRef(e,t,i),i}projectOnPlaneToRef(e,t,i){const n=e.normal,r=e.d,s=f.Vector3[0];this.subtractToRef(t,s),s.normalize();const o=_.Dot(s,n);if(Math.abs(o)this._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this}isNonUniformWithinEpsilon(e){const t=Math.abs(this._x),i=Math.abs(this._y);if(!n.R.WithinEpsilon(t,i,e))return!0;const r=Math.abs(this._z);return!n.R.WithinEpsilon(t,r,e)||!n.R.WithinEpsilon(i,r,e)}get isNonUniform(){const e=Math.abs(this._x);return e!==Math.abs(this._y)||e!==Math.abs(this._z)}floor(){return new _(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))}fract(){return new _(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z}get hasAZeroComponent(){return this._x*this._y*this._z==0}normalize(){return this.normalizeFromLength(this.length())}reorderInPlace(e){return"xyz"===(e=e.toLowerCase())||(f.Vector3[0].copyFrom(this),["x","y","z"].forEach(((t,i)=>{this[t]=f.Vector3[0][e[i]]}))),this}rotateByQuaternionToRef(e,t){return e.toRotationMatrix(f.Matrix[0]),_.TransformCoordinatesToRef(this,f.Matrix[0],t),t}rotateByQuaternionAroundPointToRef(e,t,i){return this.subtractToRef(t,f.Vector3[0]),f.Vector3[0].rotateByQuaternionToRef(e,f.Vector3[0]),t.addToRef(f.Vector3[0],i),i}cross(e){return _.Cross(this,e)}normalizeFromLength(e){return 0===e||1===e?this:this.scaleInPlace(1/e)}normalizeToNew(){const e=new _(0,0,0);return this.normalizeToRef(e),e}normalizeToRef(e){const t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/t,e)}clone(){return new _(this._x,this._y,this._z)}copyFrom(e){return this.copyFromFloats(e._x,e._y,e._z)}copyFromFloats(e,t,i){return this.x=e,this.y=t,this.z=i,this}set(e,t,i){return this.copyFromFloats(e,t,i)}setAll(e){return this.x=this.y=this.z=e,this}static GetClipFactor(e,t,i,n){const r=_.Dot(e,i)-n;return r/(r-(_.Dot(t,i)-n))}static GetAngleBetweenVectors(e,t,i){const r=e.normalizeToRef(f.Vector3[1]),s=t.normalizeToRef(f.Vector3[2]);let o=_.Dot(r,s);o=n.R.Clamp(o,-1,1);const a=Math.acos(o),l=f.Vector3[3];return _.CrossToRef(r,s,l),_.Dot(l,i)>0?isNaN(a)?0:a:isNaN(a)?-Math.PI:-Math.acos(o)}static GetAngleBetweenVectorsOnPlane(e,t,i){f.Vector3[0].copyFrom(e);const r=f.Vector3[0];f.Vector3[1].copyFrom(t);const s=f.Vector3[1];f.Vector3[2].copyFrom(i);const o=f.Vector3[2],a=f.Vector3[3],l=f.Vector3[4];r.normalize(),s.normalize(),o.normalize(),_.CrossToRef(o,r,a),_.CrossToRef(a,o,l);const c=Math.atan2(_.Dot(s,a),_.Dot(s,l));return n.R.NormalizeRadians(c)}static PitchYawRollToMoveBetweenPointsToRef(e,t,i){const n=m.Vector3[0];return t.subtractToRef(e,n),i.y=Math.atan2(n.x,n.z)||0,i.x=Math.atan2(Math.sqrt(n.x**2+n.z**2),n.y)||0,i.z=0,i}static PitchYawRollToMoveBetweenPoints(e,t){const i=_.Zero();return _.PitchYawRollToMoveBetweenPointsToRef(e,t,i)}static SlerpToRef(e,t,i,s){i=n.R.Clamp(i,0,1);const o=f.Vector3[0],a=f.Vector3[1];o.copyFrom(e);const l=o.length();o.normalizeFromLength(l),a.copyFrom(t);const c=a.length();a.normalizeFromLength(c);const h=_.Dot(o,a);let d,u;if(h<1-r.kn){const e=Math.acos(h),t=1/Math.sin(e);d=Math.sin((1-i)*e)*t,u=Math.sin(i*e)*t}else d=1-i,u=i;o.scaleInPlace(d),a.scaleInPlace(u),s.copyFrom(o).addInPlace(a),s.scaleInPlace(n.R.Lerp(l,c,i))}static SmoothToRef(e,t,i,n,r){_.SlerpToRef(e,t,0===n?1:i/n,r)}static FromArray(e,t=0){return new _(e[t],e[t+1],e[t+2])}static FromFloatArray(e,t){return _.FromArray(e,t)}static FromArrayToRef(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2]}static FromFloatArrayToRef(e,t,i){return _.FromArrayToRef(e,t,i)}static FromFloatsToRef(e,t,i,n){n.copyFromFloats(e,t,i)}static Zero(){return new _(0,0,0)}static One(){return new _(1,1,1)}static Up(){return new _(0,1,0)}static get UpReadOnly(){return _._UpReadOnly}static get DownReadOnly(){return _._DownReadOnly}static get RightReadOnly(){return _._RightReadOnly}static get LeftReadOnly(){return _._LeftReadOnly}static get LeftHandedForwardReadOnly(){return _._LeftHandedForwardReadOnly}static get RightHandedForwardReadOnly(){return _._RightHandedForwardReadOnly}static get ZeroReadOnly(){return _._ZeroReadOnly}static Down(){return new _(0,-1,0)}static Forward(e=!1){return new _(0,0,e?-1:1)}static Backward(e=!1){return new _(0,0,e?1:-1)}static Right(){return new _(1,0,0)}static Left(){return new _(-1,0,0)}static TransformCoordinates(e,t){const i=_.Zero();return _.TransformCoordinatesToRef(e,t,i),i}static TransformCoordinatesToRef(e,t,i){_.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i)}static TransformCoordinatesFromFloatsToRef(e,t,i,n,r){const s=n.m,o=e*s[0]+t*s[4]+i*s[8]+s[12],a=e*s[1]+t*s[5]+i*s[9]+s[13],l=e*s[2]+t*s[6]+i*s[10]+s[14],c=1/(e*s[3]+t*s[7]+i*s[11]+s[15]);r.x=o*c,r.y=a*c,r.z=l*c}static TransformNormal(e,t){const i=_.Zero();return _.TransformNormalToRef(e,t,i),i}static TransformNormalToRef(e,t,i){this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i)}static TransformNormalFromFloatsToRef(e,t,i,n,r){const s=n.m;r.x=e*s[0]+t*s[4]+i*s[8],r.y=e*s[1]+t*s[5]+i*s[9],r.z=e*s[2]+t*s[6]+i*s[10]}static CatmullRom(e,t,i,n,r){const s=r*r,o=r*s,a=.5*(2*t._x+(-e._x+i._x)*r+(2*e._x-5*t._x+4*i._x-n._x)*s+(-e._x+3*t._x-3*i._x+n._x)*o),l=.5*(2*t._y+(-e._y+i._y)*r+(2*e._y-5*t._y+4*i._y-n._y)*s+(-e._y+3*t._y-3*i._y+n._y)*o),c=.5*(2*t._z+(-e._z+i._z)*r+(2*e._z-5*t._z+4*i._z-n._z)*s+(-e._z+3*t._z-3*i._z+n._z)*o);return new _(a,l,c)}static Clamp(e,t,i){const n=new _;return _.ClampToRef(e,t,i,n),n}static ClampToRef(e,t,i,n){let r=e._x;r=r>i._x?i._x:r,r=ri._y?i._y:s,s=si._z?i._z:o,o=o0&&I<0?(D.copyFrom(a),O=t,w=i):I>0&&M<0?(D.copyFrom(c),O=i,w=s):(D.copyFrom(l).scaleInPlace(-1),O=s,w=t);const F=f.Vector3[9],B=f.Vector3[4];if(O.subtractToRef(A,T),w.subtractToRef(A,F),_.CrossToRef(T,F,B),!(_.Dot(B,h)<0))return o.copyFrom(A),Math.abs(b*y);const N=f.Vector3[5];_.CrossToRef(D,B,N),N.normalize();const L=f.Vector3[9];L.copyFrom(O).subtractInPlace(A);const k=L.length();if(kthis.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this}floor(){return new d(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))}fract(){return new d(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}normalize(){const e=this.length();return 0===e?this:this.scaleInPlace(1/e)}toVector3(){return new _(this.x,this.y,this.z)}clone(){return new d(this.x,this.y,this.z,this.w)}copyFrom(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}copyFromFloats(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}set(e,t,i,n){return this.copyFromFloats(e,t,i,n)}setAll(e){return this.x=this.y=this.z=this.w=e,this}static FromArray(e,t){return t||(t=0),new d(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]}static FromFloatArrayToRef(e,t,i){d.FromArrayToRef(e,t,i)}static FromFloatsToRef(e,t,i,n,r){r.x=e,r.y=t,r.z=i,r.w=n}static Zero(){return new d(0,0,0,0)}static One(){return new d(1,1,1,1)}static get ZeroReadOnly(){return d._ZeroReadOnly}static Normalize(e){const t=d.Zero();return d.NormalizeToRef(e,t),t}static NormalizeToRef(e,t){t.copyFrom(e),t.normalize()}static Minimize(e,t){const i=e.clone();return i.minimizeInPlace(t),i}static Maximize(e,t){const i=e.clone();return i.maximizeInPlace(t),i}static Distance(e,t){return Math.sqrt(d.DistanceSquared(e,t))}static DistanceSquared(e,t){const i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return i*i+n*n+r*r+s*s}static Center(e,t){return d.CenterToRef(e,t,d.Zero())}static CenterToRef(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2,(e.w+t.w)/2)}static TransformCoordinates(e,t){const i=d.Zero();return d.TransformCoordinatesToRef(e,t,i),i}static TransformCoordinatesToRef(e,t,i){d.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i)}static TransformCoordinatesFromFloatsToRef(e,t,i,n,r){const s=n.m,o=e*s[0]+t*s[4]+i*s[8]+s[12],a=e*s[1]+t*s[5]+i*s[9]+s[13],l=e*s[2]+t*s[6]+i*s[10]+s[14],c=e*s[3]+t*s[7]+i*s[11]+s[15];r.x=o,r.y=a,r.z=l,r.w=c}static TransformNormal(e,t){const i=d.Zero();return d.TransformNormalToRef(e,t,i),i}static TransformNormalToRef(e,t,i){const n=t.m,r=e.x*n[0]+e.y*n[4]+e.z*n[8],s=e.x*n[1]+e.y*n[5]+e.z*n[9],o=e.x*n[2]+e.y*n[6]+e.z*n[10];i.x=r,i.y=s,i.z=o,i.w=e.w}static TransformNormalFromFloatsToRef(e,t,i,n,r,s){const o=r.m;s.x=e*o[0]+t*o[4]+i*o[8],s.y=e*o[1]+t*o[5]+i*o[9],s.z=e*o[2]+t*o[6]+i*o[10],s.w=n}static FromVector3(e,t=0){return new d(e._x,e._y,e._z,t)}}d._ZeroReadOnly=d.Zero();class u{constructor(e=0,t=0,i=0,n=1){this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=n}get x(){return this._x}set x(e){this._x=e,this._isDirty=!0}get y(){return this._y}set y(e){this._y=e,this._isDirty=!0}get z(){return this._z}set z(e){this._z=e,this._isDirty=!0}get w(){return this._w}set w(e){this._w=e,this._isDirty=!0}toString(){return`{X: ${this._x} Y: ${this._y} Z: ${this._z} W: ${this._w}}`}getClassName(){return"Quaternion"}getHashCode(){let e=c(this._x);return e=397*e^c(this._y),e=397*e^c(this._z),e=397*e^c(this._w),e}asArray(){return[this._x,this._y,this._z,this._w]}toArray(e,t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,this}equals(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w}equalsWithEpsilon(e,t=r.kn){return e&&n.R.WithinEpsilon(this._x,e._x,t)&&n.R.WithinEpsilon(this._y,e._y,t)&&n.R.WithinEpsilon(this._z,e._z,t)&&n.R.WithinEpsilon(this._w,e._w,t)}clone(){return new u(this._x,this._y,this._z,this._w)}copyFrom(e){return this.x=e._x,this.y=e._y,this.z=e._z,this.w=e._w,this}copyFromFloats(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}set(e,t,i,n){return this.copyFromFloats(e,t,i,n)}add(e){return new u(this._x+e._x,this._y+e._y,this._z+e._z,this._w+e._w)}addInPlace(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this}subtract(e){return new u(this._x-e._x,this._y-e._y,this._z-e._z,this._w-e._w)}subtractInPlace(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._w-=e._w,this}scale(e){return new u(this._x*e,this._y*e,this._z*e,this._w*e)}scaleToRef(e,t){return t.x=this._x*e,t.y=this._y*e,t.z=this._z*e,t.w=this._w*e,this}scaleInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}scaleAndAddToRef(e,t){return t.x+=this._x*e,t.y+=this._y*e,t.z+=this._z*e,t.w+=this._w*e,this}multiply(e){const t=new u(0,0,0,1);return this.multiplyToRef(e,t),t}multiplyToRef(e,t){const i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,n=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,r=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,s=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,n,r,s),this}multiplyInPlace(e){return this.multiplyToRef(e,this),this}conjugateToRef(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),this}conjugateInPlace(){return this.x*=-1,this.y*=-1,this.z*=-1,this}conjugate(){return new u(-this._x,-this._y,-this._z,this._w)}invert(){const e=this.conjugate(),t=this.lengthSquared();return 0==t||1==t||e.scaleInPlace(1/t),e}invertInPlace(){this.conjugateInPlace();const e=this.lengthSquared();return 0==e||1==e||this.scaleInPlace(1/e),this}lengthSquared(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this.lengthSquared())}normalize(){const e=this.length();if(0===e)return this;const t=1/e;return this.scaleInPlace(t),this}normalizeToNew(){const e=this.length();if(0===e)return this.clone();const t=1/e;return this.scale(t)}toEulerAngles(){const e=_.Zero();return this.toEulerAnglesToRef(e),e}toEulerAnglesToRef(e){const t=this._z,i=this._x,n=this._y,r=this._w,s=n*t-i*r,o=.4999999;if(s<-o)e.y=2*Math.atan2(n,r),e.x=Math.PI/2,e.z=0;else if(s>o)e.y=2*Math.atan2(n,r),e.x=-Math.PI/2,e.z=0;else{const o=r*r,a=t*t,l=i*i,c=n*n;e.z=Math.atan2(2*(i*n+t*r),-a-l+c+o),e.x=Math.asin(-2*s),e.y=Math.atan2(2*(t*i+n*r),a-l-c+o)}return this}toRotationMatrix(e){return p.FromQuaternionToRef(this,e),this}fromRotationMatrix(e){return u.FromRotationMatrixToRef(e,this),this}static FromRotationMatrix(e){const t=new u;return u.FromRotationMatrixToRef(e,t),t}static FromRotationMatrixToRef(e,t){const i=e.m,n=i[0],r=i[4],s=i[8],o=i[1],a=i[5],l=i[9],c=i[2],h=i[6],_=i[10],d=n+a+_;let u;d>0?(u=.5/Math.sqrt(d+1),t.w=.25/u,t.x=(h-l)*u,t.y=(s-c)*u,t.z=(o-r)*u):n>a&&n>_?(u=2*Math.sqrt(1+n-a-_),t.w=(h-l)/u,t.x=.25*u,t.y=(r+o)/u,t.z=(s+c)/u):a>_?(u=2*Math.sqrt(1+a-n-_),t.w=(s-c)/u,t.x=(r+o)/u,t.y=.25*u,t.z=(l+h)/u):(u=2*Math.sqrt(1+_-n-a),t.w=(o-r)/u,t.x=(s+c)/u,t.y=(l+h)/u,t.z=.25*u)}static RotationQuaternionFromOnto(e,t){const i=u.Zero();return u.RotationQuaternionFromOntoToRef(e,t,i)}static RotationQuaternionFromOntoToRef(e,t,i){const n=m.Vector3[0];_.CrossToRef(e,t,n),n.equals(_.ZeroReadOnly)&&e._getNormalToRef(n);const r=_.GetAngleBetweenVectors(e,t,n);return u.RotationAxisToRef(n,r,i)}static Dot(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w}static AreClose(e,t,i=.1){const n=u.Dot(e,t);return 1-n*n<=i}static SmoothToRef(e,t,i,r,s){let o=0===r?1:i/r;o=n.R.Clamp(o,0,1),u.SlerpToRef(e,t,o,s)}static Zero(){return new u(0,0,0,0)}static Inverse(e){return new u(-e._x,-e._y,-e._z,e._w)}static InverseToRef(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t}static Identity(){return new u(0,0,0,1)}static IsIdentity(e){return e&&0===e._x&&0===e._y&&0===e._z&&1===e._w}static RotationAxis(e,t){return u.RotationAxisToRef(e,t,new u)}static RotationAxisToRef(e,t,i){const n=Math.sin(t/2);return e.normalize(),i.w=Math.cos(t/2),i.x=e._x*n,i.y=e._y*n,i.z=e._z*n,i}static FromArray(e,t){return t||(t=0),new u(e[t],e[t+1],e[t+2],e[t+3])}static FromArrayToRef(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]}static FromEulerAngles(e,t,i){const n=new u;return u.RotationYawPitchRollToRef(t,e,i,n),n}static FromEulerAnglesToRef(e,t,i,n){return u.RotationYawPitchRollToRef(t,e,i,n),n}static FromEulerVector(e){const t=new u;return u.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromEulerVectorToRef(e,t){return u.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t}static FromUnitVectorsToRef(e,t,i){const n=_.Dot(e,t)+1;return nMath.abs(e.z)?i.set(-e.y,e.x,0,0):i.set(0,-e.z,e.y,0):(_.CrossToRef(e,t,m.Vector3[0]),i.set(m.Vector3[0].x,m.Vector3[0].y,m.Vector3[0].z,n)),i.normalize()}static RotationYawPitchRoll(e,t,i){const n=new u;return u.RotationYawPitchRollToRef(e,t,i,n),n}static RotationYawPitchRollToRef(e,t,i,n){const r=.5*i,s=.5*t,o=.5*e,a=Math.sin(r),l=Math.cos(r),c=Math.sin(s),h=Math.cos(s),_=Math.sin(o),d=Math.cos(o);n.x=d*c*l+_*h*a,n.y=_*h*l-d*c*a,n.z=d*h*a-_*c*l,n.w=d*h*l+_*c*a}static RotationAlphaBetaGamma(e,t,i){const n=new u;return u.RotationAlphaBetaGammaToRef(e,t,i,n),n}static RotationAlphaBetaGammaToRef(e,t,i,n){const r=.5*(i+e),s=.5*(i-e),o=.5*t;n.x=Math.cos(s)*Math.sin(o),n.y=Math.sin(s)*Math.sin(o),n.z=Math.sin(r)*Math.cos(o),n.w=Math.cos(r)*Math.cos(o)}static RotationQuaternionFromAxis(e,t,i){const n=new u(0,0,0,0);return u.RotationQuaternionFromAxisToRef(e,t,i,n),n}static RotationQuaternionFromAxisToRef(e,t,i,n){const r=f.Matrix[0];p.FromXYZAxesToRef(e.normalize(),t.normalize(),i.normalize(),r),u.FromRotationMatrixToRef(r,n)}static FromLookDirectionLH(e,t){const i=new u;return u.FromLookDirectionLHToRef(e,t,i),i}static FromLookDirectionLHToRef(e,t,i){const n=f.Matrix[0];p.LookDirectionLHToRef(e,t,n),u.FromRotationMatrixToRef(n,i)}static FromLookDirectionRH(e,t){const i=new u;return u.FromLookDirectionRHToRef(e,t,i),i}static FromLookDirectionRHToRef(e,t,i){const n=f.Matrix[0];return p.LookDirectionRHToRef(e,t,n),u.FromRotationMatrixToRef(n,i)}static Slerp(e,t,i){const n=u.Identity();return u.SlerpToRef(e,t,i,n),n}static SlerpToRef(e,t,i,n){let r,s,o=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,a=!1;if(o<0&&(a=!0,o=-o),o>.999999)s=1-i,r=a?-i:i;else{const e=Math.acos(o),t=1/Math.sin(e);s=Math.sin((1-i)*e)*t,r=a?-Math.sin(i*e)*t:Math.sin(i*e)*t}n.x=s*e._x+r*t._x,n.y=s*e._y+r*t._y,n.z=s*e._z+r*t._z,n.w=s*e._w+r*t._w}static Hermite(e,t,i,n,r){const s=r*r,o=r*s,a=2*o-3*s+1,l=-2*o+3*s,c=o-2*s+r,h=o-s,_=e._x*a+i._x*l+t._x*c+n._x*h,d=e._y*a+i._y*l+t._y*c+n._y*h,p=e._z*a+i._z*l+t._z*c+n._z*h,f=e._w*a+i._w*l+t._w*c+n._w*h;return new u(_,d,p,f)}static Hermite1stDerivative(e,t,i,n,r){const s=u.Zero();return this.Hermite1stDerivativeToRef(e,t,i,n,r,s),s}static Hermite1stDerivativeToRef(e,t,i,n,r,s){const o=r*r;s.x=6*(o-r)*e.x+(3*o-4*r+1)*t.x+6*(-o+r)*i.x+(3*o-2*r)*n.x,s.y=6*(o-r)*e.y+(3*o-4*r+1)*t.y+6*(-o+r)*i.y+(3*o-2*r)*n.y,s.z=6*(o-r)*e.z+(3*o-4*r+1)*t.z+6*(-o+r)*i.z+(3*o-2*r)*n.z,s.w=6*(o-r)*e.w+(3*o-4*r+1)*t.w+6*(-o+r)*i.w+(3*o-2*r)*n.w}}class p{constructor(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,a.Z.MatrixTrackPrecisionChange&&a.Z.MatrixTrackedMatrices.push(this),this._m=new a.Z.MatrixCurrentType(16),this.markAsUpdated()}static get Use64Bits(){return a.Z.MatrixUse64Bits}get m(){return this._m}markAsUpdated(){this.updateFlag=p._UpdateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0}_updateIdentityStatus(e,t=!1,i=!1,n=!0){this._isIdentity=e,this._isIdentity3x2=e||i,this._isIdentityDirty=!this._isIdentity&&t,this._isIdentity3x2Dirty=!this._isIdentity3x2&&n}isIdentity(){if(this._isIdentityDirty){this._isIdentityDirty=!1;const e=this._m;this._isIdentity=1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}return this._isIdentity}isIdentityAs3x2(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]||0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2}determinant(){if(!0===this._isIdentity)return 1;const e=this._m,t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],_=e[10],d=e[11],u=e[12],p=e[13],f=e[14],m=e[15],g=_*m-f*d,b=h*m-p*d,y=h*f-p*_,v=c*m-u*d,A=c*f-_*u,C=c*p-u*h;return t*+(o*g-a*b+l*y)+i*-(s*g-a*v+l*A)+n*+(s*b-o*v+l*C)+r*-(s*y-o*A+a*C)}toArray(){return this._m}asArray(){return this._m}invert(){return this.invertToRef(this),this}reset(){return p.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this}add(e){const t=new p;return this.addToRef(e,t),t}addToRef(e,t){const i=this._m,n=t._m,r=e.m;for(let e=0;e<16;e++)n[e]=i[e]+r[e];return t.markAsUpdated(),this}addToSelf(e){const t=this._m,i=e.m;for(let e=0;e<16;e++)t[e]+=i[e];return this.markAsUpdated(),this}invertToRef(e){if(!0===this._isIdentity)return p.IdentityToRef(e),this;const t=this._m,i=t[0],n=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8],_=t[9],d=t[10],u=t[11],f=t[12],m=t[13],g=t[14],b=t[15],y=d*b-g*u,v=_*b-m*u,A=_*g-m*d,C=h*b-f*u,S=h*g-d*f,x=h*m-f*_,T=+(a*y-l*v+c*A),E=-(o*y-l*C+c*S),R=+(o*v-a*C+c*x),P=-(o*A-a*S+l*x),I=i*T+n*E+r*R+s*P;if(0===I)return e.copyFrom(this),this;const M=1/I,D=l*b-g*c,O=a*b-m*c,w=a*g-m*l,F=o*b-f*c,B=o*g-f*l,N=o*m-f*a,L=l*u-d*c,k=a*u-_*c,V=a*d-_*l,U=o*u-h*c,G=o*d-h*l,j=o*_-h*a,W=-(n*y-r*v+s*A),z=+(i*y-r*C+s*S),H=-(i*v-n*C+s*x),X=+(i*A-n*S+r*x),Y=+(n*D-r*O+s*w),Q=-(i*D-r*F+s*B),q=+(i*O-n*F+s*N),K=-(i*w-n*B+r*N),Z=-(n*L-r*k+s*V),$=+(i*L-r*U+s*G),J=-(i*k-n*U+s*j),ee=+(i*V-n*G+r*j);return p.FromValuesToRef(T*M,W*M,Y*M,Z*M,E*M,z*M,Q*M,$*M,R*M,H*M,q*M,J*M,P*M,X*M,K*M,ee*M,e),this}addAtIndex(e,t){return this._m[e]+=t,this.markAsUpdated(),this}multiplyAtIndex(e,t){return this._m[e]*=t,this.markAsUpdated(),this}setTranslationFromFloats(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this.markAsUpdated(),this}addTranslationFromFloats(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this.markAsUpdated(),this}setTranslation(e){return this.setTranslationFromFloats(e._x,e._y,e._z)}getTranslation(){return new _(this._m[12],this._m[13],this._m[14])}getTranslationToRef(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],this}removeRotationAndScaling(){const e=this.m;return p.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e[12],e[13],e[14],e[15],this),this._updateIdentityStatus(0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]),this}multiply(e){const t=new p;return this.multiplyToRef(e,t),t}copyFrom(e){e.copyToArray(this._m);const t=e;return this.updateFlag=t.updateFlag,this._updateIdentityStatus(t._isIdentity,t._isIdentityDirty,t._isIdentity3x2,t._isIdentity3x2Dirty),this}copyToArray(e,t=0){const i=this._m;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],this}multiplyToRef(e,t){return this._isIdentity?(t.copyFrom(e),this):e._isIdentity?(t.copyFrom(this),this):(this.multiplyToArray(e,t._m,0),t.markAsUpdated(),this)}multiplyToArray(e,t,i){const n=this._m,r=e.m,s=n[0],o=n[1],a=n[2],l=n[3],c=n[4],h=n[5],_=n[6],d=n[7],u=n[8],p=n[9],f=n[10],m=n[11],g=n[12],b=n[13],y=n[14],v=n[15],A=r[0],C=r[1],S=r[2],x=r[3],T=r[4],E=r[5],R=r[6],P=r[7],I=r[8],M=r[9],D=r[10],O=r[11],w=r[12],F=r[13],B=r[14],N=r[15];return t[i]=s*A+o*T+a*I+l*w,t[i+1]=s*C+o*E+a*M+l*F,t[i+2]=s*S+o*R+a*D+l*B,t[i+3]=s*x+o*P+a*O+l*N,t[i+4]=c*A+h*T+_*I+d*w,t[i+5]=c*C+h*E+_*M+d*F,t[i+6]=c*S+h*R+_*D+d*B,t[i+7]=c*x+h*P+_*O+d*N,t[i+8]=u*A+p*T+f*I+m*w,t[i+9]=u*C+p*E+f*M+m*F,t[i+10]=u*S+p*R+f*D+m*B,t[i+11]=u*x+p*P+f*O+m*N,t[i+12]=g*A+b*T+y*I+v*w,t[i+13]=g*C+b*E+y*M+v*F,t[i+14]=g*S+b*R+y*D+v*B,t[i+15]=g*x+b*P+y*O+v*N,this}equals(e){const t=e;if(!t)return!1;if((this._isIdentity||t._isIdentity)&&!this._isIdentityDirty&&!t._isIdentityDirty)return this._isIdentity&&t._isIdentity;const i=this.m,n=t.m;return i[0]===n[0]&&i[1]===n[1]&&i[2]===n[2]&&i[3]===n[3]&&i[4]===n[4]&&i[5]===n[5]&&i[6]===n[6]&&i[7]===n[7]&&i[8]===n[8]&&i[9]===n[9]&&i[10]===n[10]&&i[11]===n[11]&&i[12]===n[12]&&i[13]===n[13]&&i[14]===n[14]&&i[15]===n[15]}clone(){const e=new p;return e.copyFrom(this),e}getClassName(){return"Matrix"}getHashCode(){let e=c(this._m[0]);for(let t=1;t<16;t++)e=397*e^c(this._m[t]);return e}decomposeToTransformNode(e){return e.rotationQuaternion=e.rotationQuaternion||new u,this.decompose(e.scaling,e.rotationQuaternion,e.position)}decompose(e,t,i,n){if(this._isIdentity)return i&&i.setAll(0),e&&e.setAll(1),t&&t.copyFromFloats(0,0,0,1),!0;const r=this._m;if(i&&i.copyFromFloats(r[12],r[13],r[14]),(e=e||f.Vector3[0]).x=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]),e.y=Math.sqrt(r[4]*r[4]+r[5]*r[5]+r[6]*r[6]),e.z=Math.sqrt(r[8]*r[8]+r[9]*r[9]+r[10]*r[10]),n){const t=n.scaling.x<0?-1:1,i=n.scaling.y<0?-1:1,r=n.scaling.z<0?-1:1;e.x*=t,e.y*=i,e.z*=r}else this.determinant()<=0&&(e.y*=-1);if(0===e._x||0===e._y||0===e._z)return t&&t.copyFromFloats(0,0,0,1),!1;if(t){const i=1/e._x,n=1/e._y,s=1/e._z;p.FromValuesToRef(r[0]*i,r[1]*i,r[2]*i,0,r[4]*n,r[5]*n,r[6]*n,0,r[8]*s,r[9]*s,r[10]*s,0,0,0,0,1,f.Matrix[0]),u.FromRotationMatrixToRef(f.Matrix[0],t)}return!0}getRow(e){if(e<0||e>3)return null;const t=4*e;return new d(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])}getRowToRef(e,t){if(e>=0&&e<3){const i=4*e;t.x=this._m[i+0],t.y=this._m[i+1],t.z=this._m[i+2],t.w=this._m[i+3]}return this}setRow(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)}transpose(){return p.Transpose(this)}transposeToRef(e){return p.TransposeToRef(this,e),this}setRowFromFloats(e,t,i,n,r){if(e<0||e>3)return this;const s=4*e;return this._m[s+0]=t,this._m[s+1]=i,this._m[s+2]=n,this._m[s+3]=r,this.markAsUpdated(),this}scale(e){const t=new p;return this.scaleToRef(e,t),t}scaleToRef(e,t){for(let i=0;i<16;i++)t._m[i]=this._m[i]*e;return t.markAsUpdated(),this}scaleAndAddToRef(e,t){for(let i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t.markAsUpdated(),this}toNormalMatrix(e){const t=f.Matrix[0];this.invertToRef(t),t.transposeToRef(e);const i=e._m;p.FromValuesToRef(i[0],i[1],i[2],0,i[4],i[5],i[6],0,i[8],i[9],i[10],0,0,0,0,1,e)}getRotationMatrix(){const e=new p;return this.getRotationMatrixToRef(e),e}getRotationMatrixToRef(e){const t=f.Vector3[0];if(!this.decompose(t))return p.IdentityToRef(e),this;const i=this._m,n=1/t._x,r=1/t._y,s=1/t._z;return p.FromValuesToRef(i[0]*n,i[1]*n,i[2]*n,0,i[4]*r,i[5]*r,i[6]*r,0,i[8]*s,i[9]*s,i[10]*s,0,0,0,0,1,e),this}toggleModelMatrixHandInPlace(){const e=this._m;e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this.markAsUpdated()}toggleProjectionMatrixHandInPlace(){const e=this._m;e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this.markAsUpdated()}static FromArray(e,t=0){const i=new p;return p.FromArrayToRef(e,t,i),i}static FromArrayToRef(e,t,i){for(let n=0;n<16;n++)i._m[n]=e[n+t];i.markAsUpdated()}static FromFloat32ArrayToRefScaled(e,t,i,n){for(let r=0;r<16;r++)n._m[r]=e[r+t]*i;n.markAsUpdated()}static get IdentityReadOnly(){return p._IdentityReadOnly}static FromValuesToRef(e,t,i,n,r,s,o,a,l,c,h,_,d,u,p,f,m){const g=m._m;g[0]=e,g[1]=t,g[2]=i,g[3]=n,g[4]=r,g[5]=s,g[6]=o,g[7]=a,g[8]=l,g[9]=c,g[10]=h,g[11]=_,g[12]=d,g[13]=u,g[14]=p,g[15]=f,m.markAsUpdated()}static FromValues(e,t,i,n,r,s,o,a,l,c,h,_,d,u,f,m){const g=new p,b=g._m;return b[0]=e,b[1]=t,b[2]=i,b[3]=n,b[4]=r,b[5]=s,b[6]=o,b[7]=a,b[8]=l,b[9]=c,b[10]=h,b[11]=_,b[12]=d,b[13]=u,b[14]=f,b[15]=m,g.markAsUpdated(),g}static Compose(e,t,i){const n=new p;return p.ComposeToRef(e,t,i,n),n}static ComposeToRef(e,t,i,n){const r=n._m,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,h=o+o,_=a+a,d=s*c,u=s*h,p=s*_,f=o*h,m=o*_,g=a*_,b=l*c,y=l*h,v=l*_,A=e._x,C=e._y,S=e._z;r[0]=(1-(f+g))*A,r[1]=(u+v)*A,r[2]=(p-y)*A,r[3]=0,r[4]=(u-v)*C,r[5]=(1-(d+g))*C,r[6]=(m+b)*C,r[7]=0,r[8]=(p+y)*S,r[9]=(m-b)*S,r[10]=(1-(d+f))*S,r[11]=0,r[12]=i._x,r[13]=i._y,r[14]=i._z,r[15]=1,n.markAsUpdated()}static Identity(){const e=p.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return e._updateIdentityStatus(!0),e}static IdentityToRef(e){p.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(!0)}static Zero(){const e=p.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e._updateIdentityStatus(!1),e}static RotationX(e){const t=new p;return p.RotationXToRef(e,t),t}static Invert(e){const t=new p;return e.invertToRef(t),t}static RotationXToRef(e,t){const i=Math.sin(e),n=Math.cos(e);p.FromValuesToRef(1,0,0,0,0,n,i,0,0,-i,n,0,0,0,0,1,t),t._updateIdentityStatus(1===n&&0===i)}static RotationY(e){const t=new p;return p.RotationYToRef(e,t),t}static RotationYToRef(e,t){const i=Math.sin(e),n=Math.cos(e);p.FromValuesToRef(n,0,-i,0,0,1,0,0,i,0,n,0,0,0,0,1,t),t._updateIdentityStatus(1===n&&0===i)}static RotationZ(e){const t=new p;return p.RotationZToRef(e,t),t}static RotationZToRef(e,t){const i=Math.sin(e),n=Math.cos(e);p.FromValuesToRef(n,i,0,0,-i,n,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(1===n&&0===i)}static RotationAxis(e,t){const i=new p;return p.RotationAxisToRef(e,t,i),i}static RotationAxisToRef(e,t,i){const n=Math.sin(-t),r=Math.cos(-t),s=1-r;e.normalize();const o=i._m;o[0]=e._x*e._x*s+r,o[1]=e._x*e._y*s-e._z*n,o[2]=e._x*e._z*s+e._y*n,o[3]=0,o[4]=e._y*e._x*s+e._z*n,o[5]=e._y*e._y*s+r,o[6]=e._y*e._z*s-e._x*n,o[7]=0,o[8]=e._z*e._x*s-e._y*n,o[9]=e._z*e._y*s+e._x*n,o[10]=e._z*e._z*s+r,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,i.markAsUpdated()}static RotationAlignToRef(e,t,i){const n=_.Dot(t,e),s=i._m;if(n<-1+r.kn)s[0]=-1,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=-1,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1,s[11]=0;else{const i=_.Cross(t,e),r=1/(1+n);s[0]=i._x*i._x*r+n,s[1]=i._y*i._x*r-i._z,s[2]=i._z*i._x*r+i._y,s[3]=0,s[4]=i._x*i._y*r+i._z,s[5]=i._y*i._y*r+n,s[6]=i._z*i._y*r-i._x,s[7]=0,s[8]=i._x*i._z*r-i._y,s[9]=i._y*i._z*r+i._x,s[10]=i._z*i._z*r+n,s[11]=0}s[12]=0,s[13]=0,s[14]=0,s[15]=1,i.markAsUpdated()}static RotationYawPitchRoll(e,t,i){const n=new p;return p.RotationYawPitchRollToRef(e,t,i,n),n}static RotationYawPitchRollToRef(e,t,i,n){u.RotationYawPitchRollToRef(e,t,i,f.Quaternion[0]),f.Quaternion[0].toRotationMatrix(n)}static Scaling(e,t,i){const n=new p;return p.ScalingToRef(e,t,i,n),n}static ScalingToRef(e,t,i,n){p.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1,n),n._updateIdentityStatus(1===e&&1===t&&1===i)}static Translation(e,t,i){const n=new p;return p.TranslationToRef(e,t,i,n),n}static TranslationToRef(e,t,i,n){p.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1,n),n._updateIdentityStatus(0===e&&0===t&&0===i)}static Lerp(e,t,i){const n=new p;return p.LerpToRef(e,t,i,n),n}static LerpToRef(e,t,i,n){const r=n._m,s=e.m,o=t.m;for(let e=0;e<16;e++)r[e]=s[e]*(1-i)+o[e]*i;n.markAsUpdated()}static DecomposeLerp(e,t,i){const n=new p;return p.DecomposeLerpToRef(e,t,i,n),n}static DecomposeLerpToRef(e,t,i,n){const r=f.Vector3[0],s=f.Quaternion[0],o=f.Vector3[1];e.decompose(r,s,o);const a=f.Vector3[2],l=f.Quaternion[1],c=f.Vector3[3];t.decompose(a,l,c);const h=f.Vector3[4];_.LerpToRef(r,a,i,h);const d=f.Quaternion[2];u.SlerpToRef(s,l,i,d);const m=f.Vector3[5];_.LerpToRef(o,c,i,m),p.ComposeToRef(h,d,m,n)}static LookAtLH(e,t,i){const n=new p;return p.LookAtLHToRef(e,t,i,n),n}static LookAtLHToRef(e,t,i,n){const r=f.Vector3[0],s=f.Vector3[1],o=f.Vector3[2];t.subtractToRef(e,o),o.normalize(),_.CrossToRef(i,o,r);const a=r.lengthSquared();0===a?r.x=1:r.normalizeFromLength(Math.sqrt(a)),_.CrossToRef(o,r,s),s.normalize();const l=-_.Dot(r,e),c=-_.Dot(s,e),h=-_.Dot(o,e);p.FromValuesToRef(r._x,s._x,o._x,0,r._y,s._y,o._y,0,r._z,s._z,o._z,0,l,c,h,1,n)}static LookAtRH(e,t,i){const n=new p;return p.LookAtRHToRef(e,t,i,n),n}static LookAtRHToRef(e,t,i,n){const r=f.Vector3[0],s=f.Vector3[1],o=f.Vector3[2];e.subtractToRef(t,o),o.normalize(),_.CrossToRef(i,o,r);const a=r.lengthSquared();0===a?r.x=1:r.normalizeFromLength(Math.sqrt(a)),_.CrossToRef(o,r,s),s.normalize();const l=-_.Dot(r,e),c=-_.Dot(s,e),h=-_.Dot(o,e);p.FromValuesToRef(r._x,s._x,o._x,0,r._y,s._y,o._y,0,r._z,s._z,o._z,0,l,c,h,1,n)}static LookDirectionLH(e,t){const i=new p;return p.LookDirectionLHToRef(e,t,i),i}static LookDirectionLHToRef(e,t,i){const n=f.Vector3[0];n.copyFrom(e),n.scaleInPlace(-1);const r=f.Vector3[1];_.CrossToRef(t,n,r),p.FromValuesToRef(r._x,r._y,r._z,0,t._x,t._y,t._z,0,n._x,n._y,n._z,0,0,0,0,1,i)}static LookDirectionRH(e,t){const i=new p;return p.LookDirectionRHToRef(e,t,i),i}static LookDirectionRHToRef(e,t,i){const n=f.Vector3[2];_.CrossToRef(t,e,n),p.FromValuesToRef(n._x,n._y,n._z,0,t._x,t._y,t._z,0,e._x,e._y,e._z,0,0,0,0,1,i)}static OrthoLH(e,t,i,n,r){const s=new p;return p.OrthoLHToRef(e,t,i,n,s,r),s}static OrthoLHToRef(e,t,i,n,r,s){const o=2/e,a=2/t,l=2/(n-i),c=-(n+i)/(n-i);p.FromValuesToRef(o,0,0,0,0,a,0,0,0,0,l,0,0,0,c,1,r),s&&r.multiplyToRef(g,r),r._updateIdentityStatus(1===o&&1===a&&1===l&&0===c)}static OrthoOffCenterLH(e,t,i,n,r,s,o){const a=new p;return p.OrthoOffCenterLHToRef(e,t,i,n,r,s,a,o),a}static OrthoOffCenterLHToRef(e,t,i,n,r,s,o,a){const l=2/(t-e),c=2/(n-i),h=2/(s-r),_=-(s+r)/(s-r),d=(e+t)/(e-t),u=(n+i)/(i-n);p.FromValuesToRef(l,0,0,0,0,c,0,0,0,0,h,0,d,u,_,1,o),a&&o.multiplyToRef(g,o),o.markAsUpdated()}static OrthoOffCenterRH(e,t,i,n,r,s,o){const a=new p;return p.OrthoOffCenterRHToRef(e,t,i,n,r,s,a,o),a}static OrthoOffCenterRHToRef(e,t,i,n,r,s,o,a){p.OrthoOffCenterLHToRef(e,t,i,n,r,s,o,a),o._m[10]*=-1}static PerspectiveLH(e,t,i,n,r,s=0){const o=new p,a=2*i/e,l=2*i/t,c=(n+i)/(n-i),h=-2*n*i/(n-i),_=Math.tan(s);return p.FromValuesToRef(a,0,0,0,0,l,0,_,0,0,c,1,0,0,h,0,o),r&&o.multiplyToRef(g,o),o._updateIdentityStatus(!1),o}static PerspectiveFovLH(e,t,i,n,r,s=0,o=!1){const a=new p;return p.PerspectiveFovLHToRef(e,t,i,n,a,!0,r,s,o),a}static PerspectiveFovLHToRef(e,t,i,n,r,s=!0,o,a=0,l=!1){const c=i,h=n,_=1/Math.tan(.5*e),d=s?_/t:_,u=s?_:_*t,f=l&&0===c?-1:0!==h?(h+c)/(h-c):1,m=l&&0===c?2*h:0!==h?-2*h*c/(h-c):-2*c,b=Math.tan(a);p.FromValuesToRef(d,0,0,0,0,u,0,b,0,0,f,1,0,0,m,0,r),o&&r.multiplyToRef(g,r),r._updateIdentityStatus(!1)}static PerspectiveFovReverseLHToRef(e,t,i,n,r,s=!0,o,a=0){const l=1/Math.tan(.5*e),c=s?l/t:l,h=s?l:l*t,_=Math.tan(a);p.FromValuesToRef(c,0,0,0,0,h,0,_,0,0,-i,1,0,0,1,0,r),o&&r.multiplyToRef(g,r),r._updateIdentityStatus(!1)}static PerspectiveFovRH(e,t,i,n,r,s=0,o=!1){const a=new p;return p.PerspectiveFovRHToRef(e,t,i,n,a,!0,r,s,o),a}static PerspectiveFovRHToRef(e,t,i,n,r,s=!0,o,a=0,l=!1){const c=i,h=n,_=1/Math.tan(.5*e),d=s?_/t:_,u=s?_:_*t,f=l&&0===c?1:0!==h?-(h+c)/(h-c):-1,m=l&&0===c?2*h:0!==h?-2*h*c/(h-c):-2*c,b=Math.tan(a);p.FromValuesToRef(d,0,0,0,0,u,0,b,0,0,f,-1,0,0,m,0,r),o&&r.multiplyToRef(g,r),r._updateIdentityStatus(!1)}static PerspectiveFovReverseRHToRef(e,t,i,n,r,s=!0,o,a=0){const l=1/Math.tan(.5*e),c=s?l/t:l,h=s?l:l*t,_=Math.tan(a);p.FromValuesToRef(c,0,0,0,0,h,0,_,0,0,-i,-1,0,0,-1,0,r),o&&r.multiplyToRef(g,r),r._updateIdentityStatus(!1)}static PerspectiveFovWebVRToRef(e,t,i,n,r=!1,s,o=0){const a=r?-1:1,l=Math.tan(e.upDegrees*Math.PI/180),c=Math.tan(e.downDegrees*Math.PI/180),h=Math.tan(e.leftDegrees*Math.PI/180),_=Math.tan(e.rightDegrees*Math.PI/180),d=2/(h+_),u=2/(l+c),p=Math.tan(o),f=n._m;f[0]=d,f[1]=f[2]=f[3]=f[4]=0,f[5]=u,f[6]=0,f[7]=p,f[8]=(h-_)*d*.5,f[9]=-(l-c)*u*.5,f[10]=-i/(t-i),f[11]=1*a,f[12]=f[13]=f[15]=0,f[14]=-2*i*t/(i-t),s&&n.multiplyToRef(g,n),n.markAsUpdated()}static GetFinalMatrix(e,t,i,n,r,s){const o=e.width,a=e.height,l=e.x,c=e.y,h=p.FromValues(o/2,0,0,0,0,-a/2,0,0,0,0,s-r,0,l+o/2,a/2+c,r,1),_=f.Matrix[0];return t.multiplyToRef(i,_),_.multiplyToRef(n,_),_.multiply(h)}static GetAsMatrix2x2(e){const t=e.m,i=[t[0],t[1],t[4],t[5]];return a.Z.MatrixUse64Bits?i:new Float32Array(i)}static GetAsMatrix3x3(e){const t=e.m,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return a.Z.MatrixUse64Bits?i:new Float32Array(i)}static Transpose(e){const t=new p;return p.TransposeToRef(e,t),t}static TransposeToRef(e,t){const i=t._m,n=e.m;i[0]=n[0],i[1]=n[4],i[2]=n[8],i[3]=n[12],i[4]=n[1],i[5]=n[5],i[6]=n[9],i[7]=n[13],i[8]=n[2],i[9]=n[6],i[10]=n[10],i[11]=n[14],i[12]=n[3],i[13]=n[7],i[14]=n[11],i[15]=n[15],t.markAsUpdated(),t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty)}static Reflection(e){const t=new p;return p.ReflectionToRef(e,t),t}static ReflectionToRef(e,t){e.normalize();const i=e.normal.x,n=e.normal.y,r=e.normal.z,s=-2*i,o=-2*n,a=-2*r;p.FromValuesToRef(s*i+1,o*i,a*i,0,s*n,o*n+1,a*n,0,s*r,o*r,a*r+1,0,s*e.d,o*e.d,a*e.d,1,t)}static FromXYZAxesToRef(e,t,i,n){p.FromValuesToRef(e._x,e._y,e._z,0,t._x,t._y,t._z,0,i._x,i._y,i._z,0,0,0,0,1,n)}static FromQuaternionToRef(e,t){const i=e._x*e._x,n=e._y*e._y,r=e._z*e._z,s=e._x*e._y,o=e._z*e._w,a=e._z*e._x,l=e._y*e._w,c=e._y*e._z,h=e._x*e._w;t._m[0]=1-2*(n+r),t._m[1]=2*(s+o),t._m[2]=2*(a-l),t._m[3]=0,t._m[4]=2*(s-o),t._m[5]=1-2*(r+i),t._m[6]=2*(c+h),t._m[7]=0,t._m[8]=2*(a+l),t._m[9]=2*(c-h),t._m[10]=1-2*(n+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t.markAsUpdated()}}p._UpdateFlagSeed=0,p._IdentityReadOnly=p.Identity();class f{}f.Vector3=s.B.BuildTuple(11,_.Zero),f.Matrix=s.B.BuildTuple(2,p.Identity),f.Quaternion=s.B.BuildTuple(3,u.Zero);class m{}m.Vector2=s.B.BuildTuple(3,h.Zero),m.Vector3=s.B.BuildTuple(13,_.Zero),m.Vector4=s.B.BuildTuple(3,d.Zero),m.Quaternion=s.B.BuildTuple(2,u.Zero),m.Matrix=s.B.BuildTuple(8,p.Identity),(0,o.H)("BABYLON.Vector2",h),(0,o.H)("BABYLON.Vector3",_),(0,o.H)("BABYLON.Vector4",d),(0,o.H)("BABYLON.Matrix",p);const g=p.FromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1)},"../../../node_modules/@babylonjs/core/Maths/math.vertexFormat.js":function(e,t,i){"use strict";i.d(t,{e:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js");class r{constructor(e=n.P.Zero(),t=n.P.Up(),i=n.FM.Zero()){this.position=e,this.normal=t,this.uv=i}clone(){return new r(this.position.clone(),this.normal.clone(),this.uv.clone())}}},"../../../node_modules/@babylonjs/core/Maths/math.viewport.js":function(e,t,i){"use strict";i.d(t,{l:function(){return n}});class n{constructor(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n}toGlobal(e,t){return new n(this.x*e,this.y*t,this.width*e,this.height*t)}toGlobalToRef(e,t,i){return i.x=this.x*e,i.y=this.y*t,i.width=this.width*e,i.height=this.height*t,this}clone(){return new n(this.x,this.y,this.width,this.height)}}},"../../../node_modules/@babylonjs/core/Maths/sphericalPolynomial.js":function(e,t,i){"use strict";i.d(t,{_:function(){return c},i:function(){return h}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.js");const s=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],o=[()=>1,e=>e.y,e=>e.z,e=>e.x,e=>e.x*e.y,e=>e.y*e.z,e=>3*e.z*e.z-1,e=>e.x*e.z,e=>e.x*e.x-e.y*e.y],a=(e,t)=>s[e]*o[e](t),l=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4];class c{constructor(){this.preScaled=!1,this.l00=n.P.Zero(),this.l1_1=n.P.Zero(),this.l10=n.P.Zero(),this.l11=n.P.Zero(),this.l2_2=n.P.Zero(),this.l2_1=n.P.Zero(),this.l20=n.P.Zero(),this.l21=n.P.Zero(),this.l22=n.P.Zero()}addLight(e,t,i){r.jp.Vector3[0].set(t.r,t.g,t.b);const n=r.jp.Vector3[0],s=r.jp.Vector3[1];n.scaleToRef(i,s),s.scaleToRef(a(0,e),r.jp.Vector3[2]),this.l00.addInPlace(r.jp.Vector3[2]),s.scaleToRef(a(1,e),r.jp.Vector3[2]),this.l1_1.addInPlace(r.jp.Vector3[2]),s.scaleToRef(a(2,e),r.jp.Vector3[2]),this.l10.addInPlace(r.jp.Vector3[2]),s.scaleToRef(a(3,e),r.jp.Vector3[2]),this.l11.addInPlace(r.jp.Vector3[2]),s.scaleToRef(a(4,e),r.jp.Vector3[2]),this.l2_2.addInPlace(r.jp.Vector3[2]),s.scaleToRef(a(5,e),r.jp.Vector3[2]),this.l2_1.addInPlace(r.jp.Vector3[2]),s.scaleToRef(a(6,e),r.jp.Vector3[2]),this.l20.addInPlace(r.jp.Vector3[2]),s.scaleToRef(a(7,e),r.jp.Vector3[2]),this.l21.addInPlace(r.jp.Vector3[2]),s.scaleToRef(a(8,e),r.jp.Vector3[2]),this.l22.addInPlace(r.jp.Vector3[2])}scaleInPlace(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)}convertIncidentRadianceToIrradiance(){this.l00.scaleInPlace(l[0]),this.l1_1.scaleInPlace(l[1]),this.l10.scaleInPlace(l[2]),this.l11.scaleInPlace(l[3]),this.l2_2.scaleInPlace(l[4]),this.l2_1.scaleInPlace(l[5]),this.l20.scaleInPlace(l[6]),this.l21.scaleInPlace(l[7]),this.l22.scaleInPlace(l[8])}convertIrradianceToLambertianRadiance(){this.scaleInPlace(1/Math.PI)}preScaleForRendering(){this.preScaled=!0,this.l00.scaleInPlace(s[0]),this.l1_1.scaleInPlace(s[1]),this.l10.scaleInPlace(s[2]),this.l11.scaleInPlace(s[3]),this.l2_2.scaleInPlace(s[4]),this.l2_1.scaleInPlace(s[5]),this.l20.scaleInPlace(s[6]),this.l21.scaleInPlace(s[7]),this.l22.scaleInPlace(s[8])}updateFromArray(e){return n.P.FromArrayToRef(e[0],0,this.l00),n.P.FromArrayToRef(e[1],0,this.l1_1),n.P.FromArrayToRef(e[2],0,this.l10),n.P.FromArrayToRef(e[3],0,this.l11),n.P.FromArrayToRef(e[4],0,this.l2_2),n.P.FromArrayToRef(e[5],0,this.l2_1),n.P.FromArrayToRef(e[6],0,this.l20),n.P.FromArrayToRef(e[7],0,this.l21),n.P.FromArrayToRef(e[8],0,this.l22),this}updateFromFloatsArray(e){return n.P.FromFloatsToRef(e[0],e[1],e[2],this.l00),n.P.FromFloatsToRef(e[3],e[4],e[5],this.l1_1),n.P.FromFloatsToRef(e[6],e[7],e[8],this.l10),n.P.FromFloatsToRef(e[9],e[10],e[11],this.l11),n.P.FromFloatsToRef(e[12],e[13],e[14],this.l2_2),n.P.FromFloatsToRef(e[15],e[16],e[17],this.l2_1),n.P.FromFloatsToRef(e[18],e[19],e[20],this.l20),n.P.FromFloatsToRef(e[21],e[22],e[23],this.l21),n.P.FromFloatsToRef(e[24],e[25],e[26],this.l22),this}static FromArray(e){return(new c).updateFromArray(e)}static FromPolynomial(e){const t=new c;return t.l00=e.xx.scale(.376127).add(e.yy.scale(.376127)).add(e.zz.scale(.376126)),t.l1_1=e.y.scale(.977204),t.l10=e.z.scale(.977204),t.l11=e.x.scale(.977204),t.l2_2=e.xy.scale(1.16538),t.l2_1=e.yz.scale(1.16538),t.l20=e.zz.scale(1.34567).subtract(e.xx.scale(.672834)).subtract(e.yy.scale(.672834)),t.l21=e.zx.scale(1.16538),t.l22=e.xx.scale(1.16538).subtract(e.yy.scale(1.16538)),t.l1_1.scaleInPlace(-1),t.l11.scaleInPlace(-1),t.l2_1.scaleInPlace(-1),t.l21.scaleInPlace(-1),t.scaleInPlace(Math.PI),t}}class h{constructor(){this.x=n.P.Zero(),this.y=n.P.Zero(),this.z=n.P.Zero(),this.xx=n.P.Zero(),this.yy=n.P.Zero(),this.zz=n.P.Zero(),this.xy=n.P.Zero(),this.yz=n.P.Zero(),this.zx=n.P.Zero()}get preScaledHarmonics(){return this._harmonics||(this._harmonics=c.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics}addAmbient(e){r.jp.Vector3[0].copyFromFloats(e.r,e.g,e.b);const t=r.jp.Vector3[0];this.xx.addInPlace(t),this.yy.addInPlace(t),this.zz.addInPlace(t)}scaleInPlace(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)}updateFromHarmonics(e){return this._harmonics=e,this.x.copyFrom(e.l11),this.x.scaleInPlace(1.02333).scaleInPlace(-1),this.y.copyFrom(e.l1_1),this.y.scaleInPlace(1.02333).scaleInPlace(-1),this.z.copyFrom(e.l10),this.z.scaleInPlace(1.02333),this.xx.copyFrom(e.l00),r.jp.Vector3[0].copyFrom(e.l20).scaleInPlace(.247708),r.jp.Vector3[1].copyFrom(e.l22).scaleInPlace(.429043),this.xx.scaleInPlace(.886277).subtractInPlace(r.jp.Vector3[0]).addInPlace(r.jp.Vector3[1]),this.yy.copyFrom(e.l00),this.yy.scaleInPlace(.886277).subtractInPlace(r.jp.Vector3[0]).subtractInPlace(r.jp.Vector3[1]),this.zz.copyFrom(e.l00),r.jp.Vector3[0].copyFrom(e.l20).scaleInPlace(.495417),this.zz.scaleInPlace(.886277).addInPlace(r.jp.Vector3[0]),this.yz.copyFrom(e.l2_1),this.yz.scaleInPlace(.858086).scaleInPlace(-1),this.zx.copyFrom(e.l21),this.zx.scaleInPlace(.858086).scaleInPlace(-1),this.xy.copyFrom(e.l2_2),this.xy.scaleInPlace(.858086),this.scaleInPlace(1/Math.PI),this}static FromHarmonics(e){return(new h).updateFromHarmonics(e)}static FromArray(e){const t=new h;return n.P.FromArrayToRef(e[0],0,t.x),n.P.FromArrayToRef(e[1],0,t.y),n.P.FromArrayToRef(e[2],0,t.z),n.P.FromArrayToRef(e[3],0,t.xx),n.P.FromArrayToRef(e[4],0,t.yy),n.P.FromArrayToRef(e[5],0,t.zz),n.P.FromArrayToRef(e[6],0,t.yz),n.P.FromArrayToRef(e[7],0,t.zx),n.P.FromArrayToRef(e[8],0,t.xy),t}}},"../../../node_modules/@babylonjs/core/Meshes/Builders/boxBuilder.js":function(e,t,i){"use strict";i.d(t,{NR:function(){return c},aR:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),s=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),o=i("../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js"),a=i("../../../node_modules/@babylonjs/core/Compat/compatibilityOptions.js");function l(e){let t=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23];const i=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],s=[];let l=[];const c=e.width||e.size||1,h=e.height||e.size||1,_=e.depth||e.size||1,d=e.wrap||!1;let u=void 0===e.topBaseAt?1:e.topBaseAt,p=void 0===e.bottomBaseAt?0:e.bottomBaseAt;u=(u+4)%4,p=(p+4)%4;let f=[2,0,3,1][u],m=[2,0,1,3][p],g=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(d){t=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],g=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];let e=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],i=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]];const n=[17,18,19,16],r=[22,23,20,21];for(;f>0;)e.unshift(e.pop()),n.unshift(n.pop()),f--;for(;m>0;)i.unshift(i.pop()),r.unshift(r.pop()),m--;e=e.flat(),i=i.flat(),g=g.concat(e).concat(i),t.push(n[0],n[2],n[3],n[0],n[1],n[2]),t.push(r[0],r[2],r[3],r[0],r[1],r[2])}const b=[c/2,h/2,_/2];l=g.reduce(((e,t,i)=>e.concat(t*b[i%3])),[]);const y=0===e.sideOrientation?0:e.sideOrientation||o.x.DEFAULTSIDE,v=e.faceUV||new Array(6),A=e.faceColors,C=[];for(let e=0;e<6;e++)void 0===v[e]&&(v[e]=new n.Lt(0,0,1,1)),A&&void 0===A[e]&&(A[e]=new r.HE(1,1,1,1));for(let e=0;e<6;e++)if(s.push(v[e].z,a.e.UseOpenGLOrientationForUV?1-v[e].w:v[e].w),s.push(v[e].x,a.e.UseOpenGLOrientationForUV?1-v[e].w:v[e].w),s.push(v[e].x,a.e.UseOpenGLOrientationForUV?1-v[e].y:v[e].y),s.push(v[e].z,a.e.UseOpenGLOrientationForUV?1-v[e].y:v[e].y),A)for(let t=0;t<4;t++)C.push(A[e].r,A[e].g,A[e].b,A[e].a);o.x._ComputeSides(y,l,t,i,s,e.frontUVs,e.backUVs);const S=new o.x;if(S.indices=t,S.positions=l,S.normals=i,S.uvs=s,A){const e=y===o.x.DOUBLESIDE?C.concat(C):C;S.colors=e}return S}function c(e,t={},i=null){const n=new s.Kj(e,i);return t.sideOrientation=s.Kj._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,l(t).applyToMesh(n,t.updatable),n}o.x.CreateBox=l,s.Kj.CreateBox=(e,t,i=null,n,r)=>c(e,{size:t,sideOrientation:r,updatable:n},i)},"../../../node_modules/@babylonjs/core/Meshes/Builders/icoSphereBuilder.js":function(e,t,i){"use strict";i.d(t,{Au:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),s=i("../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js"),o=i("../../../node_modules/@babylonjs/core/Compat/compatibilityOptions.js");function a(e){const t=e.sideOrientation||s.x.DEFAULTSIDE,i=e.radius||1,r=void 0===e.flat||e.flat,a=e.subdivisions||4,l=e.radiusX||i,c=e.radiusY||i,h=e.radiusZ||i,_=(1+Math.sqrt(5))/2,d=[-1,_,-0,1,_,0,-1,-_,0,1,-_,0,0,-1,-_,0,1,-_,0,-1,_,0,1,_,_,0,1,_,0,-1,-_,0,1,-_,0,-1],u=[0,11,5,0,5,1,0,1,7,0,7,10,12,22,23,1,5,20,5,11,4,23,22,13,22,18,6,7,1,8,14,21,4,14,4,2,16,13,6,15,6,19,3,8,9,4,21,5,13,17,23,6,13,22,19,6,18,9,8,1],p=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],f=[5,1,3,1,6,4,0,0,5,3,4,2,2,2,4,0,2,0,1,1,6,0,6,2,0,4,3,3,4,4,3,1,4,2,4,4,0,2,1,1,2,2,3,3,1,3,2,4],m=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],g=new Array,b=new Array,y=new Array,v=new Array;let A=0;const C=new Array(3),S=new Array(3);let x;for(x=0;x<3;x++)C[x]=n.P.Zero(),S[x]=n.FM.Zero();for(let e=0;e<20;e++){for(x=0;x<3;x++){const t=u[3*e+x];C[x].copyFromFloats(d[3*p[t]],d[3*p[t]+1],d[3*p[t]+2]),C[x].normalize(),S[x].copyFromFloats(.134765625*f[2*t]+.05859375+-.0390625*m[e],.2333984375*f[2*t+1]+.025390625+.01953125*m[e])}const t=(e,t,i,s)=>{const _=n.P.Lerp(C[0],C[2],t/a),d=n.P.Lerp(C[1],C[2],t/a),u=a===t?C[2]:n.P.Lerp(_,d,e/(a-t));let p;if(u.normalize(),r){const e=n.P.Lerp(C[0],C[2],s/a),t=n.P.Lerp(C[1],C[2],s/a);p=n.P.Lerp(e,t,i/(a-s))}else p=new n.P(u.x,u.y,u.z);p.x/=l,p.y/=c,p.z/=h,p.normalize();const f=n.FM.Lerp(S[0],S[2],t/a),m=n.FM.Lerp(S[1],S[2],t/a),x=a===t?S[2]:n.FM.Lerp(f,m,e/(a-t));b.push(u.x*l,u.y*c,u.z*h),y.push(p.x,p.y,p.z),v.push(x.x,o.e.UseOpenGLOrientationForUV?1-x.y:x.y),g.push(A),A++};for(let e=0;el(e,t,i)},"../../../node_modules/@babylonjs/core/Meshes/Builders/planeBuilder.js":function(e,t,i){"use strict";i.d(t,{pT:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),r=i("../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js"),s=i("../../../node_modules/@babylonjs/core/Compat/compatibilityOptions.js");function o(e){const t=[],i=[],n=[],o=[],a=e.width||e.size||1,l=e.height||e.size||1,c=0===e.sideOrientation?0:e.sideOrientation||r.x.DEFAULTSIDE,h=a/2,_=l/2;i.push(-h,-_,0),n.push(0,0,-1),o.push(0,s.e.UseOpenGLOrientationForUV?1:0),i.push(h,-_,0),n.push(0,0,-1),o.push(1,s.e.UseOpenGLOrientationForUV?1:0),i.push(h,_,0),n.push(0,0,-1),o.push(1,s.e.UseOpenGLOrientationForUV?0:1),i.push(-h,_,0),n.push(0,0,-1),o.push(0,s.e.UseOpenGLOrientationForUV?0:1),t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),r.x._ComputeSides(c,i,t,n,o,e.frontUVs,e.backUVs);const d=new r.x;return d.indices=t,d.positions=i,d.normals=n,d.uvs=o,d}function a(e,t={},i=null){const r=new n.Kj(e,i);return t.sideOrientation=n.Kj._GetDefaultSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,o(t).applyToMesh(r,t.updatable),t.sourcePlane&&(r.translate(t.sourcePlane.normal,-t.sourcePlane.d),r.setDirection(t.sourcePlane.normal.scale(-1))),r}r.x.CreatePlane=o,n.Kj.CreatePlane=(e,t,i,n,r)=>a(e,{size:t,width:t,height:t,sideOrientation:r,updatable:n},i)},"../../../node_modules/@babylonjs/core/Meshes/Compression/dracoCompression.js":function(e,t,i){"use strict";i.d(t,{J:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),r=i("../../../node_modules/@babylonjs/core/Misc/workerPool.js"),s=i("../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js");function o(e,t,i,n,r,s){const o=new e.DecoderBuffer;o.Init(t,t.byteLength);const a=new e.Decoder;let l,c;try{const t=a.GetEncodedGeometryType(o);switch(t){case e.TRIANGULAR_MESH:l=new e.Mesh,c=a.DecodeBufferToMesh(o,l);break;case e.POINT_CLOUD:l=new e.PointCloud,c=a.DecodeBufferToPointCloud(o,l);break;default:throw new Error(`Invalid geometry type ${t}`)}if(!c.ok()||!l.ptr)throw new Error(c.error_msg());if(t===e.TRIANGULAR_MESH){const t=3*l.num_faces(),i=4*t,r=e._malloc(i);try{a.GetTrianglesUInt32Array(l,i,r);const s=new Uint32Array(t);s.set(new Uint32Array(e.HEAPF32.buffer,r,t)),n(s)}finally{e._free(r)}}const h=(t,i,n=1)=>{const s=i.num_components(),o=l.num_points(),c=o*s,h=c*Float32Array.BYTES_PER_ELEMENT,_=e._malloc(h);try{a.GetAttributeDataArrayForAllPoints(l,i,e.DT_FLOAT32,h,_);const d=new Float32Array(e.HEAPF32.buffer,_,c);if("color"===t&&3===s){const e=new Float32Array(4*o);for(let t=0,i=0;t{const i=t.data;switch(i.id){case"init":{const t=i.decoder;t.url&&(importScripts(t.url),e=DracoDecoderModule({wasmBinary:t.wasmBinary})),postMessage("done");break}case"decodeMesh":if(!e)throw new Error("Draco decoder module is not available");e.then((e=>{o(e,i.dataView,i.attributes,(e=>{postMessage({id:"indices",value:e},[e.buffer])}),((e,t)=>{postMessage({id:e,value:t},[t.buffer])})),postMessage("done")}))}}}class l{constructor(e=l.DefaultNumWorkers){const t=l.Configuration.decoder,i=t.wasmUrl&&t.wasmBinaryUrl&&"object"==typeof WebAssembly?{url:n.w1.GetAbsoluteUrl(t.wasmUrl),wasmBinaryPromise:n.w1.LoadFileAsync(n.w1.GetAbsoluteUrl(t.wasmBinaryUrl))}:{url:n.w1.GetAbsoluteUrl(t.fallbackUrl),wasmBinaryPromise:Promise.resolve(void 0)};e&&"function"==typeof Worker&&"function"==typeof URL?this._workerPoolPromise=i.wasmBinaryPromise.then((t=>{const n=`${o}(${a})()`,s=URL.createObjectURL(new Blob([n],{type:"application/javascript"}));return new r.v(e,(()=>new Promise(((e,n)=>{const r=new Worker(s),o=e=>{r.removeEventListener("error",o),r.removeEventListener("message",a),n(e)},a=t=>{"done"===t.data&&(r.removeEventListener("error",o),r.removeEventListener("message",a),e(r))};r.addEventListener("error",o),r.addEventListener("message",a),r.postMessage({id:"init",decoder:{url:i.url,wasmBinary:t}})}))))})):this._decoderModulePromise=i.wasmBinaryPromise.then((e=>{if(!i.url)throw new Error("Draco decoder module is not available");return n.w1.LoadScriptAsync(i.url).then((()=>{return t=e,new Promise((e=>{DracoDecoderModule({wasmBinary:t}).then((t=>{e({module:t})}))}));var t}))}))}static get DecoderAvailable(){const e=l.Configuration.decoder;return!!(e.wasmUrl&&e.wasmBinaryUrl&&"object"==typeof WebAssembly||e.fallbackUrl)}static GetDefaultNumWorkers(){return"object"==typeof navigator&&navigator.hardwareConcurrency?Math.min(Math.floor(.5*navigator.hardwareConcurrency),4):1}static get Default(){return l._Default||(l._Default=new l),l._Default}dispose(){this._workerPoolPromise&&this._workerPoolPromise.then((e=>{e.dispose()})),delete this._workerPoolPromise,delete this._decoderModulePromise}whenReadyAsync(){return this._workerPoolPromise?this._workerPoolPromise.then((()=>{})):this._decoderModulePromise?this._decoderModulePromise.then((()=>{})):Promise.resolve()}decodeMeshAsync(e,t,i){const n=e instanceof ArrayBuffer?new Uint8Array(e):e;if(this._workerPoolPromise)return this._workerPoolPromise.then((e=>new Promise(((r,o)=>{e.push(((e,a)=>{const l=new s.x,c=t=>{e.removeEventListener("error",c),e.removeEventListener("message",h),o(t),a()},h=t=>{if("done"===t.data)e.removeEventListener("error",c),e.removeEventListener("message",h),r(l),a();else if("indices"===t.data.id)l.indices=t.data.value;else{const e=i&&i[t.data.id]?i[t.data.id]:1;if(1!==e)for(let i=0;i{const r=new s.x;return o(e.module,n,t,(e=>{r.indices=e}),((e,t)=>{r.set(t,e)}),i),r}));throw new Error("Draco decoder module is not available")}}l.Configuration={decoder:{wasmUrl:"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js",wasmBinaryUrl:"https://preview.babylonjs.com/draco_decoder_gltf.wasm",fallbackUrl:"https://preview.babylonjs.com/draco_decoder_gltf.js"}},l.DefaultNumWorkers=l.GetDefaultNumWorkers(),l._Default=null},"../../../node_modules/@babylonjs/core/Meshes/Compression/meshoptCompression.js":function(e,t,i){"use strict";i.d(t,{K:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Misc/tools.js");class r{constructor(){const e=r.Configuration.decoder;this._decoderModulePromise=n.w1.LoadScriptAsync(n.w1.GetAbsoluteUrl(e.url)).then((()=>MeshoptDecoder.ready))}static get Default(){return r._Default||(r._Default=new r),r._Default}dispose(){delete this._decoderModulePromise}decodeGltfBufferAsync(e,t,i,n,r){return this._decoderModulePromise.then((()=>{const s=new Uint8Array(t*i);return MeshoptDecoder.decodeGltfBuffer(s,t,i,e,n,r),s}))}}r.Configuration={decoder:{url:"https://preview.babylonjs.com/meshopt_decoder.js"}},r._Default=null},"../../../node_modules/@babylonjs/core/Meshes/WebGL/webGLDataBuffer.js":function(e,t,i){"use strict";i.d(t,{M:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Buffers/dataBuffer.js");class r extends n.h{constructor(e){super(),this._buffer=e}get underlyingResource(){return this._buffer}}},"../../../node_modules/@babylonjs/core/Meshes/abstractMesh.js":function(e,t,i){"use strict";i.d(t,{x:function(){return C}});var n=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),r=i("../../../node_modules/@babylonjs/core/scene.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Engines/engine.js"),a=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),l=i("../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js"),c=i("../../../node_modules/@babylonjs/core/Meshes/transformNode.js"),h=i("../../../node_modules/@babylonjs/core/Collisions/pickingInfo.js"),_=i("../../../node_modules/@babylonjs/core/Culling/boundingInfo.js"),d=i("../../../node_modules/@babylonjs/core/Materials/uniformBuffer.js"),u=i("../../../node_modules/@babylonjs/core/Collisions/meshCollisionData.js"),p=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),f=i("../../../node_modules/@babylonjs/core/Maths/math.functions.js"),m=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),g=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js"),b=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js"),y=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class v{constructor(){this.facetNb=0,this.partitioningSubdivisions=10,this.partitioningBBoxRatio=1.01,this.facetDataEnabled=!1,this.facetParameters={},this.bbSize=s.P.Zero(),this.subDiv={max:1,X:1,Y:1,Z:1},this.facetDepthSort=!1,this.facetDepthSortEnabled=!1}}class A{constructor(){this._hasVertexAlpha=!1,this._useVertexColors=!0,this._numBoneInfluencers=4,this._applyFog=!0,this._receiveShadows=!1,this._facetData=new v,this._visibility=1,this._skeleton=null,this._layerMask=268435455,this._computeBonesUsingShaders=!0,this._isActive=!1,this._onlyForInstances=!1,this._isActiveIntermediate=!1,this._onlyForInstancesIntermediate=!1,this._actAsRegularMesh=!1,this._currentLOD=null,this._currentLODIsUpToDate=!1,this._collisionRetryCount=3,this._morphTargetManager=null,this._renderingGroupId=0,this._bakedVertexAnimationManager=null,this._material=null,this._positions=null,this._pointerOverDisableMeshTesting=!1,this._meshCollisionData=new u.a,this._enableDistantPicking=!1}}class C extends c.Y{constructor(e,t=null){switch(super(e,t,!1),this._internalAbstractMeshDataInfo=new A,this._waitingMaterialId=null,this.cullingStrategy=C.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,this.onCollideObservable=new n.y$,this.onCollisionPositionChangeObservable=new n.y$,this.onMaterialChangedObservable=new n.y$,this.definedFacingForward=!0,this._occlusionQuery=null,this._renderingGroup=null,this.alphaIndex=Number.MAX_VALUE,this.isVisible=!0,this.isPickable=!0,this.isNearPickable=!1,this.isNearGrabbable=!1,this.showSubMeshesBoundingBox=!1,this.isBlocker=!1,this.enablePointerMoveEvents=!1,this.outlineColor=m.Wo.Red(),this.outlineWidth=.02,this.overlayColor=m.Wo.Red(),this.overlayAlpha=.5,this.useOctreeForRenderingSelection=!0,this.useOctreeForPicking=!0,this.useOctreeForCollisions=!0,this.alwaysSelectAsActiveMesh=!1,this.doNotSyncBoundingInfo=!1,this.actionManager=null,this.ellipsoid=new s.P(.5,1,.5),this.ellipsoidOffset=new s.P(0,0,0),this.edgesWidth=1,this.edgesColor=new m.HE(1,0,0,1),this._edgesRenderer=null,this._masterMesh=null,this._boundingInfo=null,this._boundingInfoIsDirty=!0,this._renderId=0,this._intersectionsInProgress=new Array,this._unIndexed=!1,this._lightSources=new Array,this._waitingData={lods:null,actions:null,freezeWorldMatrix:null},this._bonesTransformMatrices=null,this._transformMatrixTexture=null,this.onRebuildObservable=new n.y$,this._onCollisionPositionChange=(e,t,i=null)=>{t.subtractToRef(this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions,this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions.length()>o.D.CollisionsEpsilon&&this.position.addInPlace(this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),i&&this.onCollideObservable.notifyObservers(i),this.onCollisionPositionChangeObservable.notifyObservers(this.position)},(t=this.getScene()).addMesh(this),this._resyncLightSources(),this._uniformBuffer=new d.M(this.getScene().getEngine(),void 0,void 0,e,!this.getScene().getEngine().isWebGPU),this._buildUniformLayout(),t.performancePriority){case r.a.Aggressive:this.doNotSyncBoundingInfo=!0;case r.a.Intermediate:this.alwaysSelectAsActiveMesh=!0,this.isPickable=!1}}static get BILLBOARDMODE_NONE(){return c.Y.BILLBOARDMODE_NONE}static get BILLBOARDMODE_X(){return c.Y.BILLBOARDMODE_X}static get BILLBOARDMODE_Y(){return c.Y.BILLBOARDMODE_Y}static get BILLBOARDMODE_Z(){return c.Y.BILLBOARDMODE_Z}static get BILLBOARDMODE_ALL(){return c.Y.BILLBOARDMODE_ALL}static get BILLBOARDMODE_USE_POSITION(){return c.Y.BILLBOARDMODE_USE_POSITION}get facetNb(){return this._internalAbstractMeshDataInfo._facetData.facetNb}get partitioningSubdivisions(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions}set partitioningSubdivisions(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e}get partitioningBBoxRatio(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio}set partitioningBBoxRatio(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e}get mustDepthSortFacets(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort}set mustDepthSortFacets(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e}get facetDepthSortFrom(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom}set facetDepthSortFrom(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e}get collisionRetryCount(){return this._internalAbstractMeshDataInfo._collisionRetryCount}set collisionRetryCount(e){this._internalAbstractMeshDataInfo._collisionRetryCount=e}get isFacetDataEnabled(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled}get morphTargetManager(){return this._internalAbstractMeshDataInfo._morphTargetManager}set morphTargetManager(e){this._internalAbstractMeshDataInfo._morphTargetManager!==e&&(this._internalAbstractMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())}get bakedVertexAnimationManager(){return this._internalAbstractMeshDataInfo._bakedVertexAnimationManager}set bakedVertexAnimationManager(e){this._internalAbstractMeshDataInfo._bakedVertexAnimationManager!==e&&(this._internalAbstractMeshDataInfo._bakedVertexAnimationManager=e,this._markSubMeshesAsAttributesDirty())}_syncGeometryWithMorphTargetManager(){}_updateNonUniformScalingState(e){return!!super._updateNonUniformScalingState(e)&&(this._markSubMeshesAsMiscDirty(),!0)}set onCollide(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)}set onCollisionPositionChange(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)}get visibility(){return this._internalAbstractMeshDataInfo._visibility}set visibility(e){if(this._internalAbstractMeshDataInfo._visibility===e)return;const t=this._internalAbstractMeshDataInfo._visibility;this._internalAbstractMeshDataInfo._visibility=e,(1===t&&1!==e||1!==t&&1===e)&&this._markSubMeshesAsMiscDirty()}get pointerOverDisableMeshTesting(){return this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting}set pointerOverDisableMeshTesting(e){this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting=e}get renderingGroupId(){return this._internalAbstractMeshDataInfo._renderingGroupId}set renderingGroupId(e){this._internalAbstractMeshDataInfo._renderingGroupId=e}get material(){return this._internalAbstractMeshDataInfo._material}set material(e){this._internalAbstractMeshDataInfo._material!==e&&(this._internalAbstractMeshDataInfo._material&&this._internalAbstractMeshDataInfo._material.meshMap&&(this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId]=void 0),this._internalAbstractMeshDataInfo._material=e,e&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers()&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&(this.resetDrawCache(),this._unBindEffect()))}getMaterialForRenderPass(e){var t;return null===(t=this._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===t?void 0:t[e]}setMaterialForRenderPass(e,t){this.resetDrawCache(e),this._internalAbstractMeshDataInfo._materialForRenderPass||(this._internalAbstractMeshDataInfo._materialForRenderPass=[]),this._internalAbstractMeshDataInfo._materialForRenderPass[e]=t}get receiveShadows(){return this._internalAbstractMeshDataInfo._receiveShadows}set receiveShadows(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())}get hasVertexAlpha(){return this._internalAbstractMeshDataInfo._hasVertexAlpha}set hasVertexAlpha(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())}get useVertexColors(){return this._internalAbstractMeshDataInfo._useVertexColors}set useVertexColors(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())}get computeBonesUsingShaders(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders}set computeBonesUsingShaders(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())}get numBoneInfluencers(){return this._internalAbstractMeshDataInfo._numBoneInfluencers}set numBoneInfluencers(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())}get applyFog(){return this._internalAbstractMeshDataInfo._applyFog}set applyFog(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())}get enableDistantPicking(){return this._internalAbstractMeshDataInfo._enableDistantPicking}set enableDistantPicking(e){this._internalAbstractMeshDataInfo._enableDistantPicking=e}get layerMask(){return this._internalAbstractMeshDataInfo._layerMask}set layerMask(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())}get collisionMask(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask}set collisionMask(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask=isNaN(e)?-1:e}get collisionResponse(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse}set collisionResponse(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse=e}get collisionGroup(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup}set collisionGroup(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup=isNaN(e)?-1:e}get surroundingMeshes(){return this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes}set surroundingMeshes(e){this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes=e}get lightSources(){return this._lightSources}get _positions(){return null}set skeleton(e){const t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()}get skeleton(){return this._internalAbstractMeshDataInfo._skeleton}_buildUniformLayout(){this._uniformBuffer.addUniform("world",16),this._uniformBuffer.addUniform("visibility",1),this._uniformBuffer.create()}transferToEffect(e){const t=this._uniformBuffer;t.updateMatrix("world",e),t.updateFloat("visibility",this._internalAbstractMeshDataInfo._visibility),t.update()}getMeshUniformBuffer(){return this._uniformBuffer}getClassName(){return"AbstractMesh"}toString(e){let t="Name: "+this.name+", isInstance: "+("InstancedMesh"!==this.getClassName()?"YES":"NO");t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0);const i=this._internalAbstractMeshDataInfo._skeleton;return i&&(t+=", skeleton: "+i.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],t+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?"YES":"NO")),t}_getEffectiveParent(){return this._masterMesh&&this.billboardMode!==c.Y.BILLBOARDMODE_NONE?this._masterMesh:super._getEffectiveParent()}_getActionManagerForTrigger(e,t=!0){if(this.actionManager&&(t||this.actionManager.isRecursive)){if(!e)return this.actionManager;if(this.actionManager.hasSpecificTrigger(e))return this.actionManager}return this.parent?this.parent._getActionManagerForTrigger(e,!1):null}_rebuild(e=!1){if(this.onRebuildObservable.notifyObservers(this),null!==this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(const e of this.subMeshes)e._rebuild()}_resyncLightSources(){this._lightSources.length=0;for(const e of this.getScene().lights)e.isEnabled()&&e.canAffectMesh(this)&&this._lightSources.push(e);this._markSubMeshesAsLightDirty()}_resyncLightSource(e){const t=e.isEnabled()&&e.canAffectMesh(this),i=this._lightSources.indexOf(e);let n=!1;if(-1===i){if(!t)return;this._lightSources.push(e)}else{if(t)return;n=!0,this._lightSources.splice(i,1)}this._markSubMeshesAsLightDirty(n)}_unBindEffect(){for(const e of this.subMeshes)e.setEffect(null)}_removeLightSource(e,t){const i=this._lightSources.indexOf(e);-1!==i&&(this._lightSources.splice(i,1),this._markSubMeshesAsLightDirty(t))}_markSubMeshesAsDirty(e){if(this.subMeshes)for(const t of this.subMeshes)for(let i=0;it.markAsLightDirty(e)))}_markSubMeshesAsAttributesDirty(){this._markSubMeshesAsDirty((e=>e.markAsAttributesDirty()))}_markSubMeshesAsMiscDirty(){this._markSubMeshesAsDirty((e=>e.markAsMiscDirty()))}markAsDirty(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this}resetDrawCache(e){if(this.subMeshes)for(const t of this.subMeshes)t.resetDrawCache(e)}get isBlocked(){return!1}getLOD(e){return this}getTotalVertices(){return 0}getTotalIndices(){return 0}getIndices(){return null}getVerticesData(e){return null}setVerticesData(e,t,i,n){return this}updateVerticesData(e,t,i,n){return this}setIndices(e,t){return this}isVerticesDataPresent(e){return!1}getBoundingInfo(){return this._masterMesh?this._masterMesh.getBoundingInfo():(this._boundingInfoIsDirty&&(this._boundingInfoIsDirty=!1,this._updateBoundingInfo()),this._boundingInfo)}setBoundingInfo(e){return this._boundingInfo=e,this}get hasBoundingInfo(){return null!==this._boundingInfo}buildBoundingInfo(e,t,i){return this._boundingInfo=new _.j(e,t,i),this._boundingInfo}normalizeToUnitCube(e=!0,t=!1,i){return super.normalizeToUnitCube(e,t,i)}get useBones(){return this.skeleton&&this.getScene().skeletonsEnabled&&this.isVerticesDataPresent(a.o.MatricesIndicesKind)&&this.isVerticesDataPresent(a.o.MatricesWeightsKind)}_preActivate(){}_preActivateForIntermediateRendering(e){}_activate(e,t){return this._renderId=e,!0}_postActivate(){}_freeze(){}_unFreeze(){}getWorldMatrix(){return this._masterMesh&&this.billboardMode===c.Y.BILLBOARDMODE_NONE?this._masterMesh.getWorldMatrix():super.getWorldMatrix()}_getWorldMatrixDeterminant(){return this._masterMesh?this._masterMesh._getWorldMatrixDeterminant():super._getWorldMatrixDeterminant()}get isAnInstance(){return!1}get hasInstances(){return!1}get hasThinInstances(){return!1}movePOV(e,t,i){return this.position.addInPlace(this.calcMovePOV(e,t,i)),this}calcMovePOV(e,t,i){const n=new s.y3;(this.rotationQuaternion?this.rotationQuaternion:s._f.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z)).toRotationMatrix(n);const r=s.P.Zero(),o=this.definedFacingForward?-1:1;return s.P.TransformCoordinatesFromFloatsToRef(e*o,t,i*o,n,r),r}rotatePOV(e,t,i){return this.rotation.addInPlace(this.calcRotatePOV(e,t,i)),this}calcRotatePOV(e,t,i){const n=this.definedFacingForward?1:-1;return new s.P(e*n,t,i*n)}refreshBoundingInfo(e=!1,t=!1){return this._boundingInfo&&this._boundingInfo.isLocked||this._refreshBoundingInfo(this._getPositionData(e,t),null),this}_refreshBoundingInfo(e,t){if(e){const i=(0,f.k)(e,0,this.getTotalVertices(),t);this._boundingInfo?this._boundingInfo.reConstruct(i.minimum,i.maximum):this._boundingInfo=new _.j(i.minimum,i.maximum)}if(this.subMeshes)for(let t=0;t0){const e=t.getPositions();e&&(i[r]+=(e[r]-i[r])*n)}}if(e++,n===a.o.PositionKind&&this._positions&&3===e){e=0;const n=3*t;this._positions[t++].copyFromFloats(i[n],i[n+1],i[n+2])}}}if(i&&e&&this.skeleton){const e=this.getVerticesData(a.o.MatricesIndicesKind),t=this.getVerticesData(a.o.MatricesWeightsKind);if(t&&e){const r=this.numBoneInfluencers>4,o=r?this.getVerticesData(a.o.MatricesIndicesExtraKind):null,l=r?this.getVerticesData(a.o.MatricesWeightsExtraKind):null,c=this.skeleton.getTransformMatrices(this),h=s.jp.Vector3[0],_=s.jp.Matrix[0],d=s.jp.Matrix[1];let u=0;for(let p=0;p0&&(s.y3.FromFloat32ArrayToRefScaled(c,Math.floor(16*e[u+f]),m,d),_.addToSelf(d));if(r)for(f=0;f<4;f++)m=l[u+f],m>0&&(s.y3.FromFloat32ArrayToRefScaled(c,Math.floor(16*o[u+f]),m,d),_.addToSelf(d));n===a.o.NormalKind?s.P.TransformNormalFromFloatsToRef(i[p],i[p+1],i[p+2],_,h):s.P.TransformCoordinatesFromFloatsToRef(i[p],i[p+1],i[p+2],_,h),h.toArray(i,p),n===a.o.PositionKind&&this._positions&&this._positions[p/3].copyFrom(h)}}}return i}getNormalsData(e=!1,t=!1){return this._getData(e,t,null,a.o.NormalKind)}getPositionData(e=!1,t=!1,i){return this._getData(e,t,i,a.o.PositionKind)}_getPositionData(e,t){var i;let n=this.getVerticesData(a.o.PositionKind);if(this._internalAbstractMeshDataInfo._positions&&(this._internalAbstractMeshDataInfo._positions=null),n&&(e&&this.skeleton||t&&this.morphTargetManager)){if(n=n.slice(),this._generatePointsArray(),this._positions){const e=this._positions;this._internalAbstractMeshDataInfo._positions=new Array(e.length);for(let t=0;t1||!n.IsGlobal)&&n.updateBoundingInfo(e)}return this}_afterComputeWorldMatrix(){this.doNotSyncBoundingInfo||(this._boundingInfoIsDirty=!0)}isInFrustum(e){return this.getBoundingInfo().isInFrustum(e,this.cullingStrategy)}isCompletelyInFrustum(e){return this.getBoundingInfo().isCompletelyInFrustum(e)}intersectsMesh(e,t=!1,i){const n=this.getBoundingInfo(),r=e.getBoundingInfo();if(n.intersects(r,t))return!0;if(i)for(const i of this.getChildMeshes())if(i.intersectsMesh(e,t,!0))return!0;return!1}intersectsPoint(e){return this.getBoundingInfo().intersectsPoint(e)}get checkCollisions(){return this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions}set checkCollisions(e){this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions=e}get collider(){return this._internalAbstractMeshDataInfo._meshCollisionData._collider}moveWithCollisions(e){this.getAbsolutePosition().addToRef(this.ellipsoidOffset,this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions);const t=this.getScene().collisionCoordinator;return this._internalAbstractMeshDataInfo._meshCollisionData._collider||(this._internalAbstractMeshDataInfo._meshCollisionData._collider=t.createCollider()),this._internalAbstractMeshDataInfo._meshCollisionData._collider._radius=this.ellipsoid,t.getNewPosition(this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions,e,this._internalAbstractMeshDataInfo._meshCollisionData._collider,this.collisionRetryCount,this,this._onCollisionPositionChange,this.uniqueId),this}_collideForSubMesh(e,t,i){var n;if(this._generatePointsArray(),!this._positions)return this;if(!e._lastColliderWorldVertices||!e._lastColliderTransformMatrix.equals(t)){e._lastColliderTransformMatrix=t.clone(),e._lastColliderWorldVertices=[],e._trianglePlanes=[];const i=e.verticesStart,n=e.verticesStart+e.verticesCount;for(let r=i;r1&&!s._checkCollision(e)||this._collideForSubMesh(s,t,e)}return this}_shouldConvertRHS(){return!1}_checkCollision(e){if(!this.getBoundingInfo()._checkCollision(e))return this;const t=s.jp.Matrix[0],i=s.jp.Matrix[1];return s.y3.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this}_generatePointsArray(){return!1}intersects(e,t,i,n=!1,r,o=!1){const a=new h.p,l="InstancedLinesMesh"===this.getClassName()||"LinesMesh"===this.getClassName()?this.intersectionThreshold:0,c=this.getBoundingInfo();if(!this.subMeshes)return a;if(!(o||e.intersectsSphere(c.boundingSphere,l)&&e.intersectsBox(c.boundingBox,l)))return a;if(n)return a.hit=!o,a.pickedMesh=o?null:this,a.distance=o?0:s.P.Distance(e.origin,c.boundingSphere.center),a.subMeshId=0,a;if(!this._generatePointsArray())return a;let _=null;const d=this._scene.getIntersectingSubMeshCandidates(this,e),u=d.length;let p=!1;for(let e=0;e1&&!r.canIntersects(e))continue;const s=r.intersects(e,this._positions,this.getIndices(),t,i);if(s&&(t||!_||s.distance<_.distance)&&(_=s,_.subMeshId=n,t))break}if(_){const t=null!=r?r:this.getWorldMatrix(),i=s.jp.Vector3[0],n=s.jp.Vector3[1];s.P.TransformCoordinatesToRef(e.origin,t,i),e.direction.scaleToRef(_.distance,n);const o=s.P.TransformNormal(n,t).addInPlace(i);return a.hit=!0,a.distance=s.P.Distance(i,o),a.pickedPoint=o,a.pickedMesh=this,a.bu=_.bu||0,a.bv=_.bv||0,a.subMeshFaceId=_.faceId,a.faceId=_.faceId+d.data[_.subMeshId].indexStart/(-1!==this.getClassName().indexOf("LinesMesh")?2:3),a.subMeshId=_.subMeshId,a}return a}clone(e,t,i){return null}releaseSubMeshes(){if(this.subMeshes)for(;this.subMeshes.length;)this.subMeshes[0].dispose();else this.subMeshes=new Array;return this}dispose(e,t=!1){let i;for(this._scene.useMaterialMeshMap&&this._internalAbstractMeshDataInfo._material&&this._internalAbstractMeshDataInfo._material.meshMap&&(this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId]=void 0),this.getScene().freeActiveMeshes(),this.getScene().freeRenderingGroups(),void 0!==this.actionManager&&null!==this.actionManager&&(this.actionManager.dispose(),this.actionManager=null),this._internalAbstractMeshDataInfo._skeleton=null,this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null),i=0;i{let t=e.includedOnlyMeshes.indexOf(this);-1!==t&&e.includedOnlyMeshes.splice(t,1),t=e.excludedMeshes.indexOf(this),-1!==t&&e.excludedMeshes.splice(t,1);const i=e.getShadowGenerator();if(i){const e=i.getShadowMap();e&&e.renderList&&(t=e.renderList.indexOf(this),-1!==t&&e.renderList.splice(t,1))}})),"InstancedMesh"===this.getClassName()&&"InstancedLinesMesh"===this.getClassName()||this.releaseSubMeshes();const n=this.getScene().getEngine();if(null!==this._occlusionQuery&&(this.isOcclusionQueryInProgress=!1,n.deleteQuery(this._occlusionQuery),this._occlusionQuery=null),n.wipeCaches(),this.getScene().removeMesh(this),this._parentContainer){const e=this._parentContainer.meshes.indexOf(this);e>-1&&this._parentContainer.meshes.splice(e,1),this._parentContainer=null}if(t&&this.material&&("MultiMaterial"===this.material.getClassName()?this.material.dispose(!1,!0,!0):this.material.dispose(!1,!0)),!e)for(i=0;i65535){t=!0;break}e.depthSortedIndices=t?new Uint32Array(i):new Uint16Array(i)}if(e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!e.facetDepthSortFrom){const t=this.getScene().activeCamera;e.facetDepthSortFrom=t?t.position:s.P.Zero()}e.depthSortedFacets=[];for(let t=0;tg.kn?r.maximum.x-r.minimum.x:g.kn,e.bbSize.y=r.maximum.y-r.minimum.y>g.kn?r.maximum.y-r.minimum.y:g.kn,e.bbSize.z=r.maximum.z-r.minimum.z>g.kn?r.maximum.z-r.minimum.z:g.kn;let o=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(o=o>e.bbSize.z?o:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/o),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/o),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/o),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=r,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),s.P.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,n&&l.x.ComputeNormals(t,i,n,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);const t=e.depthSortedIndices.length/3|0;for(let n=0;nr.subDiv.max||o<0||o>r.subDiv.max||a<0||a>r.subDiv.max?null:r.facetPartitioning[s+r.subDiv.max*o+r.subDiv.max*r.subDiv.max*a]}getClosestFacetAtCoordinates(e,t,i,n,r=!1,o=!0){const a=this.getWorldMatrix(),l=s.jp.Matrix[5];a.invertToRef(l);const c=s.jp.Vector3[8];s.P.TransformCoordinatesFromFloatsToRef(e,t,i,l,c);const h=this.getClosestFacetAtLocalCoordinates(c.x,c.y,c.z,n,r,o);return n&&s.P.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,a,n),h}getClosestFacetAtLocalCoordinates(e,t,i,n,r=!1,s=!0){let o=null,a=0,l=0,c=0,h=0,_=0,d=0,u=0,p=0;const f=this.getFacetLocalPositions(),m=this.getFacetLocalNormals(),g=this.getFacetsAtLocalCoordinates(e,t,i);if(!g)return null;let b,y,v,A=Number.MAX_VALUE,C=A;for(let S=0;S=0||r&&!s&&h<=0)&&(h=y.x*v.x+y.y*v.y+y.z*v.z,_=-(y.x*e+y.y*t+y.z*i-h)/(y.x*y.x+y.y*y.y+y.z*y.z),d=e+y.x*_,u=t+y.y*_,p=i+y.z*_,a=d-e,l=u-t,c=p-i,C=a*a+l*l+c*c,Ce.emitter===this))}}C.OCCLUSION_TYPE_NONE=0,C.OCCLUSION_TYPE_OPTIMISTIC=1,C.OCCLUSION_TYPE_STRICT=2,C.OCCLUSION_ALGORITHM_TYPE_ACCURATE=0,C.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE=1,C.CULLINGSTRATEGY_STANDARD=0,C.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1,C.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2,C.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3,(0,y.H)("BABYLON.AbstractMesh",C)},"../../../node_modules/@babylonjs/core/Meshes/geometry.js":function(e,t,i){"use strict";i.d(t,{Z:function(){return f}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),s=i("../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js"),o=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),a=i("../../../node_modules/@babylonjs/core/Meshes/subMesh.js"),l=i("../../../node_modules/@babylonjs/core/Loading/sceneLoaderFlags.js"),c=i("../../../node_modules/@babylonjs/core/Culling/boundingInfo.js"),h=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),_=i("../../../node_modules/@babylonjs/core/Misc/tags.js"),d=i("../../../node_modules/@babylonjs/core/Maths/math.functions.js"),u=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),p=i("../../../node_modules/@babylonjs/core/Compat/compatibilityOptions.js");class f{constructor(e,t,i,n=!1,r=null){this.delayLoadState=0,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this._positionsCache=[],this._parentContainer=null,this.useBoundingInfoFromGeometry=!1,this._scene=t||u.l.LastCreatedScene,this._scene&&(this.id=e,this.uniqueId=this._scene.getUniqueId(),this._engine=this._scene.getEngine(),this._meshes=[],this._vertexBuffers={},this._indices=[],this._updatable=n,i?this.setAllVerticesData(i,n):this._totalVertices=0,this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),r&&(this.applyToMesh(r),r.computeWorldMatrix(!0)))}get boundingBias(){return this._boundingBias}set boundingBias(e){this._boundingBias?this._boundingBias.copyFrom(e):this._boundingBias=e.clone(),this._updateBoundingInfo(!0,null)}static CreateGeometryForMesh(e){const t=new f(f.RandomId(),e.getScene());return t.applyToMesh(e),t}get meshes(){return this._meshes}get extend(){return this._extend}getScene(){return this._scene}getEngine(){return this._engine}isReady(){return 1===this.delayLoadState||0===this.delayLoadState}get doNotSerialize(){for(let e=0;e0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,this._updatable)),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()}_notifyUpdate(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e),this._vertexArrayObjects&&this._disposeVertexArrayObjects();for(const e of this._meshes)e._markSubMeshesAsAttributesDirty()}load(e,t){2!==this.delayLoadState&&(this.isReady()?t&&t():(this.delayLoadState=2,this._queueLoad(e,t)))}_queueLoad(e,t){this.delayLoadingFile&&(e.addPendingData(this),e._loadFile(this.delayLoadingFile,(i=>{if(!this._delayLoadingFunction)return;this._delayLoadingFunction(JSON.parse(i),this),this.delayLoadState=1,this._delayInfo=[],e.removePendingData(this);const n=this._meshes,r=n.length;for(let e=0;e0){for(let t=0;t0){for(let e=0;e0){for(let e=0;e-1&&this._parentContainer.geometries.splice(e,1),this._parentContainer=null}this._isDisposed=!0}copy(e){const t=new s.x;t.indices=[];const i=this.getIndices();if(i)for(let e=0;e0){const n=new Float32Array(e,i.positionsAttrDesc.offset,i.positionsAttrDesc.count);t.setVerticesData(o.o.PositionKind,n,!1)}if(i.normalsAttrDesc&&i.normalsAttrDesc.count>0){const n=new Float32Array(e,i.normalsAttrDesc.offset,i.normalsAttrDesc.count);t.setVerticesData(o.o.NormalKind,n,!1)}if(i.tangetsAttrDesc&&i.tangetsAttrDesc.count>0){const n=new Float32Array(e,i.tangetsAttrDesc.offset,i.tangetsAttrDesc.count);t.setVerticesData(o.o.TangentKind,n,!1)}if(i.uvsAttrDesc&&i.uvsAttrDesc.count>0){const n=new Float32Array(e,i.uvsAttrDesc.offset,i.uvsAttrDesc.count);if(p.e.UseOpenGLOrientationForUV)for(let e=1;e0){const n=new Float32Array(e,i.uvs2AttrDesc.offset,i.uvs2AttrDesc.count);if(p.e.UseOpenGLOrientationForUV)for(let e=1;e0){const n=new Float32Array(e,i.uvs3AttrDesc.offset,i.uvs3AttrDesc.count);if(p.e.UseOpenGLOrientationForUV)for(let e=1;e0){const n=new Float32Array(e,i.uvs4AttrDesc.offset,i.uvs4AttrDesc.count);if(p.e.UseOpenGLOrientationForUV)for(let e=1;e0){const n=new Float32Array(e,i.uvs5AttrDesc.offset,i.uvs5AttrDesc.count);if(p.e.UseOpenGLOrientationForUV)for(let e=1;e0){const n=new Float32Array(e,i.uvs6AttrDesc.offset,i.uvs6AttrDesc.count);if(p.e.UseOpenGLOrientationForUV)for(let e=1;e0){const n=new Float32Array(e,i.colorsAttrDesc.offset,i.colorsAttrDesc.count);t.setVerticesData(o.o.ColorKind,n,!1,i.colorsAttrDesc.stride)}if(i.matricesIndicesAttrDesc&&i.matricesIndicesAttrDesc.count>0){const n=new Int32Array(e,i.matricesIndicesAttrDesc.offset,i.matricesIndicesAttrDesc.count),r=[];for(let e=0;e>8),r.push((16711680&t)>>16),r.push(t>>24&255)}t.setVerticesData(o.o.MatricesIndicesKind,r,!1)}if(i.matricesIndicesExtraAttrDesc&&i.matricesIndicesExtraAttrDesc.count>0){const n=new Int32Array(e,i.matricesIndicesExtraAttrDesc.offset,i.matricesIndicesExtraAttrDesc.count),r=[];for(let e=0;e>8),r.push((16711680&t)>>16),r.push(t>>24&255)}t.setVerticesData(o.o.MatricesIndicesExtraKind,r,!1)}if(i.matricesWeightsAttrDesc&&i.matricesWeightsAttrDesc.count>0){const n=new Float32Array(e,i.matricesWeightsAttrDesc.offset,i.matricesWeightsAttrDesc.count);t.setVerticesData(o.o.MatricesWeightsKind,n,!1)}if(i.indicesAttrDesc&&i.indicesAttrDesc.count>0){const n=new Int32Array(e,i.indicesAttrDesc.offset,i.indicesAttrDesc.count);t.setIndices(n,null)}if(i.subMeshesAttrDesc&&i.subMeshesAttrDesc.count>0){const n=new Int32Array(e,i.subMeshesAttrDesc.offset,5*i.subMeshesAttrDesc.count);t.subMeshes=[];for(let e=0;e>8),i.push((16711680&n)>>16),i.push(n>>24&255)}t.setVerticesData(o.o.MatricesIndicesKind,i,e.matricesIndices._updatable)}if(e.matricesIndicesExtra)if(e.matricesIndicesExtra._isExpanded)delete e.matricesIndices._isExpanded,t.setVerticesData(o.o.MatricesIndicesExtraKind,e.matricesIndicesExtra,e.matricesIndicesExtra._updatable);else{const i=[];for(let t=0;t>8),i.push((16711680&n)>>16),i.push(n>>24&255)}t.setVerticesData(o.o.MatricesIndicesExtraKind,i,e.matricesIndicesExtra._updatable)}e.matricesWeights&&(f._CleanMatricesWeights(e,t),t.setVerticesData(o.o.MatricesWeightsKind,e.matricesWeights,e.matricesWeights._updatable)),e.matricesWeightsExtra&&t.setVerticesData(o.o.MatricesWeightsExtraKind,e.matricesWeightsExtra,e.matricesWeights._updatable),t.setIndices(e.indices,null)}if(e.subMeshes){t.subMeshes=[];for(let i=0;i-1))return;{const i=t.getScene().getLastSkeletonById(e.skeletonId);if(!i)return;n=i.bones.length}const r=t.getVerticesData(o.o.MatricesIndicesKind),s=t.getVerticesData(o.o.MatricesIndicesExtraKind),a=e.matricesWeights,c=e.matricesWeightsExtra,h=e.numBoneInfluencer,_=a.length;for(let e=0;e<_;e+=4){let t=0,o=-1;for(let n=0;n<4;n++){const r=a[e+n];t+=r,rh-1)&&(o=h-1),t>i){const i=1/t;for(let t=0;t<4;t++)a[e+t]*=i;if(c)for(let t=0;t<4;t++)c[e+t]*=i}else o>=4?(c[e+o-4]=1-t,s[e+o-4]=n):(a[e+o]=1-t,r[e+o]=n)}t.setVerticesData(o.o.MatricesIndicesKind,r),e.matricesWeightsExtra&&t.setVerticesData(o.o.MatricesIndicesExtraKind,s)}static Parse(e,t,i){const r=new f(e.id,t,void 0,e.updatable);return r._loadedUniqueId=e.uniqueId,_.$&&_.$.AddTagsTo(r,e.tags),e.delayLoadingFile?(r.delayLoadState=4,r.delayLoadingFile=i+e.delayLoadingFile,r._boundingInfo=new c.j(n.P.FromArray(e.boundingBoxMinimum),n.P.FromArray(e.boundingBoxMaximum)),r._delayInfo=[],e.hasUVs&&r._delayInfo.push(o.o.UVKind),e.hasUVs2&&r._delayInfo.push(o.o.UV2Kind),e.hasUVs3&&r._delayInfo.push(o.o.UV3Kind),e.hasUVs4&&r._delayInfo.push(o.o.UV4Kind),e.hasUVs5&&r._delayInfo.push(o.o.UV5Kind),e.hasUVs6&&r._delayInfo.push(o.o.UV6Kind),e.hasColors&&r._delayInfo.push(o.o.ColorKind),e.hasMatricesIndices&&r._delayInfo.push(o.o.MatricesIndicesKind),e.hasMatricesWeights&&r._delayInfo.push(o.o.MatricesWeightsKind),r._delayLoadingFunction=s.x.ImportVertexData):s.x.ImportVertexData(e,r),t.pushGeometry(r,!0),r}}},"../../../node_modules/@babylonjs/core/Meshes/mesh.js":function(e,t,i){"use strict";i.d(t,{Kj:function(){return D},gW:function(){return E}});var n=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),r=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),s=i("../../../node_modules/@babylonjs/core/Misc/deepCopier.js"),o=i("../../../node_modules/@babylonjs/core/Misc/tags.js"),a=i("../../../node_modules/@babylonjs/core/Misc/coroutine.js"),l=i("../../../node_modules/@babylonjs/core/scene.js"),c=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),h=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),_=i("../../../node_modules/@babylonjs/core/node.js"),d=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),u=i("../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js"),p=i("../../../node_modules/@babylonjs/core/Meshes/geometry.js"),f=i("../../../node_modules/@babylonjs/core/Meshes/abstractMesh.js"),m=i("../../../node_modules/@babylonjs/core/Meshes/subMesh.js"),g=i("../../../node_modules/@babylonjs/core/Materials/material.js"),b=i("../../../node_modules/@babylonjs/core/Materials/multiMaterial.js"),y=i("../../../node_modules/@babylonjs/core/Loading/sceneLoaderFlags.js"),v=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),A=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),C=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),S=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),x=i("../../../node_modules/@babylonjs/core/sceneComponent.js"),T=i("../../../node_modules/@babylonjs/core/Meshes/meshLODLevel.js");class E{}class R{constructor(){this.visibleInstances={},this.batchCache=new P,this.batchCacheReplacementModeInFrozenMode=new P,this.instancesBufferSize=2048}}class P{constructor(){this.mustReturn=!1,this.visibleInstances=new Array,this.renderSelf=new Array,this.hardwareInstancedRendering=new Array}}class I{constructor(){this.instancesCount=0,this.matrixBuffer=null,this.previousMatrixBuffer=null,this.matrixBufferSize=512,this.matrixData=null,this.boundingVectors=[],this.worldMatrices=null}}class M{constructor(){this._areNormalsFrozen=!1,this._source=null,this.meshMap=null,this._preActivateId=-1,this._LODLevels=new Array,this._useLODScreenCoverage=!1,this._effectiveMaterial=null,this._forcedInstanceCount=0}}class D extends f.x{constructor(e,t=null,i=null,r=null,a,l=!0){if(super(e,t),this._internalMeshDataInfo=new M,this.delayLoadState=0,this.instances=new Array,this._creationDataStorage=null,this._geometry=null,this._instanceDataStorage=new R,this._thinInstanceDataStorage=new I,this._shouldGenerateFlatShading=!1,this._originalBuilderSideOrientation=D.DEFAULTSIDE,this.overrideMaterialSideOrientation=null,this.ignoreCameraMaxZ=!1,t=this.getScene(),this._onBeforeDraw=(e,t,i)=>{e&&i&&(this._uniformBuffer?this.transferToEffect(t):i.bindOnlyWorldMatrix(t))},r){if(r._geometry&&r._geometry.applyToMesh(this),s.j.DeepCopy(r,this,["name","material","skeleton","instances","parent","uniqueId","source","metadata","morphTargetManager","hasInstances","worldMatrixInstancedBuffer","previousWorldMatrixInstancedBuffer","hasLODLevels","geometry","isBlocked","areNormalsFrozen","facetNb","isFacetDataEnabled","lightSources","useBones","isAnInstance","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","cloneMeshMap","hasBoundingInfo"],["_poseMatrix"]),this._internalMeshDataInfo._source=r,t.useClonedMeshMap&&(r._internalMeshDataInfo.meshMap||(r._internalMeshDataInfo.meshMap={}),r._internalMeshDataInfo.meshMap[this.uniqueId]=this),this._originalBuilderSideOrientation=r._originalBuilderSideOrientation,this._creationDataStorage=r._creationDataStorage,r._ranges){const e=r._ranges;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t]&&this.createAnimationRange(t,e[t].from,e[t].to)}if(r.metadata&&r.metadata.clone?this.metadata=r.metadata.clone():this.metadata=r.metadata,o.$&&o.$.HasTags(r)&&o.$.AddTagsTo(this,o.$.GetTags(r,!0)),this.setEnabled(r.isEnabled(!1)),this.parent=r.parent,this.setPivotMatrix(r.getPivotMatrix()),this.id=e+"."+r.id,this.material=r.material,!a){const t=r.getDescendants(!0);for(let i=0;i{e.unregisterOnNextCall=!0,this.isReady(!0)?this.onMeshReadyObservable.notifyObservers(this):this._internalMeshDataInfo._checkReadinessObserver||(this._internalMeshDataInfo._checkReadinessObserver=this._scene.onBeforeRenderObservable.add((()=>{this.isReady(!0)&&(this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver),this._internalMeshDataInfo._checkReadinessObserver=null,this.onMeshReadyObservable.notifyObservers(this))})))},this.onMeshReadyObservable=new n.y$(this._internalMeshDataInfo._onMeshReadyObserverAdded),r&&r.onClonedObservable.notifyObservers(this)}static _GetDefaultSideOrientation(e){return e||D.FRONTSIDE}get useLODScreenCoverage(){return this._internalMeshDataInfo._useLODScreenCoverage}set useLODScreenCoverage(e){this._internalMeshDataInfo._useLODScreenCoverage=e}get computeBonesUsingShaders(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders}set computeBonesUsingShaders(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(e&&this._internalMeshDataInfo._sourcePositions&&(this.setVerticesData(d.o.PositionKind,this._internalMeshDataInfo._sourcePositions,!0),this._internalMeshDataInfo._sourceNormals&&this.setVerticesData(d.o.NormalKind,this._internalMeshDataInfo._sourceNormals,!0),this._internalMeshDataInfo._sourcePositions=null,this._internalMeshDataInfo._sourceNormals=null),this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())}get onBeforeRenderObservable(){return this._internalMeshDataInfo._onBeforeRenderObservable||(this._internalMeshDataInfo._onBeforeRenderObservable=new n.y$),this._internalMeshDataInfo._onBeforeRenderObservable}get onBeforeBindObservable(){return this._internalMeshDataInfo._onBeforeBindObservable||(this._internalMeshDataInfo._onBeforeBindObservable=new n.y$),this._internalMeshDataInfo._onBeforeBindObservable}get onAfterRenderObservable(){return this._internalMeshDataInfo._onAfterRenderObservable||(this._internalMeshDataInfo._onAfterRenderObservable=new n.y$),this._internalMeshDataInfo._onAfterRenderObservable}get onBetweenPassObservable(){return this._internalMeshDataInfo._onBetweenPassObservable||(this._internalMeshDataInfo._onBetweenPassObservable=new n.y$),this._internalMeshDataInfo._onBetweenPassObservable}get onBeforeDrawObservable(){return this._internalMeshDataInfo._onBeforeDrawObservable||(this._internalMeshDataInfo._onBeforeDrawObservable=new n.y$),this._internalMeshDataInfo._onBeforeDrawObservable}set onBeforeDraw(e){this._onBeforeDrawObserver&&this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver),this._onBeforeDrawObserver=this.onBeforeDrawObservable.add(e)}get hasInstances(){return this.instances.length>0}get hasThinInstances(){var e;return(null!==(e=this._thinInstanceDataStorage.instancesCount)&&void 0!==e?e:0)>0}get forcedInstanceCount(){return this._internalMeshDataInfo._forcedInstanceCount}set forcedInstanceCount(e){this._internalMeshDataInfo._forcedInstanceCount=e}get source(){return this._internalMeshDataInfo._source}get cloneMeshMap(){return this._internalMeshDataInfo.meshMap}get isUnIndexed(){return this._unIndexed}set isUnIndexed(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())}get worldMatrixInstancedBuffer(){return this._instanceDataStorage.instancesData}get previousWorldMatrixInstancedBuffer(){return this._instanceDataStorage.instancesPreviousData}get manualUpdateOfWorldMatrixInstancedBuffer(){return this._instanceDataStorage.manualUpdate}set manualUpdateOfWorldMatrixInstancedBuffer(e){this._instanceDataStorage.manualUpdate=e}get manualUpdateOfPreviousWorldMatrixInstancedBuffer(){return this._instanceDataStorage.previousManualUpdate}set manualUpdateOfPreviousWorldMatrixInstancedBuffer(e){this._instanceDataStorage.previousManualUpdate=e}instantiateHierarchy(e=null,t,i){const n=0===this.getTotalVertices()||t&&t.doNotInstantiate&&(!0===t.doNotInstantiate||t.doNotInstantiate(this))?this.clone("Clone of "+(this.name||this.id),e||this.parent,!0):this.createInstance("instance of "+(this.name||this.id));n.parent=e||this.parent,n.position=this.position.clone(),n.scaling=this.scaling.clone(),this.rotationQuaternion?n.rotationQuaternion=this.rotationQuaternion.clone():n.rotation=this.rotation.clone(),i&&i(this,n);for(const e of this.getChildTransformNodes(!0))"InstancedMesh"===e.getClassName()&&"Mesh"===n.getClassName()?e.instantiateHierarchy(n,{doNotInstantiate:t&&t.doNotInstantiate||!1,newSourcedMesh:n},i):e.instantiateHierarchy(n,t,i);return n}getClassName(){return"Mesh"}get _isMesh(){return!0}toString(e){let t=super.toString(e);if(t+=", n vertices: "+this.getTotalVertices(),t+=", parent: "+(this._waitingParentId?this._waitingParentId:this.parent?this.parent.name:"NONE"),this.animations)for(let i=0;i0}getLODLevels(){return this._internalMeshDataInfo._LODLevels}_sortLODLevels(){const e=this._internalMeshDataInfo._useLODScreenCoverage?-1:1;this._internalMeshDataInfo._LODLevels.sort(((t,i)=>t.distanceOrScreenCoveragei.distanceOrScreenCoverage?-e:0))}addLODLevel(e,t){if(t&&t._masterMesh)return A.Y.Warn("You cannot use a mesh as LOD level twice"),this;const i=new T.g(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this}getLODLevelAtDistance(e){const t=this._internalMeshDataInfo;for(let i=0;io*s)return this.onLODLevelSelection&&this.onLODLevelSelection(s,this,this),this;for(let e=0;e0||this.hasThinInstances);this.computeWorldMatrix();const _=this.material||c.defaultMaterial;if(_)if(_._storeEffectOnSubMeshes)for(const e of this.subMeshes){const t=e.getMaterial();if(t)if(t._storeEffectOnSubMeshes){if(!t.isReadyForSubMesh(this,e,h))return!1}else if(!t.isReady(this,h))return!1}else if(!_.isReady(this,h))return!1;const d=l.currentRenderPassId;for(const e of this.lightSources){const t=e.getShadowGenerator();if(t&&(!(null===(i=t.getShadowMap())||void 0===i?void 0:i.renderList)||(null===(n=t.getShadowMap())||void 0===n?void 0:n.renderList)&&-1!==(null===(s=null===(r=t.getShadowMap())||void 0===r?void 0:r.renderList)||void 0===s?void 0:s.indexOf(this)))){t.getShadowMap()&&(l.currentRenderPassId=t.getShadowMap().renderPassId);for(const e of this.subMeshes)if(!t.isReady(e,h,null!==(a=null===(o=e.getMaterial())||void 0===o?void 0:o.needAlphaBlendingForMesh(this))&&void 0!==a&&a))return l.currentRenderPassId=d,!1;l.currentRenderPassId=d}}for(const e of this._internalMeshDataInfo._LODLevels)if(e.mesh&&!e.mesh.isReady(h))return!1;return!0}get areNormalsFrozen(){return this._internalMeshDataInfo._areNormalsFrozen}freezeNormals(){return this._internalMeshDataInfo._areNormalsFrozen=!0,this}unfreezeNormals(){return this._internalMeshDataInfo._areNormalsFrozen=!1,this}set overridenInstanceCount(e){this._instanceDataStorage.overridenInstanceCount=e}_preActivate(){const e=this._internalMeshDataInfo,t=this.getScene().getRenderId();return e._preActivateId===t||(e._preActivateId=t,this._instanceDataStorage.visibleInstances=null),this}_preActivateForIntermediateRendering(e){return this._instanceDataStorage.visibleInstances&&(this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId=e),this}_registerInstanceForRenderId(e,t){return this._instanceDataStorage.visibleInstances||(this._instanceDataStorage.visibleInstances={defaultRenderId:t,selfDefaultRenderId:this._renderId}),this._instanceDataStorage.visibleInstances[t]||(void 0!==this._instanceDataStorage.previousRenderId&&this._instanceDataStorage.isFrozen&&(this._instanceDataStorage.visibleInstances[this._instanceDataStorage.previousRenderId]=null),this._instanceDataStorage.previousRenderId=t,this._instanceDataStorage.visibleInstances[t]=new Array),this._instanceDataStorage.visibleInstances[t].push(e),this}_afterComputeWorldMatrix(){super._afterComputeWorldMatrix(),this.hasThinInstances&&(this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1))}_postActivate(){this.edgesShareWithInstances&&this.edgesRenderer&&this.edgesRenderer.isEnabled&&this._renderingGroup&&(this._renderingGroup._edgesRenderers.pushNoDuplicate(this.edgesRenderer),this.edgesRenderer.customInstances.push(this.getWorldMatrix()))}refreshBoundingInfo(e=!1,t=!1){if(this.hasBoundingInfo&&this.getBoundingInfo().isLocked)return this;const i=this.geometry?this.geometry.boundingBias:null;return this._refreshBoundingInfo(this._getPositionData(e,t),i),this}_createGlobalSubMesh(e){const t=this.getTotalVertices();if(!t||!this.getIndices())return null;if(this.subMeshes&&this.subMeshes.length>0){const i=this.getIndices();if(!i)return null;const n=i.length;let r=!1;if(e)r=!0;else for(const e of this.subMeshes){if(e.indexStart+e.indexCount>n){r=!0;break}if(e.verticesStart+e.verticesCount>t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new m.P(0,0,t,0,this.getTotalIndices(),this)}subdivide(e){if(e<1)return;const t=this.getTotalIndices();let i=t/e|0,n=0;for(;i%3!=0;)i++;this.releaseSubMeshes();for(let r=0;r=t);r++)m.P.CreateFromIndices(0,n,r===e-1?t-n:i,this),n+=i;this.synchronizeInstances()}setVerticesData(e,t,i=!1,n){if(this._geometry)this._geometry.setVerticesData(e,t,i,n);else{const n=new u.x;n.set(t,e);const r=this.getScene();new p.Z(p.Z.RandomId(),r,n,i,this)}return this}removeVerticesData(e){this._geometry&&this._geometry.removeVerticesData(e)}markVerticesDataAsUpdatable(e,t=!0){const i=this.getVertexBuffer(e);i&&i.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)}setVerticesBuffer(e,t=!0){return this._geometry||(this._geometry=p.Z.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e,null,t),this}updateVerticesData(e,t,i,n){return this._geometry?(n?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i),this):this}updateMeshPositions(e,t=!0){const i=this.getVerticesData(d.o.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(d.o.PositionKind,i,!1,!1),t){const e=this.getIndices(),t=this.getVerticesData(d.o.NormalKind);if(!t)return this;u.x.ComputeNormals(i,e,t),this.updateVerticesData(d.o.NormalKind,t,!1,!1)}return this}makeGeometryUnique(){if(!this._geometry)return this;if(1===this._geometry.meshes.length)return this;const e=this._geometry,t=this._geometry.copy(p.Z.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this}setIndices(e,t=null,i=!1){if(this._geometry)this._geometry.setIndices(e,t,i);else{const t=new u.x;t.indices=e;const n=this.getScene();new p.Z(p.Z.RandomId(),n,t,i,this)}return this}updateIndices(e,t,i=!1){return this._geometry?(this._geometry.updateIndices(e,t,i),this):this}toLeftHanded(){return this._geometry?(this._geometry.toLeftHanded(),this):this}_bind(e,t,i){if(!this._geometry)return this;const n=this.getScene().getEngine();let r;if(this.morphTargetManager&&this.morphTargetManager.isUsingTextureForTargets&&this.morphTargetManager._bind(t),this._unIndexed)r=null;else switch(i){case g.F.PointFillMode:r=null;break;case g.F.WireFrameFillMode:r=e._getLinesIndexBuffer(this.getIndices(),n);break;default:case g.F.TriangleFillMode:r=this._geometry.getIndexBuffer()}return!this._userInstancedBuffersStorage||this.hasThinInstances?this._geometry._bind(t,r):this._geometry._bind(t,r,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects),this}_draw(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);const n=this.getScene().getEngine();return this._unIndexed||t==g.F.PointFillMode?n.drawArraysType(t,e.verticesStart,e.verticesCount,this.forcedInstanceCount||i):t==g.F.WireFrameFillMode?n.drawElementsType(t,0,e._linesIndexCount,this.forcedInstanceCount||i):n.drawElementsType(t,e.indexStart,e.indexCount,this.forcedInstanceCount||i),this}registerBeforeRender(e){return this.onBeforeRenderObservable.add(e),this}unregisterBeforeRender(e){return this.onBeforeRenderObservable.removeCallback(e),this}registerAfterRender(e){return this.onAfterRenderObservable.add(e),this}unregisterAfterRender(e){return this.onAfterRenderObservable.removeCallback(e),this}_getInstancesRenderList(e,t=!1){if(this._instanceDataStorage.isFrozen){if(t)return this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.hardwareInstancedRendering[e]=!1,this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.renderSelf[e]=!0,this._instanceDataStorage.batchCacheReplacementModeInFrozenMode;if(this._instanceDataStorage.previousBatch)return this._instanceDataStorage.previousBatch}const i=this.getScene(),n=i._isInIntermediateRendering(),r=n?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,s=this._instanceDataStorage.batchCache;if(s.mustReturn=!1,s.renderSelf[e]=t||!r&&this.isEnabled()&&this.isVisible,s.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances&&!t){const t=this._instanceDataStorage.visibleInstances,r=i.getRenderId(),o=n?t.intermediateDefaultRenderId:t.defaultRenderId;s.visibleInstances[e]=t[r],!s.visibleInstances[e]&&o&&(s.visibleInstances[e]=t[o])}return s.hardwareInstancedRendering[e]=!t&&this._instanceDataStorage.hardwareInstancedRendering&&null!==s.visibleInstances[e]&&void 0!==s.visibleInstances[e],this._instanceDataStorage.previousBatch=s,s}_renderWithInstances(e,t,i,n,r){var s;const o=i.visibleInstances[e._id],a=o?o.length:0,l=this._instanceDataStorage,h=l.instancesBufferSize;let _=l.instancesBuffer,u=l.instancesPreviousBuffer;const p=16*(a+1)*4;for(;l.instancesBufferSizee._distanceToCamera>t._distanceToCamera?-1:e._distanceToCamerai&&n++,0!==s&&_++,h+=s,i=s}if(l[_]++,_>s&&(s=_),0===h)r++;else{const i=1/h;let n=0;for(let r=0;r.001&&o++}}const c=this.skeleton.bones.length,h=this.getVerticesData(d.o.MatricesIndicesKind),_=this.getVerticesData(d.o.MatricesIndicesExtraKind);let u=0;for(let e=0;e=c||i<0)&&u++}return{skinned:!0,valid:0===r&&0===o&&0===u,report:"Number of Weights = "+i/4+"\nMaximum influences = "+s+"\nMissing Weights = "+r+"\nNot Sorted = "+n+"\nNot Normalized = "+o+"\nWeightCounts = ["+l+"]\nNumber of bones = "+c+"\nBad Bone Indices = "+u}}_checkDelayState(){const e=this.getScene();return this._geometry?this._geometry.load(e):4===this.delayLoadState&&(this.delayLoadState=2,this._queueLoad(e)),this}_queueLoad(e){e.addPendingData(this);const t=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return r.w1.LoadFile(this.delayLoadingFile,(t=>{t instanceof ArrayBuffer?this._delayLoadingFunction(t,this):this._delayLoadingFunction(JSON.parse(t),this),this.instances.forEach((e=>{e.refreshBoundingInfo(),e._syncSubMeshes()})),this.delayLoadState=1,e.removePendingData(this)}),(()=>{}),e.offlineProvider,t),this}isInFrustum(e){return 2!==this.delayLoadState&&!!super.isInFrustum(e)&&(this._checkDelayState(),!0)}setMaterialById(e){const t=this.getScene().materials;let i;for(i=t.length-1;i>-1;i--)if(t[i].id===e)return this.material=t[i],this;const n=this.getScene().multiMaterials;for(i=n.length-1;i>-1;i--)if(n[i].id===e)return this.material=n[i],this;return this}getAnimatables(){const e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e}bakeTransformIntoVertices(e){if(!this.isVerticesDataPresent(d.o.PositionKind))return this;const t=this.subMeshes.splice(0);this._resetPointsArrayCache();let i,n=this.getVerticesData(d.o.PositionKind),r=new Array;for(i=0;i{const r=e.width,l=e.height,c=this.getEngine().createCanvas(r,l).getContext("2d");c.drawImage(e,0,0);const h=c.getImageData(0,0,r,l).data;this.applyDisplacementMapFromBuffer(h,r,l,t,i,s,o,a),n&&n(this)}),(()=>{}),l.offlineProvider),this}applyDisplacementMapFromBuffer(e,t,i,n,r,s,o,a=!1){if(!this.isVerticesDataPresent(d.o.PositionKind)||!this.isVerticesDataPresent(d.o.NormalKind)||!this.isVerticesDataPresent(d.o.UVKind))return A.Y.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"),this;const l=this.getVerticesData(d.o.PositionKind,!0,!0),h=this.getVerticesData(d.o.NormalKind),_=this.getVerticesData(d.o.UVKind);let p=c.P.Zero();const f=c.P.Zero(),m=c.FM.Zero();s=s||c.FM.Zero(),o=o||new c.FM(1,1);for(let a=0;a{const t=n.length-1-e,i=n[t];for(let e=0;e{for(let e=0;e-1&&(n.morphTargetManager=t.getMorphTargetManagerById(e.morphTargetManagerId)),void 0!==e.skeletonId&&null!==e.skeletonId&&(n.skeleton=t.getLastSkeletonById(e.skeletonId),e.numBoneInfluencers&&(n.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(let t=0;t4,l=a?this.getVerticesData(d.o.MatricesIndicesExtraKind):null,h=a?this.getVerticesData(d.o.MatricesWeightsExtraKind):null,_=e.getTransformMatrices(this),u=c.P.Zero(),p=new c.y3,f=new c.y3;let m,g=0;for(let e=0;e0&&(c.y3.FromFloat32ArrayToRefScaled(_,Math.floor(16*s[g+m]),d,f),p.addToSelf(f));if(a)for(m=0;m<4;m++)d=h[g+m],d>0&&(c.y3.FromFloat32ArrayToRefScaled(_,Math.floor(16*l[g+m]),d,f),p.addToSelf(f));c.P.TransformCoordinatesFromFloatsToRef(i._sourcePositions[e],i._sourcePositions[e+1],i._sourcePositions[e+2],p,u),u.toArray(n,e),t&&(c.P.TransformNormalFromFloatsToRef(i._sourceNormals[e],i._sourceNormals[e+1],i._sourceNormals[e+2],p,u),u.toArray(r,e)),p.reset()}return this.updateVerticesData(d.o.PositionKind,n),t&&this.updateVerticesData(d.o.NormalKind,r),this}static MinMax(e){let t=null,i=null;return e.forEach((function(e){const n=e.getBoundingInfo().boundingBox;t&&i?(t.minimizeInPlace(n.minimumWorld),i.maximizeInPlace(n.maximumWorld)):(t=n.minimumWorld,i=n.maximumWorld)})),t&&i?{min:t,max:i}:{min:c.P.Zero(),max:c.P.Zero()}}static Center(e){const t=e instanceof Array?D.MinMax(e):e;return c.P.Center(t.min,t.max)}static MergeMeshes(e,t=!0,i,n,r,s){return(0,a.s3)(D._MergeMeshesCoroutine(e,t,i,n,r,s,!1))}static MergeMeshesAsync(e,t=!0,i,n,r,s){return(0,a.sM)(D._MergeMeshesCoroutine(e,t,i,n,r,s,!0),(0,a.KO)())}static*_MergeMeshesCoroutine(e,t=!0,i,n,r,s,o){if(0===(e=e.filter(Boolean)).length)return null;let a;if(!i){let t=0;for(a=0;a=65536)return A.Y.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}s&&(r=!1);const l=new Array,c=new Array,h=new Array,_=e[0].overrideMaterialSideOrientation;for(a=0;a{const t=e.computeWorldMatrix(!0);return[u.x.ExtractFromMesh(e,!1,!1),t]},[f,g]=p(d);o&&(yield);const y=new Array(e.length-1);for(let t=1;t{throw(0,S.S)("GroundMesh")},D._GoldbergMeshParser=(e,t)=>{throw(0,S.S)("GoldbergMesh")},D._LinesMeshParser=(e,t)=>{throw(0,S.S)("LinesMesh")},(0,C.H)("BABYLON.Mesh",D),D.prototype.setMaterialByID=function(e){return this.setMaterialById(e)},D.CreateDisc=D.CreateDisc||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateBox=D.CreateBox||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateSphere=D.CreateSphere||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateCylinder=D.CreateCylinder||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateTorusKnot=D.CreateTorusKnot||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateTorus=D.CreateTorus||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreatePlane=D.CreatePlane||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateGround=D.CreateGround||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateTiledGround=D.CreateTiledGround||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateGroundFromHeightMap=D.CreateGroundFromHeightMap||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateTube=D.CreateTube||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreatePolyhedron=D.CreatePolyhedron||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateIcoSphere=D.CreateIcoSphere||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateDecal=D.CreateDecal||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.CreateCapsule=D.CreateCapsule||(()=>{throw new Error("Import MeshBuilder to populate this function")}),D.ExtendToGoldberg=D.ExtendToGoldberg||(()=>{throw new Error("Import MeshBuilder to populate this function")})},"../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js":function(e,t,i){"use strict";i.d(t,{x:function(){return d}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),o=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),l=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),c=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),h=i("../../../node_modules/@babylonjs/core/Misc/coroutine.js"),_=i("../../../node_modules/@babylonjs/core/Misc/error.js");class d{constructor(){this._applyTo=(0,h.vp)(this._applyToCoroutine.bind(this))}set(e,t){switch(e.length||l.Y.Warn(`Setting vertex data kind '${t}' with an empty array`),t){case s.o.PositionKind:this.positions=e;break;case s.o.NormalKind:this.normals=e;break;case s.o.TangentKind:this.tangents=e;break;case s.o.UVKind:this.uvs=e;break;case s.o.UV2Kind:this.uvs2=e;break;case s.o.UV3Kind:this.uvs3=e;break;case s.o.UV4Kind:this.uvs4=e;break;case s.o.UV5Kind:this.uvs5=e;break;case s.o.UV6Kind:this.uvs6=e;break;case s.o.ColorKind:this.colors=e;break;case s.o.MatricesIndicesKind:this.matricesIndices=e;break;case s.o.MatricesWeightsKind:this.matricesWeights=e;break;case s.o.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case s.o.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}}applyToMesh(e,t){return this._applyTo(e,t,!1),this}applyToGeometry(e,t){return this._applyTo(e,t,!1),this}updateMesh(e){return this._update(e),this}updateGeometry(e){return this._update(e),this}*_applyToCoroutine(e,t=!1,i){return this.positions&&(e.setVerticesData(s.o.PositionKind,this.positions,t),i&&(yield)),this.normals&&(e.setVerticesData(s.o.NormalKind,this.normals,t),i&&(yield)),this.tangents&&(e.setVerticesData(s.o.TangentKind,this.tangents,t),i&&(yield)),this.uvs&&(e.setVerticesData(s.o.UVKind,this.uvs,t),i&&(yield)),this.uvs2&&(e.setVerticesData(s.o.UV2Kind,this.uvs2,t),i&&(yield)),this.uvs3&&(e.setVerticesData(s.o.UV3Kind,this.uvs3,t),i&&(yield)),this.uvs4&&(e.setVerticesData(s.o.UV4Kind,this.uvs4,t),i&&(yield)),this.uvs5&&(e.setVerticesData(s.o.UV5Kind,this.uvs5,t),i&&(yield)),this.uvs6&&(e.setVerticesData(s.o.UV6Kind,this.uvs6,t),i&&(yield)),this.colors&&(e.setVerticesData(s.o.ColorKind,this.colors,t),i&&(yield)),this.matricesIndices&&(e.setVerticesData(s.o.MatricesIndicesKind,this.matricesIndices,t),i&&(yield)),this.matricesWeights&&(e.setVerticesData(s.o.MatricesWeightsKind,this.matricesWeights,t),i&&(yield)),this.matricesIndicesExtra&&(e.setVerticesData(s.o.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),i&&(yield)),this.matricesWeightsExtra&&(e.setVerticesData(s.o.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),i&&(yield)),this.indices?(e.setIndices(this.indices,null,t),i&&(yield)):e.setIndices([],null),this}_update(e,t,i){return this.positions&&e.updateVerticesData(s.o.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(s.o.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(s.o.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(s.o.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(s.o.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(s.o.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(s.o.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(s.o.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(s.o.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(s.o.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(s.o.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(s.o.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(s.o.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(s.o.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this}static _TransformVector3Coordinates(e,t,i=0,n=e.length){const s=r.jp.Vector3[0],o=r.jp.Vector3[1];for(let a=i;a[e,void 0])):[[e,void 0]];return(0,h.s3)(this._mergeCoroutine(void 0,n,t,!1,i))}*_mergeCoroutine(e,t,i=!1,n,r){var o,a,l,c;this._validate();const h=t.map((e=>e[0]));for(const e of h)if(e._validate(),!this.normals!=!e.normals||!this.tangents!=!e.tangents||!this.uvs!=!e.uvs||!this.uvs2!=!e.uvs2||!this.uvs3!=!e.uvs3||!this.uvs4!=!e.uvs4||!this.uvs5!=!e.uvs5||!this.uvs6!=!e.uvs6||!this.colors!=!e.colors||!this.matricesIndices!=!e.matricesIndices||!this.matricesWeights!=!e.matricesWeights||!this.matricesIndicesExtra!=!e.matricesIndicesExtra||!this.matricesWeightsExtra!=!e.matricesWeightsExtra)throw new Error("Cannot merge vertex data that do not have the same set of attributes");const _=h.reduce(((e,t)=>{var i,n;return e+(null!==(n=null===(i=t.indices)||void 0===i?void 0:i.length)&&void 0!==n?n:0)}),null!==(a=null===(o=this.indices)||void 0===o?void 0:o.length)&&void 0!==a?a:0);let u=r||h.some((e=>e.indices===this.indices))?null===(l=this.indices)||void 0===l?void 0:l.slice():this.indices;if(_>0){let r=null!==(c=null==u?void 0:u.length)&&void 0!==c?c:0;if(u||(u=new Array(_)),u.length!==_){if(Array.isArray(u))u.length=_;else{const e=i||u instanceof Uint32Array?new Uint32Array(_):new Uint16Array(_);e.set(u),u=e}e&&e.determinant()<0&&d._FlipFaces(u,0,r)}let s=this.positions?this.positions.length/3:0;for(const[e,i]of t)if(e.indices){for(let t=0;t[e[0].positions,e[1]]))),n&&(yield),this.normals=d._MergeElement(s.o.NormalKind,this.normals,e,t.map((e=>[e[0].normals,e[1]]))),n&&(yield),this.tangents=d._MergeElement(s.o.TangentKind,this.tangents,e,t.map((e=>[e[0].tangents,e[1]]))),n&&(yield),this.uvs=d._MergeElement(s.o.UVKind,this.uvs,e,t.map((e=>[e[0].uvs,e[1]]))),n&&(yield),this.uvs2=d._MergeElement(s.o.UV2Kind,this.uvs2,e,t.map((e=>[e[0].uvs2,e[1]]))),n&&(yield),this.uvs3=d._MergeElement(s.o.UV3Kind,this.uvs3,e,t.map((e=>[e[0].uvs3,e[1]]))),n&&(yield),this.uvs4=d._MergeElement(s.o.UV4Kind,this.uvs4,e,t.map((e=>[e[0].uvs4,e[1]]))),n&&(yield),this.uvs5=d._MergeElement(s.o.UV5Kind,this.uvs5,e,t.map((e=>[e[0].uvs5,e[1]]))),n&&(yield),this.uvs6=d._MergeElement(s.o.UV6Kind,this.uvs6,e,t.map((e=>[e[0].uvs6,e[1]]))),n&&(yield),this.colors=d._MergeElement(s.o.ColorKind,this.colors,e,t.map((e=>[e[0].colors,e[1]]))),n&&(yield),this.matricesIndices=d._MergeElement(s.o.MatricesIndicesKind,this.matricesIndices,e,t.map((e=>[e[0].matricesIndices,e[1]]))),n&&(yield),this.matricesWeights=d._MergeElement(s.o.MatricesWeightsKind,this.matricesWeights,e,t.map((e=>[e[0].matricesWeights,e[1]]))),n&&(yield),this.matricesIndicesExtra=d._MergeElement(s.o.MatricesIndicesExtraKind,this.matricesIndicesExtra,e,t.map((e=>[e[0].matricesIndicesExtra,e[1]]))),n&&(yield),this.matricesWeightsExtra=d._MergeElement(s.o.MatricesWeightsExtraKind,this.matricesWeightsExtra,e,t.map((e=>[e[0].matricesWeightsExtra,e[1]]))),this}static _MergeElement(e,t,i,n){const r=n.filter((e=>null!==e[0]&&void 0!==e[0]));if(!t&&0==r.length)return t;if(!t)return this._MergeElement(e,r[0][0],r[0][1],r.slice(1));const o=r.reduce(((e,t)=>e+t[0].length),t.length),a=e===s.o.PositionKind?d._TransformVector3Coordinates:e===s.o.NormalKind?d._TransformVector3Normals:e===s.o.TangentKind?d._TransformVector4Normals:()=>{};if(t instanceof Float32Array){const e=new Float32Array(o);e.set(t),i&&a(e,i,0,t.length);let n=t.length;for(const[t,i]of r)e.set(t,n),i&&a(e,i,n,t.length),n+=t.length;return e}{const e=new Array(o);for(let i=0;i{const i=s.o.DeduceStride(e);if(t.length%i!=0)throw new Error("The "+e+"s array count must be a multiple of "+i);return t.length/i},t=e(s.o.PositionKind,this.positions),i=(i,n)=>{const r=e(i,n);if(r!==t)throw new Error("The "+i+"s element count ("+r+") does not match the positions count ("+t+")")};this.normals&&i(s.o.NormalKind,this.normals),this.tangents&&i(s.o.TangentKind,this.tangents),this.uvs&&i(s.o.UVKind,this.uvs),this.uvs2&&i(s.o.UV2Kind,this.uvs2),this.uvs3&&i(s.o.UV3Kind,this.uvs3),this.uvs4&&i(s.o.UV4Kind,this.uvs4),this.uvs5&&i(s.o.UV5Kind,this.uvs5),this.uvs6&&i(s.o.UV6Kind,this.uvs6),this.colors&&i(s.o.ColorKind,this.colors),this.matricesIndices&&i(s.o.MatricesIndicesKind,this.matricesIndices),this.matricesWeights&&i(s.o.MatricesWeightsKind,this.matricesWeights),this.matricesIndicesExtra&&i(s.o.MatricesIndicesExtraKind,this.matricesIndicesExtra),this.matricesWeightsExtra&&i(s.o.MatricesWeightsExtraKind,this.matricesWeightsExtra)}serialize(){const e={};return this.positions&&(e.positions=this.positions),this.normals&&(e.normals=this.normals),this.tangents&&(e.tangents=this.tangents),this.uvs&&(e.uvs=this.uvs),this.uvs2&&(e.uvs2=this.uvs2),this.uvs3&&(e.uvs3=this.uvs3),this.uvs4&&(e.uvs4=this.uvs4),this.uvs5&&(e.uvs5=this.uvs5),this.uvs6&&(e.uvs6=this.uvs6),this.colors&&(e.colors=this.colors),this.matricesIndices&&(e.matricesIndices=this.matricesIndices,e.matricesIndices._isExpanded=!0),this.matricesWeights&&(e.matricesWeights=this.matricesWeights),this.matricesIndicesExtra&&(e.matricesIndicesExtra=this.matricesIndicesExtra,e.matricesIndicesExtra._isExpanded=!0),this.matricesWeightsExtra&&(e.matricesWeightsExtra=this.matricesWeightsExtra),e.indices=this.indices,e}static ExtractFromMesh(e,t,i){return d._ExtractFrom(e,t,i)}static ExtractFromGeometry(e,t,i){return d._ExtractFrom(e,t,i)}static _ExtractFrom(e,t,i){const n=new d;return e.isVerticesDataPresent(s.o.PositionKind)&&(n.positions=e.getVerticesData(s.o.PositionKind,t,i)),e.isVerticesDataPresent(s.o.NormalKind)&&(n.normals=e.getVerticesData(s.o.NormalKind,t,i)),e.isVerticesDataPresent(s.o.TangentKind)&&(n.tangents=e.getVerticesData(s.o.TangentKind,t,i)),e.isVerticesDataPresent(s.o.UVKind)&&(n.uvs=e.getVerticesData(s.o.UVKind,t,i)),e.isVerticesDataPresent(s.o.UV2Kind)&&(n.uvs2=e.getVerticesData(s.o.UV2Kind,t,i)),e.isVerticesDataPresent(s.o.UV3Kind)&&(n.uvs3=e.getVerticesData(s.o.UV3Kind,t,i)),e.isVerticesDataPresent(s.o.UV4Kind)&&(n.uvs4=e.getVerticesData(s.o.UV4Kind,t,i)),e.isVerticesDataPresent(s.o.UV5Kind)&&(n.uvs5=e.getVerticesData(s.o.UV5Kind,t,i)),e.isVerticesDataPresent(s.o.UV6Kind)&&(n.uvs6=e.getVerticesData(s.o.UV6Kind,t,i)),e.isVerticesDataPresent(s.o.ColorKind)&&(n.colors=e.getVerticesData(s.o.ColorKind,t,i)),e.isVerticesDataPresent(s.o.MatricesIndicesKind)&&(n.matricesIndices=e.getVerticesData(s.o.MatricesIndicesKind,t,i)),e.isVerticesDataPresent(s.o.MatricesWeightsKind)&&(n.matricesWeights=e.getVerticesData(s.o.MatricesWeightsKind,t,i)),e.isVerticesDataPresent(s.o.MatricesIndicesExtraKind)&&(n.matricesIndicesExtra=e.getVerticesData(s.o.MatricesIndicesExtraKind,t,i)),e.isVerticesDataPresent(s.o.MatricesWeightsExtraKind)&&(n.matricesWeightsExtra=e.getVerticesData(s.o.MatricesWeightsExtraKind,t,i)),n.indices=e.getIndices(t,i),n}static CreateRibbon(e){throw(0,o.S)("ribbonBuilder")}static CreateBox(e){throw(0,o.S)("boxBuilder")}static CreateTiledBox(e){throw(0,o.S)("tiledBoxBuilder")}static CreateTiledPlane(e){throw(0,o.S)("tiledPlaneBuilder")}static CreateSphere(e){throw(0,o.S)("sphereBuilder")}static CreateCylinder(e){throw(0,o.S)("cylinderBuilder")}static CreateTorus(e){throw(0,o.S)("torusBuilder")}static CreateLineSystem(e){throw(0,o.S)("linesBuilder")}static CreateDashedLines(e){throw(0,o.S)("linesBuilder")}static CreateGround(e){throw(0,o.S)("groundBuilder")}static CreateTiledGround(e){throw(0,o.S)("groundBuilder")}static CreateGroundFromHeightMap(e){throw(0,o.S)("groundBuilder")}static CreatePlane(e){throw(0,o.S)("planeBuilder")}static CreateDisc(e){throw(0,o.S)("discBuilder")}static CreatePolygon(e,t,i,n,r,s,a){throw(0,o.S)("polygonBuilder")}static CreateIcoSphere(e){throw(0,o.S)("icoSphereBuilder")}static CreatePolyhedron(e){throw(0,o.S)("polyhedronBuilder")}static CreateCapsule(e={orientation:r.P.Up(),subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6}){throw(0,o.S)("capsuleBuilder")}static CreateTorusKnot(e){throw(0,o.S)("torusKnotBuilder")}static ComputeNormals(e,t,i,n){let s=0,o=0,a=0,l=0,c=0,h=0,_=0,d=0,u=0,p=0,f=0,m=0,g=0,b=0,y=0,v=0,A=0,C=0,S=0,x=0,T=!1,E=!1,R=!1,P=!1,I=1,M=0,D=null;n&&(T=!!n.facetNormals,E=!!n.facetPositions,R=!!n.facetPartitioning,I=!0===n.useRightHandedSystem?-1:1,M=n.ratio||0,P=!!n.depthSort,D=n.distanceTo,P&&void 0===D&&(D=r.P.Zero()));let O=0,w=0,F=0,B=0;for(R&&n&&n.bbSize&&(O=n.subDiv.X*M/n.bbSize.x,w=n.subDiv.Y*M/n.bbSize.y,F=n.subDiv.Z*M/n.bbSize.z,B=n.subDiv.max*n.subDiv.max,n.facetPartitioning.length=0),s=0;s!Array.isArray(e)))],d,"_TransformVector3Coordinates",null),(0,n.gn)([c.G6.filter(((...[e])=>!Array.isArray(e)))],d,"_TransformVector3Normals",null),(0,n.gn)([c.G6.filter(((...[e])=>!Array.isArray(e)))],d,"_TransformVector4Normals",null),(0,n.gn)([c.G6.filter(((...[e])=>!Array.isArray(e)))],d,"_FlipFaces",null)},"../../../node_modules/@babylonjs/core/Meshes/meshLODLevel.js":function(e,t,i){"use strict";i.d(t,{g:function(){return n}});class n{constructor(e,t){this.distanceOrScreenCoverage=e,this.mesh=t}}},"../../../node_modules/@babylonjs/core/Meshes/subMesh.js":function(e,t,i){"use strict";i.d(t,{P:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),r=i("../../../node_modules/@babylonjs/core/Collisions/intersectionInfo.js"),s=i("../../../node_modules/@babylonjs/core/Culling/boundingInfo.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.functions.js"),a=i("../../../node_modules/@babylonjs/core/Materials/drawWrapper.js");class l{constructor(e,t,i,n,r,s,o,a=!0,l=!0){this.materialIndex=e,this.verticesStart=t,this.verticesCount=i,this.indexStart=n,this.indexCount=r,this._mainDrawWrapperOverride=null,this._linesIndexCount=0,this._linesIndexBuffer=null,this._lastColliderWorldVertices=null,this._lastColliderTransformMatrix=null,this._wasDispatched=!1,this._renderId=0,this._alphaIndex=0,this._distanceToCamera=0,this._currentMaterial=null,this._mesh=s,this._renderingMesh=o||s,l&&s.subMeshes.push(this),this._engine=this._mesh.getScene().getEngine(),this.resetDrawCache(),this._trianglePlanes=[],this._id=s.subMeshes.length-1,a&&(this.refreshBoundingInfo(),s.computeWorldMatrix(!0))}get materialDefines(){var e;return this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.defines:null===(e=this._getDrawWrapper())||void 0===e?void 0:e.defines}set materialDefines(e){var t;(null!==(t=this._mainDrawWrapperOverride)&&void 0!==t?t:this._getDrawWrapper(void 0,!0)).defines=e}_getDrawWrapper(e,t=!1){e=null!=e?e:this._engine.currentRenderPassId;let i=this._drawWrappers[e];return!i&&t&&(this._drawWrappers[e]=i=new a.q(this._mesh.getScene().getEngine())),i}_removeDrawWrapper(e,t=!0){var i;t&&(null===(i=this._drawWrappers[e])||void 0===i||i.dispose()),this._drawWrappers[e]=void 0}get effect(){var e,t;return this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.effect:null!==(t=null===(e=this._getDrawWrapper())||void 0===e?void 0:e.effect)&&void 0!==t?t:null}get _drawWrapper(){var e;return null!==(e=this._mainDrawWrapperOverride)&&void 0!==e?e:this._getDrawWrapper(void 0,!0)}get _drawWrapperOverride(){return this._mainDrawWrapperOverride}_setMainDrawWrapperOverride(e){this._mainDrawWrapperOverride=e}setEffect(e,t=null,i,n=!0){const r=this._drawWrapper;r.setEffect(e,t,n),void 0!==i&&(r.materialContext=i),e||(r.defines=null,r.materialContext=void 0)}resetDrawCache(e){if(this._drawWrappers){if(void 0!==e)return void this._removeDrawWrapper(e);for(const e of this._drawWrappers)null==e||e.dispose()}this._drawWrappers=[]}static AddToMesh(e,t,i,n,r,s,o,a=!0){return new l(e,t,i,n,r,s,o,a)}get IsGlobal(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()&&0===this.indexStart&&this.indexCount===this._mesh.getTotalIndices()}getBoundingInfo(){return this.IsGlobal?this._mesh.getBoundingInfo():this._boundingInfo}setBoundingInfo(e){return this._boundingInfo=e,this}getMesh(){return this._mesh}getRenderingMesh(){return this._renderingMesh}getReplacementMesh(){return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null}getEffectiveMesh(){return(this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null)||this._renderingMesh}getMaterial(e=!0){var t;const i=null!==(t=this._renderingMesh.getMaterialForRenderPass(this._engine.currentRenderPassId))&&void 0!==t?t:this._renderingMesh.material;if(!i)return e?this._mesh.getScene().defaultMaterial:null;if(this._isMultiMaterial(i)){const e=i.getSubMaterial(this.materialIndex);return this._currentMaterial!==e&&(this._currentMaterial=e,this.resetDrawCache()),e}return i}_isMultiMaterial(e){return void 0!==e.getSubMaterial}refreshBoundingInfo(e=null){if(this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(e||(e=this._renderingMesh.getVerticesData(n.o.PositionKind)),!e)return this._boundingInfo=this._mesh.getBoundingInfo(),this;const t=this._renderingMesh.getIndices();let i;if(0===this.indexStart&&this.indexCount===t.length){const e=this._renderingMesh.getBoundingInfo();i={minimum:e.minimum.clone(),maximum:e.maximum.clone()}}else i=(0,o.y)(e,t,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo?this._boundingInfo.reConstruct(i.minimum,i.maximum):this._boundingInfo=new s.j(i.minimum,i.maximum),this}_checkCollision(e){return this.getBoundingInfo()._checkCollision(e)}updateBoundingInfo(e){let t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t&&t.update(e),this}isInFrustum(e){const t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)}isCompletelyInFrustum(e){const t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)}render(e){return this._renderingMesh.render(this,e,this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:void 0),this}_getLinesIndexBuffer(e,t){if(!this._linesIndexBuffer){const i=[];for(let t=this.indexStart;ta&&(a=t)}return new l(e,o,a-o+1,t,i,n,r,s)}}},"../../../node_modules/@babylonjs/core/Meshes/thinInstanceMesh.js":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),r=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Misc/logger.js");n.Kj.prototype.thinInstanceAdd=function(e,t=!0){if(!this.getScene().getEngine().getCaps().instancedArrays)return o.Y.Error("Thin Instances are not supported on this device as Instanced Array extension not supported"),-1;this._thinInstanceUpdateBufferSize("matrix",Array.isArray(e)?e.length:1);const i=this._thinInstanceDataStorage.instancesCount;if(Array.isArray(e))for(let i=0;i=this._thinInstanceDataStorage.instancesCount)return!1;const n=this._thinInstanceDataStorage.matrixData;return t.copyToArray(n,16*e),this._thinInstanceDataStorage.worldMatrices&&(this._thinInstanceDataStorage.worldMatrices[e]=t),i&&(this.thinInstanceBufferUpdated("matrix"),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)),!0},n.Kj.prototype.thinInstanceSetAttributeAt=function(e,t,i,n=!0){return e===r.o.ColorKind&&(e=r.o.ColorInstanceKind),!(!this._userThinInstanceBuffersStorage||!this._userThinInstanceBuffersStorage.data[e]||t>=this._thinInstanceDataStorage.instancesCount||(this._thinInstanceUpdateBufferSize(e,0),this._userThinInstanceBuffersStorage.data[e].set(i,t*this._userThinInstanceBuffersStorage.strides[e]),n&&this.thinInstanceBufferUpdated(e),0))},Object.defineProperty(n.Kj.prototype,"thinInstanceCount",{get:function(){return this._thinInstanceDataStorage.instancesCount},set:function(e){var t,i;const n=null!==(t=this._thinInstanceDataStorage.matrixData)&&void 0!==t?t:null===(i=this.source)||void 0===i?void 0:i._thinInstanceDataStorage.matrixData;e<=(n?n.length/16:0)&&(this._thinInstanceDataStorage.instancesCount=e)},enumerable:!0,configurable:!0}),n.Kj.prototype._thinInstanceCreateMatrixBuffer=function(e,t,i=!1){e===r.o.ColorKind&&(e=r.o.ColorInstanceKind);const n=new r.l(this.getEngine(),t,!i,16,!1,!0);for(let t=0;t<4;t++)this.setVerticesBuffer(n.createVertexBuffer(e+t,4*t,4));return n},n.Kj.prototype.thinInstanceSetBuffer=function(e,t,i=0,n=!1){var s,o,a;i=i||16,"matrix"===e?(null===(s=this._thinInstanceDataStorage.matrixBuffer)||void 0===s||s.dispose(),this._thinInstanceDataStorage.matrixBuffer=null,this._thinInstanceDataStorage.matrixBufferSize=t?t.length:32*i,this._thinInstanceDataStorage.matrixData=t,this._thinInstanceDataStorage.worldMatrices=null,null!==t?(this._thinInstanceDataStorage.instancesCount=t.length/i,this._thinInstanceDataStorage.matrixBuffer=this._thinInstanceCreateMatrixBuffer("world",t,n),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)):(this._thinInstanceDataStorage.instancesCount=0,this.doNotSyncBoundingInfo||this.refreshBoundingInfo())):"previousMatrix"===e?(null===(o=this._thinInstanceDataStorage.previousMatrixBuffer)||void 0===o||o.dispose(),this._thinInstanceDataStorage.previousMatrixBuffer=null,this._thinInstanceDataStorage.previousMatrixData=t,null!==t&&(this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer("previousWorld",t,n))):(e===r.o.ColorKind&&(e=r.o.ColorInstanceKind),null===t?(null===(a=this._userThinInstanceBuffersStorage)||void 0===a?void 0:a.data[e])&&(this.removeVerticesData(e),delete this._userThinInstanceBuffersStorage.data[e],delete this._userThinInstanceBuffersStorage.strides[e],delete this._userThinInstanceBuffersStorage.sizes[e],delete this._userThinInstanceBuffersStorage.vertexBuffers[e]):(this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.data[e]=t,this._userThinInstanceBuffersStorage.strides[e]=i,this._userThinInstanceBuffersStorage.sizes[e]=t.length,this._userThinInstanceBuffersStorage.vertexBuffers[e]=new r.o(this.getEngine(),t,e,!n,!1,i,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e])))},n.Kj.prototype.thinInstanceBufferUpdated=function(e){var t,i,n;"matrix"===e?null===(t=this._thinInstanceDataStorage.matrixBuffer)||void 0===t||t.updateDirectly(this._thinInstanceDataStorage.matrixData,0,this._thinInstanceDataStorage.instancesCount):"previousMatrix"===e?null===(i=this._thinInstanceDataStorage.previousMatrixBuffer)||void 0===i||i.updateDirectly(this._thinInstanceDataStorage.previousMatrixData,0,this._thinInstanceDataStorage.instancesCount):(e===r.o.ColorKind&&(e=r.o.ColorInstanceKind),(null===(n=this._userThinInstanceBuffersStorage)||void 0===n?void 0:n.vertexBuffers[e])&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(this._userThinInstanceBuffersStorage.data[e],0))},n.Kj.prototype.thinInstancePartialBufferUpdate=function(e,t,i){var n;"matrix"===e?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(t,i):(e===r.o.ColorKind&&(e=r.o.ColorInstanceKind),(null===(n=this._userThinInstanceBuffersStorage)||void 0===n?void 0:n.vertexBuffers[e])&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(t,i))},n.Kj.prototype.thinInstanceGetWorldMatrices=function(){if(!this._thinInstanceDataStorage.matrixData||!this._thinInstanceDataStorage.matrixBuffer)return[];const e=this._thinInstanceDataStorage.matrixData;if(!this._thinInstanceDataStorage.worldMatrices){this._thinInstanceDataStorage.worldMatrices=new Array;for(let t=0;tnew c(e,this.getScene())),this);if(n.name=e,n.id=e,t&&(n.parent=t),!i){const t=this.getDescendants(!0);for(let i=0;inew c(e.name,t)),e,t,i);return e.localMatrix?n.setPreTransformMatrix(o.y3.FromArray(e.localMatrix)):e.pivotMatrix&&n.setPivotMatrix(o.y3.FromArray(e.pivotMatrix)),n.setEnabled(e.isEnabled),n._waitingParsedUniqueId=e.uniqueId,void 0!==e.parentId&&(n._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(n._waitingParentInstanceIndex=e.parentInstanceIndex),n}getChildTransformNodes(e,t){const i=[];return this._getDescendants(i,e,(e=>(!t||t(e))&&e instanceof c)),i}dispose(e,t=!1){if(this.getScene().stopAnimation(this),this.getScene().removeTransformNode(this),this._parentContainer){const e=this._parentContainer.transformNodes.indexOf(this);e>-1&&this._parentContainer.transformNodes.splice(e,1),this._parentContainer=null}if(this.onAfterWorldMatrixUpdateObservable.clear(),e){const e=this.getChildTransformNodes(!0);for(const t of e)t.parent=null,t.computeWorldMatrix(!0)}super.dispose(e,t)}normalizeToUnitCube(e=!0,t=!1,i){let n=null,r=null;t&&(this.rotationQuaternion?(r=this.rotationQuaternion.clone(),this.rotationQuaternion.copyFromFloats(0,0,0,1)):this.rotation&&(n=this.rotation.clone(),this.rotation.copyFromFloats(0,0,0)));const s=this.getHierarchyBoundingVectors(e,i),o=s.max.subtract(s.min),a=Math.max(o.x,o.y,o.z);if(0===a)return this;const l=1/a;return this.scaling.scaleInPlace(l),t&&(this.rotationQuaternion&&r?this.rotationQuaternion.copyFrom(r):this.rotation&&n&&this.rotation.copyFrom(n)),this}_syncAbsoluteScalingAndRotation(){this._isAbsoluteSynced||(this._worldMatrix.decompose(this._absoluteScaling,this._absoluteRotationQuaternion),this._isAbsoluteSynced=!0)}}c.BILLBOARDMODE_NONE=0,c.BILLBOARDMODE_X=1,c.BILLBOARDMODE_Y=2,c.BILLBOARDMODE_Z=4,c.BILLBOARDMODE_ALL=7,c.BILLBOARDMODE_USE_POSITION=128,c.BillboardUseParentOrientation=!1,c._TmpRotation=o._f.Zero(),c._TmpScaling=o.P.Zero(),c._TmpTranslation=o.P.Zero(),c._LookAtVectorCache=new o.P(0,0,0),c._RotationAxisCache=new o._f,(0,n.gn)([(0,r.hd)("position")],c.prototype,"_position",void 0),(0,n.gn)([(0,r.hd)("rotation")],c.prototype,"_rotation",void 0),(0,n.gn)([(0,r.mv)("rotationQuaternion")],c.prototype,"_rotationQuaternion",void 0),(0,n.gn)([(0,r.hd)("scaling")],c.prototype,"_scaling",void 0),(0,n.gn)([(0,r.qC)("billboardMode")],c.prototype,"_billboardMode",void 0),(0,n.gn)([(0,r.qC)()],c.prototype,"scalingDeterminant",void 0),(0,n.gn)([(0,r.qC)("infiniteDistance")],c.prototype,"_infiniteDistance",void 0),(0,n.gn)([(0,r.qC)()],c.prototype,"ignoreNonUniformScaling",void 0),(0,n.gn)([(0,r.qC)()],c.prototype,"reIntegrateRotationIntoRotationQuaternion",void 0)},"../../../node_modules/@babylonjs/core/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js":function(e,t,i){"use strict";i.d(t,{$:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js"),s=i("../../../node_modules/@babylonjs/core/Maths/sphericalPolynomial.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.color.js");class l{constructor(e,t,i,n){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=n}}class c{static ConvertCubeMapTextureToSphericalPolynomial(e){var t;if(!e.isCube)return null;null===(t=e.getScene())||void 0===t||t.getEngine().flushFramebuffer();const i=e.getSize().width,n=e.readPixels(0,void 0,void 0,!1),r=e.readPixels(1,void 0,void 0,!1);let s,o;e.isRenderTarget?(s=e.readPixels(3,void 0,void 0,!1),o=e.readPixels(2,void 0,void 0,!1)):(s=e.readPixels(2,void 0,void 0,!1),o=e.readPixels(3,void 0,void 0,!1));const a=e.readPixels(4,void 0,void 0,!1),l=e.readPixels(5,void 0,void 0,!1),c=e.gammaSpace;let h=0;return 1!=e.textureType&&2!=e.textureType||(h=1),new Promise((e=>{Promise.all([r,n,s,o,a,l]).then((([t,n,r,s,o,a])=>{const l={size:i,right:n,left:t,up:r,down:s,front:o,back:a,format:5,type:h,gammaSpace:c};e(this.ConvertCubeMapToSphericalPolynomial(l))}))}))}static _AreaElement(e,t){return Math.atan2(e*t,Math.sqrt(e*e+t*t+1))}static ConvertCubeMapToSphericalPolynomial(e){const t=new s._;let i=0;const n=2/e.size,l=n,c=.5*n,h=c-1;for(let s=0;s<6;s++){const _=this._FileFaces[s],d=e[_.name];let u=h;const p=5===e.format?4:3;for(let s=0;s(e=e.slice(1,e.length-1),n._HandleParenthesisContent(e,t)))):n._HandleParenthesisContent(e,t))||"false"!==e&&n.Eval(e,t)}static _HandleParenthesisContent(e,t){let i;t=t||(e=>"true"===e);const r=e.split("||");for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)){let s=n._SimplifyNegation(r[e].trim());const o=s.split("&&");if(o.length>1)for(let e=0;e(e=e.replace(/[\s]/g,(()=>""))).length%2?"!":""))).trim())?e="false":"!false"===e&&(e="true"),e}}},"../../../node_modules/@babylonjs/core/Misc/arrayTools.js":function(e,t,i){"use strict";i.d(t,{B:function(){return n},M:function(){return s}});class n{static BuildArray(e,t){const i=[];for(let n=0;nfunction(e,t,i){const n=e[t];if("function"!=typeof n)return null;const r=function(){const n=e.length,s=r.previous.apply(e,arguments);return i(t,n),s};return n.next=r,r.previous=n,e[t]=r,()=>{const i=r.previous;if(!i)return;const n=r.next;n?(i.next=n,n.previous=i):(i.next=void 0,e[t]=i),r.next=void 0,r.previous=void 0}}(e,i,t)));return()=>{i.forEach((e=>{null==e||e()}))}}},"../../../node_modules/@babylonjs/core/Misc/brdfTextureTools.js":function(e,t,i){"use strict";i.d(t,{$:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),r=i("../../../node_modules/@babylonjs/core/Misc/rgbdTextureTools.js"),s=i("../../../node_modules/@babylonjs/core/Misc/tools.js");let o=0;const a=e=>{if(!e.environmentBRDFTexture){const t=e.useDelayedTextureLoading;e.useDelayedTextureLoading=!1;const i=e._blockEntityCollection;e._blockEntityCollection=!1;const a=n.x.CreateFromBase64String("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/z05/9i3/13/0PX//eX/2FyP8tIv+PiPy9iPy/IvIzEfm5iPxCRH4lIt/c/393//9BRD6KyKf7f488fP74/PH544dJAF9cLl98IZfLBZtuqterXr/7Dt9982v95S9+Lv+gF/3i7Spv/8lf/vnf/vGf/dF/JfKnIvLnIvLvReQ/NEngn0TklyLy6/v/34jIt00iGJOBlxAsdvv54/PH5493SQCXy9t2ueh2ueimKorrFbjq9eNH+fDtb+TXv/ol/vHyhX4Fxfbx7euPf/Lnf/PfiPyeiPyhiPxxkwB+fk8AvxzQgJcIrGTwFsiAEXH4/PH54/PHUgLY7whgu2C7bLqpQgHB2xvePn6SDx8+6G9+84384vKF/IPu8iVU9Y/+7C/+jWxffiHytYj8VER+X0T+oEEBvxqQwCMJeIngo5EI3goIwVMIPn98/vj8ESaAbbtu2ybbvl8u2ybbdtluSECA65u8ffqIDx8+6G++/VZ/efkV/sO261dQXP7wT/7kX8vl8qXIFyLylbySwe/dE0CLAr65B/9vGn0gQwRMMqgmhM/J4fPH548eAezbZd/lsm3YtssNAYiqiogAAkCvb5/k46cP8u2HD/rrb7+R/2/b9Wu9yJe//8d/9Ney6S5yEZFdRL68/38khG/uKOCnAwoYkcCoEXwkEgGDDq7CeQfyOTl8/vhd1QCum26ybZtu2yabbrKpQvXue1yvuF6v+vbpTT5+/CDffviAX1++1V9sO77WXb/66R/+4V/dgkbllQi+aBLBV/dE8LWRALwkYCWCNyMZXElkwLTMeMkga/P4/PH547ccAVwuctkvdxSw6bbdtYDbTfSZBN7e8PHTR/3u4wf55vKd/nL7DX6mu3791U9//5+/gkNFZGuSgZUQvnKowKgLWLTAQgRtEniTuEfwaELw0MJvf3LQzynud+53uG+X6y3gN9kul+2y6XVT1U27JCDAFVc8ksAn/e7jR/nN5YP+avtWfq6Xy9f7Vz/9w1dgRYngiyYhfNkkgzYBWHTg44AEMmqQUYQKOmDaiCIa8TmsfmzB+DnZDQjgcpGLbti2y3bZHjRAdRMVvb/dcYU8kcDbPQlsH/CrbddfbF98+RPZfvLFnAQeieCRDC5DMvju/vmD4JkEvjRQgKULeGggowdHkAHTYxihg89vu88I5UeGAPSOAFTlrgPopiqbKPSmCKreUoAAkCcSePukHz590m8vH+WbD9/JP335k6/+tA86KxFchv8jMvhiogE4JQm8XhfKqOAqx5qRPyeGzx8/cgSwbXcUoLJtim27C4Oi93+4v6VxQwKAvl2v+Hj9pB8+fZJvt4/yzfbF9lPdv/wJnsE2BogmyeCRED40tGFvksIXiSbgiYSRRpDNDZ6BDI6ghM+J4fPHeyKAO+zX7cb9t4tedMMNAQju5V+f1uAtBSiu1zsduMrHy5t8ePsk3376KN98sX/xE5FPAnm7/782o0DiUINXMkCXCB7/P94/e87AWUmARQWVvgMuKej9t1RLBp+Tw+ePgwngsutFFdu26WXbbl+rSvdfbnqAiuA23QcBgCugV1zl7e1NPm5v+LC96XfbJ/1W9y++fgXjA3bDYXV+MuhRwSPwL3JLMFYC+HS/LU8HYrGwIhwyNOF12SvgM4SgztdifP85MXz+KGsA2C6X7aJ6bXSAOwrY5OYIqGy3d5uq4P5GhABXuV6veLvRAf10fZMPb2/y3b7vX7+g+9v98/WOBq7GG7RNAlYy+Dgkhhb+Xxp0sE8IAC4SGAP/TbgVJK/PoJPBnAiwPKxsXfbbnRg+i3s/JAK4Q/4b9NfLtomBAqCickMBjy7BuywAUVyv8na94tMjCVzf9KNcLl/0SeA6oAEYb1i9g+FtSALb/bKL8/+t+wxXFMyswqiHoK4ToIgKqslgpg1qUC0QoYbvJZg/B/q5v4szHmPX7YEAsD0CX25OwEUVm9xag1+agKg+nxQArnKjAtDr9U0+Xd/k4/UqH7bL5YsewrcBBiMJZPRAp6TwQgWfjM9vgRbgUYGL8AvLWH2gqhesCokeUmCSwPsnhs8fP2YNYMO2XeSmAWxy2VQaXeDmDIhApf33rD4PTUCuV+DtCn27XuXT5ir8VmCJ2G5BpBM8/r/dEcJb8/0lEQMtJHA5TAlqNuLRhJChhEpSqFabH3di+G1AGj+W1/dyAR4IYJNNnuLf6+tWC9CHHiAtFhAIFLjK2/Uqn65X+SS67aK+3QeTDoy/IG2ogQ7fb/dAtz5vBgrYGqrwNtCHsVfgIvwK07OTQBURVNCBFpKCOjqCHn5L/67TgTN+fpySAC56nwSUi256kXsSuFGAVyLoUIDo8/Pz7fdoErr/v17lk162HbgHvFpIYDfoAJJfW4sGPjkU4VNAF8ZEcLmLhdc7kljdY1y1Dq9yLiI4IiRqcLujb138KIPn80ejATwRwIbtBvn1cqv+2J78/5EI5N4cJA8qIPcmwRsKAHDF9WYP6mV7VmrgLuTpxYTcMEW0LAmoQxFsuvAI8tv/a/C5fV2ZMMiKg++FCM7RDPRu8ebWY7VG6VJi+Bzk35MI2LsAckMAgwvQ0gC5DQjd3ABg2HQLAPpEAlZ1Bu7VV7MGHDFRAbo3VKsTbAY9sPWC/uvx86gBbDK3D1eEQS8pbAeSgSwmhepnJb6uBv/o/PzHLzxWA/X7TH77De5j6AGQi6o0CUGfCOD2X7cXAlCFQABtEsGLDtxuOyQB2UTQBKZe5GUPXgkUYCUAbZJRhBDeuq8xBf+bgwbehDm+BFQi2IJksOocvA8ysIMfxluVcRsY/eB3JzH8GFDAXQO48X/dcIf9jyDHptIigDsFkEe066tBSETQUYF7ElDdYEBytN4+rk9UcBPfrKaZqFHWcw3i4J8/X4ev2//bSXqAhwTay6OEIPLD2Ipt8OtAGzxkwLw9WVFRjTc/qC6H3+YK/b1oAA0KuOizHfieCLaHHiAb5NYTIC9EMEbZrVEQt1xwhVy1UfBh8PUOquMizwaap3tQXfY5B//tea/NZdfhsvbz+PURQTDSGWB87VX/7WSd4KxjUqrIgE0IUkoKGnhIvwvawpGf6eECXJ7tv4qbA7DJgwpsKthEmmYgfaAAffYF3HLxo0vwNjJ0SwRWMG4db4eh1gPNm18vQ+us/0eGmxDemu/fnM/X4evq/8342ksGHgLY5LyT/zg0wM8lcMjgGFXwqIOVFJBQw99eCvF9oZL9Mfl3QwAvIXDsBRC9R+fz8x0FPBLB0xJEpwUobrfAkARgIAF41h3wQgP6QAmX5E/7eI43IxGwwf/moIkRyWRJQIPgt9CA9b39nzt4bYUWjAlCjWDPgv8IEjgLJfzuaAsrv9VdVG4OwOXW/fdoA35qAdL0BDwvf6AAUVHd8LIEu94A3K+Q+2YxaB84MOH62P//qoo38fCRDERE2zf0JfmDa+MieElAjcDPKz+mRKCOtdgGtXaBjgNJ4H2owSpNeAW/rRH4CaHSpMwnBYYycjgSJwfie9CR6mPu20Uv8kABF206AvXlBMiIBPSlB9wjBW1fwEuSb94296VCqgMaGCt/G1BbExi3IG+r3a3J6P48Gv/J0YmEYoiGY7V/SxwFCwGoE/xa0AJ0CEiV9QPCJb1OJ5F1VTjEY2/MO9AEJvj1BJTQpqLfTlGwjABuzT962e4IoKnyrdh3+/6mzDVJ4PHOxj0JqGKoy20+wBMN6D1gLWi9NQHfVP5MEEPzjGYy8BMAOnTAJgEr8HUIejRo5xrA5xkR5AngmiSHs+zDDAmMgWzTg55GSJEmHE8IvWPAoYTfhWak/Wn/bQ0CGLSAjv83SUEfKp5q24LXuQICpzrjrgWoza8xVE00CQCORdhMJuTUT/rjuls0gO4Iby8BIEgK6gS7BsGuTtDrScH/fR68biUHNVGBnxjeNyHEvQe/ve3LZQqgG3rof6cEclsNflG9J4KtaQ8WHcVBHS1BtHE4QP9OBMS98mpbKTeDW7dJwRsnHpMBTFJpV4I+b0kY/NqInVFSyBLANbnMSgBM8F+Fqfxq/h657/Up+GaBnwV9hRqc9bZ/vA6vu+T9E8KPJWns94UfTeCj2QXwCHS9dNL8Xf3Ho/rfewSeFODGDV69AU0y6NFAE1DP3qK++rdB7/1HRxf86gT376zOr99T/h/ioBiXWQkgQgVeIrCC/WomhDmQK+hASI2ARQZKooHMLdCJwGEBBXC3+uERwg+VOHZ9ioAt9H80AI06wGgJ3nQA3BoCut6AhxYwgcPOFnxuFnrphk+NIKIGrWPQtgz3b0i7Y6D5rs1GKqTop0nQX52vmQC4BkjA+r4a7Kx9WLENGeegkhSETBCrNXIMdi/444Rw1n6E96ry7OPuj8UfLxtQ78NA2iSBbg7gIiIbdDLsb5agPhLC3RkYKv8NDbS2YGsatNRAG2oQwf9ZIOydgy1MAzBkAw8UwEEIDzSAqdPQ6za0PkeJAMH3Z0wXniUSZoHvBXU2mcjQgv56TedIKglCpIoQfgwCIjOytd8WgN0bfxoR8Fn9Gx0Aj5Zgq0lIZbsH/ibSJoFnS+C98g9ooHEELI3gliy25yONIiE6pb0NfBlyNEYyENoodkKwgl6I6s8kARgJ4ZoEfuYWHLEJa0LhSBXm7kImGeSfVdoJ1DO2G7WXsehAptupSOoyrCSF904k+6vt98X/ZcM98Hsd4JYIXhQAIg3/f9AAUYhsLQKAtkHVBnzjCKhOoYl2ym+iBtvzDzQ2DLXJ4PUmbJHAVnBQX4jkxfvHhNDqAdHXGQJgv0aSDGItgOseHIU+K9hXnIJzkoGlEKzNHagTdJ6VWEUH4iCKH4fd2AwDPaYBm4Wgng4gQ9V/CoGiuNmD04AQtNGMGzSAAQ2I2pzfogY9LRh7BrbOh4+D30sAencljFu2CUFrwY8UAWRfWwGvVOVfbx2uIILM0pwDv082dUTw8hYs8L+uIWiHGpWgClnAa1lMPJogovvvbePPs/q3Xr++kgCsfgB5oQF9WYKPJqEn6G+OE3i5AqouF59FQOmahQC8rlPLj38kg1c2f30vw+XaoIX24/pMGIgSBoZqoH3wo0sIIGlA9PWcCPrAtpPB8eBf6x1o6cHra+2+tpIFP4PgBfxZtZUJfo4qxELT948D9ucK8Mt9+ccjIQw6QJcEbrD/1g340ATuDgDkFfx6twSf1f9xvuBECYxq/7ythQQGm+5JDx6Brw4CkMGT3wgscCUoQ4sU2t6DR2ciBjTgtcpenQoZVX9NuL4Owc+dVaDursYVkVALX+shjSBKBuvCYDUZjE5BdNkxdHAUBexyHwB6NP7Iyw7sxUDViwge1t+mz8B/LAvVx/c3PeBBCToB8IUGOgqA3iV4yUg6UAOxaUFHDx6CYS8SorMOue0CCJGAf5YfRhoAI+A1CvwxqNkAY5yAIx2EQmkFfeWOXi+nEdSQQA0ZHMEItiagJArQxDXIrj8nCfQi4HZPAttrIahso9oPQ/2/JwV5JQU8zw+7I4D7/sBn4EO6rjw0FR+i3Z9fHtahzsFvJgM0X+tmVH5vaYiNDGAigewAz+gyNLThnjCURQFR1b9d3lZvnVqmj9mEPDKIUIC4KCCjBXywS4N+otp/Hk3QVthOkwEKlV9PQwXjT7s/zwF4Qf9toAAzFdjuaEB6S7D1//U5FIQu2MevO0rQQH8ZmoXE6B/IkgE60XCjVoq8gt2iCG0S8L5GdxkM1cGsfsCMArSCAnrr7dzAZxCEEpepvB8tqHJ/q+bmJGGts/AcAXFOMMeTwC7Pw0B6CtCtA2vWgonqBQJFSwH0JQK29OB2kvgj2HHXAoyeAIsCQO0kMNECAhFMqCBf8mElAkyBbX1tJQP2RJ/ha0gpAfS9l+/5n00CkrQpq0MZbOdAuxmMvHswog62jZj7BnYQe19b14kxNq2D/ehX/p68HEcF+x3yP7z/V/A/q/5DA3i5A/dzA5pdgbKp3v3/wQF4Bb70WkCTHGRAA6+KL0bFl6FJaFw0ImZwm6igSwbbwPn9RMBWf3sN2JgA/BVh/Rg0kQBgePf6HglAHLFQwqQQOwDjbdVxNZjR4iM6Qa3WxwvNxh0JFb3g/WzFQQS8b/ttKcDWoABtUMAd8j9hf0MB2uDXhzX4CHj03L9DBU3Qjz0C0l4mLSLQPicOOwZoVCB6P6dA7nDbGkVuxcNr8PU2JQO4wX5trEqmccZaHU4q8oCDFOpzAnOwqyMIMktNNNAHouDGxO37DgArQZzlmp/14W1QlqHTMaIIx7SCx0+5yza7AKJ3IXBrNAHVDcMZAU/BT/vgv/ULPOA+XiLggAREDF2g0ci6xNDRglegd7P7TWWH5oJfayliEg7bScQRBVgI4Ookg/F6rvpLWP29swREqA3CaG8/FpKqS8DTAV4TiBqIqtxfzaQRLys5I0XEFIFrPbZRQb+16Fgi2LvJv8EFUPW1gGfQv1T/F/d/HBnccP7rAwnIIyHI4ArgWeGbU4eHy6Tx/EeTZIb5bo/BsMBjmjBE08f/RB0PHYBd9eVRAGY7cHRwiBf8WeCPHY1bgBTa9xKTELzEkQX9CPtl0gJiqsAmCT7I8xbjivh3JGFI+D2nBcSJQJ8agDX+O9iBL7UfG4bzAkcaICrbtYHz1ycSmGmAjJfL3CMgT3tQpmrfB7gxSzC1DnvdhQMieG47u75+kTouKNkM8c/+vq/Q7ZYjO/hhVvRq8F/9gGfhP8aqE9EIdR6LTwJ1h0BItyDqB8iFwuNqASscRnYioxOg9ApvnYA35f8e9Ohbfe8J4rknoFkO0lmA2gmAG0YK0DkB4ieEjiLoMD8wBzom27ANZkzIoU8EMHk/uo1mzeVoEoRWKn8L/62EYAX/lsB7D/LXg74uAMr9oGivJ0CNJCGD6i9DhZdQF+gtOp4S+NODRzsDVbhdgv4BqTMNyIL9SCKwL9/FGPp5oQKxIf8A/UX6r231H7YIqLML0Ae2GtrADOvRQH5b/MPE9dt9BGLNG8jVTAQvIaK5TtvvvWQgDvyXIClUA78S9Nfg7VtIBlO7cbsEYkQDMot+ygQ7QwmOawTHnAM2XUSnJvPIYRYMmYPS+sv3J+cfP3d04JYIXsF/EwMbBKB9Q9AY+BiSwFj9mzrSXmcJhFPVHySTbgHJCPvRQ/z7G/SVUETsg0ZF+i3CRoCjhf7y1A9mOiDD7TwdwEoEXjLwAv+avLE2B7Jnb+OqDpBoAchoQJskxKnss0vu7Q2YhcDv4ySeLOg9GsCKiUIihP7yfW7zbTsBh0TQfN0iAWn9f72Z56/Ax9P7j5OAH/Qvv3/QxKfk0DgDuP+R3USg3bzBC7bO/QT9Eeh9QvDPG7glBQzJwK740lAFFgFk8P88CqDGAa223YckWYhr+c0BPdwetl2ocnsfzePAWcVnnAIp6gDVhDLyfV4nqFEDPxHsbWD3k4BDkN+pARqKMLYBPzYEvxp9xmCHQQdgWH/9EtH2TIFpu3AH/cdGydv1j0TQbRrq+D/mLcX3ZACZ15bF378CG0My6Kq/zoGOQwhASDFwFbxyNGBuSxbCEhQ/uEPe/6gAERWQObCVVfjPpQX+rexxYhYFxIkgpgX7Y/vPs+Pvxf9vwt8kAs7i32t3QCP+3SPaTwIytQXP38u0PESm+YER+o9B3vr8mETAUfDrEkPI80ck0FZ0dXh9U+HRbhey0cAc2H7A4y4egoD6y8JfkBiigLdFP8v2W00E8deT2IeAKujZ/QAVKpAtKI20gLWksHedfgPcb+0+NEHefd9vB9rayi8h7J91gBbaw20MsnWAF5xHkyDUCOoXp+yrOwwxcKj0aL6fFppaaKDv6OpHR5sgx5BAlK/+fYhuP1D196o8e7lFBaKqv5YIMnFQpd0FGVR35RJCnCDaABaXBtgbiSwtICMtalKC+1JQ6bx/PLcDPQL91QFodQNKpwOgF/9eqcBxBBqRcKAAVk+ArQOMx1RYGgB6naDhlK+uQQwJYx4meQbxtNnYQwMjt/d4f3M9ZE4UOld1LAh99fbfzOxiEkKFCkTJIUIMUeVnJ/9sDt8/e1NEJOi9oVHDGYhgnSLss9DX2IAqw1zALUncKcDr0FB5NP+0cBQNrEezDiyiADPkt9qGpwoPdL0AGPx/NOKeyf3b9WJNdfcFv6bKd2cLMJVfJ6Y3B6wB9WFUfWWEwKMfGiQL+3bz9XGQz2EHKhF41GCtZyDi/gUCsNhYoAr3UNJ58YidHKqnMb/6AB5J4N73/4L+t7mAkeeP3P+1LNSB/l0SkMEd8DcEuUlguEw6t2AU/PCE/q++Akw6QFf1u6SBrj1ZnnhG50AfkoGIdf7gJv1KcSfgzWWkQ9U33Z3tHXYASKJ9e/YhU90rvD+q9Ej69/wxYJVs506Eg/r3DkMDzEdDBRGgcZay49XihLA30P+l8N+hf1f57/0AoxbQbwYaan/rBMirE9Dk+sBzTkC8JNDEUlv5McB8PP19Y01Gayep+hC/2zvQ/2HGLAurowsNGlA1cnqGGzeH5weiYLZm7h3QQC4O2tXdhvMMk1ZS5ebpgI8eMrPvPGkwaxayk8Yc6PMOBPEdC1XZ+2UfbfOPtxLMQQAG9BcZFoF0gp/RKjxe7+oAw9T7ZPWhgedodgz0gf5KBtrtIZhQAZpAV1Bi36w6t98qVfH7hqGI318lLCjLCUFlxRHwqYEH9a2qb4XjWvDT7kBwfbZA5P0+PNuRuW1yf4yNQH3zzwv6b70QOJ0G9OT/dhoYRUGT15uQH/71MjQLtQlxfDuiCXrtM+SkA+icQdH6sU/xz7Ze7FlubV4TpoTQ2osdpaEjtqADmEU7OkBEFoLeC3IWFFeswJXKXzkboNL+wzcFHU8hTGKIboO7CLi1/P+5F+gydQhuvRbwEgxvtACmANikhLTbj0gCYk8KdlYgmj+4Ymaod7TwahwadICuX0Cm2fE5iNHPK0x/CDV66Kyg1MnqjNFBnhBoLQCgUULfaVe5nq/6EQWY67bXCszUb+7232fVPz51iGB12owK9peyP1T4raMFF/OEYJP792mgXYfZ04GHMAhBkCSmSj+dKqRPgVFGHbpLEGMiGFeQWfSgrY52VxaeDUPSNJI0P7NoisG729HHl78z6hxfs9rV3m4JjgM/lsui2qmThjCfDFSb+I9vwUqG5wwL55U7C+6ot8B+7N2o6r3q37T9trfpjgmTvv7PSQATLLeRAOZhIJHBQfDQQJPBdUwEbVW3+L08EcEE/9G4ANrCeWcnPKRHDupbNynMx5AA9IRYLmrc/YLSiD5EaEBS/s/TgnU9ILcH19n+CpHwegLejx7Mn/d25fdN+e9U/1vgb7bqf08MOtf8EXxaoh+GY8L6gDfhvs4i6HQ7seYI2sv1GchdMsBIG3xlvxcCRzdgCPTn+6q/TW00VE8Q9FaFv+R2VlOM1vm/hhjhDCdgNflVKME5B47I9xT8z0YgPAJ8myb/LqHy36j/Mwqw9AALxuO1JVjiuQAYLcFzIhiEPe05fk8tRjGw7yWQbsfuLAT2VqOId1osnr0F49VM8INACPHDoBz4B5mqqSnUgyh3ArjXxfQH5BbgUS8gP7aU+w0zHD9GGD0CGHf+P1p/DeivlhU4BbxR9a2kYFR58YaDZCUR2P0DMmgED2eg77puegy6PgDphEB0CwlG/i9d+/Hs34pBEQrBn0W51mqGnJAk3ACCHeiqkQ1XFQA5AlKH7Lk8yJKWY3/nym14h2C3JvxeMwD9ZVMz0BPMi1n1RbKl1cYhIVblF3G0ATsRiCMUvoK9//OgcwYMoe+ZKOLlC6/Xk50br9NFz9fanqA8UIYSpCwlBO4kHc4WLLBfBHVaKwKgLQjmP4Un61Vq+3s7Bsyi0WztmLjJwJwFeE0I2vD/1Q6MVwefxfUf32skCPbCnxQqf+QMPEUDHZ7vGeyj020JgkPXXwsldA7SYR1RE3h94NvNtugswcgxXEkIcBPCGZ1rmrgDC0A4K88nm2fn/eTnpQtWyZfybRoK8Dro4zYDIMGsf7saTBzvX0SMbkAD6o9CYbsfMK38cJKD9l2FJt9/VGs0h5Gib33pxMKWNsigFUh3G2un+/N1WUglI/EEx8fq27vUNnwsiOoKecL7kQS8VnWAGCFUgn6dBtQhv40CmIYggwK0uwDHRGAuBXVdfwzHUjZzATLMAoyJ4FmBhzaWBlrHld9CCWpPHRqofBqMReMGTJ78q9rDes1Tv7/0m0v0AFHXNR6P6g30SHivin7V1BOhh3iWPwvps/yE836L2XiwnUT8x2iHgfqhnwn667QHEE8oLQjEvtEW7GYBZDrDVkwNIO4G5GiBDf9fGoFM6n+vbEtzXwP6u9AduaWnGYSLAlVdl/AU+ikrSeEIKgwdaZ4AACAASURBVKj4/wtgHcHtdO2nWKcBkPfxcvnNQvsj2Me9f02r76T8q0IBn9OLKfz1HX8yVXQYGoAB/2UeBQ5/5kCL6+H/OGGoRnLSwdd3oH8r7KkGTbgIxEwVWvnF8KOpHnyzfF9Jod5Px+IF1h8owyitDw/XEgRb5bPqbt1uvn7qBIQ16vtS/u+DP3cR7CH0WWJgd5mTJKYgNzoGjQrfvu99NDBC+bnyW1x/qhTatv2OaMKgJWPvv5kwnMgxHYGFRtJW8VMl3uP+MgoqSZyWFKr7+KIDw1d6+IiOgZI4+d5iYL3imzbgyO+tph9t2oSBxOM3ugHtPoFZ1LM0hF4kXNEBssvVgPdjdXZWK7uKvyS3q1Xb1WQwtVDqSUggq+Vw3t56JA2cz7PXOwGNW1ecwxPhfe3QEUsDsFaAz8jg0nf+iZMAHNg/XSazDuC18Iq1HBRrOsAQ8NLB+16g614jmuSgs3bROxE55D+WDDQNA4ivdMJ9M1b309UqknaDU8ObV9/PwmMPATvTMAxpABLBzugUtV9bLdhNDQA+7B9tQJ06/7QNDHGSwtgZOCIA47InIoDdROQGtt0U1HI3GaoUnCnC/rzBMQJteN17+VaAzYNA7e+PFqHQUyXPUYB7iQYa5ZFjq1Zqpx8Uqu/XT7+6BWC1Xaj0GlBIwMoHu7UzcI/6/Acb8KIq+hzmGWmAYnADrIpvKP7TZeLaf0LAeQkGgebbq9FToI44p654F47tekKkI0L5PQNZPsDwPBpy/ni+wKMN76Vav4+2cFZFf8+JwAraMt0DFB7beA/u4Zz/a+RXx0M/ct4/jwaNAS8G17eSwmta0Fhx0VRxJkHMivso+onMXr+YwdWKbgioy1jp4x4AzIKg5lEA7wvHEYCRmdx11TAuT6lDLVl4KvXkAET9P4RT8H2u+lg9EPQIpw+/NpJ7RwE8HaDv/Mu4f3OdNkq/EfAiEiOANjEALvcWL9gfFV4NZbgbQc6qPky4Pm35QZxtH1f4j+P/jXuaYPcWwIEH/fmEPBoAO4m4LGxV3txOQqDU+dXgey+UwSzuqP++uImO/u/6ogCb7wTc1n61sL+vZi87rxnrNas+giTg6QLzaUCjIp6JfhwtGI7AjBBB9JjDY4ePYVR6ZPgN4owVv6Q2N5hhVHwNeYrM+w6dN6K1sMHZm/Ce7bHe3dzKr1xw1w4JrSQMZtgnoQHlr18fzunAszD4qurNUg/TDqzx/lfCaO6t4tACMUQ6P6htWjDPC1hCoZ8kpODzJ70MUR9AODcgwyqyPhmE+wfHYB/hvSqt6qeXUShhXH+d9SR8DzrDaZZdpSp/HxqLMQuATgDU/qDPRgOIeT8cvz/h/XC6BtE7ACLOWPE0KIS4UUjmZaJ2grBphiWgT41BUVWZfP3AnEIT6OrfoF122l2rMycBoU5i/OXoUZ4/aglsXwLzHNU++FVF3qikOj5HXm2PBitT1WuvJRAB+6O//W0/PY8vQH5IrAsMs/WuVmAdHBrQgrbOxJShXwRSsu08h8JMBpo0+aDTALwV4tbswgzHrftG/dJKIAQb5h9KCssWIMeto+GYqG12/HWGjx8kzqNJaa0noMWOr2KwW01AMwJoNvhMQda2/RKQP/3ecABM3g9uD6BY68Ntz9+nDOMb5iV+hIE+dP/Zs/wwJhJ9mgBnohBuStABUXjugF3hkXF9ZZJAjefKdHZCc389LoStKvIl7QIEb1d9RyciQgFDI9Cjyccc/23Aam7/PZJBhgDgin5CtQvbCzX8ip9YgIFtOAt+w0owp/hOiCWgEGbVHuYjRigPGR/YOnEoqPDoV5z5YqB3mRq2ox5ICmSSgAP1Ne+XV2NE+/vuFbCTRADxtS70VRBCjgBk2OyDUQiUgfl77b7DwaHm2rAZ7osRSOOUoHgKfNBSLI767+oDYrfwZvqChSpGfj3pFwZFsCJg2jeIQQBUiyI4WgD68ww4qO8khuWkkIuDrxWv2nv+UTBpJYiPd0KemTA8qqFiuUF1jWS3BoG6pADJq751JqBI0wvAVPyMQvjcX1zbELltKK+zBiXRFiRxG+b7q3M9xuLdzR8g0gCGNzSM5gNYfqGO9CBT8OHct6oB3KsSDBisUnwsFuISQaRHxDSv0vptt2oeLHMERfRn/FG/Cx01EpgIQG8LP+/i37PKw53xn6sYCM4/JwSRrCnIeB1ZkLsawDhaPKv/njU3wnZ/dBdGE8+YTHSG8+ofGgIjsC19YnwdM/KAnTSsqj6ig7uGgIPw3nYFzhhIIvriAxFP9CQd4HSlnzgxONIdrE7A8ZDPx9fjib8ifgegNIliRgdx95+E1T7+3nQVNNhEzDgGA3T2rEDLduwtPpuuouPcs8swwXFjdTaMKt+jA5gUAQPcf95KJQxYU0cYxEDvsBSmYuukp7AwnqniC9Afa5z8vboI68ImT0t26CvwBzSggkj447r9IojvCn7U92J/Hw0QSdwZKNNjxPCfSxRqnATkdwpOwh88oc4J8KTSm/wdbZjrc+4iFP8YO0/5JJDCfaijK5xVXevqfg6zGRrQf83chvX4aRfAE//6vv5+6490U4ADdO7QgM/5bcHP/n4OtCQhBEFeDWSvos8DPq8/IwzLzjpa8/U6MMSkBklDm8e0mn3QIY7XG1Om8wzN48y7HwhOK3P0/ZwUQHHv4psbdoVeb9VlAjChBCdtDDpOKTh9ZfcagOYq31RFjN4/gwBYzp8lAwYNwBELhZoxECeZxMlAzWGdCRV0fQWGHo8+8Kx+AAxnCIzowAxy9KvNepWfsfp4RR9kUrD88CPVTuXRybhqqTHcnxEGndsgub1Gdug8yz9fHt3Hpl57x/mfCOC29FOSQ7/noAZR5W3Ob24UMpuPYAYiQrQgk1gnFoUIKr4vKFpV15pHUJO3Y5rfH3UFHU4bGkU+NKJ9f2hJyOMxDBDpjAgwiYqvk5TqNl9EH2Arb6fA3yaA4cBtPWewhkEcIQJBlGzYp6zRmr1v+e3Fv27xpzvyI44NGDkCIi7CGNV9Dw0M8NtHC2vUwHINumCGNG8erxOwtQINsW88Tlwdoc+F85nI559ngEDpt2F/Uu3hiXYrkN/pBFS26hYDAkFgErMK67y9mGBA3L5ore5izf8b3n805MOq/t7XU4WHv1DUF/5gugCSOAIW/59uMwl6CHWAib8bvfxWl9/rBGEMTTwDfG+ezEYG4yk6FvRPuPwE+wvc39IRjENWM+/cm5b0W4Pf4WuKUnw/vD6eDbB1ETs5vl77Dhnm/51g6wPWwQAqxnivgQaeS3gy/u/1H4hpTPrIgHAN0mSgXUX13YP5PMIuQAfBr/f70cdeE+QoCX3i8nFMLcAjInBoAIYqt1LhC1WdtvmSab28AYffaeivCB+ohdYQgfUa/WS4ToMsNLHLc9nnvPZLwn1/EefPVf+U/xvnCVSEQEkEQEnEQJO7S7RvYDxNeNYKrG7DKMhtsQ8cMmhgPKKKj+F7CiHYFR5KIIPxOmg5IVAtu3ACQSPh7CzUQOgAej5CWEkIe3vgxz0ROGO//qYfz/dnLT+ZxDr4QW0eNCJBorCFOVC312Ec2TiY5Bk0cAaQmiA1VH1MOwDHQ0kHdEDDf+2UTWhS4Z8diQMicLx8MLBfverLcP/jQzF0P8EJj5+NGK9RCz755S6F/f1+X/gxeP+Wsedv+vF8/54aSPJYFjIQd624MDz/UDLQnr8HU3ztKHRf8Qeno1vyAQJBaLcMtTV3cvgP56COCqd/QP9xLgBkH4BxO13n4hNUDtACC6G1S3zqooZ6Ba4lp/zcAFb7iERKQwQcF39IFJjdXECGADw0IE4gg674pYAnk4HoHPx54tD5daO5vxrugSkMjgiiqc7TVKAT6AT8R4ckbHEQCYR/IZBxJgA+XZjsR7vaoRpIxWqeqfXuGC2CxwudicwePEB1kNkaZCuwyF0DuKv/4sz9mzP/Qxdg3BDkBTMC8Q+loD6UGBzx0Kz6eAX/KArOQTlPHFoI4vVtf4rNuLrca9edRn4xBP7k8w+9AgZCgBfEUZWfEs8iFNZ3UO7TqmkjCO/rWdgco/yIqHcQWaC2EGTzgz5y/iXQAvyx3riyxxV/JeBriaGB9OrTA5g9/eokM+37GszqfA/UZk9iW5UnCtBqBl3XoNN6Ag/+zy6A5evPAp+TIFDn15gQw9rjrOzFX0s2JBVAxa/nP1a6AsNWYGjPNGPLTQgBsNUFvOA3Ht9o/rGDN0tWOCcxJGp+f7++kkP7PxcGv1+GjkaLt/fawpwwerQxBJNW4b+PJsYEgiAYYdEAGIlDNaAbRkIgK3ut0jKByp+8yz23X6GttmBmjwDvChgiYLP5V/zhH6/110sGcKo5CkggCngxnIPoPja0j2B+1BRkiYJiviaLJqghDI63G2nAgAxMCuDdnoD0wIQm+urMB3VuAwbBrFGgGgnhAFqg9+ujKsLxB3qGCQNEEtPinIQlAj4WgIw7/iXc9V/x/yUWFs2KH504bAh4aYWf4TrTLGTy9YbftyLeVOWNfYNyt/ji29mQnqMAltU3ioTtbX343yv/1u0YPUBz6zB702tQucnX0gWaFh6DgPdmhXaapGotw0SFz1qDiTMdd8h45HfcqCPRUhA3+NmKz1l9teCPaMd4urGaewRitNBDdahR5c3AfQmDCFT9vmtQEwqAYXX4XI2n23Z9B/Yb1FL+LWox6wHGbZSo6FR1LzyG+3hriSZvWT6jfXhl2cmQZJDrAbuYAqAHo1GA/EOgD8eGcU7A8eDvH4fQBuAhBL/Zp/vamPTrRENDGLTV/7E1WEPLDlP/PwzU4YhusIMUgfIPAr6Dhv5R4y2r8ldFwiFoYHnmr8TAHbhRQSZOctH598ZYhqt6wP7q/ouqe77RJxvzFYaji/z4vna4v5cUMDXqDAJ5ytktqtBDckyjvJg04hl16LB0xFfyMfD77PZjErGQRRjYIfSvoAXntks0ok8MsUC4KARWnYPlJBeIgLeFrUgDOHYCag0/XNAbWgRwQuLAsaQwIhC1g7+jCNKuT38JfnYSyTi+QQEwwHeT4/dWHYxJPxfOj5oAnRQqgU3YgGZSOaDyK3n/qkDYBKptzR3oD6B4fyRKjp2AzSl80YR/3P+/1vBjX18Jbu+YsrMRgbqPP8zrDLTAaupphfeZtyPs9BPztpLSBZjowF3woYRwBwOWaqbev15b7X4RWsiqYiY6ZkFEIoUwUA2OrkeEQE8HYNyD/rl3m88jCGgO/nPW3xy8x4Q/HBcM1dYg5q8N+B/SBSYhtD0EY1PRGLDoKIBHF3yLz4H/gSYQJRETgqeB2d4vC8L2NVnQn4PoVJJAcP0inahAfdXVI8CFszjRagCTtRdV7Sr895NBpRKXIT64RMFw/iw5eChhEvmmyUIH+k+Qu3cLzOAN6ILlFvgWnx3YWFDz0f38ze9GlfP6UQ3ojEY0gtqRIEbA5/WgQFhsEuIeL75uTzvqHktAWfj/OD6sQXssROcGiRgFn0QVkld7OznMDT7CJKzhMIqxW9B+LCOQdH4uyxIcE49VTSeLj0wKjzcp2oDXQA8YoDEGBLMW0BJw+eAxXejPV/IXd59/tp5rVyYXDw5BlRetSpQAcvgfOwVM8ObzBq/AQ2wX4lwkQV3vNhYFfn2LFgaoDU1ogqsfqGkJYmrj9Tr22KQwBLzbLuzDeA9yzyJjVRfwegWq0H+FThDPA6ZhZwX2M2Kh4waovCzAWJTzD/qY00c+6PM8coz08VNqglzx54LfHuTJK7z2rwX35ABLg1DzsZ7Qv7l/f2yXDlbf4C/irg0MJ0aCuD0wP74MrxfdFlX7tq+vtRdCpvt599EG9Yz3V+P+Oj/n4zLruZHcJ7oMt/MNp9eD6HEeFb6/TMfbWo85Pb79HJo8t3371/PuIAZqMvjPC34nVV6ZB4hEuA7AzA5cfU0y2n6ux89D/35/n2/vWY5Bf0qwf3tPLISO1Tap9qzFB6eap/beqI94NCCbGwgqOItY3CGl446CaQ8i2Q9g0AvmgJOnBoAA0gu17tsKtKS7D4udgCYERy2QIceCX/P7mBW+g/7D9S6Mn50CS0eAoQPDcBjopIA5+EcxEjLweRjXq0UbLIjcBxsGx2IZvlf0ATjz/6qypAmY7bhrk4ahsIis6ccXKHdueAfUgk+RWPCLh42c6zEeKyJpRTdRAOqBbl/Wq/uT+q+Fx3FoTIuCzc6+hN8j4veGjuAnhSE5gKnco3A3XwYlq2sq+lmP4yEOpqEoG0M+mGDYuYT0pKCFHgLHKt3T7T9p8GcWH+n1UwGa8X6kQt2x4CeqPexegT6o/Z4Cr313PHdgrsS2ZReLfpKIf+IMFnmVmwxQ9AhithYT73+p2s+JIVfrjwiHnpAZrSsr9CMstQXP1+1+510N/q8E/YoekMN9OMFvi5LvkRDsy9rgFCOoPdpgaQIWBZjf5KCSQszZJ1ivTvLokpen6tsJAVND0NFqb6GUGg2Im4Dyx9Pn7/0dm4pADAslJzTv+dKNrAPQ0wyySm7bj1RQgbAXsRa4R+mBJzpaQmHLmy0BLoL+Nh2ZRca8uUc6P37k97n451fvTieAE8BdZ2ItqFEK6oOJIYPsiU4woo140Oh+H/UC++gatHYcOFT+2y3AYvD1rM/fpxdUcsAi70c0OxAEP45X/hymE9XeoC0zfYhbcqfbhs09HpwnKMDR6g0mmYyKth/UcLl9ITGQ8N1S6s+gA1HvQCc2pluPvN2Br8SyZyfyxPP/VhCi1L1HWX2CQCuAE8TIq/sBYdANZmTIwqq0sb0HIzhhugBeUpBZLFyA8y+EErsBUYDZHYN9QAAooQwOws+uQlhdESSSqk5Qsh8LSYI6LDS1AbmOvLlRBqQIeITvM36+TP63VfE5hFClCTr9zEyVFwS3STQBy66DMHB+PJWIrfgGnYBx2dTboPa2X49GaBVlePA7CFx4iaGi4ns0aLVjMGvtPTDtmO4XEE8E5Kb/8qYai+NHl60LgAICcUCoJPVeiYG6Pxw/X9VFNVbFn9FNPzXoIRDTyzcpREYB5Fm1EQQn3KRi9wKApR8Tz48SwxnV3qM0q7ZhpdKvr0zfY+gO4oQf+EGPFYW/Xf5hwWsUgxiBbShGoGIx+D2eH1h2EeR3UQMH4zMaUKr4033nzkSkfQADelFbLOQCalxdxvN8mInhPas9bxtGJw29Fx3Y8429MAS0fL33Oeo7qFZeiToCC3B/VSNYuU0fgDnkhxGgMFdxiYEY7MYel+OHPH30IMeVFK1C79l+QdXVpFqHlMAXEf3EYDyfkkGdNvJ8f3RAXU0jpgM7jMNA5yCrtfzOicKG/M9bgEkEjqqPPDEcDfqVwGZv6zcO9avDfOhf4OmLFd9OLBHHdxp51HvOBlnAoQksYjASA1xnIhPsapTCPjbsGB2YevpPpgM73EYeSYIftgPgte6CWesVBB9QEgfnWYMgoeC8ql69bWoRIqYHvSIv/u26bj/jdqZ9KSGk74JRo6QS9PuTiSHm6Z62kLUGH0UO4rwWrhtRETkR4iKRdI8giJ2D2nUCMjsA0TXiVDb98NAf/rCMlajA9wesWHZrAe1dlwRyVI2jx4KkyUHSx7YDe6YD4tOC6XW01puEdAJwaEJzf1uATHi6ZlSCpBQscsh6C1xRcWEG4bCFeKcAVhVlDu54JQIkTT21hptIT/Afk0kMcS9BKfjBJozcDXCrtgbWXxbMAw3INQIxtQJPAGwXmYaBbYh4SCsuKwLOAQ5awKskCMmRg8P3xwlBfbosQaDqyZqBkyQe1CLQACoTgN4qbyHsPwkTiF2pYaj6MAXBmUosQHnUEYCsBL3MW39SNKMJ5PfoBsT33DVJCEbFnBCMOkHfvj6Xq8uw+dgRIhGgAiUqf5QgKDFyhe8nnYrlqn9sG1GoAfirubygX4H+8IM1CmQrMFAJ5ExzKIp54nPoVU2Auh6eBShDlTV4u5c4HE/fVvjFrsII0Ik6QX+Iq68jB19ziLoKC27FYe0gC+j1RSS+BgB7AvAM3m8HLdy5fV60C8RMVuhD1ieQB32MCCq0QPJuvuw5IHF/geMKwOPdpmsxBwVEfGEOgeincJqNmuSFIPhPq/xM81CWIIi+gCFBqDX3QPYd2OcCRo6GZBoA3AM+00aesAOQ7/2Pe/vBCXoguD4OBD1WfPwClzcui12AuH+gC0gEwW72KfjBCQRBr05D0IQc7N8PzOCMehPWK384MPVDJQim7yDdoiRTItzzFV/ZOX9sYFetP0fsQzb6O7wOoFjxk89YoQXv+BmSN+yYHYO+BsDRAXHhuJXsEFbdIEGZQWUkNVNzGA9NZUVBIQL7jASR0AclE4Pb7JN3BO72mG92+o8UG3nybj+mASh0FsLKn9GPxDrEcS2Au35BzHO1BksriIJdpqWjKR1wlpR4fN977rZqI+XbYjYDgVDpcYQalOYKMiuQbB3G6Pu/HlMbi9a0EMkksXtjvvXTfgMKAEZRN/i/O7yD8Da2S2Bdh3ICWfp8yuMkYl5a4df4vVWt4UF0yyqEnaT6swYyWB8/j111Y1ERS9oB0SLMtBGDEBD1PEHwtdjUEAHnqmoHU4wCDAoAS+lHwtu9eQLUAgmxVvAuMB9cELMV3m8EUtcBYYI9nkNIEEJYrQeUHfnzzRyC39j8CgSkir/E0P2odnAmAqDnDIhqrtV9BDNS2POjv/0pwKr6z1h/PMz3uf9ykFYq9TtoAXSwpz0HljdvBCVAPY6t7osv6gFhMpkX13rcfXQMIpuTsfTibkfOPRAC2meLRipI4mDPwMD5x+v3+Ey+qEfACwoUEkKQSMZxYJDz9R68PyP43yvo2aYf881rNQbZgRU/jp80QnW/hdXqJxMvCFxXQSNHpE8QiF4XI+wFfQcw7VL2Md7RRajsKgh2D+6SLAKPF356+/7yXYBTUgFy/38StUjFHweD+iiHh8/LV/i/TSvGk4L5x7F6AsIKbgb4C0YjgdGRIToGUx7cgS3JKP8pRcgak95BJGQbjaJdBYQ1qHYnYHL8F45QgHx2gLMQ2cDxBD/4SeR0LSDi5XzPQNjM4ySE/HGG6g+ugltLNSARn281BPtNO72eJLjdX4ITSEgpQvJYFEUg24f1qAYQNQdxx6Q/RcB85j9f+03zf2QV33IDPHegNgPABTfqFR8cZK9TA7/ll0EQbUUHW8Gr1d+MSadia+LRHwhunv87yWoJ3h/pRDwJAbDNQQFd2P2mH4kP/wDT/ZeN3CK3+ZjvgVpw4r20AMafb58j4N1UMknuj6iCx883PU9g2VHVH5JX2eEcPghSgRBCKPzK0Q3fknwPN0Hk0CyC0zBkz//7duEetgFjVtypASDI4CsknYJgYDhqsBxxy29+eyxrAZX75EEf8f+CkOcijMDDHx4ASYGGu8WHgPwpHJc0qOG8FgFTuVk0cRZVePFwHEIUEu8xSHoL5qWg4I7/HgOKXe2dcnu2SSdCGIDTA+AcxY1zYL6Q6AAFu+/1GvjKPSeEoJV3NiM4Dz9C6oWkEav+NWjPWXNOIkKgNTi2I8LeBgaZHJxqrC4oNXoB9pzzMws/OW3ghSyQJgjbygOVEDhoj4nHLld8HPD6UUMFVLIgKrTL7cFoBRLQgEdXIseZ2/HhFPKbk4d5tYWwwR0nIFQSD2P5gQhs6meVfB+Bkyz2fOIvX/zxqsSODuAGIOLtPNnmIPCrv6Kqvgz3q4tCwNl9lWYfnsdHj2HTgQw5IBHwULmfSu1jEV3gDFSxTBmqSEVqiYK2IkWcRiAkwV/cyW9YhqHXDw9dkNQAcO6HFNJT7oChfrPUYc3KY17zAd+evAwF2w5SCKLV4EuCEKsKfjBVWHu9Q9Arh4CoBqEMWYBsNX7YgKP/69uC3M7/mOOz232QT+ox4iCyJGEFP4oBHd+GVvXBwX35nqp7qeIbV6L6tdZub3ueJ+gBIKgC6S5gOQFxDoGr+Bv2nzqbknd7ph/EmXzO0o+kZdc/wqvQkAOUffVMzKtYgx5Vob1/+HAfCdzHSiXHenX35/2JTr3KZ9Ruj2lYiMhLIFoNyMq9hFroeYMTE0bSLbhb4l3YlFPa6hMd2jk8dmrDgdQCnC4/+ANFlYTB6ATlx2GDGXP1rvL+SnWHw+cJes5/rRWt4H2pw9GklD4uSMpwasIQiaYR92gIyFX5S8dtRZt/nCAH48VXW3hRE/HKOsGquj8EM85Q9cfeAV4XwNGAlmIFIwPYrfLKuxV476RRetzcdeAsRSZhiHizCKEIOHn3EMOWy5X4uIJnXX6sFiBFLaBm/THOQAkVJK9j6TKwiSDTBWpwHkSPQJX7U959uAkoaTUuug6oQCBz1Zlxm0OJSIoIw04M+7zCGuYiznCfHww9AN6Ir+HXA7lfn2oBSJ2FOOh8SzINfmcAyITq8JX/sOMPx6A9LeYtVfwgCBZhdu25OB9/XmWWNPUEPD5dUuJ68wd1AqD2+w1PI9KxE9BW5t3z/igdYGWiL7L+wPv9jgVY8f0ZcbCKCuLAHN+c5wa69Zpr0J9t2KnpAGzyiAIPiFalJ8/xXrrA6Y+/8NoDnWCPNwFJzf5DpVkHte8hx76P+HU1+HEytEeSEIzAsu5r6wPJGu6oLz8VrKofXLce+ywIHhNa/Dmw8LrptWXZ4NKZm4pr/QQ7Qk8ehMrPtAF7PQCD309QgRgRZMKgAbFREAfBBXNalbHA9cEHMo4IgIUuPjjBWEUFEQpYTkhVO43eRiynJw9Jjj8TOUIlJExK+0wA4gWgQvcFBHAc7P4/u78/Ff4CC5ATB3P3oUwFClYgcALcxzp/B9Ez4DUV8RjBbsCBrMH4dLNwIDaCGhA6o3pXksdBvYBsktrXDgNJKAFy1Z+ZGIy5NXgXoBT8a3ZgVSPIUAMV6DjLxhsV8wX4n4ibbONObHNyCr8Z4FinNFjg8ziiF5zSV8A99u7Zdf5OisvVaAAAG3VJREFU/kIPAJLWX3hUIFD6o7MD4WkHIMXBk4IftSrPNBJVk0OoC7ice8HGS8XBKDoz/YFBLaQi392lGpCMJfhD9xVkx5Xbj73P9V4m1j0v73x9FjDDPlYvATkgFAVWcdNvJBamliOjAwRV0EpeRymAe717kMYRyy/j5FwFBX0fP7Dyx8gq8wn2ZXi8GfGYR+lFcGJSxa3Y84WgzBHetlU4cvKY44Ps4iP9fsgsPGEhQTAcHqwwGCj61SoPexKwasXFqtxq8qhD9SixoBBYcJEDNzmIoi3J7QkoJActVHocTVpPBCDhElAvMDK1PT/Sq3DwB/ygmyB9GNhYDH4so4Foy48kkPtZfZEv1PQTxYpyX0EI3Bu+/5krcN8fgwVdwWu2JNVNWAk+PcOOPMNdGFyAZ5Aj6gicgzNfwuHZg0HrLxBWfjSRl88fVCo/apX/IBrIvf65ZxtEoK9Bec4KZIPLe76osQns46NwW0pUPCPAyMc4A/KXOwZzFLGbAqD5xhhbgBcWfoJBAlarcCSQgdQJ+Movnih4gjZQTw51rz588y/ZgxVUEAQ8soCfX8OR26JwujCLGFAMsOjnwGrlPuQw9D/PPv8BYVR7pG/eeFtQpsLzR2KFI8SwKj9KlX++HeLOPuSBKrKeHBi7L4b+Kx184+ptAp4Trcscv69oARVYzWgaK01H1X0K3zNSmARKtxXYHvwJuT+8gLGGWgpHcWOmBeljFB2Ckg6wiAYOqfxEK3GMCAj6kIiTWdCBCXhkjUKMgJcLk271N9uLSbtvvK0S69OXAvoA5z94VsFubbmZvx4QAnXgBnJxENyQjy38wef81uPhxMpPJIQzr5ckuUTKe0wZyN57iFTWga8GvCwlh5UqvYgmaNV9XSxEVWs40kkosFwA70RgNOu8mLZfR6wDiwRa35y7j08NksqPQhcfkRBK/J8R75Iz+9C8gJpqzwiIeZII3QnYOkJWbVEI5jNuA+o2BwK82ifwnpSgHwaC+GNAdmW2VXfC+vPu6wR6lBj84C9WfvivZyUhZMJlJhjSukDlFJ3g4AvGJfC1iEpQJ/CaEd7G9wds7p71+odruKrHip/C7RdsxeVjzIxhoNkFGOW/+sk/YVAGtltfzZAIfzix8gcHhZCXpcGN2u69qWqD9OlRFAy7x2fQBhHUiETB+DocqvArYt98f+AEAXApsEmEcNLC0t2uPHCqPQIXwHYDfI4/9+8LMpchqr5HK39MJSrBXwnutNqjovjHFdq+fcHLp7YLR4mGgduW5hFpAXUoL4cTTuW5HJSkB5PC0S7A+8c+837DyoM1J9iv/po/o3BunlDqPjOSO/YbLFd+FGy9sxKFeT8b+nLNPrkAyD53FtT27yUS32yqUaEGTMBiASGcZ0FmK8nWxbvjC1q6WQC4VdWdAcBY8eFoAzIrC0b7Wt8wlPcIdE1FhUWeKU1Igv8Q/0dl4k/NnYSxdlDon8diUDeuQB4c8XVzcahRgyyZmNC+LAgeCfSVALde8/t1DCYawNoePGT83wlOpFUdOZKwxn89OsMEf0X8CxJCBN/dwKbFwkSMgx0ACJJDJD4iC1JEYh6XcEqVHpx4+J4I4UiAl26r5x64sttvSlAn3LBuQCz6edU8C+J5epBrC4YP52EFDgHrCw1B0eU9bOaTgh3wmYvQV3Oqqcf53XnVNXUBELX1xtSgFrirlII5d3HFulxBCNEfZx0h7K2f34XwdHpuYQcguN189Ow/nPXclaUcqMH5leCXjKOjbv3F0a7i2ZaRHmBe5zwnhA9S736ZC8AH8LHkg/T5znYgmES1dtuzGo92qwHIquiWX+4KgVLd8utv9Ml1BQNhEJW/FOgweiTguCUoQHkEwYhjfQIgm8eAzPKzHqAG5xGiiPyxeGRRaYetUpDVpHVC1T9bHGyaknb/TQTnuG7rDYwYCUT7/cMjtILzA+Go/FPw581F/mWeTkDuBsBCAK8ki+A29nMzPn4Rzjv6QV7xWW4fzQFUxb9jQQ1qc28kMi4mDl1NBr4usIsz5ltZqNm7AeJXfuTHd7nioLEyPBISU+8/tP1AC4Il/n+YGmjg2NiBRdl6yCw//zG5ph7bqaBuz8B4VMU/TqSsNPbwCeZA1cdxyG9SgKzRZPL+GXFOiH1/SFZ9wX8M3zUgvH8a4rMBjZj/h1W9MrwTiN6MlsCKiI4gycBzgV/xUaQGjGDHwHiYi0VIzeEAasCpNuL76AC7BIEl7i4AIxnAfoMxk35eJbZ68wWEUChs8IPz/EEE9BkUoNA4RCWSLJkY1h0Y/dG9bVCtUVPe7QRhtStXG4nOECDfUxc4Uw/Ik8JkA9o9+a83IrfHH11EdFUWc4phNgVFWkPsIHBnCvCCYBSgqEN9qtoXuwHhByYoJJA7BxIkkRwpDGgAHo+vQ3ZGOwCFJCJKUAx4MBpFZWvReeLgtBBkDDQu2OJxXa7SE/P4ZiUPHABjY1DsFIhPAaygWewiXK72hHjow/k8gCL6gKES8qcDZ7A+EhYlWCPGCX1wXIwzkQEKt8cP6iqkC0FEhFj/ZYtvXCtwuBLcDT5wXN+9H6ZEIkTwV/x/s78fXFX3siWHEKrC3tw7EFZ31Ll7ttknQyEMGgAqCaVe1bGk8r8nFWCQQR0h7CY0dsU/mIeIuA1AGCo02Q0YVXxub36sG1Qgfo0CBBUXxap+ECFEycQVyViBEBFPt14TK9rZHB9EwMG7DPXOv0OVHkdtx7OSCXfb3av4CFZGTwQBwT7/hKPHE4PzpJ4L4+FM9r1n8B+B+9R9I4Fu9brYUZgCunZWNxdQgIs8mASBQ4F8hJpEiaf4GPihk8FdAxin/kybjZjTj+mAQy6ihZ9whDvHAWB6BKrBXQr+5SBfqPaINwiz12UIwoTmbPACZY/fshBBBKNlW8ZCHwH/cVKSOZMm4Mxk4OwE9JeB+EFkn1IzcPQoiSB4vGgNeJSoik1A7m0TCmE/HrggB+/1M12C1Z18ACGoIeH1pH2IhAqFWgBq+kDFEWAvA3X8tpW0cnSD5WAOriOHhnYraF1eLTkS8P/QsHUBdtMPnOrMaANJE9AZiaKWII5Ue/8PTHn/UcCSTgIF2xN4zdmAQYIAKeBFl6FiO0aKfq5jcImHfPwTxcEdRmD3LcFoAva1Hdjm9UgGggI9YOoPkOBYLsT8HlG3nucMDGkOOJ8CkNOELdSO7D5qqAeJYBb2GpABgRi2gxLITgrOQ9C937HgB+0i7MeRx3gfPWCXLtgbLJAu/gCFBPzRX8eADJqCvA3FViC/BlOQC4LZyrBq8BdQAOUKoKjqR7v7EFfVFMojPgEoSlJesNIePyLHwW9NRgq7E6HvUN8A0yj0wyWDHRZ3J2A1jHdMyu3hCGwSDwdRir7h9VP7AKLgPoMCgKziOFLtrUm8aIFHlgxYfz8WBYUU55iAXauo+evJaIK/NTgRJM9sUcZRzcCnMdNKMJc7usnAyrpxHYkTRHK+n1HxS01LheAHqRWwKIDqLvQC0+PupHZgBawfVGsiniTVHwZHRqbUI/D4Cd+ftgyLAR1ehkIiqaKFw7MJEwUIuK5zsu4svoFYCFKgBJZACBuppOId2RDkPZas8H9kULcA9a0KTCQDGtpnzT+RMJiOGseHl4BQ1C29AWUXIIf/OIwwqoNEK3SCuA7FRiBrE9B4/PcrGJ1OQNj83F4Xbol/TgVHfMiIZLAdcaVkgh8sLrd+liNQH/FqsNTfj15m1J0X+ffZuq/gTY7QnvIfJz6UzBJLs83ItQpt3RfZz5iuGfNPajpngUm0R8DoA5jDlzsOTAwZjzsC3Jjxg7H914PjlcskGdghgx9HG4OOQH34uwQyzz61/0qiYNQjXxECuWYbGM/DrjtPH/Mw/K+gBLLSA+cEfPr4MroArzcDuybbr8Zc72i2UnzeHnTgzD4Ug78SzIvCoARVOQxaFFR3TzWnkkHUVFShEuqKxZnKz4p4YYcf8ZhYhuu8wFgSHcuuwCJagI4bgchJQK/qe9c/RT6nGcg6KGREJpb+MI0EY/b0jcsni3AJBeCQNsBOFVYoApcM2Aom4VFgIRdHpeIG8D3YaxBD+qCiQ+rBOSVnci8hzkAG1t/pgHA4uwDzmu8xFKkkkIqCfkIRs204r/hiDgutoAAcowBMZ9+KS0CcXVBOHCvJw2jMQSJyeoeExF2DuTuRcuWAo9sefyUQ6/oBaIjPtiRH1KvQKvygAHb171d+vc4GRMDPoxN/kL5pwlVh1mBQ1quQJAJ5j0TgOAis+h8d3mnC8xTKE34+8sDNjyVXE6nFMN+H39TQDmocHScENvN74LoGScGU4f7g6IG3n3C3qnG6JBS+Z5tHOOzRYQx+u7MZmAl0OSsRLAS/VIKfRAWU92+12aaVPksGDBWQuCMvgNy2M2Mt8EwqbjosZAec5xLEAmXmcFTHiOWARWglpNpjdEtBQRxJJU5VL5/7F1X86XntXgUK4q+KggsUoIIK8oA+kgy4+zLaACqQGTVOX6MBWdehL6BxHn+tlyBMDGAqufd7WOX5WTJwKYDfXJJP2GXDPk7Tj5Ed7BOG7DMFaBRAJgI/+H2Ngeb2SKb0zkoGlQBHkefDr7xMA5HZeJPtKIzyApI9gmnPgf1c3mulfhe0gFekDCdNFnrOwi4Gs6eTACNjB+Uegcgojog4V25P8bctRYY6RL8AJklE9ACFAGZdBEahd4d4CmghFhbzcwaXYH5qTlS6DY+KfNH5Avzjo2JJ0poDkSCMxLn73H/eB+ifvgvyIFCWAji7BWC8hd0qj0FziMdrS70BlVbgamIgcmotGZDNPwm0L9l5iHv7WRoAFx57ScFS2r2iwot8oKu8l+TOCOg2mZ2nFdjTgOFQENzKkJ8OjEnsE8f6AzyXwT6MNF3RDRnuj0Lwo6wTlBMDIyqaz6G+RiLJMg/KUrQV/rh9uH0tWduwoxmky0kSMQ+rnXxZsGadgnxfgk1pCnsIsGYltvfdzTOBIclIsN8MLAGcz5gBwj94AE8DuC9Molip/JGwB57nRyJiyD3pyk6q5ij+3TzRLohcqyqCEQBTepF15+WVmW8SEr5jMUUkx3oMIsrH3ndwAQganKzyMpOJNxMQooGBYwcByw7axIhgPRGEr6GSGJhkAELoQ1YRg+dPeD5IIRDIqq5PA2Jh0Rq0YcS8XBi0ghGRFpCtWTdum5+yLOsQf2EuYY8AfnbQZDgCjHxBSKwTGpt8QCIDVH3/4H5OwEvldhliINwAFLsEyyIfGKV+vm3eEehVqKTdNxtDiPoLHCRiuwTJxCECxMDqDjTvZ63KaPKvRgV2i/F3ohm88V8LN8hgJcXD5pVGIPPNn9EBqSQC0I4AMxBUcQNCkarkFgSn/oCs9GCVep4eUG5BRAOcQOCWlGSc3If0IFqRfURQGRrKewPKEJ9sLnIowKCcw+f48N6UHjqYtgInaCCkBbPSj8VEkCr2g8U43wY1xX/BNkwreQrzg+oaJghOCGTU8RBxuIp6VFOGoEXgEsBLIgV6gBgxoLSI5CgiYNT+GBHsU01GthrceiMUtv9KgAYktgVNeGrBbtiOQVi9x8WjiAW7UNUnm4Vet7WtsFgDCDYEwQ/EVL1PnQf/xCDLTowTh4c4HPRDoQaiwhKIAae4B7xgCBydI/CDPOrevK0FR4p6w3VfoXgQiB3T1N8Y1PCD0X19JqcHGfzB5WkQE4p/kdeXBcEVUXEIFqSij82lMyrWq/7c+LFHA7z5/dwOHHg8s/Y8C2CmhbmALtare+4UWLfb25BmXABKABTniC8gRAP2yvDAiUAsElnrxFzITQa/sAFecAOY7zPV/8jMQHSbWAiUPGkQNABhw85xrSCv+mMSzFR8+7mjw01A8f4F8S/td4jnDHYxpT8/OEyV3gz2+GTfdAeAszswfJNGlQhEIjB0Bls0BKn4Iw7WKu9f1gmSagmvqleEwJwnZwjO7npz1HdCJ1hS/mlBcRXyF3i/M7NxqJFoeH27z7nnJaBmpUZKHsTbGUc1ALEoIGsGYl9ixS50gjAT/VhB8IzvGTrBVfWEz1MzAkRFTtecW731VdjNQPukVdhdn0Y8d/a7WYH6i/TBPBzUFwAlHwtGHOQISrgb1AMUgDETTA3+THAdeRJhg59V/Ektofa9I8wxVICkC7QQSAd2O3cftzPzdMK6aA4iZI4ILfYRbb9RgqICt2AxVnYZ4kkBvHOBxT/zN9ybHx/f5Ql2fkGCX6ANm6F8WCfqAS+Eq5AGcHJd2IFHagTMHAAj+mWBnDXuc81CjhsAi5dL2K8QCYI1aJ/PJtSSxEFXASv7C2I3ZB9/a0j/7nDn/j1pHsz9Jr8fNpxPBUAUUYD4wz5GBlmyAiORjtAIGDFwzSUwqiNZ1d1tPiB7/Q9VeI9KeJU16/knkEeQJEALjY4rkp74fCZiMDSA/PgvT/aT2gYgp5E/P29AKBQAo6TRth5T4VesQFb0i4K7RA2MZpgyFXCEQHCOixuYMPgy2L7+45ezSSKt2oUkURlpXkEMOLSiXPuDQZjk63N5bmzOSxQdLHX7AhwUEA0BAeQPJIQzkAuFlOK/GtyLdiGDKEBdllQ7YouxV2Xdwza9So4Kp5Z0yAgUhTlJgFzSFrznIHYIwKcCu2/L3LsCg6UI1b1/CA+ApIV5/32HqOIjdQusE4azip5Wc1b0q/QGIAlaWEJbXP3r/L+AEipw/+BtkQVY9fIM2i/ZhgVEgJO6DZ1ksVtlYdoQAPhVO0oKmYBmnAYco4DRCRB3TwCziptaE0auER9/VzRqKNOEYINOQg2m1l9GpGNQAhh1v6UmxNQh2M4+LmlUzll0OTjYQOaGlZAEMCrdhmBphaMBwBADrSQQc3//He8KgFETT7p6BHnjj2X9EXsDjrgBS6ihoAmcSQVYmE4JgYWFpp1waAQRoqDzxDhU+HxSnZHz/9JEY6Y5MJA+cwoWrt99+U3Mc/9g/NQTFaigAEtwB1yBzwzucZSX7RZEILhR1d5GDCsBLVUdIQvsldZfEJt5i/MHx2hGJZFkVVyK242iFeh58oBUFqIQbkfp2DV2X0CkAYgv1sU+P+I/HmBu8nErugdRnUWhfp+A/ddlbEH3uQlBsNobUEMHasK1HOYn8BEEvCUaiuigXRIKj+sGOPA4KAWz9/s7WxcgB4+a6/fI2osEwv4yOENAiPf+wQhbc/5f0gGisWuQaRFmGoIqguARWsBQgTTocDLMT5OJUQnhqdCEig+/EShKSEgTVV0MBMnz04BcshPnLk/+OaV0/dwKzB4QUt1NB6uTDfGOP+cNm9mEsBAFiM7AQh9AKVEU75vy68jeOxrUC4mDEuYO0oLqoSdHaEF2eXYYSm0V+oEOwpLmYFOF3Z4CmAeBTIGueiIw2xoKPzDBJVBXQ5g5O8/twwA+QguIjJt3+g0NQEcDfUXgO5gsqlTBLkQLdl86K3CWneitQ8sg/5oWAUJP2C3V3RoEyji5n4b9lB4t9pz2CA+cAFn1Z9I/uzYsU/ELtEBOCHYQQqGcFejV+yeuRJX31zsKV5IGjway9z6PLDxKwNEPsBuOEiqw57jGgOtZ1Y++T50AuMFl7hPIbhskiOwsATtRoc7rS7dXrpcgrMCGJca6ELJo+Y0be0BW5ZKGcFz4y8W9BduwcDnK9iO5fagsKpp9ANnvDPxeP8THNyIVFo1AMas8Qk5v2Ytm0LCCYAXqn+wQsPTBh/5Bcnne14Os3uCQt28vsK1WUESJFviBgAW//3u9PLxusXchcCR2WsNzv/ImvgZzzkUByDUAIrjTvmSHAowpJBQE4SUlxMxnARlQbIqkArVAJ6pBBvELCCKlkyCDAP45BYfEPfcUpfMch3Vn4bheYK4E66BxAxHSVd5INgEPgU/NBCDfNQ8Ho1CoINAPQAW/QT8OCIZlNFCB84XhoDChFByHGjx35v9BLgyhmojqHYb5QYXnuAecvua0hZe6BV9f7v4ibvgvamrmAc1TmaEir0LQ9h97eYAYVoM/nWA60i8Q3Ifezha9BqaaL3zvqd6IAuwwLSCCuCLuJWch4h30giPtyiAphKEBcCu9BV5wwzkMxID8rhMwdwMhcSFgrBT3RUTQboAUg3+p+Qe1IGarOioVnazmefV3lHpwA0AcLWCahUiXwePHWJsP+GH1gnp/we5KfOhJAbsj0H/BIEb04TbrTPsAyb2LLu93KwfCvn5PLAwrOXAa72eEQRo1CNdw5IprsAZ3hApy9zlcITG2vpCihsRSYxNS+J4vdBZ6B52eqRcQ/QXmSjAWSfa/5GA5qEg4iJFtm624AqXLrSA2gx8p1Mdqcghv41S0lSp/xAYs9gakQc4Ie2RTUYwYgt748mV+FU1Xgp14eW3XYZ6cdqGTNHwHICTwEeTPl0jEZwIgP9gDEaogeg5IHWCF+1eoAhvEKPB/EAeTRsM/pSAP5wjWEUMM1/NJRhwJbpJSgK7S7zF3EOsI5jBQBK9DV80Z8Y0COzvmWzJXgDl40KEC6cqvqgi4OB5cpgLFYK/1CvDiItXqC6/S87wfAUfPtxqfGNzlYaOjlf1IsHPPvffHgDAoEeEST4ZLZUd/RSo91/BjXY5ggWgQ4In3fyj4mUqPrInHOCLKO3wUwRsfyXpt1nEIRLrqcWeTuk7bigsbid1zD4iDRQtnIdQsyIXnFCn1I9D7ADgxEhOvR5AJosoUbu1FkJyYCi9OhQERoIx+4AX/YqUXQhtYEwKN4Cy1HntLMmtaAQpqfrT/UCoLSxeswjA5UWPPi0mjajUWxMTdVusNvt/ChMdmILK5IRMFu90BMEzFYHdg2GAgeYVHMMJIBTA7EFTx/5fpgTFXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==","EnvironmentBRDFTexture"+o++,e,!0,!1,n.x.BILINEAR_SAMPLINGMODE);e._blockEntityCollection=i;const l=e.getEngine().getLoadedTexturesCache(),c=l.indexOf(a.getInternalTexture());-1!==c&&l.splice(c,1),a.isRGBD=!0,a.wrapU=n.x.CLAMP_ADDRESSMODE,a.wrapV=n.x.CLAMP_ADDRESSMODE,e.environmentBRDFTexture=a,e.useDelayedTextureLoading=t,r.r.ExpandRGBDTexture(a);const h=e.getEngine().onContextRestoredObservable.add((()=>{a.isRGBD=!0;const e=()=>{a.isReady()?r.r.ExpandRGBDTexture(a):s.w1.SetImmediate(e)};e()}));e.onDisposeObservable.add((()=>{e.getEngine().onContextRestoredObservable.remove(h)}))}return e.environmentBRDFTexture}},"../../../node_modules/@babylonjs/core/Misc/computePressure.js":function(e,t,i){"use strict";i.d(t,{D:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js");class r{constructor(e,t){r.IsAvailable&&(this._observer=new window.ComputePressureObserver(e,t))}static get IsAvailable(){var e,t;return(0,n.CG)()&&"ComputePressureObserver"in window&&(null===(t=null===(e=window.ComputePressureObserver)||void 0===e?void 0:e.supportedSources)||void 0===t?void 0:t.includes("cpu"))}observe(e){var t,i;(null===(t=this._observer)||void 0===t?void 0:t.observe)&&(null===(i=this._observer)||void 0===i||i.observe(e).catch((()=>{})))}unobserve(e){var t,i;try{(null===(t=this._observer)||void 0===t?void 0:t.unobserve)&&(null===(i=this._observer)||void 0===i||i.unobserve(e))}catch(e){}}}},"../../../node_modules/@babylonjs/core/Misc/copyTools.js":function(e,t,i){"use strict";function n(e,t,i=!1){const n=t.width,r=t.height;if(e instanceof Float32Array){let t=e.byteLength/e.BYTES_PER_ELEMENT;const i=new Uint8Array(t);for(;--t>=0;){let n=e[t];n<0?n=0:n>1&&(n=1),i[t]=255*n}e=i}const s=document.createElement("canvas");s.width=n,s.height=r;const o=s.getContext("2d");if(!o)return null;const a=o.createImageData(n,r);if(a.data.set(e),o.putImageData(a,0,0),i){const e=document.createElement("canvas");e.width=n,e.height=r;const t=e.getContext("2d");return t?(t.translate(0,r),t.scale(1,-1),t.drawImage(s,0,0),e.toDataURL("image/png")):null}return s.toDataURL("image/png")}function r(e,t=0,i=0){const r=e.getInternalTexture();if(!r)return null;const s=e._readPixelsSync(t,i);return s?n(s,e.getSize(),r.invertY):null}async function s(e,t=0,i=0){const r=e.getInternalTexture();if(!r)return null;const s=await e.readPixels(t,i);return s?n(s,e.getSize(),r.invertY):null}i.d(t,{Jj:function(){return s},_u:function(){return r}})},"../../../node_modules/@babylonjs/core/Misc/coroutine.js":function(e,t,i){"use strict";function n(e,t,i){try{const n=e.next();n.done?t(n):n.value?n.value.then((()=>{n.value=void 0,t(n)}),i):t(n)}catch(e){i(e)}}function r(e=25){let t;return(i,r,s)=>{const o=performance.now();void 0===t||o-t>e?(t=o,setTimeout((()=>{n(i,r,s)}),0)):n(i,r,s)}}function s(e,t,i,n,r){const s=()=>{let o;const a=e=>{e.done?i(e.value):void 0===o?o=!0:s()};do{o=void 0,r&&r.aborted?n(new Error("Aborted")):t(e,a,n),void 0===o&&(o=!1)}while(o)};s()}function o(e,t){let i;return s(e,n,(e=>i=e),(e=>{throw e}),t),i}function a(e,t,i){return new Promise(((n,r)=>{s(e,t,n,r,i)}))}function l(e,t){return(...i)=>o(e(...i),t)}i.d(t,{KO:function(){return r},WP:function(){return n},s3:function(){return o},sM:function(){return a},vp:function(){return l}})},"../../../node_modules/@babylonjs/core/Misc/dataReader.js":function(e,t,i){"use strict";i.d(t,{d:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Misc/stringTools.js");class r{constructor(e){this.byteOffset=0,this.buffer=e}loadAsync(e){return this.buffer.readAsync(this.byteOffset,e).then((e=>{this._dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),this._dataByteOffset=0}))}readUint32(){const e=this._dataView.getUint32(this._dataByteOffset,!0);return this._dataByteOffset+=4,this.byteOffset+=4,e}readUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._dataByteOffset,e);return this._dataByteOffset+=e,this.byteOffset+=e,t}readString(e){return(0,n.fJ)(this.readUint8Array(e))}skipBytes(e){this._dataByteOffset+=e,this.byteOffset+=e}}},"../../../node_modules/@babylonjs/core/Misc/decorators.js":function(e,t,i){"use strict";i.d(t,{G6:function(){return R},N$:function(){return v},QC:function(){return g},RR:function(){return y},VE:function(){return T},XX:function(){return A},hd:function(){return b},mv:function(){return S},n9:function(){return f},oQ:function(){return x},oU:function(){return p},p4:function(){return E},qC:function(){return u},qQ:function(){return m},rX:function(){return C},wz:function(){return d}});var n=i("../../../node_modules/@babylonjs/core/Misc/tags.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.color.js");const a={},l={},c=function(e,t,i){const r=e();n.$&&n.$.AddTagsTo(r,t.tags);const s=h(r);for(const e in s){const n=s[e],o=t[e],a=n.type;if(null!=o&&("uniqueId"!==e||E.AllowLoadingUniqueId))switch(a){case 0:case 6:case 11:r[e]=o;break;case 1:r[e]=i||o.isRenderTarget?o:o.clone();break;case 2:case 3:case 4:case 5:case 7:case 10:case 12:r[e]=i?o:o.clone()}}return r};function h(e){const t=e.getClassName();if(l[t])return l[t];l[t]={};const i=l[t];let n=e,r=t;for(;r;){const e=a[r];for(const t in e)i[t]=e[t];let t,s=!1;do{if(t=Object.getPrototypeOf(n),!t.getClassName){s=!0;break}if(t.getClassName()!==r)break;n=t}while(t);if(s)break;r=t.getClassName(),n=t}return i}function _(e,t){return(i,n)=>{const r=function(e){const t=e.getClassName();return a[t]||(a[t]={}),a[t]}(i);r[n]||(r[n]={type:e,sourceName:t})}}function d(e,t=null){return function(e,t=null){return(i,n)=>{const r=t||"_"+n;Object.defineProperty(i,n,{get:function(){return this[r]},set:function(t){"function"==typeof this.equals&&this.equals(t)||this[r]!==t&&(this[r]=t,i[e].apply(this))},enumerable:!0,configurable:!0})}}(e,t)}function u(e){return _(0,e)}function p(e){return _(1,e)}function f(e){return _(2,e)}function m(e){return _(3,e)}function g(e){return _(4,e)}function b(e){return _(5,e)}function y(e){return _(6,e)}function v(e){return _(7,e)}function A(e){return _(8,e)}function C(e){return _(9,e)}function S(e){return _(10,e)}function x(e){return _(12,e)}function T(e){return _(11,e)}class E{static AppendSerializedAnimations(e,t){if(e.animations){t.animations=[];for(let i=0;i{let s=r;if("undefined"!=typeof _native&&_native[t]){const e=_native[t];s=n?(...t)=>n(...t)?e(...t):r(...t):e}return e[t]=s,s(...i)}}E.AllowLoadingUniqueId=!1,E._ImageProcessingConfigurationParser=e=>{throw(0,s.S)("ImageProcessingConfiguration")},E._FresnelParametersParser=e=>{throw(0,s.S)("FresnelParameters")},E._ColorCurvesParser=e=>{throw(0,s.S)("ColorCurves")},E._TextureParser=(e,t,i)=>{throw(0,s.S)("Texture")},R.filter=function(e){return(t,i,n)=>R(t,i,n,e)}},"../../../node_modules/@babylonjs/core/Misc/deepCopier.js":function(e,t,i){"use strict";i.d(t,{j:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Misc/logger.js");const r=(e,t)=>e?e.getClassName&&"Mesh"===e.getClassName()?null:e.getClassName&&"SubMesh"===e.getClassName()?e.clone(t):e.clone?e.clone():null:null;class s{static DeepCopy(e,t,i,s){const o=function(e){const t=[];do{Object.getOwnPropertyNames(e).forEach((function(e){-1===t.indexOf(e)&&t.push(e)}))}while(e=Object.getPrototypeOf(e));return t}(e);for(const a of o){if("_"===a[0]&&(!s||-1===s.indexOf(a)))continue;if(a.endsWith("Observable"))continue;if(i&&-1!==i.indexOf(a))continue;const o=e[a],l=typeof o;if("function"!==l)try{if("object"===l)if(o instanceof Array){if(t[a]=[],o.length>0)if("object"==typeof o[0])for(let e=0;e{this._resolve=e,this._reject=t}))}get resolve(){return this._resolve}get reject(){return this._reject}}},"../../../node_modules/@babylonjs/core/Misc/devTools.js":function(e,t,i){"use strict";function n(e){return`${e} needs to be imported before as it contains a side-effect required by your code.`}i.d(t,{S:function(){return n}})},"../../../node_modules/@babylonjs/core/Misc/domManagement.js":function(e,t,i){"use strict";function n(){return"undefined"!=typeof window}function r(){return"undefined"!=typeof navigator}function s(){return"undefined"!=typeof document}function o(e){let t="",i=e.firstChild;for(;i;)3===i.nodeType&&(t+=i.textContent),i=i.nextSibling;return t}i.d(t,{CG:function(){return n},MZ:function(){return a},n5:function(){return s},up:function(){return r},v:function(){return o}});const a={IsWindowObjectExist:n,IsNavigatorAvailable:r,IsDocumentAvailable:s,GetDOMTextContent:o}},"../../../node_modules/@babylonjs/core/Misc/environmentTextureTools.js":function(e,t,i){"use strict";i.d(t,{Do:function(){return f},qJ:function(){return u},Ro:function(){return m},qC:function(){return y},Lf:function(){return v}});var n=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js"),o=i("../../../node_modules/@babylonjs/core/Maths/sphericalPolynomial.js"),a=i("../../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js"),l=i("../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.js"),c=(i("../../../node_modules/@babylonjs/core/scene.js"),i("../../../node_modules/@babylonjs/core/PostProcesses/postProcess.js")),h=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),_=(i("../../../node_modules/@babylonjs/core/Misc/rgbdTextureTools.js"),i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTargetCube.js"),i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.readTexture.js"),i("../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.polynomial.js"),i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js"));i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js");_.v.ShadersStore.rgbdEncodePixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}",i("../../../node_modules/@babylonjs/core/Shaders/rgbdDecode.fragment.js");const d=[134,22,135,150,246,214,150,54];function u(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);let i=0;for(let e=0;e2)throw new Error(`Unsupported babylon environment map version "${e.version}". Latest supported version is "2".`);return 2===e.version?e:e={...e,version:2,imageType:"image/png"}}function f(e,t){const i=(t=p(t)).specular;let n=s.R.Log2(t.width);if(n=Math.round(n)+1,i.mipmaps.length!==6*n)throw new Error(`Unsupported specular mipmaps number "${i.mipmaps.length}"`);const r=new Array(n);for(let t=0;t{if(i){const i=t.createTexture(null,!0,!0,null,1,null,(e=>{d(e)}),e);n.getEffect().executeWhenCompiled((()=>{n.externalTextureSamplerBinding=!0,n.onApply=n=>{n._bindTexture("textureSampler",i),n.setFloat2("scale",1,t._features.needsInvertingBitmap&&e instanceof ImageBitmap?-1:1)},t.scenes.length&&(t.scenes[0].postProcessManager.directRender([n],c,!0,s,o),t.restoreDefaultFramebuffer(),i.dispose(),URL.revokeObjectURL(r),_())}))}else{if(t._uploadImageToTexture(h,e,s,o),a){const i=l[o];i&&t._uploadImageToTexture(i._texture,e,s,0)}_()}}))}function b(e,t,i="image/png"){if(!n.w1.IsExponentOfTwo(e.width))throw new Error("Texture size must be a power of two");const r=s.R.ILog2(e.width)+1,o=e.getEngine();let h=!1,_=!1,d=null,u=null,p=null;const f=o.getCaps();if(e.format=5,e.type=0,e.generateMipMaps=!0,e._cachedAnisotropicFilteringLevel=null,o.updateTextureSamplingMode(3,e),f.textureLOD?o._features.supportRenderAndCopyToLodForFloatTextures?f.textureHalfFloatRender&&f.textureHalfFloatLinearFiltering?(h=!0,e.type=2):f.textureFloatRender&&f.textureFloatLinearFiltering&&(h=!0,e.type=1):h=!1:(h=!1,_=!0,p={}),h)d=new c.D("rgbdDecode","rgbdDecode",null,null,1,null,3,o,!1,void 0,e.type,void 0,null,!1),e._isRGBD=!1,e.invertY=!1,u=o.createRenderTargetCubeTexture(e.width,{generateDepthBuffer:!1,generateMipMaps:!0,generateStencilBuffer:!1,samplingMode:3,type:e.type,format:5});else if(e._isRGBD=!0,e.invertY=!0,_){const t=3,i=e._lodGenerationScale,n=e._lodGenerationOffset;for(let s=0;sg(t,o,h,d,l,r,n,_,p,u,e)));else{const t=new Image;t.src=l,c=new Promise(((i,s)=>{t.onload=()=>{g(t,o,h,d,l,r,n,_,p,u,e).then((()=>i())).catch((e=>{s(e)}))},t.onerror=e=>{s(e)}}))}m.push(c)}if(t.length{u&&(o._releaseTexture(e),u._swapAndDie(e)),d&&d.dispose(),_&&(e._lodTextureHigh&&e._lodTextureHigh._texture&&(e._lodTextureHigh._texture.isReady=!0),e._lodTextureMid&&e._lodTextureMid._texture&&(e._lodTextureMid._texture.isReady=!0),e._lodTextureLow&&e._lodTextureLow._texture&&(e._lodTextureLow._texture.isReady=!0))}))}function y(e,t){const i=(t=p(t)).irradiance;if(!i)return;const n=new o.i;r.P.FromArrayToRef(i.x,0,n.x),r.P.FromArrayToRef(i.y,0,n.y),r.P.FromArrayToRef(i.z,0,n.z),r.P.FromArrayToRef(i.xx,0,n.xx),r.P.FromArrayToRef(i.yy,0,n.yy),r.P.FromArrayToRef(i.zz,0,n.zz),r.P.FromArrayToRef(i.yz,0,n.yz),r.P.FromArrayToRef(i.zx,0,n.zx),r.P.FromArrayToRef(i.xy,0,n.xy),e._sphericalPolynomial=n}function v(e,t,i,n,r){const s=b(e.getEngine().createRawCubeTexture(null,e.width,e.format,e.type,e.generateMipMaps,e.invertY,e.samplingMode,e._compression),t).then((()=>e));return e.onRebuildCallback=e=>({proxy:s,isReady:!0,isAsync:!0}),e._source=a.S.CubeRawRGBD,e._bufferViewArrayArray=t,e._lodGenerationScale=n,e._lodGenerationOffset=r,e._sphericalPolynomial=i,b(e,t).then((()=>(e.isReady=!0,e)))}},"../../../node_modules/@babylonjs/core/Misc/error.js":function(e,t,i){"use strict";i.d(t,{GU:function(){return n},LH:function(){return s},SM:function(){return r}});class n extends Error{}n._setPrototypeOf=Object.setPrototypeOf||((e,t)=>(e.__proto__=t,e));const r={MeshInvalidPositionsError:0,UnsupportedTextureError:1e3,GLTFLoaderUnexpectedMagicError:2e3,SceneLoaderError:3e3,LoadFileError:4e3,RequestFileError:4001,ReadFileError:4002};class s extends n{constructor(e,t,i){super(e),this.errorCode=t,this.innerError=i,this.name="RuntimeError",n._setPrototypeOf(this,s.prototype)}}},"../../../node_modules/@babylonjs/core/Misc/fileTools.js":function(e,t,i){"use strict";i.d(t,{$K:function(){return I},$M:function(){return A},FV:function(){return T},Ip:function(){return S},VL:function(){return R},eh:function(){return m},r6:function(){return C},rN:function(){return y},vP:function(){return x}});var n=i("../../../node_modules/@babylonjs/core/Misc/webRequest.js"),r=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js"),s=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),o=i("../../../node_modules/@babylonjs/core/Misc/filesInputStore.js"),a=i("../../../node_modules/@babylonjs/core/Misc/retryStrategy.js"),l=i("../../../node_modules/@babylonjs/core/Misc/error.js"),c=i("../../../node_modules/@babylonjs/core/Misc/stringTools.js"),h=i("../../../node_modules/@babylonjs/core/Engines/Processors/shaderProcessor.js"),_=i("../../../node_modules/@babylonjs/core/Engines/thinEngine.js"),d=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),u=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),p=i("../../../node_modules/@babylonjs/core/Misc/timingTools.js");const f=new RegExp(/^data:([^,]+\/[^,]+)?;base64,/i);class m extends l.LH{constructor(e,t){super(e,l.SM.LoadFileError),this.name="LoadFileError",l.GU._setPrototypeOf(this,m.prototype),t instanceof n.g?this.request=t:this.file=t}}class g extends l.LH{constructor(e,t){super(e,l.SM.RequestFileError),this.request=t,this.name="RequestFileError",l.GU._setPrototypeOf(this,g.prototype)}}class b extends l.LH{constructor(e,t){super(e,l.SM.ReadFileError),this.file=t,this.name="ReadFileError",l.GU._setPrototypeOf(this,b.prototype)}}const y={DefaultRetryStrategy:a.b.ExponentialBackoff(),BaseUrl:"",CorsBehavior:"anonymous",PreprocessUrl:e=>e},v=e=>e.replace(/#/gm,"%23"),A=(e,t)=>{if((!e||0!==e.indexOf("data:"))&&y.CorsBehavior)if("string"==typeof y.CorsBehavior||y.CorsBehavior instanceof String)t.crossOrigin=y.CorsBehavior;else{const i=y.CorsBehavior(e);i&&(t.crossOrigin=i)}},C=(e,t,i,n,r="",s)=>{var a;let l,h=!1;e instanceof ArrayBuffer||ArrayBuffer.isView(e)?"undefined"!=typeof Blob&&"undefined"!=typeof URL?(l=URL.createObjectURL(new Blob([e],{type:r})),h=!0):l=`data:${r};base64,`+(0,c.Gh)(e):e instanceof Blob?(l=URL.createObjectURL(e),h=!0):(l=v(e),l=y.PreprocessUrl(e));const _=d.l.LastCreatedEngine,u=t=>{if(i){const n=l||e.toString();i(`Error while trying to load image: ${0===n.indexOf("http")||n.length<=128?n:n.slice(0,128)+"..."}`,t)}};if("undefined"==typeof Image||null!==(a=null==_?void 0:_._features.forceBitmapOverHTMLImageElement)&&void 0!==a&&a)return x(l,(n=>{_.createImageBitmap(new Blob([n],{type:r}),{premultiplyAlpha:"none",...s}).then((e=>{t(e),h&&URL.revokeObjectURL(l)})).catch((t=>{i&&i("Error while trying to load image: "+e,t)}))}),void 0,n||void 0,!0,((e,t)=>{u(t)})),null;const p=new Image;A(l,p);const f=[],m=()=>{f.forEach((e=>{e.target.removeEventListener(e.name,e.handler)})),f.length=0};f.push({target:p,name:"load",handler:()=>{m(),t(p),h&&p.src&&URL.revokeObjectURL(p.src)}}),f.push({target:p,name:"error",handler:e=>{m(),u(e),h&&p.src&&URL.revokeObjectURL(p.src)}}),f.push({target:document,name:"securitypolicyviolation",handler:e=>{m();const t=new Error(`CSP violation of policy ${e.effectiveDirective} ${e.blockedURI}. Current policy is ${e.originalPolicy}`);d.l.UseFallbackTexture=!1,u(t),h&&p.src&&URL.revokeObjectURL(p.src),p.src=""}}),f.forEach((e=>{e.target.addEventListener(e.name,e.handler)}));const g="blob:"===l.substring(0,5),b="data:"===l.substring(0,5),C=()=>{g||b?p.src=l:x(l,((e,t,i)=>{const n=new Blob([e],{type:!r&&i?i:r}),s=URL.createObjectURL(n);h=!0,p.src=s}),void 0,n||void 0,!0,((e,t)=>{u(t)}))};if(!g&&!b&&n&&n.enableTexturesOffline)n.open((()=>{n&&n.loadImage(l,p)}),C);else{if(-1!==l.indexOf("file:")){const e=decodeURIComponent(l.substring(5).toLowerCase());if(o.X.FilesToLoad[e]&&"undefined"!=typeof URL){try{let t;try{t=URL.createObjectURL(o.X.FilesToLoad[e])}catch(i){t=URL.createObjectURL(o.X.FilesToLoad[e])}p.src=t,h=!0}catch(e){p.src=""}return p}}C()}return p},S=(e,t,i,n,r)=>{const o=new FileReader,a={onCompleteObservable:new s.y$,abort:()=>o.abort()};return o.onloadend=()=>a.onCompleteObservable.notifyObservers(a),r&&(o.onerror=()=>{r(new b(`Unable to read ${e.name}`,e))}),o.onload=e=>{t(e.target.result)},i&&(o.onprogress=i),n?o.readAsArrayBuffer(e):o.readAsText(e),a},x=(e,t,i,n,r,a,l)=>{if(e.name)return S(e,t,i,r,a?e=>{a(void 0,e)}:void 0);const c=e;if(-1!==c.indexOf("file:")){let e=decodeURIComponent(c.substring(5).toLowerCase());0===e.indexOf("./")&&(e=e.substring(2));const n=o.X.FilesToLoad[e];if(n)return S(n,t,i,r,a?e=>a(void 0,new m(e.message,e.file)):void 0)}const{match:h,type:_}=P(c);if(h){const e={onCompleteObservable:new s.y$,abort:()=>()=>{}};try{const e=r?I(c):M(c);t(e,void 0,_)}catch(e){a?a(void 0,e):u.Y.Error(e.message||"Failed to parse the Data URL")}return p.Q.SetImmediate((()=>{e.onCompleteObservable.notifyObservers(e)})),e}return T(c,((e,i)=>{t(e,null==i?void 0:i.responseURL,null==i?void 0:i.getResponseHeader("content-type"))}),i,n,r,a?e=>{a(e.request,new m(e.message,e.request))}:void 0,l)},T=(e,t,i,o,a,l,c)=>{e=v(e),e=y.PreprocessUrl(e);const h=y.BaseUrl+e;let _=!1;const d={onCompleteObservable:new s.y$,abort:()=>_=!0},p=()=>{let e,s=new n.g,o=null;const p=()=>{s&&(i&&s.removeEventListener("progress",i),e&&s.removeEventListener("readystatechange",e),s.removeEventListener("loadend",f))};let f=()=>{p(),d.onCompleteObservable.notifyObservers(d),d.onCompleteObservable.clear(),i=void 0,e=null,f=null,l=void 0,c=void 0,t=void 0};d.abort=()=>{_=!0,f&&f(),s&&s.readyState!==(XMLHttpRequest.DONE||4)&&s.abort(),null!==o&&(clearTimeout(o),o=null),s=null};const m=e=>{const t=e.message||"Unknown error";l&&s?l(new g(t,s)):u.Y.Error(t)},b=d=>{if(s){if(s.open("GET",h),c)try{c(s)}catch(e){return void m(e)}a&&(s.responseType="arraybuffer"),i&&s.addEventListener("progress",i),f&&s.addEventListener("loadend",f),e=()=>{if(!_&&s&&s.readyState===(XMLHttpRequest.DONE||4)){if(e&&s.removeEventListener("readystatechange",e),s.status>=200&&s.status<300||0===s.status&&(!(0,r.CG)()||E())){try{t&&t(a?s.response:s.responseText,s)}catch(e){m(e)}return}const i=y.DefaultRetryStrategy;if(i){const e=i(h,s,d);if(-1!==e)return p(),s=new n.g,void(o=setTimeout((()=>b(d+1)),e))}const c=new g("Error status: "+s.status+" "+s.statusText+" - Unable to load "+h,s);l&&l(c)}},s.addEventListener("readystatechange",e),s.send()}};b(0)};if(o&&o.enableSceneOffline){const n=e=>{e&&e.status>400?l&&l(e):p()},r=()=>{o&&o.loadFile(y.BaseUrl+e,(e=>{!_&&t&&t(e),d.onCompleteObservable.notifyObservers(d)}),i?e=>{!_&&i&&i(e)}:void 0,n,a)};o.open(r,n)}else p();return d},E=()=>"undefined"!=typeof location&&"file:"===location.protocol,R=e=>f.test(e),P=e=>{const t=f.exec(e);return null===t||0===t.length?{match:!1,type:""}:{match:!0,type:t[0].replace("data:","").replace("base64,","")}};function I(e){return(0,c.HQ)(e.split(",")[1])}const M=e=>(0,c.rP)(e.split(",")[1]);let D;_.B._FileToolsLoadImage=C,_.B._FileToolsLoadFile=x,h.L._FileToolsLoadFile=x,((e,t,i,n,r,s,o,a,l,c)=>{D={DecodeBase64UrlToBinary:e,DecodeBase64UrlToString:t,DefaultRetryStrategy:i.DefaultRetryStrategy,BaseUrl:i.BaseUrl,CorsBehavior:i.CorsBehavior,PreprocessUrl:i.PreprocessUrl,IsBase64DataUrl:n,IsFileURL:r,LoadFile:s,LoadImage:o,ReadFile:a,RequestFile:l,SetCorsBehavior:c},Object.defineProperty(D,"DefaultRetryStrategy",{get:function(){return i.DefaultRetryStrategy},set:function(e){i.DefaultRetryStrategy=e}}),Object.defineProperty(D,"BaseUrl",{get:function(){return i.BaseUrl},set:function(e){i.BaseUrl=e}}),Object.defineProperty(D,"PreprocessUrl",{get:function(){return i.PreprocessUrl},set:function(e){i.PreprocessUrl=e}}),Object.defineProperty(D,"CorsBehavior",{get:function(){return i.CorsBehavior},set:function(e){i.CorsBehavior=e}})})(I,M,y,R,E,x,C,S,T,A)},"../../../node_modules/@babylonjs/core/Misc/filesInputStore.js":function(e,t,i){"use strict";i.d(t,{X:function(){return n}});class n{}n.FilesToLoad={}},"../../../node_modules/@babylonjs/core/Misc/guid.js":function(e,t,i){"use strict";function n(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}i.d(t,{f:function(){return n}})},"../../../node_modules/@babylonjs/core/Misc/instantiationTools.js":function(e,t,i){"use strict";i.d(t,{K:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),r=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class s{static Instantiate(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];const t=(0,r.q)(e);if(t)return t;n.Y.Warn(e+" not found, you may have missed an import.");const i=e.split(".");let s=window||this;for(let e=0,t=i.length;ee<10?"0"+e:""+e,i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e}static _LogDisabled(e,t){}static _LogEnabled(e=1,t,i){if(void 0!==i&&!n._CheckLimit(t,i))return;const r=n._FormatMessage(t),s=this._Levels[e];s.logFunc&&s.logFunc("BJS - "+r);const o=`
${r}

`;n._AddLogEntry(o),n._GenerateLimitMessage(t,e)}static get LogCache(){return n._LogCache}static ClearLogCache(){n._LogCache="",n._LogLimitOutputs={},n.errorsCount=0}static set LogLevels(e){n.Log=n._LogDisabled,n.Warn=n._LogDisabled,n.Error=n._LogDisabled,[n.MessageLogLevel,n.WarningLogLevel,n.ErrorLogLevel].forEach((t=>{if((e&t)===t){const e=this._Levels[t];n[e.name]=n._LogEnabled.bind(n,t)}}))}}n.NoneLogLevel=0,n.MessageLogLevel=1,n.WarningLogLevel=2,n.ErrorLogLevel=4,n.AllLogLevel=7,n.MessageLimitReached="Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.",n._LogCache="",n._LogLimitOutputs={},n._Levels=[{},{color:"white",logFunc:console.log,name:"Log"},{color:"orange",logFunc:console.warn,name:"Warn"},{},{color:"red",logFunc:console.error,name:"Error"}],n.errorsCount=0,n.Log=n._LogEnabled.bind(n,n.MessageLogLevel),n.Warn=n._LogEnabled.bind(n,n.WarningLogLevel),n.Error=n._LogEnabled.bind(n,n.ErrorLogLevel)},"../../../node_modules/@babylonjs/core/Misc/observable.js":function(e,t,i){"use strict";i.d(t,{he:function(){return n},y$:function(){return s}});class n{constructor(e,t=!1,i,n){this.initialize(e,t,i,n)}initialize(e,t=!1,i,n){return this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=n,this}}class r{constructor(e,t,i=null){this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1}}class s{constructor(e){this._observers=new Array,this._eventState=new n(0),e&&(this._onObserverAdded=e)}static FromPromise(e,t){const i=new s;return e.then((e=>{i.notifyObservers(e)})).catch((e=>{if(!t)throw e;t.notifyObservers(e)})),i}get observers(){return this._observers}add(e,t=-1,i=!1,n=null,s=!1){if(!e)return null;const o=new r(e,t,n);return o.unregisterOnNextCall=s,i?this._observers.unshift(o):this._observers.push(o),this._onObserverAdded&&this._onObserverAdded(o),o}addOnce(e){return this.add(e,void 0,void 0,void 0,!0)}remove(e){return!!e&&(-1!==this._observers.indexOf(e)&&(this._deferUnregister(e),!0))}removeCallback(e,t){for(let i=0;i{this._remove(e)}),0)}_remove(e){if(!e)return!1;const t=this._observers.indexOf(e);return-1!==t&&(this._observers.splice(t,1),!0)}makeObserverTopPriority(e){this._remove(e),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e),this._observers.push(e)}notifyObservers(e,t=-1,i,n,r){if(!this._observers.length)return!0;const s=this._eventState;s.mask=t,s.target=i,s.currentTarget=n,s.skipNextObservers=!1,s.lastReturnValue=e,s.userInfo=r;for(const i of this._observers)if(!i._willBeUnregistered&&(i.mask&t&&(i.scope?s.lastReturnValue=i.callback.apply(i.scope,[e,s]):s.lastReturnValue=i.callback(e,s),i.unregisterOnNextCall&&this._deferUnregister(i)),s.skipNextObservers))return!1;return!0}notifyObserver(e,t,i=-1){if(e._willBeUnregistered)return;const n=this._eventState;n.mask=i,n.skipNextObservers=!1,e.callback(t,n),e.unregisterOnNextCall&&this._deferUnregister(e)}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const e=new s;return e._observers=this._observers.slice(0),e}hasSpecificMask(e=-1){for(const t of this._observers)if(t.mask&e||t.mask===e)return!0;return!1}}},"../../../node_modules/@babylonjs/core/Misc/perfCounter.js":function(e,t,i){"use strict";i.d(t,{z:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Misc/precisionDate.js");class r{constructor(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}get min(){return this._min}get max(){return this._max}get average(){return this._average}get lastSecAverage(){return this._lastSecAverage}get current(){return this._current}get total(){return this._totalAccumulated}get count(){return this._totalValueCount}fetchNewFrame(){this._totalValueCount++,this._current=0,this._lastSecValueCount++}addCount(e,t){r.Enabled&&(this._current+=e,t&&this._fetchResult())}beginMonitoring(){r.Enabled&&(this._startMonitoringTime=n.F.Now)}endMonitoring(e=!0){if(!r.Enabled)return;e&&this.fetchNewFrame();const t=n.F.Now;this._current=t-this._startMonitoringTime,e&&this._fetchResult()}_fetchResult(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;const e=n.F.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)}}r.Enabled=!0},"../../../node_modules/@babylonjs/core/Misc/performanceMonitor.js":function(e,t,i){"use strict";i.d(t,{A:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Misc/precisionDate.js");class r{constructor(e=30){this._enabled=!0,this._rollingFrameTime=new s(e)}sampleFrame(e=n.F.Now){if(this._enabled){if(null!=this._lastFrameTimeMs){const t=e-this._lastFrameTimeMs;this._rollingFrameTime.add(t)}this._lastFrameTimeMs=e}}get averageFrameTime(){return this._rollingFrameTime.average}get averageFrameTimeVariance(){return this._rollingFrameTime.variance}get instantaneousFrameTime(){return this._rollingFrameTime.history(0)}get averageFPS(){return 1e3/this._rollingFrameTime.average}get instantaneousFPS(){const e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e}get isSaturated(){return this._rollingFrameTime.isSaturated()}enable(){this._enabled=!0}disable(){this._enabled=!1,this._lastFrameTimeMs=null}get isEnabled(){return this._enabled}reset(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()}}class s{constructor(e){this._samples=new Array(e),this.reset()}add(e){let t;if(this.isSaturated()){const e=this._samples[this._pos];t=e-this.average,this.average-=t/(this._sampleCount-1),this._m2-=t*(e-this.average)}else this._sampleCount++;t=e-this.average,this.average+=t/this._sampleCount,this._m2+=t*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length}history(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;const t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]}isSaturated(){return this._sampleCount>=this._samples.length}reset(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0}_wrapPosition(e){const t=this._samples.length;return(e%t+t)%t}}},"../../../node_modules/@babylonjs/core/Misc/pivotTools.js":function(e,t,i){"use strict";i.d(t,{m:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js");class r{static _RemoveAndStorePivotPoint(e){e&&0===r._PivotCached&&(e.getPivotPointToRef(r._OldPivotPoint),r._PivotPostMultiplyPivotMatrix=e._postMultiplyPivotMatrix,r._OldPivotPoint.equalsToFloats(0,0,0)||(e.setPivotMatrix(n.y3.IdentityReadOnly),r._OldPivotPoint.subtractToRef(e.getPivotPoint(),r._PivotTranslation),r._PivotTmpVector.copyFromFloats(1,1,1),r._PivotTmpVector.subtractInPlace(e.scaling),r._PivotTmpVector.multiplyInPlace(r._PivotTranslation),e.position.addInPlace(r._PivotTmpVector))),r._PivotCached++}static _RestorePivotPoint(e){e&&!r._OldPivotPoint.equalsToFloats(0,0,0)&&1===r._PivotCached&&(e.setPivotPoint(r._OldPivotPoint),e._postMultiplyPivotMatrix=r._PivotPostMultiplyPivotMatrix,r._PivotTmpVector.copyFromFloats(1,1,1),r._PivotTmpVector.subtractInPlace(e.scaling),r._PivotTmpVector.multiplyInPlace(r._PivotTranslation),e.position.subtractInPlace(r._PivotTmpVector)),this._PivotCached--}}r._PivotCached=0,r._OldPivotPoint=new n.P,r._PivotTranslation=new n.P,r._PivotTmpVector=new n.P,r._PivotPostMultiplyPivotMatrix=!1},"../../../node_modules/@babylonjs/core/Misc/precisionDate.js":function(e,t,i){"use strict";i.d(t,{F:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js");class r{static get Now(){return n.MZ.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance.now():Date.now()}}},"../../../node_modules/@babylonjs/core/Misc/retryStrategy.js":function(e,t,i){"use strict";i.d(t,{b:function(){return n}});class n{static ExponentialBackoff(e=3,t=500){return(i,n,r)=>0!==n.status||r>=e||-1!==i.indexOf("file:")?-1:Math.pow(2,r)*t}}},"../../../node_modules/@babylonjs/core/Misc/rgbdTextureTools.js":function(e,t,i){"use strict";i.d(t,{r:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/PostProcesses/postProcess.js"),r=(i("../../../node_modules/@babylonjs/core/Shaders/rgbdDecode.fragment.js"),i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.js"),i("../../../node_modules/@babylonjs/core/Misc/textureTools.js"));class s{static ExpandRGBDTexture(e){const t=e._texture;if(!t||!e.isRGBD)return;const i=t.getEngine(),r=i.getCaps(),s=t.isReady;let o=!1;r.textureHalfFloatRender&&r.textureHalfFloatLinearFiltering?(o=!0,t.type=2):r.textureFloatRender&&r.textureFloatLinearFiltering&&(o=!0,t.type=1),o&&(t.isReady=!1,t._isRGBD=!1,t.invertY=!1);const a=()=>{if(o){const r=new n.D("rgbdDecode","rgbdDecode",null,null,1,null,3,i,!1,void 0,t.type,void 0,null,!1);r.externalTextureSamplerBinding=!0;const s=i.createRenderTargetTexture(t.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:t.samplingMode,type:t.type,format:5});r.getEffect().executeWhenCompiled((()=>{r.onApply=e=>{e._bindTexture("textureSampler",t),e.setFloat2("scale",1,1)},e.getScene().postProcessManager.directRender([r],s,!0),i.restoreDefaultFramebuffer(),i._releaseTexture(t),r&&r.dispose(),s._swapAndDie(t),t.isReady=!0}))}};s?a():e.onLoadObservable.addOnce(a)}static EncodeTextureToRGBD(e,t,i=0){return(0,r.$0)("rgbdEncode",e,t,i,1,5)}}},"../../../node_modules/@babylonjs/core/Misc/smartArray.js":function(e,t,i){"use strict";i.d(t,{f:function(){return r},t:function(){return n}});class n{constructor(e){this.length=0,this.data=new Array(e),this._id=n._GlobalId++}push(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)}forEach(e){for(let t=0;tthis.data.length&&(this.data.length=2*(this.length+e.length));for(let t=0;t=this.length?-1:t}contains(e){return-1!==this.indexOf(e)}}n._GlobalId=0;class r extends n{constructor(){super(...arguments),this._duplicateId=0}push(e){super.push(e),e.__smartArrayFlags||(e.__smartArrayFlags={}),e.__smartArrayFlags[this._id]=this._duplicateId}pushNoDuplicate(e){return!(e.__smartArrayFlags&&e.__smartArrayFlags[this._id]===this._duplicateId||(this.push(e),0))}reset(){super.reset(),this._duplicateId++}concatWithNoDuplicate(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(let t=0;tthis.add(e,t)))}get(e){const t=this._data[e];if(void 0!==t)return t}getOrAddWithFactory(e,t){let i=this.get(e);return void 0!==i||(i=t(e),i&&this.add(e,i)),i}getOrAdd(e,t){const i=this.get(e);return void 0!==i?i:(this.add(e,t),t)}contains(e){return void 0!==this._data[e]}add(e,t){return void 0===this._data[e]&&(this._data[e]=t,++this._count,!0)}set(e,t){return void 0!==this._data[e]&&(this._data[e]=t,!0)}getAndRemove(e){const t=this.get(e);return void 0!==t?(delete this._data[e],--this._count,t):null}remove(e){return!!this.contains(e)&&(delete this._data[e],--this._count,!0)}clear(){this._data={},this._count=0}get count(){return this._count}forEach(e){for(const t in this._data)e(t,this._data[t])}first(e){for(const t in this._data){const i=e(t,this._data[t]);if(i)return i}return null}}},"../../../node_modules/@babylonjs/core/Misc/stringTools.js":function(e,t,i){"use strict";i.d(t,{Gh:function(){return r},HQ:function(){return o},fJ:function(){return n},rP:function(){return s}});const n=e=>{if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let i=0;i{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i,n,r,s,o,a,l,c="",h=0;const _=ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e);for(;h<_.length;)i=_[h++],n=h<_.length?_[h++]:Number.NaN,r=h<_.length?_[h++]:Number.NaN,s=i>>2,o=(3&i)<<4|n>>4,a=(15&n)<<2|r>>6,l=63&r,isNaN(n)?a=l=64:isNaN(r)&&(l=64),c+=t.charAt(s)+t.charAt(o)+t.charAt(a)+t.charAt(l);return c},s=e=>atob(e),o=e=>{const t=s(e),i=t.length,n=new Uint8Array(new ArrayBuffer(i));for(let e=0;er.HasTags(e),e.addTags=t=>r.AddTagsTo(e,t),e.removeTags=t=>r.RemoveTagsFrom(e,t),e.matchesTagsQuery=t=>r.MatchesQuery(e,t)}static DisableFor(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery}static HasTags(e){if(!e._tags)return!1;const t=e._tags;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}static GetTags(e,t=!0){if(!e._tags)return null;if(t){const t=[];for(const i in e._tags)Object.prototype.hasOwnProperty.call(e._tags,i)&&!0===e._tags[i]&&t.push(i);return t.join(" ")}return e._tags}static AddTagsTo(e,t){t&&"string"==typeof t&&t.split(" ").forEach((function(t){r._AddTagTo(e,t)}))}static _AddTagTo(e,t){""!==(t=t.trim())&&"true"!==t&&"false"!==t&&(t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(r.EnableFor(e),e._tags[t]=!0))}static RemoveTagsFrom(e,t){if(!r.HasTags(e))return;const i=t.split(" ");for(const t in i)r._RemoveTagFrom(e,i[t])}static _RemoveTagFrom(e,t){delete e._tags[t]}static MatchesQuery(e,t){return void 0===t||(""===t?r.HasTags(e):n.q.Eval(t,(t=>r.HasTags(e)&&e._tags[t])))}}},"../../../node_modules/@babylonjs/core/Misc/textureTools.js":function(e,t,i){"use strict";i.d(t,{$0:function(){return r},ay:function(){return a},qZ:function(){return l}}),i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),i("../../../node_modules/@babylonjs/core/Materials/Textures/renderTargetTexture.js"),i("../../../node_modules/@babylonjs/core/PostProcesses/passPostProcess.js");var n=i("../../../node_modules/@babylonjs/core/PostProcesses/postProcess.js");function r(e,t,i,r,s,o){const a=t.getEngine();return t.isReady=!1,s=null!=s?s:t.samplingMode,r=null!=r?r:t.type,o=null!=o?o:t.format,-1===r&&(r=0),new Promise((l=>{const c=new n.D("postprocess",e,null,null,1,null,s,a,!1,void 0,r,void 0,null,!1,o);c.externalTextureSamplerBinding=!0;const h=a.createRenderTargetTexture({width:t.width,height:t.height},{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:s,type:r,format:o});c.getEffect().executeWhenCompiled((()=>{c.onApply=e=>{e._bindTexture("textureSampler",t),e.setFloat2("scale",1,1)},i.postProcessManager.directRender([c],h,!0),a.restoreDefaultFramebuffer(),a._releaseTexture(t),c&&c.dispose(),h._swapAndDie(t),t.type=r,t.format=5,t.isReady=!0,l(t)}))}))}let s,o;function a(e){s||(s=new Float32Array(1),o=new Int32Array(s.buffer)),s[0]=e;const t=o[0];let i=t>>16&32768,n=t>>12&2047;const r=t>>23&255;return r<103?i:r>142?(i|=31744,i|=(255==r?0:1)&&8388607&t,i):r<113?(n|=2048,i|=(n>>114-r)+(n>>113-r&1),i):(i|=r-112<<10|n>>1,i+=1&n,i)}function l(e){const t=(32768&e)>>15,i=(31744&e)>>10,n=1023&e;return 0===i?(t?-1:1)*Math.pow(2,-14)*(n/Math.pow(2,10)):31==i?n?NaN:1/0*(t?-1:1):(t?-1:1)*Math.pow(2,i-15)*(1+n/Math.pow(2,10))}},"../../../node_modules/@babylonjs/core/Misc/timingTools.js":function(e,t,i){"use strict";i.d(t,{Q:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js");class r{static SetImmediate(e){(0,n.CG)()&&window.setImmediate?window.setImmediate(e):setTimeout(e,1)}}},"../../../node_modules/@babylonjs/core/Misc/tools.js":function(e,t,i){"use strict";i.d(t,{$g:function(){return m},w1:function(){return f}});var n=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),r=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js"),s=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),o=i("../../../node_modules/@babylonjs/core/Misc/deepCopier.js"),a=i("../../../node_modules/@babylonjs/core/Misc/precisionDate.js"),l=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),c=i("../../../node_modules/@babylonjs/core/Misc/webRequest.js"),h=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),_=i("../../../node_modules/@babylonjs/core/Misc/fileTools.js"),d=i("../../../node_modules/@babylonjs/core/Misc/timingTools.js"),u=i("../../../node_modules/@babylonjs/core/Misc/instantiationTools.js"),p=i("../../../node_modules/@babylonjs/core/Misc/guid.js");class f{static get BaseUrl(){return _.rN.BaseUrl}static set BaseUrl(e){_.rN.BaseUrl=e}static get DefaultRetryStrategy(){return _.rN.DefaultRetryStrategy}static set DefaultRetryStrategy(e){_.rN.DefaultRetryStrategy=e}static get CorsBehavior(){return _.rN.CorsBehavior}static set CorsBehavior(e){_.rN.CorsBehavior=e}static get UseFallbackTexture(){return h.l.UseFallbackTexture}static set UseFallbackTexture(e){h.l.UseFallbackTexture=e}static get RegisteredExternalClasses(){return u.K.RegisteredExternalClasses}static set RegisteredExternalClasses(e){u.K.RegisteredExternalClasses=e}static get fallbackTexture(){return h.l.FallbackTexture}static set fallbackTexture(e){h.l.FallbackTexture=e}static FetchToRef(e,t,i,n,r,s){const o=4*((Math.abs(e)*i%i|0)+(Math.abs(t)*n%n|0)*i);s.r=r[o]/255,s.g=r[o+1]/255,s.b=r[o+2]/255,s.a=r[o+3]/255}static Mix(e,t,i){return e*(1-i)+t*i}static Instantiate(e){return u.K.Instantiate(e)}static SetImmediate(e){d.Q.SetImmediate(e)}static IsExponentOfTwo(e){let t=1;do{t*=2}while(t{(0,_.vP)(e,(e=>{i(e)}),void 0,void 0,t,((e,t)=>{n(t)}))}))}static LoadScript(e,t,i,n){if("function"==typeof importScripts){try{importScripts(e),t()}catch(t){null==i||i(`Unable to load script '${e}' in worker`,t)}return}if(!(0,r.CG)())return void(null==i||i(`Cannot load script '${e}' outside of a window or a worker`));const s=document.getElementsByTagName("head")[0],o=document.createElement("script");o.setAttribute("type","text/javascript"),o.setAttribute("src",e),n&&(o.id=n),o.onload=()=>{t&&t()},o.onerror=t=>{i&&i(`Unable to load script '${e}'`,t)},s.appendChild(o)}static LoadScriptAsync(e){return new Promise(((t,i)=>{this.LoadScript(e,(()=>{t()}),((e,t)=>{i(t)}))}))}static ReadFileAsDataURL(e,t,i){const r=new FileReader,s={onCompleteObservable:new n.y$,abort:()=>r.abort()};return r.onloadend=()=>{s.onCompleteObservable.notifyObservers(s)},r.onload=e=>{t(e.target.result)},r.onprogress=i,r.readAsDataURL(e),s}static ReadFile(e,t,i,n,r){return(0,_.Ip)(e,t,i,n,r)}static FileAsURL(e){const t=new Blob([e]);return window.URL.createObjectURL(t)}static Format(e,t=2){return e.toFixed(t)}static DeepCopy(e,t,i,n){o.j.DeepCopy(e,t,i,n)}static IsEmpty(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}static RegisterTopRootEvents(e,t){for(let i=0;i1?1:Math.round(255*n)}i=e}const h=c.createImageData(e,t);h.data.set(i),c.putImageData(h,0,0);let _=f._ScreenshotCanvas;if(o){const i=document.createElement("canvas");i.width=e,i.height=t;const n=i.getContext("2d");if(!n)return;n.translate(0,t),n.scale(1,-1),n.drawImage(f._ScreenshotCanvas,0,0),_=i}a?f.ToBlob(_,(e=>{const t=new FileReader;t.onload=e=>{const t=e.target.result;n&&n(t)},t.readAsArrayBuffer(e)}),r,l):f.EncodeScreenshotCanvasData(n,r,s,_,l)}}static DumpDataAsync(e,t,i,n="image/png",r,s=!1,o=!1,a){return new Promise((l=>{f.DumpData(e,t,i,(e=>l(e)),n,r,s,o,a)}))}static ToBlob(e,t,i="image/png",n){e.toBlob||(e.toBlob=function(e,t,i){setTimeout((()=>{const n=atob(this.toDataURL(t,i).split(",")[1]),r=n.length,s=new Uint8Array(r);for(let e=0;e{n.parentElement&&n.parentElement.removeChild(n)})),n.click(),window.URL.revokeObjectURL(i)}static BackCompatCameraNoPreventDefault(e){return"boolean"==typeof e[0]?e[0]:"boolean"==typeof e[1]&&e[1]}static CreateScreenshot(e,t,i,n,r="image/png"){throw(0,l.S)("ScreenshotTools")}static CreateScreenshotAsync(e,t,i,n="image/png"){throw(0,l.S)("ScreenshotTools")}static CreateScreenshotUsingRenderTarget(e,t,i,n,r="image/png",s=1,o=!1,a){throw(0,l.S)("ScreenshotTools")}static CreateScreenshotUsingRenderTargetAsync(e,t,i,n="image/png",r=1,s=!1,o){throw(0,l.S)("ScreenshotTools")}static RandomId(){return(0,p.f)()}static IsBase64(e){return(0,_.VL)(e)}static DecodeBase64(e){return(0,_.$K)(e)}static get errorsCount(){return s.Y.errorsCount}static Log(e){s.Y.Log(e)}static Warn(e){s.Y.Warn(e)}static Error(e){s.Y.Error(e)}static get LogCache(){return s.Y.LogCache}static ClearLogCache(){s.Y.ClearLogCache()}static set LogLevels(e){s.Y.LogLevels=e}static set PerformanceLogLevel(e){return(e&f.PerformanceUserMarkLogLevel)===f.PerformanceUserMarkLogLevel?(f.StartPerformanceCounter=f._StartUserMark,void(f.EndPerformanceCounter=f._EndUserMark)):(e&f.PerformanceConsoleLogLevel)===f.PerformanceConsoleLogLevel?(f.StartPerformanceCounter=f._StartPerformanceConsole,void(f.EndPerformanceCounter=f._EndPerformanceConsole)):(f.StartPerformanceCounter=f._StartPerformanceCounterDisabled,void(f.EndPerformanceCounter=f._EndPerformanceCounterDisabled))}static _StartPerformanceCounterDisabled(e,t){}static _EndPerformanceCounterDisabled(e,t){}static _StartUserMark(e,t=!0){if(!f._Performance){if(!(0,r.CG)())return;f._Performance=window.performance}t&&f._Performance.mark&&f._Performance.mark(e+"-Begin")}static _EndUserMark(e,t=!0){t&&f._Performance.mark&&(f._Performance.mark(e+"-End"),f._Performance.measure(e,e+"-Begin",e+"-End"))}static _StartPerformanceConsole(e,t=!0){t&&(f._StartUserMark(e,t),console.time&&console.time(e))}static _EndPerformanceConsole(e,t=!0){t&&(f._EndUserMark(e,t),console.timeEnd(e))}static get Now(){return a.F.Now}static GetClassName(e,t=!1){let i=null;return!t&&e.getClassName?i=e.getClassName():(e instanceof Object&&(i=(t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__),i||(i=typeof e)),i}static First(e,t){for(const i of e)if(t(i))return i;return null}static getFullClassName(e,t=!1){let i=null,n=null;if(!t&&e.getClassName)i=e.getClassName();else{if(e instanceof Object){const r=t?e:Object.getPrototypeOf(e);i=r.constructor.__bjsclassName__,n=r.constructor.__bjsmoduleName__}i||(i=typeof e)}return i?(null!=n?n+".":"")+i:null}static DelayAsync(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}static IsSafari(){return!!(0,r.up)()&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}f.UseCustomRequestHeaders=!1,f.CustomRequestHeaders=c.g.CustomRequestHeaders,f._TmpFloatArray=new Float32Array(1),f.GetDOMTextContent=r.v,f.GetAbsoluteUrl="object"==typeof document?e=>{const t=document.createElement("a");return t.href=e,t.href}:"function"==typeof URL&&"object"==typeof location?e=>new URL(e,location.origin).href:()=>{throw new Error("Unable to get absolute URL. Override BABYLON.Tools.GetAbsoluteUrl to a custom implementation for the current context.")},f.NoneLogLevel=s.Y.NoneLogLevel,f.MessageLogLevel=s.Y.MessageLogLevel,f.WarningLogLevel=s.Y.WarningLogLevel,f.ErrorLogLevel=s.Y.ErrorLogLevel,f.AllLogLevel=s.Y.AllLogLevel,f.IsWindowObjectExist=r.CG,f.PerformanceNoneLogLevel=0,f.PerformanceUserMarkLogLevel=1,f.PerformanceConsoleLogLevel=2,f.StartPerformanceCounter=f._StartPerformanceCounterDisabled,f.EndPerformanceCounter=f._EndPerformanceCounterDisabled;class m{constructor(e,t,i,n=0){this.iterations=e,this.index=n-1,this._done=!1,this._fn=t,this._successCallback=i}executeNext(){this._done||(this.index+1{r&&r()?n.breakLoop():setTimeout((()=>{for(let s=0;s=e)break;if(i(o),r&&r()){n.breakLoop();break}}n.executeNext()}),s)}),n)}}h.l.FallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z"},"../../../node_modules/@babylonjs/core/Misc/typeStore.js":function(e,t,i){"use strict";i.d(t,{H:function(){return r},q:function(){return s}});const n={};function r(e,t){n[e]=t}function s(e){return n[e]}},"../../../node_modules/@babylonjs/core/Misc/uniqueIdGenerator.js":function(e,t,i){"use strict";i.d(t,{K:function(){return n}});class n{static get UniqueId(){const e=this._UniqueIdCounter;return this._UniqueIdCounter++,e}}n._UniqueIdCounter=1},"../../../node_modules/@babylonjs/core/Misc/webRequest.js":function(e,t,i){"use strict";i.d(t,{g:function(){return n}});class n{constructor(){this._xhr="undefined"!=typeof _native&&_native.XMLHttpRequest?new _native.XMLHttpRequest:new XMLHttpRequest,this._requestURL=""}_injectCustomRequestHeaders(){if(!this._shouldSkipRequestModifications(this._requestURL))for(const e in n.CustomRequestHeaders){const t=n.CustomRequestHeaders[e];t&&this._xhr.setRequestHeader(e,t)}}_shouldSkipRequestModifications(e){return n.SkipRequestModificationForBabylonCDN&&(e.includes("preview.babylonjs.com")||e.includes("cdn.babylonjs.com"))}get onprogress(){return this._xhr.onprogress}set onprogress(e){this._xhr.onprogress=e}get readyState(){return this._xhr.readyState}get status(){return this._xhr.status}get statusText(){return this._xhr.statusText}get response(){return this._xhr.response}get responseURL(){return this._xhr.responseURL}get responseText(){return this._xhr.responseText}get responseType(){return this._xhr.responseType}set responseType(e){this._xhr.responseType=e}get timeout(){return this._xhr.timeout}set timeout(e){this._xhr.timeout=e}addEventListener(e,t,i){this._xhr.addEventListener(e,t,i)}removeEventListener(e,t,i){this._xhr.removeEventListener(e,t,i)}abort(){this._xhr.abort()}send(e){n.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(e)}open(e,t){for(const e of n.CustomRequestModifiers){if(this._shouldSkipRequestModifications(t))return;e(this._xhr,t)}return t=(t=t.replace("file:http:","http:")).replace("file:https:","https:"),this._requestURL=t,this._xhr.open(e,t,!0)}setRequestHeader(e,t){this._xhr.setRequestHeader(e,t)}getResponseHeader(e){return this._xhr.getResponseHeader(e)}}n.CustomRequestHeaders={},n.CustomRequestModifiers=new Array,n.SkipRequestModificationForBabylonCDN=!0},"../../../node_modules/@babylonjs/core/Misc/workerPool.js":function(e,t,i){"use strict";i.d(t,{v:function(){return r}});class n{constructor(e){this._pendingActions=new Array,this._workerInfos=e.map((e=>({workerPromise:Promise.resolve(e),idle:!0})))}dispose(){for(const e of this._workerInfos)e.workerPromise.then((e=>{e.terminate()}));this._workerInfos.length=0,this._pendingActions.length=0}push(e){this._executeOnIdleWorker(e)||this._pendingActions.push(e)}_executeOnIdleWorker(e){for(const t of this._workerInfos)if(t.idle)return this._execute(t,e),!0;return!1}_execute(e,t){e.idle=!1,e.workerPromise.then((i=>{t(i,(()=>{const t=this._pendingActions.shift();t?this._execute(e,t):e.idle=!0}))}))}}class r extends n{constructor(e,t,i=r.DefaultOptions){super([]),this._maxWorkers=e,this._createWorkerAsync=t,this._options=i}push(e){if(!this._executeOnIdleWorker(e))if(this._workerInfos.length{t(i,(()=>{n(),e.idle&&(e.timeoutId=setTimeout((()=>{e.workerPromise.then((e=>{e.terminate()}));const t=this._workerInfos.indexOf(e);-1!==t&&this._workerInfos.splice(t,1)}),this._options.idleTimeElapsedBeforeRelease))}))}))}}r.DefaultOptions={idleTimeElapsedBeforeRelease:1e3}},"../../../node_modules/@babylonjs/core/Morph/morphTarget.js":function(e,t,i){"use strict";i.d(t,{Y:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),s=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),o=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),a=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),l=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class c{constructor(e,t=0,i=null){this.name=e,this.animations=new Array,this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this._uniqueId=0,this.onInfluenceChanged=new r.y$,this._onDataLayoutChanged=new r.y$,this._animationPropertiesOverride=null,this._scene=i||s.l.LastCreatedScene,this.influence=t,this._scene&&(this._uniqueId=this._scene.getUniqueId())}get influence(){return this._influence}set influence(e){if(this._influence===e)return;const t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers()&&this.onInfluenceChanged.notifyObservers(0===t||0===e)}get animationPropertiesOverride(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}get uniqueId(){return this._uniqueId}get hasPositions(){return!!this._positions}get hasNormals(){return!!this._normals}get hasTangents(){return!!this._tangents}get hasUVs(){return!!this._uvs}setPositions(e){const t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)}getPositions(){return this._positions}setNormals(e){const t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)}getNormals(){return this._normals}setTangents(e){const t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)}getTangents(){return this._tangents}setUVs(e){const t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)}getUVs(){return this._uvs}clone(){const e=a.p4.Clone((()=>new c(this.name,this.influence,this._scene)),this);return e._positions=this._positions,e._normals=this._normals,e._tangents=this._tangents,e._uvs=this._uvs,e}serialize(){const e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),null!=this.id&&(e.id=this.id),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),a.p4.AppendSerializedAnimations(this,e),e}getClassName(){return"MorphTarget"}static Parse(e,t){const i=new c(e.name,e.influence);if(i.setPositions(e.positions),null!=e.id&&(i.id=e.id),e.normals&&i.setNormals(e.normals),e.tangents&&i.setTangents(e.tangents),e.uvs&&i.setUVs(e.uvs),e.animations){for(let t=0;t0&&e.texture2DArrayMaxLayerCount>1}}set areUpdatesFrozen(e){e?this._blockCounter++:(this._blockCounter--,this._blockCounter<=0&&(this._blockCounter=0,this._syncActiveTargets(!0)))}get areUpdatesFrozen(){return this._blockCounter>0}get uniqueId(){return this._uniqueId}get vertexCount(){return this._vertexCount}get supportsNormals(){return this._supportsNormals&&this.enableNormalMorphing}get supportsTangents(){return this._supportsTangents&&this.enableTangentMorphing}get supportsUVs(){return this._supportsUVs&&this.enableUVMorphing}get numTargets(){return this._targets.length}get numInfluencers(){return this._activeTargets.length}get influences(){return this._influences}get useTextureToStoreTargets(){return this._useTextureToStoreTargets}set useTextureToStoreTargets(e){this._useTextureToStoreTargets=e}get isUsingTextureForTargets(){return l.EnableTextureStorage&&this.useTextureToStoreTargets&&this._canUseTextureForTargets}getActiveTarget(e){return this._activeTargets.data[e]}getTarget(e){return this._targets[e]}addTarget(e){this._targets.push(e),this._targetInfluenceChangedObservers.push(e.onInfluenceChanged.add((e=>{this._syncActiveTargets(e)}))),this._targetDataLayoutChangedObservers.push(e._onDataLayoutChanged.add((()=>{this._syncActiveTargets(!0)}))),this._syncActiveTargets(!0)}removeTarget(e){const t=this._targets.indexOf(e);t>=0&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._syncActiveTargets(!0))}_bind(e){e.setFloat3("morphTargetTextureInfo",this._textureVertexStride,this._textureWidth,this._textureHeight),e.setFloatArray("morphTargetTextureIndices",this._morphTargetTextureIndices),e.setTexture("morphTargets",this._targetStoreTexture)}clone(){const e=new l(this._scene);for(const t of this._targets)e.addTarget(t.clone());return e.enableNormalMorphing=this.enableNormalMorphing,e.enableTangentMorphing=this.enableTangentMorphing,e.enableUVMorphing=this.enableUVMorphing,e}serialize(){const e={};e.id=this.uniqueId,e.targets=[];for(const t of this._targets)e.targets.push(t.serialize());return e}_syncActiveTargets(e){if(this.areUpdatesFrozen)return;let t=0;this._activeTargets.reset(),this._supportsNormals=!0,this._supportsTangents=!0,this._supportsUVs=!0,this._vertexCount=0,this._morphTargetTextureIndices&&this._morphTargetTextureIndices.length===this._targets.length||(this._morphTargetTextureIndices=new Float32Array(this._targets.length));let i=-1;for(const e of this._targets){if(i++,0===e.influence&&this.optimizeInfluencers)continue;this._activeTargets.push(e),this._morphTargetTextureIndices[t]=i,this._tempInfluences[t++]=e.influence,this._supportsNormals=this._supportsNormals&&e.hasNormals,this._supportsTangents=this._supportsTangents&&e.hasTangents,this._supportsUVs=this._supportsUVs&&e.hasUVs;const n=e.getPositions();if(n){const e=n.length/3;if(0===this._vertexCount)this._vertexCount=e;else if(this._vertexCount!==e)return void r.Y.Error("Incompatible target. Targets must all have the same vertices count.")}}this._influences&&this._influences.length===t||(this._influences=new Float32Array(t));for(let e=0;ee&&(this._textureHeight=Math.ceil(this._textureWidth/e),this._textureWidth=e);let t=!0;if(this._targetStoreTexture){const e=this._targetStoreTexture.getSize();e.width===this._textureWidth&&e.height===this._textureHeight&&this._targetStoreTexture.depth===this._targets.length&&(t=!1)}if(t){this._targetStoreTexture&&this._targetStoreTexture.dispose();const e=this._targets.length,t=new Float32Array(e*this._textureWidth*this._textureHeight*4);let i=0;for(let n=0;n-1&&this._parentContainer.morphTargetManagers.splice(e,1),this._parentContainer=null}}static Parse(e,t){const i=new l(t);i._uniqueId=e.id;for(const n of e.targets)i.addTarget(o.Y.Parse(n,t));return i}}l.EnableTextureStorage=!0},"../../../node_modules/@babylonjs/core/Particles/EmitterTypes/boxParticleEmitter.js":function(e,t,i){"use strict";i.d(t,{S:function(){return o}});var n=i("../../../node_modules/@babylonjs/core/Misc/deepCopier.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js");class o{constructor(){this.direction1=new r.P(0,1,0),this.direction2=new r.P(0,1,0),this.minEmitBox=new r.P(-.5,-.5,-.5),this.maxEmitBox=new r.P(.5,.5,.5)}startDirectionFunction(e,t,i,n){const o=s.R.RandomRange(this.direction1.x,this.direction2.x),a=s.R.RandomRange(this.direction1.y,this.direction2.y),l=s.R.RandomRange(this.direction1.z,this.direction2.z);if(n)return t.x=o,t.y=a,void(t.z=l);r.P.TransformNormalFromFloatsToRef(o,a,l,e,t)}startPositionFunction(e,t,i,n){const o=s.R.RandomRange(this.minEmitBox.x,this.maxEmitBox.x),a=s.R.RandomRange(this.minEmitBox.y,this.maxEmitBox.y),l=s.R.RandomRange(this.minEmitBox.z,this.maxEmitBox.z);if(n)return t.x=o,t.y=a,void(t.z=l);r.P.TransformCoordinatesFromFloatsToRef(o,a,l,e,t)}clone(){const e=new o;return n.j.DeepCopy(this,e),e}applyToShader(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2),e.setVector3("minEmitBox",this.minEmitBox),e.setVector3("maxEmitBox",this.maxEmitBox)}buildUniformLayout(e){e.addUniform("direction1",3),e.addUniform("direction2",3),e.addUniform("minEmitBox",3),e.addUniform("maxEmitBox",3)}getEffectDefines(){return"#define BOXEMITTER"}getClassName(){return"BoxParticleEmitter"}serialize(){const e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e.minEmitBox=this.minEmitBox.asArray(),e.maxEmitBox=this.maxEmitBox.asArray(),e}parse(e){r.P.FromArrayToRef(e.direction1,0,this.direction1),r.P.FromArrayToRef(e.direction2,0,this.direction2),r.P.FromArrayToRef(e.minEmitBox,0,this.minEmitBox),r.P.FromArrayToRef(e.maxEmitBox,0,this.maxEmitBox)}}},"../../../node_modules/@babylonjs/core/Particles/EmitterTypes/customParticleEmitter.js":function(e,t,i){"use strict";i.d(t,{E:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Misc/deepCopier.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js");class s{constructor(){this.particlePositionGenerator=()=>{},this.particleDestinationGenerator=()=>{}}startDirectionFunction(e,t,i,n){const s=r.jp.Vector3[0];if(this.particleDestinationGenerator){this.particleDestinationGenerator(-1,i,s);const e=r.jp.Vector3[1];s.subtractToRef(i.position,e),e.scaleToRef(1/i.lifeTime,s)}else s.set(0,0,0);n?t.copyFrom(s):r.P.TransformNormalToRef(s,e,t)}startPositionFunction(e,t,i,n){const s=r.jp.Vector3[0];this.particlePositionGenerator?this.particlePositionGenerator(-1,i,s):s.set(0,0,0),n?t.copyFrom(s):r.P.TransformCoordinatesToRef(s,e,t)}clone(){const e=new s;return n.j.DeepCopy(this,e),e}applyToShader(e){}buildUniformLayout(e){}getEffectDefines(){return"#define CUSTOMEMITTER"}getClassName(){return"CustomParticleEmitter"}serialize(){const e={};return e.type=this.getClassName(),e}parse(e){}}},"../../../node_modules/@babylonjs/core/Particles/EmitterTypes/index.js":function(e,t,i){"use strict";i.d(t,{S3:function(){return n.S},LV:function(){return a},z:function(){return c},kT:function(){return l},VD:function(){return h},F3:function(){return f},cl:function(){return _},cE:function(){return u},Ai:function(){return d}});var n=i("../../../node_modules/@babylonjs/core/Particles/EmitterTypes/boxParticleEmitter.js"),r=i("../../../node_modules/@babylonjs/core/Misc/deepCopier.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js");class a{constructor(e=1,t=Math.PI,i=0){this.directionRandomizer=i,this.radiusRange=1,this.heightRange=1,this.emitFromSpawnPointOnly=!1,this.angle=t,this.radius=e}get radius(){return this._radius}set radius(e){this._radius=e,this._buildHeight()}get angle(){return this._angle}set angle(e){this._angle=e,this._buildHeight()}_buildHeight(){0!==this._angle?this._height=this._radius/Math.tan(this._angle/2):this._height=1}startDirectionFunction(e,t,i,n){n?s.jp.Vector3[0].copyFrom(i._localPosition).normalize():i.position.subtractToRef(e.getTranslation(),s.jp.Vector3[0]).normalize();const r=o.R.RandomRange(0,this.directionRandomizer),a=o.R.RandomRange(0,this.directionRandomizer),l=o.R.RandomRange(0,this.directionRandomizer);t.x=s.jp.Vector3[0].x+r,t.y=s.jp.Vector3[0].y+a,t.z=s.jp.Vector3[0].z+l,t.normalize()}startPositionFunction(e,t,i,n){const r=o.R.RandomRange(0,2*Math.PI);let a;this.emitFromSpawnPointOnly?a=1e-4:(a=o.R.RandomRange(0,this.heightRange),a=1-a*a);let l=this._radius-o.R.RandomRange(0,this._radius*this.radiusRange);l*=a;const c=l*Math.sin(r),h=l*Math.cos(r),_=a*this._height;if(n)return t.x=c,t.y=_,void(t.z=h);s.P.TransformCoordinatesFromFloatsToRef(c,_,h,e,t)}clone(){const e=new a(this._radius,this._angle,this.directionRandomizer);return r.j.DeepCopy(this,e),e}applyToShader(e){e.setFloat2("radius",this._radius,this.radiusRange),e.setFloat("coneAngle",this._angle),e.setFloat2("height",this._height,this.heightRange),e.setFloat("directionRandomizer",this.directionRandomizer)}buildUniformLayout(e){e.addUniform("radius",2),e.addUniform("coneAngle",1),e.addUniform("height",2),e.addUniform("directionRandomizer",1)}getEffectDefines(){let e="#define CONEEMITTER";return this.emitFromSpawnPointOnly&&(e+="\n#define CONEEMITTERSPAWNPOINT"),e}getClassName(){return"ConeParticleEmitter"}serialize(){const e={};return e.type=this.getClassName(),e.radius=this._radius,e.angle=this._angle,e.directionRandomizer=this.directionRandomizer,e.radiusRange=this.radiusRange,e.heightRange=this.heightRange,e.emitFromSpawnPointOnly=this.emitFromSpawnPointOnly,e}parse(e){this.radius=e.radius,this.angle=e.angle,this.directionRandomizer=e.directionRandomizer,this.radiusRange=void 0!==e.radiusRange?e.radiusRange:1,this.heightRange=void 0!==e.radiusRange?e.heightRange:1,this.emitFromSpawnPointOnly=void 0!==e.emitFromSpawnPointOnly&&e.emitFromSpawnPointOnly}}class l{constructor(e=1,t=1,i=1,n=0){this.radius=e,this.height=t,this.radiusRange=i,this.directionRandomizer=n,this._tempVector=s.P.Zero()}startDirectionFunction(e,t,i,n,r){i.position.subtractToRef(e.getTranslation(),this._tempVector),this._tempVector.normalize(),s.P.TransformNormalToRef(this._tempVector,r,this._tempVector);const a=o.R.RandomRange(-this.directionRandomizer/2,this.directionRandomizer/2);let l=Math.atan2(this._tempVector.x,this._tempVector.z);l+=o.R.RandomRange(-Math.PI/2,Math.PI/2)*this.directionRandomizer,this._tempVector.y=a,this._tempVector.x=Math.sin(l),this._tempVector.z=Math.cos(l),this._tempVector.normalize(),n?t.copyFrom(this._tempVector):s.P.TransformNormalFromFloatsToRef(this._tempVector.x,this._tempVector.y,this._tempVector.z,e,t)}startPositionFunction(e,t,i,n){const r=o.R.RandomRange(-this.height/2,this.height/2),a=o.R.RandomRange(0,2*Math.PI),l=o.R.RandomRange((1-this.radiusRange)*(1-this.radiusRange),1),c=Math.sqrt(l)*this.radius,h=c*Math.cos(a),_=c*Math.sin(a);n?t.copyFromFloats(h,r,_):s.P.TransformCoordinatesFromFloatsToRef(h,r,_,e,t)}clone(){const e=new l(this.radius,this.directionRandomizer);return r.j.DeepCopy(this,e),e}applyToShader(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)}buildUniformLayout(e){e.addUniform("radius",1),e.addUniform("height",1),e.addUniform("radiusRange",1),e.addUniform("directionRandomizer",1)}getEffectDefines(){return"#define CYLINDEREMITTER"}getClassName(){return"CylinderParticleEmitter"}serialize(){const e={};return e.type=this.getClassName(),e.radius=this.radius,e.height=this.height,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e}parse(e){this.radius=e.radius,this.height=e.height,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer}}class c extends l{constructor(e=1,t=1,i=1,n=new s.P(0,1,0),r=new s.P(0,1,0)){super(e,t,i),this.direction1=n,this.direction2=r}startDirectionFunction(e,t){const i=o.R.RandomRange(this.direction1.x,this.direction2.x),n=o.R.RandomRange(this.direction1.y,this.direction2.y),r=o.R.RandomRange(this.direction1.z,this.direction2.z);s.P.TransformNormalFromFloatsToRef(i,n,r,e,t)}clone(){const e=new c(this.radius,this.height,this.radiusRange,this.direction1,this.direction2);return r.j.DeepCopy(this,e),e}applyToShader(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)}buildUniformLayout(e){e.addUniform("radius",1),e.addUniform("height",1),e.addUniform("radiusRange",1),e.addUniform("direction1",3),e.addUniform("direction2",3)}getEffectDefines(){return"#define CYLINDEREMITTER\n#define DIRECTEDCYLINDEREMITTER"}getClassName(){return"CylinderDirectedParticleEmitter"}serialize(){const e=super.serialize();return e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e}parse(e){super.parse(e),this.direction1.copyFrom(e.direction1),this.direction2.copyFrom(e.direction2)}}class h{constructor(e=1,t=1,i=0){this.radius=e,this.radiusRange=t,this.directionRandomizer=i}startDirectionFunction(e,t,i,n){const r=i.position.subtract(e.getTranslation()).normalize(),a=o.R.RandomRange(0,this.directionRandomizer),l=o.R.RandomRange(0,this.directionRandomizer),c=o.R.RandomRange(0,this.directionRandomizer);r.x+=a,r.y+=l,r.z+=c,r.normalize(),n?t.copyFrom(r):s.P.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)}startPositionFunction(e,t,i,n){const r=this.radius-o.R.RandomRange(0,this.radius*this.radiusRange),a=o.R.RandomRange(0,1),l=o.R.RandomRange(0,2*Math.PI),c=Math.acos(2*a-1),h=r*Math.cos(l)*Math.sin(c),_=r*Math.cos(c),d=r*Math.sin(l)*Math.sin(c);n?t.copyFromFloats(h,Math.abs(_),d):s.P.TransformCoordinatesFromFloatsToRef(h,Math.abs(_),d,e,t)}clone(){const e=new h(this.radius,this.directionRandomizer);return r.j.DeepCopy(this,e),e}applyToShader(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)}buildUniformLayout(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("directionRandomizer",1)}getEffectDefines(){return"#define HEMISPHERICEMITTER"}getClassName(){return"HemisphericParticleEmitter"}serialize(){const e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e}parse(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer}}class _{constructor(){this.direction1=new s.P(0,1,0),this.direction2=new s.P(0,1,0)}startDirectionFunction(e,t,i,n){const r=o.R.RandomRange(this.direction1.x,this.direction2.x),a=o.R.RandomRange(this.direction1.y,this.direction2.y),l=o.R.RandomRange(this.direction1.z,this.direction2.z);n?t.copyFromFloats(r,a,l):s.P.TransformNormalFromFloatsToRef(r,a,l,e,t)}startPositionFunction(e,t,i,n){n?t.copyFromFloats(0,0,0):s.P.TransformCoordinatesFromFloatsToRef(0,0,0,e,t)}clone(){const e=new _;return r.j.DeepCopy(this,e),e}applyToShader(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)}buildUniformLayout(e){e.addUniform("direction1",3),e.addUniform("direction2",3)}getEffectDefines(){return"#define POINTEMITTER"}getClassName(){return"PointParticleEmitter"}serialize(){const e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e}parse(e){s.P.FromArrayToRef(e.direction1,0,this.direction1),s.P.FromArrayToRef(e.direction2,0,this.direction2)}}class d{constructor(e=1,t=1,i=0){this.radius=e,this.radiusRange=t,this.directionRandomizer=i}startDirectionFunction(e,t,i,n){const r=i.position.subtract(e.getTranslation()).normalize(),a=o.R.RandomRange(0,this.directionRandomizer),l=o.R.RandomRange(0,this.directionRandomizer),c=o.R.RandomRange(0,this.directionRandomizer);r.x+=a,r.y+=l,r.z+=c,r.normalize(),n?t.copyFrom(r):s.P.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)}startPositionFunction(e,t,i,n){const r=this.radius-o.R.RandomRange(0,this.radius*this.radiusRange),a=o.R.RandomRange(0,1),l=o.R.RandomRange(0,2*Math.PI),c=Math.acos(2*a-1),h=r*Math.cos(l)*Math.sin(c),_=r*Math.cos(c),d=r*Math.sin(l)*Math.sin(c);n?t.copyFromFloats(h,_,d):s.P.TransformCoordinatesFromFloatsToRef(h,_,d,e,t)}clone(){const e=new d(this.radius,this.directionRandomizer);return r.j.DeepCopy(this,e),e}applyToShader(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)}buildUniformLayout(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("directionRandomizer",1)}getEffectDefines(){return"#define SPHEREEMITTER"}getClassName(){return"SphereParticleEmitter"}serialize(){const e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e}parse(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer}}class u extends d{constructor(e=1,t=new s.P(0,1,0),i=new s.P(0,1,0)){super(e),this.direction1=t,this.direction2=i}startDirectionFunction(e,t){const i=o.R.RandomRange(this.direction1.x,this.direction2.x),n=o.R.RandomRange(this.direction1.y,this.direction2.y),r=o.R.RandomRange(this.direction1.z,this.direction2.z);s.P.TransformNormalFromFloatsToRef(i,n,r,e,t)}clone(){const e=new u(this.radius,this.direction1,this.direction2);return r.j.DeepCopy(this,e),e}applyToShader(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)}buildUniformLayout(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("direction1",3),e.addUniform("direction2",3)}getEffectDefines(){return"#define SPHEREEMITTER\n#define DIRECTEDSPHEREEMITTER"}getClassName(){return"SphereDirectedParticleEmitter"}serialize(){const e=super.serialize();return e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e}parse(e){super.parse(e),this.direction1.copyFrom(e.direction1),this.direction2.copyFrom(e.direction2)}}i("../../../node_modules/@babylonjs/core/Particles/EmitterTypes/customParticleEmitter.js");var p=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js");class f{constructor(e=null){this._indices=null,this._positions=null,this._normals=null,this._storedNormal=s.P.Zero(),this._mesh=null,this.direction1=new s.P(0,1,0),this.direction2=new s.P(0,1,0),this.useMeshNormalsForDirection=!0,this.mesh=e}get mesh(){return this._mesh}set mesh(e){this._mesh!==e&&(this._mesh=e,e?(this._indices=e.getIndices(),this._positions=e.getVerticesData(p.o.PositionKind),this._normals=e.getVerticesData(p.o.NormalKind)):(this._indices=null,this._positions=null,this._normals=null))}startDirectionFunction(e,t,i,n){if(this.useMeshNormalsForDirection&&this._normals)return void s.P.TransformNormalToRef(this._storedNormal,e,t);const r=o.R.RandomRange(this.direction1.x,this.direction2.x),a=o.R.RandomRange(this.direction1.y,this.direction2.y),l=o.R.RandomRange(this.direction1.z,this.direction2.z);n?t.copyFromFloats(r,a,l):s.P.TransformNormalFromFloatsToRef(r,a,l,e,t)}startPositionFunction(e,t,i,n){if(!this._indices||!this._positions)return;const r=3*Math.random()*(this._indices.length/3)|0,o=Math.random(),a=Math.random()*(1-o),l=1-o-a,c=this._indices[r],h=this._indices[r+1],_=this._indices[r+2],d=s.jp.Vector3[0],u=s.jp.Vector3[1],p=s.jp.Vector3[2],f=s.jp.Vector3[3];s.P.FromArrayToRef(this._positions,3*c,d),s.P.FromArrayToRef(this._positions,3*h,u),s.P.FromArrayToRef(this._positions,3*_,p),f.x=o*d.x+a*u.x+l*p.x,f.y=o*d.y+a*u.y+l*p.y,f.z=o*d.z+a*u.z+l*p.z,n?t.copyFromFloats(f.x,f.y,f.z):s.P.TransformCoordinatesFromFloatsToRef(f.x,f.y,f.z,e,t),this.useMeshNormalsForDirection&&this._normals&&(s.P.FromArrayToRef(this._normals,3*c,d),s.P.FromArrayToRef(this._normals,3*h,u),s.P.FromArrayToRef(this._normals,3*_,p),this._storedNormal.x=o*d.x+a*u.x+l*p.x,this._storedNormal.y=o*d.y+a*u.y+l*p.y,this._storedNormal.z=o*d.z+a*u.z+l*p.z)}clone(){const e=new f(this.mesh);return r.j.DeepCopy(this,e),e}applyToShader(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)}buildUniformLayout(e){e.addUniform("direction1",3),e.addUniform("direction2",3)}getEffectDefines(){return""}getClassName(){return"MeshParticleEmitter"}serialize(){var e;const t={};return t.type=this.getClassName(),t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t.meshId=null===(e=this.mesh)||void 0===e?void 0:e.id,t.useMeshNormalsForDirection=this.useMeshNormalsForDirection,t}parse(e,t){s.P.FromArrayToRef(e.direction1,0,this.direction1),s.P.FromArrayToRef(e.direction2,0,this.direction2),e.meshId&&t&&(this.mesh=t.getLastMeshById(e.meshId)),this.useMeshNormalsForDirection=e.useMeshNormalsForDirection}}},"../../../node_modules/@babylonjs/core/Particles/baseParticleSystem.js":function(e,t,i){"use strict";i.d(t,{U:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Materials/imageProcessingConfiguration.js"),s=i("../../../node_modules/@babylonjs/core/Particles/EmitterTypes/index.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.color.js");i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicBuffer.js");class a{constructor(e){this.animations=[],this.renderingGroupId=0,this.emitter=n.P.Zero(),this.emitRate=10,this.manualEmitCount=-1,this.updateSpeed=.01,this.targetStopDuration=0,this.disposeOnStop=!1,this.minEmitPower=1,this.maxEmitPower=1,this.minLifeTime=1,this.maxLifeTime=1,this.minSize=1,this.maxSize=1,this.minScaleX=1,this.maxScaleX=1,this.minScaleY=1,this.maxScaleY=1,this.minInitialRotation=0,this.maxInitialRotation=0,this.minAngularSpeed=0,this.maxAngularSpeed=0,this.layerMask=268435455,this.customShader=null,this.preventAutoStart=!1,this._wasDispatched=!1,this._rootUrl="",this.noiseStrength=new n.P(10,10,10),this.onAnimationEnd=null,this.blendMode=a.BLENDMODE_ONEONE,this.forceDepthWrite=!1,this.preWarmCycles=0,this.preWarmStepOffset=1,this.spriteCellChangeSpeed=1,this.startSpriteCellID=0,this.endSpriteCellID=0,this.spriteCellWidth=0,this.spriteCellHeight=0,this.spriteCellLoop=!0,this.spriteRandomStartCell=!1,this.translationPivot=new n.FM(0,0),this.beginAnimationOnStart=!1,this.beginAnimationFrom=0,this.beginAnimationTo=60,this.beginAnimationLoop=!1,this.worldOffset=new n.P(0,0,0),this._useLogarithmicDepth=!1,this.gravity=n.P.Zero(),this._colorGradients=null,this._sizeGradients=null,this._lifeTimeGradients=null,this._angularSpeedGradients=null,this._velocityGradients=null,this._limitVelocityGradients=null,this._dragGradients=null,this._emitRateGradients=null,this._startSizeGradients=null,this._rampGradients=null,this._colorRemapGradients=null,this._alphaRemapGradients=null,this.startDelay=0,this.limitVelocityDamping=.4,this.color1=new o.HE(1,1,1,1),this.color2=new o.HE(1,1,1,1),this.colorDead=new o.HE(0,0,0,1),this.textureMask=new o.HE(1,1,1,1),this._isSubEmitter=!1,this._billboardMode=7,this._isBillboardBased=!0,this._imageProcessingConfigurationDefines=new r.b,this.id=e,this.name=e}get noiseTexture(){return this._noiseTexture}set noiseTexture(e){this._noiseTexture!==e&&(this._noiseTexture=e,this._reset())}get isAnimationSheetEnabled(){return this._isAnimationSheetEnabled}set isAnimationSheetEnabled(e){this._isAnimationSheetEnabled!=e&&(this._isAnimationSheetEnabled=e,this._reset())}get useLogarithmicDepth(){return this._useLogarithmicDepth}set useLogarithmicDepth(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported}getScene(){return this._scene}_hasTargetStopDurationDependantGradient(){return this._startSizeGradients&&this._startSizeGradients.length>0||this._emitRateGradients&&this._emitRateGradients.length>0||this._lifeTimeGradients&&this._lifeTimeGradients.length>0}getDragGradients(){return this._dragGradients}getLimitVelocityGradients(){return this._limitVelocityGradients}getColorGradients(){return this._colorGradients}getSizeGradients(){return this._sizeGradients}getColorRemapGradients(){return this._colorRemapGradients}getAlphaRemapGradients(){return this._alphaRemapGradients}getLifeTimeGradients(){return this._lifeTimeGradients}getAngularSpeedGradients(){return this._angularSpeedGradients}getVelocityGradients(){return this._velocityGradients}getStartSizeGradients(){return this._startSizeGradients}getEmitRateGradients(){return this._emitRateGradients}get direction1(){return this.particleEmitterType.direction1?this.particleEmitterType.direction1:n.P.Zero()}set direction1(e){this.particleEmitterType.direction1&&(this.particleEmitterType.direction1=e)}get direction2(){return this.particleEmitterType.direction2?this.particleEmitterType.direction2:n.P.Zero()}set direction2(e){this.particleEmitterType.direction2&&(this.particleEmitterType.direction2=e)}get minEmitBox(){return this.particleEmitterType.minEmitBox?this.particleEmitterType.minEmitBox:n.P.Zero()}set minEmitBox(e){this.particleEmitterType.minEmitBox&&(this.particleEmitterType.minEmitBox=e)}get maxEmitBox(){return this.particleEmitterType.maxEmitBox?this.particleEmitterType.maxEmitBox:n.P.Zero()}set maxEmitBox(e){this.particleEmitterType.maxEmitBox&&(this.particleEmitterType.maxEmitBox=e)}get billboardMode(){return this._billboardMode}set billboardMode(e){this._billboardMode!==e&&(this._billboardMode=e,this._reset())}get isBillboardBased(){return this._isBillboardBased}set isBillboardBased(e){this._isBillboardBased!==e&&(this._isBillboardBased=e,this._reset())}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}set imageProcessingConfiguration(e){this._attachImageProcessingConfiguration(e)}_attachImageProcessingConfiguration(e){e!==this._imageProcessingConfiguration&&(!e&&this._scene?this._imageProcessingConfiguration=this._scene.imageProcessingConfiguration:this._imageProcessingConfiguration=e)}_reset(){}_removeGradientAndTexture(e,t,i){if(!t)return this;let n=0;for(const i of t){if(i.gradient===e){t.splice(n,1);break}n++}return i&&i.dispose(),this}createPointEmitter(e,t){const i=new s.cl;return i.direction1=e,i.direction2=t,this.particleEmitterType=i,i}createHemisphericEmitter(e=1,t=1){const i=new s.VD(e,t);return this.particleEmitterType=i,i}createSphereEmitter(e=1,t=1){const i=new s.Ai(e,t);return this.particleEmitterType=i,i}createDirectedSphereEmitter(e=1,t=new n.P(0,1,0),i=new n.P(0,1,0)){const r=new s.cE(e,t,i);return this.particleEmitterType=r,r}createCylinderEmitter(e=1,t=1,i=1,n=0){const r=new s.kT(e,t,i,n);return this.particleEmitterType=r,r}createDirectedCylinderEmitter(e=1,t=1,i=1,r=new n.P(0,1,0),o=new n.P(0,1,0)){const a=new s.z(e,t,i,r,o);return this.particleEmitterType=a,a}createConeEmitter(e=1,t=Math.PI/4){const i=new s.LV(e,t);return this.particleEmitterType=i,i}createBoxEmitter(e,t,i,n){const r=new s.S3;return this.particleEmitterType=r,this.direction1=e,this.direction2=t,this.minEmitBox=i,this.maxEmitBox=n,r}}a.BLENDMODE_ONEONE=0,a.BLENDMODE_STANDARD=1,a.BLENDMODE_ADD=2,a.BLENDMODE_MULTIPLY=3,a.BLENDMODE_MULTIPLYADD=4},"../../../node_modules/@babylonjs/core/Physics/physicsImpostor.js":function(e,t,i){"use strict";i.d(t,{Q:function(){return h}});var n=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),r=i("../../../node_modules/@babylonjs/core/Misc/arrayTools.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Meshes/abstractMesh.js"),a=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),l=i("../../../node_modules/@babylonjs/core/Physics/physicsJoint.js"),c=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js");a.Kj._PhysicsImpostorParser=function(e,t,i){return new h(t,i.physicsImpostor,{mass:i.physicsMass,friction:i.physicsFriction,restitution:i.physicsRestitution},e)};class h{constructor(e,t,i={mass:0},r){this.object=e,this.type=t,this._options=i,this._scene=r,this._pluginData={},this._bodyUpdateRequired=!1,this._onBeforePhysicsStepCallbacks=new Array,this._onAfterPhysicsStepCallbacks=new Array,this._onPhysicsCollideCallbacks=[],this._deltaPosition=s.P.Zero(),this._isDisposed=!1,this.soft=!1,this.segments=0,this._tmpQuat=new s._f,this._tmpQuat2=new s._f,this.beforeStep=()=>{this._physicsEngine&&(this.object.translate(this._deltaPosition,-1),this._deltaRotationConjugated&&this.object.rotationQuaternion&&this.object.rotationQuaternion.multiplyToRef(this._deltaRotationConjugated,this.object.rotationQuaternion),this.object.computeWorldMatrix(!1),this.object.parent&&this.object.rotationQuaternion?(this.getParentsRotation(),this._tmpQuat.multiplyToRef(this.object.rotationQuaternion,this._tmpQuat)):this._tmpQuat.copyFrom(this.object.rotationQuaternion||new s._f),this._options.disableBidirectionalTransformation||this.object.rotationQuaternion&&this._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(this,this.object.getAbsolutePosition(),this._tmpQuat),this._onBeforePhysicsStepCallbacks.forEach((e=>{e(this)})))},this.afterStep=()=>{this._physicsEngine&&(this._onAfterPhysicsStepCallbacks.forEach((e=>{e(this)})),this._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(this),this.object.parent&&this.object.rotationQuaternion&&(this.getParentsRotation(),this._tmpQuat.conjugateInPlace(),this._tmpQuat.multiplyToRef(this.object.rotationQuaternion,this.object.rotationQuaternion)),this.object.setAbsolutePosition(this.object.position),this._deltaRotation?(this.object.rotationQuaternion&&this.object.rotationQuaternion.multiplyToRef(this._deltaRotation,this.object.rotationQuaternion),this._deltaPosition.applyRotationQuaternionToRef(this._deltaRotation,h._TmpVecs[0]),this.object.translate(h._TmpVecs[0],1)):this.object.translate(this._deltaPosition,1),this.object.computeWorldMatrix(!0))},this.onCollideEvent=null,this.onCollide=e=>{if(!this._onPhysicsCollideCallbacks.length&&!this.onCollideEvent)return;if(!this._physicsEngine)return;const t=this._physicsEngine.getImpostorWithPhysicsBody(e.body);t&&(this.onCollideEvent&&this.onCollideEvent(this,t),this._onPhysicsCollideCallbacks.filter((e=>-1!==e.otherImpostors.indexOf(t))).forEach((i=>{i.callback(this,t,e.point,e.distance,e.impulse,e.normal)})))},this.object?(this.object.parent&&0!==i.mass&&n.Y.Warn("A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur."),!this._scene&&e.getScene&&(this._scene=e.getScene()),this._scene&&(this.type>100&&(this.soft=!0),this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine?(this.object.rotationQuaternion||(this.object.rotation?this.object.rotationQuaternion=s._f.RotationYawPitchRoll(this.object.rotation.y,this.object.rotation.x,this.object.rotation.z):this.object.rotationQuaternion=new s._f),this._options.mass=void 0===i.mass?0:i.mass,this._options.friction=void 0===i.friction?.2:i.friction,this._options.restitution=void 0===i.restitution?.2:i.restitution,this.soft&&(this._options.mass=this._options.mass>0?this._options.mass:1,this._options.pressure=void 0===i.pressure?200:i.pressure,this._options.stiffness=void 0===i.stiffness?1:i.stiffness,this._options.velocityIterations=void 0===i.velocityIterations?20:i.velocityIterations,this._options.positionIterations=void 0===i.positionIterations?20:i.positionIterations,this._options.fixedPoints=void 0===i.fixedPoints?0:i.fixedPoints,this._options.margin=void 0===i.margin?0:i.margin,this._options.damping=void 0===i.damping?0:i.damping,this._options.path=void 0===i.path?null:i.path,this._options.shape=void 0===i.shape?null:i.shape),this._joints=[],!this.object.parent||this._options.ignoreParent?this._init():this.object.parent.physicsImpostor&&n.Y.Warn("You must affect impostors to children before affecting impostor to parent.")):n.Y.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."))):n.Y.Error("No object was provided. A physics object is obligatory")}get isDisposed(){return this._isDisposed}get mass(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyMass(this):0}set mass(e){this.setMass(e)}get friction(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyFriction(this):0}set friction(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyFriction(this,e)}get restitution(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this):0}set restitution(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this,e)}get pressure(){if(!this._physicsEngine)return 0;const e=this._physicsEngine.getPhysicsPlugin();return e.setBodyPressure?e.getBodyPressure(this):0}set pressure(e){if(!this._physicsEngine)return;const t=this._physicsEngine.getPhysicsPlugin();t.setBodyPressure&&t.setBodyPressure(this,e)}get stiffness(){if(!this._physicsEngine)return 0;const e=this._physicsEngine.getPhysicsPlugin();return e.getBodyStiffness?e.getBodyStiffness(this):0}set stiffness(e){if(!this._physicsEngine)return;const t=this._physicsEngine.getPhysicsPlugin();t.setBodyStiffness&&t.setBodyStiffness(this,e)}get velocityIterations(){if(!this._physicsEngine)return 0;const e=this._physicsEngine.getPhysicsPlugin();return e.getBodyVelocityIterations?e.getBodyVelocityIterations(this):0}set velocityIterations(e){if(!this._physicsEngine)return;const t=this._physicsEngine.getPhysicsPlugin();t.setBodyVelocityIterations&&t.setBodyVelocityIterations(this,e)}get positionIterations(){if(!this._physicsEngine)return 0;const e=this._physicsEngine.getPhysicsPlugin();return e.getBodyPositionIterations?e.getBodyPositionIterations(this):0}set positionIterations(e){if(!this._physicsEngine)return;const t=this._physicsEngine.getPhysicsPlugin();t.setBodyPositionIterations&&t.setBodyPositionIterations(this,e)}_init(){this._physicsEngine&&(this._physicsEngine.removeImpostor(this),this.physicsBody=null,this._parent=this._parent||this._getPhysicsParent(),this._isDisposed||this.parent&&!this._options.ignoreParent||this._physicsEngine.addImpostor(this))}_getPhysicsParent(){return this.object.parent instanceof o.x?this.object.parent.physicsImpostor:null}isBodyInitRequired(){return this._bodyUpdateRequired||!this._physicsBody&&(!this._parent||!!this._options.ignoreParent)}setScalingUpdated(){this.forceUpdate()}forceUpdate(){this._init(),this.parent&&!this._options.ignoreParent&&this.parent.forceUpdate()}get physicsBody(){return this._parent&&!this._options.ignoreParent?this._parent.physicsBody:this._physicsBody}get parent(){return!this._options.ignoreParent&&this._parent?this._parent:null}set parent(e){this._parent=e}set physicsBody(e){this._physicsBody&&this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this),this._physicsBody=e,this.resetUpdateFlags()}resetUpdateFlags(){this._bodyUpdateRequired=!1}getObjectExtents(){if(this.object.getBoundingInfo){const e=this.object.rotationQuaternion,t=this.object.scaling.clone();this.object.rotationQuaternion=h.IDENTITY_QUATERNION;const i=this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0);i&&i.decompose(t,void 0,void 0);const n=this.object.getBoundingInfo().boundingBox.extendSize.scale(2).multiplyInPlace(t);return n.x=Math.abs(n.x),n.y=Math.abs(n.y),n.z=Math.abs(n.z),this.object.rotationQuaternion=e,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0),n}return h.DEFAULT_OBJECT_SIZE}getObjectCenter(){return this.object.getBoundingInfo?this.object.getBoundingInfo().boundingBox.centerWorld:this.object.position}getParam(e){return this._options[e]}setParam(e,t){this._options[e]=t,this._bodyUpdateRequired=!0}setMass(e){this.getParam("mass")!==e&&this.setParam("mass",e),this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyMass(this,e)}getLinearVelocity(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this):s.P.Zero()}setLinearVelocity(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this,e)}getAngularVelocity(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this):s.P.Zero()}setAngularVelocity(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this,e)}executeNativeFunction(e){this._physicsEngine&&e(this._physicsEngine.getPhysicsPlugin().world,this.physicsBody)}registerBeforePhysicsStep(e){this._onBeforePhysicsStepCallbacks.push(e)}unregisterBeforePhysicsStep(e){const t=this._onBeforePhysicsStepCallbacks.indexOf(e);t>-1?this._onBeforePhysicsStepCallbacks.splice(t,1):n.Y.Warn("Function to remove was not found")}registerAfterPhysicsStep(e){this._onAfterPhysicsStepCallbacks.push(e)}unregisterAfterPhysicsStep(e){const t=this._onAfterPhysicsStepCallbacks.indexOf(e);t>-1?this._onAfterPhysicsStepCallbacks.splice(t,1):n.Y.Warn("Function to remove was not found")}registerOnPhysicsCollide(e,t){const i=e instanceof Array?e:[e];this._onPhysicsCollideCallbacks.push({callback:t,otherImpostors:i})}unregisterOnPhysicsCollide(e,t){const i=e instanceof Array?e:[e];let r=-1;this._onPhysicsCollideCallbacks.some(((e,n)=>{if(e.callback===t&&e.otherImpostors.length===i.length){const t=e.otherImpostors.every((e=>i.indexOf(e)>-1));return t&&(r=n),t}return!1}))?this._onPhysicsCollideCallbacks.splice(r,1):n.Y.Warn("Function to remove was not found")}getParentsRotation(){let e=this.object.parent;for(this._tmpQuat.copyFromFloats(0,0,0,1);e;)e.rotationQuaternion?this._tmpQuat2.copyFrom(e.rotationQuaternion):s._f.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,e.rotation.z,this._tmpQuat2),this._tmpQuat.multiplyToRef(this._tmpQuat2,this._tmpQuat),e=e.parent;return this._tmpQuat}applyForce(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyForce(this,e,t),this}applyImpulse(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyImpulse(this,e,t),this}createJoint(e,t,i){const n=new l.q7(t,i);return this.addJoint(e,n),this}addJoint(e,t){return this._joints.push({otherImpostor:e,joint:t}),this._physicsEngine&&this._physicsEngine.addJoint(this,e,t),this}addAnchor(e,t,i,n,r){if(!this._physicsEngine)return this;const s=this._physicsEngine.getPhysicsPlugin();return s.appendAnchor?(this._physicsEngine&&s.appendAnchor(this,e,t,i,n,r),this):this}addHook(e,t,i,n){if(!this._physicsEngine)return this;const r=this._physicsEngine.getPhysicsPlugin();return r.appendAnchor?(this._physicsEngine&&r.appendHook(this,e,t,i,n),this):this}sleep(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().sleepBody(this),this}wakeUp(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().wakeUpBody(this),this}clone(e){return e?new h(e,this.type,this._options,this._scene):null}dispose(){this._physicsEngine&&(this._joints.forEach((e=>{this._physicsEngine&&this._physicsEngine.removeJoint(this,e.otherImpostor,e.joint)})),this._physicsEngine.removeImpostor(this),this.parent&&this.parent.forceUpdate(),this._isDisposed=!0)}setDeltaPosition(e){this._deltaPosition.copyFrom(e)}setDeltaRotation(e){this._deltaRotation||(this._deltaRotation=new s._f),this._deltaRotation.copyFrom(e),this._deltaRotationConjugated=this._deltaRotation.conjugate()}getBoxSizeToRef(e){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this,e),this}getRadius(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getRadius(this):0}syncBoneWithImpostor(e,t,i,n,r){const s=h._TmpVecs[0],o=this.object;if(o.rotationQuaternion)if(r){const i=h._TmpQuat;o.rotationQuaternion.multiplyToRef(r,i),e.setRotationQuaternion(i,c.T.WORLD,t)}else e.setRotationQuaternion(o.rotationQuaternion,c.T.WORLD,t);s.x=0,s.y=0,s.z=0,i&&(s.x=i.x,s.y=i.y,s.z=i.z,e.getDirectionToRef(s,t,s),null==n&&(n=i.length()),s.x*=n,s.y*=n,s.z*=n),e.getParent()?(s.addInPlace(o.getAbsolutePosition()),e.setAbsolutePosition(s,t)):(t.setAbsolutePosition(o.getAbsolutePosition()),t.position.x-=s.x,t.position.y-=s.y,t.position.z-=s.z)}syncImpostorWithBone(e,t,i,n,r,s){const o=this.object;if(o.rotationQuaternion)if(r){const i=h._TmpQuat;e.getRotationQuaternionToRef(c.T.WORLD,t,i),i.multiplyToRef(r,o.rotationQuaternion)}else e.getRotationQuaternionToRef(c.T.WORLD,t,o.rotationQuaternion);const a=h._TmpVecs[0],l=h._TmpVecs[1];s||((s=h._TmpVecs[2]).x=0,s.y=1,s.z=0),e.getDirectionToRef(s,t,l),e.getAbsolutePositionToRef(t,a),null==n&&i&&(n=i.length()),null!=n&&(a.x+=l.x*n,a.y+=l.y*n,a.z+=l.z*n),o.setAbsolutePosition(a)}}h.DEFAULT_OBJECT_SIZE=new s.P(1,1,1),h.IDENTITY_QUATERNION=s._f.Identity(),h._TmpVecs=r.B.BuildArray(3,s.P.Zero),h._TmpQuat=s._f.Identity(),h.NoImpostor=0,h.SphereImpostor=1,h.BoxImpostor=2,h.PlaneImpostor=3,h.MeshImpostor=4,h.CapsuleImpostor=6,h.CylinderImpostor=7,h.ParticleImpostor=8,h.HeightmapImpostor=9,h.ConvexHullImpostor=10,h.CustomImpostor=100,h.RopeImpostor=101,h.ClothImpostor=102,h.SoftbodyImpostor=103},"../../../node_modules/@babylonjs/core/Physics/physicsJoint.js":function(e,t,i){"use strict";i.d(t,{q7:function(){return n}});class n{constructor(e,t){this.type=e,this.jointData=t,t.nativeParams=t.nativeParams||{}}get physicsJoint(){return this._physicsJoint}set physicsJoint(e){this._physicsJoint,this._physicsJoint=e}set physicsPlugin(e){this._physicsPlugin=e}executeNativeFunction(e){e(this._physicsPlugin.world,this._physicsJoint)}}n.DistanceJoint=0,n.HingeJoint=1,n.BallAndSocketJoint=2,n.WheelJoint=3,n.SliderJoint=4,n.PrismaticJoint=5,n.UniversalJoint=6,n.Hinge2Joint=n.WheelJoint,n.PointToPointJoint=8,n.SpringJoint=9,n.LockJoint=10},"../../../node_modules/@babylonjs/core/PostProcesses/passPostProcess.js":function(e,t,i){"use strict";i.d(t,{Q:function(){return l}});var n=i("../../../node_modules/@babylonjs/core/PostProcesses/postProcess.js"),r=i("../../../node_modules/@babylonjs/core/Engines/engine.js"),s=i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js");s.v.ShadersStore.passPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}";s.v.ShadersStore.passCubePixelShader="varying vec2 vUV;\nuniform samplerCube textureSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec2 uv=vUV*2.0-1.0;\n#ifdef POSITIVEX\ngl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x));\n#endif\n#ifdef NEGATIVEX\ngl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x));\n#endif\n#ifdef POSITIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x));\n#endif\n#ifdef NEGATIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x));\n#endif\n#ifdef POSITIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,1.001));\n#endif\n#ifdef NEGATIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,-1.001));\n#endif\n}";var o=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),a=i("../../../node_modules/@babylonjs/core/Misc/decorators.js");class l extends n.D{getClassName(){return"PassPostProcess"}constructor(e,t,i=null,n,r,s,o=0,a=!1){super(e,"pass",null,null,t,i,n,r,s,void 0,o,void 0,null,a)}static _Parse(e,t,i,n){return a.p4.Parse((()=>new l(e.name,e.options,t,e.renderTargetSamplingMode,e._engine,e.reusable)),e,i,n)}}(0,o.H)("BABYLON.PassPostProcess",l),r.D._RescalePostProcessFactory=e=>new l("rescale",1,null,2,e,!1,0)},"../../../node_modules/@babylonjs/core/PostProcesses/postProcess.js":function(e,t,i){"use strict";i.d(t,{D:function(){return _}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/smartArray.js"),s=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),a=(i("../../../node_modules/@babylonjs/core/Shaders/postprocess.vertex.js"),i("../../../node_modules/@babylonjs/core/Engines/engine.js")),l=(i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.js"),i("../../../node_modules/@babylonjs/core/Misc/decorators.js")),c=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),h=i("../../../node_modules/@babylonjs/core/Materials/drawWrapper.js");class _{constructor(e,t,i,n,a,l,c=1,_,d,u=null,p=0,f="postprocess",m,g=!1,b=5){this._parentContainer=null,this.width=-1,this.height=-1,this.nodeMaterialSource=null,this._outputTexture=null,this.autoClear=!0,this.alphaMode=0,this.animations=new Array,this.enablePixelPerfectMode=!1,this.forceFullscreenViewport=!0,this.scaleMode=1,this.alwaysForcePOT=!1,this._samples=1,this.adaptScaleToCurrentViewport=!1,this._reusable=!1,this._renderId=0,this.externalTextureSamplerBinding=!1,this._textures=new r.t(2),this._textureCache=[],this._currentRenderTextureInd=0,this._scaleRatio=new o.FM(1,1),this._texelSize=o.FM.Zero(),this.onActivateObservable=new s.y$,this.onSizeChangedObservable=new s.y$,this.onApplyObservable=new s.y$,this.onBeforeRenderObservable=new s.y$,this.onAfterRenderObservable=new s.y$,this.name=e,null!=l?(this._camera=l,this._scene=l.getScene(),l.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.postProcesses.push(this),this.uniqueId=this._scene.getUniqueId()):_&&(this._engine=_,this._engine.postProcesses.push(this)),this._options=a,this.renderTargetSamplingMode=c||1,this._reusable=d||!1,this._textureType=p,this._textureFormat=b,this._samplers=n||[],this._samplers.push("textureSampler"),this._fragmentUrl=t,this._vertexUrl=f,this._parameters=i||[],this._parameters.push("scale"),this._indexParameters=m,this._drawWrapper=new h.q(this._engine),g||this.updateEffect(u)}get samples(){return this._samples}set samples(e){this._samples=Math.min(e,this._engine.getCaps().maxMSAASamples),this._textures.forEach((e=>{e.samples!==this._samples&&this._engine.updateRenderTargetTextureSampleCount(e,this._samples)}))}getEffectName(){return this._fragmentUrl}set onActivate(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))}set onSizeChanged(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)}set onApply(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)}set onBeforeRender(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)}set onAfterRender(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)}get inputTexture(){return this._textures.data[this._currentRenderTextureInd]}set inputTexture(e){this._forcedOutputTexture=e}restoreDefaultInputTexture(){this._forcedOutputTexture&&(this._forcedOutputTexture=null,this.markTextureDirty())}getCamera(){return this._camera}get texelSize(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)}getClassName(){return"PostProcess"}getEngine(){return this._engine}getEffect(){return this._drawWrapper.effect}shareOutputWith(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this}useOwnOutput(){0==this._textures.length&&(this._textures=new r.t(2)),this._shareOutputWithPostProcess=null}updateEffect(e=null,t=null,i=null,n,r,s,o,a){this._postProcessDefines=e,this._drawWrapper.effect=this._engine.createEffect({vertex:null!=o?o:this._vertexUrl,fragment:null!=a?a:this._fragmentUrl},["position"],t||this._parameters,i||this._samplers,null!==e?e:"",void 0,r,s,n||this._indexParameters)}isReusable(){return this._reusable}markTextureDirty(){this.width=-1}_createRenderTargetTexture(e,t,i=0){for(let n=0;n=0;t--)if(e-this._textureCache[t].lastUsedRenderId>100){let e=!1;for(let i=0;i0&&this._textures.reset(),this.width=e,this.height=t;let s=null;for(let e=0;e{e.samples!==this.samples&&this._engine.updateRenderTargetTextureSampleCount(e,this.samples)})),this._flushTextureCache(),this._renderId++}let f;if(this._shareOutputWithPostProcess)f=this._shareOutputWithPostProcess.inputTexture;else if(this._forcedOutputTexture)f=this._forcedOutputTexture,this.width=this._forcedOutputTexture.width,this.height=this._forcedOutputTexture.height;else{let e;f=this.inputTexture;for(let t=0;t=0;e--)this._textureCache[e].texture.dispose();this._textureCache.length=0}setPrePassRenderer(e){return!!this._prePassEffectConfiguration&&(this._prePassEffectConfiguration=e.addEffectConfiguration(this._prePassEffectConfiguration),this._prePassEffectConfiguration.enabled=!0,!0)}dispose(e){let t;if(e=e||this._camera,this._disposeTextures(),this._scene&&(t=this._scene.postProcesses.indexOf(this),-1!==t&&this._scene.postProcesses.splice(t,1)),this._parentContainer){const e=this._parentContainer.postProcesses.indexOf(this);e>-1&&this._parentContainer.postProcesses.splice(e,1),this._parentContainer=null}if(t=this._engine.postProcesses.indexOf(this),-1!==t&&this._engine.postProcesses.splice(t,1),e){if(e.detachPostProcess(this),t=e._postProcesses.indexOf(this),0===t&&e._postProcesses.length>0){const e=this._camera._getFirstPostProcess();e&&e.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear()}}serialize(){const e=l.p4.Serialize(this),t=this.getCamera()||this._scene&&this._scene.activeCamera;return e.customType="BABYLON."+this.getClassName(),e.cameraId=t?t.id:null,e.reusable=this._reusable,e.textureType=this._textureType,e.fragmentUrl=this._fragmentUrl,e.parameters=this._parameters,e.samplers=this._samplers,e.options=this._options,e.defines=this._postProcessDefines,e.textureFormat=this._textureFormat,e.vertexUrl=this._vertexUrl,e.indexParameters=this._indexParameters,e}clone(){const e=this.serialize();e._engine=this._engine,e.cameraId=null;const t=_.Parse(e,this._scene,"");return t?(t.onActivateObservable=this.onActivateObservable.clone(),t.onSizeChangedObservable=this.onSizeChangedObservable.clone(),t.onApplyObservable=this.onApplyObservable.clone(),t.onBeforeRenderObservable=this.onBeforeRenderObservable.clone(),t.onAfterRenderObservable=this.onAfterRenderObservable.clone(),t._prePassEffectConfiguration=this._prePassEffectConfiguration,t):null}static Parse(e,t,i){const n=(0,c.q)(e.customType);if(!n||!n._Parse)return null;const r=t?t.getCameraById(e.cameraId):null;return n._Parse(e,r,t,i)}static _Parse(e,t,i,n){return l.p4.Parse((()=>new _(e.name,e.fragmentUrl,e.parameters,e.samplers,e.options,t,e.renderTargetSamplingMode,e._engine,e.reusable,e.defines,e.textureType,e.vertexUrl,e.indexParameters,!1,e.textureFormat)),e,i,n)}}(0,n.gn)([(0,l.qC)()],_.prototype,"uniqueId",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"name",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"width",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"height",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"renderTargetSamplingMode",void 0),(0,n.gn)([(0,l.XX)()],_.prototype,"clearColor",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"autoClear",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"alphaMode",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"alphaConstants",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"enablePixelPerfectMode",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"forceFullscreenViewport",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"scaleMode",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"alwaysForcePOT",void 0),(0,n.gn)([(0,l.qC)("samples")],_.prototype,"_samples",void 0),(0,n.gn)([(0,l.qC)()],_.prototype,"adaptScaleToCurrentViewport",void 0),(0,c.H)("BABYLON.PostProcess",_)},"../../../node_modules/@babylonjs/core/PostProcesses/postProcessManager.js":function(e,t,i){"use strict";i.d(t,{O:function(){return r}});var n=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js");class r{constructor(e){this._vertexBuffers={},this._scene=e}_prepareBuffers(){if(this._vertexBuffers[n.o.PositionKind])return;const e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[n.o.PositionKind]=new n.o(this._scene.getEngine(),e,n.o.PositionKind,!1,!1,2),this._buildIndexBuffer()}_buildIndexBuffer(){const e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)}_rebuild(){const e=this._vertexBuffers[n.o.PositionKind];e&&(e._rebuild(),this._buildIndexBuffer())}_prepareFrame(e=null,t=null){const i=this._scene.activeCamera;return!(!i||!(t=t||i._postProcesses.filter((e=>null!=e)))||0===t.length||!this._scene.postProcessesEnabled||(t[0].activate(i,e,null!=t),0))}directRender(e,t=null,i=!1,n=0,r=0,s=!1){var o;const a=this._scene.getEngine();for(let l=0;lnull!=e))).length||!this._scene.postProcessesEnabled)return;const a=this._scene.getEngine();for(let l=0,c=n.length;lt._alphaIndex?1:e._alphaIndext._distanceToCamera?-1:0}static frontToBackSortCompare(e,t){return e._distanceToCamerat._distanceToCamera?1:0}static PainterSortCompare(e,t){const i=e.getMesh(),n=t.getMesh();return i.material&&n.material?i.material.uniqueId-n.material.uniqueId:i.uniqueId-n.uniqueId}prepare(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this._spriteManagers.reset(),this._edgesRenderers.reset(),this._empty=!0}dispose(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()}dispatch(e,t,i){void 0===t&&(t=e.getMesh()),void 0===i&&(i=e.getMaterial()),null!=i&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTesting()?(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.pushNoDuplicate(t._edgesRenderer),this._empty=!1)}dispatchSprites(e){this._spriteManagers.push(e),this._empty=!1}dispatchParticles(e){this._particleSystems.push(e),this._empty=!1}_renderParticles(e){if(0===this._particleSystems.length)return;const t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(let i=0;i{if(!this.utilityLayerScene.activeCamera)return;if(!this.pickingEnabled)return;if(!this.processAllEvents&&t.type!==s.kD.POINTERMOVE&&t.type!==s.kD.POINTERUP&&t.type!==s.kD.POINTERDOWN&&t.type!==s.kD.POINTERDOUBLETAP)return;this.utilityLayerScene.pointerX=e.pointerX,this.utilityLayerScene.pointerY=e.pointerY;const i=t.event;if(e.isPointerCaptured(i.pointerId))return void(this._pointerCaptures[i.pointerId]=!1);const n=i=>{let n=null;if(t.nearInteractionPickingInfo)n=t.nearInteractionPickingInfo.pickedMesh.getScene()==i?t.nearInteractionPickingInfo:new o.p;else if(i!==this.utilityLayerScene&&t.originalPickingInfo)n=t.originalPickingInfo;else{let r=null;this._renderCamera&&(r=i._activeCamera,i._activeCamera=this._renderCamera,t.ray=null),n=t.ray?i.pickWithRay(t.ray):i.pick(e.pointerX,e.pointerY),r&&(i._activeCamera=r)}return n},r=n(this.utilityLayerScene);if(!t.ray&&r&&(t.ray=r.ray),this.utilityLayerScene.onPrePointerObservable.notifyObservers(t),this.onlyCheckPointerDownEvents&&t.type!=s.kD.POINTERDOWN)return t.skipOnPointerObservable||this.utilityLayerScene.onPointerObservable.notifyObservers(new s.R5(t.type,t.event,r),t.type),void(t.type===s.kD.POINTERUP&&this._pointerCaptures[i.pointerId]&&(this._pointerCaptures[i.pointerId]=!1));if(this.utilityLayerScene.autoClearDepthAndStencil||this.pickUtilitySceneFirst)r&&r.hit&&(t.skipOnPointerObservable||this.utilityLayerScene.onPointerObservable.notifyObservers(new s.R5(t.type,t.event,r),t.type),t.skipOnPointerObservable=!0);else{const i=n(e),o=t.event;i&&r&&(0===r.distance&&i.pickedMesh?this.mainSceneTrackerPredicate&&this.mainSceneTrackerPredicate(i.pickedMesh)?(this._notifyObservers(t,i,o),t.skipOnPointerObservable=!0):t.type===s.kD.POINTERDOWN?this._pointerCaptures[o.pointerId]=!0:t.type!==s.kD.POINTERMOVE&&t.type!==s.kD.POINTERUP||(this._lastPointerEvents[o.pointerId]&&(this.onPointerOutObservable.notifyObservers(o.pointerId),delete this._lastPointerEvents[o.pointerId]),this._notifyObservers(t,i,o)):!this._pointerCaptures[o.pointerId]&&(r.distance0)):!this._pointerCaptures[o.pointerId]&&r.distance>=i.distance&&(this.mainSceneTrackerPredicate&&this.mainSceneTrackerPredicate(i.pickedMesh)?(this._notifyObservers(t,i,o),t.skipOnPointerObservable=!0):(t.type!==s.kD.POINTERMOVE&&t.type!==s.kD.POINTERUP||this._lastPointerEvents[o.pointerId]&&(this.onPointerOutObservable.notifyObservers(o.pointerId),delete this._lastPointerEvents[o.pointerId]),this._notifyObservers(t,r,o))),t.type===s.kD.POINTERUP&&this._pointerCaptures[o.pointerId]&&(this._pointerCaptures[o.pointerId]=!1))}})),this._originalPointerObserver&&e.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)),this.utilityLayerScene.autoClear=!1,this._afterRenderObserver=this.originalScene.onAfterRenderCameraObservable.add((e=>{this.shouldRender&&e==this.getRenderCamera()&&this.render()})),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add((()=>{this.dispose()})),this._updateCamera()}getRenderCamera(e){if(this._renderCamera)return this._renderCamera;{let t;return t=this.originalScene.activeCameras&&this.originalScene.activeCameras.length>1?this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:this.originalScene.activeCamera,e&&t&&t.isRigCamera?t.rigParent:t}}setRenderCamera(e){this._renderCamera=e}_getSharedGizmoLight(){return this._sharedGizmoLight||(this._sharedGizmoLight=new l.e("shared gizmo light",new c.P(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=h.Wo.Gray()),this._sharedGizmoLight}static get DefaultUtilityLayer(){return null==_._DefaultUtilityLayer?_._CreateDefaultUtilityLayerFromScene(a.l.LastCreatedScene):_._DefaultUtilityLayer}static _CreateDefaultUtilityLayerFromScene(e){return _._DefaultUtilityLayer=new _(e),_._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce((()=>{_._DefaultUtilityLayer=null})),_._DefaultUtilityLayer}static get DefaultKeepDepthUtilityLayer(){return null==_._DefaultKeepDepthUtilityLayer&&(_._DefaultKeepDepthUtilityLayer=new _(a.l.LastCreatedScene),_._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,_._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce((()=>{_._DefaultKeepDepthUtilityLayer=null}))),_._DefaultKeepDepthUtilityLayer}_notifyObservers(e,t,i){e.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new s.R5(e.type,e.event,t),e.type),this._lastPointerEvents[i.pointerId]=!0)}render(){if(this._updateCamera(),this.utilityLayerScene.activeCamera){const e=this.utilityLayerScene.activeCamera.getScene(),t=this.utilityLayerScene.activeCamera;t._scene=this.utilityLayerScene,t.leftCamera&&(t.leftCamera._scene=this.utilityLayerScene),t.rightCamera&&(t.rightCamera._scene=this.utilityLayerScene),this.utilityLayerScene.render(!1),t._scene=e,t.leftCamera&&(t.leftCamera._scene=e),t.rightCamera&&(t.rightCamera._scene=e)}}dispose(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()}_updateCamera(){this.utilityLayerScene.cameraToUseForPointers=this.getRenderCamera(),this.utilityLayerScene.activeCamera=this.getRenderCamera()}}_._DefaultUtilityLayer=null,_._DefaultKeepDepthUtilityLayer=null},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.bakedVertexAnimation="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\n{\n#ifdef INSTANCES\n#define BVASNAME bakedVertexAnimationSettingsInstanced\n#else\n#define BVASNAME bakedVertexAnimationSettings\n#endif\nfloat VATStartFrame=BVASNAME.x;\nfloat VATEndFrame=BVASNAME.y;\nfloat VATOffsetFrame=BVASNAME.z;\nfloat VATSpeed=BVASNAME.w;\nfloat totalFrames=VATEndFrame-VATStartFrame+1.0;\nfloat time=bakedVertexAnimationTime*VATSpeed/totalFrames;\nfloat frameCorrection=time<1.0 ? 0.0 : 1.0;\nfloat numOfFrames=totalFrames-frameCorrection;\nfloat VATFrameNum=fract(time)*numOfFrames;\nVATFrameNum=mod(VATFrameNum+VATOffsetFrame,numOfFrames);\nVATFrameNum=floor(VATFrameNum);\nVATFrameNum+=VATStartFrame+frameCorrection;\nmat4 VATInfluence;\nVATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[0],VATFrameNum)*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[1],VATFrameNum)*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[2],VATFrameNum)*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[3],VATFrameNum)*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[0],VATFrameNum)*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[1],VATFrameNum)*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[2],VATFrameNum)*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[3],VATFrameNum)*matricesWeightsExtra[3];\n#endif\nfinalWorld=finalWorld*VATInfluence;\n}\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.bakedVertexAnimationDeclaration="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\nuniform float bakedVertexAnimationTime;\nuniform vec2 bakedVertexAnimationTextureSizeInverted;\nuniform vec4 bakedVertexAnimationSettings;\nuniform sampler2D bakedVertexAnimationTexture;\n#ifdef INSTANCES\nattribute vec4 bakedVertexAnimationSettingsInstanced;\n#endif\n#define inline\nmat4 readMatrixFromRawSamplerVAT(sampler2D smp,float index,float frame)\n{\nfloat offset=index*4.0;\nfloat frameUV=(frame+0.5)*bakedVertexAnimationTextureSizeInverted.y;\nfloat dx=bakedVertexAnimationTextureSizeInverted.x;\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),frameUV));\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),frameUV));\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),frameUV));\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),frameUV));\nreturn mat4(m0,m1,m2,m3);\n}\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.bonesDeclaration="#if NUM_BONE_INFLUENCERS>0\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#ifdef BONETEXTURE\nuniform sampler2D boneSampler;\nuniform float boneTextureWidth;\n#else\nuniform mat4 mBones[BonesPerMesh];\n#ifdef BONES_VELOCITY_ENABLED\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\n#ifdef BONETEXTURE\n#define inline\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\n{\nfloat offset=index *4.0;\nfloat dx=1.0/boneTextureWidth;\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\nreturn mat4(m0,m1,m2,m3);\n}\n#endif\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.bonesVertex="#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif\n#else\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\n#endif\nfinalWorld=finalWorld*influence;\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragment.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.bumpFragment="vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#elif defined(BUMP)\nfloat normalScale=vBumpInfos.y;\n#else\nfloat normalScale=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#elif defined(BUMP)\nvec2 TBNUV=gl_FrontFacing ? vBumpUV : -vBumpUV;\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);\n#else\nvec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nvec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;\nmat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\nvec2 detailNormalRG=detailColor.wy*2.0-1.0;\nfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\nvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);\nnormalW=normalize(mat3(normalMatrix)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y);\n#else\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\n#if DETAIL_NORMALBLENDMETHOD==0 \ndetailNormal.xy*=vDetailInfos.z;\nvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD==1 \ndetailNormal.xy*=vDetailInfos.z;\nbumpNormal+=vec3(0.0,0.0,1.0);\ndetailNormal*=vec3(-1.0,-1.0,1.0);\nvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;\nnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentFunctions.js":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js");i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerFragmentDeclaration.js");n.v.IncludesShadersStore.bumpFragmentFunctions="#if defined(BUMP)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump)\n#endif\n#if defined(DETAIL)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)\n#endif\n#if defined(BUMP) && defined(PARALLAX)\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nfor (int i=0; icurrRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\nbreak;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentMainFunctions.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.bumpFragmentMainFunctions="#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\n{\n#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*normal);\n}\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\n{\nreturn perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);\n}\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\n{\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\ntangent*=tangentSpaceParams.x;\nbitangent*=tangentSpaceParams.y;\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\n}\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertex.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.bumpVertex="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertexDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.bumpVertexDeclaration="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.clipPlaneFragment="#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nif (false) {}\n#endif\n#ifdef CLIPPLANE\nelse if (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nelse if (fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nelse if (fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nelse if (fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE5\nelse if (fClipDistance5>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE6\nelse if (fClipDistance6>0.0)\n{\ndiscard;\n}\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.clipPlaneFragmentDeclaration="#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nvarying float fClipDistance6;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.clipPlaneVertex="#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nfClipDistance5=dot(worldPos,vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nfClipDistance6=dot(worldPos,vClipPlane6);\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.clipPlaneVertexDeclaration="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;\nvarying float fClipDistance6;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.depthPrePass="#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);\nreturn;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragment.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.fogFragment="#ifdef FOG\nfloat fog=CalcFogFactor();\n#ifdef PBR\nfog=toLinearSpace(fog);\n#endif\ncolor.rgb=mix(vFogColor,color.rgb,fog);\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.fogFragmentDeclaration="#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying vec3 vFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nfloat fogDistance=length(vFogDistance);\nif (FOGMODE_LINEAR==vFogInfos.x)\n{\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP==vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2==vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertex.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.fogVertex="#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.fogVertexDeclaration="#ifdef FOG\nvarying vec3 vFogDistance;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fresnelFunction.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.fresnelFunction="#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/hdrFilteringFunctions.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.hdrFilteringFunctions="#ifdef NUM_SAMPLES\n#if NUM_SAMPLES>0\n#if defined(WEBGL2) || defined(WEBGPU)\nfloat radicalInverse_VdC(uint bits) \n{\nbits=(bits<<16u) | (bits>>16u);\nbits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);\nbits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);\nbits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);\nbits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);\nreturn float(bits)*2.3283064365386963e-10; \n}\nvec2 hammersley(uint i,uint N)\n{\nreturn vec2(float(i)/float(N),radicalInverse_VdC(i));\n}\n#else\nfloat vanDerCorpus(int n,int base)\n{\nfloat invBase=1.0/float(base);\nfloat denom =1.0;\nfloat result =0.0;\nfor(int i=0; i<32; ++i)\n{\nif(n>0)\n{\ndenom =mod(float(n),2.0);\nresult+=denom*invBase;\ninvBase=invBase/2.0;\nn =int(float(n)/2.0);\n}\n}\nreturn result;\n}\nvec2 hammersley(int i,int N)\n{\nreturn vec2(float(i)/float(N),vanDerCorpus(i,2));\n}\n#endif\nfloat log4(float x) {\nreturn log2(x)/2.;\n}\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);\nconst float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;\nconst float K=4.;\n#define inline\nvec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{\nvec3 n=normalize(inputN);\nvec3 result=vec3(0.0);\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\ntangent=normalize(cross(tangent,n));\nvec3 bitangent=cross(n,tangent);\nmat3 tbn=mat3(tangent,bitangent,n);\nfloat maxLevel=filteringInfo.y;\nfloat dim0=filteringInfo.x;\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\n#if defined(WEBGL2) || defined(WEBGPU)\nfor(uint i=0u; i0.) {\nfloat pdf_inversed=PI/NoL;\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\nfloat mipLevel=clamp(l,0.0,maxLevel);\nvec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c;\n}\n}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\nreturn result;\n}\n#define inline\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{\nvec3 n=normalize(inputN);\nif (alphaG==0.) {\nvec3 c=textureCube(inputTexture,n).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;\n} else {\nvec3 result=vec3(0.);\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\ntangent=normalize(cross(tangent,n));\nvec3 bitangent=cross(n,tangent);\nmat3 tbn=mat3(tangent,bitangent,n);\nfloat maxLevel=filteringInfo.y;\nfloat dim0=filteringInfo.x;\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\nfloat weight=0.;\n#if defined(WEBGL2) || defined(WEBGPU)\nfor(uint i=0u; i0.) {\nfloat pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\nfloat mipLevel=clamp(float(l),0.0,maxLevel);\nweight+=NoL;\nvec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;\n}\n}\nresult=result/weight;\nreturn result;\n}\n}\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.helperFunctions="const float PI=3.1415926535897932384626433832795;\nconst float HALF_MIN=5.96046448e-08; \nconst float LinearEncodePowerApprox=2.2;\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\nconst float Epsilon=0.0000001;\n#define saturate(x) clamp(x,0.0,1.0)\n#define absEps(x) abs(x)+Epsilon\n#define maxEps(x) max(x,Epsilon)\n#define saturateEps(x) clamp(x,Epsilon,1.0)\nmat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}\nmat3 inverseMat3(mat3 inMatrix) {\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\nfloat b01=a22*a11-a12*a21;\nfloat b11=-a22*a10+a12*a20;\nfloat b21=a21*a10-a11*a20;\nfloat det=a00*b01+a01*b11+a02*b21;\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\n}\n#if USE_EXACT_SRGB_CONVERSIONS\nvec3 toLinearSpaceExact(vec3 color)\n{\nvec3 nearZeroSection=0.0773993808*color;\nvec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4));\n#if defined(WEBGL2) || defined(WEBGPU)\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045)));\n#else\nreturn\nvec3(\ncolor.r<=0.04045 ? nearZeroSection.r : remainingSection.r,\ncolor.g<=0.04045 ? nearZeroSection.g : remainingSection.g,\ncolor.b<=0.04045 ? nearZeroSection.b : remainingSection.b);\n#endif\n}\nvec3 toGammaSpaceExact(vec3 color)\n{\nvec3 nearZeroSection=12.92*color;\nvec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055);\n#if defined(WEBGL2) || defined(WEBGPU)\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308)));\n#else\nreturn\nvec3(\ncolor.r<=0.0031308 ? nearZeroSection.r : remainingSection.r,\ncolor.g<=0.0031308 ? nearZeroSection.g : remainingSection.g,\ncolor.b<=0.0031308 ? nearZeroSection.b : remainingSection.b);\n#endif\n}\n#endif\nfloat toLinearSpace(float color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nfloat nearZeroSection=0.0773993808*color;\nfloat remainingSection=pow(0.947867299*(color+0.055),2.4);\nreturn color<=0.04045 ? nearZeroSection : remainingSection;\n#else\nreturn pow(color,LinearEncodePowerApprox);\n#endif\n}\nvec3 toLinearSpace(vec3 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toLinearSpaceExact(color);\n#else\nreturn pow(color,vec3(LinearEncodePowerApprox));\n#endif\n}\nvec4 toLinearSpace(vec4 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4(toLinearSpaceExact(color.rgb),color.a);\n#else\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\n#endif\n}\nfloat toGammaSpace(float color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nfloat nearZeroSection=12.92*color;\nfloat remainingSection=1.055*pow(color,0.41666)-0.055;\nreturn color<=0.0031308 ? nearZeroSection : remainingSection;\n#else\nreturn pow(color,GammaEncodePowerApprox);\n#endif\n}\nvec3 toGammaSpace(vec3 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toGammaSpaceExact(color);\n#else\nreturn pow(color,vec3(GammaEncodePowerApprox));\n#endif\n}\nvec4 toGammaSpace(vec4 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4(toGammaSpaceExact(color.rgb),color.a);\n#else\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\n#endif\n}\nfloat square(float value)\n{\nreturn value*value;\n}\nvec3 square(vec3 value)\n{\nreturn value*value;\n}\nfloat pow5(float value) {\nfloat sq=value*value;\nreturn sq*sq*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\n}\nfloat getRand(vec2 seed) {\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\n}\nfloat dither(vec2 seed,float varianceAmount) {\nfloat rand=getRand(seed);\nfloat normVariance=varianceAmount/255.0;\nfloat dither=mix(-normVariance,normVariance,rand);\nreturn dither;\n}\nconst float rgbdMaxRange=255.0;\nvec4 toRGBD(vec3 color) {\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\nfloat D =max(rgbdMaxRange/maxRGB,1.);\nD =clamp(floor(D)/255.0,0.,1.);\nvec3 rgb=color.rgb*D;\nrgb=toGammaSpace(rgb);\nreturn vec4(clamp(rgb,0.,1.),D); \n}\nvec3 fromRGBD(vec4 rgbd) {\nrgbd.rgb=toLinearSpace(rgbd.rgb);\nreturn rgbd.rgb/rgbd.a;\n}\nvec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\nvec3 halfSize=cubeSize*0.5;\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\nvec3 intersectPositionWS=vertexPos+origVec*distance;\nreturn intersectPositionWS-cubePos;\n}\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.imageProcessingDeclaration="#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#if defined(VIGNETTE) || defined(DITHER)\nuniform vec2 vInverseScreenSize;\n#endif\n#ifdef VIGNETTE\nuniform vec4 vignetteSettings1;\nuniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;\nuniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif\n#ifdef DITHER\nuniform float ditherIntensity;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingFunctions.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.imageProcessingFunctions="#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n/** \n* Polyfill for SAMPLE_TEXTURE_3D,which is unsupported in WebGL.\n* sampler3dSetting.x=textureOffset (0.5/textureSize).\n* sampler3dSetting.y=textureSize.\n*/\n#define inline\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{\nfloat sliceSize=2.0*sampler3dSetting.x; \n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);\nfloat sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;\nsliceUV.x+=sliceInteger*sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;\n}\n#endif\n#ifdef TONEMAPPING_ACES\nconst mat3 ACESInputMat=mat3(\nvec3(0.59719,0.07600,0.02840),\nvec3(0.35458,0.90834,0.13383),\nvec3(0.04823,0.01566,0.83777)\n);\nconst mat3 ACESOutputMat=mat3(\nvec3( 1.60475,-0.10208,-0.00327),\nvec3(-0.53108, 1.10813,-0.07276),\nvec3(-0.07367,-0.00605, 1.07602)\n);\nvec3 RRTAndODTFit(vec3 v)\n{\nvec3 a=v*(v+0.0245786)-0.000090537;\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\nreturn a/b;\n}\nvec3 ACESFitted(vec3 color)\n{\ncolor=ACESInputMat*color;\ncolor=RRTAndODTFit(color);\ncolor=ACESOutputMat*color;\ncolor=saturate(color);\nreturn color;\n}\n#endif\nvec4 applyImageProcessing(vec4 result) {\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\nviewportXY=viewportXY*2.0-1.0;\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\nvec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\nresult.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\n#ifdef TONEMAPPING_ACES\nresult.rgb=ACESFitted(result.rgb);\n#else\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n#endif\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=saturate(result.rgb);\n#ifdef CONTRAST\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\nif (contrast<1.0) {\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\n} else {\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\n}\n#endif\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\nfloat luma=getLuminance(result.rgb);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\n#ifdef DITHER\nfloat rand=getRand(gl_FragCoord.xy*vInverseScreenSize);\nfloat dither=mix(-ditherIntensity,ditherIntensity,rand);\nresult.rgb=saturate(result.rgb+vec3(dither));\n#endif\nreturn result;\n}"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/importanceSampling.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.importanceSampling="vec3 hemisphereCosSample(vec2 u) {\nfloat phi=2.*PI*u.x;\nfloat cosTheta2=1.-u.y;\nfloat cosTheta=sqrt(cosTheta2);\nfloat sinTheta=sqrt(1.-cosTheta2);\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\n}\nvec3 hemisphereImportanceSampleDggx(vec2 u,float a) {\nfloat phi=2.*PI*u.x;\nfloat cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));\nfloat cosTheta=sqrt(cosTheta2);\nfloat sinTheta=sqrt(1.-cosTheta2);\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\n}\nvec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) { \nfloat phi=2.*PI*u.x;\nfloat sinTheta=pow(u.y,a/(2.*a+1.));\nfloat cosTheta=sqrt(1.-sinTheta*sinTheta);\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\n}"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.instancesDeclaration="#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#ifdef INSTANCESCOLOR\nattribute vec4 instanceColor;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nattribute vec4 previousWorld0;\nattribute vec4 previousWorld1;\nattribute vec4 previousWorld2;\nattribute vec4 previousWorld3;\n#ifdef THIN_INSTANCES\nuniform mat4 previousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nuniform mat4 previousWorld;\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.instancesVertex="#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nmat4 finalPreviousWorld=mat4(previousWorld0,previousWorld1,previousWorld2,previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\nfinalWorld=world*finalWorld;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\nmat4 finalWorld=world;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nmat4 finalPreviousWorld=previousWorld;\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragment.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.lightFragment="#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n#else\n#ifdef PBR\n#ifdef SPOTLIGHT{X}\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(POINTLIGHT{X})\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(HEMILIGHT{X})\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(DIRLIGHT{X})\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#endif\npreInfo.NdotV=NdotV;\n#ifdef SPOTLIGHT{X}\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#elif defined(POINTLIGHT{X})\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\n#else\npreInfo.attenuation=1.0;\n#endif\n#ifdef HEMILIGHT{X}\npreInfo.roughness=roughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#ifdef IRIDESCENCE\npreInfo.iridescenceIntensity=iridescenceIntensity;\n#endif\n#ifdef HEMILIGHT{X}\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\n#elif defined(SS_TRANSLUCENCY)\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,subSurfaceOut.transmittance);\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\n#endif\n#ifdef SPECULARTERM\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\n#ifdef HEMILIGHT{X}\npreInfo.roughness=sheenOut.sheenRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n#ifdef CLEARCOAT\n#ifdef HEMILIGHT{X}\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light{X}.vLightDiffuse.rgb);\n#ifdef CLEARCOAT_TINT\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);\ninfo.diffuse*=absorption;\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\n#else\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nfor (int i=0; i=0.) {\nindex{X}=i;\nbreak;\n}\n}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nfloat frustumLength=frustumLengths{X}[index{X}];\nfloat diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};\nif (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{\nindex{X}+=1;\nfloat nextShadow=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;\nshadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else \ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.lightFragmentDeclaration="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.lightUboDeclaration="#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X}; \n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxFragmentDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.lightVxFragmentDeclaration="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#elif defined(SHADOWCUBE{X})\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxUboDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.lightVxUboDeclaration="#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#elif defined(SHADOWCUBE{X})\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.lightsFragmentFunctions="struct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 lightVectorW;\nfloat attenuation=1.0;\nif (lightData.w==0.)\n{\nvec3 direction=lightData.xyz-vPositionW;\nattenuation=max(0.,1.0-length(direction)/range);\nlightVectorW=normalize(direction);\n}\nelse\n{\nlightVectorW=normalize(-lightData.xyz);\n}\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 direction=lightData.xyz-vPositionW;\nvec3 lightVectorW=normalize(direction);\nfloat attenuation=max(0.,1.0-length(direction)/range);\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\nif (cosAngle>=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn textureColor;\n}"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.logDepthDeclaration="#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.logDepthFragment="#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.logDepthVertex="#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/mainUVVaryingDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.mainUVVaryingDeclaration="#ifdef MAINUV{X}\nvarying vec2 vMainUV{X};\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/meshUboDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.meshUboDeclaration="#ifdef WEBGL2\nuniform mat4 world;\nuniform float visibility;\n#else\nlayout(std140,column_major) uniform;\nuniform Mesh\n{\nmat4 world;\nfloat visibility;\n};\n#endif\n#define WORLD_UBO\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertex.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.morphTargetsVertex="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE \nvertexID=float(gl_VertexID)*morphTargetTextureInfo.x;\npositionUpdated+=(readVector3FromRawSampler({X},vertexID)-position)*morphTargetInfluences[{X}];\nvertexID+=1.0;\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(readVector3FromRawSampler({X},vertexID) -normal)*morphTargetInfluences[{X}];\nvertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(readVector3FromRawSampler({X},vertexID).xy-uv)*morphTargetInfluences[{X}];\nvertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(readVector3FromRawSampler({X},vertexID) -tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#else\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\n#endif\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.morphTargetsVertexDeclaration="#ifdef MORPHTARGETS\n#ifndef MORPHTARGETS_TEXTURE\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#ifdef MORPHTARGETS_UV\nattribute vec2 uv_{X};\n#endif\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobal.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.morphTargetsVertexGlobal="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\nfloat vertexID;\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.morphTargetsVertexGlobalDeclaration="#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#ifdef MORPHTARGETS_TEXTURE \nprecision mediump sampler2DArray; \nuniform float morphTargetTextureIndices[NUM_MORPH_INFLUENCERS];\nuniform vec3 morphTargetTextureInfo;\nuniform sampler2DArray morphTargets;\nvec3 readVector3FromRawSampler(int targetIndex,float vertexIndex)\n{ \nfloat y=floor(vertexIndex/morphTargetTextureInfo.y);\nfloat x=vertexIndex-y*morphTargetTextureInfo.y;\nvec3 textureUV=vec3((x+0.5)/morphTargetTextureInfo.y,(y+0.5)/morphTargetTextureInfo.z,morphTargetTextureIndices[targetIndex]);\nreturn texture(morphTargets,textureUV).xyz;\n}\n#endif\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/oitDeclaration.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.oitDeclaration="#ifdef ORDER_INDEPENDENT_TRANSPARENCY\n#extension GL_EXT_draw_buffers : require\nlayout(location=0) out vec2 depth; \nlayout(location=1) out vec4 frontColor;\nlayout(location=2) out vec4 backColor;\n#define MAX_DEPTH 99999.0\nhighp vec4 gl_FragColor;\nuniform sampler2D oitDepthSampler;\nuniform sampler2D oitFrontColorSampler;\n#endif\n"},"../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/oitFragment.js":function(e,t,i){"use strict";i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js").v.IncludesShadersStore.oitFragment="#ifdef ORDER_INDEPENDENT_TRANSPARENCY\nfloat fragDepth=gl_FragCoord.z; \n#ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS\nuint halfFloat=packHalf2x16(vec2(fragDepth));\nvec2 full=unpackHalf2x16(halfFloat);\nfragDepth=full.x;\n#endif\nivec2 fragCoord=ivec2(gl_FragCoord.xy);\nvec2 lastDepth=texelFetch(oitDepthSampler,fragCoord,0).rg;\nvec4 lastFrontColor=texelFetch(oitFrontColorSampler,fragCoord,0);\ndepth.rg=vec2(-MAX_DEPTH);\nfrontColor=lastFrontColor;\nbackColor=vec4(0.0);\n#ifdef USE_REVERSE_DEPTHBUFFER\nfloat furthestDepth=-lastDepth.x;\nfloat nearestDepth=lastDepth.y;\n#else\nfloat nearestDepth=-lastDepth.x;\nfloat furthestDepth=lastDepth.y;\n#endif\nfloat alphaMultiplier=1.0-lastFrontColor.a;\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepth>nearestDepth || fragDepthfurthestDepth) {\n#endif\nreturn;\n}\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepthfurthestDepth) {\n#else\nif (fragDepth>nearestDepth && fragDepth\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}"},"../../../node_modules/@babylonjs/core/States/alphaCullingState.js":function(e,t,i){"use strict";i.d(t,{Q:function(){return n}});class n{constructor(){this._blendFunctionParameters=new Array(4),this._blendEquationParameters=new Array(2),this._blendConstants=new Array(4),this._isBlendConstantsDirty=!1,this._alphaBlend=!1,this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this.reset()}get isDirty(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty||this._isBlendEquationParametersDirty}get alphaBlend(){return this._alphaBlend}set alphaBlend(e){this._alphaBlend!==e&&(this._alphaBlend=e,this._isAlphaBlendDirty=!0)}setAlphaBlendConstants(e,t,i,n){this._blendConstants[0]===e&&this._blendConstants[1]===t&&this._blendConstants[2]===i&&this._blendConstants[3]===n||(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=i,this._blendConstants[3]=n,this._isBlendConstantsDirty=!0)}setAlphaBlendFunctionParameters(e,t,i,n){this._blendFunctionParameters[0]===e&&this._blendFunctionParameters[1]===t&&this._blendFunctionParameters[2]===i&&this._blendFunctionParameters[3]===n||(this._blendFunctionParameters[0]=e,this._blendFunctionParameters[1]=t,this._blendFunctionParameters[2]=i,this._blendFunctionParameters[3]=n,this._isBlendFunctionParametersDirty=!0)}setAlphaEquationParameters(e,t){this._blendEquationParameters[0]===e&&this._blendEquationParameters[1]===t||(this._blendEquationParameters[0]=e,this._blendEquationParameters[1]=t,this._isBlendEquationParametersDirty=!0)}reset(){this._alphaBlend=!1,this._blendFunctionParameters[0]=null,this._blendFunctionParameters[1]=null,this._blendFunctionParameters[2]=null,this._blendFunctionParameters[3]=null,this._blendEquationParameters[0]=null,this._blendEquationParameters[1]=null,this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1}apply(e){this.isDirty&&(this._isAlphaBlendDirty&&(this._alphaBlend?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._blendEquationParameters[0],this._blendEquationParameters[1]),this._isBlendEquationParametersDirty=!1),this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1))}}},"../../../node_modules/@babylonjs/core/States/depthCullingState.js":function(e,t,i){"use strict";i.d(t,{k:function(){return n}});class n{constructor(e=!0){this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,e&&this.reset()}get isDirty(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty}get zOffset(){return this._zOffset}set zOffset(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)}get zOffsetUnits(){return this._zOffsetUnits}set zOffsetUnits(e){this._zOffsetUnits!==e&&(this._zOffsetUnits=e,this._isZOffsetDirty=!0)}get cullFace(){return this._cullFace}set cullFace(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)}get cull(){return this._cull}set cull(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)}get depthFunc(){return this._depthFunc}set depthFunc(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)}get depthMask(){return this._depthMask}set depthMask(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)}get depthTest(){return this._depthTest}set depthTest(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)}get frontFace(){return this._frontFace}set frontFace(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)}reset(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._zOffsetUnits=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!0,this._isFrontFaceDirty=!1}apply(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset||this.zOffsetUnits?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,this.zOffsetUnits)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))}}},"../../../node_modules/@babylonjs/core/States/stencilState.js":function(e,t,i){"use strict";i.d(t,{s:function(){return n}});class n{constructor(){this.reset()}reset(){this.enabled=!1,this.mask=255,this.func=n.ALWAYS,this.funcRef=1,this.funcMask=255,this.opStencilFail=n.KEEP,this.opDepthFail=n.KEEP,this.opStencilDepthPass=n.REPLACE}get stencilFunc(){return this.func}set stencilFunc(e){this.func=e}get stencilFuncRef(){return this.funcRef}set stencilFuncRef(e){this.funcRef=e}get stencilFuncMask(){return this.funcMask}set stencilFuncMask(e){this.funcMask=e}get stencilOpStencilFail(){return this.opStencilFail}set stencilOpStencilFail(e){this.opStencilFail=e}get stencilOpDepthFail(){return this.opDepthFail}set stencilOpDepthFail(e){this.opDepthFail=e}get stencilOpStencilDepthPass(){return this.opStencilDepthPass}set stencilOpStencilDepthPass(e){this.opStencilDepthPass=e}get stencilMask(){return this.mask}set stencilMask(e){this.mask=e}get stencilTest(){return this.enabled}set stencilTest(e){this.enabled=e}}n.ALWAYS=519,n.KEEP=7680,n.REPLACE=7681},"../../../node_modules/@babylonjs/core/States/stencilStateComposer.js":function(e,t,i){"use strict";i.d(t,{C:function(){return n}});class n{constructor(e=!0){this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.useStencilGlobalOnly=!1,e&&this.reset()}get isDirty(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty}get func(){return this._func}set func(e){this._func!==e&&(this._func=e,this._isStencilFuncDirty=!0)}get funcRef(){return this._funcRef}set funcRef(e){this._funcRef!==e&&(this._funcRef=e,this._isStencilFuncDirty=!0)}get funcMask(){return this._funcMask}set funcMask(e){this._funcMask!==e&&(this._funcMask=e,this._isStencilFuncDirty=!0)}get opStencilFail(){return this._opStencilFail}set opStencilFail(e){this._opStencilFail!==e&&(this._opStencilFail=e,this._isStencilOpDirty=!0)}get opDepthFail(){return this._opDepthFail}set opDepthFail(e){this._opDepthFail!==e&&(this._opDepthFail=e,this._isStencilOpDirty=!0)}get opStencilDepthPass(){return this._opStencilDepthPass}set opStencilDepthPass(e){this._opStencilDepthPass!==e&&(this._opStencilDepthPass=e,this._isStencilOpDirty=!0)}get mask(){return this._mask}set mask(e){this._mask!==e&&(this._mask=e,this._isStencilMaskDirty=!0)}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._isStencilTestDirty=!0)}reset(){var e;this.stencilMaterial=void 0,null===(e=this.stencilGlobal)||void 0===e||e.reset(),this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0}apply(e){var t;if(!e)return;const i=!this.useStencilGlobalOnly&&!!(null===(t=this.stencilMaterial)||void 0===t?void 0:t.enabled);this.enabled=i?this.stencilMaterial.enabled:this.stencilGlobal.enabled,this.func=i?this.stencilMaterial.func:this.stencilGlobal.func,this.funcRef=i?this.stencilMaterial.funcRef:this.stencilGlobal.funcRef,this.funcMask=i?this.stencilMaterial.funcMask:this.stencilGlobal.funcMask,this.opStencilFail=i?this.stencilMaterial.opStencilFail:this.stencilGlobal.opStencilFail,this.opDepthFail=i?this.stencilMaterial.opDepthFail:this.stencilGlobal.opDepthFail,this.opStencilDepthPass=i?this.stencilMaterial.opStencilDepthPass:this.stencilGlobal.opStencilDepthPass,this.mask=i?this.stencilMaterial.mask:this.stencilGlobal.mask,this.isDirty&&(this._isStencilTestDirty&&(this.enabled?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.mask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFunc(this.func,this.funcRef,this.funcMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOp(this.opStencilFail,this.opDepthFail,this.opStencilDepthPass),this._isStencilOpDirty=!1))}}},"../../../node_modules/@babylonjs/core/XR/features/WebXRAbstractFeature.js":function(e,t,i){"use strict";i.d(t,{F:function(){return n}});class n{constructor(e){this._xrSessionManager=e,this._attached=!1,this._removeOnDetach=[],this.isDisposed=!1,this.disableAutoAttach=!1,this.xrNativeFeatureName=""}get attached(){return this._attached}attach(e){if(this.isDisposed)return!1;if(e)this.attached&&this.detach();else if(this.attached)return!1;return this._attached=!0,this._addNewAttachObserver(this._xrSessionManager.onXRFrameObservable,(e=>this._onXRFrame(e))),!0}detach(){return this._attached?(this._attached=!1,this._removeOnDetach.forEach((e=>{e.observable.remove(e.observer)})),!0):(this.disableAutoAttach=!0,!1)}dispose(){this.detach(),this.isDisposed=!0}isCompatible(){return!0}_addNewAttachObserver(e,t){this._removeOnDetach.push({observable:e,observer:e.add(t)})}}},"../../../node_modules/@babylonjs/core/XR/features/WebXRHandTracking.js":function(e,t,i){"use strict";var n,r,s=i("../../../node_modules/@babylonjs/core/XR/features/WebXRAbstractFeature.js"),o=i("../../../node_modules/@babylonjs/core/XR/webXRFeaturesManager.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),l=i("../../../node_modules/@babylonjs/core/Physics/physicsImpostor.js"),c=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),h=i("../../../node_modules/@babylonjs/core/Loading/sceneLoader.js"),_=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),d=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterial.js"),u=i("../../../node_modules/@babylonjs/core/Materials/material.js"),p=i("../../../node_modules/@babylonjs/core/Meshes/Builders/icoSphereBuilder.js"),f=i("../../../node_modules/@babylonjs/core/Meshes/transformNode.js"),m=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js"),g=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js");!function(e){e.WRIST="wrist",e.THUMB="thumb",e.INDEX="index",e.MIDDLE="middle",e.RING="ring",e.LITTLE="little"}(n||(n={})),function(e){e.WRIST="wrist",e.THUMB_METACARPAL="thumb-metacarpal",e.THUMB_PHALANX_PROXIMAL="thumb-phalanx-proximal",e.THUMB_PHALANX_DISTAL="thumb-phalanx-distal",e.THUMB_TIP="thumb-tip",e.INDEX_FINGER_METACARPAL="index-finger-metacarpal",e.INDEX_FINGER_PHALANX_PROXIMAL="index-finger-phalanx-proximal",e.INDEX_FINGER_PHALANX_INTERMEDIATE="index-finger-phalanx-intermediate",e.INDEX_FINGER_PHALANX_DISTAL="index-finger-phalanx-distal",e.INDEX_FINGER_TIP="index-finger-tip",e.MIDDLE_FINGER_METACARPAL="middle-finger-metacarpal",e.MIDDLE_FINGER_PHALANX_PROXIMAL="middle-finger-phalanx-proximal",e.MIDDLE_FINGER_PHALANX_INTERMEDIATE="middle-finger-phalanx-intermediate",e.MIDDLE_FINGER_PHALANX_DISTAL="middle-finger-phalanx-distal",e.MIDDLE_FINGER_TIP="middle-finger-tip",e.RING_FINGER_METACARPAL="ring-finger-metacarpal",e.RING_FINGER_PHALANX_PROXIMAL="ring-finger-phalanx-proximal",e.RING_FINGER_PHALANX_INTERMEDIATE="ring-finger-phalanx-intermediate",e.RING_FINGER_PHALANX_DISTAL="ring-finger-phalanx-distal",e.RING_FINGER_TIP="ring-finger-tip",e.PINKY_FINGER_METACARPAL="pinky-finger-metacarpal",e.PINKY_FINGER_PHALANX_PROXIMAL="pinky-finger-phalanx-proximal",e.PINKY_FINGER_PHALANX_INTERMEDIATE="pinky-finger-phalanx-intermediate",e.PINKY_FINGER_PHALANX_DISTAL="pinky-finger-phalanx-distal",e.PINKY_FINGER_TIP="pinky-finger-tip"}(r||(r={}));const b=[r.WRIST,r.THUMB_METACARPAL,r.THUMB_PHALANX_PROXIMAL,r.THUMB_PHALANX_DISTAL,r.THUMB_TIP,r.INDEX_FINGER_METACARPAL,r.INDEX_FINGER_PHALANX_PROXIMAL,r.INDEX_FINGER_PHALANX_INTERMEDIATE,r.INDEX_FINGER_PHALANX_DISTAL,r.INDEX_FINGER_TIP,r.MIDDLE_FINGER_METACARPAL,r.MIDDLE_FINGER_PHALANX_PROXIMAL,r.MIDDLE_FINGER_PHALANX_INTERMEDIATE,r.MIDDLE_FINGER_PHALANX_DISTAL,r.MIDDLE_FINGER_TIP,r.RING_FINGER_METACARPAL,r.RING_FINGER_PHALANX_PROXIMAL,r.RING_FINGER_PHALANX_INTERMEDIATE,r.RING_FINGER_PHALANX_DISTAL,r.RING_FINGER_TIP,r.PINKY_FINGER_METACARPAL,r.PINKY_FINGER_PHALANX_PROXIMAL,r.PINKY_FINGER_PHALANX_INTERMEDIATE,r.PINKY_FINGER_PHALANX_DISTAL,r.PINKY_FINGER_TIP],y={[n.WRIST]:[r.WRIST],[n.THUMB]:[r.THUMB_METACARPAL,r.THUMB_PHALANX_PROXIMAL,r.THUMB_PHALANX_DISTAL,r.THUMB_TIP],[n.INDEX]:[r.INDEX_FINGER_METACARPAL,r.INDEX_FINGER_PHALANX_PROXIMAL,r.INDEX_FINGER_PHALANX_INTERMEDIATE,r.INDEX_FINGER_PHALANX_DISTAL,r.INDEX_FINGER_TIP],[n.MIDDLE]:[r.MIDDLE_FINGER_METACARPAL,r.MIDDLE_FINGER_PHALANX_PROXIMAL,r.MIDDLE_FINGER_PHALANX_INTERMEDIATE,r.MIDDLE_FINGER_PHALANX_DISTAL,r.MIDDLE_FINGER_TIP],[n.RING]:[r.RING_FINGER_METACARPAL,r.RING_FINGER_PHALANX_PROXIMAL,r.RING_FINGER_PHALANX_INTERMEDIATE,r.RING_FINGER_PHALANX_DISTAL,r.RING_FINGER_TIP],[n.LITTLE]:[r.PINKY_FINGER_METACARPAL,r.PINKY_FINGER_PHALANX_PROXIMAL,r.PINKY_FINGER_PHALANX_INTERMEDIATE,r.PINKY_FINGER_PHALANX_DISTAL,r.PINKY_FINGER_TIP]};class v{constructor(e,t,i,n,r=!1,s=!1,o=1){this.xrController=e,this._jointMeshes=t,this._handMesh=i,this.rigMapping=n,this._leftHandedMeshes=r,this._jointsInvisible=s,this._jointScaleFactor=o,this._jointTransforms=new Array(b.length),this._jointTransformMatrices=new Float32Array(16*b.length),this._tempJointMatrix=new a.y3,this._jointRadii=new Float32Array(b.length),this._scene=t[0].getScene();for(let e=0;e{e.rootMesh&&e.rootMesh.setEnabled(!1)}))),this.xrController.onMotionControllerInitObservable.add((e=>{e.onModelLoadedObservable.add((e=>{e.rootMesh&&e.rootMesh.setEnabled(!1)})),e.rootMesh&&e.rootMesh.setEnabled(!1)}))}get handMesh(){return this._handMesh}getHandPartMeshes(e){return y[e].map((e=>this._jointMeshes[b.indexOf(e)]))}getJointMesh(e){return this._jointMeshes[b.indexOf(e)]}setHandMesh(e,t){if(this._handMesh=e,e.alwaysSelectAsActiveMesh=!0,e.getChildMeshes().forEach((e=>e.alwaysSelectAsActiveMesh=!0)),this._handMesh.skeleton){const e=this._handMesh.skeleton;b.forEach(((i,n)=>{const r=e.getBoneIndexByName(t?t[i]:i);-1!==r&&e.bones[r].linkTransformNode(this._jointTransforms[n])}))}}updateFromXRFrame(e,t){const i=this.xrController.inputSource.hand;if(!i)return;const n=i,r=b.map((e=>n[e]||i.get(e)));let s=!1;if(e.fillPoses&&e.fillJointRadii)s=e.fillPoses(r,t,this._jointTransformMatrices)&&e.fillJointRadii(r,this._jointRadii);else if(e.getJointPose){s=!0;for(let i=0;i{const i=this._jointTransforms[t];a.y3.FromArrayToRef(this._jointTransformMatrices,16*t,this._tempJointMatrix),this._tempJointMatrix.decompose(void 0,i.rotationQuaternion,i.position);const n=this._jointRadii[t]*this._jointScaleFactor,r=this._jointMeshes[t];r.isVisible=!this._handMesh&&!this._jointsInvisible,r.position.copyFrom(i.position),r.rotationQuaternion.copyFrom(i.rotationQuaternion),r.scaling.setAll(n),this._scene.useRightHandedSystem||(r.position.z*=-1,r.rotationQuaternion.z*=-1,r.rotationQuaternion.w*=-1,this._leftHandedMeshes&&this._handMesh&&(i.position.z*=-1,i.rotationQuaternion.z*=-1,i.rotationQuaternion.w*=-1))})),this._handMesh&&(this._handMesh.isVisible=!0))}dispose(){this._handMesh&&(this._handMesh.isVisible=!1)}}class A extends s.F{constructor(e,t){super(e),this.options=t,this._attachedHands={},this._trackingHands={left:null,right:null},this._handResources={jointMeshes:null,handMeshes:null,rigMappings:null},this.onHandAddedObservable=new c.y$,this.onHandRemovedObservable=new c.y$,this._attachHand=e=>{var t,i,n;if(!e.inputSource.hand||"none"==e.inputSource.handedness||!this._handResources.jointMeshes)return;const r=e.inputSource.handedness,s=new v(e,this._handResources.jointMeshes[r],this._handResources.handMeshes&&this._handResources.handMeshes[r],this._handResources.rigMappings&&this._handResources.rigMappings[r],null===(t=this.options.handMeshes)||void 0===t?void 0:t.meshesUseLeftHandedCoordinates,null===(i=this.options.jointMeshes)||void 0===i?void 0:i.invisible,null===(n=this.options.jointMeshes)||void 0===n?void 0:n.scaleFactor);this._attachedHands[e.uniqueId]=s,this._trackingHands[r]=s,this.onHandAddedObservable.notifyObservers(s)},this._detachHand=e=>{this._detachHandById(e.uniqueId)},this.xrNativeFeatureName="hand-tracking";const i=t.jointMeshes;if(i&&(void 0!==i.disableDefaultHandMesh&&(t.handMeshes=t.handMeshes||{},t.handMeshes.disableDefaultMeshes=i.disableDefaultHandMesh),void 0!==i.handMeshes&&(t.handMeshes=t.handMeshes||{},t.handMeshes.customMeshes=i.handMeshes),void 0!==i.leftHandedSystemMeshes&&(t.handMeshes=t.handMeshes||{},t.handMeshes.meshesUseLeftHandedCoordinates=i.leftHandedSystemMeshes),void 0!==i.rigMapping)){t.handMeshes=t.handMeshes||{};const e={},n={};[[i.rigMapping.left,e],[i.rigMapping.right,n]].forEach((e=>{const t=e[0],i=e[1];t.forEach(((e,t)=>{i[b[t]]=e}))})),t.handMeshes.customRigMappings={left:e,right:n}}}static _GenerateTrackedJointMeshes(e){const t={};return["left","right"].map((i=>{var n,r,s,o,c;const h=[],_=(null===(n=e.jointMeshes)||void 0===n?void 0:n.sourceMesh)||(0,p.Au)("jointParent",A._ICOSPHERE_PARAMS);_.isVisible=!!(null===(r=e.jointMeshes)||void 0===r?void 0:r.keepOriginalVisible);for(let t=0;t{var n,r,s,o,a;const l={};(null===(r=null===(n=A._RightHandGLB)||void 0===n?void 0:n.meshes[1])||void 0===r?void 0:r.isDisposed())&&(A._RightHandGLB=null),(null===(o=null===(s=A._LeftHandGLB)||void 0===s?void 0:s.meshes[1])||void 0===o?void 0:o.isDisposed())&&(A._LeftHandGLB=null);const c=!(!A._RightHandGLB||!A._LeftHandGLB),p=await Promise.all([A._RightHandGLB||h.n.ImportMeshAsync("",A.DEFAULT_HAND_MODEL_BASE_URL,A.DEFAULT_HAND_MODEL_RIGHT_FILENAME,e),A._LeftHandGLB||h.n.ImportMeshAsync("",A.DEFAULT_HAND_MODEL_BASE_URL,A.DEFAULT_HAND_MODEL_LEFT_FILENAME,e)]);A._RightHandGLB=p[0],A._LeftHandGLB=p[1];const f=new d.O("handShader",e,{emitComments:!1});await f.loadAsync(A.DEFAULT_HAND_MODEL_SHADER_URL),f.needDepthPrePass=!0,f.transparencyMode=u.F.MATERIAL_ALPHABLEND,f.alphaMode=2,f.build(!1);const g={base:_.Wo.FromInts(116,63,203),fresnel:_.Wo.FromInts(149,102,229),fingerColor:_.Wo.FromInts(177,130,255),tipFresnel:_.Wo.FromInts(220,200,255),...null===(a=null==t?void 0:t.handMeshes)||void 0===a?void 0:a.customColors},b={base:f.getBlockByName("baseColor"),fresnel:f.getBlockByName("fresnelColor"),fingerColor:f.getBlockByName("fingerColor"),tipFresnel:f.getBlockByName("tipFresnelColor")};b.base.value=g.base,b.fresnel.value=g.fresnel,b.fingerColor.value=g.fingerColor,b.tipFresnel.value=g.tipFresnel,["left","right"].forEach((t=>{const i="left"==t?A._LeftHandGLB:A._RightHandGLB;if(!i)throw new Error("Could not load hand model");const n=i.meshes[1];n._internalAbstractMeshDataInfo._computeBonesUsingShaders=!0,n.material=f.clone(`${t}HandShaderClone`,!0),n.isVisible=!1,l[t]=n,c||e.useRightHandedSystem||i.meshes[1].rotate(m.RD.Y,Math.PI)})),f.dispose(),i({left:l.left,right:l.right})}))}static _GenerateDefaultHandMeshRigMapping(e){const t="right"==e?"R":"L";return{[r.WRIST]:`wrist_${t}`,[r.THUMB_METACARPAL]:`thumb_metacarpal_${t}`,[r.THUMB_PHALANX_PROXIMAL]:`thumb_proxPhalanx_${t}`,[r.THUMB_PHALANX_DISTAL]:`thumb_distPhalanx_${t}`,[r.THUMB_TIP]:`thumb_tip_${t}`,[r.INDEX_FINGER_METACARPAL]:`index_metacarpal_${t}`,[r.INDEX_FINGER_PHALANX_PROXIMAL]:`index_proxPhalanx_${t}`,[r.INDEX_FINGER_PHALANX_INTERMEDIATE]:`index_intPhalanx_${t}`,[r.INDEX_FINGER_PHALANX_DISTAL]:`index_distPhalanx_${t}`,[r.INDEX_FINGER_TIP]:`index_tip_${t}`,[r.MIDDLE_FINGER_METACARPAL]:`middle_metacarpal_${t}`,[r.MIDDLE_FINGER_PHALANX_PROXIMAL]:`middle_proxPhalanx_${t}`,[r.MIDDLE_FINGER_PHALANX_INTERMEDIATE]:`middle_intPhalanx_${t}`,[r.MIDDLE_FINGER_PHALANX_DISTAL]:`middle_distPhalanx_${t}`,[r.MIDDLE_FINGER_TIP]:`middle_tip_${t}`,[r.RING_FINGER_METACARPAL]:`ring_metacarpal_${t}`,[r.RING_FINGER_PHALANX_PROXIMAL]:`ring_proxPhalanx_${t}`,[r.RING_FINGER_PHALANX_INTERMEDIATE]:`ring_intPhalanx_${t}`,[r.RING_FINGER_PHALANX_DISTAL]:`ring_distPhalanx_${t}`,[r.RING_FINGER_TIP]:`ring_tip_${t}`,[r.PINKY_FINGER_METACARPAL]:`little_metacarpal_${t}`,[r.PINKY_FINGER_PHALANX_PROXIMAL]:`little_proxPhalanx_${t}`,[r.PINKY_FINGER_PHALANX_INTERMEDIATE]:`little_intPhalanx_${t}`,[r.PINKY_FINGER_PHALANX_DISTAL]:`little_distPhalanx_${t}`,[r.PINKY_FINGER_TIP]:`little_tip_${t}`}}isCompatible(){return"undefined"!=typeof XRHand}getHandByControllerId(e){return this._attachedHands[e]}getHandByHandedness(e){return"none"==e?null:this._trackingHands[e]}attach(){var e,t,i,n;return!!super.attach()&&(this._handResources={jointMeshes:A._GenerateTrackedJointMeshes(this.options),handMeshes:(null===(e=this.options.handMeshes)||void 0===e?void 0:e.customMeshes)||null,rigMappings:(null===(t=this.options.handMeshes)||void 0===t?void 0:t.customRigMappings)||null},(null===(i=this.options.handMeshes)||void 0===i?void 0:i.customMeshes)||(null===(n=this.options.handMeshes)||void 0===n?void 0:n.disableDefaultMeshes)||A._GenerateDefaultHandMeshesAsync(g.l.LastCreatedScene,this.options).then((e=>{var t,i;this._handResources.handMeshes=e,this._handResources.rigMappings={left:A._GenerateDefaultHandMeshRigMapping("left"),right:A._GenerateDefaultHandMeshRigMapping("right")},null===(t=this._trackingHands.left)||void 0===t||t.setHandMesh(this._handResources.handMeshes.left,this._handResources.rigMappings.left),null===(i=this._trackingHands.right)||void 0===i||i.setHandMesh(this._handResources.handMeshes.right,this._handResources.rigMappings.right)})),this.options.xrInput.controllers.forEach(this._attachHand),this._addNewAttachObserver(this.options.xrInput.onControllerAddedObservable,this._attachHand),this._addNewAttachObserver(this.options.xrInput.onControllerRemovedObservable,this._detachHand),!0)}_onXRFrame(e){var t,i;null===(t=this._trackingHands.left)||void 0===t||t.updateFromXRFrame(e,this._xrSessionManager.referenceSpace),null===(i=this._trackingHands.right)||void 0===i||i.updateFromXRFrame(e,this._xrSessionManager.referenceSpace)}_detachHandById(e){var t;const i=this.getHandByControllerId(e);if(i){const n="left"==i.xrController.inputSource.handedness?"left":"right";(null===(t=this._trackingHands[n])||void 0===t?void 0:t.xrController.uniqueId)===e&&(this._trackingHands[n]=null),this.onHandRemovedObservable.notifyObservers(i),i.dispose(),delete this._attachedHands[e]}}detach(){return!!super.detach()&&(Object.keys(this._attachedHands).forEach((e=>this._detachHandById(e))),!0)}dispose(){var e;super.dispose(),this.onHandAddedObservable.clear(),this.onHandRemovedObservable.clear(),this._handResources.handMeshes&&!(null===(e=this.options.handMeshes)||void 0===e?void 0:e.customMeshes)&&(this._handResources.handMeshes.left.dispose(),this._handResources.handMeshes.right.dispose(),A._RightHandGLB=null,A._LeftHandGLB=null),this._handResources.jointMeshes&&(this._handResources.jointMeshes.left.forEach((e=>e.dispose())),this._handResources.jointMeshes.right.forEach((e=>e.dispose())))}}A.Name=o.b.HAND_TRACKING,A.Version=1,A.DEFAULT_HAND_MODEL_BASE_URL="https://assets.babylonjs.com/meshes/HandMeshes/",A.DEFAULT_HAND_MODEL_RIGHT_FILENAME="r_hand_rhs.glb",A.DEFAULT_HAND_MODEL_LEFT_FILENAME="l_hand_rhs.glb",A.DEFAULT_HAND_MODEL_SHADER_URL="https://assets.babylonjs.com/meshes/HandMeshes/handsShader.json",A._ICOSPHERE_PARAMS={radius:.5,flat:!1,subdivisions:2},A._RightHandGLB=null,A._LeftHandGLB=null,o.d.AddWebXRFeature(A.Name,((e,t)=>()=>new A(e,t)),A.Version,!1)},"../../../node_modules/@babylonjs/core/XR/webXRFeaturesManager.js":function(e,t,i){"use strict";i.d(t,{b:function(){return r},d:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Misc/tools.js");class r{}r.ANCHOR_SYSTEM="xr-anchor-system",r.BACKGROUND_REMOVER="xr-background-remover",r.HIT_TEST="xr-hit-test",r.MESH_DETECTION="xr-mesh-detection",r.PHYSICS_CONTROLLERS="xr-physics-controller",r.PLANE_DETECTION="xr-plane-detection",r.POINTER_SELECTION="xr-controller-pointer-selection",r.TELEPORTATION="xr-controller-teleportation",r.FEATURE_POINTS="xr-feature-points",r.HAND_TRACKING="xr-hand-tracking",r.IMAGE_TRACKING="xr-image-tracking",r.NEAR_INTERACTION="xr-near-interaction",r.DOM_OVERLAY="xr-dom-overlay",r.MOVEMENT="xr-controller-movement",r.LIGHT_ESTIMATION="xr-light-estimation",r.EYE_TRACKING="xr-eye-tracking",r.WALKING_LOCOMOTION="xr-walking-locomotion",r.LAYERS="xr-layers";class s{constructor(e){this._xrSessionManager=e,this._features={},this._xrSessionManager.onXRSessionInit.add((()=>{this.getEnabledFeatures().forEach((e=>{const t=this._features[e];!t.enabled||t.featureImplementation.attached||t.featureImplementation.disableAutoAttach||this.attachFeature(e)}))})),this._xrSessionManager.onXRSessionEnded.add((()=>{this.getEnabledFeatures().forEach((e=>{const t=this._features[e];t.enabled&&t.featureImplementation.attached&&this.detachFeature(e)}))}))}static AddWebXRFeature(e,t,i=1,n=!1){this._AvailableFeatures[e]=this._AvailableFeatures[e]||{latest:i},i>this._AvailableFeatures[e].latest&&(this._AvailableFeatures[e].latest=i),n&&(this._AvailableFeatures[e].stable=i),this._AvailableFeatures[e][i]=t}static ConstructFeature(e,t=1,i,n){const r=this._AvailableFeatures[e][t];if(!r)throw new Error("feature not found");return r(i,n)}static GetAvailableFeatures(){return Object.keys(this._AvailableFeatures)}static GetAvailableVersions(e){return Object.keys(this._AvailableFeatures[e])}static GetLatestVersionOfFeature(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].latest||-1}static GetStableVersionOfFeature(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].stable||-1}attachFeature(e){const t=this._features[e];t&&t.enabled&&!t.featureImplementation.attached&&t.featureImplementation.attach()}detachFeature(e){const t=this._features[e];t&&t.featureImplementation.attached&&t.featureImplementation.detach()}disableFeature(e){const t="string"==typeof e?e:e.Name,i=this._features[t];return!(!i||!i.enabled||(i.enabled=!1,this.detachFeature(t),i.featureImplementation.dispose(),delete this._features[t],0))}dispose(){this.getEnabledFeatures().forEach((e=>{this.disableFeature(e)}))}enableFeature(e,t="latest",i={},r=!0,o=!0){const a="string"==typeof e?e:e.Name;let l=0;if("string"==typeof t){if(!t)throw new Error(`Error in provided version - ${a} (${t})`);if(l="stable"===t?s.GetStableVersionOfFeature(a):"latest"===t?s.GetLatestVersionOfFeature(a):+t,-1===l||isNaN(l))throw new Error(`feature not found - ${a} (${t})`)}else l=t;const c=s._ConflictingFeatures[a];if(void 0!==c&&-1!==this.getEnabledFeatures().indexOf(c))throw new Error(`Feature ${a} cannot be enabled while ${c} is enabled.`);const h=this._features[a],_=s.ConstructFeature(a,l,this._xrSessionManager,i);if(!_)throw new Error(`feature not found - ${a}`);h&&this.disableFeature(a);const d=_();if(d.dependsOn){const e=d.dependsOn.every((e=>!!this._features[e]));if(!e)throw new Error(`Dependant features missing. Make sure the following features are enabled - ${d.dependsOn.join(", ")}`)}if(d.isCompatible())return this._features[a]={featureImplementation:d,enabled:!0,version:l,required:o},r?this._xrSessionManager.session&&!this._features[a].featureImplementation.attached&&this.attachFeature(a):this._features[a].featureImplementation.disableAutoAttach=!0,this._features[a].featureImplementation;if(o)throw new Error("required feature not compatible");return n.w1.Warn(`Feature ${a} not compatible with the current environment/browser and was not enabled.`),d}getEnabledFeature(e){return this._features[e]&&this._features[e].featureImplementation}getEnabledFeatures(){return Object.keys(this._features)}async _extendXRSessionInitObject(e){const t=this.getEnabledFeatures();for(const i of t){const t=this._features[i],n=t.featureImplementation.xrNativeFeatureName;if(n&&(t.required?(e.requiredFeatures=e.requiredFeatures||[],-1===e.requiredFeatures.indexOf(n)&&e.requiredFeatures.push(n)):(e.optionalFeatures=e.optionalFeatures||[],-1===e.optionalFeatures.indexOf(n)&&e.optionalFeatures.push(n))),t.featureImplementation.getXRSessionInitExtension){const i=await t.featureImplementation.getXRSessionInitExtension();e={...e,...i}}}return e}}s._AvailableFeatures={},s._ConflictingFeatures={[r.TELEPORTATION]:r.MOVEMENT,[r.MOVEMENT]:r.TELEPORTATION}},"../../../node_modules/@babylonjs/core/abstractScene.js":function(e,t,i){"use strict";i.d(t,{p:function(){return n}});class n{constructor(){this.rootNodes=new Array,this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=[],this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.actionManagers=new Array,this.textures=new Array,this._environmentTexture=null,this.postProcesses=new Array}static AddParser(e,t){this._BabylonFileParsers[e]=t}static GetParser(e){return this._BabylonFileParsers[e]?this._BabylonFileParsers[e]:null}static AddIndividualParser(e,t){this._IndividualBabylonFileParsers[e]=t}static GetIndividualParser(e){return this._IndividualBabylonFileParsers[e]?this._IndividualBabylonFileParsers[e]:null}static Parse(e,t,i,n){for(const r in this._BabylonFileParsers)Object.prototype.hasOwnProperty.call(this._BabylonFileParsers,r)&&this._BabylonFileParsers[r](e,t,i,n)}get environmentTexture(){return this._environmentTexture}set environmentTexture(e){this._environmentTexture=e}getNodes(){let e=new Array;return e=e.concat(this.meshes),e=e.concat(this.lights),e=e.concat(this.cameras),e=e.concat(this.transformNodes),this.skeletons.forEach((t=>e=e.concat(t.bones))),e}}n._BabylonFileParsers={},n._IndividualBabylonFileParsers={}},"../../../node_modules/@babylonjs/core/assetContainer.js":function(e,t,i){"use strict";i.d(t,{TJ:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/abstractScene.js"),r=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),s=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),o=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js");class a extends n.p{}class l{constructor(){this.rootNodes=[],this.skeletons=[],this.animationGroups=[]}}class c extends n.p{constructor(e){super(),this._wasAddedToScene=!1,(e=e||o.l.LastCreatedScene)&&(this.scene=e,this.sounds=[],this.effectLayers=[],this.layers=[],this.lensFlareSystems=[],this.proceduralTextures=[],this.reflectionProbes=[],e.onDisposeObservable.add((()=>{this._wasAddedToScene||this.dispose()})),this._onContextRestoredObserver=e.getEngine().onContextRestoredObservable.add((()=>{for(const e of this.geometries)e._rebuild();for(const e of this.meshes)e._rebuild();for(const e of this.particleSystems)e.rebuild();for(const e of this.textures)e._rebuild()})))}instantiateModelsToScene(e,t=!1,i){const n={},s={},o=new l,a=[],c=[],h={doNotInstantiate:!0,...i};h.doNotInstantiate||(h.doNotInstantiate=e=>!!e.skeleton);const _=(t,i)=>{if(n[t.uniqueId]=i.uniqueId,s[i.uniqueId]=i,e&&(i.name=e(t.name)),i instanceof r.Kj){const e=i;if(e.morphTargetManager){const i=t.morphTargetManager;e.morphTargetManager=i.clone();for(let t=0;t{if((!h.predicate||h.predicate(e))&&!e.parent){const t=e.instantiateHierarchy(null,h,((e,t)=>{_(e,t)}));t&&o.rootNodes.push(t)}}));const d=this.meshes.some((e=>"InstancedMesh"===e.getClassName())),u=[],p=(i,r)=>{if(_(i,r),r.material){const o=r;if(o.material)if(t){const t=i.material;if(-1===c.indexOf(t)){let i=t.clone(e?e(t.name):"Clone of "+t.name);if(c.push(t),n[t.uniqueId]=i.uniqueId,s[i.uniqueId]=i,"MultiMaterial"===t.getClassName()){const r=t;for(const t of r.subMaterials)t&&(i=t.clone(e?e(t.name):"Clone of "+t.name),c.push(t),n[t.uniqueId]=i.uniqueId,s[i.uniqueId]=i);r.subMaterials=r.subMaterials.map((e=>e&&s[n[e.uniqueId]]))}}"InstancedMesh"!==o.getClassName()&&(o.material=s[n[t.uniqueId]])}else"MultiMaterial"===o.material.getClassName()?-1===this.scene.multiMaterials.indexOf(o.material)&&this.scene.addMultiMaterial(o.material):-1===this.scene.materials.indexOf(o.material)&&this.scene.addMaterial(o.material)}};return this.meshes.forEach(((e,t)=>{if((!h.predicate||h.predicate(e))&&!e.parent){const i="InstancedMesh"===e.getClassName();let n;if(i){const t=e.sourceMesh,i=this.meshes.indexOf(t);-1!==i&&u[i]&&(n=u[i])}const r=i?e.instantiateHierarchy(null,{...h,newSourcedMesh:n},p):e.instantiateHierarchy(null,h,p);r&&(d&&"InstancedMesh"!==r.getClassName()&&(u[t]=r),o.rootNodes.push(r))}})),this.skeletons.forEach((t=>{if(h.predicate&&!h.predicate(t))return;const i=t.clone(e?e(t.name):"Clone of "+t.name);for(const e of this.meshes)if(e.skeleton===t&&!e.isAnInstance){const t=s[n[e.uniqueId]];if(t.isAnInstance)continue;if(t.skeleton=i,-1!==a.indexOf(i))continue;a.push(i);for(const e of i.bones)e._linkedTransformNode&&(e._linkedTransformNode=s[n[e._linkedTransformNode.uniqueId]])}o.skeletons.push(i)})),this.animationGroups.forEach((t=>{if(h.predicate&&!h.predicate(t))return;const i=t.clone(e?e(t.name):"Clone of "+t.name,(e=>s[n[e.uniqueId]]||e));o.animationGroups.push(i)})),o}addAllToScene(){if(!this._wasAddedToScene){this._wasAddedToScene=!0,this.addToScene(null),this.environmentTexture&&(this.scene.environmentTexture=this.environmentTexture);for(const e of this.scene._serializableComponents)e.addFromContainer(this);this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null}}addToScene(e=null){this.cameras.forEach((t=>{e&&!e(t)||this.scene.addCamera(t)})),this.lights.forEach((t=>{e&&!e(t)||this.scene.addLight(t)})),this.meshes.forEach((t=>{e&&!e(t)||this.scene.addMesh(t)})),this.skeletons.forEach((t=>{e&&!e(t)||this.scene.addSkeleton(t)})),this.animations.forEach((t=>{e&&!e(t)||this.scene.addAnimation(t)})),this.animationGroups.forEach((t=>{e&&!e(t)||this.scene.addAnimationGroup(t)})),this.multiMaterials.forEach((t=>{e&&!e(t)||this.scene.addMultiMaterial(t)})),this.materials.forEach((t=>{e&&!e(t)||this.scene.addMaterial(t)})),this.morphTargetManagers.forEach((t=>{e&&!e(t)||this.scene.addMorphTargetManager(t)})),this.geometries.forEach((t=>{e&&!e(t)||this.scene.addGeometry(t)})),this.transformNodes.forEach((t=>{e&&!e(t)||this.scene.addTransformNode(t)})),this.actionManagers.forEach((t=>{e&&!e(t)||this.scene.addActionManager(t)})),this.textures.forEach((t=>{e&&!e(t)||this.scene.addTexture(t)})),this.reflectionProbes.forEach((t=>{e&&!e(t)||this.scene.addReflectionProbe(t)}))}removeAllFromScene(){this._wasAddedToScene=!1,this.removeFromScene(null),this.environmentTexture===this.scene.environmentTexture&&(this.scene.environmentTexture=null);for(const e of this.scene._serializableComponents)e.removeFromContainer(this)}removeFromScene(e=null){this.cameras.forEach((t=>{e&&!e(t)||this.scene.removeCamera(t)})),this.lights.forEach((t=>{e&&!e(t)||this.scene.removeLight(t)})),this.meshes.forEach((t=>{e&&!e(t)||this.scene.removeMesh(t)})),this.skeletons.forEach((t=>{e&&!e(t)||this.scene.removeSkeleton(t)})),this.animations.forEach((t=>{e&&!e(t)||this.scene.removeAnimation(t)})),this.animationGroups.forEach((t=>{e&&!e(t)||this.scene.removeAnimationGroup(t)})),this.multiMaterials.forEach((t=>{e&&!e(t)||this.scene.removeMultiMaterial(t)})),this.materials.forEach((t=>{e&&!e(t)||this.scene.removeMaterial(t)})),this.morphTargetManagers.forEach((t=>{e&&!e(t)||this.scene.removeMorphTargetManager(t)})),this.geometries.forEach((t=>{e&&!e(t)||this.scene.removeGeometry(t)})),this.transformNodes.forEach((t=>{e&&!e(t)||this.scene.removeTransformNode(t)})),this.actionManagers.forEach((t=>{e&&!e(t)||this.scene.removeActionManager(t)})),this.textures.forEach((t=>{e&&!e(t)||this.scene.removeTexture(t)})),this.reflectionProbes.forEach((t=>{e&&!e(t)||this.scene.removeReflectionProbe(t)}))}dispose(){this.cameras.slice(0).forEach((e=>{e.dispose()})),this.cameras.length=0,this.lights.slice(0).forEach((e=>{e.dispose()})),this.lights.length=0,this.meshes.slice(0).forEach((e=>{e.dispose()})),this.meshes.length=0,this.skeletons.slice(0).forEach((e=>{e.dispose()})),this.skeletons.length=0,this.animationGroups.slice(0).forEach((e=>{e.dispose()})),this.animationGroups.length=0,this.multiMaterials.slice(0).forEach((e=>{e.dispose()})),this.multiMaterials.length=0,this.materials.slice(0).forEach((e=>{e.dispose()})),this.materials.length=0,this.geometries.slice(0).forEach((e=>{e.dispose()})),this.geometries.length=0,this.transformNodes.slice(0).forEach((e=>{e.dispose()})),this.transformNodes.length=0,this.actionManagers.slice(0).forEach((e=>{e.dispose()})),this.actionManagers.length=0,this.textures.slice(0).forEach((e=>{e.dispose()})),this.textures.length=0,this.reflectionProbes.slice(0).forEach((e=>{e.dispose()})),this.reflectionProbes.length=0,this.environmentTexture&&(this.environmentTexture.dispose(),this.environmentTexture=null);for(const e of this.scene._serializableComponents)e.removeFromContainer(this,!0);this._onContextRestoredObserver&&(this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)}_moveAssets(e,t,i){if(e)for(const n of e){let e=!0;if(i)for(const t of i)if(n===t){e=!1;break}e&&(t.push(n),n._parentContainer=this)}}moveAllFromScene(e){this._wasAddedToScene=!1,void 0===e&&(e=new a);for(const t in this)Object.prototype.hasOwnProperty.call(this,t)&&(this[t]=this[t]||("environmentTexture"===t?null:[]),this._moveAssets(this.scene[t],this[t],e[t]));this.environmentTexture=this.scene.environmentTexture,this.removeAllFromScene()}createRootMesh(){const e=new r.Kj("assetContainerRootMesh",this.scene);return this.meshes.forEach((t=>{t.parent||e.addChild(t)})),this.meshes.unshift(e),e}mergeAnimationsTo(e=o.l.LastCreatedScene,t,i=null){if(!e)return s.Y.Error("No scene available to merge animations to"),[];const n=i||(t=>{let i=null;const n=t.animations.length?t.animations[0].targetProperty:"",r=t.name.split(".").join("").split("_primitive")[0];switch(n){case"position":case"rotationQuaternion":i=e.getTransformNodeByName(t.name)||e.getTransformNodeByName(r);break;case"influence":i=e.getMorphTargetByName(t.name)||e.getMorphTargetByName(r);break;default:i=e.getNodeByName(t.name)||e.getNodeByName(r)}return i});this.getNodes().forEach((e=>{const t=n(e);if(null!==t){for(const i of e.animations){const e=t.animations.filter((e=>e.targetProperty===i.targetProperty));for(const i of e){const e=t.animations.indexOf(i,0);e>-1&&t.animations.splice(e,1)}}t.animations=t.animations.concat(e.animations)}}));const r=new Array;return this.animationGroups.slice().forEach((e=>{r.push(e.clone(e.name,n)),e.animatables.forEach((e=>{e.stop()}))})),t.forEach((t=>{const i=n(t.target);i&&(e.beginAnimation(i,t.fromFrame,t.toFrame,t.loopAnimation,t.speedRatio,t.onAnimationEnd?t.onAnimationEnd:void 0,void 0,!0,void 0,t.onAnimationLoop?t.onAnimationLoop:void 0),e.stopAnimation(t.target))})),r}}},"../../../node_modules/@babylonjs/core/index.js":function(e,t,i){"use strict";i.d(t,{x23:function(){return zi.x},bei:function(){return Ka},fwF:function(){return y.f},YfP:function(){return We},TJ4:function(){return L.TJ},SpM:function(){return wd},wMC:function(){return Ki},RDh:function(){return Br.RD},V1s:function(){return Le.V},RSz:function(){return Oa},Wot:function(){return Br.Wo},HEv:function(){return Br.HE},gTE:function(){return Sn.g},Ox3:function(){return Zs.O},KpW:function(){return O},D4V:function(){return k.D},Pj8:function(){return ca},kn4:function(){return Br.kn},cMO:function(){return pa},ezm:function(){return jt.e},H1p:function(){return ma},y3G:function(){return Br.y3},Kj0:function(){return je.Kj},VO7:function(){return Wh},F3H:function(){return e_.F3},NBX:function(){return Ue.N},y$z:function(){return s.y$},YVB:function(){return yo.Y},pcH:function(){return h_},zRS:function(){return Pn.z},Q03:function(){return tn.Q},JOQ:function(){return Br.JO},clv:function(){return e_.cl},kD3:function(){return Z.kD},_fP:function(){return Br._f},zHn:function(){return tt.z},lSG:function(){return fn},_iX:function(){return Ot._},tYM:function(){return Aa.t},$v2:function(){return Aa.$},Rus:function(){return ve.R},xsS:function(){return R.x},Cye:function(){return ha},uXA:function(){return Ca},biB:function(){return B},$uU:function(){return j.$},TaI:function(){return Br.T},Ai6:function(){return e_.Ai},PMe:function(){return to.P},jyi:function(){return gd},ZmM:function(){return vd},KuD:function(){return Yt.K},xEZ:function(){return K.x},YOI:function(){return Et.Y},Ms4:function(){return Dt.M},xcu:function(){return lt},FM8:function(){return Br.FM},Pa4:function(){return Br.P},Ltg:function(){return Br.Lt},xx8:function(){return ci.x},l_w:function(){return Br.l_}});var n=i("../../../node_modules/@babylonjs/core/abstractScene.js"),r=i("../../../node_modules/@babylonjs/core/Actions/abstractActionManager.js"),s=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),o=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),a=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),l=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class c{constructor(e,t){this.triggerOptions=e,this.onBeforeExecuteObservable=new s.y$,e.parameter?(this.trigger=e.trigger,this._triggerParameter=e.parameter):e.trigger?this.trigger=e.trigger:this.trigger=e,this._nextActiveAction=this,this._condition=t}_prepare(){}getTriggerParameter(){return this._triggerParameter}setTriggerParameter(e){this._triggerParameter=e}_evaluateConditionForCurrentFrame(){const e=this._condition;if(!e)return!0;const t=this._actionManager.getScene().getRenderId();return e._evaluationId!==t&&(e._evaluationId=t,e._currentResult=e.isValid()),e._currentResult}_executeCurrent(e){this._evaluateConditionForCurrentFrame()&&(this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(e),this.skipToNextActiveAction())}execute(e){}skipToNextActiveAction(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this}then(e){return this._child=e,e._actionManager=this._actionManager,e._prepare(),e}_getProperty(e){return this._actionManager._getProperty(e)}_getEffectiveTarget(e,t){return this._actionManager._getEffectiveTarget(e,t)}serialize(e){}_serialize(e,t){const i={type:1,children:[],name:e.name,properties:e.properties||[]};if(this._child&&this._child.serialize(i),this._condition){const e=this._condition.serialize();return e.children.push(i),t&&t.children.push(e),e}return t&&t.children.push(i),i}}c._SerializeValueAsString=e=>"number"==typeof e?e.toString():"boolean"==typeof e?e?"true":"false":e instanceof o.FM?e.x+", "+e.y:e instanceof o.P?e.x+", "+e.y+", "+e.z:e instanceof a.Wo?e.r+", "+e.g+", "+e.b:e instanceof a.HE?e.r+", "+e.g+", "+e.b+", "+e.a:e,c._GetTargetProperty=e=>({name:"target",targetType:e._isMesh?"MeshProperties":e._isLight?"LightProperties":e._isCamera?"CameraProperties":"SceneProperties",value:e._isScene?"Scene":e.name}),(0,l.H)("BABYLON.Action",c);var h=i("../../../node_modules/@babylonjs/core/Actions/actionEvent.js");class _{constructor(e){this._actionManager=e}isValid(){return!0}_getProperty(e){return this._actionManager._getProperty(e)}_getEffectiveTarget(e,t){return this._actionManager._getEffectiveTarget(e,t)}serialize(){}_serialize(e){return{type:2,children:[],name:e.name,properties:e.properties}}}class d extends _{constructor(e,t,i,n,r=d.IsEqual){super(e),this.propertyPath=i,this.value=n,this.operator=r,this._target=t,this._effectiveTarget=this._getEffectiveTarget(t,this.propertyPath),this._property=this._getProperty(this.propertyPath)}static get IsEqual(){return d._IsEqual}static get IsDifferent(){return d._IsDifferent}static get IsGreater(){return d._IsGreater}static get IsLesser(){return d._IsLesser}isValid(){switch(this.operator){case d.IsGreater:return this._effectiveTarget[this._property]>this.value;case d.IsLesser:return this._effectiveTarget[this._property]-1&&this._scene.actionManagers.splice(e,1)}getScene(){return this._scene}hasSpecificTriggers(e){for(let t=0;t-1)return!0}return!1}hasSpecificTriggers2(e,t){for(let i=0;i=b.OnPickTrigger&&t.trigger<=b.OnPointerOutTrigger)return!0}return!1}get hasPickTriggers(){for(let e=0;e=b.OnPickTrigger&&t.trigger<=b.OnPickUpTrigger)return!0}return!1}registerAction(e){return e.trigger===b.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(u.Y.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),b.Triggers[e.trigger]?b.Triggers[e.trigger]++:b.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)}unregisterAction(e){const t=this.actions.indexOf(e);return-1!==t&&(this.actions.splice(t,1),b.Triggers[e.trigger]-=1,0===b.Triggers[e.trigger]&&delete b.Triggers[e.trigger],e._actionManager=null,!0)}processTrigger(e,t){for(let i=0;i{if(null===n){const e=parseFloat(t);return"true"===t||"false"===t?"true"===t:isNaN(e)?t:e}const r=n.split("."),s=t.split(",");for(let e=0;e{if(e.detached)return;const h=new Array;let u=null,f=null;const m=e.combine&&e.combine.length>0;if(2===e.type?h.push(n):h.push(t),m){const t=new Array;for(let i=0;i{const i=(0,l.q)("BABYLON."+e);if(i){const e=Object.create(i.prototype);return e.constructor.apply(e,t),e}})(e.name,h);if(g instanceof _&&null!==o){const e=new p(t,o);a?a.then(e):n.registerAction(e),a=e}null===c?g instanceof _?(o=g,g=a):(o=null,a?a.then(g):n.registerAction(g)):c.push(g);for(let i=0;i0){const e=r.properties[0].value,t=null===r.properties[0].targetType?e:i.getMeshByName(e);t._meshId&&(t.mesh=i.getMeshById(t._meshId)),n={trigger:b[r.name],parameter:t}}else n=b[r.name];for(let e=0;e{this.onInterpolationDoneObservable.notifyObservers(this),this.onInterpolationDone&&this.onInterpolationDone()}))}serialize(e){return super._serialize({name:"InterpolateValueAction",properties:[c._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:c._SerializeValueAsString(this.value)},{name:"duration",value:c._SerializeValueAsString(this.duration)},{name:"stopOtherAnimations",value:c._SerializeValueAsString(this.stopOtherAnimations)||!1}]},e)}});var v=i("../../../node_modules/@babylonjs/core/Maths/math.size.js");const A=Object.freeze(new o._f(0,0,0,0)),C=Object.freeze(o.P.Zero()),S=Object.freeze(o.FM.Zero()),x=Object.freeze(v.$.Zero()),T=Object.freeze(a.Wo.Black());class E{constructor(e,t,i,n){if(this._events=new Array,this._currentFrame=0,this._originalValue=new Array,this._originalBlendValue=null,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._currentValue=null,this._currentActiveTarget=null,this._directTarget=null,this._targetPath="",this._weight=1,this._ratioOffset=0,this._previousDelay=0,this._previousRatio=0,this._targetIsArray=!1,this._animation=t,this._target=e,this._scene=i,this._host=n,this._activeTargets=[],t._runtimeAnimations.push(this),this._animationState={key:0,repeatCount:0,loopMode:this._getCorrectLoopMode()},this._animation.dataType===y.f.ANIMATIONTYPE_MATRIX&&(this._animationState.workValue=o.y3.Zero()),this._keys=this._animation.getKeys(),this._minFrame=this._keys[0].frame,this._maxFrame=this._keys[this._keys.length-1].frame,this._minValue=this._keys[0].value,this._maxValue=this._keys[this._keys.length-1].value,0!==this._minFrame){const e={frame:0,value:this._minValue};this._keys.splice(0,0,e)}if(this._target instanceof Array){let e=0;for(const t of this._target)this._preparePath(t,e),this._getOriginalValues(e),e++;this._targetIsArray=!0}else this._preparePath(this._target),this._getOriginalValues(),this._targetIsArray=!1,this._directTarget=this._activeTargets[0];const r=t.getEvents();r&&r.length>0&&r.forEach((e=>{this._events.push(e._clone())})),this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}get currentFrame(){return this._currentFrame}get weight(){return this._weight}get currentValue(){return this._currentValue}get targetPath(){return this._targetPath}get target(){return this._currentActiveTarget}get isAdditive(){return this._host&&this._host.isAdditive}_preparePath(e,t=0){const i=this._animation.targetPropertyPath;if(i.length>1){let n=e[i[0]];for(let e=1;e-1&&this._animation.runtimeAnimations.splice(e,1)}setValue(e,t){if(this._targetIsArray)for(let i=0;it[t.length-1].frame&&(e=t[t.length-1].frame);const i=this._events;if(i.length)for(let t=0;tthis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame);const c=i-t;let h;const _=e*(o.framePerSecond*r)/1e3+this._ratioOffset;let d,u=0;if(this._previousDelay=e,this._previousRatio=_,!n&&i>=t&&_>=c)l=!1,u=o._getKeyValue(this._maxValue);else if(!n&&t>=i&&_<=c)l=!1,u=o._getKeyValue(this._minValue);else if(this._animationState.loopMode!==y.f.ANIMATIONLOOPMODE_CYCLE){const e=i.toString()+t.toString();if(!this._offsetsCache[e]){this._animationState.repeatCount=0,this._animationState.loopMode=y.f.ANIMATIONLOOPMODE_CYCLE;const n=o._interpolate(t,this._animationState),r=o._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),o.dataType){case y.f.ANIMATIONTYPE_FLOAT:this._offsetsCache[e]=r-n;break;case y.f.ANIMATIONTYPE_QUATERNION:case y.f.ANIMATIONTYPE_VECTOR3:case y.f.ANIMATIONTYPE_VECTOR2:case y.f.ANIMATIONTYPE_SIZE:case y.f.ANIMATIONTYPE_COLOR3:this._offsetsCache[e]=r.subtract(n)}this._highLimitsCache[e]=r}u=this._highLimitsCache[e],h=this._offsetsCache[e]}if(void 0===h)switch(o.dataType){case y.f.ANIMATIONTYPE_FLOAT:h=0;break;case y.f.ANIMATIONTYPE_QUATERNION:h=A;break;case y.f.ANIMATIONTYPE_VECTOR3:h=C;break;case y.f.ANIMATIONTYPE_VECTOR2:h=S;break;case y.f.ANIMATIONTYPE_SIZE:h=x;break;case y.f.ANIMATIONTYPE_COLOR3:h=T}if(this._host&&this._host.syncRoot){const e=this._host.syncRoot;d=t+(i-t)*((e.masterFrame-e.fromFrame)/(e.toFrame-e.fromFrame))}else d=_>0&&t>i||_<0&&t0&&this.currentFrame>d||r<0&&this.currentFrame0?0:o.getKeys().length-1}this._currentFrame=d,this._animationState.repeatCount=0===c?0:_/c>>0,this._animationState.highLimitValue=u,this._animationState.offsetValue=h;const f=o._interpolate(d,this._animationState);if(this.setValue(f,s),p.length)for(let e=0;e0&&d>=p[e].frame&&p[e].frame>=t||c<0&&d<=p[e].frame&&p[e].frame<=t){const t=p[e];t.isDone||(t.onlyOnce&&(p.splice(e,1),e--),t.isDone=!0,t.action(d))}return l||(this._stopped=!0),l}}var R=i("../../../node_modules/@babylonjs/core/scene.js"),P=i("../../../node_modules/@babylonjs/core/Misc/precisionDate.js"),I=i("../../../node_modules/@babylonjs/core/Bones/bone.js");class M{constructor(e,t,i=0,n=100,r=!1,o=1,a,l,c,h=!1){this.target=t,this.fromFrame=i,this.toFrame=n,this.loopAnimation=r,this.onAnimationEnd=a,this.onAnimationLoop=c,this.isAdditive=h,this._localDelayOffset=null,this._pausedDelay=null,this._manualJumpDelay=null,this._runtimeAnimations=new Array,this._paused=!1,this._speedRatio=1,this._weight=-1,this._syncRoot=null,this._frameToSyncFromJump=null,this.disposeOnEnd=!0,this.animationStarted=!1,this.onAnimationEndObservable=new s.y$,this.onAnimationLoopObservable=new s.y$,this._scene=e,l&&this.appendAnimations(t,l),this._speedRatio=o,e._activeAnimatables.push(this)}get syncRoot(){return this._syncRoot}get masterFrame(){return 0===this._runtimeAnimations.length?0:this._runtimeAnimations[0].currentFrame}get weight(){return this._weight}set weight(e){this._weight=-1!==e?Math.min(Math.max(e,0),1):-1}get speedRatio(){return this._speedRatio}set speedRatio(e){for(let t=0;t-1&&(this._scene._activeAnimatables.splice(e,1),this._scene._activeAnimatables.push(this))}return this}getAnimations(){return this._runtimeAnimations}appendAnimations(e,t){for(let i=0;i{this.onAnimationLoopObservable.notifyObservers(this),this.onAnimationLoop&&this.onAnimationLoop()},this._runtimeAnimations.push(r)}}getAnimationByTargetProperty(e){const t=this._runtimeAnimations;for(let i=0;i-1){const n=this._runtimeAnimations;for(let i=n.length-1;i>=0;i--){const r=n[i];e&&r.animation.name!=e||t&&!t(r.target)||(r.dispose(),n.splice(i,1))}0==n.length&&(this._scene._activeAnimatables.splice(i,1),this._raiseOnAnimationEnd())}}else{const e=this._scene._activeAnimatables.indexOf(this);if(e>-1){this._scene._activeAnimatables.splice(e,1);const t=this._runtimeAnimations;for(let e=0;e{this.onAnimationEndObservable.add((()=>{e(this)}),void 0,void 0,this,!0)}))}_animate(e){if(this._paused)return this.animationStarted=!1,null===this._pausedDelay&&(this._pausedDelay=e),!0;if(null===this._localDelayOffset?(this._localDelayOffset=e,this._pausedDelay=null):null!==this._pausedDelay&&(this._localDelayOffset+=e-this._pausedDelay,this._pausedDelay=null),null!==this._manualJumpDelay&&(this._localDelayOffset+=this._manualJumpDelay,this._manualJumpDelay=null,this._frameToSyncFromJump=null),0===this._weight)return!0;let t=!1;const i=this._runtimeAnimations;let n;for(n=0;n0)return;this._animationTimeLast=e}this.deltaTime=this.useConstantAnimationDeltaTime?16:(e-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=e;const t=this._activeAnimatables;if(0===t.length)return;this._animationTime+=this.deltaTime;const i=this._animationTime;for(let e=0;ei&&r>0&&(r*=-1),a&&this.stopAnimation(e,void 0,l),o||(o=new M(this,e,t,i,n,r,s,void 0,c,h));const _=!l||l(e);if(e.animations&&_&&o.appendAnimations(e,e.animations),e.getAnimatables){const h=e.getAnimatables();for(let e=0;en&&s>0)s*=-1;else if(n>i&&s<0){const e=n;n=i,i=e}return new M(this,e,i,n,r,s,o,t,a,l)},R.x.prototype.beginDirectHierarchyAnimation=function(e,t,i,n,r,s,o,a,l,c=!1){const h=e.getDescendants(t),_=[];_.push(this.beginDirectAnimation(e,i,n,r,s,o,a,l,c));for(const e of h)_.push(this.beginDirectAnimation(e,i,n,r,s,o,a,l,c));return _},R.x.prototype.getAnimatableByTarget=function(e){for(let t=0;t0?c:-c,r),l.scaleAndAddToRef(c,i)}r.normalize()}for(let t=0;t0)r.copyFrom(n);else if(1===e.animations.length){if(o._f.SlerpToRef(n,i.currentValue,Math.min(1,e.totalWeight),r),0===e.totalAdditiveWeight)return r}else if(e.animations.length>1){let i,s,a=1;if(e.totalWeight<1){const t=1-e.totalWeight;i=[],s=[],i.push(n),s.push(t)}else{if(2===e.animations.length&&(o._f.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),0===e.totalAdditiveWeight))return t;i=[],s=[],a=e.totalWeight}for(let t=0;t=o&&m.frame<=a&&(n?(b=m.value.clone(),d?(g=b.getTranslation(),b.setTranslation(g.scaleInPlace(u))):p&&r?(g=b.getTranslation(),b.setTranslation(g.multiplyInPlace(r))):b=m.value):b=m.value,f.push({frame:m.frame+i,value:b}));return this.animations[0].createRange(t,o+i,a+i),!0};var D=i("../../../node_modules/@babylonjs/core/Maths/math.path.js");class O{constructor(){this._easingMode=O.EASINGMODE_EASEIN}setEasingMode(e){const t=Math.min(Math.max(e,0),2);this._easingMode=t}getEasingMode(){return this._easingMode}easeInCore(e){throw new Error("You must implement this method")}ease(e){switch(this._easingMode){case O.EASINGMODE_EASEIN:return this.easeInCore(e);case O.EASINGMODE_EASEOUT:return 1-this.easeInCore(1-e)}return e>=.5?.5*(1-this.easeInCore(2*(1-e)))+.5:.5*this.easeInCore(2*e)}}O.EASINGMODE_EASEIN=0,O.EASINGMODE_EASEOUT=1,O.EASINGMODE_EASEINOUT=2;class w extends O{easeInCore(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)}}class F extends O{easeInCore(e){return e*e}}class B extends O{easeInCore(e){return 1-Math.sin(1.5707963267948966*(1-e))}}i("../../../node_modules/@babylonjs/core/Animations/animationEvent.js");var N=i("../../../node_modules/@babylonjs/core/Animations/animationGroup.js");i("../../../node_modules/@babylonjs/core/Animations/animationKey.js"),i("../../../node_modules/@babylonjs/core/Animations/animationRange.js");var L=i("../../../node_modules/@babylonjs/core/assetContainer.js"),k=i("../../../node_modules/@babylonjs/core/Engines/engine.js"),V=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),U=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js");k.D.AudioEngineFactory=(e,t,i)=>new G(e,t,i);class G{constructor(e=null,t=null,i=null){if(this._audioContext=null,this._audioContextInitialized=!1,this._muteButton=null,this._audioDestination=null,this.canUseWebAudio=!1,this.WarnedWebAudioUnsupported=!1,this.isMP3supported=!1,this.isOGGsupported=!1,this.unlocked=!0,this.useCustomUnlockedButton=!1,this.onAudioUnlockedObservable=new s.y$,this.onAudioLockedObservable=new s.y$,this._tryToRun=!1,this._onResize=()=>{this._moveButtonToTopLeft()},!(0,U.CG)())return;void 0!==window.AudioContext&&(this.canUseWebAudio=!0);const n=document.createElement("audio");this._hostElement=e,this._audioContext=t,this._audioDestination=i;try{n&&n.canPlayType&&(n.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/,"")||n.canPlayType("audio/mp3").replace(/^no$/,""))&&(this.isMP3supported=!0)}catch(e){}try{n&&n.canPlayType&&n.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(this.isOGGsupported=!0)}catch(e){}}get audioContext(){return this._audioContextInitialized?this.unlocked||this._muteButton||this._displayMuteButton():this._initializeAudioContext(),this._audioContext}lock(){this._triggerSuspendedState()}unlock(){this._triggerRunningState()}_resumeAudioContext(){let e;return void 0!==this._audioContext.resume&&(e=this._audioContext.resume()),e||Promise.resolve()}_initializeAudioContext(){try{this.canUseWebAudio&&(this._audioContext||(this._audioContext=new AudioContext),this.masterGain=this._audioContext.createGain(),this.masterGain.gain.value=1,this._audioDestination||(this._audioDestination=this._audioContext.destination),this.masterGain.connect(this._audioDestination),this._audioContextInitialized=!0,"running"===this._audioContext.state&&this._triggerRunningState())}catch(e){this.canUseWebAudio=!1,u.Y.Error("Web Audio: "+e.message)}}_triggerRunningState(){this._tryToRun||(this._tryToRun=!0,this._resumeAudioContext().then((()=>{this._tryToRun=!1,this._muteButton&&this._hideMuteButton(),this.unlocked=!0,this.onAudioUnlockedObservable.notifyObservers(this)})).catch((()=>{this._tryToRun=!1,this.unlocked=!1})))}_triggerSuspendedState(){this.unlocked=!1,this.onAudioLockedObservable.notifyObservers(this),this._displayMuteButton()}_displayMuteButton(){if(this.useCustomUnlockedButton||this._muteButton)return;this._muteButton=document.createElement("BUTTON"),this._muteButton.className="babylonUnmuteIcon",this._muteButton.id="babylonUnmuteIconBtn",this._muteButton.title="Unmute";const e=".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url("+(window.SVGSVGElement?"data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E":"https://cdn.babylonjs.com/Assets/audio.png")+"); background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }",t=document.createElement("style");t.appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(t),document.body.appendChild(this._muteButton),this._moveButtonToTopLeft(),this._muteButton.addEventListener("touchend",(()=>{this._triggerRunningState()}),!0),this._muteButton.addEventListener("click",(()=>{this._triggerRunningState()}),!0),window.addEventListener("resize",this._onResize)}_moveButtonToTopLeft(){this._hostElement&&this._muteButton&&(this._muteButton.style.top=this._hostElement.offsetTop+20+"px",this._muteButton.style.left=this._hostElement.offsetLeft+20+"px")}_hideMuteButton(){this._muteButton&&(document.body.removeChild(this._muteButton),this._muteButton=null)}dispose(){this.canUseWebAudio&&this._audioContextInitialized&&(this._connectedAnalyser&&this._audioContext&&(this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser.dispose(),this.masterGain.disconnect(),this.masterGain.connect(this._audioContext.destination),this._connectedAnalyser=null),this.masterGain.gain.value=1),this.WarnedWebAudioUnsupported=!1,this._hideMuteButton(),window.removeEventListener("resize",this._onResize),this.onAudioUnlockedObservable.clear(),this.onAudioLockedObservable.clear()}getGlobalVolume(){return this.canUseWebAudio&&this._audioContextInitialized?this.masterGain.gain.value:-1}setGlobalVolume(e){this.canUseWebAudio&&this._audioContextInitialized&&(this.masterGain.gain.value=e)}connectToAnalyser(e){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this.canUseWebAudio&&this._audioContextInitialized&&this._audioContext&&(this._connectedAnalyser=e,this.masterGain.disconnect(),this._connectedAnalyser.connectAudioNodes(this.masterGain,this._audioContext.destination))}}var j=i("../../../node_modules/@babylonjs/core/Audio/sound.js");class W{constructor(e,t={}){this.id=-1,this._isInitialized=!1,(e=e||m.l.LastCreatedScene)&&(this._scene=e,this.soundCollection=new Array,this._options=t,!this._options.mainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1))}_initializeSoundTrackAudioGraph(){var e;(null===(e=k.D.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&k.D.audioEngine.audioContext&&(this._outputAudioNode=k.D.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(k.D.audioEngine.masterGain),this._options&&this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._isInitialized=!0)}dispose(){if(k.D.audioEngine&&k.D.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}}addSound(e){var t;this._isInitialized||this._initializeSoundTrackAudioGraph(),(null===(t=k.D.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&e.connectToSoundTrackAudioNode(this._outputAudioNode),e.soundTrackId&&(-1===e.soundTrackId?this._scene.mainSoundTrack.removeSound(e):this._scene.soundTracks&&this._scene.soundTracks[e.soundTrackId].removeSound(e)),this.soundCollection.push(e),e.soundTrackId=this.id}removeSound(e){const t=this.soundCollection.indexOf(e);-1!==t&&this.soundCollection.splice(t,1)}setVolume(e){var t;(null===(t=k.D.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)}switchPanningModelToHRTF(){var e;if(null===(e=k.D.audioEngine)||void 0===e?void 0:e.canUseWebAudio)for(let e=0;e{var r;let s,o=[];if(i.sounds=i.sounds||[],void 0!==e.sounds&&null!==e.sounds)for(let a=0,l=e.sounds.length;a{e.play(),e.autoplay=!0,this.scene.mainSoundTrack.addSound(e)}))}removeFromContainer(e,t=!1){e.sounds&&e.sounds.forEach((e=>{e.stop(),e.autoplay=!1,this.scene.mainSoundTrack.removeSound(e),t&&e.dispose()}))}dispose(){const e=this.scene;if(e._mainSoundTrack&&e.mainSoundTrack.dispose(),e.soundTracks)for(let t=0;t0?t.activeCameras[0]:t.activeCamera,e?(this._cachedCameraPosition.equals(e.globalPosition)||(this._cachedCameraPosition.copyFrom(e.globalPosition),i.audioContext.listener.setPosition(e.globalPosition.x,e.globalPosition.y,e.globalPosition.z)),e.rigCameras&&e.rigCameras.length>0&&(e=e.rigCameras[0]),e.getViewMatrix().invertToRef(this._invertMatrixTemp),o.P.TransformNormalToRef(H._CameraDirection,this._invertMatrixTemp,this._cameraDirectionTemp),this._cameraDirectionTemp.normalize(),isNaN(this._cameraDirectionTemp.x)||isNaN(this._cameraDirectionTemp.y)||isNaN(this._cameraDirectionTemp.z)||this._cachedCameraDirection.equals(this._cameraDirectionTemp)||(this._cachedCameraDirection.copyFrom(this._cameraDirectionTemp),i.audioContext.listener.setOrientation(this._cameraDirectionTemp.x,this._cameraDirectionTemp.y,this._cameraDirectionTemp.z,0,1,0))):i.audioContext.listener.setPosition(0,0,0)}let e;for(e=0;e{let t=e._getComponent(z.l.NAME_AUDIO);t||(t=new H(e),e._addComponent(t))},i("../../../node_modules/@babylonjs/core/Audio/weightedsound.js");var X=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),Y=i("../../../node_modules/@babylonjs/core/Misc/decorators.js");class Q{constructor(e){this._texture=null,this._isEnabled=!0,this.isEnabled=!0,this.time=0,(e=e||m.l.LastCreatedScene)&&(this._scene=e,this.animationParameters=new o.Lt(0,0,0,30))}_markSubMeshesAsAttributesDirty(){for(const e of this._scene.meshes)e.bakedVertexAnimationManager===this&&e._markSubMeshesAsAttributesDirty()}bind(e,t=!1){if(!this._texture||!this._isEnabled)return;const i=this._texture.getSize();e.setFloat2("bakedVertexAnimationTextureSizeInverted",1/i.width,1/i.height),e.setFloat("bakedVertexAnimationTime",this.time),t||e.setVector4("bakedVertexAnimationSettings",this.animationParameters),e.setTexture("bakedVertexAnimationTexture",this._texture)}clone(){const e=new Q(this._scene);return this.copyTo(e),e}setAnimationParameters(e,t,i=0,n=30){this.animationParameters=new o.Lt(e,t,i,n)}dispose(e){var t;e&&(null===(t=this._texture)||void 0===t||t.dispose())}getClassName(){return"BakedVertexAnimationManager"}copyTo(e){Y.p4.Clone((()=>e),this)}serialize(){return Y.p4.Serialize(this)}parse(e,t,i){Y.p4.Parse((()=>this),e,t,i)}}(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markSubMeshesAsAttributesDirty")],Q.prototype,"texture",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markSubMeshesAsAttributesDirty")],Q.prototype,"isEnabled",void 0),(0,X.gn)([(0,Y.qC)()],Q.prototype,"animationParameters",void 0),(0,X.gn)([(0,Y.qC)()],Q.prototype,"time",void 0);var q=i("../../../node_modules/@babylonjs/core/Materials/Textures/rawTexture.js"),K=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js");i("../../../node_modules/@babylonjs/core/Misc/stringTools.js");var Z=i("../../../node_modules/@babylonjs/core/Events/pointerEvents.js"),$=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js");class J{constructor(){this._zoomStopsAnimation=!1,this._idleRotationSpeed=.05,this._idleRotationWaitTime=2e3,this._idleRotationSpinupTime=2e3,this.targetAlpha=null,this._isPointerDown=!1,this._lastFrameTime=null,this._lastInteractionTime=-1/0,this._cameraRotationSpeed=0,this._lastFrameRadius=0}get name(){return"AutoRotation"}set zoomStopsAnimation(e){this._zoomStopsAnimation=e}get zoomStopsAnimation(){return this._zoomStopsAnimation}set idleRotationSpeed(e){this._idleRotationSpeed=e}get idleRotationSpeed(){return this._idleRotationSpeed}set idleRotationWaitTime(e){this._idleRotationWaitTime=e}get idleRotationWaitTime(){return this._idleRotationWaitTime}set idleRotationSpinupTime(e){this._idleRotationSpinupTime=e}get idleRotationSpinupTime(){return this._idleRotationSpinupTime}get rotationInProgress(){return Math.abs(this._cameraRotationSpeed)>0}init(){}attach(e){this._attachedCamera=e;const t=this._attachedCamera.getScene();this._onPrePointerObservableObserver=t.onPrePointerObservable.add((e=>{e.type!==Z.kD.POINTERDOWN?e.type===Z.kD.POINTERUP&&(this._isPointerDown=!1):this._isPointerDown=!0})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((()=>{if(this._reachTargetAlpha())return;const e=P.F.Now;let t=0;null!=this._lastFrameTime&&(t=e-this._lastFrameTime),this._lastFrameTime=e,this._applyUserInteraction();const i=e-this._lastInteractionTime-this._idleRotationWaitTime,n=Math.max(Math.min(i/this._idleRotationSpinupTime,1),0);this._cameraRotationSpeed=this._idleRotationSpeed*n,this._attachedCamera&&(this._attachedCamera.alpha-=this._cameraRotationSpeed*(t/1e3))}))}detach(){if(!this._attachedCamera)return;const e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null}resetLastInteractionTime(e){this._lastInteractionTime=null!=e?e:P.F.Now}_reachTargetAlpha(){return!(!this._attachedCamera||!this.targetAlpha)&&Math.abs(this._attachedCamera.alpha-this.targetAlpha)<$.kn}_userIsZooming(){return!!this._attachedCamera&&0!==this._attachedCamera.inertialRadiusOffset}_shouldAnimationStopForInteraction(){if(!this._attachedCamera)return!1;let e=!1;return this._lastFrameRadius===this._attachedCamera.radius&&0!==this._attachedCamera.inertialRadiusOffset&&(e=!0),this._lastFrameRadius=this._attachedCamera.radius,this._zoomStopsAnimation?e:this._userIsZooming()}_applyUserInteraction(){this._userIsMoving()&&!this._shouldAnimationStopForInteraction()&&(this._lastInteractionTime=P.F.Now)}_userIsMoving(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)}}class ee{constructor(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.upperRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}get name(){return"Bouncing"}get autoTransitionRange(){return this._autoTransitionRange}set autoTransitionRange(e){if(this._autoTransitionRange===e)return;this._autoTransitionRange=e;const t=this._attachedCamera;t&&(e?this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add((e=>{if(!e)return;e.computeWorldMatrix(!0);const t=e.getBoundingInfo().diagonalLength;this.lowerRadiusTransitionRange=.05*t,this.upperRadiusTransitionRange=.05*t})):this._onMeshTargetChangedObserver&&t.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver))}init(){}attach(e){this._attachedCamera=e,this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((()=>{this._attachedCamera&&(this._isRadiusAtLimit(this._attachedCamera.lowerRadiusLimit)&&this._applyBoundRadiusAnimation(this.lowerRadiusTransitionRange),this._isRadiusAtLimit(this._attachedCamera.upperRadiusLimit)&&this._applyBoundRadiusAnimation(this.upperRadiusTransitionRange))}))}detach(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)}_isRadiusAtLimit(e){return!!this._attachedCamera&&this._attachedCamera.radius===e&&!this._radiusIsAnimating}_applyBoundRadiusAnimation(e){if(!this._attachedCamera)return;this._radiusBounceTransition||(ee.EasingFunction.setEasingMode(ee.EasingMode),this._radiusBounceTransition=y.f.CreateAnimation("radius",y.f.ANIMATIONTYPE_FLOAT,60,ee.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0;const t=y.f.TransitionTo("radius",this._attachedCamera.radius+e,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,(()=>this._clearAnimationLocks()));t&&this._animatables.push(t)}_clearAnimationLocks(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)}stopAllAnimations(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()}}ee.EasingFunction=new class extends O{constructor(e=1){super(),this.amplitude=e}easeInCore(e){const t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)}}(.3),ee.EasingMode=O.EASINGMODE_EASEOUT;class te{constructor(){this.onTargetFramingAnimationEndObservable=new s.y$,this._mode=te.FitFrustumSidesMode,this._radiusScale=1,this._positionScale=.5,this._defaultElevation=.3,this._elevationReturnTime=1500,this._elevationReturnWaitTime=1e3,this._zoomStopsAnimation=!1,this._framingTime=1500,this.autoCorrectCameraLimitsAndSensibility=!0,this._isPointerDown=!1,this._lastInteractionTime=-1/0,this._animatables=new Array,this._betaIsAnimating=!1}get name(){return"Framing"}set mode(e){this._mode=e}get mode(){return this._mode}set radiusScale(e){this._radiusScale=e}get radiusScale(){return this._radiusScale}set positionScale(e){this._positionScale=e}get positionScale(){return this._positionScale}set defaultElevation(e){this._defaultElevation=e}get defaultElevation(){return this._defaultElevation}set elevationReturnTime(e){this._elevationReturnTime=e}get elevationReturnTime(){return this._elevationReturnTime}set elevationReturnWaitTime(e){this._elevationReturnWaitTime=e}get elevationReturnWaitTime(){return this._elevationReturnWaitTime}set zoomStopsAnimation(e){this._zoomStopsAnimation=e}get zoomStopsAnimation(){return this._zoomStopsAnimation}set framingTime(e){this._framingTime=e}get framingTime(){return this._framingTime}init(){}attach(e){this._attachedCamera=e;const t=this._attachedCamera.getScene();te.EasingFunction.setEasingMode(te.EasingMode),this._onPrePointerObservableObserver=t.onPrePointerObservable.add((e=>{e.type!==Z.kD.POINTERDOWN?e.type===Z.kD.POINTERUP&&(this._isPointerDown=!1):this._isPointerDown=!0})),this._onMeshTargetChangedObserver=e.onMeshTargetChangedObservable.add((e=>{e&&this.zoomOnMesh(e,void 0,(()=>{this.onTargetFramingAnimationEndObservable.notifyObservers()}))})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((()=>{this._applyUserInteraction(),this._maintainCameraAboveGround()}))}detach(){if(!this._attachedCamera)return;const e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null}zoomOnMesh(e,t=!1,i=null){e.computeWorldMatrix(!0);const n=e.getBoundingInfo().boundingBox;this.zoomOnBoundingInfo(n.minimumWorld,n.maximumWorld,t,i)}zoomOnMeshHierarchy(e,t=!1,i=null){e.computeWorldMatrix(!0);const n=e.getHierarchyBoundingVectors(!0);this.zoomOnBoundingInfo(n.min,n.max,t,i)}zoomOnMeshesHierarchy(e,t=!1,i=null){const n=new o.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new o.P(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let t=0;t{this.stopAllAnimations(),n&&n(),this._attachedCamera&&this._attachedCamera.useInputToRestoreState&&this._attachedCamera.storeState()})),c&&this._animatables.push(c)}_calculateLowerRadiusFromModelBoundingSphere(e,t){const i=t.subtract(e).length(),n=this._getFrustumSlope(),r=.5*i*this._radiusScale,s=r*Math.sqrt(1+1/(n.x*n.x)),o=r*Math.sqrt(1+1/(n.y*n.y));let a=Math.max(s,o);const l=this._attachedCamera;return l?(l.lowerRadiusLimit&&this._mode===te.IgnoreBoundsSizeMode&&(a=al.upperRadiusLimit?l.upperRadiusLimit:a),a):0}_maintainCameraAboveGround(){if(this._elevationReturnTime<0)return;const e=P.F.Now-this._lastInteractionTime,t=.5*Math.PI-this._defaultElevation,i=.5*Math.PI;if(this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>i&&e>=this._elevationReturnWaitTime){this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=y.f.CreateAnimation("beta",y.f.ANIMATIONTYPE_FLOAT,60,te.EasingFunction));const e=y.f.TransitionTo("beta",t,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,(()=>{this._clearAnimationLocks(),this.stopAllAnimations()}));e&&this._animatables.push(e)}}_getFrustumSlope(){const e=this._attachedCamera;if(!e)return o.FM.Zero();const t=e.getScene().getEngine().getAspectRatio(e),i=Math.tan(e.fov/2),n=i*t;return new o.FM(n,i)}_clearAnimationLocks(){this._betaIsAnimating=!1}_applyUserInteraction(){this.isUserIsMoving&&(this._lastInteractionTime=P.F.Now,this.stopAllAnimations(),this._clearAnimationLocks())}stopAllAnimations(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()}get isUserIsMoving(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)}}te.EasingFunction=new class extends O{constructor(e=2){super(),this.exponent=e}easeInCore(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)}},te.EasingMode=O.EASINGMODE_EASEINOUT,te.IgnoreBoundsSizeMode=0,te.FitFrustumSidesMode=1,i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/fadeInOutBehavior.js");var ie=i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/pointerDragBehavior.js");i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/sixDofDragBehavior.js"),i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/surfaceMagnetismBehavior.js"),i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/baseSixDofDragBehavior.js"),i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/followBehavior.js"),i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/handConstraintBehavior.js");var ne=i("../../../node_modules/@babylonjs/core/Maths/math.axis.js");class re{constructor(e,t,i){if(this.targetPosition=o.P.Zero(),this.poleTargetPosition=o.P.Zero(),this.poleTargetLocalOffset=o.P.Zero(),this.poleAngle=0,this.slerpAmount=1,this._bone1Quat=o._f.Identity(),this._bone1Mat=o.y3.Identity(),this._bone2Ang=Math.PI,this._maxAngle=Math.PI,this._rightHandedSystem=!1,this._bendAxis=o.P.Right(),this._slerping=!1,this._adjustRoll=0,this._bone2=t,this._bone1=t.getParent(),!this._bone1)return;this.mesh=e;const n=t.getPosition();if(t.getAbsoluteTransform().determinant()>0&&(this._rightHandedSystem=!0,this._bendAxis.x=0,this._bendAxis.y=0,this._bendAxis.z=-1,n.x>n.y&&n.x>n.z&&(this._adjustRoll=.5*Math.PI,this._bendAxis.z=1)),this._bone1.length){const e=this._bone1.getScale(),t=this._bone2.getScale();this._bone1Length=this._bone1.length*e.y*this.mesh.scaling.y,this._bone2Length=this._bone2.length*t.y*this.mesh.scaling.y}else if(this._bone1.children[0]){e.computeWorldMatrix(!0);const t=this._bone2.children[0].getAbsolutePosition(e),i=this._bone2.getAbsolutePosition(e),n=this._bone1.getAbsolutePosition(e);this._bone1Length=o.P.Distance(t,i),this._bone2Length=o.P.Distance(i,n)}this._bone1.getRotationMatrixToRef(ne.T.WORLD,e,this._bone1Mat),this.maxAngle=Math.PI,i&&(i.targetMesh&&(this.targetMesh=i.targetMesh,this.targetMesh.computeWorldMatrix(!0)),i.poleTargetMesh?(this.poleTargetMesh=i.poleTargetMesh,this.poleTargetMesh.computeWorldMatrix(!0)):i.poleTargetBone?this.poleTargetBone=i.poleTargetBone:this._bone1.getParent()&&(this.poleTargetBone=this._bone1.getParent()),i.poleTargetLocalOffset&&this.poleTargetLocalOffset.copyFrom(i.poleTargetLocalOffset),i.poleAngle&&(this.poleAngle=i.poleAngle),i.bendAxis&&this._bendAxis.copyFrom(i.bendAxis),i.maxAngle&&(this.maxAngle=i.maxAngle),i.slerpAmount&&(this.slerpAmount=i.slerpAmount))}get maxAngle(){return this._maxAngle}set maxAngle(e){this._setMaxAngle(e)}_setMaxAngle(e){e<0&&(e=0),(e>Math.PI||null==e)&&(e=Math.PI),this._maxAngle=e;const t=this._bone1Length,i=this._bone2Length;this._maxReach=Math.sqrt(t*t+i*i-2*t*i*Math.cos(e))}update(){const e=this._bone1;if(!e)return;const t=this.targetPosition,i=this.poleTargetPosition,n=re._TmpMats[0],r=re._TmpMats[1];this.targetMesh&&t.copyFrom(this.targetMesh.getAbsolutePosition()),this.poleTargetBone?this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset,this.mesh,i):this.poleTargetMesh&&o.P.TransformCoordinatesToRef(this.poleTargetLocalOffset,this.poleTargetMesh.getWorldMatrix(),i);const s=re._TmpVecs[0],a=re._TmpVecs[1],l=re._TmpVecs[2],c=re._TmpVecs[3],h=re._TmpVecs[4],_=re._TmpQuat;e.getAbsolutePositionToRef(this.mesh,s),i.subtractToRef(s,h),0==h.x&&0==h.y&&0==h.z?h.y=1:h.normalize(),t.subtractToRef(s,c),c.normalize(),o.P.CrossToRef(c,h,a),a.normalize(),o.P.CrossToRef(c,a,l),l.normalize(),o.y3.FromXYZAxesToRef(l,c,a,n);const d=this._bone1Length,u=this._bone2Length;let p=o.P.Distance(s,t);this._maxReach>0&&(p=Math.min(this._maxReach,p));let f=(u*u+p*p-d*d)/(2*u*p),m=(p*p+d*d-u*u)/(2*p*d);f>1&&(f=1),m>1&&(m=1),f<-1&&(f=-1),m<-1&&(m=-1);const g=Math.acos(f),b=Math.acos(m);let y=-g-b;if(this._rightHandedSystem)o.y3.RotationYawPitchRollToRef(0,0,this._adjustRoll,r),r.multiplyToRef(n,n),o.y3.RotationAxisToRef(this._bendAxis,b,r),r.multiplyToRef(n,n);else{const e=re._TmpVecs[5];e.copyFrom(this._bendAxis),e.x*=-1,o.y3.RotationAxisToRef(e,-b,r),r.multiplyToRef(n,n)}this.poleAngle&&(o.y3.RotationAxisToRef(c,this.poleAngle,r),n.multiplyToRef(r,n)),this._bone1&&(this.slerpAmount<1?(this._slerping||o._f.FromRotationMatrixToRef(this._bone1Mat,this._bone1Quat),o._f.FromRotationMatrixToRef(n,_),o._f.SlerpToRef(this._bone1Quat,_,this.slerpAmount,this._bone1Quat),y=this._bone2Ang*(1-this.slerpAmount)+y*this.slerpAmount,this._bone1.setRotationQuaternion(this._bone1Quat,ne.T.WORLD,this.mesh),this._slerping=!0):(this._bone1.setRotationMatrix(n,ne.T.WORLD,this.mesh),this._bone1Mat.copyFrom(n),this._slerping=!1),this._updateLinkedTransformRotation(this._bone1)),this._bone2.setAxisAngle(this._bendAxis,y,ne.T.LOCAL),this._updateLinkedTransformRotation(this._bone2),this._bone2Ang=y}_updateLinkedTransformRotation(e){e._linkedTransformNode&&(e._linkedTransformNode.rotationQuaternion||(e._linkedTransformNode.rotationQuaternion=new o._f),e.getRotationQuaternionToRef(ne.T.LOCAL,null,e._linkedTransformNode.rotationQuaternion))}}re._TmpVecs=[o.P.Zero(),o.P.Zero(),o.P.Zero(),o.P.Zero(),o.P.Zero(),o.P.Zero()],re._TmpQuat=o._f.Identity(),re._TmpMats=[o.y3.Identity(),o.y3.Identity()];var se=i("../../../node_modules/@babylonjs/core/Misc/arrayTools.js");class oe{constructor(e,t,i,n){if(this.upAxis=o.P.Up(),this.upAxisSpace=ne.T.LOCAL,this.adjustYaw=0,this.adjustPitch=0,this.adjustRoll=0,this.slerpAmount=1,this._boneQuat=o._f.Identity(),this._slerping=!1,this._firstFrameSkipped=!1,this._fowardAxis=o.P.Forward(),this.mesh=e,this.bone=t,this.target=i,n&&(n.adjustYaw&&(this.adjustYaw=n.adjustYaw),n.adjustPitch&&(this.adjustPitch=n.adjustPitch),n.adjustRoll&&(this.adjustRoll=n.adjustRoll),null!=n.maxYaw?this.maxYaw=n.maxYaw:this.maxYaw=Math.PI,null!=n.minYaw?this.minYaw=n.minYaw:this.minYaw=-Math.PI,null!=n.maxPitch?this.maxPitch=n.maxPitch:this.maxPitch=Math.PI,null!=n.minPitch?this.minPitch=n.minPitch:this.minPitch=-Math.PI,null!=n.slerpAmount&&(this.slerpAmount=n.slerpAmount),null!=n.upAxis&&(this.upAxis=n.upAxis),null!=n.upAxisSpace&&(this.upAxisSpace=n.upAxisSpace),null!=n.yawAxis||null!=n.pitchAxis)){let e=ne.RD.Y,t=ne.RD.X;null!=n.yawAxis&&(e=n.yawAxis.clone(),e.normalize()),null!=n.pitchAxis&&(t=n.pitchAxis.clone(),t.normalize());const i=o.P.Cross(t,e);this._transformYawPitch=o.y3.Identity(),o.y3.FromXYZAxesToRef(t,e,i,this._transformYawPitch),this._transformYawPitchInv=this._transformYawPitch.clone(),this._transformYawPitch.invert()}t.getParent()||this.upAxisSpace!=ne.T.BONE||(this.upAxisSpace=ne.T.LOCAL)}get minYaw(){return this._minYaw}set minYaw(e){this._minYaw=e,this._minYawSin=Math.sin(e),this._minYawCos=Math.cos(e),null!=this._maxYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)}get maxYaw(){return this._maxYaw}set maxYaw(e){this._maxYaw=e,this._maxYawSin=Math.sin(e),this._maxYawCos=Math.cos(e),null!=this._minYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch=e,this._minPitchTan=Math.tan(e)}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch=e,this._maxPitchTan=Math.tan(e)}update(){if(this.slerpAmount<1&&!this._firstFrameSkipped)return void(this._firstFrameSkipped=!0);const e=this.bone,t=oe._TmpVecs[0];e.getAbsolutePositionToRef(this.mesh,t);let i=this.target;const n=oe._TmpMats[0],r=oe._TmpMats[1],s=this.mesh,a=e.getParent(),l=oe._TmpVecs[1];l.copyFrom(this.upAxis),this.upAxisSpace==ne.T.BONE&&a?(this._transformYawPitch&&o.P.TransformCoordinatesToRef(l,this._transformYawPitchInv,l),a.getDirectionToRef(l,this.mesh,l)):this.upAxisSpace==ne.T.LOCAL&&(s.getDirectionToRef(l,l),1==s.scaling.x&&1==s.scaling.y&&1==s.scaling.z||l.normalize());let c=!1,h=!1;if(this._maxYaw==Math.PI&&this._minYaw==-Math.PI||(c=!0),this._maxPitch==Math.PI&&this._minPitch==-Math.PI||(h=!0),c||h){const e=oe._TmpMats[2],n=oe._TmpMats[3];if(this.upAxisSpace==ne.T.BONE&&1==l.y&&a)a.getRotationMatrixToRef(ne.T.WORLD,this.mesh,e);else if(this.upAxisSpace!=ne.T.LOCAL||1!=l.y||a){let t=oe._TmpVecs[2];t.copyFrom(this._fowardAxis),this._transformYawPitch&&o.P.TransformCoordinatesToRef(t,this._transformYawPitchInv,t),a?a.getDirectionToRef(t,this.mesh,t):s.getDirectionToRef(t,t);const i=o.P.Cross(l,t);i.normalize(),t=o.P.Cross(i,l),o.y3.FromXYZAxesToRef(i,l,t,e)}else e.copyFrom(s.getWorldMatrix());e.invertToRef(n);let r=null;if(h){const s=oe._TmpVecs[3];i.subtractToRef(t,s),o.P.TransformCoordinatesToRef(s,n,s),r=Math.sqrt(s.x*s.x+s.z*s.z);const a=Math.atan2(s.y,r);let l=a;a>this._maxPitch?(s.y=this._maxPitchTan*r,l=this._maxPitch):athis._maxYaw||aMath.PI?this._isAngleBetween(a,this._maxYaw,this._midYawConstraint)?(s.z=this._maxYawCos*r,s.x=this._maxYawSin*r,l=this._maxYaw):this._isAngleBetween(a,this._midYawConstraint,this._minYaw)&&(s.z=this._minYawCos*r,s.x=this._minYawSin*r,l=this._minYaw):a>this._maxYaw?(s.z=this._maxYawCos*r,s.x=this._maxYawSin*r,l=this._maxYaw):aMath.PI){const e=oe._TmpVecs[8];e.copyFrom(ne.RD.Z),this._transformYawPitch&&o.P.TransformCoordinatesToRef(e,this._transformYawPitchInv,e);const t=oe._TmpMats[4];this._boneQuat.toRotationMatrix(t),this.mesh.getWorldMatrix().multiplyToRef(t,t),o.P.TransformCoordinatesToRef(e,t,e),o.P.TransformCoordinatesToRef(e,n,e);const i=Math.atan2(e.x,e.z);if(this._getAngleBetween(i,a)>this._getAngleBetween(i,this._midYawConstraint)){null==r&&(r=Math.sqrt(s.x*s.x+s.z*s.z));const e=this._getAngleBetween(i,this._maxYaw);this._getAngleBetween(i,this._minYaw)Math.PI?i-=2*Math.PI:i<-Math.PI&&(i+=2*Math.PI),i}_getAngleBetween(e,t){let i=0;return i=(e=(e%=2*Math.PI)<0?e+2*Math.PI:e)<(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)?t-e:e-t,i>Math.PI&&(i=2*Math.PI-i),i}_isAngleBetween(e,t,i){if(e=(e%=2*Math.PI)<0?e+2*Math.PI:e,(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)<(i=(i%=2*Math.PI)<0?i+2*Math.PI:i)){if(e>t&&ei&&e{const o=s.event,a="touch"===o.pointerType;if(t.isInVRExclusivePointerMode)return;if(s.type!==Z.kD.POINTERMOVE&&-1===this.buttons.indexOf(o.button))return;const l=o.target;if(this._altKey=o.altKey,this._ctrlKey=o.ctrlKey,this._metaKey=o.metaKey,this._shiftKey=o.shiftKey,this._buttonsPressed=o.buttons,t.isPointerLock){const e=o.movementX,t=o.movementY;this.onTouch(null,e,t),this._pointA=null,this._pointB=null}else if(s.type!==Z.kD.POINTERDOWN||-1!==this._currentActiveButton&&!a)if(s.type===Z.kD.POINTERDOUBLETAP)this.onDoubleTap(o.pointerType);else if(s.type!==Z.kD.POINTERUP||this._currentActiveButton!==o.button&&!a){if(s.type===Z.kD.POINTERMOVE)if(e||o.preventDefault(),this._pointA&&null===this._pointB){const e=o.clientX-this._pointA.x,t=o.clientY-this._pointA.y;this.onTouch(this._pointA,e,t),this._pointA.x=o.clientX,this._pointA.y=o.clientY}else if(this._pointA&&this._pointB){const e=this._pointA.pointerId===o.pointerId?this._pointA:this._pointB;e.x=o.clientX,e.y=o.clientY;const t=this._pointA.x-this._pointB.x,i=this._pointA.y-this._pointB.y,a=t*t+i*i,l={x:(this._pointA.x+this._pointB.x)/2,y:(this._pointA.y+this._pointB.y)/2,pointerId:o.pointerId,type:s.type};this.onMultiTouch(this._pointA,this._pointB,n,a,r,l),r=l,n=a}}else{try{null==l||l.releasePointerCapture(o.pointerId)}catch(e){}a||(this._pointB=null),t._badOS?this._pointA=this._pointB=null:this._pointB&&this._pointA&&this._pointA.pointerId==o.pointerId?(this._pointA=this._pointB,this._pointB=null):this._pointA&&this._pointB&&this._pointB.pointerId==o.pointerId?this._pointB=null:this._pointA=this._pointB=null,(0!==n||r)&&(this.onMultiTouch(this._pointA,this._pointB,n,0,r,null),n=0,r=null),this._currentActiveButton=-1,this.onButtonUp(o),e||o.preventDefault()}else{try{null==l||l.setPointerCapture(o.pointerId)}catch(e){}null===this._pointA?this._pointA={x:o.clientX,y:o.clientY,pointerId:o.pointerId,type:o.pointerType}:null===this._pointB&&(this._pointB={x:o.clientX,y:o.clientY,pointerId:o.pointerId,type:o.pointerType}),-1!==this._currentActiveButton||a||(this._currentActiveButton=o.button),this.onButtonDown(o),e||(o.preventDefault(),i&&i.focus())}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,Z.kD.POINTERDOWN|Z.kD.POINTERUP|Z.kD.POINTERMOVE|Z.kD.POINTERDOUBLETAP),this._onLostFocus=()=>{this._pointA=this._pointB=null,n=0,r=null,this.onLostFocus()},this._contextMenuBind=this.onContextMenu.bind(this),i&&i.addEventListener("contextmenu",this._contextMenuBind,!1);const s=this.camera.getScene().getEngine().getHostWindow();s&&V.w1.RegisterTopRootEvents(s,[{name:"blur",handler:this._onLostFocus}])}detachControl(){if(this._onLostFocus){const e=this.camera.getScene().getEngine().getHostWindow();e&&V.w1.UnregisterTopRootEvents(e,[{name:"blur",handler:this._onLostFocus}])}if(this._observer){if(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._contextMenuBind){const e=this.camera.getScene().getEngine().getInputElement();e&&e.removeEventListener("contextmenu",this._contextMenuBind)}this._onLostFocus=null}this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0,this._currentActiveButton=-1}getClassName(){return"BaseCameraPointersInput"}getSimpleName(){return"pointers"}onDoubleTap(e){}onTouch(e,t,i){}onMultiTouch(e,t,i,n,r,s){}onContextMenu(e){e.preventDefault()}onButtonDown(e){}onButtonUp(e){}onLostFocus(){}}(0,X.gn)([(0,Y.qC)()],_e.prototype,"buttons",void 0);var de=i("../../../node_modules/@babylonjs/core/Cameras/cameraInputsManager.js");class ue{constructor(e,t,i,n=0,r=1,s=2,o=3){this.id=e,this.index=t,this.browserGamepad=i,this._leftStick={x:0,y:0},this._rightStick={x:0,y:0},this._isConnected=!0,this._invertLeftStickY=!1,this.type=ue.GAMEPAD,this._leftStickAxisX=n,this._leftStickAxisY=r,this._rightStickAxisX=s,this._rightStickAxisY=o,this.browserGamepad.axes.length>=2&&(this._leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]}),this.browserGamepad.axes.length>=4&&(this._rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})}get isConnected(){return this._isConnected}onleftstickchanged(e){this._onleftstickchanged=e}onrightstickchanged(e){this._onrightstickchanged=e}get leftStick(){return this._leftStick}set leftStick(e){!this._onleftstickchanged||this._leftStick.x===e.x&&this._leftStick.y===e.y||this._onleftstickchanged(e),this._leftStick=e}get rightStick(){return this._rightStick}set rightStick(e){!this._onrightstickchanged||this._rightStick.x===e.x&&this._rightStick.y===e.y||this._onrightstickchanged(e),this._rightStick=e}update(){this._leftStick&&(this.leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]},this._invertLeftStickY&&(this.leftStick.y*=-1)),this._rightStick&&(this.rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})}dispose(){}}ue.GAMEPAD=0,ue.GENERIC=1,ue.XBOX=2,ue.POSE_ENABLED=3,ue.DUALSHOCK=4;class pe extends ue{constructor(e,t,i){super(e,t,i),this.onButtonDownObservable=new s.y$,this.onButtonUpObservable=new s.y$,this.type=ue.GENERIC,this._buttons=new Array(i.buttons.length)}onbuttondown(e){this._onbuttondown=e}onbuttonup(e){this._onbuttonup=e}_setButtonValue(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e}update(){super.update();for(let e=0;e{e.type!==ue.POSE_ENABLED&&(this.gamepad&&e.type!==ue.XBOX||(this.gamepad=e))})),this._onGamepadDisconnectedObserver=e.onGamepadDisconnectedObservable.add((e=>{this.gamepad===e&&(this.gamepad=null)})),this.gamepad=e.getGamepadByType(ue.XBOX)}detachControl(){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null}checkInputs(){if(this.gamepad){const e=this.camera,t=this.gamepad.rightStick;if(t){if(0!=t.x){const i=t.x/this.gamepadRotationSensibility;0!=i&&Math.abs(i)>.005&&(e.inertialAlphaOffset+=i)}if(0!=t.y){const i=t.y/this.gamepadRotationSensibility*this._yAxisScale;0!=i&&Math.abs(i)>.005&&(e.inertialBetaOffset+=i)}}const i=this.gamepad.leftStick;if(i&&0!=i.y){const e=i.y/this.gamepadMoveSensibility;0!=e&&Math.abs(e)>.005&&(this.camera.inertialRadiusOffset-=e)}}}getClassName(){return"ArcRotateCameraGamepadInput"}getSimpleName(){return"gamepad"}}(0,X.gn)([(0,Y.qC)()],fe.prototype,"gamepadRotationSensibility",void 0),(0,X.gn)([(0,Y.qC)()],fe.prototype,"gamepadMoveSensibility",void 0),de.u.ArcRotateCameraGamepadInput=fe;var me=i("../../../node_modules/@babylonjs/core/Events/keyboardEvents.js");class ge{constructor(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}attachControl(e){e=V.w1.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((()=>{this._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((t=>{const i=t.event;if(!i.metaKey)if(t.type===me.OG.KEYDOWN)this._ctrlPressed=i.ctrlKey,this._altPressed=i.altKey,(-1!==this.keysUp.indexOf(i.keyCode)||-1!==this.keysDown.indexOf(i.keyCode)||-1!==this.keysLeft.indexOf(i.keyCode)||-1!==this.keysRight.indexOf(i.keyCode)||-1!==this.keysReset.indexOf(i.keyCode))&&(-1===this._keys.indexOf(i.keyCode)&&this._keys.push(i.keyCode),i.preventDefault&&(e||i.preventDefault()));else if(-1!==this.keysUp.indexOf(i.keyCode)||-1!==this.keysDown.indexOf(i.keyCode)||-1!==this.keysLeft.indexOf(i.keyCode)||-1!==this.keysRight.indexOf(i.keyCode)||-1!==this.keysReset.indexOf(i.keyCode)){const t=this._keys.indexOf(i.keyCode);t>=0&&this._keys.splice(t,1),i.preventDefault&&(e||i.preventDefault())}})))}detachControl(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0}checkInputs(){if(this._onKeyboardObserver){const e=this.camera;for(let t=0;t0?n/(1+this.wheelDeltaPercentage):n*(1+this.wheelDeltaPercentage),i}attachControl(e){e=V.w1.BackCompatCameraNoPreventDefault(arguments),this._wheel=t=>{if(t.type!==Z.kD.POINTERWHEEL)return;const i=t.event;let n=0;const r=i.deltaMode===ye.G.DOM_DELTA_LINE?40:1,s=-i.deltaY*r;if(this.customComputeDeltaFromMouseWheel)n=this.customComputeDeltaFromMouseWheel(s,this,i);else if(this.wheelDeltaPercentage){if(n=this._computeDeltaFromMouseWheelLegacyEvent(s,this.camera.radius),n>0){let e=this.camera.radius,t=this.camera.inertialRadiusOffset+n;for(let i=0;i<20&&Math.abs(t)>.001;i++)e-=t,t*=this.camera.inertia;e=ve.R.Clamp(e,0,Number.MAX_VALUE),n=this._computeDeltaFromMouseWheelLegacyEvent(s,e)}}else n=s/(40*this.wheelPrecision);n&&(this.zoomToMouseLocation&&this._hitPlane?this._zoomToMouse(n):this.camera.inertialRadiusOffset+=n),i.preventDefault&&(e||i.preventDefault())},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,Z.kD.POINTERWHEEL),this.zoomToMouseLocation&&this._inertialPanning.setAll(0)}detachControl(){this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)}checkInputs(){if(!this.zoomToMouseLocation)return;const e=this.camera;0+e.inertialAlphaOffset+e.inertialBetaOffset+e.inertialRadiusOffset&&(this._updateHitPlane(),e.target.addInPlace(this._inertialPanning),this._inertialPanning.scaleInPlace(e.inertia),this._zeroIfClose(this._inertialPanning))}getClassName(){return"ArcRotateCameraMouseWheelInput"}getSimpleName(){return"mousewheel"}_updateHitPlane(){const e=this.camera,t=e.target.subtract(e.position);this._hitPlane=be.J.FromPositionAndNormal(e.target,t)}_getPosition(){var e;const t=this.camera,i=t.getScene(),n=i.createPickingRay(i.pointerX,i.pointerY,o.y3.Identity(),t,!1);let r=0;return this._hitPlane&&(r=null!==(e=n.intersectsPlane(this._hitPlane))&&void 0!==e?e:0),n.origin.addInPlace(n.direction.scaleInPlace(r))}_zoomToMouse(e){var t,i;const n=this.camera,r=1-n.inertia;if(n.lowerRadiusLimit){const i=null!==(t=n.lowerRadiusLimit)&&void 0!==t?t:0;n.radius-(n.inertialRadiusOffset+e)/rt&&(e=(n.radius-t)*r-n.inertialRadiusOffset)}const s=e/r/n.radius,a=this._getPosition(),l=o.jp.Vector3[6];a.subtractToRef(n.target,l),l.scaleInPlace(s),l.scaleInPlace(r),this._inertialPanning.addInPlace(l),n.inertialRadiusOffset+=e}_zeroIfClose(e){Math.abs(e.x)<$.kn&&(e.x=0),Math.abs(e.y)<$.kn&&(e.y=0),Math.abs(e.z)<$.kn&&(e.z=0)}}(0,X.gn)([(0,Y.qC)()],Ae.prototype,"wheelPrecision",void 0),(0,X.gn)([(0,Y.qC)()],Ae.prototype,"zoomToMouseLocation",void 0),(0,X.gn)([(0,Y.qC)()],Ae.prototype,"wheelDeltaPercentage",void 0),de.u.ArcRotateCameraMouseWheelInput=Ae;class Ce extends _e{constructor(){super(...arguments),this.buttons=[0,1,2],this.angularSensibilityX=1e3,this.angularSensibilityY=1e3,this.pinchPrecision=12,this.pinchDeltaPercentage=0,this.useNaturalPinchZoom=!1,this.pinchZoom=!0,this.panningSensibility=1e3,this.multiTouchPanning=!0,this.multiTouchPanAndZoom=!0,this.pinchInwards=!0,this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1}getClassName(){return"ArcRotateCameraPointersInput"}_computeMultiTouchPanning(e,t){if(0!==this.panningSensibility&&e&&t){const i=t.x-e.x,n=t.y-e.y;this.camera.inertialPanningX+=-i/this.panningSensibility,this.camera.inertialPanningY+=n/this.panningSensibility}}_computePinchZoom(e,t){const i=this.camera.radius||Ce.MinimumRadiusForPinch;this.useNaturalPinchZoom?this.camera.radius=i*Math.sqrt(e)/Math.sqrt(t):this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(t-e)*i*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(t-e)/(this.pinchPrecision*(this.pinchInwards?1:-1)*(this.angularSensibilityX+this.angularSensibilityY)/2)}onTouch(e,t,i){0!==this.panningSensibility&&(this._ctrlKey&&this.camera._useCtrlForPanning||this._isPanClick)?(this.camera.inertialPanningX+=-t/this.panningSensibility,this.camera.inertialPanningY+=i/this.panningSensibility):(this.camera.inertialAlphaOffset-=t/this.angularSensibilityX,this.camera.inertialBetaOffset-=i/this.angularSensibilityY)}onDoubleTap(){this.camera.useInputToRestoreState&&this.camera.restoreState()}onMultiTouch(e,t,i,n,r,s){0===i&&null===r||0===n&&null===s||(this.multiTouchPanAndZoom?(this._computePinchZoom(i,n),this._computeMultiTouchPanning(r,s)):this.multiTouchPanning&&this.pinchZoom?(this._twoFingerActivityCount++,this._isPinching||this._twoFingerActivityCount<20&&Math.abs(Math.sqrt(n)-Math.sqrt(i))>this.camera.pinchToPanMaxDistance?(this._computePinchZoom(i,n),this._isPinching=!0):this._computeMultiTouchPanning(r,s)):this.multiTouchPanning?this._computeMultiTouchPanning(r,s):this.pinchZoom&&this._computePinchZoom(i,n))}onButtonDown(e){this._isPanClick=e.button===this.camera._panningMouseButton}onButtonUp(){this._twoFingerActivityCount=0,this._isPinching=!1}onLostFocus(){this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1}}Ce.MinimumRadiusForPinch=.001,(0,X.gn)([(0,Y.qC)()],Ce.prototype,"buttons",void 0),(0,X.gn)([(0,Y.qC)()],Ce.prototype,"angularSensibilityX",void 0),(0,X.gn)([(0,Y.qC)()],Ce.prototype,"angularSensibilityY",void 0),(0,X.gn)([(0,Y.qC)()],Ce.prototype,"pinchPrecision",void 0),(0,X.gn)([(0,Y.qC)()],Ce.prototype,"pinchDeltaPercentage",void 0),(0,X.gn)([(0,Y.qC)()],Ce.prototype,"useNaturalPinchZoom",void 0),(0,X.gn)([(0,Y.qC)()],Ce.prototype,"pinchZoom",void 0),(0,X.gn)([(0,Y.qC)()],Ce.prototype,"panningSensibility",void 0),(0,X.gn)([(0,Y.qC)()],Ce.prototype,"multiTouchPanning",void 0),(0,X.gn)([(0,Y.qC)()],Ce.prototype,"multiTouchPanAndZoom",void 0),de.u.ArcRotateCameraPointersInput=Ce;class Se extends de.p{constructor(e){super(e)}addMouseWheel(){return this.add(new Ae),this}addPointers(){return this.add(new Ce),this}addKeyboard(){return this.add(new ge),this}}Se.prototype.addVRDeviceOrientation=function(){return this.add(new xe),this};class xe{constructor(){this.alphaCorrection=1,this.gammaCorrection=1,this._alpha=0,this._gamma=0,this._dirty=!1,this._deviceOrientationHandler=this._onOrientationEvent.bind(this)}attachControl(e){e=V.w1.BackCompatCameraNoPreventDefault(arguments),this.camera.attachControl(e);const t=this.camera.getScene().getEngine().getHostWindow();t&&("undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((e=>{"granted"===e?t.addEventListener("deviceorientation",this._deviceOrientationHandler):V.w1.Warn("Permission not granted.")})).catch((e=>{V.w1.Error(e)})):t.addEventListener("deviceorientation",this._deviceOrientationHandler))}_onOrientationEvent(e){null!==e.alpha&&(this._alpha=(0|+e.alpha)*this.alphaCorrection),null!==e.gamma&&(this._gamma=(0|+e.gamma)*this.gammaCorrection),this._dirty=!0}checkInputs(){this._dirty&&(this._dirty=!1,this._gamma<0&&(this._gamma=180+this._gamma),this.camera.alpha=-this._alpha/180*Math.PI%Math.PI*2,this.camera.beta=this._gamma/180*Math.PI)}detachControl(){window.removeEventListener("deviceorientation",this._deviceOrientationHandler)}getClassName(){return"ArcRotateCameraVRDeviceOrientationInput"}getSimpleName(){return"VRDeviceOrientation"}}de.u.ArcRotateCameraVRDeviceOrientationInput=xe;class Te{constructor(){this.keysForward=[87],this.keysBackward=[83],this.keysUp=[69],this.keysDown=[81],this.keysRight=[68],this.keysLeft=[65],this._keys=new Array}attachControl(e){e=V.w1.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((()=>{this._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((t=>{const i=t.event;if(t.type===me.OG.KEYDOWN)-1===this.keysForward.indexOf(i.keyCode)&&-1===this.keysBackward.indexOf(i.keyCode)&&-1===this.keysUp.indexOf(i.keyCode)&&-1===this.keysDown.indexOf(i.keyCode)&&-1===this.keysLeft.indexOf(i.keyCode)&&-1===this.keysRight.indexOf(i.keyCode)||(-1===this._keys.indexOf(i.keyCode)&&this._keys.push(i.keyCode),e||i.preventDefault());else if(-1!==this.keysForward.indexOf(i.keyCode)||-1!==this.keysBackward.indexOf(i.keyCode)||-1!==this.keysUp.indexOf(i.keyCode)||-1!==this.keysDown.indexOf(i.keyCode)||-1!==this.keysLeft.indexOf(i.keyCode)||-1!==this.keysRight.indexOf(i.keyCode)){const t=this._keys.indexOf(i.keyCode);t>=0&&this._keys.splice(t,1),e||i.preventDefault()}})))}detachControl(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0}getClassName(){return"FlyCameraKeyboardInput"}_onLostFocus(){this._keys.length=0}getSimpleName(){return"keyboard"}checkInputs(){if(this._onKeyboardObserver){const e=this.camera;for(let t=0;t{this._pointerInput(e)}),Z.kD.POINTERDOWN|Z.kD.POINTERUP|Z.kD.POINTERMOVE),this._rollObserver=this.camera.getScene().onBeforeRenderObservable.add((()=>{this.camera.rollCorrect&&this.camera.restoreRoll(this.camera.rollCorrect)}))}detachControl(){this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this.camera.getScene().onBeforeRenderObservable.remove(this._rollObserver),this._observer=null,this._rollObserver=null,this._previousPosition=null,this._noPreventDefault=void 0)}getClassName(){return"FlyCameraMouseInput"}getSimpleName(){return"mouse"}_pointerInput(e){const t=e.event,i=this.camera.getEngine();if(i.isInVRExclusivePointerMode)return;if(!this.touchEnabled&&"touch"===t.pointerType)return;if(e.type!==Z.kD.POINTERMOVE&&-1===this.buttons.indexOf(t.button))return;const n=t.target;if(e.type===Z.kD.POINTERDOWN){try{null==n||n.setPointerCapture(t.pointerId)}catch(t){}this._previousPosition={x:t.clientX,y:t.clientY},this.activeButton=t.button,this._noPreventDefault||(t.preventDefault(),this._element.focus()),i.isPointerLock&&this._onMouseMove(e.event)}else if(e.type===Z.kD.POINTERUP){try{null==n||n.releasePointerCapture(t.pointerId)}catch(t){}this.activeButton=-1,this._previousPosition=null,this._noPreventDefault||t.preventDefault()}else if(e.type===Z.kD.POINTERMOVE){if(!this._previousPosition)return void(i.isPointerLock&&this._onMouseMove(e.event));const n=t.clientX-this._previousPosition.x,r=t.clientY-this._previousPosition.y;this._rotateCamera(n,r),this._previousPosition={x:t.clientX,y:t.clientY},this._noPreventDefault||t.preventDefault()}}_onMouseMove(e){const t=this.camera.getEngine();if(!t.isPointerLock||t.isInVRExclusivePointerMode)return;const i=e.movementX,n=e.movementY;this._rotateCamera(i,n),this._previousPosition=null,this._noPreventDefault||e.preventDefault()}_rotateCamera(e,t){const i=this.camera;this.camera.getScene().useRightHandedSystem&&(e*=-1),i.parent&&i.parent._getWorldMatrixDeterminant()<0&&(e*=-1);const n=e/this.angularSensibility,r=t/this.angularSensibility,s=o._f.RotationYawPitchRoll(i.rotation.y,i.rotation.x,i.rotation.z);let a;if(this.buttonsPitch.some((e=>e===this.activeButton))&&(a=o._f.RotationAxis(ne.RD.X,r),s.multiplyInPlace(a)),this.buttonsYaw.some((e=>e===this.activeButton))){a=o._f.RotationAxis(ne.RD.Y,n),s.multiplyInPlace(a);const e=i.bankedTurnLimit+i._trackRoll;if(i.bankedTurn&&-ee===this.activeButton))&&(a=o._f.RotationAxis(ne.RD.Z,-n),i._trackRoll-=n,s.multiplyInPlace(a)),s.toEulerAnglesToRef(i.rotation)}}(0,X.gn)([(0,Y.qC)()],Ee.prototype,"buttons",void 0),(0,X.gn)([(0,Y.qC)()],Ee.prototype,"angularSensibility",void 0),de.u.FlyCameraMouseInput=Ee;class Re{constructor(){this.keysHeightOffsetIncr=[38],this.keysHeightOffsetDecr=[40],this.keysHeightOffsetModifierAlt=!1,this.keysHeightOffsetModifierCtrl=!1,this.keysHeightOffsetModifierShift=!1,this.keysRotationOffsetIncr=[37],this.keysRotationOffsetDecr=[39],this.keysRotationOffsetModifierAlt=!1,this.keysRotationOffsetModifierCtrl=!1,this.keysRotationOffsetModifierShift=!1,this.keysRadiusIncr=[40],this.keysRadiusDecr=[38],this.keysRadiusModifierAlt=!0,this.keysRadiusModifierCtrl=!1,this.keysRadiusModifierShift=!1,this.heightSensibility=1,this.rotationSensibility=1,this.radiusSensibility=1,this._keys=new Array}attachControl(e){e=V.w1.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((()=>{this._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((t=>{const i=t.event;if(!i.metaKey)if(t.type===me.OG.KEYDOWN)this._ctrlPressed=i.ctrlKey,this._altPressed=i.altKey,this._shiftPressed=i.shiftKey,(-1!==this.keysHeightOffsetIncr.indexOf(i.keyCode)||-1!==this.keysHeightOffsetDecr.indexOf(i.keyCode)||-1!==this.keysRotationOffsetIncr.indexOf(i.keyCode)||-1!==this.keysRotationOffsetDecr.indexOf(i.keyCode)||-1!==this.keysRadiusIncr.indexOf(i.keyCode)||-1!==this.keysRadiusDecr.indexOf(i.keyCode))&&(-1===this._keys.indexOf(i.keyCode)&&this._keys.push(i.keyCode),i.preventDefault&&(e||i.preventDefault()));else if(-1!==this.keysHeightOffsetIncr.indexOf(i.keyCode)||-1!==this.keysHeightOffsetDecr.indexOf(i.keyCode)||-1!==this.keysRotationOffsetIncr.indexOf(i.keyCode)||-1!==this.keysRotationOffsetDecr.indexOf(i.keyCode)||-1!==this.keysRadiusIncr.indexOf(i.keyCode)||-1!==this.keysRadiusDecr.indexOf(i.keyCode)){const t=this._keys.indexOf(i.keyCode);t>=0&&this._keys.splice(t,1),i.preventDefault&&(e||i.preventDefault())}})))}detachControl(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0}checkInputs(){this._onKeyboardObserver&&this._keys.forEach((e=>{-1!==this.keysHeightOffsetIncr.indexOf(e)&&this._modifierHeightOffset()?this.camera.heightOffset+=this.heightSensibility:-1!==this.keysHeightOffsetDecr.indexOf(e)&&this._modifierHeightOffset()?this.camera.heightOffset-=this.heightSensibility:-1!==this.keysRotationOffsetIncr.indexOf(e)&&this._modifierRotationOffset()?(this.camera.rotationOffset+=this.rotationSensibility,this.camera.rotationOffset%=360):-1!==this.keysRotationOffsetDecr.indexOf(e)&&this._modifierRotationOffset()?(this.camera.rotationOffset-=this.rotationSensibility,this.camera.rotationOffset%=360):-1!==this.keysRadiusIncr.indexOf(e)&&this._modifierRadius()?this.camera.radius+=this.radiusSensibility:-1!==this.keysRadiusDecr.indexOf(e)&&this._modifierRadius()&&(this.camera.radius-=this.radiusSensibility)}))}getClassName(){return"FollowCameraKeyboardMoveInput"}getSimpleName(){return"keyboard"}_modifierHeightOffset(){return this.keysHeightOffsetModifierAlt===this._altPressed&&this.keysHeightOffsetModifierCtrl===this._ctrlPressed&&this.keysHeightOffsetModifierShift===this._shiftPressed}_modifierRotationOffset(){return this.keysRotationOffsetModifierAlt===this._altPressed&&this.keysRotationOffsetModifierCtrl===this._ctrlPressed&&this.keysRotationOffsetModifierShift===this._shiftPressed}_modifierRadius(){return this.keysRadiusModifierAlt===this._altPressed&&this.keysRadiusModifierCtrl===this._ctrlPressed&&this.keysRadiusModifierShift===this._shiftPressed}}(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysHeightOffsetIncr",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysHeightOffsetDecr",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysHeightOffsetModifierAlt",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysHeightOffsetModifierCtrl",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysHeightOffsetModifierShift",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRotationOffsetIncr",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRotationOffsetDecr",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRotationOffsetModifierAlt",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRotationOffsetModifierCtrl",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRotationOffsetModifierShift",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRadiusIncr",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRadiusDecr",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRadiusModifierAlt",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRadiusModifierCtrl",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"keysRadiusModifierShift",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"heightSensibility",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"rotationSensibility",void 0),(0,X.gn)([(0,Y.qC)()],Re.prototype,"radiusSensibility",void 0),de.u.FollowCameraKeyboardMoveInput=Re;class Pe{constructor(){this.axisControlRadius=!0,this.axisControlHeight=!1,this.axisControlRotation=!1,this.wheelPrecision=3,this.wheelDeltaPercentage=0}attachControl(e){e=V.w1.BackCompatCameraNoPreventDefault(arguments),this._wheel=t=>{if(t.type!==Z.kD.POINTERWHEEL)return;const i=t.event;let n=0;const r=Math.max(-1,Math.min(1,i.deltaY));this.wheelDeltaPercentage?(console.assert(this.axisControlRadius+this.axisControlHeight+this.axisControlRotation<=1,"wheelDeltaPercentage only usable when mouse wheel controls ONE axis. Currently enabled: axisControlRadius: "+this.axisControlRadius+", axisControlHeightOffset: "+this.axisControlHeight+", axisControlRotationOffset: "+this.axisControlRotation),this.axisControlRadius?n=.01*r*this.wheelDeltaPercentage*this.camera.radius:this.axisControlHeight?n=.01*r*this.wheelDeltaPercentage*this.camera.heightOffset:this.axisControlRotation&&(n=.01*r*this.wheelDeltaPercentage*this.camera.rotationOffset)):n=r*this.wheelPrecision,n&&(this.axisControlRadius?this.camera.radius+=n:this.axisControlHeight?this.camera.heightOffset-=n:this.axisControlRotation&&(this.camera.rotationOffset-=n)),i.preventDefault&&(e||i.preventDefault())},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,Z.kD.POINTERWHEEL)}detachControl(){this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)}getClassName(){return"ArcRotateCameraMouseWheelInput"}getSimpleName(){return"mousewheel"}}(0,X.gn)([(0,Y.qC)()],Pe.prototype,"axisControlRadius",void 0),(0,X.gn)([(0,Y.qC)()],Pe.prototype,"axisControlHeight",void 0),(0,X.gn)([(0,Y.qC)()],Pe.prototype,"axisControlRotation",void 0),(0,X.gn)([(0,Y.qC)()],Pe.prototype,"wheelPrecision",void 0),(0,X.gn)([(0,Y.qC)()],Pe.prototype,"wheelDeltaPercentage",void 0),de.u.FollowCameraMouseWheelInput=Pe;class Ie extends _e{constructor(){super(...arguments),this.angularSensibilityX=1,this.angularSensibilityY=1,this.pinchPrecision=1e4,this.pinchDeltaPercentage=0,this.axisXControlRadius=!1,this.axisXControlHeight=!1,this.axisXControlRotation=!0,this.axisYControlRadius=!1,this.axisYControlHeight=!0,this.axisYControlRotation=!1,this.axisPinchControlRadius=!0,this.axisPinchControlHeight=!1,this.axisPinchControlRotation=!1,this.warningEnable=!0,this._warningCounter=0}getClassName(){return"FollowCameraPointersInput"}onTouch(e,t,i){this._warning(),this.axisXControlRotation?this.camera.rotationOffset+=t/this.angularSensibilityX:this.axisYControlRotation&&(this.camera.rotationOffset+=i/this.angularSensibilityX),this.axisXControlHeight?this.camera.heightOffset+=t/this.angularSensibilityY:this.axisYControlHeight&&(this.camera.heightOffset+=i/this.angularSensibilityY),this.axisXControlRadius?this.camera.radius-=t/this.angularSensibilityY:this.axisYControlRadius&&(this.camera.radius-=i/this.angularSensibilityY)}onMultiTouch(e,t,i,n,r,s){if(0===i&&null===r)return;if(0===n&&null===s)return;let o=(n-i)/(this.pinchPrecision*(this.angularSensibilityX+this.angularSensibilityY)/2);this.pinchDeltaPercentage?(o*=.01*this.pinchDeltaPercentage,this.axisPinchControlRotation&&(this.camera.rotationOffset+=o*this.camera.rotationOffset),this.axisPinchControlHeight&&(this.camera.heightOffset+=o*this.camera.heightOffset),this.axisPinchControlRadius&&(this.camera.radius-=o*this.camera.radius)):(this.axisPinchControlRotation&&(this.camera.rotationOffset+=o),this.axisPinchControlHeight&&(this.camera.heightOffset+=o),this.axisPinchControlRadius&&(this.camera.radius-=o))}_warning(){if(!this.warningEnable||this._warningCounter++%100!=0)return;const e="It probably only makes sense to control ONE camera property with each pointer axis. Set 'warningEnable = false' if you are sure. Currently enabled: ";console.assert(this.axisXControlRotation+this.axisXControlHeight+this.axisXControlRadius<=1,e+"axisXControlRotation: "+this.axisXControlRotation+", axisXControlHeight: "+this.axisXControlHeight+", axisXControlRadius: "+this.axisXControlRadius),console.assert(this.axisYControlRotation+this.axisYControlHeight+this.axisYControlRadius<=1,e+"axisYControlRotation: "+this.axisYControlRotation+", axisYControlHeight: "+this.axisYControlHeight+", axisYControlRadius: "+this.axisYControlRadius),console.assert(this.axisPinchControlRotation+this.axisPinchControlHeight+this.axisPinchControlRadius<=1,e+"axisPinchControlRotation: "+this.axisPinchControlRotation+", axisPinchControlHeight: "+this.axisPinchControlHeight+", axisPinchControlRadius: "+this.axisPinchControlRadius)}}(0,X.gn)([(0,Y.qC)()],Ie.prototype,"angularSensibilityX",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"angularSensibilityY",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"pinchPrecision",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"pinchDeltaPercentage",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"axisXControlRadius",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"axisXControlHeight",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"axisXControlRotation",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"axisYControlRadius",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"axisYControlHeight",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"axisYControlRotation",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"axisPinchControlRadius",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"axisPinchControlHeight",void 0),(0,X.gn)([(0,Y.qC)()],Ie.prototype,"axisPinchControlRotation",void 0),de.u.FollowCameraPointersInput=Ie;var Me=i("../../../node_modules/@babylonjs/core/Cameras/freeCameraInputsManager.js");Me.a.prototype.addDeviceOrientation=function(e){return this._deviceOrientationInput||(this._deviceOrientationInput=new De,e&&(this._deviceOrientationInput.smoothFactor=e),this.add(this._deviceOrientationInput)),this};class De{constructor(){this._screenOrientationAngle=0,this._screenQuaternion=new o._f,this._alpha=0,this._beta=0,this._gamma=0,this.smoothFactor=0,this._onDeviceOrientationChangedObservable=new s.y$,this._orientationChanged=()=>{this._screenOrientationAngle=void 0!==window.orientation?+window.orientation:window.screen.orientation&&window.screen.orientation.angle?window.screen.orientation.angle:0,this._screenOrientationAngle=-V.w1.ToRadians(this._screenOrientationAngle/2),this._screenQuaternion.copyFromFloats(0,Math.sin(this._screenOrientationAngle),0,Math.cos(this._screenOrientationAngle))},this._deviceOrientation=e=>{this.smoothFactor?(this._alpha=null!==e.alpha?V.w1.SmoothAngleChange(this._alpha,e.alpha,this.smoothFactor):0,this._beta=null!==e.beta?V.w1.SmoothAngleChange(this._beta,e.beta,this.smoothFactor):0,this._gamma=null!==e.gamma?V.w1.SmoothAngleChange(this._gamma,e.gamma,this.smoothFactor):0):(this._alpha=null!==e.alpha?e.alpha:0,this._beta=null!==e.beta?e.beta:0,this._gamma=null!==e.gamma?e.gamma:0),null!==e.alpha&&this._onDeviceOrientationChangedObservable.notifyObservers()},this._constantTranform=new o._f(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._orientationChanged()}static WaitForOrientationChangeAsync(e){return new Promise(((t,i)=>{let n=!1;const r=()=>{window.removeEventListener("deviceorientation",r),n=!0,t()};e&&setTimeout((()=>{n||(window.removeEventListener("deviceorientation",r),i("WaitForOrientationChangeAsync timed out"))}),e),"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((e=>{"granted"==e?window.addEventListener("deviceorientation",r):V.w1.Warn("Permission not granted.")})).catch((e=>{V.w1.Error(e)})):window.addEventListener("deviceorientation",r)}))}get camera(){return this._camera}set camera(e){this._camera=e,null==this._camera||this._camera.rotationQuaternion||(this._camera.rotationQuaternion=new o._f),this._camera&&this._camera.onDisposeObservable.add((()=>{this._onDeviceOrientationChangedObservable.clear()}))}attachControl(){const e=this.camera.getScene().getEngine().getHostWindow();if(e){const t=()=>{e.addEventListener("orientationchange",this._orientationChanged),e.addEventListener("deviceorientation",this._deviceOrientation),this._orientationChanged()};"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((e=>{"granted"===e?t():V.w1.Warn("Permission not granted.")})).catch((e=>{V.w1.Error(e)})):t()}}detachControl(){window.removeEventListener("orientationchange",this._orientationChanged),window.removeEventListener("deviceorientation",this._deviceOrientation),this._alpha=0}checkInputs(){this._alpha&&(o._f.RotationYawPitchRollToRef(V.w1.ToRadians(this._alpha),V.w1.ToRadians(this._beta),-V.w1.ToRadians(this._gamma),this.camera.rotationQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform),this._camera.rotationQuaternion.z*=-1,this._camera.rotationQuaternion.w*=-1)}getClassName(){return"FreeCameraDeviceOrientationInput"}getSimpleName(){return"deviceOrientation"}}de.u.FreeCameraDeviceOrientationInput=De;class Oe{constructor(){this.gamepadAngularSensibility=200,this.gamepadMoveSensibility=40,this.deadzoneDelta=.1,this._yAxisScale=1,this._cameraTransform=o.y3.Identity(),this._deltaTransform=o.P.Zero(),this._vector3=o.P.Zero(),this._vector2=o.FM.Zero()}get invertYAxis(){return 1!==this._yAxisScale}set invertYAxis(e){this._yAxisScale=e?-1:1}attachControl(){const e=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=e.onGamepadConnectedObservable.add((e=>{e.type!==ue.POSE_ENABLED&&(this.gamepad&&e.type!==ue.XBOX||(this.gamepad=e))})),this._onGamepadDisconnectedObserver=e.onGamepadDisconnectedObservable.add((e=>{this.gamepad===e&&(this.gamepad=null)})),this.gamepad=e.getGamepadByType(ue.XBOX),!this.gamepad&&e.gamepads.length&&(this.gamepad=e.gamepads[0])}detachControl(){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null}checkInputs(){if(this.gamepad&&this.gamepad.leftStick){const e=this.camera,t=this.gamepad.leftStick;0!==this.gamepadMoveSensibility&&(t.x=Math.abs(t.x)>this.deadzoneDelta?t.x/this.gamepadMoveSensibility:0,t.y=Math.abs(t.y)>this.deadzoneDelta?t.y/this.gamepadMoveSensibility:0);let i=this.gamepad.rightStick;i&&0!==this.gamepadAngularSensibility?(i.x=Math.abs(i.x)>this.deadzoneDelta?i.x/this.gamepadAngularSensibility:0,i.y=(Math.abs(i.y)>this.deadzoneDelta?i.y/this.gamepadAngularSensibility:0)*this._yAxisScale):i={x:0,y:0},e.rotationQuaternion?e.rotationQuaternion.toRotationMatrix(this._cameraTransform):o.y3.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,this._cameraTransform);const n=50*e._computeLocalCameraSpeed();this._vector3.copyFromFloats(t.x*n,0,-t.y*n),o.P.TransformCoordinatesToRef(this._vector3,this._cameraTransform,this._deltaTransform),e.cameraDirection.addInPlace(this._deltaTransform),this._vector2.copyFromFloats(i.y,i.x),e.cameraRotation.addInPlace(this._vector2)}}getClassName(){return"FreeCameraGamepadInput"}getSimpleName(){return"gamepad"}}(0,X.gn)([(0,Y.qC)()],Oe.prototype,"gamepadAngularSensibility",void 0),(0,X.gn)([(0,Y.qC)()],Oe.prototype,"gamepadMoveSensibility",void 0),de.u.FreeCameraGamepadInput=Oe,i("../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraKeyboardMoveInput.js"),i("../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseInput.js"),i("../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseWheelInput.js"),i("../../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraTouchInput.js");var we,Fe=i("../../../node_modules/@babylonjs/core/Misc/stringDictionary.js");!function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(we||(we={}));class Be{constructor(e,t){const i={...Be._GetDefaultOptions(),...t};if(this._leftJoystick=!!e,Be._GlobalJoystickIndex++,this._axisTargetedByLeftAndRight=we.X,this._axisTargetedByUpAndDown=we.Y,this.reverseLeftRight=!1,this.reverseUpDown=!1,this._touches=new Fe.x,this.deltaPosition=o.P.Zero(),this._joystickSensibility=25,this._inversedSensibility=1/(this._joystickSensibility/1e3),this._onResize=()=>{Be._VJCanvasWidth=window.innerWidth,Be._VJCanvasHeight=window.innerHeight,Be.Canvas&&(Be.Canvas.width=Be._VJCanvasWidth,Be.Canvas.height=Be._VJCanvasHeight),Be._HalfWidth=Be._VJCanvasWidth/2},!Be.Canvas){window.addEventListener("resize",this._onResize,!1),Be.Canvas=document.createElement("canvas"),Be._VJCanvasWidth=window.innerWidth,Be._VJCanvasHeight=window.innerHeight,Be.Canvas.width=window.innerWidth,Be.Canvas.height=window.innerHeight,Be.Canvas.style.width="100%",Be.Canvas.style.height="100%",Be.Canvas.style.position="absolute",Be.Canvas.style.backgroundColor="transparent",Be.Canvas.style.top="0px",Be.Canvas.style.left="0px",Be.Canvas.style.zIndex="5",Be.Canvas.style.touchAction="none",Be.Canvas.setAttribute("touch-action","none");const e=Be.Canvas.getContext("2d");if(!e)throw new Error("Unable to create canvas for virtual joystick");Be._VJCanvasContext=e,Be._VJCanvasContext.strokeStyle="#ffffff",Be._VJCanvasContext.lineWidth=2,document.body.appendChild(Be.Canvas)}Be._HalfWidth=Be.Canvas.width/2,this.pressed=!1,this.limitToContainer=i.limitToContainer,this._joystickColor=i.color,this.containerSize=i.containerSize,this.puckSize=i.puckSize,i.position&&this.setPosition(i.position.x,i.position.y),i.puckImage&&this.setPuckImage(i.puckImage),i.containerImage&&this.setContainerImage(i.containerImage),i.alwaysVisible&&Be._AlwaysVisibleSticks++,this.alwaysVisible=i.alwaysVisible,this._joystickPointerId=-1,this._joystickPointerPos=new o.FM(0,0),this._joystickPreviousPointerPos=new o.FM(0,0),this._joystickPointerStartPos=new o.FM(0,0),this._deltaJoystickVector=new o.FM(0,0),this._onPointerDownHandlerRef=e=>{this._onPointerDown(e)},this._onPointerMoveHandlerRef=e=>{this._onPointerMove(e)},this._onPointerUpHandlerRef=e=>{this._onPointerUp(e)},Be.Canvas.addEventListener("pointerdown",this._onPointerDownHandlerRef,!1),Be.Canvas.addEventListener("pointermove",this._onPointerMoveHandlerRef,!1),Be.Canvas.addEventListener("pointerup",this._onPointerUpHandlerRef,!1),Be.Canvas.addEventListener("pointerout",this._onPointerUpHandlerRef,!1),Be.Canvas.addEventListener("contextmenu",(e=>{e.preventDefault()}),!1),requestAnimationFrame((()=>{this._drawVirtualJoystick()}))}static _GetDefaultOptions(){return{puckSize:40,containerSize:60,color:"cyan",puckImage:void 0,containerImage:void 0,position:void 0,alwaysVisible:!1,limitToContainer:!1}}setJoystickSensibility(e){this._joystickSensibility=e,this._inversedSensibility=1/(this._joystickSensibility/1e3)}_onPointerDown(e){let t;e.preventDefault(),t=!0===this._leftJoystick?e.clientXBe._HalfWidth,t&&this._joystickPointerId<0?(this._joystickPointerId=e.pointerId,this._joystickPosition?(this._joystickPointerStartPos=this._joystickPosition.clone(),this._joystickPointerPos=this._joystickPosition.clone(),this._joystickPreviousPointerPos=this._joystickPosition.clone(),this._onPointerMove(e)):(this._joystickPointerStartPos.x=e.clientX,this._joystickPointerStartPos.y=e.clientY,this._joystickPointerPos=this._joystickPointerStartPos.clone(),this._joystickPreviousPointerPos=this._joystickPointerStartPos.clone()),this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this.pressed=!0,this._touches.add(e.pointerId.toString(),e)):Be._GlobalJoystickIndex<2&&this._action&&(this._action(),this._touches.add(e.pointerId.toString(),{x:e.clientX,y:e.clientY,prevX:e.clientX,prevY:e.clientY}))}_onPointerMove(e){if(this._joystickPointerId==e.pointerId){if(this.limitToContainer){const t=new o.FM(e.clientX-this._joystickPointerStartPos.x,e.clientY-this._joystickPointerStartPos.y),i=t.length();i>this.containerSize&&t.scaleInPlace(this.containerSize/i),this._joystickPointerPos.x=this._joystickPointerStartPos.x+t.x,this._joystickPointerPos.y=this._joystickPointerStartPos.y+t.y}else this._joystickPointerPos.x=e.clientX,this._joystickPointerPos.y=e.clientY;this._deltaJoystickVector=this._joystickPointerPos.clone(),this._deltaJoystickVector=this._deltaJoystickVector.subtract(this._joystickPointerStartPos),0this._containerImage=t}setPuckImage(e){const t=new Image;t.src=e,t.onload=()=>this._puckImage=t}_drawContainer(){const e=this._joystickPosition||this._joystickPointerStartPos;this._clearPreviousDraw(),this._containerImage?Be._VJCanvasContext.drawImage(this._containerImage,e.x-this.containerSize,e.y-this.containerSize,2*this.containerSize,2*this.containerSize):(Be._VJCanvasContext.beginPath(),Be._VJCanvasContext.strokeStyle=this._joystickColor,Be._VJCanvasContext.lineWidth=2,Be._VJCanvasContext.arc(e.x,e.y,this.containerSize,0,2*Math.PI,!0),Be._VJCanvasContext.stroke(),Be._VJCanvasContext.closePath(),Be._VJCanvasContext.beginPath(),Be._VJCanvasContext.lineWidth=6,Be._VJCanvasContext.strokeStyle=this._joystickColor,Be._VJCanvasContext.arc(e.x,e.y,this.puckSize,0,2*Math.PI,!0),Be._VJCanvasContext.stroke(),Be._VJCanvasContext.closePath())}_drawPuck(){this._puckImage?Be._VJCanvasContext.drawImage(this._puckImage,this._joystickPointerPos.x-this.puckSize,this._joystickPointerPos.y-this.puckSize,2*this.puckSize,2*this.puckSize):(Be._VJCanvasContext.beginPath(),Be._VJCanvasContext.strokeStyle=this._joystickColor,Be._VJCanvasContext.lineWidth=2,Be._VJCanvasContext.arc(this._joystickPointerPos.x,this._joystickPointerPos.y,this.puckSize,0,2*Math.PI,!0),Be._VJCanvasContext.stroke(),Be._VJCanvasContext.closePath())}_drawVirtualJoystick(){this.alwaysVisible&&this._drawContainer(),this.pressed&&this._touches.forEach(((e,t)=>{t.pointerId===this._joystickPointerId?(this.alwaysVisible||this._drawContainer(),this._drawPuck(),this._joystickPreviousPointerPos=this._joystickPointerPos.clone()):(Be._VJCanvasContext.clearRect(t.prevX-44,t.prevY-44,88,88),Be._VJCanvasContext.beginPath(),Be._VJCanvasContext.fillStyle="white",Be._VJCanvasContext.beginPath(),Be._VJCanvasContext.strokeStyle="red",Be._VJCanvasContext.lineWidth=6,Be._VJCanvasContext.arc(t.x,t.y,40,0,2*Math.PI,!0),Be._VJCanvasContext.stroke(),Be._VJCanvasContext.closePath(),t.prevX=t.x,t.prevY=t.y)})),requestAnimationFrame((()=>{this._drawVirtualJoystick()}))}releaseCanvas(){Be.Canvas&&(Be.Canvas.removeEventListener("pointerdown",this._onPointerDownHandlerRef),Be.Canvas.removeEventListener("pointermove",this._onPointerMoveHandlerRef),Be.Canvas.removeEventListener("pointerup",this._onPointerUpHandlerRef),Be.Canvas.removeEventListener("pointerout",this._onPointerUpHandlerRef),window.removeEventListener("resize",this._onResize),document.body.removeChild(Be.Canvas),Be.Canvas=null)}}Be._GlobalJoystickIndex=0,Be._AlwaysVisibleSticks=0,Me.a.prototype.addVirtualJoystick=function(){return this.add(new Ne),this};class Ne{getLeftJoystick(){return this._leftjoystick}getRightJoystick(){return this._rightjoystick}checkInputs(){if(this._leftjoystick){const e=this.camera,t=50*e._computeLocalCameraSpeed(),i=o.y3.RotationYawPitchRoll(e.rotation.y,e.rotation.x,0),n=o.P.TransformCoordinates(new o.P(this._leftjoystick.deltaPosition.x*t,this._leftjoystick.deltaPosition.y*t,this._leftjoystick.deltaPosition.z*t),i);e.cameraDirection=e.cameraDirection.add(n),e.cameraRotation=e.cameraRotation.addVector3(this._rightjoystick.deltaPosition),this._leftjoystick.pressed||(this._leftjoystick.deltaPosition=this._leftjoystick.deltaPosition.scale(.9)),this._rightjoystick.pressed||(this._rightjoystick.deltaPosition=this._rightjoystick.deltaPosition.scale(.9))}}attachControl(){this._leftjoystick=new Be(!0),this._leftjoystick.setAxisForUpDown(we.Z),this._leftjoystick.setAxisForLeftRight(we.X),this._leftjoystick.setJoystickSensibility(.15),this._rightjoystick=new Be(!1),this._rightjoystick.setAxisForUpDown(we.X),this._rightjoystick.setAxisForLeftRight(we.Y),this._rightjoystick.reverseUpDown=!0,this._rightjoystick.setJoystickSensibility(.05),this._rightjoystick.setJoystickColor("yellow")}detachControl(){this._leftjoystick.releaseCanvas(),this._rightjoystick.releaseCanvas()}getClassName(){return"FreeCameraVirtualJoystickInput"}getSimpleName(){return"virtualJoystick"}}de.u.FreeCameraVirtualJoystickInput=Ne;var Le=i("../../../node_modules/@babylonjs/core/Cameras/camera.js"),ke=i("../../../node_modules/@babylonjs/core/Cameras/targetCamera.js"),Ve=i("../../../node_modules/@babylonjs/core/Cameras/freeCamera.js"),Ue=i("../../../node_modules/@babylonjs/core/node.js");Ue.N.AddNodeConstructor("TouchCamera",((e,t)=>()=>new Ge(e,o.P.Zero(),t)));class Ge extends Ve.c{get touchAngularSensibility(){const e=this.inputs.attached.touch;return e?e.touchAngularSensibility:0}set touchAngularSensibility(e){const t=this.inputs.attached.touch;t&&(t.touchAngularSensibility=e)}get touchMoveSensibility(){const e=this.inputs.attached.touch;return e?e.touchMoveSensibility:0}set touchMoveSensibility(e){const t=this.inputs.attached.touch;t&&(t.touchMoveSensibility=e)}constructor(e,t,i){super(e,t,i),this.inputs.addTouch(),this._setupInputs()}getClassName(){return"TouchCamera"}_setupInputs(){const e=this.inputs.attached.touch,t=this.inputs.attached.mouse;t?t.touchEnabled=!1:e.allowMouse=!0}}var je=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js");Ue.N.AddNodeConstructor("ArcRotateCamera",((e,t)=>()=>new We(e,0,0,1,o.P.Zero(),t)));class We extends ke.C{constructor(e,t,i,n,r,a,l=!0){super(e,o.P.Zero(),a,l),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.lowerAlphaLimit=null,this.upperAlphaLimit=null,this.lowerBetaLimit=.01,this.upperBetaLimit=Math.PI-.01,this.lowerRadiusLimit=null,this.upperRadiusLimit=null,this.inertialPanningX=0,this.inertialPanningY=0,this.pinchToPanMaxDistance=20,this.panningDistanceLimit=null,this.panningOriginTarget=o.P.Zero(),this.panningInertia=.9,this.zoomOnFactor=1,this.targetScreenOffset=o.FM.Zero(),this.allowUpsideDown=!0,this.useInputToRestoreState=!0,this._viewMatrix=new o.y3,this.panningAxis=new o.P(1,1,0),this._transformedDirection=new o.P,this.mapPanning=!1,this.onMeshTargetChangedObservable=new s.y$,this.checkCollisions=!1,this.collisionRadius=new o.P(.5,.5,.5),this._previousPosition=o.P.Zero(),this._collisionVelocity=o.P.Zero(),this._newPosition=o.P.Zero(),this._computationVector=o.P.Zero(),this._onCollisionPositionChange=(e,t,i=null)=>{i?(this.setPosition(t),this.onCollide&&this.onCollide(i)):this._previousPosition.copyFrom(this._position);const n=Math.cos(this.alpha),r=Math.sin(this.alpha),s=Math.cos(this.beta);let o=Math.sin(this.beta);0===o&&(o=1e-4);const a=this._getTargetPosition();this._computationVector.copyFromFloats(this.radius*n*o,this.radius*s,this.radius*r*o),a.addToRef(this._computationVector,this._newPosition),this._position.copyFrom(this._newPosition);let l=this.upVector;this.allowUpsideDown&&this.beta<0&&(l=l.clone(),l=l.negate()),this._computeViewMatrix(this._position,a,l),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y),this._collisionTriggered=!1},this._target=o.P.Zero(),r&&this.setTarget(r),this.alpha=t,this.beta=i,this.radius=n,this.getViewMatrix(),this.inputs=new Se(this),this.inputs.addKeyboard().addMouseWheel().addPointers()}get target(){return this._target}set target(e){this.setTarget(e)}get targetHost(){return this._targetHost}set targetHost(e){e&&this.setTarget(e)}getTarget(){return this.target}get position(){return this._position}set position(e){this.setPosition(e)}set upVector(e){this._upToYMatrix||(this._yToUpMatrix=new o.y3,this._upToYMatrix=new o.y3,this._upVector=o.P.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()}get upVector(){return this._upVector}setMatUp(){o.y3.RotationAlignToRef(o.P.UpReadOnly,this._upVector,this._yToUpMatrix),o.y3.RotationAlignToRef(this._upVector,o.P.UpReadOnly,this._upToYMatrix)}get angularSensibilityX(){const e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0}set angularSensibilityX(e){const t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)}get angularSensibilityY(){const e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0}set angularSensibilityY(e){const t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)}get pinchPrecision(){const e=this.inputs.attached.pointers;return e?e.pinchPrecision:0}set pinchPrecision(e){const t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)}get pinchDeltaPercentage(){const e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0}set pinchDeltaPercentage(e){const t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)}get useNaturalPinchZoom(){const e=this.inputs.attached.pointers;return!!e&&e.useNaturalPinchZoom}set useNaturalPinchZoom(e){const t=this.inputs.attached.pointers;t&&(t.useNaturalPinchZoom=e)}get panningSensibility(){const e=this.inputs.attached.pointers;return e?e.panningSensibility:0}set panningSensibility(e){const t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)}get keysUp(){const e=this.inputs.attached.keyboard;return e?e.keysUp:[]}set keysUp(e){const t=this.inputs.attached.keyboard;t&&(t.keysUp=e)}get keysDown(){const e=this.inputs.attached.keyboard;return e?e.keysDown:[]}set keysDown(e){const t=this.inputs.attached.keyboard;t&&(t.keysDown=e)}get keysLeft(){const e=this.inputs.attached.keyboard;return e?e.keysLeft:[]}set keysLeft(e){const t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)}get keysRight(){const e=this.inputs.attached.keyboard;return e?e.keysRight:[]}set keysRight(e){const t=this.inputs.attached.keyboard;t&&(t.keysRight=e)}get wheelPrecision(){const e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0}set wheelPrecision(e){const t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)}get zoomToMouseLocation(){const e=this.inputs.attached.mousewheel;return!!e&&e.zoomToMouseLocation}set zoomToMouseLocation(e){const t=this.inputs.attached.mousewheel;t&&(t.zoomToMouseLocation=e)}get wheelDeltaPercentage(){const e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0}set wheelDeltaPercentage(e){const t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)}get bouncingBehavior(){return this._bouncingBehavior}get useBouncingBehavior(){return null!=this._bouncingBehavior}set useBouncingBehavior(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new ee,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))}get framingBehavior(){return this._framingBehavior}get useFramingBehavior(){return null!=this._framingBehavior}set useFramingBehavior(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new te,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))}get autoRotationBehavior(){return this._autoRotationBehavior}get useAutoRotationBehavior(){return null!=this._autoRotationBehavior}set useAutoRotationBehavior(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new J,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))}_initCache(){super._initCache(),this._cache._target=new o.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=o.FM.Zero()}_updateCache(e){e||super._updateCache(),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)}_getTargetPosition(){if(this._targetHost&&this._targetHost.getAbsolutePosition){const e=this._targetHost.getAbsolutePosition();this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)}return this._getLockedTargetPosition()||this._target}storeState(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),super.storeState()}_restoreStateValues(){return!!super._restoreStateValues()&&(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,!0)}_isSynchronizedViewMatrix(){return!!super._isSynchronizedViewMatrix()&&this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset)}attachControl(e,t,i=!0,n=2){const r=arguments;t=V.w1.BackCompatCameraNoPreventDefault(r),this._useCtrlForPanning=i,this._panningMouseButton=n,"boolean"==typeof r[0]&&(r.length>1&&(this._useCtrlForPanning=r[1]),r.length>2&&(this._panningMouseButton=r[2])),this.inputs.attachElement(t),this._reset=()=>{this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0}}detachControl(){this.inputs.detachElement(),this._reset&&this._reset()}_checkInputs(){if(!this._collisionTriggered){if(this.inputs.checkInputs(),0!==this.inertialAlphaOffset||0!==this.inertialBetaOffset||0!==this.inertialRadiusOffset){const e=this.invertRotation?-1:1;let t=this.inertialAlphaOffset;this.beta<=0&&(t*=-1),this.getScene().useRightHandedSystem&&(t*=-1),this.parent&&this.parent._getWorldMatrixDeterminant()<0&&(t*=-1),this.alpha+=t*e,this.beta+=this.inertialBetaOffset*e,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)<$.kn&&(this.inertialAlphaOffset=0),Math.abs(this.inertialBetaOffset)<$.kn&&(this.inertialBetaOffset=0),Math.abs(this.inertialRadiusOffset)Math.PI&&(this.beta=this.beta-2*Math.PI):this.betathis.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alphathis.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0)}rebuildAnglesAndRadius(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||o.P.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4);const e=this.alpha;0===this._computationVector.x&&0===this._computationVector.z?this.alpha=Math.PI/2:this.alpha=Math.acos(this._computationVector.x/Math.sqrt(Math.pow(this._computationVector.x,2)+Math.pow(this._computationVector.z,2))),this._computationVector.z<0&&(this.alpha=2*Math.PI-this.alpha);const t=Math.round((e-this.alpha)/(2*Math.PI));this.alpha+=2*t*Math.PI,this.beta=Math.acos(this._computationVector.y/this.radius),this._checkLimits()}setPosition(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())}setTarget(e,t=!1,i=!1,n=!1){var r;if(n=null!==(r=this.overrideCloneAlphaBetaRadius)&&void 0!==r?r:n,e.getBoundingInfo)this._targetBoundingCenter=t?e.getBoundingInfo().boundingBox.centerWorld.clone():null,e.computeWorldMatrix(),this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{const t=e,n=this._getTargetPosition();if(n&&!i&&n.equals(t))return;this._targetHost=null,this._target=t,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}n||this.rebuildAnglesAndRadius()}_getViewMatrix(){const e=Math.cos(this.alpha),t=Math.sin(this.alpha),i=Math.cos(this.beta);let n=Math.sin(this.beta);0===n&&(n=1e-4),0===this.radius&&(this.radius=1e-4);const r=this._getTargetPosition();if(this._computationVector.copyFromFloats(this.radius*e*n,this.radius*i,this.radius*t*n),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||o.P.TransformCoordinatesToRef(this._computationVector,this._yToUpMatrix,this._computationVector),r.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions){const e=this.getScene().collisionCoordinator;this._collider||(this._collider=e.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,e.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}else{this._position.copyFrom(this._newPosition);let e=this.upVector;this.allowUpsideDown&&n<0&&(e=e.negate()),this._computeViewMatrix(this._position,r,e),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)}return this._currentTarget=r,this._viewMatrix}zoomOn(e,t=!1){e=e||this.getScene().meshes;const i=je.Kj.MinMax(e),n=o.P.Distance(i.min,i.max);this.radius=n*this.zoomOnFactor,this.focusOn({min:i.min,max:i.max,distance:n},t)}focusOn(e,t=!1){let i,n;if(void 0===e.min){const t=e||this.getScene().meshes;i=je.Kj.MinMax(t),n=o.P.Distance(i.min,i.max)}else i=e,n=e.distance;this._target=je.Kj.Center(i),t||(this.maxZ=2*n)}createRigCamera(e,t){let i=0;switch(this.cameraRigMode){case Le.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Le.V.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Le.V.RIG_MODE_STEREOSCOPIC_INTERLACED:case Le.V.RIG_MODE_VR:i=this._cameraRigParams.stereoHalfAngle*(0===t?1:-1);break;case Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:i=this._cameraRigParams.stereoHalfAngle*(0===t?-1:1)}const n=new We(e,this.alpha+i,this.beta,this.radius,this._target,this.getScene());return n._cameraRigParams={},n.isRigCamera=!0,n.rigParent=this,n.upVector=this.upVector,n.mode=this.mode,n.orthoLeft=this.orthoLeft,n.orthoRight=this.orthoRight,n.orthoBottom=this.orthoBottom,n.orthoTop=this.orthoTop,n}_updateRigCameras(){const e=this._rigCameras[0],t=this._rigCameras[1];switch(e.beta=t.beta=this.beta,this.cameraRigMode){case Le.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Le.V.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Le.V.RIG_MODE_STEREOSCOPIC_INTERLACED:case Le.V.RIG_MODE_VR:e.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:e.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}super._updateRigCameras()}dispose(){this.inputs.clear(),super.dispose()}getClassName(){return"ArcRotateCamera"}}(0,X.gn)([(0,Y.qC)()],We.prototype,"alpha",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"beta",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"radius",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"overrideCloneAlphaBetaRadius",void 0),(0,X.gn)([(0,Y.hd)("target")],We.prototype,"_target",void 0),(0,X.gn)([(0,Y.RR)("targetHost")],We.prototype,"_targetHost",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"inertialAlphaOffset",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"inertialBetaOffset",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"inertialRadiusOffset",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"lowerAlphaLimit",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"upperAlphaLimit",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"lowerBetaLimit",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"upperBetaLimit",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"lowerRadiusLimit",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"upperRadiusLimit",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"inertialPanningX",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"inertialPanningY",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"pinchToPanMaxDistance",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"panningDistanceLimit",void 0),(0,X.gn)([(0,Y.hd)()],We.prototype,"panningOriginTarget",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"panningInertia",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"zoomToMouseLocation",null),(0,X.gn)([(0,Y.qC)()],We.prototype,"zoomOnFactor",void 0),(0,X.gn)([(0,Y.QC)()],We.prototype,"targetScreenOffset",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"allowUpsideDown",void 0),(0,X.gn)([(0,Y.qC)()],We.prototype,"useInputToRestoreState",void 0),Ue.N.AddNodeConstructor("DeviceOrientationCamera",((e,t)=>()=>new ze(e,o.P.Zero(),t)));class ze extends Ve.c{constructor(e,t,i){super(e,t,i),this._tmpDragQuaternion=new o._f,this._disablePointerInputWhenUsingDeviceOrientation=!0,this._dragFactor=0,this._quaternionCache=new o._f,this.inputs.addDeviceOrientation(),this.inputs._deviceOrientationInput&&this.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce((()=>{this._disablePointerInputWhenUsingDeviceOrientation&&this.inputs._mouseInput&&(this.inputs._mouseInput._allowCameraRotation=!1,this.inputs._mouseInput.onPointerMovedObservable.add((e=>{0!=this._dragFactor&&(this._initialQuaternion||(this._initialQuaternion=new o._f),o._f.FromEulerAnglesToRef(0,e.offsetX*this._dragFactor,0,this._tmpDragQuaternion),this._initialQuaternion.multiplyToRef(this._tmpDragQuaternion,this._initialQuaternion))})))}))}get disablePointerInputWhenUsingDeviceOrientation(){return this._disablePointerInputWhenUsingDeviceOrientation}set disablePointerInputWhenUsingDeviceOrientation(e){this._disablePointerInputWhenUsingDeviceOrientation=e}enableHorizontalDragging(e=1/300){this._dragFactor=e}getClassName(){return"DeviceOrientationCamera"}_checkInputs(){super._checkInputs(),this._quaternionCache.copyFrom(this.rotationQuaternion),this._initialQuaternion&&this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)}resetToCurrentRotation(e=ne.RD.Y){this.rotationQuaternion&&(this._initialQuaternion||(this._initialQuaternion=new o._f),this._initialQuaternion.copyFrom(this._quaternionCache||this.rotationQuaternion),["x","y","z"].forEach((t=>{e[t]?this._initialQuaternion[t]*=-1:this._initialQuaternion[t]=0})),this._initialQuaternion.normalize(),this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion))}}class He extends de.p{constructor(e){super(e)}addKeyboard(){return this.add(new Te),this}addMouse(){return this.add(new Ee),this}}class Xe extends ke.C{constructor(e,t,i,n=!0){super(e,t,i,n),this.ellipsoid=new o.P(1,1,1),this.ellipsoidOffset=new o.P(0,0,0),this.checkCollisions=!1,this.applyGravity=!1,this.cameraDirection=o.P.Zero(),this._trackRoll=0,this.rollCorrect=100,this.bankedTurn=!1,this.bankedTurnLimit=Math.PI/2,this.bankedTurnMultiplier=1,this._needMoveForGravity=!1,this._oldPosition=o.P.Zero(),this._diffPosition=o.P.Zero(),this._newPosition=o.P.Zero(),this._collisionMask=-1,this._onCollisionPositionChange=(e,t,i=null)=>{(e=>{this._newPosition.copyFrom(e),this._newPosition.subtractToRef(this._oldPosition,this._diffPosition),this._diffPosition.length()>k.D.CollisionsEpsilon&&(this.position.addInPlace(this._diffPosition),this.onCollide&&i&&this.onCollide(i))})(t)},this.inputs=new He(this),this.inputs.addKeyboard().addMouse()}get angularSensibility(){const e=this.inputs.attached.mouse;return e?e.angularSensibility:0}set angularSensibility(e){const t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)}get keysForward(){const e=this.inputs.attached.keyboard;return e?e.keysForward:[]}set keysForward(e){const t=this.inputs.attached.keyboard;t&&(t.keysForward=e)}get keysBackward(){const e=this.inputs.attached.keyboard;return e?e.keysBackward:[]}set keysBackward(e){const t=this.inputs.attached.keyboard;t&&(t.keysBackward=e)}get keysUp(){const e=this.inputs.attached.keyboard;return e?e.keysUp:[]}set keysUp(e){const t=this.inputs.attached.keyboard;t&&(t.keysUp=e)}get keysDown(){const e=this.inputs.attached.keyboard;return e?e.keysDown:[]}set keysDown(e){const t=this.inputs.attached.keyboard;t&&(t.keysDown=e)}get keysLeft(){const e=this.inputs.attached.keyboard;return e?e.keysLeft:[]}set keysLeft(e){const t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)}get keysRight(){const e=this.inputs.attached.keyboard;return e?e.keysRight:[]}set keysRight(e){const t=this.inputs.attached.keyboard;t&&(t.keysRight=e)}attachControl(e,t){t=V.w1.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)}detachControl(){this.inputs.detachElement(),this.cameraDirection=new o.P(0,0,0)}get collisionMask(){return this._collisionMask}set collisionMask(e){this._collisionMask=isNaN(e)?-1:e}_collideWithWorld(e){let t;t=this.parent?o.P.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position,t.subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);const i=this.getScene().collisionCoordinator;this._collider||(this._collider=i.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;let n=e;this.applyGravity&&(n=e.add(this.getScene().gravity)),i.getNewPosition(this._oldPosition,n,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}_checkInputs(){this._localDirection||(this._localDirection=o.P.Zero(),this._transformedDirection=o.P.Zero()),this.inputs.checkInputs(),super._checkInputs()}_decideIfNeedsToMove(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0}_updatePosition(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):super._updatePosition()}restoreRoll(e){const t=this._trackRoll,i=t-this.rotation.z;Math.abs(i)>=.001&&(this.rotation.z+=i/e,Math.abs(t-this.rotation.z)<=.001&&(this.rotation.z=t))}dispose(){this.inputs.clear(),super.dispose()}getClassName(){return"FlyCamera"}}(0,X.gn)([(0,Y.hd)()],Xe.prototype,"ellipsoid",void 0),(0,X.gn)([(0,Y.hd)()],Xe.prototype,"ellipsoidOffset",void 0),(0,X.gn)([(0,Y.qC)()],Xe.prototype,"checkCollisions",void 0),(0,X.gn)([(0,Y.qC)()],Xe.prototype,"applyGravity",void 0);class Ye extends de.p{constructor(e){super(e)}addKeyboard(){return this.add(new Re),this}addMouseWheel(){return this.add(new Pe),this}addPointers(){return this.add(new Ie),this}addVRDeviceOrientation(){return console.warn("DeviceOrientation support not yet implemented for FollowCamera."),this}}Ue.N.AddNodeConstructor("FollowCamera",((e,t)=>()=>new Qe(e,o.P.Zero(),t))),Ue.N.AddNodeConstructor("ArcFollowCamera",((e,t)=>()=>new qe(e,0,0,1,null,t)));class Qe extends ke.C{constructor(e,t,i,n=null){super(e,t,i),this.radius=12,this.lowerRadiusLimit=null,this.upperRadiusLimit=null,this.rotationOffset=0,this.lowerRotationOffsetLimit=null,this.upperRotationOffsetLimit=null,this.heightOffset=4,this.lowerHeightOffsetLimit=null,this.upperHeightOffsetLimit=null,this.cameraAcceleration=.05,this.maxCameraSpeed=20,this.lockedTarget=n,this.inputs=new Ye(this),this.inputs.addKeyboard().addMouseWheel().addPointers()}_follow(e){if(!e)return;const t=o.jp.Matrix[0];e.absoluteRotationQuaternion.toRotationMatrix(t);const i=Math.atan2(t.m[8],t.m[10]),n=V.w1.ToRadians(this.rotationOffset)+i,r=e.getAbsolutePosition(),s=r.x+Math.sin(n)*this.radius,a=r.z+Math.cos(n)*this.radius,l=s-this.position.x,c=r.y+this.heightOffset-this.position.y,h=a-this.position.z;let _=l*this.cameraAcceleration*2,d=c*this.cameraAcceleration,u=h*this.cameraAcceleration*2;(_>this.maxCameraSpeed||_<-this.maxCameraSpeed)&&(_=_<1?-this.maxCameraSpeed:this.maxCameraSpeed),(d>this.maxCameraSpeed||d<-this.maxCameraSpeed)&&(d=d<1?-this.maxCameraSpeed:this.maxCameraSpeed),(u>this.maxCameraSpeed||u<-this.maxCameraSpeed)&&(u=u<1?-this.maxCameraSpeed:this.maxCameraSpeed),this.position=new o.P(this.position.x+_,this.position.y+d,this.position.z+u),this.setTarget(r)}attachControl(e,t){t=V.w1.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t),this._reset=()=>{}}detachControl(){this.inputs.detachElement(),this._reset&&this._reset()}_checkInputs(){this.inputs.checkInputs(),this._checkLimits(),super._checkInputs(),this.lockedTarget&&this._follow(this.lockedTarget)}_checkLimits(){null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit),null!==this.lowerHeightOffsetLimit&&this.heightOffsetthis.upperHeightOffsetLimit&&(this.heightOffset=this.upperHeightOffsetLimit),null!==this.lowerRotationOffsetLimit&&this.rotationOffsetthis.upperRotationOffsetLimit&&(this.rotationOffset=this.upperRotationOffsetLimit)}getClassName(){return"FollowCamera"}}(0,X.gn)([(0,Y.qC)()],Qe.prototype,"radius",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"lowerRadiusLimit",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"upperRadiusLimit",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"rotationOffset",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"lowerRotationOffsetLimit",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"upperRotationOffsetLimit",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"heightOffset",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"lowerHeightOffsetLimit",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"upperHeightOffsetLimit",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"cameraAcceleration",void 0),(0,X.gn)([(0,Y.qC)()],Qe.prototype,"maxCameraSpeed",void 0),(0,X.gn)([(0,Y.RR)("lockedTargetId")],Qe.prototype,"lockedTarget",void 0);class qe extends ke.C{constructor(e,t,i,n,r,s){super(e,o.P.Zero(),s),this.alpha=t,this.beta=i,this.radius=n,this._cartesianCoordinates=o.P.Zero(),this.setMeshTarget(r)}setMeshTarget(e){this._meshTarget=e,this._follow()}_follow(){if(!this._meshTarget)return;this._cartesianCoordinates.x=this.radius*Math.cos(this.alpha)*Math.cos(this.beta),this._cartesianCoordinates.y=this.radius*Math.sin(this.beta),this._cartesianCoordinates.z=this.radius*Math.sin(this.alpha)*Math.cos(this.beta);const e=this._meshTarget.getAbsolutePosition();this.position=e.add(this._cartesianCoordinates),this.setTarget(e)}_checkInputs(){super._checkInputs(),this._follow()}getClassName(){return"ArcFollowCamera"}}var Ke,Ze,$e,Je,et,tt=i("../../../node_modules/@babylonjs/core/Culling/ray.js");!function(e){e[e.VIVE=0]="VIVE",e[e.OCULUS=1]="OCULUS",e[e.WINDOWS=2]="WINDOWS",e[e.GEAR_VR=3]="GEAR_VR",e[e.DAYDREAM=4]="DAYDREAM",e[e.GENERIC=5]="GENERIC"}(Ke||(Ke={}));class it{static InitiateController(e){for(const t of this._ControllerFactories)if(t.canCreate(e))return t.create(e);if(this._DefaultControllerFactory)return this._DefaultControllerFactory(e);throw"The type of gamepad you are trying to load needs to be imported first or is not supported."}}it._ControllerFactories=[],it._DefaultControllerFactory=null;class nt extends ue{constructor(e){super(e.id,e.index,e),this.isXR=!1,this._deviceRoomPosition=o.P.Zero(),this._deviceRoomRotationQuaternion=new o._f,this.devicePosition=o.P.Zero(),this.deviceRotationQuaternion=new o._f,this.deviceScaleFactor=1,this._trackPosition=!0,this._maxRotationDistFromHeadset=Math.PI/5,this._draggedRoomRotation=0,this._leftHandSystemQuaternion=new o._f,this._deviceToWorld=o.y3.Identity(),this._pointingPoseNode=null,this._workingMatrix=o.y3.Identity(),this._meshAttachedObservable=new s.y$,this.type=ue.POSE_ENABLED,this.controllerType=Ke.GENERIC,this.position=o.P.Zero(),this.rotationQuaternion=new o._f,this._calculatedPosition=o.P.Zero(),this._calculatedRotation=new o._f,o._f.RotationYawPitchRollToRef(Math.PI,0,0,this._leftHandSystemQuaternion)}_disableTrackPosition(e){this._trackPosition&&(this._calculatedPosition.copyFrom(e),this._trackPosition=!1)}update(){super.update(),this._updatePoseAndMesh()}_updatePoseAndMesh(){if(this.isXR)return;const e=this.browserGamepad.pose;if(this.updateFromDevice(e),!this._trackPosition&&m.l.LastCreatedScene&&m.l.LastCreatedScene.activeCamera&&m.l.LastCreatedScene.activeCamera.devicePosition){const e=m.l.LastCreatedScene.activeCamera;if(e._computeDevicePosition(),this._deviceToWorld.setTranslation(e.devicePosition),e.deviceRotationQuaternion){e._deviceRoomRotationQuaternion.toEulerAnglesToRef(o.jp.Vector3[0]);const t=Math.atan2(Math.sin(o.jp.Vector3[0].y-this._draggedRoomRotation),Math.cos(o.jp.Vector3[0].y-this._draggedRoomRotation));if(Math.abs(t)>this._maxRotationDistFromHeadset){const e=t-(t<0?-this._maxRotationDistFromHeadset:this._maxRotationDistFromHeadset);this._draggedRoomRotation+=e;const i=Math.sin(-e),n=Math.cos(-e);this._calculatedPosition.x=this._calculatedPosition.x*n-this._calculatedPosition.z*i,this._calculatedPosition.z=this._calculatedPosition.x*i+this._calculatedPosition.z*n}}}o.P.TransformCoordinatesToRef(this._calculatedPosition,this._deviceToWorld,this.devicePosition),this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix),o._f.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation),this._mesh&&(this._mesh.position.copyFrom(this.devicePosition),this._mesh.rotationQuaternion&&this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion))}updateFromDevice(e){if(!this.isXR&&e){this.rawPose=e,e.position&&(this._deviceRoomPosition.copyFromFloats(e.position[0],e.position[1],-e.position[2]),this._mesh&&this._mesh.getScene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1),this._trackPosition&&this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor,this._calculatedPosition),this._calculatedPosition.addInPlace(this.position));const t=this.rawPose;e.orientation&&t.orientation&&4===t.orientation.length&&(this._deviceRoomRotationQuaternion.copyFromFloats(t.orientation[0],t.orientation[1],-t.orientation[2],-t.orientation[3]),this._mesh&&(this._mesh.getScene().useRightHandedSystem?(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1):this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion,this._deviceRoomRotationQuaternion)),this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion,this._calculatedRotation))}}attachToMesh(e){if(this._mesh&&(this._mesh.parent=null),this._mesh=e,this._poseControlledCamera&&(this._mesh.parent=this._poseControlledCamera),this._mesh.rotationQuaternion||(this._mesh.rotationQuaternion=new o._f),!this.isXR&&(this._updatePoseAndMesh(),this._pointingPoseNode)){const e=[];let t=this._pointingPoseNode;for(;t.parent;)e.push(t.parent),t=t.parent;e.reverse().forEach((e=>{e.computeWorldMatrix(!0)}))}this._meshAttachedObservable.notifyObservers(e)}attachToPoseControlledCamera(e){this._poseControlledCamera=e,this._mesh&&(this._mesh.parent=this._poseControlledCamera)}dispose(){this._mesh&&this._mesh.dispose(),this._mesh=null,super.dispose()}get mesh(){return this._mesh}getForwardRay(e=100){if(!this.mesh)return new tt.z(o.P.Zero(),new o.P(0,0,1),e);const t=this._pointingPoseNode?this._pointingPoseNode.getWorldMatrix():this.mesh.getWorldMatrix(),i=t.getTranslation(),n=new o.P(0,0,-1),r=o.P.TransformNormal(n,t),s=o.P.Normalize(r);return new tt.z(i,s,e)}}nt.POINTING_POSE="POINTING_POSE",function(e){e[e.A=0]="A",e[e.B=1]="B",e[e.X=2]="X",e[e.Y=3]="Y",e[e.LB=4]="LB",e[e.RB=5]="RB",e[e.Back=8]="Back",e[e.Start=9]="Start",e[e.LeftStick=10]="LeftStick",e[e.RightStick=11]="RightStick"}(Ze||(Ze={})),function(e){e[e.Up=12]="Up",e[e.Down=13]="Down",e[e.Left=14]="Left",e[e.Right=15]="Right"}($e||($e={}));class rt extends ue{constructor(e,t,i,n=!1){super(e,t,i,0,1,2,3),this._leftTrigger=0,this._rightTrigger=0,this.onButtonDownObservable=new s.y$,this.onButtonUpObservable=new s.y$,this.onPadDownObservable=new s.y$,this.onPadUpObservable=new s.y$,this._buttonA=0,this._buttonB=0,this._buttonX=0,this._buttonY=0,this._buttonBack=0,this._buttonStart=0,this._buttonLB=0,this._buttonRB=0,this._buttonLeftStick=0,this._buttonRightStick=0,this._dPadUp=0,this._dPadDown=0,this._dPadLeft=0,this._dPadRight=0,this._isXboxOnePad=!1,this.type=ue.XBOX,this._isXboxOnePad=n}onlefttriggerchanged(e){this._onlefttriggerchanged=e}onrighttriggerchanged(e){this._onrighttriggerchanged=e}get leftTrigger(){return this._leftTrigger}set leftTrigger(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e}get rightTrigger(){return this._rightTrigger}set rightTrigger(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e}onbuttondown(e){this._onbuttondown=e}onbuttonup(e){this._onbuttonup=e}ondpaddown(e){this._ondpaddown=e}ondpadup(e){this._ondpadup=e}_setButtonValue(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e}_setDPadValue(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e}get buttonA(){return this._buttonA}set buttonA(e){this._buttonA=this._setButtonValue(e,this._buttonA,Ze.A)}get buttonB(){return this._buttonB}set buttonB(e){this._buttonB=this._setButtonValue(e,this._buttonB,Ze.B)}get buttonX(){return this._buttonX}set buttonX(e){this._buttonX=this._setButtonValue(e,this._buttonX,Ze.X)}get buttonY(){return this._buttonY}set buttonY(e){this._buttonY=this._setButtonValue(e,this._buttonY,Ze.Y)}get buttonStart(){return this._buttonStart}set buttonStart(e){this._buttonStart=this._setButtonValue(e,this._buttonStart,Ze.Start)}get buttonBack(){return this._buttonBack}set buttonBack(e){this._buttonBack=this._setButtonValue(e,this._buttonBack,Ze.Back)}get buttonLB(){return this._buttonLB}set buttonLB(e){this._buttonLB=this._setButtonValue(e,this._buttonLB,Ze.LB)}get buttonRB(){return this._buttonRB}set buttonRB(e){this._buttonRB=this._setButtonValue(e,this._buttonRB,Ze.RB)}get buttonLeftStick(){return this._buttonLeftStick}set buttonLeftStick(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,Ze.LeftStick)}get buttonRightStick(){return this._buttonRightStick}set buttonRightStick(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,Ze.RightStick)}get dPadUp(){return this._dPadUp}set dPadUp(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,$e.Up)}get dPadDown(){return this._dPadDown}set dPadDown(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,$e.Down)}get dPadLeft(){return this._dPadLeft}set dPadLeft(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,$e.Left)}get dPadRight(){return this._dPadRight}set dPadRight(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,$e.Right)}update(){super.update(),this._isXboxOnePad,this.buttonA=this.browserGamepad.buttons[0].value,this.buttonB=this.browserGamepad.buttons[1].value,this.buttonX=this.browserGamepad.buttons[2].value,this.buttonY=this.browserGamepad.buttons[3].value,this.buttonLB=this.browserGamepad.buttons[4].value,this.buttonRB=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonBack=this.browserGamepad.buttons[8].value,this.buttonStart=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value}dispose(){super.dispose(),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()}}!function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.L1=4]="L1",e[e.R1=5]="R1",e[e.Share=8]="Share",e[e.Options=9]="Options",e[e.LeftStick=10]="LeftStick",e[e.RightStick=11]="RightStick"}(Je||(Je={})),function(e){e[e.Up=12]="Up",e[e.Down=13]="Down",e[e.Left=14]="Left",e[e.Right=15]="Right"}(et||(et={}));class st extends ue{constructor(e,t,i){super(e.replace("STANDARD GAMEPAD","SONY PLAYSTATION DUALSHOCK"),t,i,0,1,2,3),this._leftTrigger=0,this._rightTrigger=0,this.onButtonDownObservable=new s.y$,this.onButtonUpObservable=new s.y$,this.onPadDownObservable=new s.y$,this.onPadUpObservable=new s.y$,this._buttonCross=0,this._buttonCircle=0,this._buttonSquare=0,this._buttonTriangle=0,this._buttonShare=0,this._buttonOptions=0,this._buttonL1=0,this._buttonR1=0,this._buttonLeftStick=0,this._buttonRightStick=0,this._dPadUp=0,this._dPadDown=0,this._dPadLeft=0,this._dPadRight=0,this.type=ue.DUALSHOCK}onlefttriggerchanged(e){this._onlefttriggerchanged=e}onrighttriggerchanged(e){this._onrighttriggerchanged=e}get leftTrigger(){return this._leftTrigger}set leftTrigger(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e}get rightTrigger(){return this._rightTrigger}set rightTrigger(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e}onbuttondown(e){this._onbuttondown=e}onbuttonup(e){this._onbuttonup=e}ondpaddown(e){this._ondpaddown=e}ondpadup(e){this._ondpadup=e}_setButtonValue(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e}_setDPadValue(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e}get buttonCross(){return this._buttonCross}set buttonCross(e){this._buttonCross=this._setButtonValue(e,this._buttonCross,Je.Cross)}get buttonCircle(){return this._buttonCircle}set buttonCircle(e){this._buttonCircle=this._setButtonValue(e,this._buttonCircle,Je.Circle)}get buttonSquare(){return this._buttonSquare}set buttonSquare(e){this._buttonSquare=this._setButtonValue(e,this._buttonSquare,Je.Square)}get buttonTriangle(){return this._buttonTriangle}set buttonTriangle(e){this._buttonTriangle=this._setButtonValue(e,this._buttonTriangle,Je.Triangle)}get buttonOptions(){return this._buttonOptions}set buttonOptions(e){this._buttonOptions=this._setButtonValue(e,this._buttonOptions,Je.Options)}get buttonShare(){return this._buttonShare}set buttonShare(e){this._buttonShare=this._setButtonValue(e,this._buttonShare,Je.Share)}get buttonL1(){return this._buttonL1}set buttonL1(e){this._buttonL1=this._setButtonValue(e,this._buttonL1,Je.L1)}get buttonR1(){return this._buttonR1}set buttonR1(e){this._buttonR1=this._setButtonValue(e,this._buttonR1,Je.R1)}get buttonLeftStick(){return this._buttonLeftStick}set buttonLeftStick(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,Je.LeftStick)}get buttonRightStick(){return this._buttonRightStick}set buttonRightStick(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,Je.RightStick)}get dPadUp(){return this._dPadUp}set dPadUp(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,et.Up)}get dPadDown(){return this._dPadDown}set dPadDown(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,et.Down)}get dPadLeft(){return this._dPadLeft}set dPadLeft(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,et.Left)}get dPadRight(){return this._dPadRight}set dPadRight(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,et.Right)}update(){super.update(),this.buttonCross=this.browserGamepad.buttons[0].value,this.buttonCircle=this.browserGamepad.buttons[1].value,this.buttonSquare=this.browserGamepad.buttons[2].value,this.buttonTriangle=this.browserGamepad.buttons[3].value,this.buttonL1=this.browserGamepad.buttons[4].value,this.buttonR1=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonShare=this.browserGamepad.buttons[8].value,this.buttonOptions=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value}dispose(){super.dispose(),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()}}class ot{constructor(e){if(this._scene=e,this._babylonGamepads=[],this._oneGamepadConnected=!1,this._isMonitoring=!1,this.onGamepadDisconnectedObservable=new s.y$,(0,U.CG)()?(this._gamepadEventSupported="GamepadEvent"in window,this._gamepadSupport=navigator&&navigator.getGamepads):this._gamepadEventSupported=!1,this.onGamepadConnectedObservable=new s.y$((e=>{for(const t in this._babylonGamepads){const i=this._babylonGamepads[t];i&&i._isConnected&&this.onGamepadConnectedObservable.notifyObserver(e,i)}})),this._onGamepadConnectedEvent=e=>{const t=e.gamepad;if(t.index in this._babylonGamepads&&this._babylonGamepads[t.index].isConnected)return;let i;this._babylonGamepads[t.index]?(i=this._babylonGamepads[t.index],i.browserGamepad=t,i._isConnected=!0):i=this._addNewGamepad(t),this.onGamepadConnectedObservable.notifyObservers(i),this._startMonitoringGamepads()},this._onGamepadDisconnectedEvent=e=>{const t=e.gamepad;for(const e in this._babylonGamepads)if(this._babylonGamepads[e].index===t.index){const t=this._babylonGamepads[e];t._isConnected=!1,this.onGamepadDisconnectedObservable.notifyObservers(t),t.dispose&&t.dispose();break}},this._gamepadSupport)if(this._updateGamepadObjects(),this._babylonGamepads.length&&this._startMonitoringGamepads(),this._gamepadEventSupported){const e=this._scene?this._scene.getEngine().getHostWindow():window;e&&(e.addEventListener("gamepadconnected",this._onGamepadConnectedEvent,!1),e.addEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent,!1))}else this._startMonitoringGamepads()}get gamepads(){return this._babylonGamepads}getGamepadByType(e=ue.XBOX){for(const t of this._babylonGamepads)if(t&&t.type===e)return t;return null}dispose(){this._gamepadEventSupported&&(this._onGamepadConnectedEvent&&window.removeEventListener("gamepadconnected",this._onGamepadConnectedEvent),this._onGamepadDisconnectedEvent&&window.removeEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent),this._onGamepadConnectedEvent=null,this._onGamepadDisconnectedEvent=null),this._babylonGamepads.forEach((e=>{e.dispose()})),this.onGamepadConnectedObservable.clear(),this.onGamepadDisconnectedObservable.clear(),this._oneGamepadConnected=!1,this._stopMonitoringGamepads(),this._babylonGamepads=[]}_addNewGamepad(e){let t;this._oneGamepadConnected||(this._oneGamepadConnected=!0);const i=-1!==e.id.search("054c")&&-1===e.id.search("0ce6"),n=-1!==e.id.search("Xbox One");return t=n||-1!==e.id.search("Xbox 360")||-1!==e.id.search("xinput")||-1!==e.id.search("045e")&&-1===e.id.search("Surface Dock")?new rt(e.id,e.index,e,n):i?new st(e.id,e.index,e):e.pose?it.InitiateController(e):new pe(e.id,e.index,e),this._babylonGamepads[t.index]=t,t}_startMonitoringGamepads(){this._isMonitoring||(this._isMonitoring=!0,this._scene||this._checkGamepadsStatus())}_stopMonitoringGamepads(){this._isMonitoring=!1}_checkGamepadsStatus(){this._updateGamepadObjects();for(const e in this._babylonGamepads){const t=this._babylonGamepads[e];if(t&&t.isConnected)try{t.update()}catch(e){-1===this._loggedErrors.indexOf(t.index)&&(V.w1.Warn(`Error updating gamepad ${t.id}`),this._loggedErrors.push(t.index))}}this._isMonitoring&&!this._scene&&k.D.QueueNewFrame((()=>{this._checkGamepadsStatus()}))}_updateGamepadObjects(){const e=navigator.getGamepads?navigator.getGamepads():[];for(let t=0;t()=>new lt(e,o.P.Zero(),t)));class lt extends Ge{get gamepadAngularSensibility(){const e=this.inputs.attached.gamepad;return e?e.gamepadAngularSensibility:0}set gamepadAngularSensibility(e){const t=this.inputs.attached.gamepad;t&&(t.gamepadAngularSensibility=e)}get gamepadMoveSensibility(){const e=this.inputs.attached.gamepad;return e?e.gamepadMoveSensibility:0}set gamepadMoveSensibility(e){const t=this.inputs.attached.gamepad;t&&(t.gamepadMoveSensibility=e)}constructor(e,t,i){super(e,t,i),this.inputs.addGamepad()}getClassName(){return"UniversalCamera"}}Le.V._CreateDefaultParsedCamera=(e,t)=>new lt(e,o.P.Zero(),t),Ue.N.AddNodeConstructor("GamepadCamera",((e,t)=>()=>new ct(e,o.P.Zero(),t)));class ct extends lt{constructor(e,t,i){super(e,t,i)}getClassName(){return"GamepadCamera"}}var ht=i("../../../node_modules/@babylonjs/core/PostProcesses/passPostProcess.js"),_t=i("../../../node_modules/@babylonjs/core/PostProcesses/postProcess.js"),dt=i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js");dt.v.ShadersStore.anaglyphPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D leftSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 leftFrag=texture2D(leftSampler,vUV);\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\nvec4 rightFrag=texture2D(textureSampler,vUV);\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\n}";class ut extends _t.D{constructor(e,t,i,n,r,s){super(e,"anaglyph",null,["leftSampler"],t,i[1],n,r,s),this._passedProcess=i[0]._rigPostProcess,this.onApplyObservable.add((e=>{e.setTextureFromPostProcess("leftSampler",this._passedProcess)}))}getClassName(){return"AnaglyphPostProcess"}}function pt(e){e._rigCameras[0]._rigPostProcess=new ht.Q(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new ut(e.name+"_anaglyph",1,e._rigCameras)}(0,l.H)("BABYLON.AnaglyphPostProcess",ut),Ue.N.AddNodeConstructor("AnaglyphArcRotateCamera",((e,t,i)=>()=>new ft(e,0,0,1,o.P.Zero(),i.interaxial_distance,t)));class ft extends We{constructor(e,t,i,n,r,s,o){super(e,t,i,n,r,o),this._setRigMode=pt.bind(null,this),this.interaxialDistance=s,this.setCameraRigMode(Le.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:s})}getClassName(){return"AnaglyphArcRotateCamera"}}Ue.N.AddNodeConstructor("AnaglyphFreeCamera",((e,t,i)=>()=>new mt(e,o.P.Zero(),i.interaxial_distance,t)));class mt extends Ve.c{constructor(e,t,i,n){super(e,t,n),this._setRigMode=pt.bind(null,this),this.interaxialDistance=i,this.setCameraRigMode(Le.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i})}getClassName(){return"AnaglyphFreeCamera"}}Ue.N.AddNodeConstructor("AnaglyphGamepadCamera",((e,t,i)=>()=>new gt(e,o.P.Zero(),i.interaxial_distance,t)));class gt extends ct{constructor(e,t,i,n){super(e,t,n),this._setRigMode=pt.bind(null,this),this.interaxialDistance=i,this.setCameraRigMode(Le.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i})}getClassName(){return"AnaglyphGamepadCamera"}}Ue.N.AddNodeConstructor("AnaglyphUniversalCamera",((e,t,i)=>()=>new bt(e,o.P.Zero(),i.interaxial_distance,t)));class bt extends lt{constructor(e,t,i,n){super(e,t,n),this._setRigMode=pt.bind(null,this),this.interaxialDistance=i,this.setCameraRigMode(Le.V.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i})}getClassName(){return"AnaglyphUniversalCamera"}}var yt=i("../../../node_modules/@babylonjs/core/Maths/math.viewport.js");dt.v.ShadersStore.stereoscopicInterlacePixelShader="const vec3 TWO=vec3(2.0,2.0,2.0);\nvarying vec2 vUV;\nuniform sampler2D camASampler;\nuniform sampler2D textureSampler;\nuniform vec2 stepSize;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nbool useCamA;\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\nuseCamA=!useCamB;\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\n#ifdef IS_STEREOSCOPIC_INTERLACED\nfloat rowNum=floor(vUV.y/stepSize.y);\nuseCamA=mod(rowNum,2.0)==1.0;\nuseCamB=mod(rowNum,2.0)==0.0;\ntexCoord1=vec2(vUV.x,vUV.y);\ntexCoord2=vec2(vUV.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\nuseCamA=!useCamB;\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n#endif\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else if (useCamA){\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}else {\ndiscard;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}\n";class vt extends _t.D{constructor(e,t,i,n,r,s,a){super(e,"stereoscopicInterlace",["stepSize"],["camASampler"],1,t[1],r,s,a,n?"#define IS_STEREOSCOPIC_INTERLACED 1":i?"#define IS_STEREOSCOPIC_HORIZ 1":void 0),this._passedProcess=t[0]._rigPostProcess,this._stepSize=new o.FM(1/this.width,1/this.height),this.onSizeChangedObservable.add((()=>{this._stepSize=new o.FM(1/this.width,1/this.height)})),this.onApplyObservable.add((e=>{e.setTextureFromPostProcess("camASampler",this._passedProcess),e.setFloat2("stepSize",this._stepSize.x,this._stepSize.y)}))}getClassName(){return"StereoscopicInterlacePostProcessI"}}function At(e){const t=e.cameraRigMode===Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||e.cameraRigMode===Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED,i=e.cameraRigMode===Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;e.cameraRigMode===Le.V.RIG_MODE_STEREOSCOPIC_INTERLACED?(e._rigCameras[0]._rigPostProcess=new ht.Q(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new vt(e.name+"_stereoInterlace",e._rigCameras,!1,!0)):(e._rigCameras[i?1:0].viewport=new yt.l(0,0,t?.5:1,t?1:.5),e._rigCameras[i?0:1].viewport=new yt.l(t?.5:0,t?0:.5,t?.5:1,t?1:.5))}Ue.N.AddNodeConstructor("StereoscopicArcRotateCamera",((e,t,i)=>()=>new Ct(e,0,0,1,o.P.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)));class Ct extends We{constructor(e,t,i,n,r,s,o,a){super(e,t,i,n,r,a),this._setRigMode=At.bind(null,this),this.interaxialDistance=s,this.isStereoscopicSideBySide=o,this.setCameraRigMode(o?Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Le.V.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:s})}getClassName(){return"StereoscopicArcRotateCamera"}}Ue.N.AddNodeConstructor("StereoscopicFreeCamera",((e,t,i)=>()=>new St(e,o.P.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)));class St extends Ve.c{constructor(e,t,i,n,r){super(e,t,r),this._setRigMode=At.bind(null,this),this.interaxialDistance=i,this.isStereoscopicSideBySide=n,this.setCameraRigMode(n?Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Le.V.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i})}getClassName(){return"StereoscopicFreeCamera"}}Ue.N.AddNodeConstructor("StereoscopicGamepadCamera",((e,t,i)=>()=>new xt(e,o.P.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)));class xt extends ct{constructor(e,t,i,n,r){super(e,t,r),this._setRigMode=At.bind(null,this),this.interaxialDistance=i,this.isStereoscopicSideBySide=n,this.setCameraRigMode(n?Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Le.V.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i})}getClassName(){return"StereoscopicGamepadCamera"}}Ue.N.AddNodeConstructor("StereoscopicFreeCamera",((e,t,i)=>()=>new Tt(e,o.P.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)));class Tt extends lt{constructor(e,t,i,n,r){super(e,t,r),this._setRigMode=At.bind(null,this),this.interaxialDistance=i,this.isStereoscopicSideBySide=n,this.setCameraRigMode(n?Le.V.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Le.V.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i})}getClassName(){return"StereoscopicUniversalCamera"}}var Et=i("../../../node_modules/@babylonjs/core/Meshes/transformNode.js");Ue.N.AddNodeConstructor("VirtualJoysticksCamera",((e,t)=>()=>new Rt(e,o.P.Zero(),t)));class Rt extends Ve.c{constructor(e,t,i){super(e,t,i),this.inputs.addVirtualJoystick()}getClassName(){return"VirtualJoysticksCamera"}}class Pt{constructor(){this.compensateDistortion=!0,this.multiviewEnabled=!1}get aspectRatio(){return this.hResolution/(2*this.vResolution)}get aspectRatioFov(){return 2*Math.atan(this.postProcessScaleFactor*this.vScreenSize/(2*this.eyeToScreenDistance))}get leftHMatrix(){const e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return o.y3.Translation(e,0,0)}get rightHMatrix(){const e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return o.y3.Translation(-e,0,0)}get leftPreViewMatrix(){return o.y3.Translation(.5*this.interpupillaryDistance,0,0)}get rightPreViewMatrix(){return o.y3.Translation(-.5*this.interpupillaryDistance,0,0)}static GetDefault(){const e=new Pt;return e.hResolution=1280,e.vResolution=800,e.hScreenSize=.149759993,e.vScreenSize=.0935999975,e.vScreenCenter=.0467999987,e.eyeToScreenDistance=.0410000011,e.lensSeparationDistance=.063500002,e.interpupillaryDistance=.064000003,e.distortionK=[1,.219999999,.239999995,0],e.chromaAbCorrection=[.995999992,-.00400000019,1.01400006,0],e.postProcessScaleFactor=1.714605507808412,e.lensCenterOffset=.151976421,e}}dt.v.ShadersStore.vrDistortionCorrectionPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 LensCenter;\nuniform vec2 Scale;\nuniform vec2 ScaleIn;\nuniform vec4 HmdWarpParam;\nvec2 HmdWarp(vec2 in01) {\nvec2 theta=(in01-LensCenter)*ScaleIn; \nfloat rSq=theta.x*theta.x+theta.y*theta.y;\nvec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);\nreturn LensCenter+Scale*rvector;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec2 tc=HmdWarp(vUV);\nif (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);\nelse{\ngl_FragColor=texture2D(textureSampler,tc);\n}\n}";class It extends _t.D{constructor(e,t,i,n){super(e,"vrDistortionCorrection",["LensCenter","Scale","ScaleIn","HmdWarpParam"],null,n.postProcessScaleFactor,t,K.x.BILINEAR_SAMPLINGMODE),this._isRightEye=i,this._distortionFactors=n.distortionK,this._postProcessScaleFactor=n.postProcessScaleFactor,this._lensCenterOffset=n.lensCenterOffset,this.adaptScaleToCurrentViewport=!0,this.onSizeChangedObservable.add((()=>{this._scaleIn=new o.FM(2,2/this.aspectRatio),this._scaleFactor=new o.FM(1/this._postProcessScaleFactor*.5,1/this._postProcessScaleFactor*.5*this.aspectRatio),this._lensCenter=new o.FM(this._isRightEye?.5-.5*this._lensCenterOffset:.5+.5*this._lensCenterOffset,.5)})),this.onApplyObservable.add((e=>{e.setFloat2("LensCenter",this._lensCenter.x,this._lensCenter.y),e.setFloat2("Scale",this._scaleFactor.x,this._scaleFactor.y),e.setFloat2("ScaleIn",this._scaleIn.x,this._scaleIn.y),e.setFloat4("HmdWarpParam",this._distortionFactors[0],this._distortionFactors[1],this._distortionFactors[2],this._distortionFactors[3])}))}getClassName(){return"VRDistortionCorrectionPostProcess"}}dt.v.ShadersStore.vrMultiviewToSingleviewPixelShader="precision mediump sampler2DArray;\nvarying vec2 vUV;\nuniform sampler2DArray multiviewSampler;\nuniform int imageIndex;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\ngl_FragColor=texture2D(multiviewSampler,vec3(vUV,imageIndex));\n}";var Mt=i("../../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js"),Dt=i("../../../node_modules/@babylonjs/core/Materials/uniformBuffer.js"),Ot=i("../../../node_modules/@babylonjs/core/Materials/Textures/renderTargetTexture.js");class wt extends Ot._{set samples(e){this._samples=e}constructor(e,t=512){super("multiview rtt",t,e,!1,!0,0,!1,void 0,!1,!1,!0,void 0,!0),this._renderTarget=this.getScene().getEngine().createMultiviewRenderTargetTexture(this.getRenderWidth(),this.getRenderHeight()),this._texture=this._renderTarget.texture,this._texture.isMultiview=!0,this._texture.format=5,this.samples=this._getEngine().getCaps().maxSamples||this.samples,this._texture.samples=this._samples}_bindFrameBuffer(){this._renderTarget&&this.getScene().getEngine().bindMultiviewFramebuffer(this._renderTarget)}getViewCount(){return 2}}var Ft=i("../../../node_modules/@babylonjs/core/Maths/math.frustum.js");function Bt(e,t){const i=new Dt.M(e,void 0,!0,t);return i.addUniform("viewProjection",16),i.addUniform("viewProjectionR",16),i.addUniform("view",16),i.addUniform("projection",16),i.addUniform("vEyePosition",4),i}k.D.prototype.createMultiviewRenderTargetTexture=function(e,t){const i=this._gl;if(!this.getCaps().multiview)throw"Multiview is not supported";const n=this._createHardwareRenderTargetWrapper(!1,!1,{width:e,height:t});n._framebuffer=i.createFramebuffer();const r=new Mt.l(this,Mt.S.Unknown,!0);return r.width=e,r.height=t,r.isMultiview=!0,n._colorTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._colorTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.RGBA8,e,t,2),n._depthStencilTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._depthStencilTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.DEPTH24_STENCIL8,e,t,2),r.isReady=!0,n.setTextures(r),n._depthStencilTexture=r,n},k.D.prototype.bindMultiviewFramebuffer=function(e){const t=e,i=this._gl,n=this.getCaps().oculusMultiview||this.getCaps().multiview;if(this.bindFramebuffer(t,void 0,void 0,void 0,!0),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,t._framebuffer),!t._colorTextureArray||!t._depthStencilTextureArray)throw"Invalid multiview frame buffer";this.getCaps().oculusMultiview?(n.framebufferTextureMultisampleMultiviewOVR(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,t._colorTextureArray,0,t.samples,0,2),n.framebufferTextureMultisampleMultiviewOVR(i.DRAW_FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,t._depthStencilTextureArray,0,t.samples,0,2)):(n.framebufferTextureMultiviewOVR(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,t._colorTextureArray,0,0,2),n.framebufferTextureMultiviewOVR(i.DRAW_FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,t._depthStencilTextureArray,0,0,2))},Le.V.prototype._useMultiviewToSingleView=!1,Le.V.prototype._multiviewTexture=null,Le.V.prototype._resizeOrCreateMultiviewTexture=function(e,t){this._multiviewTexture?this._multiviewTexture.getRenderWidth()==e&&this._multiviewTexture.getRenderHeight()==t||(this._multiviewTexture.dispose(),this._multiviewTexture=new wt(this.getScene(),{width:e,height:t})):this._multiviewTexture=new wt(this.getScene(),{width:e,height:t})};const Nt=R.x.prototype.createSceneUniformBuffer;R.x.prototype._transformMatrixR=o.y3.Zero(),R.x.prototype._multiviewSceneUbo=null,R.x.prototype._createMultiviewUbo=function(){this._multiviewSceneUbo=Bt(this.getEngine(),"scene_multiview")},R.x.prototype.createSceneUniformBuffer=function(e){return this._multiviewSceneUbo?Bt(this.getEngine(),e):Nt.bind(this)(e)},R.x.prototype._updateMultiviewUbo=function(e,t){e&&t&&e.multiplyToRef(t,this._transformMatrixR),e&&t&&(e.multiplyToRef(t,o.jp.Matrix[0]),Ft.i.GetRightPlaneToRef(o.jp.Matrix[0],this._frustumPlanes[3])),this._multiviewSceneUbo&&(this._multiviewSceneUbo.updateMatrix("viewProjection",this.getTransformMatrix()),this._multiviewSceneUbo.updateMatrix("viewProjectionR",this._transformMatrixR),this._multiviewSceneUbo.updateMatrix("view",this._viewMatrix),this._multiviewSceneUbo.updateMatrix("projection",this._projectionMatrix))},R.x.prototype._renderMultiviewToSingleView=function(e){e._resizeOrCreateMultiviewTexture(e._rigPostProcess&&e._rigPostProcess&&e._rigPostProcess.width>0?e._rigPostProcess.width:this.getEngine().getRenderWidth(!0),e._rigPostProcess&&e._rigPostProcess&&e._rigPostProcess.height>0?e._rigPostProcess.height:this.getEngine().getRenderHeight(!0)),this._multiviewSceneUbo||this._createMultiviewUbo(),e.outputRenderTarget=e._multiviewTexture,this._renderForCamera(e),e.outputRenderTarget=null;for(let t=0;t{})),this.onApplyObservable.add((e=>{n._scene.activeCamera&&n._scene.activeCamera.isLeftCamera?e.setInt("imageIndex",0):e.setInt("imageIndex",1),e.setTexture("multiviewSampler",n._multiviewTexture)}))}}function kt(e,t){const i=t.vrCameraMetrics||Pt.GetDefault();e._rigCameras[0]._cameraRigParams.vrMetrics=i,e._rigCameras[0].viewport=new yt.l(0,0,.5,1),e._rigCameras[0]._cameraRigParams.vrWorkMatrix=new o.y3,e._rigCameras[0]._cameraRigParams.vrHMatrix=i.leftHMatrix,e._rigCameras[0]._cameraRigParams.vrPreViewMatrix=i.leftPreViewMatrix,e._rigCameras[0].getProjectionMatrix=e._rigCameras[0]._getVRProjectionMatrix,e._rigCameras[1]._cameraRigParams.vrMetrics=i,e._rigCameras[1].viewport=new yt.l(.5,0,.5,1),e._rigCameras[1]._cameraRigParams.vrWorkMatrix=new o.y3,e._rigCameras[1]._cameraRigParams.vrHMatrix=i.rightHMatrix,e._rigCameras[1]._cameraRigParams.vrPreViewMatrix=i.rightPreViewMatrix,e._rigCameras[1].getProjectionMatrix=e._rigCameras[1]._getVRProjectionMatrix,i.multiviewEnabled&&(e.getScene().getEngine().getCaps().multiview?(e._useMultiviewToSingleView=!0,e._rigPostProcess=new Lt("VRMultiviewToSingleview",e,i.postProcessScaleFactor)):(u.Y.Warn("Multiview is not supported, falling back to standard rendering"),i.multiviewEnabled=!1)),i.compensateDistortion&&(e._rigCameras[0]._rigPostProcess=new It("VR_Distort_Compensation_Left",e._rigCameras[0],!1,i),e._rigCameras[1]._rigPostProcess=new It("VR_Distort_Compensation_Right",e._rigCameras[1],!0,i))}Ue.N.AddNodeConstructor("VRDeviceOrientationArcRotateCamera",((e,t)=>()=>new Vt(e,0,0,1,o.P.Zero(),t)));class Vt extends We{constructor(e,t,i,n,r,s,o=!0,a=Pt.GetDefault()){super(e,t,i,n,r,s),this._setRigMode=kt.bind(null,this),a.compensateDistortion=o,this.setCameraRigMode(Le.V.RIG_MODE_VR,{vrCameraMetrics:a}),this.inputs.addVRDeviceOrientation()}getClassName(){return"VRDeviceOrientationArcRotateCamera"}}Ue.N.AddNodeConstructor("VRDeviceOrientationFreeCamera",((e,t)=>()=>new Ut(e,o.P.Zero(),t)));class Ut extends ze{constructor(e,t,i,n=!0,r=Pt.GetDefault()){super(e,t,i),this._setRigMode=kt.bind(null,this),r.compensateDistortion=n,this.setCameraRigMode(Le.V.RIG_MODE_VR,{vrCameraMetrics:r})}getClassName(){return"VRDeviceOrientationFreeCamera"}}Ue.N.AddNodeConstructor("VRDeviceOrientationGamepadCamera",((e,t)=>()=>new Gt(e,o.P.Zero(),t)));class Gt extends Ut{constructor(e,t,i,n=!0,r=Pt.GetDefault()){super(e,t,i,n,r),this._setRigMode=kt.bind(null,this),this.inputs.addGamepad()}getClassName(){return"VRDeviceOrientationGamepadCamera"}}var jt=i("../../../node_modules/@babylonjs/core/Lights/hemisphericLight.js");function Wt(e,t){if(t.vrDisplay){const i=t.vrDisplay.getEyeParameters("left"),n=t.vrDisplay.getEyeParameters("right");e._rigCameras[0].viewport=new yt.l(0,0,.5,1),e._rigCameras[0].setCameraRigParameter("left",!0),e._rigCameras[0].setCameraRigParameter("specs",t.specs),e._rigCameras[0].setCameraRigParameter("eyeParameters",i),e._rigCameras[0].setCameraRigParameter("frameData",t.frameData),e._rigCameras[0].setCameraRigParameter("parentCamera",t.parentCamera),e._rigCameras[0]._cameraRigParams.vrWorkMatrix=new o.y3,e._rigCameras[0].getProjectionMatrix=e._getWebVRProjectionMatrix,e._rigCameras[0].parent=e,e._rigCameras[0]._getViewMatrix=e._getWebVRViewMatrix,e._rigCameras[1].viewport=new yt.l(.5,0,.5,1),e._rigCameras[1].setCameraRigParameter("eyeParameters",n),e._rigCameras[1].setCameraRigParameter("specs",t.specs),e._rigCameras[1].setCameraRigParameter("frameData",t.frameData),e._rigCameras[1].setCameraRigParameter("parentCamera",t.parentCamera),e._rigCameras[1]._cameraRigParams.vrWorkMatrix=new o.y3,e._rigCameras[1].getProjectionMatrix=e._getWebVRProjectionMatrix,e._rigCameras[1].parent=e,e._rigCameras[1]._getViewMatrix=e._getWebVRViewMatrix}}Object.defineProperty(k.D.prototype,"isInVRExclusivePointerMode",{get:function(){return this._vrExclusivePointerMode},enumerable:!0,configurable:!0}),k.D.prototype._prepareVRComponent=function(){this._vrSupported=!1,this._vrExclusivePointerMode=!1,this.onVRDisplayChangedObservable=new s.y$,this.onVRRequestPresentComplete=new s.y$,this.onVRRequestPresentStart=new s.y$},k.D.prototype.isVRDevicePresent=function(){return!!this._vrDisplay},k.D.prototype.getVRDevice=function(){return this._vrDisplay},k.D.prototype.initWebVR=function(){return this.initWebVRAsync(),this.onVRDisplayChangedObservable},k.D.prototype.initWebVRAsync=function(){const e=()=>{const e={vrDisplay:this._vrDisplay,vrSupported:this._vrSupported};this.onVRDisplayChangedObservable.notifyObservers(e),this._webVRInitPromise=new Promise((t=>{t(e)}))};if(!this._onVrDisplayConnect){this._onVrDisplayConnect=t=>{this._vrDisplay=t.display,e()},this._onVrDisplayDisconnect=()=>{this._vrDisplay.cancelAnimationFrame(this._frameHandler),this._vrDisplay=void 0,this._frameHandler=k.D.QueueNewFrame(this._boundRenderFunction),e()},this._onVrDisplayPresentChange=()=>{this._vrExclusivePointerMode=this._vrDisplay&&this._vrDisplay.isPresenting};const t=this.getHostWindow();t&&(t.addEventListener("vrdisplayconnect",this._onVrDisplayConnect),t.addEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),t.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange))}return this._webVRInitPromise=this._webVRInitPromise||this._getVRDisplaysAsync(),this._webVRInitPromise.then(e),this._webVRInitPromise},k.D.prototype._getVRDisplaysAsync=function(){return new Promise((e=>{navigator.getVRDisplays?navigator.getVRDisplays().then((t=>{this._vrSupported=!0,this._vrDisplay=t[0],e({vrDisplay:this._vrDisplay,vrSupported:this._vrSupported})})):(this._vrDisplay=void 0,this._vrSupported=!1,e({vrDisplay:this._vrDisplay,vrSupported:this._vrSupported}))}))},k.D.prototype.enableVR=function(e){if(this._vrDisplay&&!this._vrDisplay.isPresenting){const t=()=>{this.onVRRequestPresentComplete.notifyObservers(!0),this._onVRFullScreenTriggered()},i=()=>{this.onVRRequestPresentComplete.notifyObservers(!1)};this.onVRRequestPresentStart.notifyObservers(this);const n={highRefreshRate:!!this.vrPresentationAttributes&&this.vrPresentationAttributes.highRefreshRate,foveationLevel:this.vrPresentationAttributes?this.vrPresentationAttributes.foveationLevel:1,multiview:(this.getCaps().multiview||this.getCaps().oculusMultiview)&&e.useMultiview};this._vrDisplay.requestPresent([{source:this.getRenderingCanvas(),attributes:n,...n}]).then(t).catch(i)}},k.D.prototype._onVRFullScreenTriggered=function(){if(this._vrDisplay&&this._vrDisplay.isPresenting){this._oldSize=new v.$(this.getRenderWidth(),this.getRenderHeight()),this._oldHardwareScaleFactor=this.getHardwareScalingLevel();const e=this._vrDisplay.getEyeParameters("left");this.setHardwareScalingLevel(1),this.setSize(2*e.renderWidth,e.renderHeight)}else this.setHardwareScalingLevel(this._oldHardwareScaleFactor),this.setSize(this._oldSize.width,this._oldSize.height)},k.D.prototype.disableVR=function(){this._vrDisplay&&this._vrDisplay.isPresenting&&this._vrDisplay.exitPresent().then((()=>this._onVRFullScreenTriggered())).catch((()=>this._onVRFullScreenTriggered())),(0,U.CG)()&&(window.removeEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted),window.removeEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted),this._onVrDisplayConnect&&(window.removeEventListener("vrdisplayconnect",this._onVrDisplayConnect),this._onVrDisplayDisconnect&&window.removeEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),this._onVrDisplayPresentChange&&window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),this._onVrDisplayConnect=null,this._onVrDisplayDisconnect=null))},k.D.prototype._connectVREvents=function(e,t){if(this._onVRDisplayPointerRestricted=()=>{e&&e.requestPointerLock()},this._onVRDisplayPointerUnrestricted=()=>{if(t)t.exitPointerLock&&t.exitPointerLock();else{const e=this.getHostWindow();e.document&&e.document.exitPointerLock&&e.document.exitPointerLock()}},(0,U.CG)()){const e=this.getHostWindow();e.addEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted,!1),e.addEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted,!1)}},k.D.prototype._submitVRFrame=function(){if(this._vrDisplay&&this._vrDisplay.isPresenting)try{this._vrDisplay.submitFrame()}catch(e){V.w1.Warn("webVR submitFrame has had an unexpected failure: "+e)}},k.D.prototype.isVRPresenting=function(){return this._vrDisplay&&this._vrDisplay.isPresenting},k.D.prototype._requestVRFrame=function(){this._frameHandler=k.D.QueueNewFrame(this._boundRenderFunction,this._vrDisplay)},Ue.N.AddNodeConstructor("WebVRFreeCamera",((e,t)=>()=>new zt(e,o.P.Zero(),t))),Ue.N.AddNodeConstructor("WebVRGamepadCamera",((e,t)=>()=>new zt(e,o.P.Zero(),t)));class zt extends Ve.c{constructor(e,t,i,n={}){super(e,t,i),this._webVROptions=n,this._vrDevice=null,this.rawPose=null,this._specsVersion="1.1",this._attached=!1,this._descendants=[],this._deviceRoomPosition=o.P.Zero(),this._deviceRoomRotationQuaternion=o._f.Identity(),this._standingMatrix=null,this.devicePosition=o.P.Zero(),this.deviceRotationQuaternion=o._f.Identity(),this.deviceScaleFactor=1,this._deviceToWorld=o.y3.Identity(),this._worldToDevice=o.y3.Identity(),this.controllers=[],this.onControllersAttachedObservable=new s.y$,this.onControllerMeshLoadedObservable=new s.y$,this.onPoseUpdatedFromDeviceObservable=new s.y$,this._poseSet=!1,this.rigParenting=!0,this._defaultHeight=void 0,this._setRigMode=Wt.bind(null,this),this._detachIfAttached=()=>{const e=this.getEngine().getVRDevice();e&&!e.isPresenting&&this.detachControl()},this._workingVector=o.P.Zero(),this._oneVector=o.P.One(),this._workingMatrix=o.y3.Identity(),this._tmpMatrix=new o.y3,this._cache.position=o.P.Zero(),n.defaultHeight&&(this._defaultHeight=n.defaultHeight,this.position.y=this._defaultHeight),this.minZ=.1,5===arguments.length&&(this._webVROptions=arguments[4]),null==this._webVROptions.trackPosition&&(this._webVROptions.trackPosition=!0),null==this._webVROptions.controllerMeshes&&(this._webVROptions.controllerMeshes=!0),null==this._webVROptions.defaultLightingOnControllers&&(this._webVROptions.defaultLightingOnControllers=!0),this.rotationQuaternion=new o._f,this._webVROptions&&this._webVROptions.positionScale&&(this.deviceScaleFactor=this._webVROptions.positionScale);const r=this.getEngine();this._onVREnabled=e=>{e&&this.initControllers()},r.onVRRequestPresentComplete.add(this._onVREnabled),r.initWebVR().add((e=>{e.vrDisplay&&this._vrDevice!==e.vrDisplay&&(this._vrDevice=e.vrDisplay,this.setCameraRigMode(Le.V.RIG_MODE_WEBVR,{parentCamera:this,vrDisplay:this._vrDevice,frameData:this._frameData,specs:this._specsVersion}),this._attached&&this.getEngine().enableVR(this._webVROptions))})),"undefined"!=typeof VRFrameData&&(this._frameData=new VRFrameData),n.useMultiview&&(this.getScene().getEngine().getCaps().multiview?(this._useMultiviewToSingleView=!0,this._rigPostProcess=new Lt("VRMultiviewToSingleview",this,1)):(u.Y.Warn("Multiview is not supported, falling back to standard rendering"),this._useMultiviewToSingleView=!1)),this.getScene().onBeforeCameraRenderObservable.add((e=>{e.parent===this&&this.rigParenting&&(this._descendants=this.getDescendants(!0,(e=>{const t=this.controllers.some((t=>t._mesh===e)),i=-1!==this._rigCameras.indexOf(e);return!t&&!i})),this._descendants.forEach((t=>{t.parent=e})))})),this.getScene().onAfterCameraRenderObservable.add((e=>{e.parent===this&&this.rigParenting&&this._descendants.forEach((e=>{e.parent=this}))}))}deviceDistanceToRoomGround(){return this._standingMatrix?(this._standingMatrix.getTranslationToRef(this._workingVector),this._deviceRoomPosition.y+this._workingVector.y):this._defaultHeight||0}useStandingMatrix(e=(e=>{})){this.getEngine().initWebVRAsync().then((t=>{t.vrDisplay&&t.vrDisplay.stageParameters&&t.vrDisplay.stageParameters.sittingToStandingTransform&&this._webVROptions.trackPosition?(this._standingMatrix=new o.y3,o.y3.FromFloat32ArrayToRefScaled(t.vrDisplay.stageParameters.sittingToStandingTransform,0,1,this._standingMatrix),this.getScene().useRightHandedSystem||this._standingMatrix&&this._standingMatrix.toggleModelMatrixHandInPlace(),e(!0)):e(!1)}))}useStandingMatrixAsync(){return new Promise((e=>{this.useStandingMatrix((t=>{e(t)}))}))}dispose(){this._detachIfAttached(),this.getEngine().onVRRequestPresentComplete.removeCallback(this._onVREnabled),this._updateCacheWhenTrackingDisabledObserver&&this._scene.onBeforeRenderObservable.remove(this._updateCacheWhenTrackingDisabledObserver),super.dispose()}getControllerByName(e){for(const t of this.controllers)if(t.hand===e)return t;return null}get leftController(){return this._leftController||(this._leftController=this.getControllerByName("left")),this._leftController}get rightController(){return this._rightController||(this._rightController=this.getControllerByName("right")),this._rightController}getForwardRay(e=100){return this.leftCamera?super.getForwardRay(e,this.leftCamera.getWorldMatrix(),this.leftCamera.globalPosition):super.getForwardRay(e)}_checkInputs(){this._vrDevice&&this._vrDevice.isPresenting&&(this._vrDevice.getFrameData(this._frameData),this.updateFromDevice(this._frameData.pose)),super._checkInputs()}updateFromDevice(e){e&&e.orientation&&4===e.orientation.length&&(this.rawPose=e,this._deviceRoomRotationQuaternion.copyFromFloats(e.orientation[0],e.orientation[1],-e.orientation[2],-e.orientation[3]),this.getScene().useRightHandedSystem&&(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1),this._webVROptions.trackPosition&&this.rawPose.position&&(this._deviceRoomPosition.copyFromFloats(this.rawPose.position[0],this.rawPose.position[1],-this.rawPose.position[2]),this.getScene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1)),this._poseSet=!0)}attachControl(e){e=V.w1.BackCompatCameraNoPreventDefault(arguments),super.attachControl(e),this._attached=!0,e=!Le.V.ForceAttachControlToAlwaysPreventDefault&&e,this._vrDevice&&this.getEngine().enableVR(this._webVROptions);const t=this._scene.getEngine().getHostWindow();t&&t.addEventListener("vrdisplaypresentchange",this._detachIfAttached)}detachControl(){this.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),super.detachControl(),this._attached=!1,this.getEngine().disableVR(),window.removeEventListener("vrdisplaypresentchange",this._detachIfAttached)}getClassName(){return"WebVRFreeCamera"}resetToCurrentRotation(){this._vrDevice.resetPose()}_updateRigCameras(){const e=this._rigCameras[0],t=this._rigCameras[1];e.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion),t.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion),e.position.copyFrom(this._deviceRoomPosition),t.position.copyFrom(this._deviceRoomPosition)}_correctPositionIfNotTrackPosition(e,t=!1){this.rawPose&&this.rawPose.position&&!this._webVROptions.trackPosition&&(o.y3.TranslationToRef(this.rawPose.position[0],this.rawPose.position[1],-this.rawPose.position[2],this._tmpMatrix),t||this._tmpMatrix.invert(),this._tmpMatrix.multiplyToRef(e,e))}_updateCache(e){this.rotationQuaternion.equals(this._cache.rotationQuaternion)&&this.position.equals(this._cache.position)||(this._updateCacheCalled||(this._updateCacheCalled=!0,this.update()),this.rotationQuaternion.toRotationMatrix(this._workingMatrix),o.P.TransformCoordinatesToRef(this._deviceRoomPosition,this._workingMatrix,this._workingVector),this.devicePosition.subtractToRef(this._workingVector,this._workingVector),o.y3.ComposeToRef(this._oneVector,this.rotationQuaternion,this._workingVector,this._deviceToWorld),this._deviceToWorld.getTranslationToRef(this._workingVector),this._workingVector.addInPlace(this.position),this._workingVector.subtractInPlace(this._cache.position),this._deviceToWorld.setTranslation(this._workingVector),this._deviceToWorld.invertToRef(this._worldToDevice),this.controllers.forEach((e=>{e._deviceToWorld.copyFrom(this._deviceToWorld),this._correctPositionIfNotTrackPosition(e._deviceToWorld),e.update()}))),e||super._updateCache(),this._updateCacheCalled=!1}_computeDevicePosition(){o.P.TransformCoordinatesToRef(this._deviceRoomPosition,this._deviceToWorld,this.devicePosition)}update(){this._computeDevicePosition(),o.y3.FromQuaternionToRef(this._deviceRoomRotationQuaternion,this._workingMatrix),this._workingMatrix.multiplyToRef(this._deviceToWorld,this._workingMatrix),o._f.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this._poseSet&&this.onPoseUpdatedFromDeviceObservable.notifyObservers(null),super.update()}_getViewMatrix(){return o.y3.Identity()}_getWebVRViewMatrix(){const e=this._cameraRigParams.parentCamera;e._updateCache();const t=this._cameraRigParams.left?this._cameraRigParams.frameData.leftViewMatrix:this._cameraRigParams.frameData.rightViewMatrix;return o.y3.FromArrayToRef(t,0,this._webvrViewMatrix),this.getScene().useRightHandedSystem||this._webvrViewMatrix.toggleModelMatrixHandInPlace(),this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix),o.P.TransformCoordinatesToRef(this._referencePoint,this._cameraRotationMatrix,this._transformedReferencePoint),this.position.addToRef(this._transformedReferencePoint,this._currentTarget),1!==e.deviceScaleFactor&&(this._webvrViewMatrix.invert(),e.deviceScaleFactor&&(this._webvrViewMatrix.multiplyAtIndex(12,e.deviceScaleFactor),this._webvrViewMatrix.multiplyAtIndex(13,e.deviceScaleFactor),this._webvrViewMatrix.multiplyAtIndex(14,e.deviceScaleFactor)),this._webvrViewMatrix.invert()),e._correctPositionIfNotTrackPosition(this._webvrViewMatrix,!0),e._worldToDevice.multiplyToRef(this._webvrViewMatrix,this._webvrViewMatrix),this._workingMatrix=this._workingMatrix||o.y3.Identity(),this._webvrViewMatrix.invertToRef(this._workingMatrix),this._workingMatrix.multiplyToRef(e.getWorldMatrix(),this._workingMatrix),this._workingMatrix.getTranslationToRef(this._globalPosition),this._markSyncedWithParent(),this._webvrViewMatrix}_getWebVRProjectionMatrix(){const e=this.parent;e._vrDevice.depthNear=e.minZ,e._vrDevice.depthFar=e.maxZ;const t=this._cameraRigParams.left?this._cameraRigParams.frameData.leftProjectionMatrix:this._cameraRigParams.frameData.rightProjectionMatrix;return o.y3.FromArrayToRef(t,0,this._projectionMatrix),this.getScene().useRightHandedSystem||this._projectionMatrix.toggleProjectionMatrixHandInPlace(),this._projectionMatrix}initControllers(){this.controllers.length=0;const e=this.getScene().gamepadManager;this._onGamepadDisconnectedObserver=e.onGamepadDisconnectedObservable.add((e=>{if(e.type===ue.POSE_ENABLED){const t=e;t.defaultModel&&t.defaultModel.setEnabled(!1),"right"===t.hand&&(this._rightController=null),"left"===t.hand&&(this._leftController=null);const i=this.controllers.indexOf(t);-1!==i&&this.controllers.splice(i,1)}})),this._onGamepadConnectedObserver=e.onGamepadConnectedObservable.add((e=>{if(e.type===ue.POSE_ENABLED){const t=e;if(this._webVROptions.trackPosition||(t._disableTrackPosition(new o.P("left"==t.hand?-.15:.15,-.5,.25)),this._updateCacheWhenTrackingDisabledObserver||(this._updateCacheWhenTrackingDisabledObserver=this._scene.onBeforeRenderObservable.add((()=>{this._updateCache()})))),t.deviceScaleFactor=this.deviceScaleFactor,t._deviceToWorld.copyFrom(this._deviceToWorld),this._correctPositionIfNotTrackPosition(t._deviceToWorld),this._webVROptions.controllerMeshes&&(t.defaultModel?t.defaultModel.setEnabled(!0):t.initControllerMesh(this.getScene(),(e=>{if(e.scaling.scaleInPlace(this.deviceScaleFactor),this.onControllerMeshLoadedObservable.notifyObservers(t),this._webVROptions.defaultLightingOnControllers){this._lightOnControllers||(this._lightOnControllers=new jt.e("vrControllersLight",new o.P(0,1,0),this.getScene()));const t=function(e,i){const n=e.getChildren();n&&0!==n.length&&n.forEach((e=>{i.includedOnlyMeshes.push(e),t(e,i)}))};this._lightOnControllers.includedOnlyMeshes.push(e),t(e,this._lightOnControllers)}}))),t.attachToPoseControlledCamera(this),-1===this.controllers.indexOf(t)){this.controllers.push(t);let e=!1;for(let t=0;t=2&&this.onControllersAttachedObservable.notifyObservers(this.controllers)}}}))}}class Ht extends nt{constructor(e){super(e),this.onTriggerStateChangedObservable=new s.y$,this.onMainButtonStateChangedObservable=new s.y$,this.onSecondaryButtonStateChangedObservable=new s.y$,this.onPadStateChangedObservable=new s.y$,this.onPadValuesChangedObservable=new s.y$,this.pad={x:0,y:0},this._changes={pressChanged:!1,touchChanged:!1,valueChanged:!1,changed:!1},this._buttons=new Array(e.buttons.length),this.hand=e.hand}onButtonStateChange(e){this._onButtonStateChange=e}get defaultModel(){return this._defaultModel}update(){super.update();for(let e=0;e\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 result=texture2D(textureSampler,vUV);\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\nresult.rgb=toLinearSpace(result.rgb);\n#endif\nresult=applyImageProcessing(result);\n#else\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\ngl_FragColor=result;\n}",i("../../../node_modules/@babylonjs/core/Shaders/postprocess.vertex.js");class qt extends _t.D{constructor(e,t,i=null,n,r,s,o=0,a){super(e,"imageProcessing",[],[],t,i,n,r,s,null,o,"postprocess",null,!0),this._fromLinearSpace=!0,this._defines={IMAGEPROCESSING:!1,VIGNETTE:!1,VIGNETTEBLENDMODEMULTIPLY:!1,VIGNETTEBLENDMODEOPAQUE:!1,TONEMAPPING:!1,TONEMAPPING_ACES:!1,CONTRAST:!1,COLORCURVES:!1,COLORGRADING:!1,COLORGRADING3D:!1,FROMLINEARSPACE:!1,SAMPLER3DGREENDEPTH:!1,SAMPLER3DBGRMAP:!1,DITHER:!1,IMAGEPROCESSINGPOSTPROCESS:!1,EXPOSURE:!1,SKIPFINALCOLORCLAMP:!1},a?(a.applyByPostProcess=!0,this._attachImageProcessingConfiguration(a,!0),this._updateParameters()):(this._attachImageProcessingConfiguration(null,!0),this.imageProcessingConfiguration.applyByPostProcess=!0),this.onApply=e=>{this.imageProcessingConfiguration.bind(e,this.aspectRatio)}}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}set imageProcessingConfiguration(e){e.applyByPostProcess=!0,this._attachImageProcessingConfiguration(e)}_attachImageProcessingConfiguration(e,t=!1){if(e!==this._imageProcessingConfiguration){if(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e)this._imageProcessingConfiguration=e;else{let e=null;const t=this.getEngine(),i=this.getCamera();if(i)e=i.getScene();else if(t&&t.scenes){const i=t.scenes;e=i[i.length-1]}else e=m.l.LastCreatedScene;this._imageProcessingConfiguration=e?e.imageProcessingConfiguration:new Xt.$}this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((()=>{this._updateParameters()}))),t||this._updateParameters()}}get isSupported(){const e=this.getEffect();return!e||e.isSupported}get colorCurves(){return this.imageProcessingConfiguration.colorCurves}set colorCurves(e){this.imageProcessingConfiguration.colorCurves=e}get colorCurvesEnabled(){return this.imageProcessingConfiguration.colorCurvesEnabled}set colorCurvesEnabled(e){this.imageProcessingConfiguration.colorCurvesEnabled=e}get colorGradingTexture(){return this.imageProcessingConfiguration.colorGradingTexture}set colorGradingTexture(e){this.imageProcessingConfiguration.colorGradingTexture=e}get colorGradingEnabled(){return this.imageProcessingConfiguration.colorGradingEnabled}set colorGradingEnabled(e){this.imageProcessingConfiguration.colorGradingEnabled=e}get exposure(){return this.imageProcessingConfiguration.exposure}set exposure(e){this.imageProcessingConfiguration.exposure=e}get toneMappingEnabled(){return this._imageProcessingConfiguration.toneMappingEnabled}set toneMappingEnabled(e){this._imageProcessingConfiguration.toneMappingEnabled=e}get toneMappingType(){return this._imageProcessingConfiguration.toneMappingType}set toneMappingType(e){this._imageProcessingConfiguration.toneMappingType=e}get contrast(){return this.imageProcessingConfiguration.contrast}set contrast(e){this.imageProcessingConfiguration.contrast=e}get vignetteStretch(){return this.imageProcessingConfiguration.vignetteStretch}set vignetteStretch(e){this.imageProcessingConfiguration.vignetteStretch=e}get vignetteCentreX(){return this.imageProcessingConfiguration.vignetteCentreX}set vignetteCentreX(e){this.imageProcessingConfiguration.vignetteCentreX=e}get vignetteCentreY(){return this.imageProcessingConfiguration.vignetteCentreY}set vignetteCentreY(e){this.imageProcessingConfiguration.vignetteCentreY=e}get vignetteWeight(){return this.imageProcessingConfiguration.vignetteWeight}set vignetteWeight(e){this.imageProcessingConfiguration.vignetteWeight=e}get vignetteColor(){return this.imageProcessingConfiguration.vignetteColor}set vignetteColor(e){this.imageProcessingConfiguration.vignetteColor=e}get vignetteCameraFov(){return this.imageProcessingConfiguration.vignetteCameraFov}set vignetteCameraFov(e){this.imageProcessingConfiguration.vignetteCameraFov=e}get vignetteBlendMode(){return this.imageProcessingConfiguration.vignetteBlendMode}set vignetteBlendMode(e){this.imageProcessingConfiguration.vignetteBlendMode=e}get vignetteEnabled(){return this.imageProcessingConfiguration.vignetteEnabled}set vignetteEnabled(e){this.imageProcessingConfiguration.vignetteEnabled=e}get ditheringIntensity(){return this.imageProcessingConfiguration.ditheringIntensity}set ditheringIntensity(e){this.imageProcessingConfiguration.ditheringIntensity=e}get ditheringEnabled(){return this.imageProcessingConfiguration.ditheringEnabled}set ditheringEnabled(e){this.imageProcessingConfiguration.ditheringEnabled=e}get fromLinearSpace(){return this._fromLinearSpace}set fromLinearSpace(e){this._fromLinearSpace!==e&&(this._fromLinearSpace=e,this._updateParameters())}getClassName(){return"ImageProcessingPostProcess"}_updateParameters(){this._defines.FROMLINEARSPACE=this._fromLinearSpace,this.imageProcessingConfiguration.prepareDefines(this._defines,!0);let e="";for(const t in this._defines)this._defines[t]&&(e+=`#define ${t};\r\n`);const t=["textureSampler"],i=["scale"];Xt.$&&(Xt.$.PrepareSamplers(t,this._defines),Xt.$.PrepareUniforms(i,this._defines)),this.updateEffect(e,i,t)}dispose(e){super.dispose(e),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)}}(0,X.gn)([(0,Y.qC)()],qt.prototype,"_fromLinearSpace",void 0);class Kt{constructor(e,t,i,n,r){this.getWidth=e,this.getHeight=t,this.layer=i,this.layerType=n,this.createRenderTargetTextureProvider=r}get isFixedFoveationSupported(){return"XRWebGLLayer"==this.layerType&&"number"==typeof this.layer.fixedFoveation}get fixedFoveation(){return this.isFixedFoveationSupported?this.layer.fixedFoveation:null}set fixedFoveation(e){if(this.isFixedFoveationSupported){const t=Math.max(0,Math.min(1,e||0));this.layer.fixedFoveation=t}}}var Zt,$t,Jt=i("../../../node_modules/@babylonjs/core/Engines/WebGL/webGLHardwareTexture.js");class ei{constructor(e,t){this._scene=e,this.layerWrapper=t,this._renderTargetTextures=new Array,this._engine=e.getEngine()}_createInternalTexture(e,t){const i=new Mt.l(this._engine,Mt.S.Unknown,!0);return i.width=e.width,i.height=e.height,i._hardwareTexture=new Jt.B(t,this._engine._gl),i.isReady=!0,i}_createRenderTargetTexture(e,t,i,n,r,s){if(!this._engine)throw new Error("Engine is disposed");const o={width:e,height:t},a=s?new wt(this._scene,o):new Ot._("XR renderTargetTexture",o,this._scene),l=a.renderTarget;if(!i&&n||(l._framebuffer=i),n)if(s)l._colorTextureArray=n;else{const e=this._createInternalTexture(o,n);l.setTexture(e,0),a._texture=e}return r&&(s?l._depthStencilTextureArray=r:l._depthStencilTexture=this._createInternalTexture(o,r)),a.disableRescaling(),"undefined"!=typeof XRWebGLBinding&&(a.skipInitialClear=!0),this._renderTargetTextures.push(a),a}_destroyRenderTargetTexture(e){this._renderTargetTextures.splice(this._renderTargetTextures.indexOf(e),1),e.dispose()}getFramebufferDimensions(){return this._framebufferDimensions}dispose(){this._renderTargetTextures.forEach((e=>e.dispose())),this._renderTargetTextures.length=0}}class ti extends Kt{constructor(e){super((()=>e.framebufferWidth),(()=>e.framebufferHeight),e,"XRWebGLLayer",(e=>new ii(e.scene,this))),this.layer=e}}class ii extends ei{constructor(e,t){super(e,t),this.layerWrapper=t,this._layer=t.layer,this._framebufferDimensions={framebufferWidth:this._layer.framebufferWidth,framebufferHeight:this._layer.framebufferHeight}}trySetViewportForView(e,t){const i=this._layer.getViewport(t);if(!i)return!1;const n=this._framebufferDimensions.framebufferWidth,r=this._framebufferDimensions.framebufferHeight;return e.x=i.x/n,e.y=i.y/r,e.width=i.width/n,e.height=i.height/r,!0}getRenderTargetTextureForEye(e){const t=this._layer.framebufferWidth,i=this._layer.framebufferHeight,n=this._layer.framebuffer;return this._rtt&&t===this._framebufferDimensions.framebufferWidth&&i===this._framebufferDimensions.framebufferHeight&&n===this._framebuffer||(this._rtt=this._createRenderTargetTexture(t,i,n),this._framebufferDimensions.framebufferWidth=t,this._framebufferDimensions.framebufferHeight=i,this._framebuffer=n),this._rtt}getRenderTargetTextureForView(e){return this.getRenderTargetTextureForEye(e.eye)}}class ni{static GetDefaults(e){const t=new ni;return t.canvasOptions={antialias:!0,depth:!0,stencil:!e||e.isStencilEnable,alpha:!0,framebufferScaleFactor:1},t.newCanvasCssStyle="position:absolute; bottom:0px;right:0px;z-index:10;width:90%;height:100%;background-color: #000000;",t}}class ri{constructor(e,t=ni.GetDefaults()){if(this._options=t,this._canvas=null,this._engine=null,this.xrLayer=null,this._xrLayerWrapper=null,this.onXRLayerInitObservable=new s.y$,this._engine=e.scene.getEngine(),this._engine.onDisposeObservable.addOnce((()=>{this._engine=null})),t.canvasElement)this._setManagedOutputCanvas(t.canvasElement);else{const e=document.createElement("canvas");e.style.cssText=this._options.newCanvasCssStyle||"position:absolute; bottom:0px;right:0px;",this._setManagedOutputCanvas(e)}e.onXRSessionInit.add((()=>{this._addCanvas()})),e.onXRSessionEnded.add((()=>{this._removeCanvas()}))}dispose(){this._removeCanvas(),this._setManagedOutputCanvas(null)}async initializeXRLayerAsync(e){const t=()=>(this.xrLayer=new XRWebGLLayer(e,this.canvasContext,this._options.canvasOptions),this._xrLayerWrapper=new ti(this.xrLayer),this.onXRLayerInitObservable.notifyObservers(this.xrLayer),this.xrLayer);return this.canvasContext.makeXRCompatible?this.canvasContext.makeXRCompatible().then((()=>{}),(()=>{V.w1.Warn("Error executing makeXRCompatible. This does not mean that the session will work incorrectly.")})).then((()=>t())):Promise.resolve(t())}_addCanvas(){this._canvas&&this._engine&&this._canvas!==this._engine.getRenderingCanvas()&&document.body.appendChild(this._canvas),this.xrLayer?this._setCanvasSize(!0):this.onXRLayerInitObservable.addOnce((()=>{this._setCanvasSize(!0)}))}_removeCanvas(){this._canvas&&this._engine&&document.body.contains(this._canvas)&&this._canvas!==this._engine.getRenderingCanvas()&&document.body.removeChild(this._canvas),this._setCanvasSize(!1)}_setCanvasSize(e=!0,t=this._xrLayerWrapper){this._canvas&&this._engine&&(e?t&&(this._canvas!==this._engine.getRenderingCanvas()?(this._canvas.style.width=t.getWidth()+"px",this._canvas.style.height=t.getHeight()+"px"):this._engine.setSize(t.getWidth(),t.getHeight())):this._originalCanvasSize&&(this._canvas!==this._engine.getRenderingCanvas()?(this._canvas.style.width=this._originalCanvasSize.width+"px",this._canvas.style.height=this._originalCanvasSize.height+"px"):this._engine.setSize(this._originalCanvasSize.width,this._originalCanvasSize.height)))}_setManagedOutputCanvas(e){this._removeCanvas(),e?(this._originalCanvasSize={width:e.offsetWidth,height:e.offsetHeight},this._canvas=e,this.canvasContext=this._canvas.getContext("webgl2"),this.canvasContext||(this.canvasContext=this._canvas.getContext("webgl"))):(this._canvas=null,this.canvasContext=null)}}class si extends Kt{constructor(e){super((()=>e.framebufferWidth),(()=>e.framebufferHeight),e,"XRWebGLLayer",(e=>new oi(e,this))),this.layer=e}}class oi extends ei{constructor(e,t){super(e.scene,t),this.layerWrapper=t,this._nativeRTTProvider=navigator.xr.getNativeRenderTargetProvider(e.session,this._createRenderTargetTexture.bind(this),this._destroyRenderTargetTexture.bind(this)),this._nativeLayer=t.layer}trySetViewportForView(e){return e.x=0,e.y=0,e.width=1,e.height=1,!0}getRenderTargetTextureForEye(e){return this._nativeRTTProvider.getRenderTargetForEye(e)}getRenderTargetTextureForView(e){return this._nativeRTTProvider.getRenderTargetForEye(e.eye)}getFramebufferDimensions(){return{framebufferWidth:this._nativeLayer.framebufferWidth,framebufferHeight:this._nativeLayer.framebufferHeight}}}class ai{constructor(e){this._nativeRenderTarget=navigator.xr.getWebXRRenderTarget(e.scene.getEngine())}async initializeXRLayerAsync(e){return await this._nativeRenderTarget.initializeXRLayerAsync(e),this.xrLayer=this._nativeRenderTarget.xrLayer,this.xrLayer}dispose(){}}class li{constructor(e){this.scene=e,this.currentTimestamp=-1,this.defaultHeightCompensation=1.7,this.onXRFrameObservable=new s.y$,this.onXRReferenceSpaceChanged=new s.y$,this.onXRSessionEnded=new s.y$,this.onXRSessionInit=new s.y$,this.inXRFrameLoop=!1,this.inXRSession=!1,this._engine=e.getEngine(),this._onEngineDisposedObserver=this._engine.onDisposeObservable.addOnce((()=>{this._engine=null})),e.onDisposeObservable.addOnce((()=>{this.dispose()}))}get referenceSpace(){return this._referenceSpace}set referenceSpace(e){this._referenceSpace=e,this.onXRReferenceSpaceChanged.notifyObservers(this._referenceSpace)}get sessionMode(){return this._sessionMode}dispose(){var e;this.inXRSession&&this.exitXRAsync(),this.onXRFrameObservable.clear(),this.onXRSessionEnded.clear(),this.onXRReferenceSpaceChanged.clear(),this.onXRSessionInit.clear(),null===(e=this._engine)||void 0===e||e.onDisposeObservable.remove(this._onEngineDisposedObserver),this._engine=null}exitXRAsync(){return this.session&&this.inXRSession?(this.inXRSession=!1,this.session.end().catch((()=>{u.Y.Warn("Could not end XR session.")}))):Promise.resolve()}trySetViewportForView(e,t){var i;return(null===(i=this._baseLayerRTTProvider)||void 0===i?void 0:i.trySetViewportForView(e,t))||!1}getRenderTargetTextureForEye(e){var t;return(null===(t=this._baseLayerRTTProvider)||void 0===t?void 0:t.getRenderTargetTextureForEye(e))||null}getRenderTargetTextureForView(e){var t;return(null===(t=this._baseLayerRTTProvider)||void 0===t?void 0:t.getRenderTargetTextureForView(e))||null}getWebXRRenderTarget(e){const t=this.scene.getEngine();return this._xrNavigator.xr.native?new ai(this):((e=e||ni.GetDefaults(t)).canvasElement=e.canvasElement||t.getRenderingCanvas()||void 0,new ri(this,e))}initializeAsync(){return this._xrNavigator=navigator,this._xrNavigator.xr?Promise.resolve():Promise.reject("WebXR not available")}initializeSessionAsync(e="immersive-vr",t={}){return this._xrNavigator.xr.requestSession(e,t).then((t=>(this.session=t,this._sessionMode=e,this.onXRSessionInit.notifyObservers(t),this.inXRSession=!0,this.session.addEventListener("end",(()=>{var e;this.inXRSession=!1,this.onXRSessionEnded.notifyObservers(null),this._engine&&(this._engine.framebufferDimensionsObject=null,this._engine.restoreDefaultFramebuffer(),this._engine.customAnimationFrameRequester=null,this._engine._renderLoop()),this.isNative&&(null===(e=this._baseLayerRTTProvider)||void 0===e||e.dispose()),this._baseLayerRTTProvider=null,this._baseLayerWrapper=null}),{once:!0}),this.session)))}isSessionSupportedAsync(e){return li.IsSessionSupportedAsync(e)}resetReferenceSpace(){this.referenceSpace=this.baseReferenceSpace}runXRRenderLoop(){var e;this.inXRSession&&this._engine&&(this._engine.customAnimationFrameRequester={requestAnimationFrame:this.session.requestAnimationFrame.bind(this.session),renderFunction:(e,t)=>{var i;this.inXRSession&&this._engine&&(this.currentFrame=t,this.currentTimestamp=e,t&&(this.inXRFrameLoop=!0,this._engine.framebufferDimensionsObject=(null===(i=this._baseLayerRTTProvider)||void 0===i?void 0:i.getFramebufferDimensions())||null,this.onXRFrameObservable.notifyObservers(t),this._engine._renderLoop(),this._engine.framebufferDimensionsObject=null,this.inXRFrameLoop=!1))}},this._engine.framebufferDimensionsObject=(null===(e=this._baseLayerRTTProvider)||void 0===e?void 0:e.getFramebufferDimensions())||null,"undefined"!=typeof window&&window.cancelAnimationFrame&&window.cancelAnimationFrame(this._engine._frameHandler),this._engine._renderLoop())}setReferenceSpaceTypeAsync(e="local-floor"){return this.session.requestReferenceSpace(e).then((e=>e),(e=>(u.Y.Error("XR.requestReferenceSpace failed for the following reason: "),u.Y.Error(e),u.Y.Log('Defaulting to universally-supported "viewer" reference space type.'),this.session.requestReferenceSpace("viewer").then((e=>{const t=new XRRigidTransform({x:0,y:-this.defaultHeightCompensation,z:0});return e.getOffsetReferenceSpace(t)}),(e=>{throw u.Y.Error(e),'XR initialization failed: required "viewer" reference space type not supported.'}))))).then((e=>this.session.requestReferenceSpace("viewer").then((t=>(this.viewerReferenceSpace=t,e))))).then((e=>(this.referenceSpace=this.baseReferenceSpace=e,this.referenceSpace)))}updateRenderStateAsync(e){return Promise.resolve(this.session.updateRenderState(e))}_setBaseLayerWrapper(e){var t,i;this.isNative&&(null===(t=this._baseLayerRTTProvider)||void 0===t||t.dispose()),this._baseLayerWrapper=e,this._baseLayerRTTProvider=(null===(i=this._baseLayerWrapper)||void 0===i?void 0:i.createRenderTargetTextureProvider(this))||null}updateRenderState(e){e.baseLayer&&this._setBaseLayerWrapper(this.isNative?new si(e.baseLayer):new ti(e.baseLayer)),this.session.updateRenderState(e)}static IsSessionSupportedAsync(e){if(!navigator.xr)return Promise.resolve(!1);const t=navigator.xr.isSessionSupported||navigator.xr.supportsSession;return t?t.call(navigator.xr,e).then((e=>{const t=void 0===e||e;return Promise.resolve(t)})).catch((e=>(u.Y.Warn(e),Promise.resolve(!1)))):Promise.resolve(!1)}get isNative(){var e;return null!==(e=this._xrNavigator.xr.native)&&void 0!==e&&e}get currentFrameRate(){var e;return null===(e=this.session)||void 0===e?void 0:e.frameRate}get supportedFrameRates(){var e;return null===(e=this.session)||void 0===e?void 0:e.supportedFrameRates}updateTargetFrameRate(e){return this.session.updateTargetFrameRate(e)}runInXRFrame(e,t=!0){this.inXRFrameLoop?e():!this.inXRSession&&t||this.onXRFrameObservable.addOnce(e)}get isFixedFoveationSupported(){var e;return(null===(e=this._baseLayerWrapper)||void 0===e?void 0:e.isFixedFoveationSupported)||!1}get fixedFoveation(){var e;return(null===(e=this._baseLayerWrapper)||void 0===e?void 0:e.fixedFoveation)||null}set fixedFoveation(e){const t=Math.max(0,Math.min(1,e||0));this._baseLayerWrapper&&(this._baseLayerWrapper.fixedFoveation=t)}}!function(e){e[e.ENTERING_XR=0]="ENTERING_XR",e[e.EXITING_XR=1]="EXITING_XR",e[e.IN_XR=2]="IN_XR",e[e.NOT_IN_XR=3]="NOT_IN_XR"}(Zt||(Zt={})),function(e){e[e.NOT_TRACKING=0]="NOT_TRACKING",e[e.TRACKING_LOST=1]="TRACKING_LOST",e[e.TRACKING=2]="TRACKING"}($t||($t={}));var ci=i("../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js"),hi=i("../../../node_modules/@babylonjs/core/Compat/compatibilityOptions.js");function _i(e){const t=e.height||2;let i=0===e.diameterTop?0:e.diameterTop||e.diameter||1,n=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1;i=i||1e-5,n=n||1e-5;const r=e.tessellation||24,s=e.subdivisions||1,l=!!e.hasRings,c=!!e.enclose,h=0===e.cap?0:e.cap||je.Kj.CAP_ALL,_=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,d=0===e.sideOrientation?0:e.sideOrientation||ci.x.DEFAULTSIDE,u=e.faceUV||new Array(3),p=e.faceColors,f=2+(1+(1!==_&&c?2:0))*(l?s:1);let m;for(m=0;m{const s=e?i/2:n/2;if(0===s)return;let a,l,c;const h=e?u[f-1]:u[0];let d=null;p&&(d=e?p[f-1]:p[0]);const m=b.length/3,C=e?t/2:-t/2,S=new o.P(0,C,0);b.push(S.x,S.y,S.z),y.push(0,e?1:-1,0);const x=h.y+.5*(h.w-h.y);v.push(h.x+.5*(h.z-h.x),hi.e.UseOpenGLOrientationForUV?1-x:x),d&&A.push(d.r,d.g,d.b,d.a);const T=new o.FM(.5,.5);for(c=0;c<=r;c++){a=2*Math.PI*c*_/r;const t=Math.cos(-a),i=Math.sin(-a);l=new o.P(t*s,C,i*s);const n=new o.FM(t*T.x+.5,i*T.y+.5);b.push(l.x,l.y,l.z),y.push(0,e?1:-1,0);const u=h.y+(h.w-h.y)*n.y;v.push(h.x+(h.z-h.x)*n.x,hi.e.UseOpenGLOrientationForUV?1-u:u),d&&A.push(d.r,d.g,d.b,d.a)}for(c=0;c(void 0!==o&&o instanceof R.x||(void 0!==o&&(l=a||je.Kj.DEFAULTSIDE,a=o),o=s,s=1),di(e,{height:t,diameterTop:i,diameterBottom:n,tessellation:r,subdivisions:s,sideOrientation:l,updatable:a},o)),ci.x.CreateTorus=ui,je.Kj.CreateTorus=(e,t,i,n,r,s,o)=>pi(e,{diameter:t,thickness:i,tessellation:n,sideOrientation:o,updatable:s},r),je.Kj._GroundMeshParser=(e,t)=>fi.Parse(e,t);class fi extends je.Kj{constructor(e,t){super(e,t),this.generateOctree=!1}getClassName(){return"GroundMesh"}get subdivisions(){return Math.min(this._subdivisionsX,this._subdivisionsY)}get subdivisionsX(){return this._subdivisionsX}get subdivisionsY(){return this._subdivisionsY}optimize(e,t=32){this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e);this.createOrUpdateSubmeshesOctree&&this.createOrUpdateSubmeshesOctree(t)}getHeightAtCoordinates(e,t){const i=this.getWorldMatrix(),n=o.jp.Matrix[5];i.invertToRef(n);const r=o.jp.Vector3[8];if(o.P.TransformCoordinatesFromFloatsToRef(e,0,t,n,r),e=r.x,t=r.z,e=this._maxX||t<=this._minZ||t>this._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());const s=this._getFacetAt(e,t),a=-(s.x*e+s.z*t+s.w)/s.y;return o.P.TransformCoordinatesFromFloatsToRef(0,a,0,i,r),r.y}getNormalAtCoordinates(e,t){const i=new o.P(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,i),i}getNormalAtCoordinatesToRef(e,t,i){const n=this.getWorldMatrix(),r=o.jp.Matrix[5];n.invertToRef(r);const s=o.jp.Vector3[8];if(o.P.TransformCoordinatesFromFloatsToRef(e,0,t,r,s),e=s.x,t=s.z,ethis._maxX||tthis._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());const a=this._getFacetAt(e,t);return o.P.TransformNormalFromFloatsToRef(a.x,a.y,a.z,n,i),this}updateCoordinateHeights(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this}_getFacetAt(e,t){const i=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),n=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),r=this._heightQuads[n*this._subdivisionsX+i];let s;return s=te.maxHeight){_=!0;const t=e.maxHeight;e.maxHeight=e.minHeight,e.minHeight=t}for(s=0;s<=e.subdivisions;s++)for(l=0;l<=e.subdivisions;l++){const t=new o.P(l*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-s)*e.height/e.subdivisions-e.height/2),a=4*(((t.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(t.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth);let d=e.buffer[a]/255,u=e.buffer[a+1]/255,p=e.buffer[a+2]/255;const f=e.buffer[a+3]/255;_&&(d=1-d,u=1-u,p=1-p);const m=d*c.r+u*c.g+p*c.b;t.y=f>=h?e.minHeight+(e.maxHeight-e.minHeight)*m:e.minHeight-$.kn,i.push(t.x,t.y,t.z),n.push(0,0,0),r.push(l/e.subdivisions,1-s/e.subdivisions)}for(s=0;s=e.minHeight,h=i[3*r+1]>=e.minHeight,_=i[3*o+1]>=e.minHeight;c&&h&&_&&(t.push(n),t.push(r),t.push(o)),i[3*a+1]>=e.minHeight&&c&&_&&(t.push(a),t.push(n),t.push(o))}ci.x.ComputeNormals(i,t,n);const d=new ci.x;return d.indices=t,d.positions=i,d.normals=n,d.uvs=r,d}function yi(e,t={},i){const n=new fi(e,i);return n._setReady(!1),n._subdivisionsX=t.subdivisionsX||t.subdivisions||1,n._subdivisionsY=t.subdivisionsY||t.subdivisions||1,n._width=t.width||1,n._height=t.height||1,n._maxX=n._width/2,n._maxZ=n._height/2,n._minX=-n._maxX,n._minZ=-n._maxZ,mi(t).applyToMesh(n,t.updatable),n._setReady(!0),n}function vi(e,t,i=null){const n=new je.Kj(e,i);return gi(t).applyToMesh(n,t.updatable),n}function Ai(e,t,i={},n=null){const r=i.width||10,s=i.height||10,o=i.subdivisions||1,l=i.minHeight||0,c=i.maxHeight||1,h=i.colorFilter||new a.Wo(.3,.59,.11),_=i.alphaFilter||0,d=i.updatable,u=i.onReady;n=n||m.l.LastCreatedScene;const p=new fi(e,n);return p._subdivisionsX=o,p._subdivisionsY=o,p._width=r,p._height=s,p._maxX=p._width/2,p._maxZ=p._height/2,p._minX=-p._maxX,p._minZ=-p._maxZ,p._setReady(!1),V.w1.LoadImage(t,(e=>{const t=e.width,i=e.height;if(n.isDisposed)return;const a=null==n?void 0:n.getEngine().resizeImageBitmap(e,t,i);bi({width:r,height:s,subdivisions:o,minHeight:l,maxHeight:c,colorFilter:h,buffer:a,bufferWidth:t,bufferHeight:i,alphaFilter:_}).applyToMesh(p,d),u&&u(p),p._setReady(!0)}),(()=>{}),n.offlineProvider),p}ci.x.CreateGround=mi,ci.x.CreateTiledGround=gi,ci.x.CreateGroundFromHeightMap=bi,je.Kj.CreateGround=(e,t,i,n,r,s)=>yi(e,{width:t,height:i,subdivisions:n,updatable:s},r),je.Kj.CreateTiledGround=(e,t,i,n,r,s,o,a,l)=>vi(e,{xmin:t,zmin:i,xmax:n,zmax:r,subdivisions:s,precision:o,updatable:l},a),je.Kj.CreateGroundFromHeightMap=(e,t,i,n,r,s,o,a,l,c,h)=>Ai(e,t,{width:i,height:n,subdivisions:r,minHeight:s,maxHeight:o,updatable:l,onReady:c,alphaFilter:h},a);class Ci{constructor(e,t=null){if(this.scene=e,this._pointerDownOnMeshAsked=!1,this._isActionableMesh=!1,this._teleportationRequestInitiated=!1,this._teleportationBackRequestInitiated=!1,this._rotationRightAsked=!1,this._rotationLeftAsked=!1,this._dpadPressed=!0,this._activePointer=!1,this._id=Ci._IdCounter++,t)this._gazeTracker=t.clone("gazeTracker");else{this._gazeTracker=pi("gazeTracker",{diameter:.0035,thickness:.0025,tessellation:20,updatable:!1},e),this._gazeTracker.bakeCurrentTransformIntoVertices(),this._gazeTracker.isPickable=!1,this._gazeTracker.isVisible=!1;const t=new Yt.K("targetMat",e);t.specularColor=a.Wo.Black(),t.emissiveColor=new a.Wo(.7,.7,.7),t.backFaceCulling=!1,this._gazeTracker.material=t}}_getForwardRay(e){return new tt.z(o.P.Zero(),new o.P(0,0,e))}_selectionPointerDown(){this._pointerDownOnMeshAsked=!0,this._currentHit&&this.scene.simulatePointerDown(this._currentHit,{pointerId:this._id})}_selectionPointerUp(){this._currentHit&&this.scene.simulatePointerUp(this._currentHit,{pointerId:this._id}),this._pointerDownOnMeshAsked=!1}_activatePointer(){this._activePointer=!0}_deactivatePointer(){this._activePointer=!1}_updatePointerDistance(e=100){}dispose(){this._interactionsEnabled=!1,this._teleportationEnabled=!1,this._gazeTracker&&this._gazeTracker.dispose()}}Ci._IdCounter=0;class Si extends Ci{constructor(e,t,i){super(t,i),this.webVRController=e,this._laserPointer=di("laserPointer",{updatable:!1,height:1,diameterTop:.004,diameterBottom:2e-4,tessellation:20,subdivisions:1},t);const n=new Yt.K("laserPointerMat",t);if(n.emissiveColor=new a.Wo(.7,.7,.7),n.alpha=.6,this._laserPointer.material=n,this._laserPointer.rotation.x=Math.PI/2,this._laserPointer.position.z=-.5,this._laserPointer.isVisible=!1,this._laserPointer.isPickable=!1,!e.mesh){const i=new je.Kj("preloadControllerMesh",t),n=new je.Kj(nt.POINTING_POSE,t);n.rotation.x=-.7,i.addChild(n),e.attachToMesh(i)}this._setLaserPointerParent(e.mesh),this._meshAttachedObserver=e._meshAttachedObservable.add((e=>{this._setLaserPointerParent(e)}))}_getForwardRay(e){return this.webVRController.getForwardRay(e)}_activatePointer(){super._activatePointer(),this._laserPointer.isVisible=!0}_deactivatePointer(){super._deactivatePointer(),this._laserPointer.isVisible=!1}_setLaserPointerColor(e){this._laserPointer.material.emissiveColor=e}_setLaserPointerLightingDisabled(e){this._laserPointer.material.disableLighting=e}_setLaserPointerParent(e){const t=e=>{e.isPickable=!1,e.getChildMeshes().forEach((e=>{t(e)}))};t(e);const i=e.getChildren(void 0,!1);let n=e;this.webVRController._pointingPoseNode=null;for(let e=0;e=0){n=i[e],this.webVRController._pointingPoseNode=n;break}this._laserPointer.parent=n}_updatePointerDistance(e=100){this._laserPointer.scaling.y=e,this._laserPointer.position.z=-e/2}dispose(){super.dispose(),this._laserPointer.dispose(),this._meshAttachedObserver&&this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver)}}class xi extends Ci{constructor(e,t){super(t),this._getCamera=e}_getForwardRay(e){const t=this._getCamera();return t?t.getForwardRay(e):new tt.z(o.P.Zero(),o.P.Forward())}}class Ti{constructor(e,t={}){if(this.webVROptions=t,this._webVRsupported=!1,this._webVRready=!1,this._webVRrequesting=!1,this._webVRpresenting=!1,this._fullscreenVRpresenting=!1,this.enableGazeEvenWhenNoPointerLock=!1,this.exitVROnDoubleTap=!0,this.onEnteringVRObservable=new s.y$,this.onAfterEnteringVRObservable=new s.y$,this.onExitingVRObservable=new s.y$,this.onControllerMeshLoadedObservable=new s.y$,this._useCustomVRButton=!1,this._teleportationRequested=!1,this._teleportActive=!1,this._floorMeshesCollection=[],this._teleportationMode=Ti.TELEPORTATIONMODE_CONSTANTTIME,this._teleportationTime=122,this._teleportationSpeed=20,this._rotationAllowed=!0,this._teleportBackwardsVector=new o.P(0,-1,-1),this._isDefaultTeleportationTarget=!0,this._teleportationFillColor="#444444",this._teleportationBorderColor="#FFFFFF",this._rotationAngle=0,this._haloCenter=new o.P(0,0,0),this._padSensibilityUp=.65,this._padSensibilityDown=.35,this._leftController=null,this._rightController=null,this._gazeColor=new a.Wo(.7,.7,.7),this._laserColor=new a.Wo(.7,.7,.7),this._pickedLaserColor=new a.Wo(.2,.2,1),this._pickedGazeColor=new a.Wo(0,0,1),this.onNewMeshSelected=new s.y$,this.onMeshSelectedWithController=new s.y$,this.onNewMeshPicked=new s.y$,this.onBeforeCameraTeleport=new s.y$,this.onAfterCameraTeleport=new s.y$,this.onSelectedMeshUnselected=new s.y$,this.teleportationEnabled=!0,this._teleportationInitialized=!1,this._interactionsEnabled=!1,this._interactionsRequested=!1,this._displayGaze=!0,this._displayLaserPointer=!0,this.updateGazeTrackerScale=!0,this.updateGazeTrackerColor=!0,this.updateControllerLaserColor=!0,this.requestPointerLockOnFullScreen=!0,this.xrTestDone=!1,this._onResize=()=>{this._moveButtonToBottomRight(),this._fullscreenVRpresenting&&this._webVRready&&this.exitVR()},this._onFullscreenChange=()=>{this._fullscreenVRpresenting=!!document.fullscreenElement,!this._fullscreenVRpresenting&&this._inputElement&&(this.exitVR(),!this._useCustomVRButton&&this._btnVR&&(this._btnVR.style.top=this._inputElement.offsetTop+this._inputElement.offsetHeight-70+"px",this._btnVR.style.left=this._inputElement.offsetLeft+this._inputElement.offsetWidth-100+"px",this._updateButtonVisibility()))},this._cachedAngularSensibility={angularSensibilityX:null,angularSensibilityY:null,angularSensibility:null},this._beforeRender=()=>{this._leftController&&this._leftController._activePointer&&this._castRayAndSelectObject(this._leftController),this._rightController&&this._rightController._activePointer&&this._castRayAndSelectObject(this._rightController),this._noControllerIsActive&&(this._scene.getEngine().isPointerLock||this.enableGazeEvenWhenNoPointerLock)?this._castRayAndSelectObject(this._cameraGazer):this._cameraGazer._gazeTracker.isVisible=!1},this._onNewGamepadConnected=e=>{if(e.type!==ue.POSE_ENABLED)e.leftStick&&e.onleftstickchanged((e=>{this._teleportationInitialized&&this.teleportationEnabled&&(!this._leftController&&!this._rightController||this._leftController&&!this._leftController._activePointer&&this._rightController&&!this._rightController._activePointer)&&(this._checkTeleportWithRay(e,this._cameraGazer),this._checkTeleportBackwards(e,this._cameraGazer))})),e.rightStick&&e.onrightstickchanged((e=>{this._teleportationInitialized&&this._checkRotate(e,this._cameraGazer)})),e.type===ue.XBOX&&(e.onbuttondown((e=>{this._interactionsEnabled&&e===Ze.A&&this._cameraGazer._selectionPointerDown()})),e.onbuttonup((e=>{this._interactionsEnabled&&e===Ze.A&&this._cameraGazer._selectionPointerUp()})));else{const t=e,i=new Si(t,this._scene,this._cameraGazer._gazeTracker);"right"===t.hand||this._leftController&&this._leftController.webVRController!=t?this._rightController=i:this._leftController=i,this._tryEnableInteractionOnController(i)}},this._tryEnableInteractionOnController=e=>{this._interactionsRequested&&!e._interactionsEnabled&&this._enableInteractionOnController(e),this._teleportationRequested&&!e._teleportationEnabled&&this._enableTeleportationOnController(e)},this._onNewGamepadDisconnected=e=>{e instanceof Ht&&("left"===e.hand&&null!=this._leftController&&(this._leftController.dispose(),this._leftController=null),"right"===e.hand&&null!=this._rightController&&(this._rightController.dispose(),this._rightController=null))},this._workingVector=o.P.Zero(),this._workingQuaternion=o._f.Identity(),this._workingMatrix=o.y3.Identity(),u.Y.Warn("WebVR is deprecated. Please avoid using this experience helper and use the WebXR experience helper instead"),this._scene=e,this._inputElement=e.getEngine().getInputElement(),"getVRDisplays"in navigator||void 0!==t.useXR||(t.useXR=!0),void 0===t.createFallbackVRDeviceOrientationFreeCamera&&(t.createFallbackVRDeviceOrientationFreeCamera=!0),void 0===t.createDeviceOrientationCamera&&(t.createDeviceOrientationCamera=!0),void 0===t.laserToggle&&(t.laserToggle=!0),void 0===t.defaultHeight&&(t.defaultHeight=1.7),t.useCustomVRButton&&(this._useCustomVRButton=!0,t.customVRButton&&(this._btnVR=t.customVRButton)),t.rayLength&&(this._rayLength=t.rayLength),this._defaultHeight=t.defaultHeight,t.positionScale&&(this._rayLength*=t.positionScale,this._defaultHeight*=t.positionScale),this._hasEnteredVR=!1,this._scene.activeCamera?this._position=this._scene.activeCamera.position.clone():this._position=new o.P(0,this._defaultHeight,0),t.createDeviceOrientationCamera||!this._scene.activeCamera){if(this._deviceOrientationCamera=new ze("deviceOrientationVRHelper",this._position.clone(),e),this._scene.activeCamera&&(this._deviceOrientationCamera.minZ=this._scene.activeCamera.minZ,this._deviceOrientationCamera.maxZ=this._scene.activeCamera.maxZ,this._scene.activeCamera instanceof ke.C&&this._scene.activeCamera.rotation)){const e=this._scene.activeCamera;e.rotationQuaternion?this._deviceOrientationCamera.rotationQuaternion.copyFrom(e.rotationQuaternion):this._deviceOrientationCamera.rotationQuaternion.copyFrom(o._f.RotationYawPitchRoll(e.rotation.y,e.rotation.x,e.rotation.z)),this._deviceOrientationCamera.rotation=e.rotation.clone()}this._scene.activeCamera=this._deviceOrientationCamera,this._inputElement&&this._scene.activeCamera.attachControl()}else this._existingCamera=this._scene.activeCamera;this.webVROptions.useXR&&navigator.xr?li.IsSessionSupportedAsync("immersive-vr").then((i=>{i?(u.Y.Log("Using WebXR. It is recommended to use the WebXRDefaultExperience directly"),e.createDefaultXRExperienceAsync({floorMeshes:t.floorMeshes||[]}).then((t=>{this.xr=t,this.xrTestDone=!0,this._cameraGazer=new xi((()=>this.xr.baseExperience.camera),e),this.xr.baseExperience.onStateChangedObservable.add((e=>{switch(e){case Zt.ENTERING_XR:this.onEnteringVRObservable.notifyObservers(this),this._interactionsEnabled||this.xr.pointerSelection.detach(),this.xr.pointerSelection.displayLaserPointer=this._displayLaserPointer;break;case Zt.EXITING_XR:this.onExitingVRObservable.notifyObservers(this),this._scene.getEngine().resize();break;case Zt.IN_XR:this._hasEnteredVR=!0;break;case Zt.NOT_IN_XR:this._hasEnteredVR=!1}}))}))):this._completeVRInit(e,t)})):this._completeVRInit(e,t)}get onEnteringVR(){return this.onEnteringVRObservable}get onExitingVR(){return this.onExitingVRObservable}get onControllerMeshLoaded(){return this.onControllerMeshLoadedObservable}get teleportationTarget(){return this._teleportationTarget}set teleportationTarget(e){e&&(e.name="teleportationTarget",this._isDefaultTeleportationTarget=!1,this._teleportationTarget=e)}get gazeTrackerMesh(){return this._cameraGazer._gazeTracker}set gazeTrackerMesh(e){e&&(this._cameraGazer._gazeTracker&&this._cameraGazer._gazeTracker.dispose(),this._leftController&&this._leftController._gazeTracker&&this._leftController._gazeTracker.dispose(),this._rightController&&this._rightController._gazeTracker&&this._rightController._gazeTracker.dispose(),this._cameraGazer._gazeTracker=e,this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(),this._cameraGazer._gazeTracker.isPickable=!1,this._cameraGazer._gazeTracker.isVisible=!1,this._cameraGazer._gazeTracker.name="gazeTracker",this._leftController&&(this._leftController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")),this._rightController&&(this._rightController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")))}get leftControllerGazeTrackerMesh(){return this._leftController?this._leftController._gazeTracker:null}get rightControllerGazeTrackerMesh(){return this._rightController?this._rightController._gazeTracker:null}get displayGaze(){return this._displayGaze}set displayGaze(e){this._displayGaze=e,e||(this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1))}get displayLaserPointer(){return this._displayLaserPointer}set displayLaserPointer(e){this._displayLaserPointer=e,e?(this._rightController&&this._rightController._activatePointer(),this._leftController&&this._leftController._activatePointer()):(this._rightController&&(this._rightController._deactivatePointer(),this._rightController._gazeTracker.isVisible=!1),this._leftController&&(this._leftController._deactivatePointer(),this._leftController._gazeTracker.isVisible=!1))}get deviceOrientationCamera(){return this._deviceOrientationCamera}get currentVRCamera(){return this._webVRready?this._webVRCamera:this._scene.activeCamera}get webVRCamera(){return this._webVRCamera}get vrDeviceOrientationCamera(){return this._vrDeviceOrientationCamera}get vrButton(){return this._btnVR}get _teleportationRequestInitiated(){return this._cameraGazer._teleportationRequestInitiated||null!==this._leftController&&this._leftController._teleportationRequestInitiated||null!==this._rightController&&this._rightController._teleportationRequestInitiated}_completeVRInit(e,t){if(this.xrTestDone=!0,t.createFallbackVRDeviceOrientationFreeCamera&&(t.useMultiview&&(t.vrDeviceOrientationCameraMetrics||(t.vrDeviceOrientationCameraMetrics=Pt.GetDefault()),t.vrDeviceOrientationCameraMetrics.multiviewEnabled=!0),this._vrDeviceOrientationCamera=new Ut("VRDeviceOrientationVRHelper",this._position,this._scene,!0,t.vrDeviceOrientationCameraMetrics),this._vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._webVRCamera=new zt("WebVRHelper",this._position,this._scene,t),this._webVRCamera.useStandingMatrix(),this._cameraGazer=new xi((()=>this.currentVRCamera),e),!this._useCustomVRButton){this._btnVR=document.createElement("BUTTON"),this._btnVR.className="babylonVRicon",this._btnVR.id="babylonVRiconbtn",this._btnVR.title="Click to switch to VR";let e=".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url("+(window.SVGSVGElement?"data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A":"https://cdn.babylonjs.com/Assets/vrButton.png")+"); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }";e+=".babylonVRicon.vrdisplaypresenting { display: none; }";const t=document.createElement("style");t.appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(t),this._moveButtonToBottomRight()}this._btnVR&&this._btnVR.addEventListener("click",(()=>{this.isInVRMode?this._scene.getEngine().disableVR():this.enterVR()}));const i=this._scene.getEngine().getHostWindow();i&&(i.addEventListener("resize",this._onResize),document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),t.createFallbackVRDeviceOrientationFreeCamera?this._displayVRButton():this._scene.getEngine().onVRDisplayChangedObservable.add((e=>{e.vrDisplay&&this._displayVRButton()})),this._onKeyDown=e=>{27===e.keyCode&&this.isInVRMode&&this.exitVR()},document.addEventListener("keydown",this._onKeyDown),this._scene.onPrePointerObservable.add((()=>{this._hasEnteredVR&&this.exitVROnDoubleTap&&(this.exitVR(),this._fullscreenVRpresenting&&this._scene.getEngine().exitFullscreen())}),Z.kD.POINTERDOUBLETAP,!1),this._onVRDisplayChangedBind=e=>this._onVRDisplayChanged(e),this._onVrDisplayPresentChangeBind=()=>this._onVrDisplayPresentChange(),this._onVRRequestPresentStart=()=>{this._webVRrequesting=!0,this._updateButtonVisibility()},this._onVRRequestPresentComplete=()=>{this._webVRrequesting=!1,this._updateButtonVisibility()},e.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChangedBind),e.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart),e.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete),i.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChangeBind),e.onDisposeObservable.add((()=>{this.dispose()})),this._webVRCamera.onControllerMeshLoadedObservable.add((e=>this._onDefaultMeshLoaded(e))),this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected),this._updateButtonVisibility(),this._circleEase=new w,this._circleEase.setEasingMode(O.EASINGMODE_EASEINOUT),this._teleportationEasing=this._circleEase,e.onPointerObservable.add((t=>{this._interactionsEnabled&&e.activeCamera===this.vrDeviceOrientationCamera&&"mouse"===t.event.pointerType&&(t.type===Z.kD.POINTERDOWN?this._cameraGazer._selectionPointerDown():t.type===Z.kD.POINTERUP&&this._cameraGazer._selectionPointerUp())})),this.webVROptions.floorMeshes&&this.enableTeleportation({floorMeshes:this.webVROptions.floorMeshes}))}_onDefaultMeshLoaded(e){this._leftController&&this._leftController.webVRController==e&&e.mesh&&this._leftController._setLaserPointerParent(e.mesh),this._rightController&&this._rightController.webVRController==e&&e.mesh&&this._rightController._setLaserPointerParent(e.mesh);try{this.onControllerMeshLoadedObservable.notifyObservers(e)}catch(e){u.Y.Warn("Error in your custom logic onControllerMeshLoaded: "+e)}}get isInVRMode(){return this.xr&&this.webVROptions.useXR&&this.xr.baseExperience.state===Zt.IN_XR||this._webVRpresenting||this._fullscreenVRpresenting}_onVrDisplayPresentChange(){const e=this._scene.getEngine().getVRDevice();if(e){const t=this._webVRpresenting;this._webVRpresenting=e.isPresenting,t&&!this._webVRpresenting&&this.exitVR()}else u.Y.Warn("Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?");this._updateButtonVisibility()}_onVRDisplayChanged(e){this._webVRsupported=e.vrSupported,this._webVRready=!!e.vrDisplay,this._webVRpresenting=e.vrDisplay&&e.vrDisplay.isPresenting,this._updateButtonVisibility()}_moveButtonToBottomRight(){if(this._inputElement&&!this._useCustomVRButton&&this._btnVR){const e=this._inputElement.getBoundingClientRect();this._btnVR.style.top=e.top+e.height-70+"px",this._btnVR.style.left=e.left+e.width-100+"px"}}_displayVRButton(){this._useCustomVRButton||this._btnVRDisplayed||!this._btnVR||(document.body.appendChild(this._btnVR),this._btnVRDisplayed=!0)}_updateButtonVisibility(){this._btnVR&&!this._useCustomVRButton&&(this._btnVR.className="babylonVRicon",this.isInVRMode?this._btnVR.className+=" vrdisplaypresenting":(this._webVRready&&(this._btnVR.className+=" vrdisplayready"),this._webVRsupported&&(this._btnVR.className+=" vrdisplaysupported"),this._webVRrequesting&&(this._btnVR.className+=" vrdisplayrequesting")))}enterVR(){if(this.xr)this.xr.baseExperience.enterXRAsync("immersive-vr","local-floor",this.xr.renderTarget);else{if(this.onEnteringVRObservable)try{this.onEnteringVRObservable.notifyObservers(this)}catch(e){u.Y.Warn("Error in your custom logic onEnteringVR: "+e)}if(this._scene.activeCamera){if(this._position=this._scene.activeCamera.position.clone(),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.rotation=o._f.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(),this.vrDeviceOrientationCamera.angularSensibility=2e3),this.webVRCamera){const e=this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y,t=o._f.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y-e,i=this.webVRCamera.rotationQuaternion.toEulerAngles().y;this.webVRCamera.rotationQuaternion=o._f.FromEulerAngles(0,i+t,0)}this._existingCamera=this._scene.activeCamera,this._existingCamera.angularSensibilityX&&(this._cachedAngularSensibility.angularSensibilityX=this._existingCamera.angularSensibilityX,this._existingCamera.angularSensibilityX=Number.MAX_VALUE),this._existingCamera.angularSensibilityY&&(this._cachedAngularSensibility.angularSensibilityY=this._existingCamera.angularSensibilityY,this._existingCamera.angularSensibilityY=Number.MAX_VALUE),this._existingCamera.angularSensibility&&(this._cachedAngularSensibility.angularSensibility=this._existingCamera.angularSensibility,this._existingCamera.angularSensibility=Number.MAX_VALUE)}this._webVRrequesting||(this._webVRready?this._webVRpresenting||(this._scene.getEngine().onVRRequestPresentComplete.addOnce((e=>{this.onAfterEnteringVRObservable.notifyObservers({success:e})})),this._webVRCamera.position=this._position,this._scene.activeCamera=this._webVRCamera):this._vrDeviceOrientationCamera&&(this._vrDeviceOrientationCamera.position=this._position,this._scene.activeCamera&&(this._vrDeviceOrientationCamera.minZ=this._scene.activeCamera.minZ),this._scene.activeCamera=this._vrDeviceOrientationCamera,this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen),this._updateButtonVisibility(),this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce((()=>{this.onAfterEnteringVRObservable.notifyObservers({success:!0})}))),this._scene.activeCamera&&this._inputElement&&this._scene.activeCamera.attachControl(),this._interactionsEnabled&&this._scene.registerBeforeRender(this._beforeRender),this._displayLaserPointer&&[this._leftController,this._rightController].forEach((e=>{e&&e._activatePointer()})),this._hasEnteredVR=!0)}}exitVR(){if(this.xr)this.xr.baseExperience.exitXRAsync();else if(this._hasEnteredVR){if(this.onExitingVRObservable)try{this.onExitingVRObservable.notifyObservers(this)}catch(e){u.Y.Warn("Error in your custom logic onExitingVR: "+e)}this._webVRpresenting&&this._scene.getEngine().disableVR(),this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone()),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._deviceOrientationCamera?(this._deviceOrientationCamera.position=this._position,this._scene.activeCamera=this._deviceOrientationCamera,this._cachedAngularSensibility.angularSensibilityX&&(this._deviceOrientationCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._deviceOrientationCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._deviceOrientationCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)):this._existingCamera&&(this._existingCamera.position=this._position,this._scene.activeCamera=this._existingCamera,this._inputElement&&this._scene.activeCamera.attachControl(),this._cachedAngularSensibility.angularSensibilityX&&(this._existingCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._existingCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._existingCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)),this._updateButtonVisibility(),this._interactionsEnabled&&(this._scene.unregisterBeforeRender(this._beforeRender),this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1)),this._scene.getEngine().resize(),[this._leftController,this._rightController].forEach((e=>{e&&e._deactivatePointer()})),this._hasEnteredVR=!1;const e=this._scene.getEngine();e._onVrDisplayPresentChange&&e._onVrDisplayPresentChange()}}get position(){return this._position}set position(e){this._position=e,this._scene.activeCamera&&(this._scene.activeCamera.position=e)}enableInteractions(){if(!this._interactionsEnabled){if(this._interactionsRequested=!0,this.xr)return void(this.xr.baseExperience.state===Zt.IN_XR&&this.xr.pointerSelection.attach());this._leftController&&this._enableInteractionOnController(this._leftController),this._rightController&&this._enableInteractionOnController(this._rightController),this.raySelectionPredicate=e=>e.isVisible&&(e.isPickable||e.name===this._floorMeshName),this.meshSelectionPredicate=()=>!0,this._raySelectionPredicate=e=>!!(this._isTeleportationFloor(e)||-1===e.name.indexOf("gazeTracker")&&-1===e.name.indexOf("teleportationTarget")&&-1===e.name.indexOf("torusTeleportation"))&&this.raySelectionPredicate(e),this._interactionsEnabled=!0}}get _noControllerIsActive(){return!(this._leftController&&this._leftController._activePointer||this._rightController&&this._rightController._activePointer)}_isTeleportationFloor(e){for(let t=0;t-1||this._floorMeshesCollection.push(e))}removeFloorMesh(e){if(!this._floorMeshesCollection)return;const t=this._floorMeshesCollection.indexOf(e);-1!==t&&this._floorMeshesCollection.splice(t,1)}enableTeleportation(e={}){if(!this._teleportationInitialized){if(this._teleportationRequested=!0,this.enableInteractions(),this.webVROptions.useXR&&(e.floorMeshes||e.floorMeshName)){const t=e.floorMeshes||[];if(!t.length){const i=this._scene.getMeshByName(e.floorMeshName);i&&t.push(i)}if(this.xr)return t.forEach((e=>{this.xr.teleportation.addFloorMesh(e)})),void(this.xr.teleportation.attached||this.xr.teleportation.attach());if(!this.xrTestDone){const t=()=>{this.xrTestDone&&(this._scene.unregisterBeforeRender(t),this.xr?this.xr.teleportation.attached||this.xr.teleportation.attach():this.enableTeleportation(e))};return void this._scene.registerBeforeRender(t)}}e.floorMeshName&&(this._floorMeshName=e.floorMeshName),e.floorMeshes&&(this._floorMeshesCollection=e.floorMeshes),e.teleportationMode&&(this._teleportationMode=e.teleportationMode),e.teleportationTime&&e.teleportationTime>0&&(this._teleportationTime=e.teleportationTime),e.teleportationSpeed&&e.teleportationSpeed>0&&(this._teleportationSpeed=e.teleportationSpeed),void 0!==e.easingFunction&&(this._teleportationEasing=e.easingFunction),null!=this._leftController&&this._enableTeleportationOnController(this._leftController),null!=this._rightController&&this._enableTeleportationOnController(this._rightController);const t=new Xt.$;t.vignetteColor=new a.HE(0,0,0,0),t.vignetteEnabled=!0,this._postProcessMove=new qt("postProcessMove",1,this._webVRCamera,void 0,void 0,void 0,void 0,t),this._webVRCamera.detachPostProcess(this._postProcessMove),this._teleportationInitialized=!0,this._isDefaultTeleportationTarget&&(this._createTeleportationCircles(),this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor))}}_enableInteractionOnController(e){e.webVRController.mesh&&(e._interactionsEnabled=!0,this.isInVRMode&&this._displayLaserPointer&&e._activatePointer(),this.webVROptions.laserToggle&&e.webVRController.onMainButtonStateChangedObservable.add((t=>{this._displayLaserPointer&&1===t.value&&(e._activePointer?e._deactivatePointer():e._activatePointer(),this.displayGaze&&(e._gazeTracker.isVisible=e._activePointer))})),e.webVRController.onTriggerStateChangedObservable.add((t=>{let i=e;this._noControllerIsActive&&(i=this._cameraGazer),i._pointerDownOnMeshAsked?t.valuethis._padSensibilityUp&&i._selectionPointerDown()})))}_checkTeleportWithRay(e,t){this._teleportationRequestInitiated&&!t._teleportationRequestInitiated||(t._teleportationRequestInitiated?Math.sqrt(e.y*e.y+e.x*e.x)-this._padSensibilityDown&&(t._rotationLeftAsked=!1):e.x<-this._padSensibilityUp&&t._dpadPressed&&(t._rotationLeftAsked=!0,this._rotationAllowed&&this._rotateCamera(!1)),t._rotationRightAsked?e.xthis._padSensibilityUp&&t._dpadPressed&&(t._rotationRightAsked=!0,this._rotationAllowed&&this._rotateCamera(!0)))}_checkTeleportBackwards(e,t){if(!t._teleportationRequestInitiated)if(e.y>this._padSensibilityUp&&t._dpadPressed){if(!t._teleportationBackRequestInitiated){if(!this.currentVRCamera)return;let e=o._f.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()),i=this.currentVRCamera.position;this.currentVRCamera.devicePosition&&this.currentVRCamera.deviceRotationQuaternion&&(e=this.currentVRCamera.deviceRotationQuaternion,i=this.currentVRCamera.devicePosition),e.toEulerAnglesToRef(this._workingVector),this._workingVector.z=0,this._workingVector.x=0,o._f.RotationYawPitchRollToRef(this._workingVector.y,this._workingVector.x,this._workingVector.z,this._workingQuaternion),this._workingQuaternion.toRotationMatrix(this._workingMatrix),o.P.TransformCoordinatesToRef(this._teleportBackwardsVector,this._workingMatrix,this._workingVector);const n=new tt.z(i,this._workingVector),r=this._scene.pickWithRay(n,this._raySelectionPredicate);r&&r.pickedPoint&&r.pickedMesh&&this._isTeleportationFloor(r.pickedMesh)&&r.distance<5&&this.teleportCamera(r.pickedPoint),t._teleportationBackRequestInitiated=!0}}else t._teleportationBackRequestInitiated=!1}_enableTeleportationOnController(e){e.webVRController.mesh&&(e._interactionsEnabled||this._enableInteractionOnController(e),e._interactionsEnabled=!0,e._teleportationEnabled=!0,e.webVRController.controllerType===Ke.VIVE&&(e._dpadPressed=!1,e.webVRController.onPadStateChangedObservable.add((t=>{e._dpadPressed=t.pressed,e._dpadPressed||(e._rotationLeftAsked=!1,e._rotationRightAsked=!1,e._teleportationBackRequestInitiated=!1)}))),e.webVRController.onPadValuesChangedObservable.add((t=>{this.teleportationEnabled&&(this._checkTeleportBackwards(t,e),this._checkTeleportWithRay(t,e)),this._checkRotate(t,e)})))}_createTeleportationCircles(){this._teleportationTarget=yi("teleportationTarget",{width:2,height:2,subdivisions:2},this._scene),this._teleportationTarget.isPickable=!1;const e=new Qt.c("DynamicTexture",512,this._scene,!0);e.hasAlpha=!0;const t=e.getContext();t.beginPath(),t.arc(256,256,200,0,2*Math.PI,!1),t.fillStyle=this._teleportationFillColor,t.fill(),t.lineWidth=10,t.strokeStyle=this._teleportationBorderColor,t.stroke(),t.closePath(),e.update();const i=new Yt.K("TextPlaneMaterial",this._scene);i.diffuseTexture=e,this._teleportationTarget.material=i;const n=pi("torusTeleportation",{diameter:.75,thickness:.1,tessellation:25,updatable:!1},this._scene);n.isPickable=!1,n.parent=this._teleportationTarget;const r=new y.f("animationInnerCircle","position.y",30,y.f.ANIMATIONTYPE_FLOAT,y.f.ANIMATIONLOOPMODE_CYCLE),s=[];s.push({frame:0,value:0}),s.push({frame:30,value:.4}),s.push({frame:60,value:0}),r.setKeys(s);const o=new B;o.setEasingMode(O.EASINGMODE_EASEINOUT),r.setEasingFunction(o),n.animations=[],n.animations.push(r),this._scene.beginAnimation(n,0,60,!0),this._hideTeleportationTarget()}_displayTeleportationTarget(){this._teleportActive=!0,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!0,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!0))}_hideTeleportationTarget(){this._teleportActive=!1,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!1,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!1))}_rotateCamera(e){if(!(this.currentVRCamera instanceof Ve.c))return;e?this._rotationAngle++:this._rotationAngle--,this.currentVRCamera.animations=[];const t=o._f.FromRotationMatrix(o.y3.RotationY(Math.PI/4*this._rotationAngle)),i=new y.f("animationRotation","rotationQuaternion",90,y.f.ANIMATIONTYPE_QUATERNION,y.f.ANIMATIONLOOPMODE_CONSTANT),n=[];n.push({frame:0,value:this.currentVRCamera.rotationQuaternion}),n.push({frame:6,value:t}),i.setKeys(n),i.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(i),this._postProcessMove.animations=[];const r=new y.f("animationPP","vignetteWeight",90,y.f.ANIMATIONTYPE_FLOAT,y.f.ANIMATIONLOOPMODE_CONSTANT),s=[];s.push({frame:0,value:0}),s.push({frame:3,value:4}),s.push({frame:6,value:0}),r.setKeys(s),r.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(r);const a=new y.f("animationPP2","vignetteStretch",90,y.f.ANIMATIONTYPE_FLOAT,y.f.ANIMATIONLOOPMODE_CONSTANT),l=[];l.push({frame:0,value:0}),l.push({frame:3,value:10}),l.push({frame:6,value:0}),a.setKeys(l),a.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(a),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._postProcessMove.samples=4,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,6,!1,1,(()=>{this._webVRCamera.detachPostProcess(this._postProcessMove)})),this._scene.beginAnimation(this.currentVRCamera,0,6,!1,1)}_moveTeleportationSelectorTo(e,t,i){if(e.pickedPoint){t._teleportationRequestInitiated&&(this._displayTeleportationTarget(),this._haloCenter.copyFrom(e.pickedPoint),this._teleportationTarget.position.copyFrom(e.pickedPoint));const n=this._convertNormalToDirectionOfRay(e.getNormal(!0,!1),i);if(n){const e=o.P.Cross(ne.RD.Y,n),t=o.P.Cross(n,e);o.P.RotationFromAxisToRef(t,n,e,this._teleportationTarget.rotation)}this._teleportationTarget.position.y+=.1}}teleportCamera(e){if(!(this.currentVRCamera instanceof Ve.c))return;let t,i;if(this.webVRCamera.leftCamera?(this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition),this._workingVector.subtractInPlace(this.webVRCamera.position),e.subtractToRef(this._workingVector,this._workingVector)):this._workingVector.copyFrom(e),this.isInVRMode?this._workingVector.y+=this.webVRCamera.deviceDistanceToRoomGround()*this._webVRCamera.deviceScaleFactor:this._workingVector.y+=this._defaultHeight,this.onBeforeCameraTeleport.notifyObservers(this._workingVector),this._teleportationMode==Ti.TELEPORTATIONMODE_CONSTANTSPEED){i=90;const e=o.P.Distance(this.currentVRCamera.position,this._workingVector);t=this._teleportationSpeed/e}else i=Math.round(90*this._teleportationTime/1e3),t=1;this.currentVRCamera.animations=[];const n=new y.f("animationCameraTeleportation","position",90,y.f.ANIMATIONTYPE_VECTOR3,y.f.ANIMATIONLOOPMODE_CONSTANT),r=[{frame:0,value:this.currentVRCamera.position},{frame:i,value:this._workingVector}];n.setKeys(r),n.setEasingFunction(this._teleportationEasing),this.currentVRCamera.animations.push(n),this._postProcessMove.animations=[];const s=Math.round(i/2),a=new y.f("animationPP","vignetteWeight",90,y.f.ANIMATIONTYPE_FLOAT,y.f.ANIMATIONLOOPMODE_CONSTANT),l=[];l.push({frame:0,value:0}),l.push({frame:s,value:8}),l.push({frame:i,value:0}),a.setKeys(l),this._postProcessMove.animations.push(a);const c=new y.f("animationPP2","vignetteStretch",90,y.f.ANIMATIONTYPE_FLOAT,y.f.ANIMATIONLOOPMODE_CONSTANT),h=[];h.push({frame:0,value:0}),h.push({frame:s,value:10}),h.push({frame:i,value:0}),c.setKeys(h),this._postProcessMove.animations.push(c),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,i,!1,t,(()=>{this._webVRCamera.detachPostProcess(this._postProcessMove)})),this._scene.beginAnimation(this.currentVRCamera,0,i,!1,t,(()=>{this.onAfterCameraTeleport.notifyObservers(this._workingVector)})),this._hideTeleportationTarget()}_convertNormalToDirectionOfRay(e,t){return e&&Math.acos(o.P.Dot(e,t.direction))l){const e=l;l=a,a=e}return a>0&&a0&&l=0))}_canDoCollision(e,t,i,n){const r=o.P.Distance(this._basePointWorld,e),s=Math.max(this._radius.x,this._radius.y,this._radius.z);return!(r>this._velocityWorldLength+s+t||!((e,t,i,n)=>!(e.x>i.x+n||i.x-n>t.x||e.y>i.y+n||i.y-n>t.y||e.z>i.z+n||i.z-n>t.z))(i,n,this._basePointWorld,this._velocityWorldLength+s))}_testTriangle(e,t,i,n,r,s,a){let l,c=!1;t||(t=[]),t[e]||(t[e]=new be.J(0,0,0,0),t[e].copyFromPoints(i,n,r));const h=t[e];if(!s&&!h.isFrontFacingTo(this._normalizedVelocity,0))return;const _=h.signedDistanceTo(this._basePoint),d=o.P.Dot(h.normal,this._velocity);if(Ri.DoubleSidedCheck&&d>1e-4)return;if(0==d){if(Math.abs(_)>=1)return;c=!0,l=0}else{l=(-1-_)/d;let e=(1-_)/d;if(l>e){const t=e;e=l,l=t}if(l>1||e<0)return;l<0&&(l=0),l>1&&(l=1)}this._collisionPoint.copyFromFloats(0,0,0);let u=!1,p=1;if(c||(this._basePoint.subtractToRef(h.normal,this._planeIntersectionPoint),this._velocity.scaleToRef(l,this._tempVector),this._planeIntersectionPoint.addInPlace(this._tempVector),this._checkPointInTriangle(this._planeIntersectionPoint,i,n,r,h.normal)&&(u=!0,p=l,this._collisionPoint.copyFrom(this._planeIntersectionPoint))),!u){let e=this._velocitySquaredLength;this._basePoint.subtractToRef(i,this._tempVector);let t=2*o.P.Dot(this._velocity,this._tempVector),s=this._tempVector.lengthSquared()-1,a=Ei(e,t,s,p);a.found&&(p=a.root,u=!0,this._collisionPoint.copyFrom(i)),this._basePoint.subtractToRef(n,this._tempVector),t=2*o.P.Dot(this._velocity,this._tempVector),s=this._tempVector.lengthSquared()-1,a=Ei(e,t,s,p),a.found&&(p=a.root,u=!0,this._collisionPoint.copyFrom(n)),this._basePoint.subtractToRef(r,this._tempVector),t=2*o.P.Dot(this._velocity,this._tempVector),s=this._tempVector.lengthSquared()-1,a=Ei(e,t,s,p),a.found&&(p=a.root,u=!0,this._collisionPoint.copyFrom(r)),n.subtractToRef(i,this._edge),i.subtractToRef(this._basePoint,this._baseToVertex);let l=this._edge.lengthSquared(),c=o.P.Dot(this._edge,this._velocity),h=o.P.Dot(this._edge,this._baseToVertex);if(e=l*-this._velocitySquaredLength+c*c,t=2*(l*o.P.Dot(this._velocity,this._baseToVertex)-c*h),s=l*(1-this._baseToVertex.lengthSquared())+h*h,a=Ei(e,t,s,p),a.found){const e=(c*a.root-h)/l;e>=0&&e<=1&&(p=a.root,u=!0,this._edge.scaleInPlace(e),i.addToRef(this._edge,this._collisionPoint))}if(r.subtractToRef(n,this._edge),n.subtractToRef(this._basePoint,this._baseToVertex),l=this._edge.lengthSquared(),c=o.P.Dot(this._edge,this._velocity),h=o.P.Dot(this._edge,this._baseToVertex),e=l*-this._velocitySquaredLength+c*c,t=2*(l*o.P.Dot(this._velocity,this._baseToVertex)-c*h),s=l*(1-this._baseToVertex.lengthSquared())+h*h,a=Ei(e,t,s,p),a.found){const e=(c*a.root-h)/l;e>=0&&e<=1&&(p=a.root,u=!0,this._edge.scaleInPlace(e),n.addToRef(this._edge,this._collisionPoint))}if(i.subtractToRef(r,this._edge),r.subtractToRef(this._basePoint,this._baseToVertex),l=this._edge.lengthSquared(),c=o.P.Dot(this._edge,this._velocity),h=o.P.Dot(this._edge,this._baseToVertex),e=l*-this._velocitySquaredLength+c*c,t=2*(l*o.P.Dot(this._velocity,this._baseToVertex)-c*h),s=l*(1-this._baseToVertex.lengthSquared())+h*h,a=Ei(e,t,s,p),a.found){const e=(c*a.root-h)/l;e>=0&&e<=1&&(p=a.root,u=!0,this._edge.scaleInPlace(e),r.addToRef(this._edge,this._collisionPoint))}}if(u){const e=p*p*this._velocitySquaredLength;(!this.collisionFound||e=n)return void r.copyFrom(e);const a=s?s.collisionMask:i.collisionMask;i._initialize(e,t,o);const l=s&&s.surroundingMeshes||this._scene.meshes;for(let e=0;enew Pi;var Ii=i("../../../node_modules/@babylonjs/core/Collisions/pickingInfo.js"),Mi=(i("../../../node_modules/@babylonjs/core/Collisions/intersectionInfo.js"),i("../../../node_modules/@babylonjs/core/Collisions/meshCollisionData.js"),i("../../../node_modules/@babylonjs/core/Engines/Processors/shaderProcessor.js")),Di=i("../../../node_modules/@babylonjs/core/Materials/shaderLanguage.js");class Oi{constructor(e,t,i,n=""){var r,o;let a;this.name=null,this.defines="",this.onCompiled=null,this.onError=null,this.uniqueId=0,this.onCompileObservable=new s.y$,this.onErrorObservable=new s.y$,this.onBindObservable=new s.y$,this._wasPreviouslyReady=!1,this._isReady=!1,this._compilationError="",this._key="",this._computeSourceCodeOverride="",this._pipelineContext=null,this._computeSourceCode="",this._rawComputeSourceCode="",this._shaderLanguage=Di.x.WGSL,this.name=e,this._key=n,this._engine=i,this.uniqueId=Oi._UniqueIdSeed++,this.defines=null!==(r=t.defines)&&void 0!==r?r:"",this.onError=t.onError,this.onCompiled=t.onCompiled,this._entryPoint=null!==(o=t.entryPoint)&&void 0!==o?o:"main",this._shaderStore=dt.v.GetShadersStore(this._shaderLanguage),this._shaderRepository=dt.v.GetShadersRepository(this._shaderLanguage),this._includeShaderStore=dt.v.GetIncludesShadersStore(this._shaderLanguage);const l=(0,U.CG)()?this._engine.getHostDocument():null;e.computeSource?a="source:"+e.computeSource:e.computeElement?(a=l?l.getElementById(e.computeElement):null,a||(a=e.computeElement)):a=e.compute||e;const c={defines:this.defines.split("\n"),indexParameters:void 0,isFragment:!1,shouldUseHighPrecisionShader:!1,processor:null,supportsUniformBuffers:this._engine.supportsUniformBuffers,shadersRepository:this._shaderRepository,includesShadersStore:this._includeShaderStore,version:(100*this._engine.version).toString(),platformName:this._engine.shaderPlatformName,processingContext:null,isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer};this._loadShader(a,"Compute","",(i=>{Mi.L.Initialize(c),Mi.L.PreProcess(i,c,(n=>{this._rawComputeSourceCode=i,t.processFinalCode&&(n=t.processFinalCode(n));const r=Mi.L.Finalize(n,"",c);this._useFinalCode(r.vertexCode,e)}),this._engine)}))}_useFinalCode(e,t){if(t){const i=t.computeElement||t.compute||t.spectorName||t;this._computeSourceCode="//#define SHADER_NAME compute:"+i+"\n"+e}else this._computeSourceCode=e;this._prepareEffect()}get key(){return this._key}isReady(){try{return this._isReadyInternal()}catch(e){return!1}}_isReadyInternal(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady}getEngine(){return this._engine}getPipelineContext(){return this._pipelineContext}getCompilationError(){return this._compilationError}executeWhenCompiled(e){this.isReady()?e(this):(this.onCompileObservable.add((t=>{e(t)})),this._pipelineContext&&!this._pipelineContext.isAsync||setTimeout((()=>{this._checkIsReady(null)}),16))}_checkIsReady(e){try{if(this._isReadyInternal())return}catch(t){return void this._processCompilationErrors(t,e)}setTimeout((()=>{this._checkIsReady(e)}),16)}_loadShader(e,t,i,n){if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return void n((0,U.v)(e));if("source:"===e.substr(0,7))return void n(e.substr(7));if("base64:"===e.substr(0,7))return void n(window.atob(e.substr(7)));if(this._shaderStore[e+t+"Shader"])return void n(this._shaderStore[e+t+"Shader"]);if(i&&this._shaderStore[e+i+"Shader"])return void n(this._shaderStore[e+i+"Shader"]);let r;r="."===e[0]||"/"===e[0]||e.indexOf("http")>-1?e:this._shaderRepository+e,this._engine._loadFile(r+"."+t.toLowerCase()+".fx",n)}get computeSourceCode(){var e,t;return this._computeSourceCodeOverride?this._computeSourceCodeOverride:null!==(t=null===(e=this._pipelineContext)||void 0===e?void 0:e._getComputeShaderCode())&&void 0!==t?t:this._computeSourceCode}get rawComputeSourceCode(){return this._rawComputeSourceCode}_prepareEffect(){const e=this.defines,t=this._pipelineContext;this._isReady=!1;try{const i=this._engine;this._pipelineContext=i.createComputePipelineContext(),this._pipelineContext._name=this._key,i._prepareComputePipelineContext(this._pipelineContext,this._computeSourceCodeOverride?this._computeSourceCodeOverride:this._computeSourceCode,this._rawComputeSourceCode,this._computeSourceCodeOverride?null:e,this._entryPoint),i._executeWhenComputeStateIsCompiled(this._pipelineContext,(()=>{this._compilationError="",this._isReady=!0,this.onCompiled&&this.onCompiled(this),this.onCompileObservable.notifyObservers(this),this.onCompileObservable.clear(),t&&this.getEngine()._deleteComputePipelineContext(t)})),this._pipelineContext.isAsync&&this._checkIsReady(t)}catch(e){this._processCompilationErrors(e,t)}}_getShaderCodeAndErrorLine(e,t){const i=/COMPUTE SHADER ERROR: 0:(\d+?):/;let n=null;if(t&&e){const r=t.match(i);if(r&&2===r.length){const t=parseInt(r[1]),i=e.split("\n",-1);i.length>=t&&(n=`Offending line [${t}] in compute code: ${i[t-1]}`)}}return[e,n]}_processCompilationErrors(e,t=null){var i;if(this._compilationError=e.message,u.Y.Error("Unable to compile compute effect:"),u.Y.Error("Defines:\r\n"+this.defines),Oi.LogShaderCodeOnCompilationError){let e=null,t=null;(null===(i=this._pipelineContext)||void 0===i?void 0:i._getComputeShaderCode())&&([t,e]=this._getShaderCodeAndErrorLine(this._pipelineContext._getComputeShaderCode(),this._compilationError),t&&(u.Y.Error("Compute code:"),u.Y.Error(t))),e&&u.Y.Error(e)}u.Y.Error("Error: "+this._compilationError),t&&(this._pipelineContext=t,this._isReady=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this))}dispose(){this._pipelineContext&&this._pipelineContext.dispose(),this._engine._releaseComputeEffect(this)}static RegisterShader(e,t){dt.v.GetShadersStore(Di.x.WGSL)[`${e}ComputeShader`]=t}}Oi._UniqueIdSeed=0,Oi.LogShaderCodeOnCompilationError=!0;var wi,Fi=i("../../../node_modules/@babylonjs/core/Engines/thinEngine.js");!function(e){e[e.Texture=0]="Texture",e[e.StorageTexture=1]="StorageTexture",e[e.UniformBuffer=2]="UniformBuffer",e[e.StorageBuffer=3]="StorageBuffer",e[e.TextureWithoutSampler=4]="TextureWithoutSampler",e[e.Sampler=5]="Sampler"}(wi||(wi={})),Fi.B.prototype.createComputeEffect=function(e,t){throw new Error("createComputeEffect: This engine does not support compute shaders!")},Fi.B.prototype.createComputePipelineContext=function(){throw new Error("createComputePipelineContext: This engine does not support compute shaders!")},Fi.B.prototype.createComputeContext=function(){},Fi.B.prototype.computeDispatch=function(e,t,i,n,r,s,o){throw new Error("computeDispatch: This engine does not support compute shaders!")},Fi.B.prototype.areAllComputeEffectsReady=function(){return!0},Fi.B.prototype.releaseComputeEffects=function(){},Fi.B.prototype._prepareComputePipelineContext=function(e,t,i,n,r){},Fi.B.prototype._rebuildComputeEffects=function(){},Fi.B.prototype._executeWhenComputeStateIsCompiled=function(e,t){t()},Fi.B.prototype._releaseComputeEffect=function(e){},Fi.B.prototype._deleteComputePipelineContext=function(e){};var Bi=i("../../../node_modules/@babylonjs/core/Misc/uniqueIdGenerator.js"),Ni=i("../../../node_modules/@babylonjs/core/Materials/Textures/textureSampler.js");class Li{constructor(e,t,i,n={}){this._bindings={},this._samplers={},this._contextIsDirty=!1,this.onCompiled=null,this.onError=null,this.name=e,this._engine=t,this.uniqueId=Bi.K.UniqueId,this._engine.getCaps().supportComputeShaders?n.bindingsMapping?(this._context=t.createComputeContext(),this._shaderPath=i,this._options={bindingsMapping:{},defines:[],...n}):u.Y.Error("You must provide the binding mappings as browsers don't support reflection for wgsl shaders yet!"):u.Y.Error("This engine does not support compute shaders!")}get options(){return this._options}get shaderPath(){return this._shaderPath}getClassName(){return"ComputeShader"}setTexture(e,t,i=!0){const n=this._bindings[e];this._bindings[e]={type:i?wi.Texture:wi.TextureWithoutSampler,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries},this._contextIsDirty||(this._contextIsDirty=!n||n.object!==t||n.type!==this._bindings[e].type)}setStorageTexture(e,t){const i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||i.object!==t),this._bindings[e]={type:wi.StorageTexture,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}}setUniformBuffer(e,t){const i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||i.object!==t),this._bindings[e]={type:wi.UniformBuffer,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}}setStorageBuffer(e,t){const i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||i.object!==t),this._bindings[e]={type:wi.StorageBuffer,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}}setTextureSampler(e,t){const i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||!t.compareSampler(i.object)),this._bindings[e]={type:wi.Sampler,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}}isReady(){let e=this._effect;for(const e in this._bindings){const t=this._bindings[e],i=t.type,n=t.object;switch(i){case wi.Texture:case wi.TextureWithoutSampler:case wi.StorageTexture:if(!n.isReady())return!1}}const t=[],i=this._shaderPath;if(this._options.defines)for(let e=0;e{const s=()=>{this.dispatch(e,t,i)?r():setTimeout(s,n)};s()}))}serialize(){const e=Y.p4.Serialize(this);e.options=this._options,e.shaderPath=this._shaderPath,e.bindings={},e.textures={};for(const t in this._bindings){const i=this._bindings[t],n=i.object;switch(i.type){case wi.Texture:case wi.TextureWithoutSampler:case wi.StorageTexture:{const r=n.serialize();r&&(e.textures[t]=r,e.bindings[t]={type:i.type});break}case wi.UniformBuffer:}}return e}static Parse(e,t,i){const n=Y.p4.Parse((()=>new Li(e.name,t.getEngine(),e.shaderPath,e.options)),e,t,i);for(const r in e.textures){const s=e.bindings[r],o=K.x.Parse(e.textures[r],t,i);s.type===wi.Texture?n.setTexture(r,o):s.type===wi.TextureWithoutSampler?n.setTexture(r,o,!1):n.setStorageTexture(r,o)}return n}}(0,X.gn)([(0,Y.qC)()],Li.prototype,"name",void 0),(0,l.H)("BABYLON.ComputeShader",Li);var ki=i("../../../node_modules/@babylonjs/core/Culling/boundingBox.js"),Vi=i("../../../node_modules/@babylonjs/core/Culling/boundingInfo.js"),Ui=i("../../../node_modules/@babylonjs/core/Culling/boundingSphere.js"),Gi=i("../../../node_modules/@babylonjs/core/Misc/smartArray.js");class ji{constructor(e,t,i,n,r,s){this.entries=new Array,this._boundingVectors=new Array,this._capacity=i,this._depth=n,this._maxDepth=r,this._creationFunc=s,this._minPoint=e,this._maxPoint=t,this._boundingVectors.push(e.clone()),this._boundingVectors.push(t.clone()),this._boundingVectors.push(e.clone()),this._boundingVectors[2].x=t.x,this._boundingVectors.push(e.clone()),this._boundingVectors[3].y=t.y,this._boundingVectors.push(e.clone()),this._boundingVectors[4].z=t.z,this._boundingVectors.push(t.clone()),this._boundingVectors[5].z=e.z,this._boundingVectors.push(t.clone()),this._boundingVectors[6].x=e.x,this._boundingVectors.push(t.clone()),this._boundingVectors[7].y=e.y}get capacity(){return this._capacity}get minPoint(){return this._minPoint}get maxPoint(){return this._maxPoint}addEntry(e){if(this.blocks)for(let t=0;tthis.capacity&&this._depth-1&&this.entries.splice(t,1)}addEntries(e){for(let t=0;t{const i=e.getBoundingInfo();!e.isBlocked&&i.boundingBox.intersectsMinMax(t.minPoint,t.maxPoint)&&t.entries.push(e)},Wi.CreationFuncForSubMeshes=(e,t)=>{e.getBoundingInfo().boundingBox.intersectsMinMax(t.minPoint,t.maxPoint)&&t.entries.push(e)};var zi=i("../../../node_modules/@babylonjs/core/Meshes/abstractMesh.js");R.x.prototype.createOrUpdateSelectionOctree=function(e=64,t=2){let i=this._getComponent(z.l.NAME_OCTREE);i||(i=new Hi(this),this._addComponent(i)),this._selectionOctree||(this._selectionOctree=new Wi(Wi.CreationFuncForMeshes,e,t));const n=this.getWorldExtends();return this._selectionOctree.update(n.min,n.max,this.meshes),this._selectionOctree},Object.defineProperty(R.x.prototype,"selectionOctree",{get:function(){return this._selectionOctree},enumerable:!0,configurable:!0}),zi.x.prototype.createOrUpdateSubmeshesOctree=function(e=64,t=2){const i=this.getScene();let n=i._getComponent(z.l.NAME_OCTREE);n||(n=new Hi(i),i._addComponent(n)),this._submeshesOctree||(this._submeshesOctree=new Wi(Wi.CreationFuncForSubMeshes,e,t)),this.computeWorldMatrix(!0);const r=this.getBoundingInfo().boundingBox;return this._submeshesOctree.update(r.minimumWorld,r.maximumWorld,this.subMeshes),this._submeshesOctree};class Hi{constructor(e){this.name=z.l.NAME_OCTREE,this.checksIsEnabled=!0,this._tempRay=new tt.z(o.P.Zero(),new o.P(1,1,1)),(e=e||m.l.LastCreatedScene)&&(this.scene=e,this.scene.getActiveMeshCandidates=this.getActiveMeshCandidates.bind(this),this.scene.getActiveSubMeshCandidates=this.getActiveSubMeshCandidates.bind(this),this.scene.getCollidingSubMeshCandidates=this.getCollidingSubMeshCandidates.bind(this),this.scene.getIntersectingSubMeshCandidates=this.getIntersectingSubMeshCandidates.bind(this))}register(){this.scene.onMeshRemovedObservable.add((e=>{const t=this.scene.selectionOctree;if(null!=t){const i=t.dynamicContent.indexOf(e);-1!==i&&t.dynamicContent.splice(i,1)}})),this.scene.onMeshImportedObservable.add((e=>{const t=this.scene.selectionOctree;null!=t&&t.addMesh(e)}))}getActiveMeshCandidates(){var e;return(null===(e=this.scene._selectionOctree)||void 0===e?void 0:e.select(this.scene.frustumPlanes))||this.scene._getDefaultMeshCandidates()}getActiveSubMeshCandidates(e){return e._submeshesOctree&&e.useOctreeForRenderingSelection?e._submeshesOctree.select(this.scene.frustumPlanes):this.scene._getDefaultSubMeshCandidates(e)}getIntersectingSubMeshCandidates(e,t){return e._submeshesOctree&&e.useOctreeForPicking?(tt.z.TransformToRef(t,e.getWorldMatrix(),this._tempRay),e._submeshesOctree.intersectsRay(this._tempRay)):this.scene._getDefaultSubMeshCandidates(e)}getCollidingSubMeshCandidates(e,t){if(e._submeshesOctree&&e.useOctreeForCollisions){const i=t._velocityWorldLength+Math.max(t._radius.x,t._radius.y,t._radius.z);return e._submeshesOctree.intersects(t._basePointWorld,i)}return this.scene._getDefaultSubMeshCandidates(e)}rebuild(){}dispose(){}}var Xi,Yi=i("../../../node_modules/@babylonjs/core/Gizmos/gizmo.js"),Qi=i("../../../node_modules/@babylonjs/core/Rendering/utilityLayerRenderer.js");class qi extends Yi.t{constructor(e,t=a.Wo.Gray(),i=Qi.x.DefaultUtilityLayer,n=null,r=1){var l;super(i),this._pointerObserver=null,this.snapDistance=0,this.onSnapObservable=new s.y$,this._isEnabled=!0,this._parent=null,this._dragging=!1,this._parent=n,this._coloredMaterial=new Yt.K("",i.utilityLayerScene),this._coloredMaterial.diffuseColor=t,this._coloredMaterial.specularColor=t.subtract(new a.Wo(.1,.1,.1)),this._hoverMaterial=new Yt.K("",i.utilityLayerScene),this._hoverMaterial.diffuseColor=a.Wo.Yellow(),this._disableMaterial=new Yt.K("",i.utilityLayerScene),this._disableMaterial.diffuseColor=a.Wo.Gray(),this._disableMaterial.alpha=.4;const c=qi._CreateArrow(i.utilityLayerScene,this._coloredMaterial,r),h=qi._CreateArrow(i.utilityLayerScene,this._coloredMaterial,r+4,!0);this._gizmoMesh=new je.Kj("",i.utilityLayerScene),this._gizmoMesh.addChild(c),this._gizmoMesh.addChild(h),this._gizmoMesh.lookAt(this._rootMesh.position.add(e)),this._gizmoMesh.scaling.scaleInPlace(1/3),this._gizmoMesh.parent=this._rootMesh;let _=0;const d=new o.P,u=new o.P,p={snapDistance:0};this.dragBehavior=new ie.M({dragAxis:e}),this.dragBehavior.moveAttached=!1,this.dragBehavior.updateDragPlane=!1,this._rootMesh.addBehavior(this.dragBehavior),this.dragBehavior.onDragObservable.add((e=>{if(this.attachedNode){this._handlePivot();let t=!1;if(0==this.snapDistance)this.attachedNode.getWorldMatrix().getTranslationToRef(u),u.addInPlace(e.delta),this.dragBehavior.validateDrag(u)&&(this.attachedNode.position&&this.attachedNode.position.addInPlaceFromFloats(e.delta.x,e.delta.y,e.delta.z),this.attachedNode.getWorldMatrix().addTranslationFromFloats(e.delta.x,e.delta.y,e.delta.z),this.attachedNode.updateCache(),t=!0);else if(_+=e.dragDistance,Math.abs(_)>this.snapDistance){const i=Math.floor(Math.abs(_)/this.snapDistance);_%=this.snapDistance,e.delta.normalizeToRef(d),d.scaleInPlace(this.snapDistance*i),this.attachedNode.getWorldMatrix().getTranslationToRef(u),u.addInPlace(d),this.dragBehavior.validateDrag(u)&&(this.attachedNode.getWorldMatrix().addTranslationFromFloats(d.x,d.y,d.z),this.attachedNode.updateCache(),p.snapDistance=this.snapDistance*i,this.onSnapObservable.notifyObservers(p),t=!0)}t&&this._matrixChanged()}})),this.dragBehavior.onDragStartObservable.add((()=>{this._dragging=!0})),this.dragBehavior.onDragEndObservable.add((()=>{this._dragging=!1}));const f=i._getSharedGizmoLight();f.includedOnlyMeshes=f.includedOnlyMeshes.concat(this._rootMesh.getChildMeshes(!1));const m={gizmoMeshes:c.getChildMeshes(),colliderMeshes:h.getChildMeshes(),material:this._coloredMaterial,hoverMaterial:this._hoverMaterial,disableMaterial:this._disableMaterial,active:!1,dragBehavior:this.dragBehavior};null===(l=this._parent)||void 0===l||l.addToAxisCache(h,m),this._pointerObserver=i.utilityLayerScene.onPointerObservable.add((e=>{var t;if(!this._customMeshSet&&(this._isHovered=!(-1==m.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),!this._parent)){const e=this.dragBehavior.enabled?this._isHovered||this._dragging?this._hoverMaterial:this._coloredMaterial:this._disableMaterial;this._setGizmoMeshMaterial(m.gizmoMeshes,e)}})),this.dragBehavior.onEnabledObservable.add((e=>{this._setGizmoMeshMaterial(m.gizmoMeshes,e?m.material:m.disableMaterial)}))}static _CreateArrow(e,t,i=1,n=!1){const r=new Et.Y("arrow",e),s=di("cylinder",{diameterTop:0,height:.075,diameterBottom:.0375*(1+(i-1)/4),tessellation:96},e),o=di("cylinder",{diameterTop:.005*i,height:.275,diameterBottom:.005*i,tessellation:96},e);return s.parent=r,s.material=t,s.rotation.x=Math.PI/2,s.position.z+=.3,o.parent=r,o.material=t,o.position.z+=.1375,o.rotation.x=Math.PI/2,n&&(o.visibility=0,s.visibility=0),r}static _CreateArrowInstance(e,t){const i=new Et.Y("arrow",e);for(const e of t.getChildMeshes())e.createInstance(e.name).parent=i;return i}_attachedNodeChanged(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)}set isEnabled(e){this._isEnabled=e,e?this._parent&&(this.attachedMesh=this._parent.attachedMesh,this.attachedNode=this._parent.attachedNode):(this.attachedMesh=null,this.attachedNode=null)}get isEnabled(){return this._isEnabled}dispose(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._gizmoMesh&&this._gizmoMesh.dispose(),[this._coloredMaterial,this._hoverMaterial,this._disableMaterial].forEach((e=>{e&&e.dispose()})),super.dispose()}}class Ki{constructor(e,t=1,i=2,n,r,s,l=1){if(this._scaleLinesFactor=4,this._instanced=!1,this.scene=null,this.scaleLines=1,e=e||m.l.LastCreatedScene){if(this.scaleLines=t,!n){const t=new Yt.K("",e);t.disableLighting=!0,t.emissiveColor=a.Wo.Red().scale(.5),n=qi._CreateArrow(e,t,l)}if(!r){const t=new Yt.K("",e);t.disableLighting=!0,t.emissiveColor=a.Wo.Green().scale(.5),r=qi._CreateArrow(e,t,l)}if(!s){const t=new Yt.K("",e);t.disableLighting=!0,t.emissiveColor=a.Wo.Blue().scale(.5),s=qi._CreateArrow(e,t,l)}this._xAxis=n,this._xAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._yAxis=r,this._yAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._zAxis=s,this._zAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),null!=i&&(Ki._SetRenderingGroupId(this._xAxis,i),Ki._SetRenderingGroupId(this._yAxis,i),Ki._SetRenderingGroupId(this._zAxis,i)),this.scene=e,this.update(new o.P,o.P.Right(),o.P.Up(),o.P.Forward())}}get xAxis(){return this._xAxis}get yAxis(){return this._yAxis}get zAxis(){return this._zAxis}update(e,t,i,n){this._xAxis.position.copyFrom(e),this._xAxis.setDirection(t),this._xAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._yAxis.position.copyFrom(e),this._yAxis.setDirection(i),this._yAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._zAxis.position.copyFrom(e),this._zAxis.setDirection(n),this._zAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor)}createInstance(){const e=qi._CreateArrowInstance(this.scene,this._xAxis),t=qi._CreateArrowInstance(this.scene,this._yAxis),i=qi._CreateArrowInstance(this.scene,this._zAxis),n=new Ki(this.scene,this.scaleLines,null,e,t,i);return n._instanced=!0,n}dispose(){this._xAxis&&this._xAxis.dispose(!1,!this._instanced),this._yAxis&&this._yAxis.dispose(!1,!this._instanced),this._zAxis&&this._zAxis.dispose(!1,!this._instanced),this.scene=null}static _SetRenderingGroupId(e,t){e.getChildMeshes().forEach((e=>{e.renderingGroupId=t}))}}Object.defineProperty(R.x.prototype,"debugLayer",{get:function(){return this._debugLayer||(this._debugLayer=new Zi(this)),this._debugLayer},enumerable:!0,configurable:!0}),function(e){e[e.Properties=0]="Properties",e[e.Debug=1]="Debug",e[e.Statistics=2]="Statistics",e[e.Tools=3]="Tools",e[e.Settings=4]="Settings"}(Xi||(Xi={}));class Zi{constructor(e){this.BJSINSPECTOR=this._getGlobalInspector(),this._scene=e||m.l.LastCreatedScene,this._scene&&this._scene.onDisposeObservable.add((()=>{this._scene._debugLayer&&this._scene._debugLayer.hide()}))}get onPropertyChangedObservable(){return this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector?this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable:(this._onPropertyChangedObservable||(this._onPropertyChangedObservable=new s.y$),this._onPropertyChangedObservable)}get onSelectionChangedObservable(){return this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector?this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable:(this._onSelectionChangedObservable||(this._onSelectionChangedObservable=new s.y$),this._onSelectionChangedObservable)}_createInspector(e){if(this.isVisible())return;if(this._onPropertyChangedObservable){for(const e of this._onPropertyChangedObservable.observers)this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(e);this._onPropertyChangedObservable.clear(),this._onPropertyChangedObservable=void 0}if(this._onSelectionChangedObservable){for(const e of this._onSelectionChangedObservable.observers)this.BJSINSPECTOR.Inspector.OnSelectionChangedObservable.add(e);this._onSelectionChangedObservable.clear(),this._onSelectionChangedObservable=void 0}const t={overlay:!1,showExplorer:!0,showInspector:!0,embedMode:!1,handleResize:!0,enablePopup:!0,...e};this.BJSINSPECTOR=this.BJSINSPECTOR||this._getGlobalInspector(),this.BJSINSPECTOR.Inspector.Show(this._scene,t)}select(e,t){this.BJSINSPECTOR&&(t&&("[object String]"==Object.prototype.toString.call(t)?this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(t):this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(t)),this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(e))}_getGlobalInspector(){return"undefined"!=typeof INSPECTOR?INSPECTOR:"undefined"!=typeof BABYLON&&void 0!==BABYLON.Inspector?BABYLON:void 0}isVisible(){return this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector.IsVisible}hide(){this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector.Hide()}setAsActiveScene(){this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector._SetNewScene(this._scene)}show(e){return new Promise((t=>{if(void 0===this.BJSINSPECTOR){const i=e&&e.inspectorURL?e.inspectorURL:Zi.InspectorURL;V.w1.LoadScript(i,(()=>{this._createInspector(e),t(this)}))}else this._createInspector(e),t(this)}))}}Zi.InspectorURL=`https://unpkg.com/babylonjs-inspector@${k.D.Version}/babylon.inspector.bundle.js`;var $i=i("../../../node_modules/@babylonjs/core/Meshes/Builders/boxBuilder.js");function Ji(e){const t=e.segments||32,i=e.diameterX||e.diameter||1,n=e.diameterY||e.diameter||1,r=e.diameterZ||e.diameter||1,s=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,a=e.slice&&e.slice<=0?1:e.slice||1,l=0===e.sideOrientation?0:e.sideOrientation||ci.x.DEFAULTSIDE,c=!!e.dedupTopBottomIndices,h=new o.P(i/2,n/2,r/2),_=2+t,d=2*_,u=[],p=[],f=[],m=[];for(let e=0;e<=_;e++){const t=e/_,i=t*Math.PI*a;for(let e=0;e<=d;e++){const n=e/d,r=n*Math.PI*2*s,a=o.y3.RotationZ(-i),l=o.y3.RotationY(r),c=o.P.TransformCoordinates(o.P.Up(),a),_=o.P.TransformCoordinates(c,l),u=_.multiply(h),g=_.divide(h).normalize();p.push(u.x,u.y,u.z),f.push(g.x,g.y,g.z),m.push(n,hi.e.UseOpenGLOrientationForUV?1-t:t)}if(e>0){const t=p.length/3;for(let i=t-2*(d+1);i+d+21&&(u.push(i),u.push(i+1),u.push(i+d+1)),(e<_||a<1)&&(u.push(i+d+1),u.push(i+1),u.push(i+d+2))):(u.push(i),u.push(i+1),u.push(i+d+1),u.push(i+d+1),u.push(i+1),u.push(i+d+2))}}ci.x._ComputeSides(l,p,u,f,m,e.frontUVs,e.backUVs);const g=new ci.x;return g.indices=u,g.positions=p,g.normals=f,g.uvs=m,g}function en(e,t={},i=null){const n=new je.Kj(e,i);return t.sideOrientation=je.Kj._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,Ji(t).applyToMesh(n,t.updatable),n}ci.x.CreateSphere=Ji,je.Kj.CreateSphere=(e,t,i,n,r,s)=>en(e,{segments:t,diameterX:i,diameterY:i,diameterZ:i,sideOrientation:s,updatable:r},n);var tn=i("../../../node_modules/@babylonjs/core/Physics/physicsImpostor.js");function nn(e={subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6}){const t=Math.max(e.subdivisions?e.subdivisions:2,1),i=Math.max(e.tessellation?e.tessellation:16,3),n=Math.max(e.height?e.height:1,0),r=Math.max(e.radius?e.radius:.25,0),s=Math.max(e.capSubdivisions?e.capSubdivisions:6,1),a=i,l=t,c=Math.max(e.radiusTop?e.radiusTop:r,0),h=Math.max(e.radiusBottom?e.radiusBottom:r,0),_=n-(c+h),d=2*Math.PI,u=Math.max(e.topCapSubdivisions?e.topCapSubdivisions:s,1),p=Math.max(e.bottomCapSubdivisions?e.bottomCapSubdivisions:s,1),f=Math.acos((h-c)/n);let m=[];const g=[],b=[],y=[];let v=0;const A=[],C=.5*_,S=.5*Math.PI;let x,T;const E=o.P.Zero(),R=o.P.Zero(),P=Math.cos(f),I=Math.sin(f),M=new o.FM(c*I,C+c*P).subtract(new o.FM(h*I,h*P-C)).length(),D=c*f+M+h*(S-f);let O=0;for(T=0;T<=u;T++){const e=[],t=S-f*(T/u);O+=c*f/u;const i=Math.cos(t),n=Math.sin(t),r=i*c;for(x=0;x<=a;x++){const t=x/a,s=t*d+0,o=Math.sin(s),l=Math.cos(s);R.x=r*o,R.y=C+n*c,R.z=r*l,g.push(R.x,R.y,R.z),E.set(i*o,n,i*l),b.push(E.x,E.y,E.z),y.push(t,hi.e.UseOpenGLOrientationForUV?O/D:1-O/D),e.push(v),v++}A.push(e)}const w=n-c-h+P*c-P*h,F=I*(h-c)/w;for(T=1;T<=l;T++){const e=[];O+=M/l;const t=I*(T*(h-c)/l+c);for(x=0;x<=a;x++){const i=x/a,n=i*d+0,r=Math.sin(n),s=Math.cos(n);R.x=t*r,R.y=C+P*c-T*w/l,R.z=t*s,g.push(R.x,R.y,R.z),E.set(r,F,s).normalize(),b.push(E.x,E.y,E.z),y.push(i,hi.e.UseOpenGLOrientationForUV?O/D:1-O/D),e.push(v),v++}A.push(e)}for(T=1;T<=p;T++){const e=[],t=S-f-(Math.PI-f)*(T/p);O+=h*f/p;const i=Math.cos(t),n=Math.sin(t),r=i*h;for(x=0;x<=a;x++){const t=x/a,s=t*d+0,o=Math.sin(s),l=Math.cos(s);R.x=r*o,R.y=n*h-C,R.z=r*l,g.push(R.x,R.y,R.z),E.set(i*o,n,i*l),b.push(E.x,E.y,E.z),y.push(t,hi.e.UseOpenGLOrientationForUV?O/D:1-O/D),e.push(v),v++}A.push(e)}for(x=0;xrn(e,t,i),ci.x.CreateCapsule=nn,je.Kj._instancedMeshFactory=(e,t)=>{const i=new sn(e,t);if(t.instancedBuffers){i.instancedBuffers={};for(const e in t.instancedBuffers)i.instancedBuffers[e]=t.instancedBuffers[e]}return i};class sn extends zi.x{constructor(e,t){super(e,t.getScene()),this._indexInSourceMeshInstanceArray=-1,this._distanceToCamera=0,t.addInstance(this),this._sourceMesh=t,this._unIndexed=t._unIndexed,this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scaling.copyFrom(t.scaling),t.rotationQuaternion&&(this.rotationQuaternion=t.rotationQuaternion.clone()),this.animations=t.animations.slice();for(const e of t.getAnimationRanges())null!=e&&this.createAnimationRange(e.name,e.from,e.to);this.infiniteDistance=t.infiniteDistance,this.setPivotMatrix(t.getPivotMatrix()),this.refreshBoundingInfo(!0,!0),this._syncSubMeshes()}getClassName(){return"InstancedMesh"}get lightSources(){return this._sourceMesh._lightSources}_resyncLightSources(){}_resyncLightSource(){}_removeLightSource(){}get receiveShadows(){return this._sourceMesh.receiveShadows}get material(){return this._sourceMesh.material}get visibility(){return this._sourceMesh.visibility}get skeleton(){return this._sourceMesh.skeleton}get renderingGroupId(){return this._sourceMesh.renderingGroupId}set renderingGroupId(e){this._sourceMesh&&e!==this._sourceMesh.renderingGroupId&&u.Y.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")}getTotalVertices(){return this._sourceMesh?this._sourceMesh.getTotalVertices():0}getTotalIndices(){return this._sourceMesh.getTotalIndices()}get sourceMesh(){return this._sourceMesh}createInstance(e){return this._sourceMesh.createInstance(e)}isReady(e=!1){return this._sourceMesh.isReady(e,!0)}getVerticesData(e,t){return this._sourceMesh.getVerticesData(e,t)}setVerticesData(e,t,i,n){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,i,n),this.sourceMesh}updateVerticesData(e,t,i,n){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,i,n),this.sourceMesh}setIndices(e,t=null){return this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh}isVerticesDataPresent(e){return this._sourceMesh.isVerticesDataPresent(e)}getIndices(){return this._sourceMesh.getIndices()}get _positions(){return this._sourceMesh._positions}refreshBoundingInfo(e=!1,t=!1){if(this.hasBoundingInfo&&this.getBoundingInfo().isLocked)return this;const i=this._sourceMesh.geometry?this._sourceMesh.geometry.boundingBias:null;return this._refreshBoundingInfo(this._sourceMesh._getPositionData(e,t),i),this}_preActivate(){return this._currentLOD&&this._currentLOD._preActivate(),this}_activate(e,t){if(super._activate(e,t),this._sourceMesh.subMeshes||u.Y.Warn("Instances should only be created for meshes with geometry."),this._currentLOD){if(this._currentLOD._getWorldMatrixDeterminant()>=0!=this._getWorldMatrixDeterminant()>=0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1}_postActivate(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)}getWorldMatrix(){if(this._currentLOD&&this._currentLOD.billboardMode!==Et.Y.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){this._billboardWorldMatrix||(this._billboardWorldMatrix=new o.y3);const e=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,o.jp.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(o.jp.Vector3[7]),this._currentLOD._masterMesh=e,this._billboardWorldMatrix}return super.getWorldMatrix()}get isAnInstance(){return!0}getLOD(e){if(!e)return this;const t=this.sourceMesh.getLODLevels();if(t&&0!==t.length){const t=this.getBoundingInfo();this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere)}else this._currentLOD=this.sourceMesh;return this._currentLOD}_preActivateForIntermediateRendering(e){return this.sourceMesh._preActivateForIntermediateRendering(e)}_syncSubMeshes(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(let e=0;e\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js");dt.v.ShadersStore.colorVertexShader="attribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}",je.Kj._LinesMeshParser=(e,t)=>ln.Parse(e,t);class ln extends je.Kj{constructor(e,t=null,i=null,n=null,r,s,o,l){super(e,t,i,n,r),this.useVertexColor=s,this.useVertexAlpha=o,this.color=new a.Wo(1,1,1),this.alpha=1,n&&(this.color=n.color.clone(),this.alpha=n.alpha,this.useVertexColor=n.useVertexColor,this.useVertexAlpha=n.useVertexAlpha),this.intersectionThreshold=.1;const c={attributes:[le.o.PositionKind],uniforms:["vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","world","viewProjection"],needAlphaBlending:!0,defines:[],useClipPlane:null};!1===o?c.needAlphaBlending=!1:c.defines.push("#define VERTEXALPHA"),s?(c.defines.push("#define VERTEXCOLOR"),c.attributes.push(le.o.ColorKind)):(c.uniforms.push("color"),this._color4=new a.HE),this.material=l||new an.j("colorShader",this.getScene(),"color",c,!1)}_isShaderMaterial(e){return"ShaderMaterial"===e.getClassName()}isReady(){return!!this._lineMaterial.isReady(this,!!this._userInstancedBuffersStorage)&&super.isReady()}getClassName(){return"LinesMesh"}get material(){return this._lineMaterial}set material(e){this._lineMaterial=e,this._lineMaterial.fillMode=on.F.LineListDrawMode}get checkCollisions(){return!1}set checkCollisions(e){}_bind(){if(!this._geometry)return this;const e=this._lineMaterial.getEffect(),t=this.isUnIndexed?null:this._geometry.getIndexBuffer();if(this._userInstancedBuffersStorage?this._geometry._bind(e,t,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects):this._geometry._bind(e,t),!this.useVertexColor&&this._isShaderMaterial(this._lineMaterial)){const{r:e,g:t,b:i}=this.color;this._color4.set(e,t,i,this.alpha),this._lineMaterial.setColor4("color",this._color4)}return this}_draw(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;const n=this.getScene().getEngine();return this._unIndexed?n.drawArraysType(on.F.LineListDrawMode,e.verticesStart,e.verticesCount,i):n.drawElementsType(on.F.LineListDrawMode,e.indexStart,e.indexCount,i),this}dispose(e){this._lineMaterial.dispose(!1,!1,!0),super.dispose(e)}clone(e,t=null,i){return new ln(e,this.getScene(),t,this,i)}createInstance(e){const t=new cn(e,this);if(this.instancedBuffers){t.instancedBuffers={};for(const e in this.instancedBuffers)t.instancedBuffers[e]=this.instancedBuffers[e]}return t}serialize(e){super.serialize(e),e.color=this.color.asArray(),e.alpha=this.alpha}static Parse(e,t){const i=new ln(e.name,t);return i.color=a.Wo.FromArray(e.color),i.alpha=e.alpha,i}}class cn extends sn{constructor(e,t){super(e,t),this.intersectionThreshold=t.intersectionThreshold}getClassName(){return"InstancedLinesMesh"}}function hn(e){const t=[],i=[],n=e.lines,r=e.colors,s=[];let o=0;for(let e=0;e0&&(t.push(o-1),t.push(o)),o++}}const a=new ci.x;return a.indices=t,a.positions=i,r&&(a.colors=s),a}function _n(e){const t=e.dashSize||3,i=e.gapSize||1,n=e.dashNb||200,r=e.points,s=new Array,a=new Array,l=o.P.Zero();let c=0,h=0,_=0,d=0,u=0,p=0,f=0;for(f=0;f{const t=o.P.Zero(),i=e.length/6;let s=0,a=0,l=0,c=0,h=0,_=0,d=0,u=0;for(d=0;dun(e,{points:t,updatable:n,instance:r},i),je.Kj.CreateDashedLines=(e,t,i,n,r,s=null,o,a)=>pn(e,{points:t,dashSize:i,gapSize:n,dashNb:r,updatable:o,instance:a},s);class fn{constructor(e){this.ray=e}static CreateAndShow(e,t,i){const n=new fn(e);return n.show(t,i),n}show(e,t){if(!this._renderFunction&&this.ray){const t=this.ray;this._renderFunction=this._render.bind(this),this._scene=e,this._renderPoints=[t.origin,t.origin.add(t.direction.scale(t.length))],this._renderLine=un("ray",{points:this._renderPoints,updatable:!0},e),this._renderLine.isPickable=!1,this._renderFunction&&this._scene.registerBeforeRender(this._renderFunction)}t&&this._renderLine&&this._renderLine.color.copyFrom(t)}hide(){this._renderFunction&&this._scene&&(this._scene.unregisterBeforeRender(this._renderFunction),this._scene=null,this._renderFunction=null,this._renderLine&&(this._renderLine.dispose(),this._renderLine=null),this._renderPoints=[])}_render(){var e;const t=this.ray;if(!t)return;const i=this._renderPoints[1],n=Math.min(t.length,1e6);i.copyFrom(t.direction),i.scaleInPlace(n),i.addInPlace(t.origin),this._renderPoints[0].copyFrom(t.origin),un("ray",{points:this._renderPoints,updatable:!0,instance:this._renderLine},this._scene),null===(e=this._renderLine)||void 0===e||e.refreshBoundingInfo()}attachToMesh(e,t,i,n){this._attachedToMesh=e;const r=this.ray;r&&(r.direction||(r.direction=o.P.Zero()),r.origin||(r.origin=o.P.Zero()),n&&(r.length=n),i||(i=o.P.Zero()),t||(t=new o.P(0,0,-1)),this._scene||(this._scene=e.getScene()),this._meshSpaceDirection?(this._meshSpaceDirection.copyFrom(t),this._meshSpaceOrigin.copyFrom(i)):(this._meshSpaceDirection=t.clone(),this._meshSpaceOrigin=i.clone()),this._onAfterRenderObserver||(this._onAfterRenderObserver=this._scene.onBeforeRenderObservable.add((()=>this._updateToMesh())),this._onAfterStepObserver=this._scene.onAfterStepObservable.add((()=>this._updateToMesh()))),this._attachedToMesh.computeWorldMatrix(!0),this._updateToMesh())}detachFromMesh(){this._attachedToMesh&&this._scene&&(this._onAfterRenderObserver&&(this._scene.onBeforeRenderObservable.remove(this._onAfterRenderObserver),this._scene.onAfterStepObservable.remove(this._onAfterStepObserver)),this._attachedToMesh=null,this._onAfterRenderObserver=null,this._onAfterStepObserver=null,this._scene=null)}_updateToMesh(){const e=this.ray;this._attachedToMesh&&e&&(this._attachedToMesh.isDisposed()?this.detachFromMesh():(this._attachedToMesh.getDirectionToRef(this._meshSpaceDirection,e.direction),o.P.TransformCoordinatesToRef(this._meshSpaceOrigin,this._attachedToMesh.getWorldMatrix(),e.origin)))}dispose(){this.hide(),this.detachFromMesh(),this.ray=null}}var mn=i("../../../node_modules/@babylonjs/core/Materials/effect.js");function gn(e){let t=e.pathArray;const i=e.closeArray||!1,n=e.closePath||!1,r=e.invertUV||!1,s=Math.floor(t[0].length/2);let o=e.offset||s;o=o>s?s:Math.floor(o);const a=0===e.sideOrientation?0:e.sideOrientation||ci.x.DEFAULTSIDE,l=e.uvs,c=e.colors,h=[],_=[],d=[],u=[],p=[],f=[],m=[],g=[];let b;const y=[],v=[];let A,C,S;if(t.length<2){const e=[],i=[];for(C=0;C0&&(P=E[S].subtract(E[S-1]).length(),I=P+m[A],p[A].push(I),m[A]=I),S++;n&&(S--,h.push(E[0].x,E[0].y,E[0].z),P=E[S].subtract(E[0]).length(),I=P+m[A],p[A].push(I),m[A]=I),y[A]=R+T,v[A]=x,x+=R+T}let O,w,F=null,B=null;for(C=0;C{let r=n[0].length;const s=l;let o=0;const a=s._originalBuilderSideOrientation===je.Kj.DOUBLESIDE?2:1;for(let l=1;l<=a;++l)for(let a=0;a1),o=t.rotationFunction||(()=>0),a=t.closePath||t.ribbonCloseArray||!1,l=t.closeShape||t.ribbonClosePath||!1,c=0===t.cap?0:t.cap||je.Kj.NO_CAP,h=t.updatable,_=t.firstNormal||null,d=t.adjustFrame||!1;return An(e,r,n,null,null,s,o,a,l,c,!0,i,!!h,je.Kj._GetDefaultSideOrientation(t.sideOrientation),t.instance||null,t.invertUV||!1,t.frontUVs||null,t.backUVs||null,_,d)}function An(e,t,i,n,r,s,a,l,c,h,_,d,u,p,f,m,g,b,y,v){const A=(e,t,i,n,r,s,a,l,c,h,_)=>{const d=i.getTangents(),u=i.getNormals(),p=i.getBinormals(),f=i.getDistances();if(_)for(let e=0;e0){let t=d[e-1];o.P.Dot(t,d[e])<0&&d[e].scaleInPlace(-1),t=u[e-1],o.P.Dot(t,u[e])<0&&u[e].scaleInPlace(-1),t=p[e-1],o.P.Dot(t,p[e])<0&&p[e].scaleInPlace(-1)}let m=0;const g=h&&l?l:()=>null!==s?s:0,b=h&&a?a:()=>null!==r?r:1;let y=c===je.Kj.NO_CAP||c===je.Kj.CAP_END?0:2;const v=o.jp.Matrix[0];for(let i=0;i{const t=Array(),i=o.P.Zero();let n;for(n=0;n3?0:h,_,v);const x=bn(e,{pathArray:S,closeArray:l,closePath:c,updatable:u,sideOrientation:p,invertUV:m,frontUVs:g||void 0,backUVs:b||void 0},d);return x._creationDataStorage.pathArray=S,x._creationDataStorage.path3D=C,x._creationDataStorage.cap=h,x}ci.x.CreateRibbon=gn,je.Kj.CreateRibbon=(e,t,i=!1,n,r,s,o=!1,a,l)=>bn(e,{pathArray:t,closeArray:i,closePath:n,offset:r,updatable:o,sideOrientation:a,instance:l},s),je.Kj.ExtrudeShape=(e,t,i,n,r,s,o=null,a,l,c)=>yn(e,{shape:t,path:i,scale:n,rotation:r,cap:0===s?0:s||je.Kj.NO_CAP,sideOrientation:l,instance:c,updatable:a},o),je.Kj.ExtrudeShapeCustom=(e,t,i,n,r,s,o,a,l,c,h,_)=>vn(e,{shape:t,path:i,scaleFunction:n,rotationFunction:r,ribbonCloseArray:s,ribbonClosePath:o,cap:0===a?0:a||je.Kj.NO_CAP,sideOrientation:h,instance:_,updatable:c},l);class Cn{constructor(e,t,i,n=!0,r=3,s={}){var o,l,c,h,_,d,u,p,f,m,g,b,y,v;this.skeleton=e,this.mesh=t,this.autoUpdateBonesMatrices=n,this.renderingGroupId=r,this.options=s,this.color=a.Wo.White(),this._debugLines=new Array,this._localAxes=null,this._isEnabled=!0,this._obs=null,this._scene=i,this._ready=!1,s.pauseAnimations=null===(o=s.pauseAnimations)||void 0===o||o,s.returnToRest=null!==(l=s.returnToRest)&&void 0!==l&&l,s.displayMode=null!==(c=s.displayMode)&&void 0!==c?c:Cn.DISPLAY_LINES,s.displayOptions=null!==(h=s.displayOptions)&&void 0!==h?h:{},s.displayOptions.midStep=null!==(_=s.displayOptions.midStep)&&void 0!==_?_:.235,s.displayOptions.midStepFactor=null!==(d=s.displayOptions.midStepFactor)&&void 0!==d?d:.155,s.displayOptions.sphereBaseSize=null!==(u=s.displayOptions.sphereBaseSize)&&void 0!==u?u:.15,s.displayOptions.sphereScaleUnit=null!==(p=s.displayOptions.sphereScaleUnit)&&void 0!==p?p:2,s.displayOptions.sphereFactor=null!==(f=s.displayOptions.sphereFactor)&&void 0!==f?f:.865,s.displayOptions.spurFollowsChild=null!==(m=s.displayOptions.spurFollowsChild)&&void 0!==m&&m,s.displayOptions.showLocalAxes=null!==(g=s.displayOptions.showLocalAxes)&&void 0!==g&&g,s.displayOptions.localAxesSize=null!==(b=s.displayOptions.localAxesSize)&&void 0!==b?b:.075,s.computeBonesUsingShaders=null===(y=s.computeBonesUsingShaders)||void 0===y||y,s.useAllBones=null===(v=s.useAllBones)||void 0===v||v;const A=t.getVerticesData(le.o.MatricesIndicesKind),C=t.getVerticesData(le.o.MatricesWeightsKind);if(this._boneIndices=new Set,!s.useAllBones&&A&&C)for(let e=0;eCn.DISPLAY_SPHERE_AND_SPURS&&(S=Cn.DISPLAY_LINES),this.displayMode=S,this.update(),this._bindObs()}static CreateBoneWeightShader(e,t){var i,n,r,s,o,l;const c=e.skeleton,h=null!==(i=e.colorBase)&&void 0!==i?i:a.Wo.Black(),_=null!==(n=e.colorZero)&&void 0!==n?n:a.Wo.Blue(),d=null!==(r=e.colorQuarter)&&void 0!==r?r:a.Wo.Green(),u=null!==(s=e.colorHalf)&&void 0!==s?s:a.Wo.Yellow(),p=null!==(o=e.colorFull)&&void 0!==o?o:a.Wo.Red(),f=null!==(l=e.targetBoneIndex)&&void 0!==l?l:0;mn.Q.ShadersStore["boneWeights:"+c.name+"VertexShader"]="precision highp float;\n\n attribute vec3 position;\n attribute vec2 uv;\n\n uniform mat4 view;\n uniform mat4 projection;\n uniform mat4 worldViewProjection;\n\n #include\n #if NUM_BONE_INFLUENCERS == 0\n attribute vec4 matricesIndices;\n attribute vec4 matricesWeights;\n #endif\n #include\n\n #include\n\n varying vec3 vColor;\n\n uniform vec3 colorBase;\n uniform vec3 colorZero;\n uniform vec3 colorQuarter;\n uniform vec3 colorHalf;\n uniform vec3 colorFull;\n\n uniform float targetBoneIndex;\n\n void main() {\n vec3 positionUpdated = position;\n\n #include\n #include\n #include\n\n vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);\n\n vec3 color = colorBase;\n float totalWeight = 0.;\n if(matricesIndices[0] == targetBoneIndex && matricesWeights[0] > 0.){\n totalWeight += matricesWeights[0];\n }\n if(matricesIndices[1] == targetBoneIndex && matricesWeights[1] > 0.){\n totalWeight += matricesWeights[1];\n }\n if(matricesIndices[2] == targetBoneIndex && matricesWeights[2] > 0.){\n totalWeight += matricesWeights[2];\n }\n if(matricesIndices[3] == targetBoneIndex && matricesWeights[3] > 0.){\n totalWeight += matricesWeights[3];\n }\n\n color = mix(color, colorZero, smoothstep(0., 0.25, totalWeight));\n color = mix(color, colorQuarter, smoothstep(0.25, 0.5, totalWeight));\n color = mix(color, colorHalf, smoothstep(0.5, 0.75, totalWeight));\n color = mix(color, colorFull, smoothstep(0.75, 1.0, totalWeight));\n vColor = color;\n\n gl_Position = projection * view * worldPos;\n }",mn.Q.ShadersStore["boneWeights:"+c.name+"FragmentShader"]="\n precision highp float;\n varying vec3 vPosition;\n\n varying vec3 vColor;\n\n void main() {\n vec4 color = vec4(vColor, 1.0);\n gl_FragColor = color;\n }\n ";const m=new an.j("boneWeight:"+c.name,t,{vertex:"boneWeights:"+c.name,fragment:"boneWeights:"+c.name},{attributes:["position","normal","matricesIndices","matricesWeights"],uniforms:["world","worldView","worldViewProjection","view","projection","viewProjection","colorBase","colorZero","colorQuarter","colorHalf","colorFull","targetBoneIndex"]});return m.setColor3("colorBase",h),m.setColor3("colorZero",_),m.setColor3("colorQuarter",d),m.setColor3("colorHalf",u),m.setColor3("colorFull",p),m.setFloat("targetBoneIndex",f),m.getClassName=()=>"BoneWeightShader",m.transparencyMode=on.F.MATERIAL_OPAQUE,m}static CreateSkeletonMapShader(e,t){var i;const n=e.skeleton,r=null!==(i=e.colorMap)&&void 0!==i?i:[{color:new a.Wo(1,.38,.18),location:0},{color:new a.Wo(.59,.18,1),location:.2},{color:new a.Wo(.59,1,.18),location:.4},{color:new a.Wo(1,.87,.17),location:.6},{color:new a.Wo(1,.17,.42),location:.8},{color:new a.Wo(.17,.68,1),location:1}],s=n.bones.length+1,o=Cn._CreateBoneMapColorBuffer(s,r,t),l=new an.j("boneWeights:"+n.name,t,{vertexSource:"precision highp float;\n\n attribute vec3 position;\n attribute vec2 uv;\n\n uniform mat4 view;\n uniform mat4 projection;\n uniform mat4 worldViewProjection;\n uniform float colorMap["+4*n.bones.length+"];\n\n #include\n #if NUM_BONE_INFLUENCERS == 0\n attribute vec4 matricesIndices;\n attribute vec4 matricesWeights;\n #endif\n #include\n #include\n\n varying vec3 vColor;\n\n void main() {\n vec3 positionUpdated = position;\n\n #include\n #include\n #include\n\n vec3 color = vec3(0.);\n bool first = true;\n\n for (int i = 0; i < 4; i++) {\n int boneIdx = int(matricesIndices[i]);\n float boneWgt = matricesWeights[i];\n\n vec3 c = vec3(colorMap[boneIdx * 4 + 0], colorMap[boneIdx * 4 + 1], colorMap[boneIdx * 4 + 2]);\n\n if (boneWgt > 0.) {\n if (first) {\n first = false;\n color = c;\n } else {\n color = mix(color, c, boneWgt);\n }\n }\n }\n\n vColor = color;\n\n vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);\n\n gl_Position = projection * view * worldPos;\n }",fragmentSource:"\n precision highp float;\n varying vec3 vColor;\n\n void main() {\n vec4 color = vec4( vColor, 1.0 );\n gl_FragColor = color;\n }\n "},{attributes:["position","normal","matricesIndices","matricesWeights"],uniforms:["world","worldView","worldViewProjection","view","projection","viewProjection","colorMap"]});return l.setFloats("colorMap",o),l.getClassName=()=>"SkeletonMapShader",l.transparencyMode=on.F.MATERIAL_OPAQUE,l}static _CreateBoneMapColorBuffer(e,t,i){const n=new Qt.c("temp",{width:e,height:1},i,!1),r=n.getContext(),s=r.createLinearGradient(0,0,e,0);t.forEach((e=>{s.addColorStop(e.location,e.color.toHexString())})),r.fillStyle=s,r.fillRect(0,0,e,1),n.update();const o=[],a=r.getImageData(0,0,e,1).data;for(let e=0;eCn.DISPLAY_SPHERE_AND_SPURS&&(e=Cn.DISPLAY_LINES),this.options.displayMode=e}_bindObs(){this.displayMode===Cn.DISPLAY_LINES&&(this._obs=this.scene.onBeforeRenderObservable.add((()=>{this._displayLinesUpdate()})))}update(){switch(this.displayMode){case Cn.DISPLAY_LINES:this._displayLinesUpdate();break;case Cn.DISPLAY_SPHERES:this._buildSpheresAndSpurs(!0);break;case Cn.DISPLAY_SPHERE_AND_SPURS:this._buildSpheresAndSpurs(!1)}this._buildLocalAxes()}set isEnabled(e){this.isEnabled!==e&&(this._isEnabled=e,this.debugMesh&&this.debugMesh.setEnabled(e),e&&!this._obs?this._bindObs():!e&&this._obs&&(this.scene.onBeforeRenderObservable.remove(this._obs),this._obs=null))}get isEnabled(){return this._isEnabled}_getBonePosition(e,t,i,n=0,r=0,s=0){const a=o.jp.Matrix[0],l=t.getParent();if(a.copyFrom(t.getLocalMatrix()),0!==n||0!==r||0!==s){const e=o.jp.Matrix[1];o.y3.IdentityToRef(e),e.setTranslationFromFloats(n,r,s),e.multiplyToRef(a,a)}l&&a.multiplyToRef(l.getAbsoluteTransform(),a),a.multiplyToRef(i,a),e.x=a.m[12],e.y=a.m[13],e.z=a.m[14]}_getLinesForBonesWithLength(e,t){const i=e.length,n=this.mesh.position;let r=0;for(let s=0;s=0;s--){const t=e[s],a=t.getParent();if(!a||!this._boneIndices.has(t.getIndex())&&!this.options.useAllBones)continue;let l=this._debugLines[i];l||(l=[o.P.Zero(),o.P.Zero()],this._debugLines[i]=l),t.getAbsolutePositionToRef(n,l[0]),a.getAbsolutePositionToRef(n,l[1]),l[0].subtractInPlace(r),l[1].subtractInPlace(r),i++}}_revert(e){this.options.pauseAnimations&&(this.scene.animationsEnabled=e,this.utilityLayer.utilityLayerScene.animationsEnabled=e)}_getAbsoluteBindPoseToRef(e,t){null!==e&&-1!==e._index?(this._getAbsoluteBindPoseToRef(e.getParent(),t),e.getBaseMatrix().multiplyToRef(t,t)):t.copyFrom(o.y3.Identity())}_buildSpheresAndSpurs(e=!0){var t,i;this._debugMesh&&(this._debugMesh.dispose(),this._debugMesh=null,this.ready=!1),this._ready=!1;const n=null===(t=this.utilityLayer)||void 0===t?void 0:t.utilityLayerScene,r=this.skeleton.bones,s=[],a=[],l=this.scene.animationsEnabled;try{this.options.pauseAnimations&&(this.scene.animationsEnabled=!1,n.animationsEnabled=!1),this.options.returnToRest&&this.skeleton.returnToRest(),this.autoUpdateBonesMatrices&&this.skeleton.computeAbsoluteTransforms();let t=Number.NEGATIVE_INFINITY;const c=this.options.displayOptions||{};for(let i=0;i{const r=new o.y3;i.getBaseMatrix().multiplyToRef(h,r);const s=new o.P;r.decompose(void 0,void 0,s);const d=o.P.Distance(_,s);if(d>t&&(t=d),e)return;const u=s.clone().subtract(_.clone()),p=u.length(),f=u.normalize().scale(p),m=c.midStep||.165,g=c.midStepFactor||.215,b=f.scale(m),y=vn("skeletonViewer",{shape:[new o.P(1,-1,0),new o.P(1,1,0),new o.P(-1,1,0),new o.P(-1,-1,0),new o.P(1,-1,0)],path:[o.P.Zero(),b,f],scaleFunction:e=>{switch(e){case 0:case 2:return 0;case 1:return p*g}return 0},sideOrientation:je.Kj.DEFAULTSIDE,updatable:!1},n),v=y.getTotalVertices(),A=[],C=[];for(let e=0;e9?C.push(i.getIndex(),0,0,0):C.push(l.getIndex(),0,0,0);y.position=_.clone(),y.setVerticesData(le.o.MatricesWeightsKind,A,!1),y.setVerticesData(le.o.MatricesIndicesKind,C,!1),y.convertToFlatShadedMesh(),a.push(y)}));const d=en("skeletonViewer",{segments:6,diameter:c.sphereBaseSize||.2,updatable:!0},n),u=d.getTotalVertices(),p=[],f=[];for(let e=0;e{this._gpuFrameTimeToken||(this._gpuFrameTimeToken=this.startTimeQuery())})),this._onEndFrameObserver=this.onEndFrameObservable.add((()=>{if(!this._gpuFrameTimeToken)return;const e=this.endTimeQuery(this._gpuFrameTimeToken);e>-1&&(this._gpuFrameTimeToken=null,this._gpuFrameTime.fetchNewFrame(),this._gpuFrameTime.addCount(e,!0))}))):(this.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null))},k.D.prototype._getGlAlgorithmType=function(e){return e===zi.x.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE?this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE:this._gl.ANY_SAMPLES_PASSED},Object.defineProperty(zi.x.prototype,"isOcclusionQueryInProgress",{get:function(){return this._occlusionDataStorage.isOcclusionQueryInProgress},set:function(e){this._occlusionDataStorage.isOcclusionQueryInProgress=e},enumerable:!1,configurable:!0}),Object.defineProperty(zi.x.prototype,"_occlusionDataStorage",{get:function(){return this.__occlusionDataStorage||(this.__occlusionDataStorage=new In),this.__occlusionDataStorage},enumerable:!1,configurable:!0}),Object.defineProperty(zi.x.prototype,"isOccluded",{get:function(){return this._occlusionDataStorage.isOccluded},set:function(e){this._occlusionDataStorage.isOccluded=e},enumerable:!0,configurable:!0}),Object.defineProperty(zi.x.prototype,"occlusionQueryAlgorithmType",{get:function(){return this._occlusionDataStorage.occlusionQueryAlgorithmType},set:function(e){this._occlusionDataStorage.occlusionQueryAlgorithmType=e},enumerable:!0,configurable:!0}),Object.defineProperty(zi.x.prototype,"occlusionType",{get:function(){return this._occlusionDataStorage.occlusionType},set:function(e){this._occlusionDataStorage.occlusionType=e},enumerable:!0,configurable:!0}),Object.defineProperty(zi.x.prototype,"occlusionRetryCount",{get:function(){return this._occlusionDataStorage.occlusionRetryCount},set:function(e){this._occlusionDataStorage.occlusionRetryCount=e},enumerable:!0,configurable:!0}),Object.defineProperty(zi.x.prototype,"forceRenderingWhenOccluded",{get:function(){return this._occlusionDataStorage.forceRenderingWhenOccluded},set:function(e){this._occlusionDataStorage.forceRenderingWhenOccluded=e},enumerable:!0,configurable:!0}),zi.x.prototype._checkOcclusionQuery=function(){const e=this._occlusionDataStorage;if(e.occlusionType===zi.x.OCCLUSION_TYPE_NONE)return e.isOccluded=!1,!1;const t=this.getEngine();if(!t.getCaps().supportOcclusionQuery)return e.isOccluded=!1,!1;if(!t.isQueryResultAvailable)return e.isOccluded=!1,!1;if(this.isOcclusionQueryInProgress&&this._occlusionQuery)if(t.isQueryResultAvailable(this._occlusionQuery)){const i=t.getQueryResult(this._occlusionQuery);e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=!(i>0)}else{if(e.occlusionInternalRetryCounter++,!(-1!==e.occlusionRetryCount&&e.occlusionInternalRetryCounter>e.occlusionRetryCount))return e.occlusionType!==zi.x.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded;e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=e.occlusionType!==zi.x.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded}const i=this.getScene();if(i.getBoundingBoxRenderer){const n=i.getBoundingBoxRenderer();null===this._occlusionQuery&&(this._occlusionQuery=t.createQuery()),t.beginOcclusionQuery(e.occlusionQueryAlgorithmType,this._occlusionQuery)&&(n.renderOcclusionBoundingBox(this),t.endOcclusionQuery(e.occlusionQueryAlgorithmType),this._occlusionDataStorage.isOcclusionQueryInProgress=!0)}return e.isOccluded},k.D.prototype.createTransformFeedback=function(){const e=this._gl.createTransformFeedback();if(!e)throw new Error("Unable to create Transform Feedback");return e},k.D.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},k.D.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},k.D.prototype.beginTransformFeedback=function(e=!0){this._gl.beginTransformFeedback(e?this._gl.POINTS:this._gl.TRIANGLES)},k.D.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},k.D.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},k.D.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e?e.underlyingResource:null)},i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.rawTexture.js"),i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicTexture.js"),Fi.B.prototype.createExternalTexture=function(e){return null},Fi.B.prototype.setExternalTexture=function(e,t){throw new Error("setExternalTexture: This engine does not support external textures!")},Fi.B.prototype.updateVideoTexture=function(e,t,i){if(!e||e._isDisabled)return;const n=this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0);this._unpackFlipY(!i);try{if(void 0===this._videoTextureSupported&&(this._gl.getError(),this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,t),0!==this._gl.getError()?this._videoTextureSupported=!1:this._videoTextureSupported=!0),this._videoTextureSupported)this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,t);else{if(!e._workingCanvas){e._workingCanvas=this.createCanvas(e.width,e.height);const t=e._workingCanvas.getContext("2d");if(!t)throw new Error("Unable to get 2d context");e._workingContext=t,e._workingCanvas.width=e.width,e._workingCanvas.height=e.height}e._workingContext.clearRect(0,0,e.width,e.height),e._workingContext.drawImage(t,0,0,t.videoWidth,t.videoHeight,0,0,e.width,e.height),this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,e._workingCanvas)}e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),n||this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0}catch(t){e._isDisabled=!0}},Fi.B.prototype.restoreSingleAttachment=function(){const e=this._gl;this.bindAttachments([e.BACK])},Fi.B.prototype.restoreSingleAttachmentForRenderTarget=function(){const e=this._gl;this.bindAttachments([e.COLOR_ATTACHMENT0])},Fi.B.prototype.buildTextureLayout=function(e){const t=this._gl,i=[];for(let n=0;n1?"COLOR_ATTACHMENT"+t:"COLOR_ATTACHMENT"+t+"_WEBGL"],n.readBuffer(r[t]),n.drawBuffers(r),n.blitFramebuffer(0,0,i.width,i.height,0,0,i.width,i.height,n.COLOR_BUFFER_BIT,n.NEAREST)}for(let e=0;e1?"COLOR_ATTACHMENT"+e:"COLOR_ATTACHMENT"+e+"_WEBGL"];n.drawBuffers(r)}for(let i=0;i1&&(13===t.depthTextureFormat||17===t.depthTextureFormat||16===t.depthTextureFormat||14===t.depthTextureFormat||18===t.depthTextureFormat)&&(a=t.depthTextureFormat));const p=this._gl,f=p.createFramebuffer();this._bindUnboundFramebuffer(f);const m=e.width||e,g=e.height||e,b=[],y=[],v=this.webGLVersion>1&&o&&(13===t.depthTextureFormat||17===t.depthTextureFormat||18===t.depthTextureFormat),A=this._setupFramebufferDepthAttachments(!v&&s,!o&&r,m,g);d._framebuffer=f,d._depthStencilBuffer=A,d._generateDepthBuffer=!o&&r,d._generateStencilBuffer=!v&&s,d._attachments=y;for(let e=0;e1||this.isWebGPU);const o=new Mt.l(this,Mt.S.MultiRenderTarget),a=p[this.webGLVersion>1?"COLOR_ATTACHMENT"+e:"COLOR_ATTACHMENT"+e+"_WEBGL"];b.push(o),y.push(a),p.activeTexture(p["TEXTURE"+e]),p.bindTexture(p.TEXTURE_2D,o._hardwareTexture.underlyingResource),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,s.mag),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,s.min),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE);const l=this._getRGBABufferInternalSizedFormat(i,5,r);p.texImage2D(p.TEXTURE_2D,0,l,m,g,0,p.RGBA,this._getWebGLTextureType(i),null),p.framebufferTexture2D(p.DRAW_FRAMEBUFFER,a,p.TEXTURE_2D,o._hardwareTexture.underlyingResource,0),n&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(p.TEXTURE_2D,null),o.baseWidth=m,o.baseHeight=g,o.width=m,o.height=g,o.isReady=!0,o.samples=1,o.generateMipMaps=n,o.samplingMode=t,o.type=i,o._useSRGBBuffer=r,this._internalTexturesCache.push(o)}if(o&&this._caps.depthTextureExtension){const e=new Mt.l(this,Mt.S.Depth);let t=5,i=p.DEPTH_COMPONENT16,r=p.DEPTH_COMPONENT,s=p.UNSIGNED_SHORT,o=p.DEPTH_ATTACHMENT;this.webGLVersion<2?i=p.DEPTH_COMPONENT:14===a?(t=1,s=p.FLOAT,i=p.DEPTH_COMPONENT32F):18===a?(t=0,s=p.FLOAT_32_UNSIGNED_INT_24_8_REV,i=p.DEPTH32F_STENCIL8,r=p.DEPTH_STENCIL,o=p.DEPTH_STENCIL_ATTACHMENT):16===a?(t=0,s=p.UNSIGNED_INT,i=p.DEPTH_COMPONENT24,o=p.DEPTH_ATTACHMENT):13!==a&&17!==a||(t=12,s=p.UNSIGNED_INT_24_8,i=p.DEPTH24_STENCIL8,r=p.DEPTH_STENCIL,o=p.DEPTH_STENCIL_ATTACHMENT),p.activeTexture(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,e._hardwareTexture.underlyingResource),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texImage2D(p.TEXTURE_2D,0,i,m,g,0,r,s,null),p.framebufferTexture2D(p.FRAMEBUFFER,o,p.TEXTURE_2D,e._hardwareTexture.underlyingResource,0),e.baseWidth=m,e.baseHeight=g,e.width=m,e.height=g,e.isReady=!0,e.samples=1,e.generateMipMaps=n,e.samplingMode=1,e.format=a,e.type=t,b.push(e),this._internalTexturesCache.push(e)}return d.setTextures(b),i&&p.drawBuffers(y),this._bindUnboundFramebuffer(null),this.resetTextureCache(),d},Fi.B.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t,i=!0){if(this.webGLVersion<2||!e||!e.texture)return 1;if(e.samples===t)return t;const n=e._attachments.length;if(0===n)return 1;const r=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples);const s=!!e._depthStencilBuffer;if(s&&(r.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(r.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),t>1&&r.renderbufferStorageMultisample){const s=r.createFramebuffer();if(!s)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=s,this._bindUnboundFramebuffer(s);const o=[];for(let i=0;i1?"COLOR_ATTACHMENT"+i:"COLOR_ATTACHMENT"+i+"_WEBGL"],l=s._MSAARenderBuffer?this._updateRenderBuffer(s._MSAARenderBuffer,n.width,n.height,t,-1,this._getRGBAMultiSampleBufferFormat(n.type),a):this._createRenderBuffer(n.width,n.height,t,-1,this._getRGBAMultiSampleBufferFormat(n.type),a);if(!l)throw new Error("Unable to create multi sampled framebuffer");s._MSAARenderBuffer=l,n.samples=t,o.push(a)}i&&r.drawBuffers(o)}else this._bindUnboundFramebuffer(e._framebuffer);return s&&(e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.texture.width,e.texture.height,t)),this._bindUnboundFramebuffer(null),t},i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.cubeTexture.js"),i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.js"),i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTargetCube.js"),Fi.B.prototype.setTextureSampler=function(e,t){throw new Error("setTextureSampler: This engine does not support separate texture sampler objects!")},i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.uniformBuffer.js"),i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicBuffer.js");const Mn=new s.y$,Dn=new s.y$;Object.defineProperty(k.D.prototype,"onBeforeViewRenderObservable",{get:function(){return Mn}}),Object.defineProperty(k.D.prototype,"onAfterViewRenderObservable",{get:function(){return Dn}}),Object.defineProperty(k.D.prototype,"inputElement",{get:function(){return this._inputElement},set:function(e){var t;this._inputElement!==e&&(this._inputElement=e,null===(t=this._onEngineViewChanged)||void 0===t||t.call(this))}}),k.D.prototype.getInputElement=function(){return this.inputElement||this.getRenderingCanvas()},k.D.prototype.registerView=function(e,t,i){this.views||(this.views=[]);for(const t of this.views)if(t.target===e)return t;const n=this.getRenderingCanvas();n&&(e.width=n.width,e.height=n.height);const r={target:e,camera:t,clearBeforeCopy:i,enabled:!0,id:(1e5*Math.random()).toFixed()};return this.views.push(r),t&&t.onDisposeObservable.add((()=>{this.unRegisterView(e)})),r},k.D.prototype.unRegisterView=function(e){if(!this.views)return this;for(const t of this.views)if(t.target===e){const e=this.views.indexOf(t);-1!==e&&this.views.splice(e,1);break}return this},k.D.prototype._renderViews=function(){if(!this.views)return!1;const e=this.getRenderingCanvas();if(!e)return!1;for(const t of this.views){if(!t.enabled)continue;const i=t.target,n=i.getContext("2d");if(!n)continue;Mn.notifyObservers(t);const r=t.camera;let s=null,o=null;if(r){if(o=r.getScene(),o.activeCameras&&o.activeCameras.length)continue;this.activeView=t,s=o.activeCamera,o.activeCamera=r}if(t.customResize)t.customResize(i);else{const t=Math.floor(i.clientWidth/this._hardwareScalingLevel),n=Math.floor(i.clientHeight/this._hardwareScalingLevel),r=t!==i.width||e.width!==i.width||n!==i.height||e.height!==i.height;i.clientWidth&&i.clientHeight&&r&&(i.width=t,i.height=n,this.setSize(t,n))}if(!e.width||!e.height)return!1;this._renderFrame(),this.flushFramebuffer(),t.clearBeforeCopy&&n.clearRect(0,0,e.width,e.height),n.drawImage(e,0,0),s&&o&&(o.activeCamera=s),Dn.notifyObservers(t)}return this.activeView=null,!0};var On=i("../../../node_modules/@babylonjs/core/Engines/Extensions/engine.readTexture.js");function wn(e){if(this._excludedCompressedTextures&&this._excludedCompressedTextures.some((t=>{const i="\\b"+t+"\\b";return e&&(e===t||e.match(new RegExp(i,"g")))})))return e;const t=e.lastIndexOf("."),i=e.lastIndexOf("?"),n=i>-1?e.substring(i,e.length):"";return(t>-1?e.substring(0,t):e)+this._textureFormatInUse+n}Fi.B.prototype.createStorageBuffer=function(e,t){throw new Error("createStorageBuffer: Unsupported method in this engine!")},Fi.B.prototype.updateStorageBuffer=function(e,t,i,n){},Fi.B.prototype.readFromStorageBuffer=function(e,t,i,n){throw new Error("readFromStorageBuffer: Unsupported method in this engine!")},Fi.B.prototype.setStorageBuffer=function(e,t){throw new Error("setStorageBuffer: Unsupported method in this engine!")},Object.defineProperty(k.D.prototype,"texturesSupported",{get:function(){const e=new Array;return this._caps.astc&&e.push("-astc.ktx"),this._caps.s3tc&&e.push("-dxt.ktx"),this._caps.pvrtc&&e.push("-pvrtc.ktx"),this._caps.etc2&&e.push("-etc2.ktx"),this._caps.etc1&&e.push("-etc1.ktx"),e},enumerable:!0,configurable:!0}),Object.defineProperty(k.D.prototype,"textureFormatInUse",{get:function(){return this._textureFormatInUse||null},enumerable:!0,configurable:!0}),k.D.prototype.setCompressedTextureExclusions=function(e){this._excludedCompressedTextures=e},k.D.prototype.setTextureFormatToUse=function(e){const t=this.texturesSupported;for(let i=0,n=t.length;i{this._flush()}))}writeUint32(e){this._flushIfNecessary(1),this._uint32s[this._position++]=e}writeInt32(e){this._flushIfNecessary(1),this._int32s[this._position++]=e}writeFloat32(e){this._flushIfNecessary(1),this._float32s[this._position++]=e}writeUint32Array(e){this._flushIfNecessary(1+e.length),this._uint32s[this._position++]=e.length,this._uint32s.set(e,this._position),this._position+=e.length}writeInt32Array(e){this._flushIfNecessary(1+e.length),this._uint32s[this._position++]=e.length,this._int32s.set(e,this._position),this._position+=e.length}writeFloat32Array(e){this._flushIfNecessary(1+e.length),this._uint32s[this._position++]=e.length,this._float32s.set(e,this._position),this._position+=e.length}writeNativeData(e){this._flushIfNecessary(e.length),this._uint32s.set(e,this._position),this._position+=e.length}writeBoolean(e){this.writeUint32(e?1:0)}_flushIfNecessary(e){this._position+e>this._length&&this._flush()}_flush(){this._nativeDataStream.writeBuffer(this._uint32s.buffer,this._position),this._position=0}}Fn.DEFAULT_BUFFER_SIZE=65536;var Bn=i("../../../node_modules/@babylonjs/core/Misc/environmentTextureTools.js");function Nn(e,t,i,n){let r=n,s=0,o="";for(;r=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||95==t}function Vn(e){let t=0,i="",n=!1;const r=[];for(;t=0&&e.charAt(t)!==i;)t--;return t}class Gn{constructor(e,t=20){this.debug=!1,this._sourceCode=e,this._numMaxIterations=t,this._functionDescr=[],this.inlineToken="#define inline"}get code(){return this._sourceCode}processCode(){this.debug&&console.log(`Start inlining process (code size=${this._sourceCode.length})...`),this._collectFunctions(),this._processInlining(this._numMaxIterations),this.debug&&console.log("End of inlining process.")}_collectFunctions(){let e=0;for(;e=0&&d.push(t.substring(i+1))}"void"!==r&&d.push("return"),this._functionDescr.push({name:s,type:r,parameters:d,body:h,callIndex:0}),e=c+1;const u=t>0?this._sourceCode.substring(0,t):"",p=c+1=0&&this._replaceFunctionCallsByCode(););return this.debug&&console.log(`numMaxIterations is ${e} after inlining process`),e>=0}_replaceFunctionCallsByCode(){let e=!1;for(const t of this._functionDescr){const{name:i,type:n,parameters:r,body:s}=t;let o=0;for(;o{const t=[];let i=0,n=0;for(;i0?this._sourceCode.substring(0,a):"";const g=c+1{const a=r[0];return kn(e.charAt(a-1))||kn(e.charAt(a+s))?t[n]:o}))}return e}}Gn._RegexpFindFunctionNameAndType=/((\s+?)(\w+)\s+(\w+)\s*?)$/;var jn=i("../../../node_modules/@babylonjs/core/Engines/WebGL/webGL2ShaderProcessors.js"),Wn=i("../../../node_modules/@babylonjs/core/Misc/error.js");const zn=new s.y$;if("undefined"!=typeof self&&!Object.prototype.hasOwnProperty.call(self,"_native")){let e;Object.defineProperty(self,"_native",{get:()=>e,set:t=>{e=t,e&&zn.notifyObservers(e)}})}class Hn{constructor(e){this.isAsync=!1,this.isReady=!1,this._valueCache={},this.engine=e}_getVertexShaderCode(){return null}_getFragmentShaderCode(){return null}_handlesSpectorRebuildCallback(e){throw new Error("Not implemented")}_fillEffectInformation(e,t,i,n,r,s,o,a){const l=this.engine;if(l.supportsUniformBuffers)for(const i in t)e.bindUniformBlock(i,t[i]);let c;for(this.engine.getUniforms(this,i).forEach(((e,t)=>{n[i[t]]=e})),this._uniforms=n,c=0;c{s[e]=t})),a.push(...l.getAttributes(this,o))}dispose(){this._uniforms={}}_cacheMatrix(e,t){const i=this._valueCache[e],n=t.updateFlag;return(void 0===i||i!==n)&&(this._valueCache[e]=n,!0)}_cacheFloat2(e,t,i){let n=this._valueCache[e];if(!n)return n=[t,i],this._valueCache[e]=n,!0;let r=!1;return n[0]!==t&&(n[0]=t,r=!0),n[1]!==i&&(n[1]=i,r=!0),r}_cacheFloat3(e,t,i,n){let r=this._valueCache[e];if(!r)return r=[t,i,n],this._valueCache[e]=r,!0;let s=!1;return r[0]!==t&&(r[0]=t,s=!0),r[1]!==i&&(r[1]=i,s=!0),r[2]!==n&&(r[2]=n,s=!0),s}_cacheFloat4(e,t,i,n,r){let s=this._valueCache[e];if(!s)return s=[t,i,n,r],this._valueCache[e]=s,!0;let o=!1;return s[0]!==t&&(s[0]=t,o=!0),s[1]!==i&&(s[1]=i,o=!0),s[2]!==n&&(s[2]=n,o=!0),s[3]!==r&&(s[3]=r,o=!0),o}setInt(e,t){const i=this._valueCache[e];void 0!==i&&i===t||this.engine.setInt(this._uniforms[e],t)&&(this._valueCache[e]=t)}setInt2(e,t,i){this._cacheFloat2(e,t,i)&&(this.engine.setInt2(this._uniforms[e],t,i)||(this._valueCache[e]=null))}setInt3(e,t,i,n){this._cacheFloat3(e,t,i,n)&&(this.engine.setInt3(this._uniforms[e],t,i,n)||(this._valueCache[e]=null))}setInt4(e,t,i,n,r){this._cacheFloat4(e,t,i,n,r)&&(this.engine.setInt4(this._uniforms[e],t,i,n,r)||(this._valueCache[e]=null))}setIntArray(e,t){this._valueCache[e]=null,this.engine.setIntArray(this._uniforms[e],t)}setIntArray2(e,t){this._valueCache[e]=null,this.engine.setIntArray2(this._uniforms[e],t)}setIntArray3(e,t){this._valueCache[e]=null,this.engine.setIntArray3(this._uniforms[e],t)}setIntArray4(e,t){this._valueCache[e]=null,this.engine.setIntArray4(this._uniforms[e],t)}setFloatArray(e,t){this._valueCache[e]=null,this.engine.setFloatArray(this._uniforms[e],t)}setFloatArray2(e,t){this._valueCache[e]=null,this.engine.setFloatArray2(this._uniforms[e],t)}setFloatArray3(e,t){this._valueCache[e]=null,this.engine.setFloatArray3(this._uniforms[e],t)}setFloatArray4(e,t){this._valueCache[e]=null,this.engine.setFloatArray4(this._uniforms[e],t)}setArray(e,t){this._valueCache[e]=null,this.engine.setArray(this._uniforms[e],t)}setArray2(e,t){this._valueCache[e]=null,this.engine.setArray2(this._uniforms[e],t)}setArray3(e,t){this._valueCache[e]=null,this.engine.setArray3(this._uniforms[e],t)}setArray4(e,t){this._valueCache[e]=null,this.engine.setArray4(this._uniforms[e],t)}setMatrices(e,t){t&&(this._valueCache[e]=null,this.engine.setMatrices(this._uniforms[e],t))}setMatrix(e,t){this._cacheMatrix(e,t)&&(this.engine.setMatrices(this._uniforms[e],t.toArray())||(this._valueCache[e]=null))}setMatrix3x3(e,t){this._valueCache[e]=null,this.engine.setMatrix3x3(this._uniforms[e],t)}setMatrix2x2(e,t){this._valueCache[e]=null,this.engine.setMatrix2x2(this._uniforms[e],t)}setFloat(e,t){const i=this._valueCache[e];void 0!==i&&i===t||this.engine.setFloat(this._uniforms[e],t)&&(this._valueCache[e]=t)}setBool(e,t){const i=this._valueCache[e];void 0!==i&&i===t||this.engine.setInt(this._uniforms[e],t?1:0)&&(this._valueCache[e]=t?1:0)}setVector2(e,t){this._cacheFloat2(e,t.x,t.y)&&(this.engine.setFloat2(this._uniforms[e],t.x,t.y)||(this._valueCache[e]=null))}setFloat2(e,t,i){this._cacheFloat2(e,t,i)&&(this.engine.setFloat2(this._uniforms[e],t,i)||(this._valueCache[e]=null))}setVector3(e,t){this._cacheFloat3(e,t.x,t.y,t.z)&&(this.engine.setFloat3(this._uniforms[e],t.x,t.y,t.z)||(this._valueCache[e]=null))}setFloat3(e,t,i,n){this._cacheFloat3(e,t,i,n)&&(this.engine.setFloat3(this._uniforms[e],t,i,n)||(this._valueCache[e]=null))}setVector4(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&(this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)||(this._valueCache[e]=null))}setQuaternion(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&(this.engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)||(this._valueCache[e]=null))}setFloat4(e,t,i,n,r){this._cacheFloat4(e,t,i,n,r)&&(this.engine.setFloat4(this._uniforms[e],t,i,n,r)||(this._valueCache[e]=null))}setColor3(e,t){this._cacheFloat3(e,t.r,t.g,t.b)&&(this.engine.setFloat3(this._uniforms[e],t.r,t.g,t.b)||(this._valueCache[e]=null))}setColor4(e,t,i){this._cacheFloat4(e,t.r,t.g,t.b,i)&&(this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,i)||(this._valueCache[e]=null))}setDirectColor4(e,t){this._cacheFloat4(e,t.r,t.g,t.b,t.a)&&(this.engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,t.a)||(this._valueCache[e]=null))}}class Xn extends En.r{constructor(e,t,i,n){super(e,t,i,n),this.__framebuffer=null,this.__framebufferDepthStencil=null,this._engine=n}get _framebuffer(){return this.__framebuffer}set _framebuffer(e){this.__framebuffer&&this._engine._releaseFramebufferObjects(this.__framebuffer),this.__framebuffer=e}get _framebufferDepthStencil(){return this.__framebufferDepthStencil}set _framebufferDepthStencil(e){this.__framebufferDepthStencil&&this._engine._releaseFramebufferObjects(this.__framebufferDepthStencil),this.__framebufferDepthStencil=e}dispose(e=!1){this._framebuffer=null,this._framebufferDepthStencil=null,super.dispose(e)}}class Yn extends ce.h{}class Qn{constructor(e){this._engine=e,this._pending=new Array,this._isCommandBufferScopeActive=!1,this._commandStream=qn._createNativeDataStream(),this._engine.setCommandDataStream(this._commandStream)}beginCommandScope(){if(this._isCommandBufferScopeActive)throw new Error("Command scope already active.");this._isCommandBufferScopeActive=!0}endCommandScope(){if(!this._isCommandBufferScopeActive)throw new Error("Command scope is not active.");this._isCommandBufferScopeActive=!1,this._submit()}startEncodingCommand(e){this._commandStream.writeNativeData(e)}encodeCommandArgAsUInt32(e){this._commandStream.writeUint32(e)}encodeCommandArgAsUInt32s(e){this._commandStream.writeUint32Array(e)}encodeCommandArgAsInt32(e){this._commandStream.writeInt32(e)}encodeCommandArgAsInt32s(e){this._commandStream.writeInt32Array(e)}encodeCommandArgAsFloat32(e){this._commandStream.writeFloat32(e)}encodeCommandArgAsFloat32s(e){this._commandStream.writeFloat32Array(e)}encodeCommandArgAsNativeData(e){this._commandStream.writeNativeData(e),this._pending.push(e)}finishEncodingCommand(){this._isCommandBufferScopeActive||this._submit()}_submit(){this._engine.submitCommands(),this._pending.length=0}}class qn extends k.D{constructor(e={}){if(super(null,!1,void 0,e.adaptToDeviceRatio),this._engine=new _native.Engine,this._camera=_native.Camera?new _native.Camera:null,this._commandBufferEncoder=new Qn(this._engine),this._boundBuffersVertexArray=null,this._currentDepthTest=_native.Engine.DEPTH_TEST_LEQUAL,this._stencilTest=!1,this._stencilMask=255,this._stencilFunc=519,this._stencilFuncRef=0,this._stencilFuncMask=255,this._stencilOpStencilFail=7680,this._stencilOpDepthFail=7680,this._stencilOpStencilDepthPass=7681,this._zOffset=0,this._zOffsetUnits=0,this._depthWrite=!0,_native.Engine.PROTOCOL_VERSION!==qn.PROTOCOL_VERSION)throw new Error(`Protocol version mismatch: ${_native.Engine.PROTOCOL_VERSION} (Native) !== ${qn.PROTOCOL_VERSION} (JS)`);this._webGLVersion=2,this.disableUniformBuffers=!0,this._caps={maxTexturesImageUnits:16,maxVertexTextureImageUnits:16,maxCombinedTexturesImageUnits:32,maxTextureSize:_native.Engine.CAPS_LIMITS_MAX_TEXTURE_SIZE,maxCubemapTextureSize:512,maxRenderTextureSize:512,maxVertexAttribs:16,maxVaryingVectors:16,maxFragmentUniformVectors:16,maxVertexUniformVectors:16,standardDerivatives:!0,astc:null,pvrtc:null,etc1:null,etc2:null,bptc:null,maxAnisotropy:16,uintIndices:!0,fragmentDepthSupported:!1,highPrecisionShaderSupported:!0,colorBufferFloat:!1,textureFloat:!0,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloat:!1,textureHalfFloatLinearFiltering:!1,textureHalfFloatRender:!1,textureLOD:!0,drawBuffersExtension:!1,depthTextureExtension:!1,vertexArrayObject:!0,instancedArrays:!0,supportOcclusionQuery:!1,canUseTimestampForTimerQuery:!1,blendMinMax:!1,maxMSAASamples:1,canUseGLInstanceID:!0,canUseGLVertexID:!0,supportComputeShaders:!1,supportSRGBBuffers:!0,supportTransformFeedbacks:!1,textureMaxLevel:!1,texture2DArrayMaxLayerCount:_native.Engine.CAPS_LIMITS_MAX_TEXTURE_LAYERS},this._features={forceBitmapOverHTMLImageElement:!1,supportRenderAndCopyToLodForFloatTextures:!1,supportDepthStencilTexture:!1,supportShadowSamplers:!1,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:!1,trackUbosInFrame:!1,checkUbosContentBeforeUpload:!1,supportCSM:!1,basisNeedsPOT:!1,support3DTextures:!1,needTypeSuffixInShaderConstants:!1,supportMSAA:!1,supportSSAO2:!1,supportExtendedTextureFormats:!1,supportSwitchCaseInShader:!1,supportSyncTextureRead:!1,needsInvertingBitmap:!0,useUBOBindingCache:!0,needShaderCodeInlining:!0,needToAlwaysBindUniformBuffers:!1,supportRenderPasses:!0,supportSpriteInstancing:!1,_collectUbosUpdatedInFrame:!1},V.w1.Log("Babylon Native (v"+k.D.Version+") launched"),V.w1.LoadScript=function(e,t,i,n){V.w1.LoadFile(e,(e=>{Function(e).apply(null),t&&t()}),void 0,void 0,!1,((e,t)=>{i&&i("LoadScript Error",t)}))},"undefined"==typeof URL&&(window.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(window.Blob=function(e){return e});const t=window&&window.devicePixelRatio||1;this._hardwareScalingLevel=e.adaptToDeviceRatio?t:1,this.resize();const i=this.getDepthFunction();i&&this.setDepthFunction(i),this._shaderProcessor=new jn.C,this.onNewSceneAddedObservable.add((e=>{const t=e.render;e.render=(...i)=>{this._commandBufferEncoder.beginCommandScope(),t.apply(e,i),this._commandBufferEncoder.endCommandScope()}}))}getHardwareScalingLevel(){return this._engine.getHardwareScalingLevel()}setHardwareScalingLevel(e){this._engine.setHardwareScalingLevel(e)}dispose(){super.dispose(),this._boundBuffersVertexArray&&this._deleteVertexArray(this._boundBuffersVertexArray),this._engine.dispose()}static _createNativeDataStream(){return new Fn}_queueNewFrame(e,t){return t.requestAnimationFrame&&t!==window?t.requestAnimationFrame(e):this._engine.requestAnimationFrame(e),0}_bindUnboundFramebuffer(e){this._currentFramebuffer!==e&&(this._currentFramebuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_UNBINDFRAMEBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(this._currentFramebuffer),this._commandBufferEncoder.finishEncodingCommand()),e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_BINDFRAMEBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()),this._currentFramebuffer=e)}getHostDocument(){return null}clear(e,t,i,n=!1){if(this.useReverseDepthBuffer)throw new Error("reverse depth buffer is not currently implemented");this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_CLEAR),this._commandBufferEncoder.encodeCommandArgAsUInt32(t&&e?1:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(e?e.r:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(e?e.g:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(e?e.b:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(e?e.a:1),this._commandBufferEncoder.encodeCommandArgAsUInt32(i?1:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(1),this._commandBufferEncoder.encodeCommandArgAsUInt32(n?1:0),this._commandBufferEncoder.encodeCommandArgAsUInt32(0),this._commandBufferEncoder.finishEncodingCommand()}createIndexBuffer(e,t){const i=this._normalizeIndexData(e),n=new Yn;return n.references=1,n.is32Bits=4===i.BYTES_PER_ELEMENT,i.byteLength&&(n.nativeIndexBuffer=this._engine.createIndexBuffer(i.buffer,i.byteOffset,i.byteLength,n.is32Bits,null!=t&&t)),n}createVertexBuffer(e,t){const i=ArrayBuffer.isView(e)?e:new Float32Array(e),n=new Yn;return n.references=1,i.byteLength&&(n.nativeVertexBuffer=this._engine.createVertexBuffer(i.buffer,i.byteOffset,i.byteLength,null!=t&&t)),n}_recordVertexArrayObject(e,t,i,n,r){i&&this._engine.recordIndexBuffer(e,i.nativeIndexBuffer);const s=n.getAttributesNames();for(let i=0;i=0){const n=s[i];let a=null;if(r&&(a=r[n]),a||(a=t[n]),a){const t=a.getBuffer();t&&t.nativeVertexBuffer&&this._engine.recordVertexBuffer(e,t.nativeVertexBuffer,o,a.byteOffset,a.byteStride,a.getSize(),this._getNativeAttribType(a.type),a.normalized,a.getInstanceDivisor())}}}}bindBuffers(e,t,i){this._boundBuffersVertexArray&&this._deleteVertexArray(this._boundBuffersVertexArray),this._boundBuffersVertexArray=this._engine.createVertexArray(),this._recordVertexArrayObject(this._boundBuffersVertexArray,e,t,i),this.bindVertexArrayObject(this._boundBuffersVertexArray)}recordVertexArrayObject(e,t,i,n){const r=this._engine.createVertexArray();return this._recordVertexArrayObject(r,e,t,i,n),r}_deleteVertexArray(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEVERTEXARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()}bindVertexArrayObject(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_BINDVERTEXARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()}releaseVertexArrayObject(e){this._deleteVertexArray(e)}getAttributes(e,t){const i=e;return this._engine.getAttributes(i.nativeProgram,t)}drawElementsType(e,t,i,n){this._drawCalls.addCount(1,!1),this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DRAWINDEXED),this._commandBufferEncoder.encodeCommandArgAsUInt32(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand()}drawArraysType(e,t,i,n){this._drawCalls.addCount(1,!1),this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DRAW),this._commandBufferEncoder.encodeCommandArgAsUInt32(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand()}createPipelineContext(){return new Hn(this)}createMaterialContext(){}createDrawContext(){}_preparePipelineContext(e,t,i,n,r,s,o,a,l){e.nativeProgram=n?this.createRawShaderProgram(e,t,i,void 0,l):this.createShaderProgram(e,t,i,a,void 0,l)}_isRenderingStateCompiled(e){return!0}_executeWhenRenderingStateIsCompiled(e,t){t()}createRawShaderProgram(e,t,i,n,r=null){throw new Error("Not Supported")}createShaderProgram(e,t,i,n,r,s=null){this.onBeforeShaderCompilationObservable.notifyObservers(this);const o=new Gn(t);o.processCode(),t=o.code;const a=new Gn(i);a.processCode(),i=a.code,t=Fi.B._ConcatenateShader(t,n),i=Fi.B._ConcatenateShader(i,n);const l=this._engine.createProgram(t,i);return this.onAfterShaderCompilationObservable.notifyObservers(this),l}inlineShaderCode(e){const t=new Gn(e);return t.debug=!1,t.processCode(),t.code}_setProgram(e){this._currentProgram!==e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETPROGRAM),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand(),this._currentProgram=e)}_deletePipelineContext(e){const t=e;t&&t.nativeProgram&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEPROGRAM),this._commandBufferEncoder.encodeCommandArgAsNativeData(t.nativeProgram),this._commandBufferEncoder.finishEncodingCommand())}getUniforms(e,t){const i=e;return this._engine.getUniforms(i.nativeProgram,t)}bindUniformBlock(e,t,i){throw new Error("Not Implemented")}bindSamplers(e){const t=e.getPipelineContext();this._setProgram(t.nativeProgram);const i=e.getSamplers();for(let t=0;t{}}}setZOffset(e){e!==this._zOffset&&(this._zOffset=e,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETZOFFSET),this._commandBufferEncoder.encodeCommandArgAsFloat32(this.useReverseDepthBuffer?-e:e),this._commandBufferEncoder.finishEncodingCommand())}getZOffset(){return this._zOffset}setZOffsetUnits(e){e!==this._zOffsetUnits&&(this._zOffsetUnits=e,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETZOFFSETUNITS),this._commandBufferEncoder.encodeCommandArgAsFloat32(this.useReverseDepthBuffer?-e:e),this._commandBufferEncoder.finishEncodingCommand())}getZOffsetUnits(){return this._zOffsetUnits}setDepthBuffer(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETDEPTHTEST),this._commandBufferEncoder.encodeCommandArgAsUInt32(e?this._currentDepthTest:_native.Engine.DEPTH_TEST_ALWAYS),this._commandBufferEncoder.finishEncodingCommand()}getDepthWrite(){return this._depthWrite}getDepthFunction(){switch(this._currentDepthTest){case _native.Engine.DEPTH_TEST_NEVER:return 512;case _native.Engine.DEPTH_TEST_ALWAYS:return 519;case _native.Engine.DEPTH_TEST_GREATER:return 516;case _native.Engine.DEPTH_TEST_GEQUAL:return 518;case _native.Engine.DEPTH_TEST_NOTEQUAL:return 517;case _native.Engine.DEPTH_TEST_EQUAL:return 514;case _native.Engine.DEPTH_TEST_LESS:return 513;case _native.Engine.DEPTH_TEST_LEQUAL:return 515}return null}setDepthFunction(e){let t=0;switch(e){case 512:t=_native.Engine.DEPTH_TEST_NEVER;break;case 519:t=_native.Engine.DEPTH_TEST_ALWAYS;break;case 516:t=_native.Engine.DEPTH_TEST_GREATER;break;case 518:t=_native.Engine.DEPTH_TEST_GEQUAL;break;case 517:t=_native.Engine.DEPTH_TEST_NOTEQUAL;break;case 514:t=_native.Engine.DEPTH_TEST_EQUAL;break;case 513:t=_native.Engine.DEPTH_TEST_LESS;break;case 515:t=_native.Engine.DEPTH_TEST_LEQUAL}this._currentDepthTest=t,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETDEPTHTEST),this._commandBufferEncoder.encodeCommandArgAsUInt32(this._currentDepthTest),this._commandBufferEncoder.finishEncodingCommand()}setDepthWrite(e){this._depthWrite=e,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETDEPTHWRITE),this._commandBufferEncoder.encodeCommandArgAsUInt32(Number(e)),this._commandBufferEncoder.finishEncodingCommand()}setColorWrite(e){this._colorWrite=e,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETCOLORWRITE),this._commandBufferEncoder.encodeCommandArgAsUInt32(Number(e)),this._commandBufferEncoder.finishEncodingCommand()}getColorWrite(){return this._colorWrite}applyStencil(){this._setStencil(this._stencilMask,this._getStencilOpFail(this._stencilOpStencilFail),this._getStencilDepthFail(this._stencilOpDepthFail),this._getStencilDepthPass(this._stencilOpStencilDepthPass),this._getStencilFunc(this._stencilFunc),this._stencilFuncRef)}_setStencil(e,t,i,n,r,s){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETSTENCIL),this._commandBufferEncoder.encodeCommandArgAsUInt32(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.encodeCommandArgAsUInt32(n),this._commandBufferEncoder.encodeCommandArgAsUInt32(r),this._commandBufferEncoder.encodeCommandArgAsUInt32(s),this._commandBufferEncoder.finishEncodingCommand()}setStencilBuffer(e){this._stencilTest=e,e?this.applyStencil():this._setStencil(255,_native.Engine.STENCIL_OP_FAIL_S_KEEP,_native.Engine.STENCIL_OP_FAIL_Z_KEEP,_native.Engine.STENCIL_OP_PASS_Z_KEEP,_native.Engine.STENCIL_TEST_ALWAYS,0)}getStencilBuffer(){return this._stencilTest}getStencilOperationPass(){return this._stencilOpStencilDepthPass}setStencilOperationPass(e){this._stencilOpStencilDepthPass=e,this.applyStencil()}setStencilMask(e){this._stencilMask=e,this.applyStencil()}setStencilFunction(e){this._stencilFunc=e,this.applyStencil()}setStencilFunctionReference(e){this._stencilFuncRef=e,this.applyStencil()}setStencilFunctionMask(e){this._stencilFuncMask=e}setStencilOperationFail(e){this._stencilOpStencilFail=e,this.applyStencil()}setStencilOperationDepthFail(e){this._stencilOpDepthFail=e,this.applyStencil()}getStencilMask(){return this._stencilMask}getStencilFunction(){return this._stencilFunc}getStencilFunctionReference(){return this._stencilFuncRef}getStencilFunctionMask(){return this._stencilFuncMask}getStencilOperationFail(){return this._stencilOpStencilFail}getStencilOperationDepthFail(){return this._stencilOpDepthFail}setAlphaConstants(e,t,i,n){throw new Error("Setting alpha blend constant color not yet implemented.")}setAlphaMode(e,t=!1){if(this._alphaMode===e)return;const i=this._getNativeAlphaMode(e);this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETBLENDMODE),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand(),t||this.setDepthWrite(0===e),this._alphaMode=e}getAlphaMode(){return this._alphaMode}setInt(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINT),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setIntArray(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINTARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setIntArray2(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINTARRAY2),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setIntArray3(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINTARRAY3),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setIntArray4(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINTARRAY4),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setFloatArray(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOATARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setFloatArray2(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOATARRAY2),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setFloatArray3(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOATARRAY3),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setFloatArray4(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOATARRAY4),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setArray(e,t){return!!e&&this.setFloatArray(e,new Float32Array(t))}setArray2(e,t){return!!e&&this.setFloatArray2(e,new Float32Array(t))}setArray3(e,t){return!!e&&this.setFloatArray3(e,new Float32Array(t))}setArray4(e,t){return!!e&&this.setFloatArray4(e,new Float32Array(t))}setMatrices(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETMATRICES),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setMatrix3x3(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETMATRIX3X3),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setMatrix2x2(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETMATRIX2X2),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setFloat(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOAT),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32(t),this._commandBufferEncoder.finishEncodingCommand(),!0)}setFloat2(e,t,i){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOAT2),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32(t),this._commandBufferEncoder.encodeCommandArgAsFloat32(i),this._commandBufferEncoder.finishEncodingCommand(),!0)}setFloat3(e,t,i,n){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOAT3),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32(t),this._commandBufferEncoder.encodeCommandArgAsFloat32(i),this._commandBufferEncoder.encodeCommandArgAsFloat32(n),this._commandBufferEncoder.finishEncodingCommand(),!0)}setFloat4(e,t,i,n,r){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOAT4),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32(t),this._commandBufferEncoder.encodeCommandArgAsFloat32(i),this._commandBufferEncoder.encodeCommandArgAsFloat32(n),this._commandBufferEncoder.encodeCommandArgAsFloat32(r),this._commandBufferEncoder.finishEncodingCommand(),!0)}setColor3(e,t){return!!e&&(this.setFloat3(e,t.r,t.g,t.b),!0)}setColor4(e,t,i){return!!e&&(this.setFloat4(e,t.r,t.g,t.b,i),!0)}wipeCaches(e){this.preventCacheWipeBetweenFrames||(this.resetTextureCache(),this._currentEffect=null,e&&(this._currentProgram=null,this._stencilStateComposer.reset(),this._depthCullingState.reset(),this._alphaState.reset()),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null)}_createTexture(){return this._engine.createTexture()}_deleteTexture(e){e&&this._engine.deleteTexture(e)}updateDynamicTexture(e,t,i,n=!1,r){if(void 0===n&&(n=!1),e&&e._hardwareTexture){const i=t.getCanvasTexture(),n=e._hardwareTexture.underlyingResource;this._engine.copyTexture(n,i),e.isReady=!0}}createDynamicTexture(e,t,i,n){return e=Math.max(e,1),t=Math.max(t,1),this.createRawTexture(new Uint8Array(e*t*4),e,t,5,!1,!1,n)}createVideoElement(e){return this._camera?this._camera.createVideo(e):null}updateVideoTexture(e,t,i){if(e&&e._hardwareTexture&&this._camera){const n=e._hardwareTexture.underlyingResource;this._camera.updateVideoTexture(n,t,i)}}createRawTexture(e,t,i,n,r,s,o,a=null,l=0,c=0,h=!1){const _=new Mt.l(this,Mt.S.Raw);if(_.format=n,_.generateMipMaps=r,_.samplingMode=o,_.invertY=s,_.baseWidth=t,_.baseHeight=i,_.width=_.baseWidth,_.height=_.baseHeight,_._compression=a,_.type=l,_._useSRGBBuffer=this._getUseSRGBBuffer(h,!r),this.updateRawTexture(_,e,n,s,a,l,_._useSRGBBuffer),_._hardwareTexture){const e=_._hardwareTexture.underlyingResource,t=this._getNativeSamplingMode(o);this._setTextureSampling(e,t)}return this._internalTexturesCache.push(_),_}createRawTexture2DArray(e,t,i,n,r,s,o,a,l=null,c=0){const h=new Mt.l(this,Mt.S.Raw2DArray);if(h.baseWidth=t,h.baseHeight=i,h.baseDepth=n,h.width=t,h.height=i,h.depth=n,h.format=r,h.type=c,h.generateMipMaps=s,h.samplingMode=a,h.is2DArray=!0,h._hardwareTexture){const l=h._hardwareTexture.underlyingResource;this._engine.loadRawTexture2DArray(l,e,t,i,n,this._getNativeTextureFormat(r,c),s,o);const _=this._getNativeSamplingMode(a);this._setTextureSampling(l,_)}return h.isReady=!0,this._internalTexturesCache.push(h),h}updateRawTexture(e,t,i,n,r=null,s=0,o=!1){if(e){if(t&&e._hardwareTexture){const n=e._hardwareTexture.underlyingResource;this._engine.loadRawTexture(n,t,e.width,e.height,this._getNativeTextureFormat(i,s),e.generateMipMaps,e.invertY)}e.isReady=!0}}createTexture(e,t,i,n,r=3,s=null,o=null,a=null,l=null,c=null,h=null,_,d,p,f=!1){const g="data:"===(e=e||"").substr(0,5),b=g&&-1!==e.indexOf(";base64,"),y=l||new Mt.l(this,Mt.S.Url),v=e;!this._transformTextureUrl||b||l||a||(e=this._transformTextureUrl(e));const A=e.lastIndexOf("."),C=h||(A>-1?e.substring(A).toLowerCase():"");let S=null;for(const e of k.D._TextureLoaders)if(e.canLoad(C)){S=e;break}n&&n.addPendingData(y),y.url=e,y.generateMipMaps=!t,y.samplingMode=r,y.invertY=i,y._useSRGBBuffer=this._getUseSRGBBuffer(f,t),this.doNotHandleContextLost||(y._buffer=a);let x=null;s&&!l&&(x=y.onLoadedObservable.add(s)),l||this._internalTexturesCache.push(y);const T=(i,l)=>{n&&n.removePendingData(y),e===v?(x&&y.onLoadedObservable.remove(x),m.l.UseFallbackTexture&&this.createTexture(m.l.FallbackTexture,t,y.invertY,n,r,null,o,a,y),o&&o((i||"Unknown error")+(m.l.UseFallbackTexture?" - Fallback texture was used":""),l)):(u.Y.Warn(`Failed to load ${e}, falling back to ${v}`),this.createTexture(v,t,y.invertY,n,r,s,o,a,y,c,h,_,d))};if(S)throw new Error("Loading textures from IInternalTextureLoader not yet implemented.");{const s=e=>{if(!y._hardwareTexture)return void(n&&n.removePendingData(y));const s=y._hardwareTexture.underlyingResource;this._engine.loadTexture(s,e,!t,i,f,(()=>{y.baseWidth=this._engine.getTextureWidth(s),y.baseHeight=this._engine.getTextureHeight(s),y.width=y.baseWidth,y.height=y.baseHeight,y.isReady=!0;const e=this._getNativeSamplingMode(r);this._setTextureSampling(s,e),n&&n.removePendingData(y),y.onLoadedObservable.notifyObservers(y),y.onLoadedObservable.clear()}),(()=>{throw new Error("Could not load a native texture.")}))};if(g&&a)if(a instanceof ArrayBuffer)s(new Uint8Array(a));else if(ArrayBuffer.isView(a))s(a);else{if("string"!=typeof a)throw new Error("Unsupported buffer type");s(new Uint8Array(V.w1.DecodeBase64(a)))}else b?s(new Uint8Array(V.w1.DecodeBase64(e))):this._loadFile(e,(e=>s(new Uint8Array(e))),void 0,void 0,!0,((e,t)=>{T("Unable to load "+(e&&e.responseURL,t))}))}return y}wrapNativeTexture(e){const t=new Jt.B(e,this._gl),i=new Mt.l(this,Mt.S.Unknown,!0);return i._hardwareTexture=t,i.isReady=!0,i}wrapWebGLTexture(){throw new Error("wrapWebGLTexture is not supported, use wrapNativeTexture instead.")}_createDepthStencilTexture(e,t,i){const n=i,r=new Mt.l(this,Mt.S.DepthStencil),s=e.width||e,o=e.height||e,a=this._engine.createFrameBuffer(r._hardwareTexture.underlyingResource,s,o,_native.Engine.TEXTURE_FORMAT_RGBA8,!1,!0,!1);return n._framebufferDepthStencil=a,r}_releaseFramebufferObjects(e){e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEFRAMEBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand())}_createImageBitmapFromSource(e,t){const i=new Promise(((t,i)=>{const n=this.createCanvasImage();n.onload=()=>{try{const e=this._engine.createImageBitmap(n);t(e)}catch(e){i(`Error loading image ${n.src} with exception: ${e}`)}},n.onerror=e=>{i(`Error loading image ${n.src} with exception: ${e}`)},n.src=e}));return i}createImageBitmap(e,t){return new Promise(((t,i)=>{if(Array.isArray(e)){const i=e;if(i.length){const e=this._engine.createImageBitmap(i[0]);if(e)return void t(e)}}i("Unsupported data for createImageBitmap.")}))}resizeImageBitmap(e,t,i){return this._engine.resizeImageBitmap(e,t,i)}createCubeTexture(e,t,i,n,r=null,s=null,o,a=null,l=!1,c=0,h=0,_=null,d,u=!1){const p=_||new Mt.l(this,Mt.S.Cube);p.isCube=!0,p.url=e,p.generateMipMaps=!n,p._lodGenerationScale=c,p._lodGenerationOffset=h,this._doNotHandleContextLost||(p._extension=a,p._files=i);const f=e.lastIndexOf(".");if(".env"===(a||(f>-1?e.substring(f).toLowerCase():""))){const t=e=>{const t=(0,Bn.qJ)(e);p.width=t.width,p.height=t.width,(0,Bn.qC)(p,t);const i=t.specular;if(!i)throw new Error("Nothing else parsed so far");p._lodGenerationScale=i.lodGenerationScale;const n=(0,Bn.Do)(e,t);p.format=5,p.type=0,p.generateMipMaps=!0,p.getEngine().updateTextureSamplingMode(K.x.TRILINEAR_SAMPLINGMODE,p),p._isRGBD=!0,p.invertY=!0,this._engine.loadCubeTextureWithMips(p._hardwareTexture.underlyingResource,n,!1,u,(()=>{p.isReady=!0,r&&r()}),(()=>{throw new Error("Could not load a native cube texture.")}))};if(i&&6===i.length)throw new Error("Multi-file loading not allowed on env files.");{const i=(e,t)=>{s&&e&&s(e.status+" "+e.statusText,t)};this._loadFile(e,(e=>t(new Uint8Array(e))),void 0,void 0,!0,i)}}else{if(!i||6!==i.length)throw new Error("Cannot load cubemap because 6 files were not defined");const e=[i[0],i[3],i[1],i[4],i[2],i[5]];Promise.all(e.map((e=>V.w1.LoadFileAsync(e).then((e=>new Uint8Array(e)))))).then((e=>new Promise(((t,i)=>{this._engine.loadCubeTexture(p._hardwareTexture.underlyingResource,e,!n,!0,u,t,i)})))).then((()=>{p.isReady=!0,r&&r()}),(e=>{s&&s(`Failed to load cubemap: ${e.message}`,e)}))}return this._internalTexturesCache.push(p),p}_createHardwareRenderTargetWrapper(e,t,i){const n=new Xn(e,t,i,this);return this._renderTargetWrapperCache.push(n),n}createRenderTargetTexture(e,t){const i=this._createHardwareRenderTargetWrapper(!1,!1,e),n={};void 0!==t&&"object"==typeof t?(n.generateMipMaps=t.generateMipMaps,n.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,n.generateStencilBuffer=n.generateDepthBuffer&&t.generateStencilBuffer,n.type=void 0===t.type?0:t.type,n.samplingMode=void 0===t.samplingMode?3:t.samplingMode,n.format=void 0===t.format?5:t.format):(n.generateMipMaps=t,n.generateDepthBuffer=!0,n.generateStencilBuffer=!1,n.type=0,n.samplingMode=3,n.format=5),(1!==n.type||this._caps.textureFloatLinearFiltering)&&(2!==n.type||this._caps.textureHalfFloatLinearFiltering)||(n.samplingMode=1);const r=new Mt.l(this,Mt.S.RenderTarget),s=e.width||e,o=e.height||e;1!==n.type||this._caps.textureFloat||(n.type=0,u.Y.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));const a=this._engine.createFrameBuffer(r._hardwareTexture.underlyingResource,s,o,this._getNativeTextureFormat(n.format,n.type),!!n.generateStencilBuffer,n.generateDepthBuffer,!!n.generateMipMaps);return i._framebuffer=a,i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=!!n.generateStencilBuffer,r.baseWidth=s,r.baseHeight=o,r.width=s,r.height=o,r.isReady=!0,r.samples=1,r.generateMipMaps=!!n.generateMipMaps,r.samplingMode=n.samplingMode,r.type=n.type,r.format=n.format,this._internalTexturesCache.push(r),i.setTextures(r),i}updateTextureSamplingMode(e,t){if(t._hardwareTexture){const i=this._getNativeSamplingMode(e);this._setTextureSampling(t._hardwareTexture.underlyingResource,i)}t.samplingMode=e}bindFramebuffer(e,t,i,n,r){const s=e;if(t)throw new Error("Cuboid frame buffers are not yet supported in NativeEngine.");if(i||n)throw new Error("Required width/height for frame buffers not yet supported in NativeEngine.");s._framebufferDepthStencil?this._bindUnboundFramebuffer(s._framebufferDepthStencil):this._bindUnboundFramebuffer(s._framebuffer)}unBindFramebuffer(e,t=!1,i){i&&i(),this._bindUnboundFramebuffer(null)}createDynamicVertexBuffer(e){return this.createVertexBuffer(e,!0)}updateDynamicIndexBuffer(e,t,i=0){const n=e,r=this._normalizeIndexData(t);n.is32Bits=4===r.BYTES_PER_ELEMENT,this._engine.updateDynamicIndexBuffer(n.nativeIndexBuffer,r.buffer,r.byteOffset,r.byteLength,i)}updateDynamicVertexBuffer(e,t,i,n){const r=e,s=ArrayBuffer.isView(t)?t:new Float32Array(t);this._engine.updateDynamicVertexBuffer(r.nativeVertexBuffer,s.buffer,s.byteOffset+(null!=i?i:0),null!=n?n:s.byteLength)}_setTexture(e,t,i=!1,n=!1){const r=this._boundUniforms[e];if(!r)return!1;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._setTextureCore(r,null)),!1;if(t.video)this._activeChannel=e,t.update();else if(4===t.delayLoadState)return t.delayLoad(),!1;let s;return s=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,this._activeChannel=e,!(!s||!s._hardwareTexture||(this._setTextureWrapMode(s._hardwareTexture.underlyingResource,this._getAddressMode(t.wrapU),this._getAddressMode(t.wrapV),this._getAddressMode(t.wrapR)),this._updateAnisotropicLevel(t),this._setTextureCore(r,s._hardwareTexture.underlyingResource),0))}_setTextureSampling(e,t){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTURESAMPLING),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.finishEncodingCommand()}_setTextureWrapMode(e,t,i,n){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTUREWRAPMODE),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.encodeCommandArgAsUInt32(n),this._commandBufferEncoder.finishEncodingCommand()}_setTextureCore(e,t){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTURE),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsNativeData(t),this._commandBufferEncoder.finishEncodingCommand()}_updateAnisotropicLevel(e){const t=e.getInternalTexture(),i=e.anisotropicFilteringLevel;t&&t._hardwareTexture&&t._cachedAnisotropicFilteringLevel!==i&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTUREANISOTROPICLEVEL),this._commandBufferEncoder.encodeCommandArgAsNativeData(t._hardwareTexture.underlyingResource),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand(),t._cachedAnisotropicFilteringLevel=i)}_getAddressMode(e){switch(e){case 1:return _native.Engine.ADDRESS_MODE_WRAP;case 0:return _native.Engine.ADDRESS_MODE_CLAMP;case 2:return _native.Engine.ADDRESS_MODE_MIRROR;default:throw new Error("Unexpected wrap mode: "+e+".")}}_bindTexture(e,t){const i=this._boundUniforms[e];if(i&&t&&t._hardwareTexture){const e=t._hardwareTexture.underlyingResource;this._setTextureCore(i,e)}}_deleteBuffer(e){e.nativeIndexBuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEINDEXBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e.nativeIndexBuffer),this._commandBufferEncoder.finishEncodingCommand(),delete e.nativeIndexBuffer),e.nativeVertexBuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEVERTEXBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e.nativeVertexBuffer),this._commandBufferEncoder.finishEncodingCommand(),delete e.nativeVertexBuffer)}createCanvas(e,t){if(!_native.Canvas)throw new Error("Native Canvas plugin not available.");const i=new _native.Canvas;return i.width=e,i.height=t,i}createCanvasImage(){if(!_native.Canvas)throw new Error("Native Canvas plugin not available.");return new _native.Image}updateTextureData(e,t,i,n,r,s,o=0,a=0,l=!1){throw new Error("updateTextureData not implemented.")}_uploadCompressedDataToTextureDirectly(e,t,i,n,r,s=0,o=0){throw new Error("_uploadCompressedDataToTextureDirectly not implemented.")}_uploadDataToTextureDirectly(e,t,i=0,n=0){throw new Error("_uploadDataToTextureDirectly not implemented.")}_uploadArrayBufferViewToTexture(e,t,i=0,n=0){throw new Error("_uploadArrayBufferViewToTexture not implemented.")}_uploadImageToTexture(e,t,i=0,n=0){throw new Error("_uploadArrayBufferViewToTexture not implemented.")}_getNativeSamplingMode(e){switch(e){case 1:return _native.Engine.TEXTURE_NEAREST_NEAREST;case 2:return _native.Engine.TEXTURE_LINEAR_LINEAR;case 3:return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR;case 4:return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST;case 5:return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST;case 6:return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR;case 7:return _native.Engine.TEXTURE_NEAREST_LINEAR;case 8:return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR;case 9:return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST;case 10:return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR;case 11:return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST;case 12:return _native.Engine.TEXTURE_LINEAR_NEAREST;default:throw new Error(`Unsupported sampling mode: ${e}.`)}}_getStencilFunc(e){switch(e){case 513:return _native.Engine.STENCIL_TEST_LESS;case 515:return _native.Engine.STENCIL_TEST_LEQUAL;case 514:return _native.Engine.STENCIL_TEST_EQUAL;case 518:return _native.Engine.STENCIL_TEST_GEQUAL;case 516:return _native.Engine.STENCIL_TEST_GREATER;case 517:return _native.Engine.STENCIL_TEST_NOTEQUAL;case 512:return _native.Engine.STENCIL_TEST_NEVER;case 519:return _native.Engine.STENCIL_TEST_ALWAYS;default:throw new Error(`Unsupported stencil func mode: ${e}.`)}}_getStencilOpFail(e){switch(e){case 7680:return _native.Engine.STENCIL_OP_FAIL_S_KEEP;case 0:return _native.Engine.STENCIL_OP_FAIL_S_ZERO;case 7681:return _native.Engine.STENCIL_OP_FAIL_S_REPLACE;case 7682:return _native.Engine.STENCIL_OP_FAIL_S_INCR;case 7683:return _native.Engine.STENCIL_OP_FAIL_S_DECR;case 5386:return _native.Engine.STENCIL_OP_FAIL_S_INVERT;case 34055:return _native.Engine.STENCIL_OP_FAIL_S_INCRSAT;case 34056:return _native.Engine.STENCIL_OP_FAIL_S_DECRSAT;default:throw new Error(`Unsupported stencil OpFail mode: ${e}.`)}}_getStencilDepthFail(e){switch(e){case 7680:return _native.Engine.STENCIL_OP_FAIL_Z_KEEP;case 0:return _native.Engine.STENCIL_OP_FAIL_Z_ZERO;case 7681:return _native.Engine.STENCIL_OP_FAIL_Z_REPLACE;case 7682:return _native.Engine.STENCIL_OP_FAIL_Z_INCR;case 7683:return _native.Engine.STENCIL_OP_FAIL_Z_DECR;case 5386:return _native.Engine.STENCIL_OP_FAIL_Z_INVERT;case 34055:return _native.Engine.STENCIL_OP_FAIL_Z_INCRSAT;case 34056:return _native.Engine.STENCIL_OP_FAIL_Z_DECRSAT;default:throw new Error(`Unsupported stencil depthFail mode: ${e}.`)}}_getStencilDepthPass(e){switch(e){case 7680:return _native.Engine.STENCIL_OP_PASS_Z_KEEP;case 0:return _native.Engine.STENCIL_OP_PASS_Z_ZERO;case 7681:return _native.Engine.STENCIL_OP_PASS_Z_REPLACE;case 7682:return _native.Engine.STENCIL_OP_PASS_Z_INCR;case 7683:return _native.Engine.STENCIL_OP_PASS_Z_DECR;case 5386:return _native.Engine.STENCIL_OP_PASS_Z_INVERT;case 34055:return _native.Engine.STENCIL_OP_PASS_Z_INCRSAT;case 34056:return _native.Engine.STENCIL_OP_PASS_Z_DECRSAT;default:throw new Error(`Unsupported stencil opPass mode: ${e}.`)}}_getNativeTextureFormat(e,t){if(4==e&&0==t)return _native.Engine.TEXTURE_FORMAT_RGB8;if(5==e&&0==t)return _native.Engine.TEXTURE_FORMAT_RGBA8;if(5==e&&1==t)return _native.Engine.TEXTURE_FORMAT_RGBA32F;throw new Wn.LH(`Unsupported texture format or type: format ${e}, type ${t}.`,Wn.SM.UnsupportedTextureError)}_getNativeAlphaMode(e){switch(e){case 0:return _native.Engine.ALPHA_DISABLE;case 1:return _native.Engine.ALPHA_ADD;case 2:return _native.Engine.ALPHA_COMBINE;case 3:return _native.Engine.ALPHA_SUBTRACT;case 4:return _native.Engine.ALPHA_MULTIPLY;case 5:return _native.Engine.ALPHA_MAXIMIZED;case 6:return _native.Engine.ALPHA_ONEONE;case 7:return _native.Engine.ALPHA_PREMULTIPLIED;case 8:return _native.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF;case 9:return _native.Engine.ALPHA_INTERPOLATE;case 10:return _native.Engine.ALPHA_SCREENMODE;default:throw new Error(`Unsupported alpha mode: ${e}.`)}}_getNativeAttribType(e){switch(e){case le.o.BYTE:return _native.Engine.ATTRIB_TYPE_INT8;case le.o.UNSIGNED_BYTE:return _native.Engine.ATTRIB_TYPE_UINT8;case le.o.SHORT:return _native.Engine.ATTRIB_TYPE_INT16;case le.o.UNSIGNED_SHORT:return _native.Engine.ATTRIB_TYPE_UINT16;case le.o.FLOAT:return _native.Engine.ATTRIB_TYPE_FLOAT;default:throw new Error(`Unsupported attribute type: ${e}.`)}}getFontOffset(e){return{ascent:0,height:0,descent:0}}_readTexturePixels(e,t,i,n,r,s,o,a,l,c){var h,_,d,u;if(void 0!==n&&-1!==n)throw new Error(`Reading cubemap faces is not supported, but faceIndex is ${n}.`);return this._engine.readTexture(null===(h=e._hardwareTexture)||void 0===h?void 0:h.underlyingResource,null!=r?r:0,null!=l?l:0,null!=c?c:0,t,i,null!==(_=null==s?void 0:s.buffer)&&void 0!==_?_:null,null!==(d=null==s?void 0:s.byteOffset)&&void 0!==d?d:0,null!==(u=null==s?void 0:s.byteLength)&&void 0!==u?u:0).then((e=>(s||(s=new Uint8Array(e)),s)))}}qn.PROTOCOL_VERSION=6,qn._createNativeDataStream=function(){return _native.NativeDataStream.VALIDATION_ENABLED?new Kn:new Fn};class Kn extends Fn{constructor(){super()}writeUint32(e){super.writeUint32(_native.NativeDataStream.VALIDATION_UINT_32),super.writeUint32(e)}writeInt32(e){super.writeUint32(_native.NativeDataStream.VALIDATION_INT_32),super.writeInt32(e)}writeFloat32(e){super.writeUint32(_native.NativeDataStream.VALIDATION_FLOAT_32),super.writeFloat32(e)}writeUint32Array(e){super.writeUint32(_native.NativeDataStream.VALIDATION_UINT_32_ARRAY),super.writeUint32Array(e)}writeInt32Array(e){super.writeUint32(_native.NativeDataStream.VALIDATION_INT_32_ARRAY),super.writeInt32Array(e)}writeFloat32Array(e){super.writeUint32(_native.NativeDataStream.VALIDATION_FLOAT_32_ARRAY),super.writeFloat32Array(e)}writeNativeData(e){super.writeUint32(_native.NativeDataStream.VALIDATION_NATIVE_DATA),super.writeNativeData(e)}writeBoolean(e){super.writeUint32(_native.NativeDataStream.VALIDATION_BOOLEAN),super.writeBoolean(e)}}var Zn,$n,Jn,er,tr,ir,nr,rr,sr,or,ar,lr,cr,hr,_r,dr,ur,pr,fr,mr,gr,br,yr,vr,Ar,Cr,Sr,xr,Tr,Er,Rr,Pr,Ir,Mr,Dr,Or,wr,Fr,Br=i("../../../node_modules/@babylonjs/core/Maths/math.js");!function(e){e.SRGB="srgb"}(Zn||(Zn={})),function(e){e.LowPower="low-power",e.HighPerformance="high-performance"}($n||($n={})),function(e){e.DepthClipControl="depth-clip-control",e.Depth24UnormStencil8="depth24unorm-stencil8",e.Depth32FloatStencil8="depth32float-stencil8",e.TextureCompressionBC="texture-compression-bc",e.TextureCompressionETC2="texture-compression-etc2",e.TextureCompressionASTC="texture-compression-astc",e.TimestampQuery="timestamp-query",e.IndirectFirstInstance="indirect-first-instance",e.ShaderF16="shader-f16",e.BGRA8UnormStorage="bgra8unorm-storage"}(Jn||(Jn={})),function(e){e[e.MapRead=1]="MapRead",e[e.MapWrite=2]="MapWrite",e[e.CopySrc=4]="CopySrc",e[e.CopyDst=8]="CopyDst",e[e.Index=16]="Index",e[e.Vertex=32]="Vertex",e[e.Uniform=64]="Uniform",e[e.Storage=128]="Storage",e[e.Indirect=256]="Indirect",e[e.QueryResolve=512]="QueryResolve"}(er||(er={})),function(e){e[e.Read=1]="Read",e[e.Write=2]="Write"}(tr||(tr={})),function(e){e.E1d="1d",e.E2d="2d",e.E3d="3d"}(ir||(ir={})),function(e){e[e.CopySrc=1]="CopySrc",e[e.CopyDst=2]="CopyDst",e[e.TextureBinding=4]="TextureBinding",e[e.StorageBinding=8]="StorageBinding",e[e.RenderAttachment=16]="RenderAttachment"}(nr||(nr={})),function(e){e.E1d="1d",e.E2d="2d",e.E2dArray="2d-array",e.Cube="cube",e.CubeArray="cube-array",e.E3d="3d"}(rr||(rr={})),function(e){e.All="all",e.StencilOnly="stencil-only",e.DepthOnly="depth-only"}(sr||(sr={})),function(e){e.R8Unorm="r8unorm",e.R8Snorm="r8snorm",e.R8Uint="r8uint",e.R8Sint="r8sint",e.R16Uint="r16uint",e.R16Sint="r16sint",e.R16Float="r16float",e.RG8Unorm="rg8unorm",e.RG8Snorm="rg8snorm",e.RG8Uint="rg8uint",e.RG8Sint="rg8sint",e.R32Uint="r32uint",e.R32Sint="r32sint",e.R32Float="r32float",e.RG16Uint="rg16uint",e.RG16Sint="rg16sint",e.RG16Float="rg16float",e.RGBA8Unorm="rgba8unorm",e.RGBA8UnormSRGB="rgba8unorm-srgb",e.RGBA8Snorm="rgba8snorm",e.RGBA8Uint="rgba8uint",e.RGBA8Sint="rgba8sint",e.BGRA8Unorm="bgra8unorm",e.BGRA8UnormSRGB="bgra8unorm-srgb",e.RGB9E5UFloat="rgb9e5ufloat",e.RGB10A2Unorm="rgb10a2unorm",e.RG11B10UFloat="rg11b10ufloat",e.RG32Uint="rg32uint",e.RG32Sint="rg32sint",e.RG32Float="rg32float",e.RGBA16Uint="rgba16uint",e.RGBA16Sint="rgba16sint",e.RGBA16Float="rgba16float",e.RGBA32Uint="rgba32uint",e.RGBA32Sint="rgba32sint",e.RGBA32Float="rgba32float",e.Stencil8="stencil8",e.Depth16Unorm="depth16unorm",e.Depth24Plus="depth24plus",e.Depth24PlusStencil8="depth24plus-stencil8",e.Depth32Float="depth32float",e.BC1RGBAUnorm="bc1-rgba-unorm",e.BC1RGBAUnormSRGB="bc1-rgba-unorm-srgb",e.BC2RGBAUnorm="bc2-rgba-unorm",e.BC2RGBAUnormSRGB="bc2-rgba-unorm-srgb",e.BC3RGBAUnorm="bc3-rgba-unorm",e.BC3RGBAUnormSRGB="bc3-rgba-unorm-srgb",e.BC4RUnorm="bc4-r-unorm",e.BC4RSnorm="bc4-r-snorm",e.BC5RGUnorm="bc5-rg-unorm",e.BC5RGSnorm="bc5-rg-snorm",e.BC6HRGBUFloat="bc6h-rgb-ufloat",e.BC6HRGBFloat="bc6h-rgb-float",e.BC7RGBAUnorm="bc7-rgba-unorm",e.BC7RGBAUnormSRGB="bc7-rgba-unorm-srgb",e.ETC2RGB8Unorm="etc2-rgb8unorm",e.ETC2RGB8UnormSRGB="etc2-rgb8unorm-srgb",e.ETC2RGB8A1Unorm="etc2-rgb8a1unorm",e.ETC2RGB8A1UnormSRGB="etc2-rgb8a1unorm-srgb",e.ETC2RGBA8Unorm="etc2-rgba8unorm",e.ETC2RGBA8UnormSRGB="etc2-rgba8unorm-srgb",e.EACR11Unorm="eac-r11unorm",e.EACR11Snorm="eac-r11snorm",e.EACRG11Unorm="eac-rg11unorm",e.EACRG11Snorm="eac-rg11snorm",e.ASTC4x4Unorm="astc-4x4-unorm",e.ASTC4x4UnormSRGB="astc-4x4-unorm-srgb",e.ASTC5x4Unorm="astc-5x4-unorm",e.ASTC5x4UnormSRGB="astc-5x4-unorm-srgb",e.ASTC5x5Unorm="astc-5x5-unorm",e.ASTC5x5UnormSRGB="astc-5x5-unorm-srgb",e.ASTC6x5Unorm="astc-6x5-unorm",e.ASTC6x5UnormSRGB="astc-6x5-unorm-srgb",e.ASTC6x6Unorm="astc-6x6-unorm",e.ASTC6x6UnormSRGB="astc-6x6-unorm-srgb",e.ASTC8x5Unorm="astc-8x5-unorm",e.ASTC8x5UnormSRGB="astc-8x5-unorm-srgb",e.ASTC8x6Unorm="astc-8x6-unorm",e.ASTC8x6UnormSRGB="astc-8x6-unorm-srgb",e.ASTC8x8Unorm="astc-8x8-unorm",e.ASTC8x8UnormSRGB="astc-8x8-unorm-srgb",e.ASTC10x5Unorm="astc-10x5-unorm",e.ASTC10x5UnormSRGB="astc-10x5-unorm-srgb",e.ASTC10x6Unorm="astc-10x6-unorm",e.ASTC10x6UnormSRGB="astc-10x6-unorm-srgb",e.ASTC10x8Unorm="astc-10x8-unorm",e.ASTC10x8UnormSRGB="astc-10x8-unorm-srgb",e.ASTC10x10Unorm="astc-10x10-unorm",e.ASTC10x10UnormSRGB="astc-10x10-unorm-srgb",e.ASTC12x10Unorm="astc-12x10-unorm",e.ASTC12x10UnormSRGB="astc-12x10-unorm-srgb",e.ASTC12x12Unorm="astc-12x12-unorm",e.ASTC12x12UnormSRGB="astc-12x12-unorm-srgb",e.Depth24UnormStencil8="depth24unorm-stencil8",e.Depth32FloatStencil8="depth32float-stencil8"}(or||(or={})),function(e){e.ClampToEdge="clamp-to-edge",e.Repeat="repeat",e.MirrorRepeat="mirror-repeat"}(ar||(ar={})),function(e){e.Nearest="nearest",e.Linear="linear"}(lr||(lr={})),function(e){e.Never="never",e.Less="less",e.Equal="equal",e.LessEqual="less-equal",e.Greater="greater",e.NotEqual="not-equal",e.GreaterEqual="greater-equal",e.Always="always"}(cr||(cr={})),function(e){e[e.Vertex=1]="Vertex",e[e.Fragment=2]="Fragment",e[e.Compute=4]="Compute"}(hr||(hr={})),function(e){e.Uniform="uniform",e.Storage="storage",e.ReadOnlyStorage="read-only-storage"}(_r||(_r={})),function(e){e.Filtering="filtering",e.NonFiltering="non-filtering",e.Comparison="comparison"}(dr||(dr={})),function(e){e.Float="float",e.UnfilterableFloat="unfilterable-float",e.Depth="depth",e.Sint="sint",e.Uint="uint"}(ur||(ur={})),function(e){e.WriteOnly="write-only"}(pr||(pr={})),function(e){e.Error="error",e.Warning="warning",e.Info="info"}(fr||(fr={})),function(e){e.Auto="auto"}(mr||(mr={})),function(e){e.PointList="point-list",e.LineList="line-list",e.LineStrip="line-strip",e.TriangleList="triangle-list",e.TriangleStrip="triangle-strip"}(gr||(gr={})),function(e){e.CCW="ccw",e.CW="cw"}(br||(br={})),function(e){e.None="none",e.Front="front",e.Back="back"}(yr||(yr={})),function(e){e[e.Red=1]="Red",e[e.Green=2]="Green",e[e.Blue=4]="Blue",e[e.Alpha=8]="Alpha",e[e.All=15]="All"}(vr||(vr={})),function(e){e.Zero="zero",e.One="one",e.Src="src",e.OneMinusSrc="one-minus-src",e.SrcAlpha="src-alpha",e.OneMinusSrcAlpha="one-minus-src-alpha",e.Dst="dst",e.OneMinusDst="one-minus-dst",e.DstAlpha="dst-alpha",e.OneMinusDstAlpha="one-minus-dst-alpha",e.SrcAlphaSaturated="src-alpha-saturated",e.Constant="constant",e.OneMinusConstant="one-minus-constant"}(Ar||(Ar={})),function(e){e.Add="add",e.Subtract="subtract",e.ReverseSubtract="reverse-subtract",e.Min="min",e.Max="max"}(Cr||(Cr={})),function(e){e.Keep="keep",e.Zero="zero",e.Replace="replace",e.Invert="invert",e.IncrementClamp="increment-clamp",e.DecrementClamp="decrement-clamp",e.IncrementWrap="increment-wrap",e.DecrementWrap="decrement-wrap"}(Sr||(Sr={})),function(e){e.Uint16="uint16",e.Uint32="uint32"}(xr||(xr={})),function(e){e.Uint8x2="uint8x2",e.Uint8x4="uint8x4",e.Sint8x2="sint8x2",e.Sint8x4="sint8x4",e.Unorm8x2="unorm8x2",e.Unorm8x4="unorm8x4",e.Snorm8x2="snorm8x2",e.Snorm8x4="snorm8x4",e.Uint16x2="uint16x2",e.Uint16x4="uint16x4",e.Sint16x2="sint16x2",e.Sint16x4="sint16x4",e.Unorm16x2="unorm16x2",e.Unorm16x4="unorm16x4",e.Snorm16x2="snorm16x2",e.Snorm16x4="snorm16x4",e.Float16x2="float16x2",e.Float16x4="float16x4",e.Float32="float32",e.Float32x2="float32x2",e.Float32x3="float32x3",e.Float32x4="float32x4",e.Uint32="uint32",e.Uint32x2="uint32x2",e.Uint32x3="uint32x3",e.Uint32x4="uint32x4",e.Sint32="sint32",e.Sint32x2="sint32x2",e.Sint32x3="sint32x3",e.Sint32x4="sint32x4"}(Tr||(Tr={})),function(e){e.Vertex="vertex",e.Instance="instance"}(Er||(Er={})),function(e){e.Beginning="beginning",e.End="end"}(Rr||(Rr={})),function(e){e.Beginning="beginning",e.End="end"}(Pr||(Pr={})),function(e){e.Load="load",e.Clear="clear"}(Ir||(Ir={})),function(e){e.Store="store",e.Discard="discard"}(Mr||(Mr={})),function(e){e.Occlusion="occlusion",e.Timestamp="timestamp"}(Dr||(Dr={})),function(e){e.Opaque="opaque",e.Premultiplied="premultiplied"}(Or||(Or={})),function(e){e.Destroyed="destroyed"}(wr||(wr={})),function(e){e.OutOfMemory="out-of-memory",e.Validation="validation"}(Fr||(Fr={}));class Nr{constructor(){this.shaderLanguage=Di.x.GLSL}_addUniformToLeftOverUBO(e,t,i){let n=0;[e,t,n]=this._getArraySize(e,t,i);for(let t=0;t=0){for(;n++=0&&(_.push(o[h]),d.push(e))}this.shaderProcessingContext.attributeNamesFromEffect=_,this.shaderProcessingContext.attributeLocationsFromEffect=d}buildUniformLayout(){if(this.shaderProcessingContext.leftOverUniforms.length){this.uniformBuffer=new Dt.M(this.engine,void 0,void 0,"leftOver-"+this._name);for(const e of this.shaderProcessingContext.leftOverUniforms){const t=e.type.replace(/^(.*?)(<.*>)?$/,"$1"),i=Nr.UniformSizes[t];this.uniformBuffer.addUniform(e.name,i,e.length),this._leftOverUniformsByName[e.name]=e.type}this.uniformBuffer.create()}}dispose(){this.uniformBuffer&&this.uniformBuffer.dispose()}setInt(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt(e,t)}setInt2(e,t,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt2(e,t,i)}setInt3(e,t,i,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt3(e,t,i,n)}setInt4(e,t,i,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt4(e,t,i,n,r)}setIntArray(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateIntArray(e,t)}setIntArray2(e,t){this.setIntArray(e,t)}setIntArray3(e,t){this.setIntArray(e,t)}setIntArray4(e,t){this.setIntArray(e,t)}setArray(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateArray(e,t)}setArray2(e,t){this.setArray(e,t)}setArray3(e,t){this.setArray(e,t)}setArray4(e,t){this.setArray(e,t)}setMatrices(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrices(e,t)}setMatrix(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix(e,t)}setMatrix3x3(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix3x3(e,t)}setMatrix2x2(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix2x2(e,t)}setFloat(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat(e,t)}setVector2(e,t){this.setFloat2(e,t.x,t.y)}setFloat2(e,t,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat2(e,t,i)}setVector3(e,t){this.setFloat3(e,t.x,t.y,t.z)}setFloat3(e,t,i,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat3(e,t,i,n)}setVector4(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)}setQuaternion(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)}setFloat4(e,t,i,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat4(e,t,i,n,r)}setColor3(e,t){this.setFloat3(e,t.r,t.g,t.b)}setColor4(e,t,i){this.setFloat4(e,t.r,t.g,t.b,i)}setDirectColor4(e,t){this.setFloat4(e,t.r,t.g,t.b,t.a)}_getVertexShaderCode(){var e;return null===(e=this.sources)||void 0===e?void 0:e.vertex}_getFragmentShaderCode(){var e;return null===(e=this.sources)||void 0===e?void 0:e.fragment}}const kr={mat2:2,mat3:3,mat4:4,mat2x2:2,mat3x3:3,mat4x4:4};class Vr{constructor(e){this.shaderLanguage=e,this._attributeNextLocation=0,this._varyingNextLocation=0,this.freeGroupIndex=0,this.freeBindingIndex=0,this.availableVaryings={},this.availableAttributes={},this.availableBuffers={},this.availableTextures={},this.availableSamplers={},this.orderedAttributes=[],this.bindGroupLayoutEntries=[],this.bindGroupLayoutEntryInfo=[],this.bindGroupEntries=[],this.bufferNames=[],this.textureNames=[],this.samplerNames=[],this.leftOverUniforms=[],this._findStartingGroupBinding()}static get KnownUBOs(){return Vr._SimplifiedKnownBindings?Vr._SimplifiedKnownUBOs:Vr._KnownUBOs}_findStartingGroupBinding(){const e=Vr.KnownUBOs,t=[];for(const i in e){const n=e[i].binding;-1!==n.groupIndex&&(void 0===t[n.groupIndex]?t[n.groupIndex]=n.bindingIndex:t[n.groupIndex]=Math.max(t[n.groupIndex],n.bindingIndex))}this.freeGroupIndex=t.length-1,0===this.freeGroupIndex?(this.freeGroupIndex++,this.freeBindingIndex=0):this.freeBindingIndex=t[t.length-1]+1}getAttributeNextLocation(e,t=0){var i;const n=this._attributeNextLocation;return this._attributeNextLocation+=(null!==(i=kr[e])&&void 0!==i?i:1)*(t||1),n}getVaryingNextLocation(e,t=0){var i;const n=this._varyingNextLocation;return this._varyingNextLocation+=(null!==(i=kr[e])&&void 0!==i?i:1)*(t||1),n}getNextFreeUBOBinding(){return this._getNextFreeBinding(1)}_getNextFreeBinding(e){if(this.freeBindingIndex>65536-e&&(this.freeGroupIndex++,this.freeBindingIndex=0),4===this.freeGroupIndex)throw"Too many textures or UBOs have been declared and it is not supported in WebGPU.";const t={groupIndex:this.freeGroupIndex,bindingIndex:this.freeBindingIndex};return this.freeBindingIndex+=e,t}}Vr._SimplifiedKnownBindings=!0,Vr._SimplifiedKnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:-1,bindingIndex:-1}},Light1:{binding:{groupIndex:-1,bindingIndex:-1}},Light2:{binding:{groupIndex:-1,bindingIndex:-1}},Light3:{binding:{groupIndex:-1,bindingIndex:-1}},Light4:{binding:{groupIndex:-1,bindingIndex:-1}},Light5:{binding:{groupIndex:-1,bindingIndex:-1}},Light6:{binding:{groupIndex:-1,bindingIndex:-1}},Light7:{binding:{groupIndex:-1,bindingIndex:-1}},Light8:{binding:{groupIndex:-1,bindingIndex:-1}},Light9:{binding:{groupIndex:-1,bindingIndex:-1}},Light10:{binding:{groupIndex:-1,bindingIndex:-1}},Light11:{binding:{groupIndex:-1,bindingIndex:-1}},Light12:{binding:{groupIndex:-1,bindingIndex:-1}},Light13:{binding:{groupIndex:-1,bindingIndex:-1}},Light14:{binding:{groupIndex:-1,bindingIndex:-1}},Light15:{binding:{groupIndex:-1,bindingIndex:-1}},Light16:{binding:{groupIndex:-1,bindingIndex:-1}},Light17:{binding:{groupIndex:-1,bindingIndex:-1}},Light18:{binding:{groupIndex:-1,bindingIndex:-1}},Light19:{binding:{groupIndex:-1,bindingIndex:-1}},Light20:{binding:{groupIndex:-1,bindingIndex:-1}},Light21:{binding:{groupIndex:-1,bindingIndex:-1}},Light22:{binding:{groupIndex:-1,bindingIndex:-1}},Light23:{binding:{groupIndex:-1,bindingIndex:-1}},Light24:{binding:{groupIndex:-1,bindingIndex:-1}},Light25:{binding:{groupIndex:-1,bindingIndex:-1}},Light26:{binding:{groupIndex:-1,bindingIndex:-1}},Light27:{binding:{groupIndex:-1,bindingIndex:-1}},Light28:{binding:{groupIndex:-1,bindingIndex:-1}},Light29:{binding:{groupIndex:-1,bindingIndex:-1}},Light30:{binding:{groupIndex:-1,bindingIndex:-1}},Light31:{binding:{groupIndex:-1,bindingIndex:-1}},Material:{binding:{groupIndex:-1,bindingIndex:-1}},Mesh:{binding:{groupIndex:-1,bindingIndex:-1}},Internals:{binding:{groupIndex:-1,bindingIndex:-1}}},Vr._KnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:1,bindingIndex:0}},Light1:{binding:{groupIndex:1,bindingIndex:1}},Light2:{binding:{groupIndex:1,bindingIndex:2}},Light3:{binding:{groupIndex:1,bindingIndex:3}},Light4:{binding:{groupIndex:1,bindingIndex:4}},Light5:{binding:{groupIndex:1,bindingIndex:5}},Light6:{binding:{groupIndex:1,bindingIndex:6}},Light7:{binding:{groupIndex:1,bindingIndex:7}},Light8:{binding:{groupIndex:1,bindingIndex:8}},Light9:{binding:{groupIndex:1,bindingIndex:9}},Light10:{binding:{groupIndex:1,bindingIndex:10}},Light11:{binding:{groupIndex:1,bindingIndex:11}},Light12:{binding:{groupIndex:1,bindingIndex:12}},Light13:{binding:{groupIndex:1,bindingIndex:13}},Light14:{binding:{groupIndex:1,bindingIndex:14}},Light15:{binding:{groupIndex:1,bindingIndex:15}},Light16:{binding:{groupIndex:1,bindingIndex:16}},Light17:{binding:{groupIndex:1,bindingIndex:17}},Light18:{binding:{groupIndex:1,bindingIndex:18}},Light19:{binding:{groupIndex:1,bindingIndex:19}},Light20:{binding:{groupIndex:1,bindingIndex:20}},Light21:{binding:{groupIndex:1,bindingIndex:21}},Light22:{binding:{groupIndex:1,bindingIndex:22}},Light23:{binding:{groupIndex:1,bindingIndex:23}},Light24:{binding:{groupIndex:1,bindingIndex:24}},Light25:{binding:{groupIndex:1,bindingIndex:25}},Light26:{binding:{groupIndex:1,bindingIndex:26}},Light27:{binding:{groupIndex:1,bindingIndex:27}},Light28:{binding:{groupIndex:1,bindingIndex:28}},Light29:{binding:{groupIndex:1,bindingIndex:29}},Light30:{binding:{groupIndex:1,bindingIndex:30}},Light31:{binding:{groupIndex:1,bindingIndex:31}},Material:{binding:{groupIndex:2,bindingIndex:0}},Mesh:{binding:{groupIndex:2,bindingIndex:1}},Internals:{binding:{groupIndex:2,bindingIndex:2}}};class Ur extends Nr{constructor(){super(...arguments),this._missingVaryings=[],this._textureArrayProcessing=[],this.shaderLanguage=Di.x.GLSL}_getArraySize(e,t,i){let n=0;const r=e.indexOf("["),s=e.indexOf("]");if(r>0&&s>0){const t=e.substring(r+1,s);n=+t,isNaN(n)&&(n=+i[t.trim()]),e=e.substr(0,r)}return[e,t,n]}initializeShaders(e){this._webgpuProcessingContext=e,this._missingVaryings.length=0,this._textureArrayProcessing.length=0}preProcessShaderCode(e,t){const i=`uniform ${Nr.InternalsUBOName} {\nfloat yFactor_;\nfloat textureOutputHeight_;\n};\n`;return t?i+"##INJECTCODE##\n"+e:i+e}varyingProcessor(e,t,i){this._preProcessors=i;const n=/\s*varying\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm.exec(e);if(null!=n){const r=n[1],s=n[2];let o;t?(o=this._webgpuProcessingContext.availableVaryings[s],this._missingVaryings[o]="",void 0===o&&u.Y.Warn(`Invalid fragment shader: The varying named "${s}" is not declared in the vertex shader! This declaration will be ignored.`)):(o=this._webgpuProcessingContext.getVaryingNextLocation(r,this._getArraySize(s,r,i)[2]),this._webgpuProcessingContext.availableVaryings[s]=o,this._missingVaryings[o]=`layout(location = ${o}) in ${r} ${s};`),e=e.replace(n[0],void 0===o?"":`layout(location = ${o}) ${t?"in":"out"} ${r} ${s};`)}return e}attributeProcessor(e,t){this._preProcessors=t;const i=/\s*attribute\s+(\S+)\s+(\S+)\s*;/gm.exec(e);if(null!=i){const n=i[1],r=i[2],s=this._webgpuProcessingContext.getAttributeNextLocation(n,this._getArraySize(r,n,t)[2]);this._webgpuProcessingContext.availableAttributes[r]=s,this._webgpuProcessingContext.orderedAttributes[s]=r,e=e.replace(i[0],`layout(location = ${s}) in ${n} ${r};`)}return e}uniformProcessor(e,t,i){var n;this._preProcessors=i;const r=/\s*uniform\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm.exec(e);if(null!=r){let s=r[1],o=r[2];if(0===s.indexOf("sampler")||1===s.indexOf("sampler")){let r=0;[o,s,r]=this._getArraySize(o,s,i);let a=this._webgpuProcessingContext.availableTextures[o];if(!a){a={autoBindSampler:!0,isTextureArray:r>0,isStorageTexture:!1,textures:[],sampleType:ur.Float};for(let e=0;e<(r||1);++e)a.textures.push(this._webgpuProcessingContext.getNextFreeUBOBinding())}const l=null!==(n=Nr._SamplerTypeByWebGLSamplerType[s])&&void 0!==n?n:"sampler",c=!!Nr._IsComparisonSamplerByWebGPUSamplerType[l],h=c?dr.Comparison:dr.Filtering,_=o+Nr.AutoSamplerSuffix;let d=this._webgpuProcessingContext.availableSamplers[_];d||(d={binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:h});const u="u"===s.charAt(0)?"u":"i"===s.charAt(0)?"i":"";u&&(s=s.substr(1));const p=c?ur.Depth:"u"===u?ur.Uint:"i"===u?ur.Sint:ur.Float;a.sampleType=p;const f=r>0,m=d.binding.groupIndex,g=d.binding.bindingIndex,b=Nr._SamplerFunctionByWebGLSamplerType[s],y=Nr._TextureTypeByWebGLSamplerType[s],v=Nr._GpuTextureViewDimensionByWebGPUTextureType[y];if(f){const t=[];t.push(`layout(set = ${m}, binding = ${g}) uniform ${u}${l} ${_};`),e="\r\n";for(let i=0;i0?"\r\n":""}#define ${o}${i} ${u}${b}(${o}Texture${i}, ${_})`}e=t.join("\r\n")+e,this._textureArrayProcessing.push(o)}else r=1,e=`layout(set = ${m}, binding = ${g}) uniform ${u}${l} ${_};\n layout(set = ${a.textures[0].groupIndex}, binding = ${a.textures[0].bindingIndex}) uniform ${y} ${o}Texture;\n #define ${o} ${u}${b}(${o}Texture, ${_})`;this._webgpuProcessingContext.availableTextures[o]=a,this._webgpuProcessingContext.availableSamplers[_]=d,this._addSamplerBindingDescription(_,d,!t);for(let e=0;e=0,i="\n glFragCoord_ = gl_FragCoord;\n if (yFactor_ == 1.) {\n glFragCoord_.y = textureOutputHeight_ - glFragCoord_.y;\n }\n ",n=t?"vec4 glFragCoord_;\n":"";e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/gl_FragCoord/g,"glFragCoord_")).replace(/void\s+?main\s*\(/g,(s?"":"layout(location = 0) out vec4 glFragColor;\n")+"void main(")).replace(/dFdy/g,"(-yFactor_)*dFdy")).replace("##INJECTCODE##",n),t&&(e=this._injectStartingAndEndingCode(e,"void main",i))}else if(e=(e=e.replace(/gl_InstanceID/g,"gl_InstanceIndex")).replace(/gl_VertexID/g,"gl_VertexIndex"),-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;if(!i){const t=e.lastIndexOf("}");e=e.substring(0,t),e+="gl_Position.y *= yFactor_;\n",r.isNDCHalfZRange||(e+="gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0;\n"),e+="}"}return e}_applyTextureArrayProcessing(e,t){const i=new RegExp(t+"\\s*\\[(.+)?\\]","gm");let n=i.exec(e);for(;null!=n;){const r=n[1];let s=+r;this._preProcessors&&isNaN(s)&&(s=+this._preProcessors[r.trim()]),e=e.replace(n[0],t+s),n=i.exec(e)}return e}_generateLeftOverUBOCode(e,t){let i=`layout(set = ${t.binding.groupIndex}, binding = ${t.binding.bindingIndex}) uniform ${e} {\n `;for(const e of this._webgpuProcessingContext.leftOverUniforms)e.length>0?i+=` ${e.type} ${e.name}[${e.length}];\n`:i+=` ${e.type} ${e.name};\n`;return i+="};\n\n",i}finalizeShaders(e,t){for(let i=0;i0&&(t=i+"\n"+t)}const i=this._buildLeftOverUBO();return e=i+e,t=i+t,this._collectBindingNames(),this._preCreateBindGroupEntries(),this._preProcessors=null,{vertexCode:e,fragmentCode:t}}}dt.v.IncludesShadersStoreWGSL.bonesDeclaration="#if NUM_BONE_INFLUENCERS>0\nattribute matricesIndices : vec4;\nattribute matricesWeights : vec4;\n#if NUM_BONE_INFLUENCERS>4\nattribute matricesIndicesExtra : vec4;\nattribute matricesWeightsExtra : vec4;\n#endif\n#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#ifdef BONETEXTURE\nvar boneSampler : texture_2d;\nuniform boneTextureWidth : f32;\n#else\nuniform mBones : array;\n#ifdef BONES_VELOCITY_ENABLED\nuniform mPreviousBones : array;\n#endif\n#endif\n#ifdef BONETEXTURE\nfn readMatrixFromRawSampler(smp : texture_2d,index : f32)->mat4x4\n{\nlet offset=i32(index) *4; \nlet m0=textureLoad(smp,vec2(offset+0,0),0);\nlet m1=textureLoad(smp,vec2(offset+1,0),0);\nlet m2=textureLoad(smp,vec2(offset+2,0),0);\nlet m3=textureLoad(smp,vec2(offset+3,0),0);\nreturn mat4x4(m0,m1,m2,m3);\n}\n#endif\n#endif\n#endif\n";dt.v.IncludesShadersStoreWGSL.bonesVertex="#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#if NUM_BONE_INFLUENCERS>0\nvar influence : mat4x4;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif \n#else \ninfluence=uniforms.mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence=influence+uniforms.mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence=influence+uniforms.mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence=influence+uniforms.mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence=influence+uniforms.mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence=influence+uniforms.mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence=influence+uniforms.mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence=influence+uniforms.mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif \n#endif\nfinalWorld=finalWorld*influence;\n#endif\n#endif\n";dt.v.IncludesShadersStoreWGSL.bakedVertexAnimationDeclaration="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\nuniform bakedVertexAnimationTime: f32;\nuniform bakedVertexAnimationTextureSizeInverted: vec2;\nuniform bakedVertexAnimationSettings: vec4;\nvar bakedVertexAnimationTexture : texture_2d;\n#ifdef INSTANCES\nattribute bakedVertexAnimationSettingsInstanced : vec4;\n#endif\nfn readMatrixFromRawSamplerVAT(smp : texture_2d,index : f32,frame : f32)->mat4x4\n{\nlet offset=i32(index)*4;\nlet frameUV=i32(frame);\nlet m0=textureLoad(smp,vec2(offset+0,frameUV),0);\nlet m1=textureLoad(smp,vec2(offset+1,frameUV),0);\nlet m2=textureLoad(smp,vec2(offset+2,frameUV),0);\nlet m3=textureLoad(smp,vec2(offset+3,frameUV),0);\nreturn mat4x4(m0,m1,m2,m3);\n}\n#endif\n";dt.v.IncludesShadersStoreWGSL.bakedVertexAnimation="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\n{\n#ifdef INSTANCES\nlet VATStartFrame: f32=bakedVertexAnimationSettingsInstanced.x;\nlet VATEndFrame: f32=bakedVertexAnimationSettingsInstanced.y;\nlet VATOffsetFrame: f32=bakedVertexAnimationSettingsInstanced.z;\nlet VATSpeed: f32=bakedVertexAnimationSettingsInstanced.w;\n#else\nlet VATStartFrame: f32=uniforms.bakedVertexAnimationSettings.x;\nlet VATEndFrame: f32=uniforms.bakedVertexAnimationSettings.y;\nlet VATOffsetFrame: f32=uniforms.bakedVertexAnimationSettings.z;\nlet VATSpeed: f32=uniforms.bakedVertexAnimationSettings.w;\n#endif\nlet totalFrames: f32=VATEndFrame-VATStartFrame+1.0;\nlet time: f32=uniforms.bakedVertexAnimationTime*VATSpeed/totalFrames;\nlet frameCorrection: f32=select(1.0,0.0,time<1.0);\nlet numOfFrames: f32=totalFrames-frameCorrection;\nvar VATFrameNum: f32=fract(time)*numOfFrames;\nVATFrameNum=(VATFrameNum+VATOffsetFrame) % numOfFrames;\nVATFrameNum=floor(VATFrameNum);\nVATFrameNum=VATFrameNum+VATStartFrame+frameCorrection;\nvar VATInfluence : mat4x4;\nVATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[0],VATFrameNum)*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[1],VATFrameNum)*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[2],VATFrameNum)*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[3],VATFrameNum)*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[0],VATFrameNum)*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[1],VATFrameNum)*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[2],VATFrameNum)*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[3],VATFrameNum)*matricesWeightsExtra[3];\n#endif\nfinalWorld=finalWorld*VATInfluence;\n}\n#endif\n";dt.v.IncludesShadersStoreWGSL.clipPlaneFragment="#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nif (false) {}\n#endif\n#ifdef CLIPPLANE\nelse if (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nelse if (fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nelse if (fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nelse if (fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE5\nelse if (fClipDistance5>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE6\nelse if (fClipDistance6>0.0)\n{\ndiscard;\n}\n#endif\n";dt.v.IncludesShadersStoreWGSL.clipPlaneFragmentDeclaration="#ifdef CLIPPLANE\nvarying fClipDistance: f32;\n#endif\n#ifdef CLIPPLANE2\nvarying fClipDistance2: f32;\n#endif\n#ifdef CLIPPLANE3\nvarying fClipDistance3: f32;\n#endif\n#ifdef CLIPPLANE4\nvarying fClipDistance4: f32;\n#endif\n#ifdef CLIPPLANE5\nvarying fClipDistance5: f32;\n#endif\n#ifdef CLIPPLANE6\nvarying fClipDistance6: f32;\n#endif\n";dt.v.IncludesShadersStoreWGSL.clipPlaneVertex="#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,uniforms.vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,uniforms.vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,uniforms.vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,uniforms.vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nfClipDistance5=dot(worldPos,uniforms.vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nfClipDistance6=dot(worldPos,uniforms.vClipPlane6);\n#endif\n";dt.v.IncludesShadersStoreWGSL.clipPlaneVertexDeclaration="#ifdef CLIPPLANE\nuniform vClipPlane: vec4;\nvarying fClipDistance: f32;\n#endif\n#ifdef CLIPPLANE2\nuniform vClipPlane2: vec4;\nvarying fClipDistance2: f32;\n#endif\n#ifdef CLIPPLANE3\nuniform vClipPlane3: vec4;\nvarying fClipDistance3: f32;\n#endif\n#ifdef CLIPPLANE4\nuniform vClipPlane4: vec4;\nvarying fClipDistance4: f32;\n#endif\n#ifdef CLIPPLANE5\nuniform vClipPlane5: vec4;\nvarying fClipDistance5: f32;\n#endif\n#ifdef CLIPPLANE6\nuniform vClipPlane6: vec4;\nvarying fClipDistance6: f32;\n#endif\n";dt.v.IncludesShadersStoreWGSL.instancesDeclaration="#ifdef INSTANCES\nattribute world0 : vec4;\nattribute world1 : vec4;\nattribute world2 : vec4;\nattribute world3 : vec4;\n#ifdef INSTANCESCOLOR\nattribute instanceColor : vec4;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform world : mat4x4;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nattribute previousWorld0 : vec4;\nattribute previousWorld1 : vec4;\nattribute previousWorld2 : vec4;\nattribute previousWorld3 : vec4;\n#ifdef THIN_INSTANCES\nuniform previousWorld : mat4x4;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform world : mat4x4;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nuniform previousWorld : mat4x4;\n#endif\n#endif\n";dt.v.IncludesShadersStoreWGSL.instancesVertex="#ifdef INSTANCES\nvar finalWorld=mat4x4(world0,world1,world2,world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nvar finalPreviousWorld=mat4x4(previousWorld0,previousWorld1,previousWorld2,previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\n#if !defined(WORLD_UBO)\nfinalWorld=uniforms.world*finalWorld;\n#else\nfinalWorld=mesh.world*finalWorld;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nvar finalWorld=uniforms.world;\n#else\nvar finalWorld=mesh.world;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nvar finalPreviousWorld=previousWorld;\n#endif\n#endif\n";dt.v.IncludesShadersStoreWGSL.meshUboDeclaration="struct Mesh {\nworld : mat4x4,\nvisibility : f32,\n};\nvar mesh : Mesh;\n#define WORLD_UBO\n";dt.v.IncludesShadersStoreWGSL.morphTargetsVertex="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE \nvertexID=f32(gl_VertexID)*uniforms.morphTargetTextureInfo.x;\npositionUpdated=positionUpdated+(readVector3FromRawSampler({X},vertexID)-position)*uniforms.morphTargetInfluences[{X}];\nvertexID=vertexID+1.0;\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated=normalUpdated+(readVector3FromRawSampler({X},vertexID) -normal)*uniforms.morphTargetInfluences[{X}];\nvertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(readVector3FromRawSampler({X},vertexID).xy-uv)*uniforms.morphTargetInfluences[{X}];\nvertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz=tangentUpdated.xyz+(readVector3FromRawSampler({X},vertexID) -tangent.xyz)*uniforms.morphTargetInfluences[{X}];\n#endif\n#else\npositionUpdated=positionUpdated+(position{X}-position)*uniforms.morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz=tangentUpdated.xyz+(tangent{X}-tangent.xyz)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(uv_{X}-uv)*uniforms.morphTargetInfluences[{X}];\n#endif\n#endif\n#endif\n";dt.v.IncludesShadersStoreWGSL.morphTargetsVertexDeclaration="#ifdef MORPHTARGETS\n#ifndef MORPHTARGETS_TEXTURE\nattribute position{X} : vec3;\n#ifdef MORPHTARGETS_NORMAL\nattribute normal{X} : vec3;\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute tangent{X} : vec3;\n#endif\n#ifdef MORPHTARGETS_UV\nattribute uv_{X} : vec2;\n#endif\n#endif\n#endif\n";dt.v.IncludesShadersStoreWGSL.morphTargetsVertexGlobal="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\nvar vertexID : f32;\n#endif\n#endif\n";dt.v.IncludesShadersStoreWGSL.morphTargetsVertexGlobalDeclaration="#ifdef MORPHTARGETS\nuniform morphTargetInfluences : array;\n#ifdef MORPHTARGETS_TEXTURE \nuniform morphTargetTextureIndices : array;\nuniform morphTargetTextureInfo : vec3;\nvar morphTargets : texture_2d_array;\nvar morphTargetsSampler : sampler;\nfn readVector3FromRawSampler(targetIndex : i32,vertexIndex : f32)->vec3\n{ \nlet y=floor(vertexIndex/uniforms.morphTargetTextureInfo.y);\nlet x=vertexIndex-y*uniforms.morphTargetTextureInfo.y;\nlet textureUV=vec2((x+0.5)/uniforms.morphTargetTextureInfo.y,(y+0.5)/uniforms.morphTargetTextureInfo.z);\nreturn textureSampleLevel(morphTargets,morphTargetsSampler,textureUV,i32(uniforms.morphTargetTextureIndices[targetIndex]),0.0).xyz;\n}\n#endif\n#endif\n";dt.v.IncludesShadersStoreWGSL.sceneUboDeclaration="struct Scene {\nviewProjection : mat4x4,\n#ifdef MULTIVIEW\nviewProjectionR : mat4x4,\n#endif \nview : mat4x4,\nprojection : mat4x4,\nvEyePosition : vec4,\n};\nvar scene : Scene;\n";const Gr="gl_FragDepth",jr={texture_1d:rr.E1d,texture_2d:rr.E2d,texture_2d_array:rr.E2dArray,texture_3d:rr.E3d,texture_cube:rr.Cube,texture_cube_array:rr.CubeArray,texture_multisampled_2d:rr.E2d,texture_depth_2d:rr.E2d,texture_depth_2d_array:rr.E2dArray,texture_depth_cube:rr.Cube,texture_depth_cube_array:rr.CubeArray,texture_depth_multisampled_2d:rr.E2d,texture_storage_1d:rr.E1d,texture_storage_2d:rr.E2d,texture_storage_2d_array:rr.E2dArray,texture_storage_3d:rr.E3d,texture_external:null};class Wr extends Nr{constructor(){super(...arguments),this.shaderLanguage=Di.x.WGSL,this.uniformRegexp=/uniform\s+(\w+)\s*:\s*(.+)\s*;/,this.textureRegexp=/var\s+(\w+)\s*:\s*((array<\s*)?(texture_\w+)\s*(<\s*(.+)\s*>)?\s*(,\s*\w+\s*>\s*)?);/,this.noPrecision=!0}_getArraySize(e,t,i){let n=0;const r=t.lastIndexOf(">");if(t.indexOf("array")>=0&&r>0){let e=r;for(;e>0&&" "!==t.charAt(e)&&","!==t.charAt(e);)e--;const s=t.substring(e+1,r);for(n=+s,isNaN(n)&&(n=+i[s.trim()]);e>0&&(" "===t.charAt(e)||","===t.charAt(e));)e--;t=t.substring(t.indexOf("<")+1,e+1)}return[e,t,n]}initializeShaders(e){this._webgpuProcessingContext=e,this._attributesWGSL=[],this._attributesDeclWGSL=[],this._attributeNamesWGSL=[],this._varyingsWGSL=[],this._varyingsDeclWGSL=[],this._varyingNamesWGSL=[],this._stridedUniformArrays=[]}preProcessShaderCode(e){return`struct ${Nr.InternalsUBOName} {\nyFactor_: f32,\ntextureOutputHeight_: f32,\n};\nvar internals : ${Nr.InternalsUBOName};\n`+Vn(e)}varyingProcessor(e,t,i){const n=/\s*varying\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s*:\s*(.+)\s*;/gm.exec(e);if(null!==n){const r=n[2],s=n[1];let o;t?(o=this._webgpuProcessingContext.availableVaryings[s],void 0===o&&u.Y.Warn(`Invalid fragment shader: The varying named "${s}" is not declared in the vertex shader! This declaration will be ignored.`)):(o=this._webgpuProcessingContext.getVaryingNextLocation(r,this._getArraySize(s,r,i)[2]),this._webgpuProcessingContext.availableVaryings[s]=o,this._varyingsWGSL.push(`@location(${o}) ${s} : ${r},`),this._varyingsDeclWGSL.push(`var ${s} : ${r};`),this._varyingNamesWGSL.push(s)),e=""}return e}attributeProcessor(e,t){const i=/\s*attribute\s+(\S+)\s*:\s*(.+)\s*;/gm.exec(e);if(null!==i){const n=i[2],r=i[1],s=this._webgpuProcessingContext.getAttributeNextLocation(n,this._getArraySize(r,n,t)[2]);this._webgpuProcessingContext.availableAttributes[r]=s,this._webgpuProcessingContext.orderedAttributes[s]=r,this._attributesWGSL.push(`@location(${s}) ${r} : ${n},`),this._attributesDeclWGSL.push(`var ${r} : ${n};`),this._attributeNamesWGSL.push(r),e=""}return e}uniformProcessor(e,t,i){const n=this.uniformRegexp.exec(e);if(null!==n){const t=n[2],r=n[1];this._addUniformToLeftOverUBO(r,t,i),e=""}return e}textureProcessor(e,t,i){const n=this.textureRegexp.exec(e);if(null!==n){const r=n[1],s=n[2],o=!!n[3],a=n[4],l=a.indexOf("storage")>0,c=n[6],h=l?c.substring(0,c.indexOf(",")).trim():null;let _=o?this._getArraySize(r,s,i)[2]:0,d=this._webgpuProcessingContext.availableTextures[r];if(d)_=d.textures.length;else{d={isTextureArray:_>0,isStorageTexture:l,textures:[],sampleType:ur.Float},_=_||1;for(let e=0;e<_;++e)d.textures.push(this._webgpuProcessingContext.getNextFreeUBOBinding())}this._webgpuProcessingContext.availableTextures[r]=d;const u=a.indexOf("depth")>0,p=jr[a],f=u?ur.Depth:"u32"===c?ur.Uint:"i32"===c?ur.Sint:ur.Float;if(d.sampleType=f,void 0===p)throw`Can't get the texture dimension corresponding to the texture function "${a}"!`;for(let i=0;i<_;++i){const{groupIndex:n,bindingIndex:s}=d.textures[i];0===i&&(e=`@group(${n}) @binding(${s}) ${e}`),this._addTextureBindingDescription(r,d,i,p,h,!t)}}return e}postProcessor(e){return e}finalizeShaders(e,t){const i=t.indexOf("gl_FragCoord")>=0?"\n if (internals.yFactor_ == 1.) {\n gl_FragCoord.y = internals.textureOutputHeight_ - gl_FragCoord.y;\n }\n ":"";e=this._processSamplers(e,!0),t=this._processSamplers(t,!1),e=this._processCustomBuffers(e,!0),t=this._processCustomBuffers(t,!1);const n=this._buildLeftOverUBO();t=n+t,e=(e=n+e).replace(/#define /g,"//#define "),e=this._processStridedUniformArrays(e);const r=this._varyingsDeclWGSL.join("\n")+"\n",s=this._attributesDeclWGSL.join("\n")+"\n";let o="struct VertexInputs {\n @builtin(vertex_index) vertexIndex : u32,\n @builtin(instance_index) instanceIndex : u32,\n";this._attributesWGSL.length>0&&(o+=this._attributesWGSL.join("\n")),o+="\n};\n";let a="struct FragmentInputs {\n @builtin(position) position : vec4,\n";this._varyingsWGSL.length>0&&(a+=this._varyingsWGSL.join("\n")),a+="\n};\n",e="var gl_VertexID : u32;\nvar gl_InstanceID : u32;\nvar gl_Position : vec4;\n"+o+s+a+r+e;let l=" var output : FragmentInputs;\n gl_VertexID = input.vertexIndex;\n gl_InstanceID = input.instanceIndex;\n";for(let e=0;e0&&(h+=this._varyingsWGSL.join("\n")),h+="\n};\n";let _="struct FragmentOutputs {\n @location(0) color : vec4,\n",d=!1,u=0;for(;!(d||(u=t.indexOf(Gr,u),u<0));){const e=u;for(d=!0;u>1&&"\n"!==t.charAt(u);){if("/"===t.charAt(u)&&"/"===t.charAt(u-1)){d=!1;break}u--}u=e+Gr.length}d&&(_+=" @builtin(frag_depth) fragDepth: f32,\n"),_+="};\n",t="var gl_FragCoord : vec4;\nvar gl_FrontFacing : bool;\nvar gl_FragColor : vec4;\nvar gl_FragDepth : f32;\n"+h+r+_+t;let p=" var output : FragmentOutputs;\n gl_FragCoord = input.position;\n gl_FrontFacing = input.frontFacing;\n"+i;for(let e=0;e)?$/,"$1"),s=Nr.UniformSizes[r];if(t.length>0)if(s<=2){const s=`${e}_${this._stridedUniformArrays.length}_strided_arr`;i+=`struct ${s} {\n @size(16)\n el: ${r},\n }`,this._stridedUniformArrays.push(t.name),n+=` @align(16) ${t.name} : array<${s}, ${t.length}>,\n`}else n+=` ${t.name} : array<${t.type}, ${t.length}>,\n`;else n+=` ${t.name} : ${t.type},\n`}return n+="};\n",n=`${i}\n${n}`,n+=`@group(${t.binding.groupIndex}) @binding(${t.binding.bindingIndex}) var uniforms : ${e};\n`,n}_processSamplers(e,t){const i=/var\s+(\w+Sampler)\s*:\s*(sampler|sampler_comparison)\s*;/gm;for(;;){const n=i.exec(e);if(null===n)break;const r=n[1],s=n[2],o=r.indexOf(Nr.AutoSamplerSuffix)===r.length-Nr.AutoSamplerSuffix.length?r.substring(0,r.indexOf(Nr.AutoSamplerSuffix)):null,a="sampler_comparison"===s?dr.Comparison:dr.Filtering;if(o){const e=this._webgpuProcessingContext.availableTextures[o];e&&(e.autoBindSampler=!0)}let l=this._webgpuProcessingContext.availableSamplers[r];l||(l={binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:a},this._webgpuProcessingContext.availableSamplers[r]=l),this._addSamplerBindingDescription(r,l,t);const c=e.substring(0,n.index),h=`@group(${l.binding.groupIndex}) @binding(${l.binding.bindingIndex}) `,_=e.substring(n.index);e=c+h+_,i.lastIndex+=h.length}return e}_processCustomBuffers(e,t){const i=/var<\s*(uniform|storage)\s*(,\s*(read|read_write)\s*)?>\s+(\S+)\s*:\s*(\S+)\s*;/gm;for(;;){const n=i.exec(e);if(null===n)break;const r=n[1],s=n[3];let o=n[4];const a=n[5];let l=this._webgpuProcessingContext.availableBuffers[o];if(!l){const e="uniform"===r?Vr.KnownUBOs[a]:null;let t;e?(o=a,t=e.binding,-1===t.groupIndex&&(t=this._webgpuProcessingContext.getNextFreeUBOBinding())):t=this._webgpuProcessingContext.getNextFreeUBOBinding(),l={binding:t},this._webgpuProcessingContext.availableBuffers[o]=l}this._addBufferBindingDescription(o,this._webgpuProcessingContext.availableBuffers[o],"read_write"===s?_r.Storage:"storage"===r?_r.ReadOnlyStorage:_r.Uniform,t);const c=l.binding.groupIndex,h=l.binding.bindingIndex,_=e.substring(0,n.index),d=`@group(${c}) @binding(${h}) `,u=e.substring(n.index);e=_+d+u,i.lastIndex+=d.length}return e}_processStridedUniformArrays(e){for(const t of this._stridedUniformArrays)e=e.replace(new RegExp(`${t}\\s*\\[(.*)\\]`,"g"),`${t}[$1].el`);return e}}class zr{constructor(e=null){this.format=or.RGBA8Unorm,this.textureUsages=0,this.textureAdditionalUsages=0,this._webgpuTexture=e,this._webgpuMSAATexture=null,this.view=null,this.viewForWriting=null}get underlyingResource(){return this._webgpuTexture}get msaaTexture(){return this._webgpuMSAATexture}set msaaTexture(e){this._webgpuMSAATexture=e}set(e){this._webgpuTexture=e}setUsage(e,t,i,n,r){t=e!==Mt.S.RenderTarget&&t,this.createView({format:this.format,dimension:i?rr.Cube:rr.E2d,mipLevelCount:t?ve.R.ILog2(Math.max(n,r))+1:1,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:i?6:1,aspect:sr.All})}createView(e,t=!1){if(this.view=this._webgpuTexture.createView(e),t&&e){const t=e.mipLevelCount;e.mipLevelCount=1,this.viewForWriting=this._webgpuTexture.createView(e),e.mipLevelCount=t}}reset(){this._webgpuTexture=null,this._webgpuMSAATexture=null,this.view=null,this.viewForWriting=null}release(){var e,t,i;null===(e=this._webgpuTexture)||void 0===e||e.destroy(),null===(t=this._webgpuMSAATexture)||void 0===t||t.destroy(),null===(i=this._copyInvertYTempTexture)||void 0===i||i.destroy(),this.reset()}}var Hr;!function(e){e[e.MipMap=0]="MipMap",e[e.InvertYPremultiplyAlpha=1]="InvertYPremultiplyAlpha",e[e.Clear=2]="Clear",e[e.InvertYPremultiplyAlphaWithOfst=3]="InvertYPremultiplyAlphaWithOfst"}(Hr||(Hr={}));const Xr=[{vertex:"\n const vec2 pos[4] = vec2[4](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f), vec2(1.0f, -1.0f));\n const vec2 tex[4] = vec2[4](vec2(0.0f, 0.0f), vec2(1.0f, 0.0f), vec2(0.0f, 1.0f), vec2(1.0f, 1.0f));\n\n layout(location = 0) out vec2 vTex;\n\n void main() {\n vTex = tex[gl_VertexIndex];\n gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n }\n ",fragment:"\n layout(set = 0, binding = 0) uniform sampler imgSampler;\n layout(set = 0, binding = 1) uniform texture2D img;\n\n layout(location = 0) in vec2 vTex;\n layout(location = 0) out vec4 outColor;\n\n void main() {\n outColor = texture(sampler2D(img, imgSampler), vTex);\n }\n "},{vertex:"\n #extension GL_EXT_samplerless_texture_functions : enable\n\n const vec2 pos[4] = vec2[4](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f), vec2(1.0f, -1.0f));\n const vec2 tex[4] = vec2[4](vec2(0.0f, 0.0f), vec2(1.0f, 0.0f), vec2(0.0f, 1.0f), vec2(1.0f, 1.0f));\n\n layout(set = 0, binding = 0) uniform texture2D img;\n\n #ifdef INVERTY\n layout(location = 0) out flat ivec2 vTextureSize;\n #endif\n\n void main() {\n #ifdef INVERTY\n vTextureSize = textureSize(img, 0);\n #endif\n gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n }\n ",fragment:"\n #extension GL_EXT_samplerless_texture_functions : enable\n\n layout(set = 0, binding = 0) uniform texture2D img;\n\n #ifdef INVERTY\n layout(location = 0) in flat ivec2 vTextureSize;\n #endif\n layout(location = 0) out vec4 outColor;\n\n void main() {\n #ifdef INVERTY\n vec4 color = texelFetch(img, ivec2(gl_FragCoord.x, vTextureSize.y - gl_FragCoord.y), 0);\n #else\n vec4 color = texelFetch(img, ivec2(gl_FragCoord.xy), 0);\n #endif\n #ifdef PREMULTIPLYALPHA\n color.rgb *= color.a;\n #endif\n outColor = color;\n }\n "},{vertex:"\n const vec2 pos[4] = vec2[4](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f), vec2(1.0f, -1.0f));\n\n void main() {\n gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n }\n ",fragment:"\n layout(set = 0, binding = 0) uniform Uniforms {\n uniform vec4 color;\n };\n\n layout(location = 0) out vec4 outColor;\n\n void main() {\n outColor = color;\n }\n "},{vertex:"\n #extension GL_EXT_samplerless_texture_functions : enable\n\n const vec2 pos[4] = vec2[4](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f), vec2(1.0f, -1.0f));\n const vec2 tex[4] = vec2[4](vec2(0.0f, 0.0f), vec2(1.0f, 0.0f), vec2(0.0f, 1.0f), vec2(1.0f, 1.0f));\n\n layout(set = 0, binding = 0) uniform texture2D img;\n\n #ifdef INVERTY\n layout(location = 0) out flat ivec2 vTextureSize;\n #endif\n\n void main() {\n #ifdef INVERTY\n vTextureSize = textureSize(img, 0);\n #endif\n gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n }\n ",fragment:"\n #extension GL_EXT_samplerless_texture_functions : enable\n\n layout(set = 0, binding = 0) uniform texture2D img;\n layout(set = 0, binding = 1) uniform Params {\n float ofstX;\n float ofstY;\n float width;\n float height;\n };\n\n #ifdef INVERTY\n layout(location = 0) in flat ivec2 vTextureSize;\n #endif\n layout(location = 0) out vec4 outColor;\n\n void main() {\n if (gl_FragCoord.x < ofstX || gl_FragCoord.x >= ofstX + width) {\n discard;\n }\n if (gl_FragCoord.y < ofstY || gl_FragCoord.y >= ofstY + height) {\n discard;\n }\n #ifdef INVERTY\n vec4 color = texelFetch(img, ivec2(gl_FragCoord.x, ofstY + height - (gl_FragCoord.y - ofstY)), 0);\n #else\n vec4 color = texelFetch(img, ivec2(gl_FragCoord.xy), 0);\n #endif\n #ifdef PREMULTIPLYALPHA\n color.rgb *= color.a;\n #endif\n outColor = color;\n }\n "}],Yr={"":0,r8unorm:1,r8uint:2,r8sint:3,r16uint:4,r16sint:5,r16float:6,rg8unorm:7,rg8uint:8,rg8sint:9,r32uint:10,r32sint:11,r32float:12,rg16uint:13,rg16sint:14,rg16float:15,rgba8unorm:16,"rgba8unorm-srgb":17,rgba8uint:18,rgba8sint:19,bgra8unorm:20,"bgra8unorm-srgb":21,rgb10a2unorm:22,rg32uint:23,rg32sint:24,rg32float:25,rgba16uint:26,rgba16sint:27,rgba16float:28,rgba32uint:29,rgba32sint:30,rgba32float:31,stencil8:32,depth16unorm:33,depth24plus:34,"depth24plus-stencil8":35,depth32float:36,"depth24unorm-stencil8":37,"depth32float-stencil8":38};class Qr{constructor(e,t,i,n){this._pipelines={},this._compiledShaders=[],this._deferredReleaseTextures=[],this._device=e,this._glslang=t,this._tintWASM=i,this._bufferManager=n,this._mipmapSampler=e.createSampler({minFilter:lr.Linear}),this._ubCopyWithOfst=this._bufferManager.createBuffer(16,er.Uniform|er.CopyDst).underlyingResource,this._getPipeline(or.RGBA8Unorm)}static ComputeNumMipmapLevels(e,t){return ve.R.ILog2(Math.max(e,t))+1}_getPipeline(e,t=Hr.MipMap,i){const n=t===Hr.MipMap?1:t===Hr.InvertYPremultiplyAlpha?((i.invertY?1:0)<<1)+((i.premultiplyAlpha?1:0)<<2):t===Hr.Clear?8:t===Hr.InvertYPremultiplyAlphaWithOfst?((i.invertY?1:0)<<4)+((i.premultiplyAlpha?1:0)<<5):0;this._pipelines[e]||(this._pipelines[e]=[]);let r=this._pipelines[e][n];if(!r){let s="#version 450\r\n";t!==Hr.InvertYPremultiplyAlpha&&t!==Hr.InvertYPremultiplyAlphaWithOfst||(i.invertY&&(s+="#define INVERTY\r\n"),i.premultiplyAlpha&&(s+="#define PREMULTIPLYALPHA\r\n"));let o=this._compiledShaders[n];if(!o){let e=this._glslang.compileGLSL(s+Xr[t].vertex,"vertex"),i=this._glslang.compileGLSL(s+Xr[t].fragment,"fragment");this._tintWASM&&(e=this._tintWASM.convertSpirV2WGSL(e),i=this._tintWASM.convertSpirV2WGSL(i));const r=this._device.createShaderModule({code:e}),a=this._device.createShaderModule({code:i});o=this._compiledShaders[n]=[r,a]}const a=this._device.createRenderPipeline({layout:mr.Auto,vertex:{module:o[0],entryPoint:"main"},fragment:{module:o[1],entryPoint:"main",targets:[{format:e}]},primitive:{topology:gr.TriangleStrip,stripIndexFormat:xr.Uint16}});r=this._pipelines[e][n]=[a,a.getBindGroupLayout(0)]}return r}static _GetTextureTypeFromFormat(e){switch(e){case or.R8Unorm:case or.R8Snorm:case or.R8Uint:case or.R8Sint:case or.RG8Unorm:case or.RG8Snorm:case or.RG8Uint:case or.RG8Sint:case or.RGBA8Unorm:case or.RGBA8UnormSRGB:case or.RGBA8Snorm:case or.RGBA8Uint:case or.RGBA8Sint:case or.BGRA8Unorm:case or.BGRA8UnormSRGB:case or.RGB10A2Unorm:case or.RGB9E5UFloat:case or.RG11B10UFloat:case or.Depth24UnormStencil8:case or.Depth32FloatStencil8:case or.BC7RGBAUnorm:case or.BC7RGBAUnormSRGB:case or.BC6HRGBUFloat:case or.BC6HRGBFloat:case or.BC5RGUnorm:case or.BC5RGSnorm:case or.BC3RGBAUnorm:case or.BC3RGBAUnormSRGB:case or.BC2RGBAUnorm:case or.BC2RGBAUnormSRGB:case or.BC4RUnorm:case or.BC4RSnorm:case or.BC1RGBAUnorm:case or.BC1RGBAUnormSRGB:case or.ETC2RGB8Unorm:case or.ETC2RGB8UnormSRGB:case or.ETC2RGB8A1Unorm:case or.ETC2RGB8A1UnormSRGB:case or.ETC2RGBA8Unorm:case or.ETC2RGBA8UnormSRGB:case or.EACR11Unorm:case or.EACR11Snorm:case or.EACRG11Unorm:case or.EACRG11Snorm:case or.ASTC4x4Unorm:case or.ASTC4x4UnormSRGB:case or.ASTC5x4Unorm:case or.ASTC5x4UnormSRGB:case or.ASTC5x5Unorm:case or.ASTC5x5UnormSRGB:case or.ASTC6x5Unorm:case or.ASTC6x5UnormSRGB:case or.ASTC6x6Unorm:case or.ASTC6x6UnormSRGB:case or.ASTC8x5Unorm:case or.ASTC8x5UnormSRGB:case or.ASTC8x6Unorm:case or.ASTC8x6UnormSRGB:case or.ASTC8x8Unorm:case or.ASTC8x8UnormSRGB:case or.ASTC10x5Unorm:case or.ASTC10x5UnormSRGB:case or.ASTC10x6Unorm:case or.ASTC10x6UnormSRGB:case or.ASTC10x8Unorm:case or.ASTC10x8UnormSRGB:case or.ASTC10x10Unorm:case or.ASTC10x10UnormSRGB:case or.ASTC12x10Unorm:case or.ASTC12x10UnormSRGB:case or.ASTC12x12Unorm:case or.ASTC12x12UnormSRGB:return 0;case or.R16Uint:case or.R16Sint:case or.RG16Uint:case or.RG16Sint:case or.RGBA16Uint:case or.RGBA16Sint:case or.Depth16Unorm:return 5;case or.R16Float:case or.RG16Float:case or.RGBA16Float:return 2;case or.R32Uint:case or.R32Sint:case or.RG32Uint:case or.RG32Sint:case or.RGBA32Uint:case or.RGBA32Sint:return 7;case or.R32Float:case or.RG32Float:case or.RGBA32Float:case or.Depth32Float:return 1;case or.Stencil8:throw"No fixed size for Stencil8 format!";case or.Depth24Plus:throw"No fixed size for Depth24Plus format!";case or.Depth24PlusStencil8:throw"No fixed size for Depth24PlusStencil8 format!"}return 0}static _GetBlockInformationFromFormat(e){switch(e){case or.R8Unorm:case or.R8Snorm:case or.R8Uint:case or.R8Sint:return{width:1,height:1,length:1};case or.R16Uint:case or.R16Sint:case or.R16Float:case or.RG8Unorm:case or.RG8Snorm:case or.RG8Uint:case or.RG8Sint:return{width:1,height:1,length:2};case or.R32Uint:case or.R32Sint:case or.R32Float:case or.RG16Uint:case or.RG16Sint:case or.RG16Float:case or.RGBA8Unorm:case or.RGBA8UnormSRGB:case or.RGBA8Snorm:case or.RGBA8Uint:case or.RGBA8Sint:case or.BGRA8Unorm:case or.BGRA8UnormSRGB:case or.RGB9E5UFloat:case or.RGB10A2Unorm:case or.RG11B10UFloat:return{width:1,height:1,length:4};case or.RG32Uint:case or.RG32Sint:case or.RG32Float:case or.RGBA16Uint:case or.RGBA16Sint:case or.RGBA16Float:return{width:1,height:1,length:8};case or.RGBA32Uint:case or.RGBA32Sint:case or.RGBA32Float:return{width:1,height:1,length:16};case or.Stencil8:throw"No fixed size for Stencil8 format!";case or.Depth16Unorm:return{width:1,height:1,length:2};case or.Depth24Plus:throw"No fixed size for Depth24Plus format!";case or.Depth24PlusStencil8:throw"No fixed size for Depth24PlusStencil8 format!";case or.Depth32Float:case or.Depth24UnormStencil8:return{width:1,height:1,length:4};case or.Depth32FloatStencil8:return{width:1,height:1,length:5};case or.BC7RGBAUnorm:case or.BC7RGBAUnormSRGB:case or.BC6HRGBUFloat:case or.BC6HRGBFloat:case or.BC5RGUnorm:case or.BC5RGSnorm:case or.BC3RGBAUnorm:case or.BC3RGBAUnormSRGB:case or.BC2RGBAUnorm:case or.BC2RGBAUnormSRGB:return{width:4,height:4,length:16};case or.BC4RUnorm:case or.BC4RSnorm:case or.BC1RGBAUnorm:case or.BC1RGBAUnormSRGB:case or.ETC2RGB8Unorm:case or.ETC2RGB8UnormSRGB:case or.ETC2RGB8A1Unorm:case or.ETC2RGB8A1UnormSRGB:case or.EACR11Unorm:case or.EACR11Snorm:return{width:4,height:4,length:8};case or.ETC2RGBA8Unorm:case or.ETC2RGBA8UnormSRGB:case or.EACRG11Unorm:case or.EACRG11Snorm:case or.ASTC4x4Unorm:case or.ASTC4x4UnormSRGB:return{width:4,height:4,length:16};case or.ASTC5x4Unorm:case or.ASTC5x4UnormSRGB:return{width:5,height:4,length:16};case or.ASTC5x5Unorm:case or.ASTC5x5UnormSRGB:return{width:5,height:5,length:16};case or.ASTC6x5Unorm:case or.ASTC6x5UnormSRGB:return{width:6,height:5,length:16};case or.ASTC6x6Unorm:case or.ASTC6x6UnormSRGB:return{width:6,height:6,length:16};case or.ASTC8x5Unorm:case or.ASTC8x5UnormSRGB:return{width:8,height:5,length:16};case or.ASTC8x6Unorm:case or.ASTC8x6UnormSRGB:return{width:8,height:6,length:16};case or.ASTC8x8Unorm:case or.ASTC8x8UnormSRGB:return{width:8,height:8,length:16};case or.ASTC10x5Unorm:case or.ASTC10x5UnormSRGB:return{width:10,height:5,length:16};case or.ASTC10x6Unorm:case or.ASTC10x6UnormSRGB:return{width:10,height:6,length:16};case or.ASTC10x8Unorm:case or.ASTC10x8UnormSRGB:return{width:10,height:8,length:16};case or.ASTC10x10Unorm:case or.ASTC10x10UnormSRGB:return{width:10,height:10,length:16};case or.ASTC12x10Unorm:case or.ASTC12x10UnormSRGB:return{width:12,height:10,length:16};case or.ASTC12x12Unorm:case or.ASTC12x12UnormSRGB:return{width:12,height:12,length:16}}return{width:1,height:1,length:4}}static _IsHardwareTexture(e){return!!e.release}static _IsInternalTexture(e){return!!e.dispose}static IsImageBitmap(e){return void 0!==e.close}static IsImageBitmapArray(e){return Array.isArray(e)&&void 0!==e[0].close}setCommandEncoder(e){this._commandEncoderForCreation=e}static IsCompressedFormat(e){switch(e){case or.BC7RGBAUnormSRGB:case or.BC7RGBAUnorm:case or.BC6HRGBFloat:case or.BC6HRGBUFloat:case or.BC5RGSnorm:case or.BC5RGUnorm:case or.BC4RSnorm:case or.BC4RUnorm:case or.BC3RGBAUnormSRGB:case or.BC3RGBAUnorm:case or.BC2RGBAUnormSRGB:case or.BC2RGBAUnorm:case or.BC1RGBAUnormSRGB:case or.BC1RGBAUnorm:case or.ETC2RGB8Unorm:case or.ETC2RGB8UnormSRGB:case or.ETC2RGB8A1Unorm:case or.ETC2RGB8A1UnormSRGB:case or.ETC2RGBA8Unorm:case or.ETC2RGBA8UnormSRGB:case or.EACR11Unorm:case or.EACR11Snorm:case or.EACRG11Unorm:case or.EACRG11Snorm:case or.ASTC4x4Unorm:case or.ASTC4x4UnormSRGB:case or.ASTC5x4Unorm:case or.ASTC5x4UnormSRGB:case or.ASTC5x5Unorm:case or.ASTC5x5UnormSRGB:case or.ASTC6x5Unorm:case or.ASTC6x5UnormSRGB:case or.ASTC6x6Unorm:case or.ASTC6x6UnormSRGB:case or.ASTC8x5Unorm:case or.ASTC8x5UnormSRGB:case or.ASTC8x6Unorm:case or.ASTC8x6UnormSRGB:case or.ASTC8x8Unorm:case or.ASTC8x8UnormSRGB:case or.ASTC10x5Unorm:case or.ASTC10x5UnormSRGB:case or.ASTC10x6Unorm:case or.ASTC10x6UnormSRGB:case or.ASTC10x8Unorm:case or.ASTC10x8UnormSRGB:case or.ASTC10x10Unorm:case or.ASTC10x10UnormSRGB:case or.ASTC12x10Unorm:case or.ASTC12x10UnormSRGB:case or.ASTC12x12Unorm:case or.ASTC12x12UnormSRGB:return!0}return!1}static GetWebGPUTextureFormat(e,t,i=!1){switch(t){case 15:return or.Depth16Unorm;case 16:return or.Depth24Plus;case 13:return or.Depth24PlusStencil8;case 14:return or.Depth32Float;case 17:return or.Depth24UnormStencil8;case 18:return or.Depth32FloatStencil8;case 36492:return i?or.BC7RGBAUnormSRGB:or.BC7RGBAUnorm;case 36495:return or.BC6HRGBUFloat;case 36494:return or.BC6HRGBFloat;case 33779:return i?or.BC3RGBAUnormSRGB:or.BC3RGBAUnorm;case 33778:return i?or.BC2RGBAUnormSRGB:or.BC2RGBAUnorm;case 33777:case 33776:return i?or.BC1RGBAUnormSRGB:or.BC1RGBAUnorm;case 37808:return i?or.ASTC4x4UnormSRGB:or.ASTC4x4Unorm;case 36196:case 37492:return i?or.ETC2RGB8UnormSRGB:or.ETC2RGB8Unorm;case 37496:return i?or.ETC2RGBA8UnormSRGB:or.ETC2RGBA8Unorm}switch(e){case 3:switch(t){case 6:return or.R8Snorm;case 7:return or.RG8Snorm;case 4:throw"RGB format not supported in WebGPU";case 8:return or.R8Sint;case 9:return or.RG8Sint;case 10:throw"RGB_INTEGER format not supported in WebGPU";case 11:return or.RGBA8Sint;default:return or.RGBA8Snorm}case 0:switch(t){case 6:return or.R8Unorm;case 7:return or.RG8Unorm;case 4:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";case 5:return i?or.RGBA8UnormSRGB:or.RGBA8Unorm;case 12:return i?or.BGRA8UnormSRGB:or.BGRA8Unorm;case 8:return or.R8Uint;case 9:return or.RG8Uint;case 10:throw"RGB_INTEGER format not supported in WebGPU";case 11:return or.RGBA8Uint;case 0:throw"TEXTUREFORMAT_ALPHA format not supported in WebGPU";case 1:throw"TEXTUREFORMAT_LUMINANCE format not supported in WebGPU";case 2:throw"TEXTUREFORMAT_LUMINANCE_ALPHA format not supported in WebGPU";default:return or.RGBA8Unorm}case 4:switch(t){case 8:return or.R16Sint;case 9:return or.RG16Sint;case 10:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";default:return or.RGBA16Sint}case 5:switch(t){case 8:return or.R16Uint;case 9:return or.RG16Uint;case 10:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";default:return or.RGBA16Uint}case 6:switch(t){case 8:return or.R32Sint;case 9:return or.RG32Sint;case 10:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";default:return or.RGBA32Sint}case 7:switch(t){case 8:return or.R32Uint;case 9:return or.RG32Uint;case 10:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";default:return or.RGBA32Uint}case 1:switch(t){case 6:return or.R32Float;case 7:return or.RG32Float;case 4:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";default:return or.RGBA32Float}case 2:switch(t){case 6:return or.R16Float;case 7:return or.RG16Float;case 4:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";default:return or.RGBA16Float}case 10:throw"TEXTURETYPE_UNSIGNED_SHORT_5_6_5 format not supported in WebGPU";case 13:throw"TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV format not supported in WebGPU";case 14:throw"TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV format not supported in WebGPU";case 8:throw"TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 format not supported in WebGPU";case 9:throw"TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 format not supported in WebGPU";case 11:switch(t){case 5:default:return or.RGB10A2Unorm;case 11:throw"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV"}}return i?or.RGBA8UnormSRGB:or.RGBA8Unorm}static GetNumChannelsFromWebGPUTextureFormat(e){switch(e){case or.R8Unorm:case or.R8Snorm:case or.R8Uint:case or.R8Sint:case or.BC4RUnorm:case or.BC4RSnorm:case or.R16Uint:case or.R16Sint:case or.Depth16Unorm:case or.R16Float:case or.R32Uint:case or.R32Sint:case or.R32Float:case or.Depth32Float:case or.Stencil8:case or.Depth24Plus:case or.EACR11Unorm:case or.EACR11Snorm:return 1;case or.RG8Unorm:case or.RG8Snorm:case or.RG8Uint:case or.RG8Sint:case or.Depth24UnormStencil8:case or.Depth32FloatStencil8:case or.BC5RGUnorm:case or.BC5RGSnorm:case or.RG16Uint:case or.RG16Sint:case or.RG16Float:case or.RG32Uint:case or.RG32Sint:case or.RG32Float:case or.Depth24PlusStencil8:case or.EACRG11Unorm:case or.EACRG11Snorm:return 2;case or.RGB9E5UFloat:case or.RG11B10UFloat:case or.BC6HRGBUFloat:case or.BC6HRGBFloat:case or.ETC2RGB8Unorm:case or.ETC2RGB8UnormSRGB:return 3;case or.RGBA8Unorm:case or.RGBA8UnormSRGB:case or.RGBA8Snorm:case or.RGBA8Uint:case or.RGBA8Sint:case or.BGRA8Unorm:case or.BGRA8UnormSRGB:case or.RGB10A2Unorm:case or.BC7RGBAUnorm:case or.BC7RGBAUnormSRGB:case or.BC3RGBAUnorm:case or.BC3RGBAUnormSRGB:case or.BC2RGBAUnorm:case or.BC2RGBAUnormSRGB:case or.BC1RGBAUnorm:case or.BC1RGBAUnormSRGB:case or.RGBA16Uint:case or.RGBA16Sint:case or.RGBA16Float:case or.RGBA32Uint:case or.RGBA32Sint:case or.RGBA32Float:case or.ETC2RGB8A1Unorm:case or.ETC2RGB8A1UnormSRGB:case or.ETC2RGBA8Unorm:case or.ETC2RGBA8UnormSRGB:case or.ASTC4x4Unorm:case or.ASTC4x4UnormSRGB:case or.ASTC5x4Unorm:case or.ASTC5x4UnormSRGB:case or.ASTC5x5Unorm:case or.ASTC5x5UnormSRGB:case or.ASTC6x5Unorm:case or.ASTC6x5UnormSRGB:case or.ASTC6x6Unorm:case or.ASTC6x6UnormSRGB:case or.ASTC8x5Unorm:case or.ASTC8x5UnormSRGB:case or.ASTC8x6Unorm:case or.ASTC8x6UnormSRGB:case or.ASTC8x8Unorm:case or.ASTC8x8UnormSRGB:case or.ASTC10x5Unorm:case or.ASTC10x5UnormSRGB:case or.ASTC10x6Unorm:case or.ASTC10x6UnormSRGB:case or.ASTC10x8Unorm:case or.ASTC10x8UnormSRGB:case or.ASTC10x10Unorm:case or.ASTC10x10UnormSRGB:case or.ASTC12x10Unorm:case or.ASTC12x10UnormSRGB:case or.ASTC12x12Unorm:case or.ASTC12x12UnormSRGB:return 4}throw`Unknown format ${e}!`}static HasStencilAspect(e){switch(e){case or.Stencil8:case or.Depth24UnormStencil8:case or.Depth32FloatStencil8:case or.Depth24PlusStencil8:return!0}return!1}static HasDepthAndStencilAspects(e){switch(e){case or.Depth24UnormStencil8:case or.Depth32FloatStencil8:case or.Depth24PlusStencil8:return!0}return!1}invertYPreMultiplyAlpha(e,t,i,n,r=!1,s=!1,o=0,a=0,l=1,c=0,h=0,_=0,d=0,u,p){var f,m,g,b,y,v;const A=0!==_,C=void 0===u,[S,x]=this._getPipeline(n,A?Hr.InvertYPremultiplyAlphaWithOfst:Hr.InvertYPremultiplyAlpha,{invertY:r,premultiplyAlpha:s});let T;if(o=Math.max(o,0),C&&(u=this._device.createCommandEncoder({})),null===(m=(f=u).pushDebugGroup)||void 0===m||m.call(f,`internal process texture - invertY=${r} premultiplyAlpha=${s}`),Qr._IsHardwareTexture(e)?(T=e.underlyingResource,r&&!s&&1===l&&0===o||(e=void 0)):(T=e,e=void 0),!T)return;A&&this._bufferManager.setRawData(this._ubCopyWithOfst,0,new Float32Array([c,h,_,d]),0,16);const E=e,R=null!==(g=null==E?void 0:E._copyInvertYTempTexture)&&void 0!==g?g:this.createTexture({width:t,height:i,layers:1},!1,!1,!1,!1,!1,n,1,u,nr.CopySrc|nr.RenderAttachment|nr.TextureBinding),P=null!==(b=null==E?void 0:E._copyInvertYRenderPassDescr)&&void 0!==b?b:{colorAttachments:[{view:R.createView({format:n,dimension:rr.E2d,baseMipLevel:0,mipLevelCount:1,arrayLayerCount:1,baseArrayLayer:0}),loadOp:Ir.Load,storeOp:Mr.Store}]},I=u.beginRenderPass(P);let M=A?null==E?void 0:E._copyInvertYBindGroupWithOfst:null==E?void 0:E._copyInvertYBindGroup;if(!M){const e={layout:x,entries:[{binding:0,resource:T.createView({format:n,dimension:rr.E2d,baseMipLevel:a,mipLevelCount:1,arrayLayerCount:l,baseArrayLayer:o})}]};A&&e.entries.push({binding:1,resource:{buffer:this._ubCopyWithOfst}}),M=this._device.createBindGroup(e)}I.setPipeline(S),I.setBindGroup(0,M),I.draw(4,1,0,0),I.end(),u.copyTextureToTexture({texture:R},{texture:T,mipLevel:a,origin:{x:0,y:0,z:o}},{width:t,height:i,depthOrArrayLayers:1}),E?(E._copyInvertYTempTexture=R,E._copyInvertYRenderPassDescr=P,A?E._copyInvertYBindGroupWithOfst=M:E._copyInvertYBindGroup=M):this._deferredReleaseTextures.push([R,null]),null===(v=(y=u).popDebugGroup)||void 0===v||v.call(y),C&&(this._device.queue.submit([u.finish()]),u=null)}copyWithInvertY(e,t,i,n){var r,s,o,a;const l=void 0===n,[c,h]=this._getPipeline(t,Hr.InvertYPremultiplyAlpha,{invertY:!0,premultiplyAlpha:!1});l&&(n=this._device.createCommandEncoder({})),null===(s=(r=n).pushDebugGroup)||void 0===s||s.call(r,"internal copy texture with invertY");const _=n.beginRenderPass(i),d=this._device.createBindGroup({layout:h,entries:[{binding:0,resource:e}]});_.setPipeline(c),_.setBindGroup(0,d),_.draw(4,1,0,0),_.end(),null===(a=(o=n).popDebugGroup)||void 0===a||a.call(o),l&&(this._device.queue.submit([n.finish()]),n=null)}createTexture(e,t=!1,i=!1,n=!1,r=!1,s=!1,o=or.RGBA8Unorm,a=1,l,c=-1,h=0){a>1&&(a=4);const _=e.layers||1,d={width:e.width,height:e.height,depthOrArrayLayers:_},u=Qr.IsCompressedFormat(o),p=t?Qr.ComputeNumMipmapLevels(e.width,e.height):1,f=c>=0?c:nr.CopySrc|nr.CopyDst|nr.TextureBinding;h|=t&&!u?nr.CopySrc|nr.RenderAttachment:0,u||s||(h|=nr.RenderAttachment|nr.CopyDst);const m=this._device.createTexture({size:d,dimension:s?ir.E3d:ir.E2d,format:o,usage:f|h,sampleCount:a,mipLevelCount:p});return Qr.IsImageBitmap(e)&&(this.updateTexture(e,m,e.width,e.height,_,o,0,0,n,r,0,0),t&&i&&this.generateMipmaps(m,o,p,0,l)),m}createCubeTexture(e,t=!1,i=!1,n=!1,r=!1,s=or.RGBA8Unorm,o=1,a,l=-1,c=0){o>1&&(o=4);const h=Qr.IsImageBitmapArray(e)?e[0].width:e.width,_=Qr.IsImageBitmapArray(e)?e[0].height:e.height,d=Qr.IsCompressedFormat(s),u=t?Qr.ComputeNumMipmapLevels(h,_):1,p=l>=0?l:nr.CopySrc|nr.CopyDst|nr.TextureBinding;c|=t&&!d?nr.CopySrc|nr.RenderAttachment:0,d||(c|=nr.RenderAttachment|nr.CopyDst);const f=this._device.createTexture({size:{width:h,height:_,depthOrArrayLayers:6},dimension:ir.E2d,format:s,usage:p|c,sampleCount:o,mipLevelCount:u});return Qr.IsImageBitmapArray(e)&&(this.updateCubeTextures(e,f,h,_,s,n,r,0,0),t&&i&&this.generateCubeMipmaps(f,s,u,a)),f}generateCubeMipmaps(e,t,i,n){var r,s,o,a;const l=void 0===n;l&&(n=this._device.createCommandEncoder({})),null===(s=(r=n).pushDebugGroup)||void 0===s||s.call(r,`create cube mipmaps - ${i} levels`);for(let r=0;r<6;++r)this.generateMipmaps(e,t,i,r,n);null===(a=(o=n).popDebugGroup)||void 0===a||a.call(o),l&&(this._device.queue.submit([n.finish()]),n=null)}generateMipmaps(e,t,i,n=0,r){var s,o,a,l,c,h,_,d;const u=void 0===r,[p,f]=this._getPipeline(t);let m;if(n=Math.max(n,0),u&&(r=this._device.createCommandEncoder({})),null===(o=(s=r).pushDebugGroup)||void 0===o||o.call(s,`create mipmaps for face #${n} - ${i} levels`),Qr._IsHardwareTexture(e)?(m=e.underlyingResource,e._mipmapGenRenderPassDescr=e._mipmapGenRenderPassDescr||[],e._mipmapGenBindGroup=e._mipmapGenBindGroup||[]):(m=e,e=void 0),!m)return;const g=e;for(let e=1;ec;)this._device.queue.writeBuffer(s,t+h,i.buffer,o+h,c),h+=c;this._device.queue.writeBuffer(s,t+h,i.buffer,o+h,r-h)}_getHalfFloatAsFloatRGBAArrayBuffer(e,t,i){i||(i=new Float32Array(e));const n=new Uint16Array(t);for(;e--;)i[e]=(0,Kr.qZ)(n[e]);return i}readDataFromBuffer(e,t,i,n,r,s,o=0,a=0,l=null,c=!0,h=!1){const _=1===o?2:2===o?1:0;return new Promise(((i,d)=>{e.mapAsync(tr.Read,a,t).then((()=>{const d=e.getMappedRange(a,t);let u=l;if(h)u=null===u?(0,On.A)(o,t,!0,d):(0,On.A)(o,u.buffer,void 0,d);else if(null===u)switch(_){case 0:u=new Uint8Array(t),u.set(new Uint8Array(d));break;case 1:u=this._getHalfFloatAsFloatRGBAArrayBuffer(t/2,d);break;case 2:u=new Float32Array(t/4),u.set(new Float32Array(d))}else switch(_){case 0:u=new Uint8Array(u.buffer),u.set(new Uint8Array(d));break;case 1:u=this._getHalfFloatAsFloatRGBAArrayBuffer(t/2,d,l);break;case 2:u=new Float32Array(u.buffer),u.set(new Float32Array(d))}if(r!==s){1!==_||h||(r*=2,s*=2);const e=new Uint8Array(u.buffer);let t=r,i=0;for(let o=1;od(e)))}))}releaseBuffer(e){return Zr._IsGPUBuffer(e)?(this._deferredReleaseBuffers.push(e),!0):(e.references--,0===e.references&&(this._deferredReleaseBuffers.push(e.underlyingResource),!0))}destroyDeferredBuffers(){for(let e=0;e1?4:1;return Jr[e.samplingMode]+es[(e._comparisonFunction||514)-512+1]+ts[e.samplingMode]+((null!==(t=e._cachedWrapU)&&void 0!==t?t:1)<<8)+((null!==(i=e._cachedWrapV)&&void 0!==i?i:1)<<10)+((null!==(n=e._cachedWrapR)&&void 0!==n?n:1)<<12)+((e.useMipMaps?1:0)<<14)+(r<<15)}static _GetSamplerFilterDescriptor(e,t){let i,n,r,s,o;const a=e.useMipMaps;switch(e.samplingMode){case 11:i=lr.Linear,n=lr.Linear,r=lr.Nearest,a||(s=o=0);break;case 3:case 3:i=lr.Linear,n=lr.Linear,a?r=lr.Linear:(r=lr.Nearest,s=o=0);break;case 8:i=lr.Nearest,n=lr.Nearest,a?r=lr.Linear:(r=lr.Nearest,s=o=0);break;case 4:i=lr.Nearest,n=lr.Nearest,r=lr.Nearest,a||(s=o=0);break;case 5:i=lr.Nearest,n=lr.Linear,r=lr.Nearest,a||(s=o=0);break;case 6:i=lr.Nearest,n=lr.Linear,a?r=lr.Linear:(r=lr.Nearest,s=o=0);break;case 7:i=lr.Nearest,n=lr.Linear,r=lr.Nearest,s=o=0;break;case 1:case 1:default:i=lr.Nearest,n=lr.Nearest,r=lr.Nearest,s=o=0;break;case 9:i=lr.Linear,n=lr.Nearest,r=lr.Nearest,a||(s=o=0);break;case 10:i=lr.Linear,n=lr.Nearest,a?r=lr.Linear:(r=lr.Nearest,s=o=0);break;case 2:case 2:i=lr.Linear,n=lr.Linear,r=lr.Nearest,s=o=0;break;case 12:i=lr.Linear,n=lr.Nearest,r=lr.Nearest,s=o=0}return t>1&&(0!==s||0!==o)?{magFilter:lr.Linear,minFilter:lr.Linear,mipmapFilter:lr.Linear,anisotropyEnabled:!0}:{magFilter:i,minFilter:n,mipmapFilter:r,lodMinClamp:s,lodMaxClamp:o}}static _GetWrappingMode(e){switch(e){case 1:return ar.Repeat;case 0:return ar.ClampToEdge;case 2:return ar.MirrorRepeat}return ar.Repeat}static _GetSamplerWrappingDescriptor(e){return{addressModeU:this._GetWrappingMode(e._cachedWrapU),addressModeV:this._GetWrappingMode(e._cachedWrapV),addressModeW:this._GetWrappingMode(e._cachedWrapR)}}static _GetSamplerDescriptor(e){const t=e.useMipMaps&&e._cachedAnisotropicFilteringLevel&&e._cachedAnisotropicFilteringLevel>1?4:1,i=this._GetSamplerFilterDescriptor(e,t);return{...i,...this._GetSamplerWrappingDescriptor(e),compare:e._comparisonFunction?is.GetCompareFunction(e._comparisonFunction):void 0,maxAnisotropy:i.anisotropyEnabled?t:1}}static GetCompareFunction(e){switch(e){case 519:return cr.Always;case 514:return cr.Equal;case 516:return cr.Greater;case 518:return cr.GreaterEqual;case 513:default:return cr.Less;case 515:return cr.LessEqual;case 512:return cr.Never;case 517:return cr.NotEqual}}getSampler(e,t=!1,i=0){if(this.disabled)return this._device.createSampler(is._GetSamplerDescriptor(e));t?i=0:0===i&&(i=is.GetSamplerHashCode(e));let n=t?void 0:this._samplers[i];return n||(n=this._device.createSampler(is._GetSamplerDescriptor(e)),t||(this._samplers[i]=n)),n}}var ns;!function(e){e[e.StencilReadMask=0]="StencilReadMask",e[e.StencilWriteMask=1]="StencilWriteMask",e[e.DepthBias=2]="DepthBias",e[e.DepthBiasSlopeScale=3]="DepthBiasSlopeScale",e[e.DepthStencilState=4]="DepthStencilState",e[e.MRTAttachments1=5]="MRTAttachments1",e[e.MRTAttachments2=6]="MRTAttachments2",e[e.RasterizationState=7]="RasterizationState",e[e.ColorStates=8]="ColorStates",e[e.ShaderStage=9]="ShaderStage",e[e.TextureStage=10]="TextureStage",e[e.VertexState=11]="VertexState",e[e.NumStates=12]="NumStates"}(ns||(ns={}));const rs={0:1,1:2,768:3,769:4,770:5,771:6,772:7,773:8,774:9,775:10,776:11,32769:12,32770:13,32771:12,32772:13},ss={0:0,7680:1,7681:2,7682:3,7683:4,5386:5,34055:6,34056:7};class os{constructor(e,t,i){this.mrtTextureCount=0,this._device=e,this._useTextureStage=i,this._states=new Array(30),this._statesLength=0,this._stateDirtyLowestIndex=0,this._emptyVertexBuffer=t,this._mrtFormats=[],this._parameter={token:void 0,pipeline:null},this.disabled=!1,this.vertexBuffers=[],this._kMaxVertexBufferStride=e.limits.maxVertexBufferArrayStride||2048,this.reset()}reset(){this._isDirty=!0,this.vertexBuffers.length=0,this.setAlphaToCoverage(!1),this.resetDepthCullingState(),this.setClampDepth(!1),this.setDepthBias(0),this._webgpuColorFormat=[or.BGRA8Unorm],this.setColorFormat(or.BGRA8Unorm),this.setMRT([]),this.setAlphaBlendEnabled(!1),this.setAlphaBlendFactors([null,null,null,null],[null,null]),this.setWriteMask(15),this.setDepthStencilFormat(or.Depth24PlusStencil8),this.setStencilEnabled(!1),this.resetStencilState(),this.setBuffers(null,null,null),this._setTextureState(0)}get colorFormats(){return this._mrtAttachments1>0?this._mrtFormats:this._webgpuColorFormat}getRenderPipeline(e,t,i,n=0){if(i>1&&(i=4),this.disabled){const n=os._GetTopology(e);return this._setVertexState(t),this._parameter.pipeline=this._createRenderPipeline(t,n,i),os.NumCacheMiss++,os._NumPipelineCreationCurrentFrame++,this._parameter.pipeline}if(this._setShaderStage(t.uniqueId),this._setRasterizationState(e,i),this._setColorStates(),this._setDepthStencilState(),this._setVertexState(t),this._setTextureState(n),this.lastStateDirtyLowestIndex=this._stateDirtyLowestIndex,!this._isDirty&&this._parameter.pipeline)return this._stateDirtyLowestIndex=this._statesLength,os.NumCacheHitWithoutHash++,this._parameter.pipeline;if(this._getRenderPipeline(this._parameter),this._isDirty=!1,this._stateDirtyLowestIndex=this._statesLength,this._parameter.pipeline)return os.NumCacheHitWithHash++,this._parameter.pipeline;const r=os._GetTopology(e);return this._parameter.pipeline=this._createRenderPipeline(t,r,i),this._setRenderPipeline(this._parameter),os.NumCacheMiss++,os._NumPipelineCreationCurrentFrame++,this._parameter.pipeline}endFrame(){os.NumPipelineCreationLastFrame=os._NumPipelineCreationCurrentFrame,os._NumPipelineCreationCurrentFrame=0}setAlphaToCoverage(e){this._alphaToCoverageEnabled=e}setFrontFace(e){this._frontFace=e}setCullEnabled(e){this._cullEnabled=e}setCullFace(e){this._cullFace=e}setClampDepth(e){this._clampDepth=e}resetDepthCullingState(){this.setDepthCullingState(!1,2,1,0,0,!0,!0,519)}setDepthCullingState(e,t,i,n,r,s,o,a){this._depthWriteEnabled=o,this._depthTestEnabled=s,this._depthCompare=(null!=a?a:519)-512,this._cullFace=i,this._cullEnabled=e,this._frontFace=t,this.setDepthBiasSlopeScale(n),this.setDepthBias(r)}setDepthBias(e){this._depthBias!==e&&(this._depthBias=e,this._states[ns.DepthBias]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ns.DepthBias))}setDepthBiasSlopeScale(e){this._depthBiasSlopeScale!==e&&(this._depthBiasSlopeScale=e,this._states[ns.DepthBiasSlopeScale]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ns.DepthBiasSlopeScale))}setColorFormat(e){this._webgpuColorFormat[0]=e,this._colorFormat=Yr[null!=e?e:""]}setMRTAttachments(e){this.mrtAttachments=e;let t=0;for(let i=0;i10)throw"Can't handle more than 10 attachments for a MRT in cache render pipeline!";this.mrtTextureArray=e,this.mrtTextureCount=t,this._mrtEnabledMask=65535;const r=[0,0];let s=0,o=0,a=0;for(let l=0;l=32&&(o=0,s++)}this._mrtFormats.length=a,this._mrtAttachments1===r[0]&&this._mrtAttachments2===r[1]||(this._mrtAttachments1=r[0],this._mrtAttachments2=r[1],this._states[ns.MRTAttachments1]=r[0],this._states[ns.MRTAttachments2]=r[1],this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ns.MRTAttachments1))}setAlphaBlendEnabled(e){this._alphaBlendEnabled=e}setAlphaBlendFactors(e,t){this._alphaBlendFuncParams=e,this._alphaBlendEqParams=t}setWriteMask(e){this._writeMask=e}setDepthStencilFormat(e){this._webgpuDepthStencilFormat=e,this._depthStencilFormat=void 0===e?0:Yr[e]}setDepthTestEnabled(e){this._depthTestEnabled=e}setDepthWriteEnabled(e){this._depthWriteEnabled=e}setDepthCompare(e){this._depthCompare=(null!=e?e:519)-512}setStencilEnabled(e){this._stencilEnabled=e}setStencilCompare(e){this._stencilFrontCompare=(null!=e?e:519)-512}setStencilDepthFailOp(e){this._stencilFrontDepthFailOp=null===e?1:ss[e]}setStencilPassOp(e){this._stencilFrontPassOp=null===e?2:ss[e]}setStencilFailOp(e){this._stencilFrontFailOp=null===e?1:ss[e]}setStencilReadMask(e){this._stencilReadMask!==e&&(this._stencilReadMask=e,this._states[ns.StencilReadMask]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ns.StencilReadMask))}setStencilWriteMask(e){this._stencilWriteMask!==e&&(this._stencilWriteMask=e,this._states[ns.StencilWriteMask]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ns.StencilWriteMask))}resetStencilState(){this.setStencilState(!1,519,7680,7681,7680,255,255)}setStencilState(e,t,i,n,r,s,o){this._stencilEnabled=e,this._stencilFrontCompare=(null!=t?t:519)-512,this._stencilFrontDepthFailOp=null===i?1:ss[i],this._stencilFrontPassOp=null===n?2:ss[n],this._stencilFrontFailOp=null===r?1:ss[r],this.setStencilReadMask(s),this.setStencilWriteMask(o)}setBuffers(e,t,i){this._vertexBuffers=e,this._overrideVertexBuffers=i,this._indexBuffer=t}static _GetTopology(e){switch(e){case 0:default:return gr.TriangleList;case 2:case 3:return gr.PointList;case 1:case 4:return gr.LineList;case 5:throw"LineLoop is an unsupported fillmode in WebGPU";case 6:return gr.LineStrip;case 7:return gr.TriangleStrip;case 8:throw"TriangleFan is an unsupported fillmode in WebGPU"}}static _GetAphaBlendOperation(e){switch(e){case 32774:default:return Cr.Add;case 32778:return Cr.Subtract;case 32779:return Cr.ReverseSubtract;case 32775:return Cr.Min;case 32776:return Cr.Max}}static _GetAphaBlendFactor(e){switch(e){case 0:return Ar.Zero;case 1:default:return Ar.One;case 768:return Ar.Src;case 769:return Ar.OneMinusSrc;case 770:return Ar.SrcAlpha;case 771:return Ar.OneMinusSrcAlpha;case 772:return Ar.DstAlpha;case 773:return Ar.OneMinusDstAlpha;case 774:return Ar.Dst;case 775:return Ar.OneMinusDst;case 776:return Ar.SrcAlphaSaturated;case 32769:case 32771:return Ar.Constant;case 32770:case 32772:return Ar.OneMinusConstant}}static _GetCompareFunction(e){switch(e){case 0:return cr.Never;case 1:return cr.Less;case 2:return cr.Equal;case 3:return cr.LessEqual;case 4:return cr.Greater;case 5:return cr.NotEqual;case 6:return cr.GreaterEqual;case 7:return cr.Always}return cr.Never}static _GetStencilOpFunction(e){switch(e){case 0:return Sr.Zero;case 1:return Sr.Keep;case 2:return Sr.Replace;case 3:return Sr.IncrementClamp;case 4:return Sr.DecrementClamp;case 5:return Sr.Invert;case 6:return Sr.IncrementWrap;case 7:return Sr.DecrementWrap}return Sr.Keep}static _GetVertexInputDescriptorFormat(e){const t=e.type,i=e.normalized,n=e.getSize();switch(t){case le.o.BYTE:switch(n){case 1:case 2:return i?Tr.Snorm8x2:Tr.Sint8x2;case 3:case 4:return i?Tr.Snorm8x4:Tr.Sint8x4}break;case le.o.UNSIGNED_BYTE:switch(n){case 1:case 2:return i?Tr.Unorm8x2:Tr.Uint8x2;case 3:case 4:return i?Tr.Unorm8x4:Tr.Uint8x4}break;case le.o.SHORT:switch(n){case 1:case 2:return i?Tr.Snorm16x2:Tr.Sint16x2;case 3:case 4:return i?Tr.Snorm16x4:Tr.Sint16x4}break;case le.o.UNSIGNED_SHORT:switch(n){case 1:case 2:return i?Tr.Unorm16x2:Tr.Uint16x2;case 3:case 4:return i?Tr.Unorm16x4:Tr.Uint16x4}break;case le.o.INT:switch(n){case 1:return Tr.Sint32;case 2:return Tr.Sint32x2;case 3:return Tr.Sint32x3;case 4:return Tr.Sint32x4}break;case le.o.UNSIGNED_INT:switch(n){case 1:return Tr.Uint32;case 2:return Tr.Uint32x2;case 3:return Tr.Uint32x3;case 4:return Tr.Uint32x4}break;case le.o.FLOAT:switch(n){case 1:return Tr.Float32;case 2:return Tr.Float32x2;case 3:return Tr.Float32x3;case 4:return Tr.Float32x4}}throw new Error(`Invalid Format '${e.getKind()}' - type=${t}, normalized=${i}, size=${n}`)}_getAphaBlendState(){return this._alphaBlendEnabled?{srcFactor:os._GetAphaBlendFactor(this._alphaBlendFuncParams[2]),dstFactor:os._GetAphaBlendFactor(this._alphaBlendFuncParams[3]),operation:os._GetAphaBlendOperation(this._alphaBlendEqParams[1])}:null}_getColorBlendState(){return this._alphaBlendEnabled?{srcFactor:os._GetAphaBlendFactor(this._alphaBlendFuncParams[0]),dstFactor:os._GetAphaBlendFactor(this._alphaBlendFuncParams[1]),operation:os._GetAphaBlendOperation(this._alphaBlendEqParams[0])}:null}_setShaderStage(e){this._shaderId!==e&&(this._shaderId=e,this._states[ns.ShaderStage]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ns.ShaderStage))}_setRasterizationState(e,t){const i=this._frontFace-1+((this._cullEnabled?this._cullFace:0)<<1)+((this._clampDepth?1:0)<<3)+((this._alphaToCoverageEnabled?1:0)<<4)+(e<<5)+(t<<8);this._rasterizationState!==i&&(this._rasterizationState=i,this._states[ns.RasterizationState]=this._rasterizationState,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ns.RasterizationState))}_setColorStates(){let e=((this._writeMask?1:0)<<22)+(this._colorFormat<<23)+((this._depthWriteEnabled?1:0)<<29);this._alphaBlendEnabled&&(e+=((null===this._alphaBlendFuncParams[0]?2:rs[this._alphaBlendFuncParams[0]])<<0)+((null===this._alphaBlendFuncParams[1]?2:rs[this._alphaBlendFuncParams[1]])<<4)+((null===this._alphaBlendFuncParams[2]?2:rs[this._alphaBlendFuncParams[2]])<<8)+((null===this._alphaBlendFuncParams[3]?2:rs[this._alphaBlendFuncParams[3]])<<12)+((null===this._alphaBlendEqParams[0]?1:this._alphaBlendEqParams[0]-32773)<<16)+((null===this._alphaBlendEqParams[1]?1:this._alphaBlendEqParams[1]-32773)<<19)),e!==this._colorStates&&(this._colorStates=e,this._states[ns.ColorStates]=this._colorStates,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ns.ColorStates))}_setDepthStencilState(){const e=this._stencilEnabled?this._stencilFrontCompare+(this._stencilFrontDepthFailOp<<3)+(this._stencilFrontPassOp<<6)+(this._stencilFrontFailOp<<9):591,t=this._depthStencilFormat+((this._depthTestEnabled?this._depthCompare:7)<<6)+(e<<10);this._depthStencilState!==t&&(this._depthStencilState=t,this._states[ns.DepthStencilState]=this._depthStencilState,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,ns.DepthStencilState))}_setVertexState(e){var t,i;const n=this._statesLength;let r=ns.VertexState;const s=e._pipelineContext,o=s.shaderProcessingContext.attributeNamesFromEffect,a=s.shaderProcessingContext.attributeLocationsFromEffect;let l,c=0;for(let e=0;e0)for(let e=0;e=this._video.HAVE_CURRENT_DATA}dispose(){}}class ps{constructor(){this.uniqueId=ps._Counter++,this.updateId=0,this.reset()}get forceBindGroupCreation(){return this._numExternalTextures>0}get hasFloatTextures(){return this._numFloatTextures>0}reset(){this.samplers={},this.textures={},this.isDirty=!0,this._numFloatTextures=0,this._numExternalTextures=0}setSampler(e,t){let i=this.samplers[e],n=-1;i?n=i.hashCode:this.samplers[e]=i={sampler:t,hashCode:0},i.sampler=t,i.hashCode=t?is.GetSamplerHashCode(t):0;const r=n!==i.hashCode;r&&this.updateId++,this.isDirty||(this.isDirty=r)}setTexture(e,t){var i,n,r;let s=this.textures[e],o=-1;s?o=null!==(n=null===(i=s.texture)||void 0===i?void 0:i.uniqueId)&&void 0!==n?n:-1:this.textures[e]=s={texture:t,isFloatTexture:!1,isExternalTexture:!1},s.isExternalTexture&&this._numExternalTextures--,s.isFloatTexture&&this._numFloatTextures--,t?(s.isFloatTexture=1===t.type,s.isExternalTexture=us.IsExternalTexture(t),s.isFloatTexture&&this._numFloatTextures++,s.isExternalTexture&&this._numExternalTextures++):(s.isFloatTexture=!1,s.isExternalTexture=!1),s.texture=t;const a=o!==(null!==(r=null==t?void 0:t.uniqueId)&&void 0!==r?r:-1);a&&this.updateId++,this.isDirty||(this.isDirty=a)}}ps._Counter=0;class fs{constructor(e){this._bufferManager=e,this.uniqueId=fs._Counter++,this._useInstancing=!1,this._currentInstanceCount=0,this.reset()}isDirty(e){return this._isDirty||this._materialContextUpdateId!==e}resetIsDirty(e){this._isDirty=!1,this._materialContextUpdateId=e}get useInstancing(){return this._useInstancing}set useInstancing(e){this._useInstancing!==e&&(e?(this.indirectDrawBuffer=this._bufferManager.createRawBuffer(40,er.CopyDst|er.Indirect),this._indirectDrawData=new Uint32Array(5),this._indirectDrawData[3]=0,this._indirectDrawData[4]=0):(this.indirectDrawBuffer&&this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0),this._useInstancing=e,this._currentInstanceCount=-1)}reset(){this.buffers={},this._isDirty=!0,this._materialContextUpdateId=0,this.fastBundle=void 0,this.bindGroups=void 0}setBuffer(e,t){var i;this._isDirty||(this._isDirty=(null==t?void 0:t.uniqueId)!==(null===(i=this.buffers[e])||void 0===i?void 0:i.uniqueId)),this.buffers[e]=t}setIndirectData(e,t,i){t!==this._currentInstanceCount&&this.indirectDrawBuffer&&this._indirectDrawData&&(this._currentInstanceCount=t,this._indirectDrawData[0]=e,this._indirectDrawData[1]=t,this._indirectDrawData[2]=i,this._bufferManager.setRawData(this.indirectDrawBuffer,0,this._indirectDrawData,0,20))}dispose(){this.indirectDrawBuffer&&(this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0),this.fastBundle=void 0,this.bindGroups=void 0,this.buffers=void 0}}fs._Counter=0;class ms{constructor(){this.values={}}}class gs{constructor(e,t,i){this.disabled=!1,this._device=e,this._cacheSampler=t,this._engine=i}static get Statistics(){return{totalCreated:gs.NumBindGroupsCreatedTotal,lastFrameCreated:gs.NumBindGroupsCreatedLastFrame,lookupLastFrame:gs.NumBindGroupsLookupLastFrame,noLookupLastFrame:gs.NumBindGroupsNoLookupLastFrame}}endFrame(){gs.NumBindGroupsCreatedLastFrame=gs._NumBindGroupsCreatedCurrentFrame,gs.NumBindGroupsLookupLastFrame=gs._NumBindGroupsLookupCurrentFrame,gs.NumBindGroupsNoLookupLastFrame=gs._NumBindGroupsNoLookupCurrentFrame,gs._NumBindGroupsCreatedCurrentFrame=0,gs._NumBindGroupsLookupCurrentFrame=0,gs._NumBindGroupsNoLookupCurrentFrame=0}getBindGroups(e,t,i){var n,r,s,o,a,l,c,h,_,d;let p,f=gs._Cache;const m=this.disabled||i.forceBindGroupCreation;if(!m){if(!t.isDirty(i.updateId)&&!i.isDirty)return gs._NumBindGroupsNoLookupCurrentFrame++,t.bindGroups;for(const i of e.shaderProcessingContext.bufferNames){const e=null!==(r=null===(n=t.buffers[i])||void 0===n?void 0:n.uniqueId)&&void 0!==r?r:0;let s=f.values[e];s||(s=new ms,f.values[e]=s),f=s}for(const t of e.shaderProcessingContext.samplerNames){const e=null!==(o=null===(s=i.samplers[t])||void 0===s?void 0:s.hashCode)&&void 0!==o?o:0;let n=f.values[e];n||(n=new ms,f.values[e]=n),f=n}for(const t of e.shaderProcessingContext.textureNames){const e=null!==(c=null===(l=null===(a=i.textures[t])||void 0===a?void 0:a.texture)||void 0===l?void 0:l.uniqueId)&&void 0!==c?c:0;let n=f.values[e];n||(n=new ms,f.values[e]=n),f=n}p=f.bindGroups}if(t.resetIsDirty(i.updateId),i.isDirty=!1,p)return t.bindGroups=p,gs._NumBindGroupsLookupCurrentFrame++,p;p=[],t.bindGroups=p,m||(f.bindGroups=p),gs.NumBindGroupsCreatedTotal++,gs._NumBindGroupsCreatedCurrentFrame++;const g=e.bindGroupLayouts;for(let n=0;n"texture"===e?"":t))}, materialContext.uniqueId=${i.uniqueId}`,50);continue}s[o].resource=this._cacheSampler.getSampler(t,!1,e.hashCode)}else u.Y.Error(`Sampler "${l}" could not be bound. entry=${JSON.stringify(r)}, materialContext=${JSON.stringify(i,((e,t)=>"texture"===e||"sampler"===e?"":t))}`,50)}else if(r.texture||r.storageTexture){const e=i.textures[l];if(e){if(this._engine.dbgSanityChecks&&null===e.texture){u.Y.Error(`Trying to bind a null texture! entry=${JSON.stringify(r)}, bindingInfo=${JSON.stringify(e,((e,t)=>"texture"===e?"":t))}, materialContext.uniqueId=${i.uniqueId}`,50);continue}const t=e.texture._hardwareTexture;if(this._engine.dbgSanityChecks&&(!t||r.texture&&!t.view||r.storageTexture&&!t.viewForWriting)){u.Y.Error(`Trying to bind a null gpu texture or view! entry=${JSON.stringify(r)}, name=${l}, bindingInfo=${JSON.stringify(e,((e,t)=>"texture"===e?"":t))}, isReady=${null===(_=e.texture)||void 0===_?void 0:_.isReady}, materialContext.uniqueId=${i.uniqueId}`,50);continue}s[o].resource=r.storageTexture?t.viewForWriting:t.view}else u.Y.Error(`Texture "${l}" could not be bound. entry=${JSON.stringify(r)}, materialContext=${JSON.stringify(i,((e,t)=>"texture"===e||"sampler"===e?"":t))}`,50)}else if(r.externalTexture){const e=i.textures[l];if(e){if(this._engine.dbgSanityChecks&&null===e.texture){u.Y.Error(`Trying to bind a null external texture! entry=${JSON.stringify(r)}, name=${l}, bindingInfo=${JSON.stringify(e,((e,t)=>"texture"===e?"":t))}, materialContext.uniqueId=${i.uniqueId}`,50);continue}const t=e.texture.underlyingResource;if(this._engine.dbgSanityChecks&&!t){u.Y.Error(`Trying to bind a null gpu external texture! entry=${JSON.stringify(r)}, name=${l}, bindingInfo=${JSON.stringify(e,((e,t)=>"texture"===e?"":t))}, isReady=${null===(d=e.texture)||void 0===d?void 0:d.isReady}, materialContext.uniqueId=${i.uniqueId}`,50);continue}s[o].resource=this._device.importExternalTexture({source:t})}else u.Y.Error(`Texture "${l}" could not be bound. entry=${JSON.stringify(r)}, materialContext=${JSON.stringify(i,((e,t)=>"texture"===e||"sampler"===e?"":t))}`,50)}else if(r.buffer){const e=t.buffers[l];if(e){const t=e.underlyingResource;s[o].resource.buffer=t,s[o].resource.size=e.capacity}else u.Y.Error(`Can't find buffer "${l}". entry=${JSON.stringify(r)}, buffers=${JSON.stringify(t.buffers)}, drawContext.uniqueId=${t.uniqueId}`,50)}}const o=g[n];p[n]=this._device.createBindGroup({layout:o,entries:s})}return p}}gs.NumBindGroupsCreatedTotal=0,gs.NumBindGroupsCreatedLastFrame=0,gs.NumBindGroupsLookupLastFrame=0,gs.NumBindGroupsNoLookupLastFrame=0,gs._Cache=new ms,gs._NumBindGroupsCreatedCurrentFrame=0,gs._NumBindGroupsLookupCurrentFrame=0,gs._NumBindGroupsNoLookupCurrentFrame=0;dt.v.ShadersStore.clearQuadVertexShader="uniform float depthValue;\nconst vec2 pos[4]={\nvec2(-1.0,1.0),\nvec2(1.0,1.0),\nvec2(-1.0,-1.0),\nvec2(1.0,-1.0)\n};\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\ngl_Position=vec4(pos[gl_VertexID],depthValue,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}\n";dt.v.ShadersStore.clearQuadPixelShader="uniform vec4 color;\nvoid main() {\ngl_FragColor=color;\n}\n";class bs{constructor(e,t,i){this._bindGroups={},this._bundleCache={},this._keyTemp=[],this._device=e,this._engine=t,this._cacheRenderPipeline=new ls(this._device,i,!t._caps.textureFloatLinearFiltering),this._cacheRenderPipeline.setDepthTestEnabled(!1),this._cacheRenderPipeline.setStencilReadMask(255),this._effect=t.createEffect("clearQuad",[],["color","depthValue"])}setDepthStencilFormat(e){this._depthTextureFormat=e,this._cacheRenderPipeline.setDepthStencilFormat(e)}setColorFormat(e){this._cacheRenderPipeline.setColorFormat(e)}setMRTAttachments(e,t,i){this._cacheRenderPipeline.setMRT(t,i),this._cacheRenderPipeline.setMRTAttachments(e)}clear(e,t,i,n,r=1){var s,o;let a,l,c=null;const h=!!this._engine._currentRenderTarget;if(e)a=e;else{let e=0;this._keyTemp.length=0;for(let t=0;t1?2**36:0)+_*2**37,l=this._keyTemp.join("_"),c=this._bundleCache[l],c)return c;a=this._device.createRenderBundleEncoder({colorFormats:this._cacheRenderPipeline.colorFormats,depthStencilFormat:this._depthTextureFormat,sampleCount:r})}this._cacheRenderPipeline.setDepthWriteEnabled(!!i),this._cacheRenderPipeline.setStencilEnabled(!!n&&!!this._depthTextureFormat&&Qr.HasStencilAspect(this._depthTextureFormat)),this._cacheRenderPipeline.setStencilWriteMask(n?255:0),this._cacheRenderPipeline.setStencilCompare(n?519:512),this._cacheRenderPipeline.setStencilPassOp(n?7681:7680),this._cacheRenderPipeline.setWriteMask(t?15:0);const _=this._cacheRenderPipeline.getRenderPipeline(7,this._effect,r),d=this._effect._pipelineContext;t&&this._effect.setDirectColor4("color",t),this._effect.setFloat("depthValue",this._engine.useReverseDepthBuffer?this._engine._clearReverseDepthValue:this._engine._clearDepthValue),d.uniformBuffer.update();const u=h?this._engine._ubInvertY:this._engine._ubDontInvertY,p=d.uniformBuffer.getBuffer(),f=p.uniqueId+"-"+u.uniqueId;let m=this._bindGroups[f];if(!m){const e=d.bindGroupLayouts;m=this._bindGroups[f]=[],m.push(this._device.createBindGroup({layout:e[0],entries:[]})),Vr._SimplifiedKnownBindings||m.push(this._device.createBindGroup({layout:e[1],entries:[]})),m.push(this._device.createBindGroup({layout:e[Vr._SimplifiedKnownBindings?1:2],entries:[{binding:0,resource:{buffer:u.underlyingResource,size:u.capacity}},{binding:1,resource:{buffer:p.underlyingResource,size:p.capacity}}]}))}a.setPipeline(_);for(let e=0;e{null!==e&&e>=0&&(this._gpuFrameTimeCounter.fetchNewFrame(),this._gpuFrameTimeCounter.addCount(e,!0)),this._measureDurationState=0})))}}class Is{constructor(e,t){this._querySet=new Rs(2,Dr.Timestamp,e,t)}start(e){e.writeTimestamp(this._querySet.querySet,0)}async stop(e){return e.writeTimestamp(this._querySet.querySet,1),this._querySet.readTwoValuesAndSubtract(0)}dispose(){this._querySet.dispose()}}class Ms{constructor(e,t,i,n=50,r=100){this._availableIndices=[],this._engine=e,this._device=t,this._bufferManager=i,this._frameLastBuffer=-1,this._currentTotalIndices=0,this._countIncrement=r,this._allocateNewIndices(n)}get querySet(){return this._querySet.querySet}get hasQueries(){return this._currentTotalIndices!==this._availableIndices.length}get canBeginQuery(){switch(this._engine._getCurrentRenderPassIndex()){case 0:return void 0!==this._engine._mainRenderPassWrapper.renderPassDescriptor.occlusionQuerySet;case 1:return void 0!==this._engine._rttRenderPassWrapper.renderPassDescriptor.occlusionQuerySet}return!1}createQuery(){0===this._availableIndices.length&&this._allocateNewIndices();const e=this._availableIndices[this._availableIndices.length-1];return this._availableIndices.length--,e}deleteQuery(e){this._availableIndices[this._availableIndices.length-1]=e}isQueryResultAvailable(e){return this._retrieveQueryBuffer(),!!this._lastBuffer&&e{this._lastBuffer=e})))}_allocateNewIndices(e){e=null!=e?e:this._countIncrement,this._delayQuerySetDispose();for(let t=0;te.dispose),1e3)}dispose(){var e;null===(e=this._querySet)||void 0===e||e.dispose(),this._availableIndices.length=0}}class Ds{constructor(){this._twgsl=null}async initTwgsl(e){return e=e||{},(e={...Ds._TWgslDefaultOptions,...e}).twgsl?(this._twgsl=e.twgsl,Promise.resolve()):(e.jsPath&&e.wasmPath&&((0,U.CG)()?await V.w1.LoadScriptAsync(e.jsPath):importScripts(e.jsPath)),self.twgsl?(this._twgsl=await self.twgsl(e.wasmPath),Promise.resolve()):Promise.reject("twgsl is not available."))}convertSpirV2WGSL(e){return this._twgsl.convertSpirV2WGSL(e)}}Ds._TWgslDefaultOptions={jsPath:"https://preview.babylonjs.com/twgsl/twgsl.js",wasmPath:"https://preview.babylonjs.com/twgsl/twgsl.wasm"};class Os{constructor(e,t,i,n){this._record=!1,this._play=!1,this._mainPassBundleList=[],this._enabled=!1,this._engine=e,this._mode=t,this._bundleList=i,this._bundleListRenderTarget=n}get enabled(){return this._enabled}get play(){return this._play}get record(){return this._record}set enabled(e){this._mainPassBundleList.length=0,this._record=this._enabled=e,this._play=!1,e&&(this._modeSaved=this._mode,this._mode=0)}get mode(){return this._mode}set mode(e){this._record?this._modeSaved=e:this._mode=e}endMainRenderPass(){this._record&&this._mainPassBundleList.push(this._bundleList.clone())}endRenderTargetPass(e,t){var i,n,r,s;if(this._play)null===(n=null===(i=t._bundleLists)||void 0===i?void 0:i[t._currentLayer])||void 0===n||n.run(e),1===this._mode&&this._engine._reportDrawCall(null===(s=null===(r=t._bundleLists)||void 0===r?void 0:r[t._currentLayer])||void 0===s?void 0:s.numDrawCalls);else{if(!this._record)return!1;t._bundleLists||(t._bundleLists=[]),t._bundleLists[t._currentLayer]=this._bundleListRenderTarget.clone(),t._bundleLists[t._currentLayer].run(e),this._bundleListRenderTarget.reset()}return!0}endFrame(e){if(this._record&&(this._mainPassBundleList.push(this._bundleList.clone()),this._record=!1,this._play=!0,this._mode=this._modeSaved),null!==e&&this._play)for(let t=0;t!!e),(()=>!1)).catch((()=>!1)):Promise.resolve(!1)}static get IsSupported(){return u.Y.Warn("You must call IsSupportedAsync for WebGPU!"),!1}get supportsUniformBuffers(){return!0}get supportedExtensions(){return this._adapterSupportedExtensions}get enabledExtensions(){return this._deviceEnabledExtensions}get description(){return this.name+this.version}get version(){return 1}getInfo(){return{vendor:"unknown vendor",renderer:"unknown renderer",version:"unknown version"}}get compatibilityMode(){return this._compatibilityMode}set compatibilityMode(e){this._compatibilityMode=e}get currentSampleCount(){return this._currentRenderTarget?this._currentRenderTarget.samples:this._mainPassSampleCount}static CreateAsync(e,t={}){const i=new ws(e,t);return new Promise((e=>{i.initAsync(t.glslangOptions,t.twgslOptions).then((()=>e(i)))}))}initAsync(e,t){var i;return this._initGlslang(null!=e?e:null===(i=this._options)||void 0===i?void 0:i.glslangOptions).then((e=>{var i;return this._glslang=e,this._tintWASM=ws.UseTWGSL?new Ds:null,this._tintWASM?this._tintWASM.initTwgsl(null!=t?t:null===(i=this._options)||void 0===i?void 0:i.twgslOptions).then((()=>navigator.gpu.requestAdapter(this._options)),(e=>{throw u.Y.Error("Can not initialize twgsl!"),u.Y.Error(e),Error("WebGPU initializations stopped.")})):navigator.gpu.requestAdapter(this._options)}),(e=>{throw u.Y.Error("Can not initialize glslang!"),u.Y.Error(e),Error("WebGPU initializations stopped.")})).then((e=>{var t;if(e){this._adapter=e,this._adapterSupportedExtensions=[],null===(t=this._adapter.features)||void 0===t||t.forEach((e=>this._adapterSupportedExtensions.push(e)));const i=this._options.deviceDescriptor;if(null==i?void 0:i.requiredFeatures){const e=i.requiredFeatures,t=[];for(const i of e)-1!==this._adapterSupportedExtensions.indexOf(i)&&t.push(i);i.requiredFeatures=t}return this._adapter.requestDevice(this._options.deviceDescriptor)}throw"Could not retrieve a WebGPU adapter (adapter is null)."})).then((e=>{var t,i;this._device=e,this._deviceEnabledExtensions=[],null===(t=this._device.features)||void 0===t||t.forEach((e=>this._deviceEnabledExtensions.push(e)));let n=-1;this._device.addEventListener("uncapturederror",(e=>{++n{this._contextWasLost=!0,u.Y.Warn("WebGPU context lost. "+e),this.onContextLostObservable.notifyObservers(this),this._restoreEngineAfterContextLost(this.initAsync.bind(this))}))}),(e=>{u.Y.Error("Could not retrieve a WebGPU device."),u.Y.Error(e)})).then((()=>{this._bufferManager=new Zr(this._device),this._textureHelper=new Qr(this._device,this._glslang,this._tintWASM,this._bufferManager),this._cacheSampler=new is(this._device),this._cacheBindGroups=new gs(this._device,this._cacheSampler,this),this._timestampQuery=new Ps(this._device,this._bufferManager),this._occlusionQuery=this._device.createQuerySet?new Ms(this,this._device,this._bufferManager):void 0,this._bundleList=new Es(this._device),this._bundleListRenderTarget=new Es(this._device),this._snapshotRendering=new Os(this,this._snapshotRenderingMode,this._bundleList,this._bundleListRenderTarget),this._ubInvertY=this._bufferManager.createBuffer(new Float32Array([-1,0]),er.Uniform|er.CopyDst),this._ubDontInvertY=this._bufferManager.createBuffer(new Float32Array([1,0]),er.Uniform|er.CopyDst),this.dbgVerboseLogsForFirstFrames&&void 0===this._count&&(this._count=0,console.log("%c frame #"+this._count+" - begin","background: #ffff00")),this._uploadEncoder=this._device.createCommandEncoder(this._uploadEncoderDescriptor),this._renderEncoder=this._device.createCommandEncoder(this._renderEncoderDescriptor),this._renderTargetEncoder=this._device.createCommandEncoder(this._renderTargetEncoderDescriptor),this._emptyVertexBuffer=new le.o(this,[0],"",!1,!1,1,!1,0,1),this._initializeLimits(),this._cacheRenderPipeline=new ls(this._device,this._emptyVertexBuffer,!this._caps.textureFloatLinearFiltering),this._depthCullingState=new ds(this._cacheRenderPipeline),this._stencilStateComposer=new hs(this._cacheRenderPipeline),this._stencilStateComposer.stencilGlobal=this._stencilState,this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=515,this._depthCullingState.depthMask=!0,this._textureHelper.setCommandEncoder(this._uploadEncoder),this._clearQuad=new bs(this._device,this,this._emptyVertexBuffer),this._defaultDrawContext=this.createDrawContext(),this._currentDrawContext=this._defaultDrawContext,this._defaultMaterialContext=this.createMaterialContext(),this._currentMaterialContext=this._defaultMaterialContext,this._initializeContextAndSwapChain(),this._initializeMainAttachments(),this.resize()})).catch((e=>{u.Y.Error("Can not create WebGPU Device and/or context."),u.Y.Error(e),console.trace&&console.trace()}))}_initGlslang(e){return e=e||{},(e={...ws._GLSLslangDefaultOptions,...e}).glslang?Promise.resolve(e.glslang):self.glslang?self.glslang(e.wasmPath):e.jsPath&&e.wasmPath?(0,U.CG)()?V.w1.LoadScriptAsync(e.jsPath).then((()=>self.glslang(e.wasmPath))):(importScripts(e.jsPath),self.glslang(e.wasmPath)):Promise.reject("gslang is not available.")}_initializeLimits(){this._caps={maxTexturesImageUnits:16,maxVertexTextureImageUnits:16,maxCombinedTexturesImageUnits:32,maxTextureSize:8192,maxCubemapTextureSize:2048,maxRenderTextureSize:8192,maxVertexAttribs:16,maxVaryingVectors:15,maxFragmentUniformVectors:1024,maxVertexUniformVectors:1024,standardDerivatives:!0,astc:this._deviceEnabledExtensions.indexOf(Jn.TextureCompressionASTC)>=0||void 0,s3tc:this._deviceEnabledExtensions.indexOf(Jn.TextureCompressionBC)>=0||void 0,pvrtc:null,etc1:null,etc2:this._deviceEnabledExtensions.indexOf(Jn.TextureCompressionETC2)>=0||void 0,bptc:this._deviceEnabledExtensions.indexOf(Jn.TextureCompressionBC)>=0||void 0,maxAnisotropy:4,uintIndices:!0,fragmentDepthSupported:!0,highPrecisionShaderSupported:!0,colorBufferFloat:!0,textureFloat:!0,textureFloatLinearFiltering:!1,textureFloatRender:!0,textureHalfFloat:!0,textureHalfFloatLinearFiltering:!0,textureHalfFloatRender:!0,textureLOD:!0,drawBuffersExtension:!0,depthTextureExtension:!0,vertexArrayObject:!1,instancedArrays:!0,timerQuery:"undefined"!=typeof BigUint64Array&&-1!==this.enabledExtensions.indexOf(Jn.TimestampQuery)||void 0,supportOcclusionQuery:"undefined"!=typeof BigUint64Array,canUseTimestampForTimerQuery:!0,multiview:!1,oculusMultiview:!1,parallelShaderCompile:void 0,blendMinMax:!0,maxMSAASamples:4,canUseGLInstanceID:!0,canUseGLVertexID:!0,supportComputeShaders:!0,supportSRGBBuffers:!0,supportTransformFeedbacks:!1,textureMaxLevel:!0,texture2DArrayMaxLayerCount:2048},this._caps.parallelShaderCompile=null,this._features={forceBitmapOverHTMLImageElement:!0,supportRenderAndCopyToLodForFloatTextures:!0,supportDepthStencilTexture:!0,supportShadowSamplers:!0,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:!0,trackUbosInFrame:!0,checkUbosContentBeforeUpload:!0,supportCSM:!0,basisNeedsPOT:!1,support3DTextures:!0,needTypeSuffixInShaderConstants:!0,supportMSAA:!0,supportSSAO2:!0,supportExtendedTextureFormats:!0,supportSwitchCaseInShader:!0,supportSyncTextureRead:!1,needsInvertingBitmap:!1,useUBOBindingCache:!1,needShaderCodeInlining:!0,needToAlwaysBindUniformBuffers:!0,supportRenderPasses:!0,supportSpriteInstancing:!0,_collectUbosUpdatedInFrame:!1}}_initializeContextAndSwapChain(){this._context=this._canvas.getContext("webgpu"),this._configureContext(),this._colorFormat=this._options.swapChainFormat,this._mainRenderPassWrapper.colorAttachmentGPUTextures=[new zr],this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].format=this._colorFormat}_initializeMainAttachments(){var e;if(!this._bufferManager)return;this._mainTextureExtends={width:this.getRenderWidth(),height:this.getRenderHeight(),depthOrArrayLayers:1};const t=new Float32Array([this.getRenderHeight()]);let i;if(this._bufferManager.setSubData(this._ubInvertY,4,t),this._bufferManager.setSubData(this._ubDontInvertY,4,t),this._options.antialiasing){const t={size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:ir.E2d,format:this._options.swapChainFormat,usage:nr.RenderAttachment};null===(e=this._mainTexture)||void 0===e||e.destroy(),this._mainTexture=this._device.createTexture(t),i=[{view:this._mainTexture.createView(),clearValue:new Br.HE(0,0,0,1),loadOp:Ir.Clear,storeOp:Mr.Store}]}else i=[{view:void 0,clearValue:new Br.HE(0,0,0,1),loadOp:Ir.Clear,storeOp:Mr.Store}];this._mainRenderPassWrapper.depthTextureFormat=this.isStencilEnable?or.Depth24PlusStencil8:or.Depth32Float,this._setDepthTextureFormat(this._mainRenderPassWrapper);const n={size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:ir.E2d,format:this._mainRenderPassWrapper.depthTextureFormat,usage:nr.RenderAttachment};this._depthTexture&&this._depthTexture.destroy(),this._depthTexture=this._device.createTexture(n);const r={view:this._depthTexture.createView(),depthClearValue:this._clearDepthValue,depthLoadOp:Ir.Clear,depthStoreOp:Mr.Store,stencilClearValue:this._clearStencilValue,stencilLoadOp:this.isStencilEnable?Ir.Clear:void 0,stencilStoreOp:this.isStencilEnable?Mr.Store:void 0};this._mainRenderPassWrapper.renderPassDescriptor={colorAttachments:i,depthStencilAttachment:r},null!==this._mainRenderPassWrapper.renderPass&&this._endMainRenderPass()}_configureContext(){this._context.configure({device:this._device,format:this._options.swapChainFormat,usage:nr.RenderAttachment|nr.CopySrc,alphaMode:this.premultipliedAlpha?Or.Premultiplied:Or.Opaque})}setSize(e,t,i=!1){return!!super.setSize(e,t,i)&&(this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count0,l._cachedWrapU=0,l._cachedWrapV=0,l._useSRGBBuffer=a.useSRGBBuffer,this._internalTexturesCache.push(l),i||this._textureHelper.createGPUTextureForInternalTexture(l,c,h,_||1,a.creationFlags),l}createTexture(e,t,i,n,r=3,s=null,o=null,a=null,l=null,c=null,h=null,_,d,u,p){return this._createTextureBase(e,t,i,n,r,s,o,((e,t,i,n,r,s,o,a)=>{var l;const h=n;if(e.baseWidth=h.width,e.baseHeight=h.height,e.width=h.width,e.height=h.height,e.format=null!=c?c:-1,a(e.width,e.height,h,t,e,(()=>{})),null===(l=e._hardwareTexture)||void 0===l?void 0:l.underlyingResource)s||o||this._generateMipmaps(e,this._uploadEncoder);else{const t=this._textureHelper.createGPUTextureForInternalTexture(e,h.width,h.height,void 0,u);Qr.IsImageBitmap(h)&&(this._textureHelper.updateTexture(h,e,h.width,h.height,e.depth,t.format,0,0,r,!1,0,0),s||o||this._generateMipmaps(e,this._uploadEncoder))}i&&i.removePendingData(e),e.isReady=!0,e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}),(()=>!1),a,l,c,h,_,d,p)}wrapWebGPUTexture(e){const t=new zr(e),i=new Mt.l(this,Mt.S.Unknown,!0);return i._hardwareTexture=t,i.isReady=!0,i}wrapWebGLTexture(){throw new Error("wrapWebGLTexture is not supported, use wrapWebGPUTexture instead.")}generateMipMapsForCubemap(e){var t;e.generateMipMaps&&((null===(t=e._hardwareTexture)||void 0===t?void 0:t.underlyingResource)||this._textureHelper.createGPUTextureForInternalTexture(e),this._generateMipmaps(e,e.source===Mt.S.RenderTarget||e.source===Mt.S.MultiRenderTarget?this._renderTargetEncoder:void 0))}updateTextureSamplingMode(e,t,i=!1){i&&(t.generateMipMaps=!0,this._generateMipmaps(t)),t.samplingMode=e}updateTextureWrappingMode(e,t,i=null,n=null){null!==t&&(e._cachedWrapU=t),null!==i&&(e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==n&&(e._cachedWrapR=n)}updateTextureDimensions(e,t,i,n=1){if(!e._hardwareTexture)return;if(e.width===t&&e.height===i&&e.depth===n)return;const r=e._hardwareTexture.textureAdditionalUsages;e._hardwareTexture.release(),this._textureHelper.createGPUTextureForInternalTexture(e,t,i,n,r)}_setInternalTexture(e,t,i){if(i=null!=i?i:e,this._currentEffect){const n=this._currentEffect._pipelineContext.shaderProcessingContext.availableTextures[i];if(this._currentMaterialContext.setTexture(e,t),n&&n.autoBindSampler){const e=i+Nr.AutoSamplerSuffix;this._currentMaterialContext.setSampler(e,t)}}}setTexture(e,t,i,n){this._setTexture(e,i,!1,!1,n,n)}setTextureArray(e,t,i,n){for(let e=0;e0;for(const t in e){const r=e[t],s=i[t],o=s.group,a=s.binding,l=r.type,c=r.object;let h=r.indexInGroupEntries,_=this._bindGroupEntries[o];switch(_||(_=this._bindGroupEntries[o]=[]),l){case wi.Sampler:{const e=c;void 0!==h&&n?_[h].resource=this._cacheSampler.getSampler(e):(r.indexInGroupEntries=_.length,_.push({binding:a,resource:this._cacheSampler.getSampler(e)}));break}case wi.Texture:case wi.TextureWithoutSampler:{const e=c,t=e._texture._hardwareTexture;void 0!==h&&n?(l===wi.Texture&&(_[h++].resource=this._cacheSampler.getSampler(e._texture)),_[h].resource=t.view):(r.indexInGroupEntries=_.length,l===wi.Texture&&_.push({binding:a-1,resource:this._cacheSampler.getSampler(e._texture)}),_.push({binding:a,resource:t.view}));break}case wi.StorageTexture:{const e=c,t=e._texture._hardwareTexture;0==(t.textureAdditionalUsages&nr.StorageBinding)&&u.Y.Error(`computeDispatch: The texture (name=${e.name}, uniqueId=${e.uniqueId}) is not a storage texture!`,50),void 0!==h&&n?_[h].resource=t.viewForWriting:(r.indexInGroupEntries=_.length,_.push({binding:a,resource:t.viewForWriting}));break}case wi.UniformBuffer:case wi.StorageBuffer:{const e=(wi.UniformBuffer,c).getBuffer(),t=e.underlyingResource;void 0!==h&&n?(_[h].resource.buffer=t,_[h].resource.size=e.capacity):(r.indexInGroupEntries=_.length,_.push({binding:a,resource:{buffer:t,offset:0,size:e.capacity}}));break}}}for(let e=0;e{this.computeDispatch(e,t,i,n,r,s,o)}));const a=e._pipelineContext,l=t;a.computePipeline||(a.computePipeline=this._device.createComputePipeline({layout:mr.Auto,compute:a.stage}));const c=this._renderTargetEncoder.beginComputePass();c.setPipeline(a.computePipeline);const h=l.getBindGroups(i,a.computePipeline,o);for(let e=0;e{const i=t,s=i[0].width,a=s;this._setCubeMapTextureParams(e,!n),e.format=null!=o?o:-1;const l=this._textureHelper.createGPUTextureForInternalTexture(e,s,a);this._textureHelper.updateCubeTextures(i,l.underlyingResource,s,a,l.format,!1,!1,0,0),n||this._generateMipmaps(e,this._uploadEncoder),e.isReady=!0,e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear(),r&&r()}),!!d)},ws.prototype._setCubeMapTextureParams=function(e,t,i){e.samplingMode=t?3:2,e._cachedWrapU=0,e._cachedWrapV=0,i&&(e._maxLodLevel=i)},ws.prototype._debugPushGroup=function(e,t){this._options.enableGPUDebugMarkers&&(0===t||1===t?(0===t?this._renderEncoder:this._renderTargetEncoder).pushDebugGroup(e):this._currentRenderPass?this._currentRenderPass.pushDebugGroup(e):this._pendingDebugCommands.push(["push",e]))},ws.prototype._debugPopGroup=function(e){this._options.enableGPUDebugMarkers&&(0===e||1===e?(0===e?this._renderEncoder:this._renderTargetEncoder).popDebugGroup():this._currentRenderPass?this._currentRenderPass.popDebugGroup():this._pendingDebugCommands.push(["pop",null]))},ws.prototype._debugInsertMarker=function(e,t){this._options.enableGPUDebugMarkers&&(0===t||1===t?(0===t?this._renderEncoder:this._renderTargetEncoder).insertDebugMarker(e):this._currentRenderPass?this._currentRenderPass.insertDebugMarker(e):this._pendingDebugCommands.push(["insert",e]))},ws.prototype._debugFlushPendingCommands=function(){for(let e=0;e{const i=d.width,s=o(e);if(!s)return;const c=[0,2,4,1,3,5];if(a){const e=4===n,t=a(s),o=d._hardwareTexture,l=[0,1,2,3,4,5];for(let n=0;n>n,a=[];for(let i=0;i<6;i++){let o=t[n][l[i]];e&&(o=Ls(o,s,s,r)),a.push(new Uint8Array(o.buffer,o.byteOffset,o.byteLength))}this._textureHelper.updateCubeTextures(a,o.underlyingResource,s,s,o.format,_,!1,0,0)}}else{const e=[];for(let t=0;t<6;t++)e.push(s[c[t]]);this.updateRawCubeTexture(d,e,n,r,_)}d.isReady=!0,null==t||t.removePendingData(d),l&&l()};return this._loadFile(e,(e=>{u(e)}),void 0,null==t?void 0:t.offlineProvider,!0,((e,i)=>{null==t||t.removePendingData(d),c&&e&&c(e.status+" "+e.statusText,i)})),d},ws.prototype.createRawTexture3D=function(e,t,i,n,r,s,o,a,l=null,c=0,h=0){const _=Mt.S.Raw3D,d=new Mt.l(this,_);return d.baseWidth=t,d.baseHeight=i,d.baseDepth=n,d.width=t,d.height=i,d.depth=n,d.format=r,d.type=c,d.generateMipMaps=s,d.samplingMode=a,d.is3D=!0,this._doNotHandleContextLost||(d._bufferView=e),this._textureHelper.createGPUTextureForInternalTexture(d,t,i,void 0,h),this.updateRawTexture3D(d,e,r,o,l,c),this._internalTexturesCache.push(d),d},ws.prototype.updateRawTexture3D=function(e,t,i,n,r=null,s=0){if(this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r),t){const r=e._hardwareTexture;4===i&&(t=Ls(t,e.width,e.height,s));const o=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this._textureHelper.updateTexture(o,e,e.width,e.height,e.depth,r.format,0,0,n,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder)}e.isReady=!0},ws.prototype.createRawTexture2DArray=function(e,t,i,n,r,s,o,a,l=null,c=0,h=0){const _=Mt.S.Raw2DArray,d=new Mt.l(this,_);return d.baseWidth=t,d.baseHeight=i,d.baseDepth=n,d.width=t,d.height=i,d.depth=n,d.format=r,d.type=c,d.generateMipMaps=s,d.samplingMode=a,d.is2DArray=!0,this._doNotHandleContextLost||(d._bufferView=e),this._textureHelper.createGPUTextureForInternalTexture(d,t,i,n,h),this.updateRawTexture2DArray(d,e,r,o,l,c),this._internalTexturesCache.push(d),d},ws.prototype.updateRawTexture2DArray=function(e,t,i,n,r=null,s=0){if(this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r),t){const r=e._hardwareTexture;4===i&&(t=Ls(t,e.width,e.height,s));const o=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this._textureHelper.updateTexture(o,e,e.width,e.height,e.depth,r.format,0,0,n,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder)}e.isReady=!0},ws.prototype._readTexturePixels=function(e,t,i,n=-1,r=0,s=null,o=!0,a=!1,l=0,c=0){const h=e._hardwareTexture;return o&&this.flushFramebuffer(),this._textureHelper.readPixels(h.underlyingResource,l,c,t,i,h.format,n,r,s,a)},ws.prototype._readTexturePixelsSync=function(){throw"_readTexturePixelsSync is unsupported in WebGPU!"};class ks extends En.r{}ws.prototype._createHardwareRenderTargetWrapper=function(e,t,i){const n=new ks(e,t,i,this);return this._renderTargetWrapperCache.push(n),n},ws.prototype.createRenderTargetTexture=function(e,t){var i;const n=this._createHardwareRenderTargetWrapper(!1,!1,e),r={};void 0!==t&&"object"==typeof t?(r.generateMipMaps=t.generateMipMaps,r.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,r.generateStencilBuffer=r.generateDepthBuffer&&t.generateStencilBuffer,r.samplingMode=void 0===t.samplingMode?3:t.samplingMode,r.creationFlags=null!==(i=t.creationFlags)&&void 0!==i?i:0,r.noColorTarget=!!t.noColorTarget):(r.generateMipMaps=t,r.generateDepthBuffer=!0,r.generateStencilBuffer=!1,r.samplingMode=3,r.creationFlags=0,r.noColorTarget=!1);const s=r.noColorTarget?null:this._createInternalTexture(e,t,!0,Mt.S.RenderTarget);return n._generateDepthBuffer=r.generateDepthBuffer,n._generateStencilBuffer=!!r.generateStencilBuffer,n.setTextures(s),(n._generateDepthBuffer||n._generateStencilBuffer)&&n.createDepthStencilTexture(0,void 0===r.samplingMode||2===r.samplingMode||2===r.samplingMode||3===r.samplingMode||3===r.samplingMode||5===r.samplingMode||6===r.samplingMode||7===r.samplingMode||11===r.samplingMode,n._generateStencilBuffer,n.samples),s&&(void 0!==t&&"object"==typeof t&&t.createMipMaps&&!r.generateMipMaps&&(s.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(s,void 0,void 0,void 0,r.creationFlags),void 0!==t&&"object"==typeof t&&t.createMipMaps&&!r.generateMipMaps&&(s.generateMipMaps=!1)),n},ws.prototype._createDepthStencilTexture=function(e,t){const i=new Mt.l(this,Mt.S.DepthStencil),n={bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1,samples:1,depthTextureFormat:t.generateStencil?13:14,...t};return i.format=n.depthTextureFormat,this._setupDepthStencilTexture(i,e,n.generateStencil,n.bilinearFiltering,n.comparisonFunction,n.samples),this._textureHelper.createGPUTextureForInternalTexture(i),this._internalTexturesCache.push(i),i},ws.prototype._setupDepthStencilTexture=function(e,t,i,n,r,s=1){const o=t.width||t,a=t.height||t,l=t.layers||0;e.baseWidth=o,e.baseHeight=a,e.width=o,e.height=a,e.is2DArray=l>0,e.depth=l,e.isReady=!0,e.samples=s,e.generateMipMaps=!1,e.samplingMode=n?2:1,e.type=1,e._comparisonFunction=r,e._cachedWrapU=0,e._cachedWrapV=0},ws.prototype.updateRenderTargetTextureSampleCount=function(e,t){return e&&e.texture&&e.samples!==t?(t=Math.min(t,this.getCaps().maxMSAASamples),this._textureHelper.createMSAATexture(e.texture,t),e._depthStencilTexture&&(this._textureHelper.createMSAATexture(e._depthStencilTexture,t),e._depthStencilTexture.samples=t),e.texture.samples=t,t):t},ws.prototype.createRenderTargetCubeTexture=function(e,t){const i=this._createHardwareRenderTargetWrapper(!1,!0,e),n={generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:0,samplingMode:3,format:5,samples:1,...t};n.generateStencilBuffer=n.generateDepthBuffer&&n.generateStencilBuffer,i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=n.generateStencilBuffer;const r=new Mt.l(this,Mt.S.RenderTarget);return r.width=e,r.height=e,r.depth=0,r.isReady=!0,r.isCube=!0,r.samples=n.samples,r.generateMipMaps=n.generateMipMaps,r.samplingMode=n.samplingMode,r.type=n.type,r.format=n.format,this._internalTexturesCache.push(r),i.setTextures(r),(i._generateDepthBuffer||i._generateStencilBuffer)&&i.createDepthStencilTexture(0,void 0===n.samplingMode||2===n.samplingMode||2===n.samplingMode||3===n.samplingMode||3===n.samplingMode||5===n.samplingMode||6===n.samplingMode||7===n.samplingMode||11===n.samplingMode,i._generateStencilBuffer,i.samples),t&&t.createMipMaps&&!n.generateMipMaps&&(r.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(r),t&&t.createMipMaps&&!n.generateMipMaps&&(r.generateMipMaps=!1),i},mn.Q.prototype.setTextureSampler=function(e,t){this._engine.setTextureSampler(e,t)},ws.prototype.setTextureSampler=function(e,t){var i;null===(i=this._currentMaterialContext)||void 0===i||i.setSampler(e,t)},mn.Q.prototype.setStorageBuffer=function(e,t){this._engine.setStorageBuffer(e,t)},ws.prototype.createStorageBuffer=function(e,t){return this._createBuffer(e,32|t)},ws.prototype.updateStorageBuffer=function(e,t,i,n){const r=e;let s;void 0===i&&(i=0),void 0===n?(s=t instanceof Array?new Float32Array(t):t instanceof ArrayBuffer?new Uint8Array(t):t,n=s.byteLength):s=t instanceof Array?new Float32Array(t):t instanceof ArrayBuffer?new Uint8Array(t):t,this._bufferManager.setSubData(r,i,s,0,n)},ws.prototype.readFromStorageBuffer=function(e,t,i,n){i=i||e.capacity;const r=this._bufferManager.createRawBuffer(i,er.MapRead|er.CopyDst);return this._renderTargetEncoder.copyBufferToBuffer(e.underlyingResource,null!=t?t:0,r,0,i),new Promise(((e,t)=>{this.onEndFrameObservable.addOnce((()=>{r.mapAsync(tr.Read,0,i).then((()=>{const t=r.getMappedRange(0,i);let s=n;if(void 0===s)s=new Uint8Array(i),s.set(new Uint8Array(t));else{const e=s.constructor;s=new e(s.buffer),s.set(new e(t))}r.unmap(),this._bufferManager.releaseBuffer(r),e(s)}),(e=>t(e)))}))}))},ws.prototype.setStorageBuffer=function(e,t){var i,n;null===(i=this._currentDrawContext)||void 0===i||i.setBuffer(e,null!==(n=null==t?void 0:t.getBuffer())&&void 0!==n?n:null)},ws.prototype.createUniformBuffer=function(e){let t;return t=e instanceof Array?new Float32Array(e):e,this._bufferManager.createBuffer(t,er.Uniform|er.CopyDst)},ws.prototype.createDynamicUniformBuffer=function(e){return this.createUniformBuffer(e)},ws.prototype.updateUniformBuffer=function(e,t,i,n){void 0===i&&(i=0);const r=e;let s;void 0===n?(s=t instanceof Float32Array?t:new Float32Array(t),n=s.byteLength):s=t instanceof Float32Array?t:new Float32Array(t),this._bufferManager.setSubData(r,i,s,0,n)},ws.prototype.bindUniformBufferBase=function(e,t,i){this._currentDrawContext.setBuffer(i,e)},ws.prototype.bindUniformBlock=function(){},ws.prototype.updateVideoTexture=function(e,t,i){var n;if(!e||e._isDisabled)return;void 0===this._videoTextureSupported&&(this._videoTextureSupported=!0);let r=e._hardwareTexture;(null===(n=e._hardwareTexture)||void 0===n?void 0:n.underlyingResource)||(r=this._textureHelper.createGPUTextureForInternalTexture(e)),this.createImageBitmap(t).then((t=>{this._textureHelper.updateTexture(t,e,e.width,e.height,e.depth,r.format,0,0,!i,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder),e.isReady=!0})).catch((()=>{e.isReady=!0}))},i("../../../node_modules/@babylonjs/core/Engines/WebGL/webGLPipelineContext.js"),i("../../../node_modules/@babylonjs/core/Events/clipboardEvents.js");var Vs=i("../../../node_modules/@babylonjs/core/Loading/sceneLoader.js");class Us extends Ht{constructor(e){super(e),this.controllerType=Ke.DAYDREAM}initControllerMesh(e,t){Vs.n.ImportMesh("",Us.MODEL_BASE_URL,Us.MODEL_FILENAME,e,(e=>{this._defaultModel=e[1],this.attachToMesh(this._defaultModel),t&&t(this._defaultModel)}))}_handleButtonChange(e,t){if(0===e){const e=this.onTriggerStateChangedObservable;e&&e.notifyObservers(t)}else u.Y.Warn(`Unrecognized Daydream button index: ${e}`)}}Us.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",Us.MODEL_FILENAME="generic.babylon",Us.GAMEPAD_ID_PREFIX="Daydream",it._ControllerFactories.push({canCreate:e=>0===e.id.indexOf(Us.GAMEPAD_ID_PREFIX),create:e=>new Us(e)});class Gs extends Ht{constructor(e){super(e),this._buttonIndexToObservableNameMap=["onPadStateChangedObservable","onTriggerStateChangedObservable"],this.controllerType=Ke.GEAR_VR,this._calculatedPosition=new o.P("left"==this.hand?-.15:.15,-.5,.25),this._disableTrackPosition(this._calculatedPosition)}initControllerMesh(e,t){Vs.n.ImportMesh("",Gs.MODEL_BASE_URL,Gs.MODEL_FILENAME,e,(i=>{const n=new je.Kj("",e);i[1].parent=n,i[1].position.z=-.15,this._defaultModel=n,this.attachToMesh(this._defaultModel),t&&t(this._defaultModel)}))}_handleButtonChange(e,t){if(e0===e.id.indexOf(Gs.GAMEPAD_ID_PREFIX)||-1!==e.id.indexOf("Oculus Go")||-1!==e.id.indexOf("Vive Focus"),create:e=>new Gs(e)});class js extends Ht{constructor(e){super(e)}initControllerMesh(e,t){Vs.n.ImportMesh("",js.MODEL_BASE_URL,js.MODEL_FILENAME,e,(e=>{this._defaultModel=e[1],this.attachToMesh(this._defaultModel),t&&t(this._defaultModel)}))}_handleButtonChange(e,t){console.log("Button id: "+e+"state: "),console.dir(t)}}js.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",js.MODEL_FILENAME="generic.babylon",it._DefaultControllerFactory=e=>new js(e);class Ws extends Ht{constructor(e){super(e),this.onSecondaryTriggerStateChangedObservable=new s.y$,this.onThumbRestChangedObservable=new s.y$,this.controllerType=Ke.OCULUS}initControllerMesh(e,t){let i;i="left"===this.hand?Ws.MODEL_LEFT_FILENAME:Ws.MODEL_RIGHT_FILENAME,Vs.n.ImportMesh("",Ws._IsQuest?Ws.QUEST_MODEL_BASE_URL:Ws.MODEL_BASE_URL,i,e,(e=>{this._defaultModel=Ws._IsQuest?e[0]:e[1],this.attachToMesh(this._defaultModel),t&&t(this._defaultModel)}))}get onAButtonStateChangedObservable(){if("right"===this.hand)return this.onMainButtonStateChangedObservable;throw new Error("No A button on left hand")}get onBButtonStateChangedObservable(){if("right"===this.hand)return this.onSecondaryButtonStateChangedObservable;throw new Error("No B button on left hand")}get onXButtonStateChangedObservable(){if("left"===this.hand)return this.onMainButtonStateChangedObservable;throw new Error("No X button on right hand")}get onYButtonStateChangedObservable(){if("left"===this.hand)return this.onSecondaryButtonStateChangedObservable;throw new Error("No Y button on right hand")}_handleButtonChange(e,t){const i=t,n="right"===this.hand?-1:1;switch(e){case 0:return void this.onPadStateChangedObservable.notifyObservers(i);case 1:return!Ws._IsQuest&&this._defaultModel&&(this._defaultModel.getChildren()[3].rotation.x=.2*-i.value,this._defaultModel.getChildren()[3].position.y=.005*-i.value,this._defaultModel.getChildren()[3].position.z=.005*-i.value),void this.onTriggerStateChangedObservable.notifyObservers(i);case 2:return!Ws._IsQuest&&this._defaultModel&&(this._defaultModel.getChildren()[4].position.x=n*i.value*.0035),void this.onSecondaryTriggerStateChangedObservable.notifyObservers(i);case 3:return!Ws._IsQuest&&this._defaultModel&&(i.pressed?this._defaultModel.getChildren()[1].position.y=-.001:this._defaultModel.getChildren()[1].position.y=0),void this.onMainButtonStateChangedObservable.notifyObservers(i);case 4:return!Ws._IsQuest&&this._defaultModel&&(i.pressed?this._defaultModel.getChildren()[2].position.y=-.001:this._defaultModel.getChildren()[2].position.y=0),void this.onSecondaryButtonStateChangedObservable.notifyObservers(i);case 5:return void this.onThumbRestChangedObservable.notifyObservers(i)}}}Ws.MODEL_BASE_URL="https://controllers.babylonjs.com/oculus/",Ws.MODEL_LEFT_FILENAME="left.babylon",Ws.MODEL_RIGHT_FILENAME="right.babylon",Ws.QUEST_MODEL_BASE_URL="https://controllers.babylonjs.com/oculusQuest/",Ws._IsQuest=!1,it._ControllerFactories.push({canCreate:e=>(m.l.LastCreatedEngine&&m.l.LastCreatedEngine._vrDisplay&&"Oculus Quest"===m.l.LastCreatedEngine._vrDisplay.displayName&&(Ws._IsQuest=!0),-1!==e.id.indexOf("Oculus Touch")),create:e=>new Ws(e)});class zs extends Ht{constructor(e){super(e),this.controllerType=Ke.VIVE,this._invertLeftStickY=!0}initControllerMesh(e,t){Vs.n.ImportMesh("",zs.MODEL_BASE_URL,zs.MODEL_FILENAME,e,(e=>{this._defaultModel=e[1],this.attachToMesh(this._defaultModel),t&&t(this._defaultModel)}))}get onLeftButtonStateChangedObservable(){return this.onMainButtonStateChangedObservable}get onRightButtonStateChangedObservable(){return this.onMainButtonStateChangedObservable}get onMenuButtonStateChangedObservable(){return this.onSecondaryButtonStateChangedObservable}_handleButtonChange(e,t){const i=t;switch(e){case 0:return void this.onPadStateChangedObservable.notifyObservers(i);case 1:return this._defaultModel&&(this._defaultModel.getChildren()[6].rotation.x=.15*-i.value),void this.onTriggerStateChangedObservable.notifyObservers(i);case 2:return void this.onMainButtonStateChangedObservable.notifyObservers(i);case 3:return this._defaultModel&&(i.pressed?this._defaultModel.getChildren()[2].position.y=-.001:this._defaultModel.getChildren()[2].position.y=0),void this.onSecondaryButtonStateChangedObservable.notifyObservers(i)}}}zs.MODEL_BASE_URL="https://controllers.babylonjs.com/vive/",zs.MODEL_FILENAME="wand.babylon",it._ControllerFactories.push({canCreate:e=>-1!==e.id.toLowerCase().indexOf("openvr"),create:e=>new zs(e)});class Hs{constructor(){this.buttonMeshes={},this.axisMeshes={}}}class Xs extends Ht{constructor(e){super(e),this._mapping={buttons:["thumbstick","trigger","grip","menu","trackpad"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",grip:"GRASP",thumbstick:"THUMBSTICK_PRESS",trackpad:"TOUCHPAD_PRESS"},buttonObservableNames:{trigger:"onTriggerStateChangedObservable",menu:"onSecondaryButtonStateChangedObservable",grip:"onMainButtonStateChangedObservable",thumbstick:"onPadStateChangedObservable",trackpad:"onTrackpadChangedObservable"},axisMeshNames:["THUMBSTICK_X","THUMBSTICK_Y","TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_Y"],pointingPoseMeshName:nt.POINTING_POSE},this.onTrackpadChangedObservable=new s.y$,this.onTrackpadValuesChangedObservable=new s.y$,this.trackpad={x:0,y:0},this.controllerType=Ke.WINDOWS,this._loadedMeshInfo=null}get onTriggerButtonStateChangedObservable(){return this.onTriggerStateChangedObservable}get onMenuButtonStateChangedObservable(){return this.onSecondaryButtonStateChangedObservable}get onGripButtonStateChangedObservable(){return this.onMainButtonStateChangedObservable}get onThumbstickButtonStateChangedObservable(){return this.onPadStateChangedObservable}get onTouchpadButtonStateChangedObservable(){return this.onTrackpadChangedObservable}get onTouchpadValuesChangedObservable(){return this.onTrackpadValuesChangedObservable}_updateTrackpad(){!this.browserGamepad.axes||this.browserGamepad.axes[2]==this.trackpad.x&&this.browserGamepad.axes[3]==this.trackpad.y||(this.trackpad.x=this.browserGamepad.axes[this._mapping.axisMeshNames.indexOf("TOUCHPAD_TOUCH_X")],this.trackpad.y=this.browserGamepad.axes[this._mapping.axisMeshNames.indexOf("TOUCHPAD_TOUCH_Y")],this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad))}update(){if(super.update(),this.browserGamepad.axes&&(this._updateTrackpad(),this._loadedMeshInfo))for(let e=0;e{this._loadedMeshInfo=this._processModel(e,i),this._loadedMeshInfo&&(this._defaultModel=this._loadedMeshInfo.rootNode,this.attachToMesh(this._defaultModel),t&&t(this._defaultModel))}),null,((e,s)=>{u.Y.Log(s),u.Y.Warn("Failed to retrieve controller model from the remote server: "+n+r),i||this.initControllerMesh(e,t,!0)}))}_processModel(e,t){let i=null;const n=new je.Kj(this.id+" "+this.hand,e);let r=null;for(let e=0;ee.name===t),!1)[0]}function r(e,t){return e.getChildren((e=>e.name==t),!0)[0]}}getForwardRay(e=100){if(!this._loadedMeshInfo||!this._loadedMeshInfo.pointingPoseNode)return super.getForwardRay(e);const t=this._loadedMeshInfo.pointingPoseNode.getWorldMatrix(),i=t.getTranslation(),n=new o.P(0,0,-1),r=o.P.TransformNormal(n,t),s=o.P.Normalize(r);return new tt.z(i,s,e)}dispose(){super.dispose(),this.onTrackpadChangedObservable.clear(),this.onTrackpadValuesChangedObservable.clear()}}Xs.MODEL_BASE_URL="https://controllers.babylonjs.com/microsoft/",Xs.MODEL_LEFT_FILENAME="left.glb",Xs.MODEL_RIGHT_FILENAME="right.glb",Xs.GAMEPAD_ID_PREFIX="Spatial Controller (Spatial Interaction Source) ",Xs.GAMEPAD_ID_PATTERN=/([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/,it._ControllerFactories.push({canCreate:e=>0===e.id.indexOf(Xs.GAMEPAD_ID_PREFIX),create:e=>new Xs(e)}),i("../../../node_modules/@babylonjs/core/Misc/pivotTools.js");var Ys=i("../../../node_modules/@babylonjs/core/Meshes/Builders/planeBuilder.js");class Qs extends Yi.t{constructor(e,t=a.Wo.Gray(),i=Qi.x.DefaultUtilityLayer,n=32,r=null,l=!1,c=1){var h;super(i),this._pointerObserver=null,this.snapDistance=0,this.onSnapObservable=new s.y$,this.angle=0,this._isEnabled=!0,this._parent=null,this._dragging=!1,this._angles=new o.P,this._parent=r,this._coloredMaterial=new Yt.K("",i.utilityLayerScene),this._coloredMaterial.diffuseColor=t,this._coloredMaterial.specularColor=t.subtract(new a.Wo(.1,.1,.1)),this._hoverMaterial=new Yt.K("",i.utilityLayerScene),this._hoverMaterial.diffuseColor=a.Wo.Yellow(),this._disableMaterial=new Yt.K("",i.utilityLayerScene),this._disableMaterial.diffuseColor=a.Wo.Gray(),this._disableMaterial.alpha=.4,this._gizmoMesh=new je.Kj("",i.utilityLayerScene);const{rotationMesh:_,collider:d}=this._createGizmoMesh(this._gizmoMesh,c,n);this._rotationDisplayPlane=(0,Ys.pT)("rotationDisplay",{size:.6,updatable:!1},this.gizmoLayer.utilityLayerScene),this._rotationDisplayPlane.rotation.z=.5*Math.PI,this._rotationDisplayPlane.parent=this._gizmoMesh,this._rotationDisplayPlane.setEnabled(!1),mn.Q.ShadersStore.rotationGizmoVertexShader=Qs._RotationGizmoVertexShader,mn.Q.ShadersStore.rotationGizmoFragmentShader=Qs._RotationGizmoFragmentShader,this._rotationShaderMaterial=new an.j("shader",this.gizmoLayer.utilityLayerScene,{vertex:"rotationGizmo",fragment:"rotationGizmo"},{attributes:["position","uv"],uniforms:["worldViewProjection","angles"]}),this._rotationShaderMaterial.backFaceCulling=!1,this._rotationDisplayPlane.material=this._rotationShaderMaterial,this._rotationDisplayPlane.visibility=.999,this._gizmoMesh.lookAt(this._rootMesh.position.add(e)),this._rootMesh.addChild(this._gizmoMesh,Yi.t.PreserveScaling),this._gizmoMesh.scaling.scaleInPlace(1/3),this.dragBehavior=new ie.M({dragPlaneNormal:e}),this.dragBehavior.moveAttached=!1,this.dragBehavior.maxDragAngle=Qs.MaxDragAngle,this.dragBehavior._useAlternatePickedPointAboveMaxDragAngle=!0,this._rootMesh.addBehavior(this.dragBehavior);const u=new o.P,p=new o.y3,f=new o.P;let m=new o.P;this.dragBehavior.onDragStartObservable.add((e=>{this.attachedNode&&(u.copyFrom(e.dragPlanePoint),this._rotationDisplayPlane.setEnabled(!0),this._rotationDisplayPlane.getWorldMatrix().invertToRef(p),o.P.TransformCoordinatesToRef(e.dragPlanePoint,p,u),this._angles.x=Math.atan2(u.y,u.x)+Math.PI,this._angles.y=0,this._angles.z=this.updateGizmoRotationToMatchAttachedMesh?1:0,this._dragging=!0,u.copyFrom(e.dragPlanePoint),this._rotationShaderMaterial.setVector3("angles",this._angles),this.angle=0)})),this.dragBehavior.onDragEndObservable.add((()=>{this._dragging=!1,this._rotationDisplayPlane.setEnabled(!1)}));const g={snapDistance:0};let b=0;const y=new o.y3,v=new o._f;this.dragBehavior.onDragObservable.add((t=>{if(this.attachedNode){const n=new o.P(1,1,1),r=new o._f(0,0,0,1),s=new o.P(0,0,0);this._handlePivot(),this.attachedNode.getWorldMatrix().decompose(n,r,s);const a=t.dragPlanePoint.subtract(s).normalize(),l=u.subtract(s).normalize(),c=o.P.Cross(a,l),h=o.P.Dot(a,l);let _=Math.atan2(c.length(),h);f.copyFrom(e),m.copyFrom(e),this.updateGizmoRotationToMatchAttachedMesh&&(r.toRotationMatrix(p),m=o.P.TransformCoordinates(f,p));let d=!1;if(i.utilityLayerScene.activeCamera){const e=i.utilityLayerScene.activeCamera.position.subtract(s).normalize();o.P.Dot(e,m)>0&&(f.scaleInPlace(-1),m.scaleInPlace(-1),d=!0)}o.P.Dot(m,c)>0&&(_=-_);let A=!1;if(0!=this.snapDistance)if(b+=_,Math.abs(b)>this.snapDistance){let e=Math.floor(Math.abs(b)/this.snapDistance);b<0&&(e*=-1),b%=this.snapDistance,_=this.snapDistance*e,A=!0}else _=0;const C=Math.sin(_/2);if(v.set(f.x*C,f.y*C,f.z*C,Math.cos(_/2)),y.determinant()>0){const e=new o.P;v.toEulerAnglesToRef(e),o._f.RotationYawPitchRollToRef(e.y,-e.x,-e.z,v)}this.updateGizmoRotationToMatchAttachedMesh?r.multiplyToRef(v,r):v.multiplyToRef(r,r),this.attachedNode.getWorldMatrix().copyFrom(o.y3.Compose(n,r,s)),u.copyFrom(t.dragPlanePoint),A&&(g.snapDistance=_,this.onSnapObservable.notifyObservers(g)),this._angles.y+=_,this.angle+=d?-_:_,this._rotationShaderMaterial.setVector3("angles",this._angles),this._matrixChanged()}}));const A=i._getSharedGizmoLight();A.includedOnlyMeshes=A.includedOnlyMeshes.concat(this._rootMesh.getChildMeshes(!1));const C={colliderMeshes:[d],gizmoMeshes:[_],material:this._coloredMaterial,hoverMaterial:this._hoverMaterial,disableMaterial:this._disableMaterial,active:!1,dragBehavior:this.dragBehavior};null===(h=this._parent)||void 0===h||h.addToAxisCache(this._gizmoMesh,C),this._pointerObserver=i.utilityLayerScene.onPointerObservable.add((e=>{var t;if(!this._customMeshSet&&(this.dragBehavior.maxDragAngle=Qs.MaxDragAngle,this._isHovered=!(-1==C.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),!this._parent)){const e=C.dragBehavior.enabled?this._isHovered||this._dragging?this._hoverMaterial:this._coloredMaterial:this._disableMaterial;this._setGizmoMeshMaterial(C.gizmoMeshes,e)}})),this.dragBehavior.onEnabledObservable.add((e=>{this._setGizmoMeshMaterial(C.gizmoMeshes,e?this._coloredMaterial:this._disableMaterial)}))}_createGizmoMesh(e,t,i){const n=pi("ignore",{diameter:.6,thickness:.03*t,tessellation:i},this.gizmoLayer.utilityLayerScene);n.visibility=0;const r=pi("",{diameter:.6,thickness:.005*t,tessellation:i},this.gizmoLayer.utilityLayerScene);return r.material=this._coloredMaterial,r.rotation.x=Math.PI/2,n.rotation.x=Math.PI/2,e.addChild(r,Yi.t.PreserveScaling),e.addChild(n,Yi.t.PreserveScaling),{rotationMesh:r,collider:n}}_attachedNodeChanged(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)}set isEnabled(e){this._isEnabled=e,e?this._parent&&(this.attachedMesh=this._parent.attachedMesh):this.attachedMesh=null}get isEnabled(){return this._isEnabled}dispose(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._gizmoMesh&&this._gizmoMesh.dispose(),this._rotationDisplayPlane&&this._rotationDisplayPlane.dispose(),this._rotationShaderMaterial&&this._rotationShaderMaterial.dispose(),[this._coloredMaterial,this._hoverMaterial,this._disableMaterial].forEach((e=>{e&&e.dispose()})),super.dispose()}}function qs(e){const t=[];t[0]={vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},t[1]={vertex:[[0,0,1.414214],[1.414214,0,0],[0,1.414214,0],[-1.414214,0,0],[0,-1.414214,0],[0,0,-1.414214]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,1],[1,4,5],[1,5,2],[2,5,3],[3,5,4]]},t[2]={vertex:[[0,0,1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},t[3]={vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},t[4]={vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},t[5]={vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},t[6]={vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},t[7]={vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},t[8]={vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},t[9]={vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},t[10]={vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},t[11]={vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},t[12]={vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},t[13]={vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},t[14]={vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]};const i=e.type&&(e.type<0||e.type>=t.length)?0:e.type||0,n=e.size,r=e.sizeX||n||1,s=e.sizeY||n||1,l=e.sizeZ||n||1,c=e.custom||t[i],h=c.face.length,_=e.faceUV||new Array(h),d=e.faceColors,u=void 0===e.flat||e.flat,p=0===e.sideOrientation?0:e.sideOrientation||ci.x.DEFAULTSIDE,f=new Array,m=new Array,g=new Array,b=new Array,y=new Array;let v=0,A=0;const C=new Array;let S,x,T,E,R,P,I=0,M=0;if(u)for(M=0;MKs(e,t,i);var Zs=i("../../../node_modules/@babylonjs/core/Lights/directionalLight.js");function $s(e){const t=new Array,i=new Array,n=new Array,r=new Array,s=e.radius||.5,o=e.tessellation||64,a=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,l=0===e.sideOrientation?0:e.sideOrientation||ci.x.DEFAULTSIDE;t.push(0,0,0),r.push(.5,.5);const c=2*Math.PI*a,h=1===a?c/o:c/(o-1);let _=0;for(let e=0;eJs(e,{radius:t,tessellation:i,sideOrientation:s,updatable:r},n),je.Kj.CreateHemisphere=(e,t,i,n)=>eo(e,{segments:t,diameter:i},n);var to=i("../../../node_modules/@babylonjs/core/Lights/spotLight.js");class io extends Yi.t{constructor(e=Qi.x.DefaultUtilityLayer){super(e),this._cachedPosition=new o.P,this._cachedForward=new o.P(0,0,1),this._pointerObserver=null,this.onClickedObservable=new s.y$,this._light=null,this.attachedMesh=new zi.x("",this.gizmoLayer.utilityLayerScene),this._attachedMeshParent=new Et.Y("parent",this.gizmoLayer.utilityLayerScene),this.attachedMesh.parent=this._attachedMeshParent,this._material=new Yt.K("light",this.gizmoLayer.utilityLayerScene),this._material.diffuseColor=new a.Wo(.5,.5,.5),this._material.specularColor=new a.Wo(.1,.1,.1),this._pointerObserver=e.utilityLayerScene.onPointerObservable.add((e=>{this._light&&(this._isHovered=!(!e.pickInfo||-1==this._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)),this._isHovered&&0===e.event.button&&this.onClickedObservable.notifyObservers(this._light))}),Z.kD.POINTERDOWN)}get attachedNode(){return this.attachedMesh}set attachedNode(e){console.warn("Nodes cannot be attached to LightGizmo. Attach to a mesh instead.")}set light(e){if(this._light=e,e){this._lightMesh&&this._lightMesh.dispose(),e instanceof jt.e?this._lightMesh=io._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof Zs.O?this._lightMesh=io._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof to.P?this._lightMesh=io._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene):this._lightMesh=io._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene),this._lightMesh.getChildMeshes(!1).forEach((e=>{e.material=this._material})),this._lightMesh.parent=this._rootMesh;const t=this.gizmoLayer._getSharedGizmoLight();t.includedOnlyMeshes=t.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(!1)),this._lightMesh.rotationQuaternion=new o._f,this.attachedMesh.reservedDataStore||(this.attachedMesh.reservedDataStore={}),this.attachedMesh.reservedDataStore.lightGizmo=this,e.parent&&this._attachedMeshParent.freezeWorldMatrix(e.parent.getWorldMatrix()),e.position&&(this.attachedMesh.position.copyFrom(e.position),this.attachedMesh.computeWorldMatrix(!0),this._cachedPosition.copyFrom(this.attachedMesh.position)),e.direction&&(this.attachedMesh.setDirection(e.direction),this.attachedMesh.computeWorldMatrix(!0),this._cachedForward.copyFrom(this.attachedMesh.forward)),this._update()}}get light(){return this._light}get material(){return this._material}_update(){if(super._update(),this._light){if(this._light.parent&&this._attachedMeshParent.freezeWorldMatrix(this._light.parent.getWorldMatrix()),this._light.position)if(this.attachedMesh.position.equals(this._cachedPosition))this.attachedMesh.position.copyFrom(this._light.position),this.attachedMesh.computeWorldMatrix(!0),this._cachedPosition.copyFrom(this.attachedMesh.position);else{const e=this.attachedMesh.position;this._light.position=new o.P(e.x,e.y,e.z),this._cachedPosition.copyFrom(this.attachedMesh.position)}if(this._light.direction)if(o.P.DistanceSquared(this.attachedMesh.forward,this._cachedForward)>1e-4){const e=this.attachedMesh.forward;this._light.direction=new o.P(e.x,e.y,e.z),this._cachedForward.copyFrom(this.attachedMesh.forward)}else o.P.DistanceSquared(this.attachedMesh.forward,this._light.direction)>1e-4&&(this.attachedMesh.setDirection(this._light.direction),this.attachedMesh.computeWorldMatrix(!0),this._cachedForward.copyFrom(this.attachedMesh.forward))}}dispose(){this.onClickedObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this._material.dispose(),super.dispose(),this._attachedMeshParent.dispose()}static _CreateHemisphericLightMesh(e){const t=new je.Kj("hemisphereLight",e),i=eo(t.name,{segments:10,diameter:1},e);return i.position.z=-.15,i.rotation.x=Math.PI/2,i.parent=t,this._CreateLightLines(3,e).parent=t,t.scaling.scaleInPlace(io._Scale),t.rotation.x=Math.PI/2,t}static _CreatePointLightMesh(e){const t=new je.Kj("pointLight",e),i=en(t.name,{segments:10,diameter:1},e);return i.rotation.x=Math.PI/2,i.parent=t,this._CreateLightLines(5,e).parent=t,t.scaling.scaleInPlace(io._Scale),t.rotation.x=Math.PI/2,t}static _CreateSpotLightMesh(e){const t=new je.Kj("spotLight",e);en(t.name,{segments:10,diameter:1},e).parent=t;const i=eo(t.name,{segments:10,diameter:2},e);return i.parent=t,i.rotation.x=-Math.PI/2,this._CreateLightLines(2,e).parent=t,t.scaling.scaleInPlace(io._Scale),t.rotation.x=Math.PI/2,t}static _CreateDirectionalLightMesh(e){const t=new je.Kj("directionalLight",e),i=new je.Kj(t.name,e);i.parent=t,en(t.name,{diameter:1.2,segments:10},e).parent=i;const n=di(t.name,{updatable:!1,height:6,diameterTop:.3,diameterBottom:.3,tessellation:6,subdivisions:1},e);n.parent=i;let r=n.clone(t.name);r.scaling.y=.5,r.position.x+=1.25;let s=n.clone(t.name);s.scaling.y=.5,s.position.x+=-1.25;const o=di(t.name,{updatable:!1,height:1,diameterTop:0,diameterBottom:.6,tessellation:6,subdivisions:1},e);return o.position.y+=3,o.parent=i,r=o.clone(t.name),r.position.y=1.5,r.position.x+=1.25,s=o.clone(t.name),s.position.y=1.5,s.position.x+=-1.25,i.scaling.scaleInPlace(io._Scale),i.rotation.z=Math.PI/2,i.rotation.y=Math.PI/2,t}}io._Scale=.007,io._CreateLightLines=(e,t)=>{const i=new je.Kj("root",t);i.rotation.x=Math.PI/2;const n=new je.Kj("linePivot",t);n.parent=i;const r=di("line",{updatable:!1,height:2,diameterTop:.2,diameterBottom:.3,tessellation:6,subdivisions:1},t);if(r.position.y=r.scaling.y/2+1.2,r.parent=n,e<2)return n;for(let e=0;e<4;e++){const t=n.clone("lineParentClone");t.rotation.z=Math.PI/4,t.rotation.y=Math.PI/2+Math.PI/2*e,t.getChildMeshes()[0].scaling.y=.5,t.getChildMeshes()[0].scaling.x=t.getChildMeshes()[0].scaling.z=.8,t.getChildMeshes()[0].position.y=t.getChildMeshes()[0].scaling.y/2+1.2}if(e<3)return i;for(let e=0;e<4;e++){const t=n.clone("linePivotClone");t.rotation.z=Math.PI/2,t.rotation.y=Math.PI/2*e}if(e<4)return i;for(let e=0;e<4;e++){const t=n.clone("linePivotClone");t.rotation.z=Math.PI+Math.PI/4,t.rotation.y=Math.PI/2+Math.PI/2*e,t.getChildMeshes()[0].scaling.y=.5,t.getChildMeshes()[0].scaling.x=t.getChildMeshes()[0].scaling.z=.8,t.getChildMeshes()[0].position.y=t.getChildMeshes()[0].scaling.y/2+1.2}return e<5||(n.clone("linePivotClone").rotation.z=Math.PI),i};class no extends Yi.t{constructor(e=Qi.x.DefaultUtilityLayer){super(e),this._pointerObserver=null,this.onClickedObservable=new s.y$,this._camera=null,this._invProjection=new Br.y3,this._material=new Yt.K("cameraGizmoMaterial",this.gizmoLayer.utilityLayerScene),this._material.diffuseColor=new a.Wo(.5,.5,.5),this._material.specularColor=new a.Wo(.1,.1,.1),this._pointerObserver=e.utilityLayerScene.onPointerObservable.add((e=>{this._camera&&(this._isHovered=!(!e.pickInfo||-1==this._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)),this._isHovered&&0===e.event.button&&this.onClickedObservable.notifyObservers(this._camera))}),Z.kD.POINTERDOWN)}get displayFrustum(){return this._cameraLinesMesh.isEnabled()}set displayFrustum(e){this._cameraLinesMesh.setEnabled(e)}set camera(e){if(this._camera=e,this.attachedNode=e,e){this._cameraMesh&&this._cameraMesh.dispose(),this._cameraLinesMesh&&this._cameraLinesMesh.dispose(),this._cameraMesh=no._CreateCameraMesh(this.gizmoLayer.utilityLayerScene),this._cameraLinesMesh=no._CreateCameraFrustum(this.gizmoLayer.utilityLayerScene),this._cameraMesh.getChildMeshes(!1).forEach((e=>{e.material=this._material})),this._cameraMesh.parent=this._rootMesh,this._cameraLinesMesh.parent=this._rootMesh,this.gizmoLayer.utilityLayerScene.activeCamera&&this.gizmoLayer.utilityLayerScene.activeCamera.maxZ<1.5*e.maxZ&&(this.gizmoLayer.utilityLayerScene.activeCamera.maxZ=1.5*e.maxZ),this.attachedNode.reservedDataStore||(this.attachedNode.reservedDataStore={}),this.attachedNode.reservedDataStore.cameraGizmo=this;const t=this.gizmoLayer._getSharedGizmoLight();t.includedOnlyMeshes=t.includedOnlyMeshes.concat(this._cameraMesh.getChildMeshes(!1)),this._update()}}get camera(){return this._camera}get material(){return this._material}_update(){super._update(),this._camera&&(this._camera.getProjectionMatrix().invertToRef(this._invProjection),this._cameraLinesMesh.setPivotMatrix(this._invProjection,!1),this._cameraLinesMesh.scaling.x=1/this._rootMesh.scaling.x,this._cameraLinesMesh.scaling.y=1/this._rootMesh.scaling.y,this._cameraLinesMesh.scaling.z=1/this._rootMesh.scaling.z,this._cameraMesh.parent=null,this._cameraMesh.rotation.y=.5*Math.PI*(this._camera.getScene().useRightHandedSystem?1:-1),this._cameraMesh.parent=this._rootMesh)}dispose(){this.onClickedObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this._cameraMesh&&this._cameraMesh.dispose(),this._cameraLinesMesh&&this._cameraLinesMesh.dispose(),this._material.dispose(),super.dispose()}static _CreateCameraMesh(e){const t=new je.Kj("rootCameraGizmo",e),i=new je.Kj(t.name,e);i.parent=t,(0,$i.NR)(t.name,{width:1,height:.8,depth:.5},e).parent=i;const n=di(t.name,{height:.5,diameterTop:.8,diameterBottom:.8},e);n.parent=i,n.position.y=.3,n.position.x=-.6,n.rotation.x=.5*Math.PI;const r=di(t.name,{height:.5,diameterTop:.6,diameterBottom:.6},e);r.parent=i,r.position.y=.5,r.position.x=.4,r.rotation.x=.5*Math.PI;const s=di(t.name,{height:.5,diameterTop:.5,diameterBottom:.5},e);return s.parent=i,s.position.y=0,s.position.x=.6,s.rotation.z=.5*Math.PI,t.scaling.scaleInPlace(no._Scale),i.position.x=-.9,t}static _CreateCameraFrustum(e){const t=new je.Kj("rootCameraGizmo",e),i=new je.Kj(t.name,e);i.parent=t;for(let t=0;t<4;t+=2)for(let n=0;n<4;n+=2){let r=un("lines",{points:[new o.P(-1+n,-1+t,-1),new o.P(-1+n,-1+t,1)]},e);r.parent=i,r.alwaysSelectAsActiveMesh=!0,r.isPickable=!1,r=un("lines",{points:[new o.P(-1,-1+n,-1+t),new o.P(1,-1+n,-1+t)]},e),r.parent=i,r.alwaysSelectAsActiveMesh=!0,r.isPickable=!1,r=un("lines",{points:[new o.P(-1+n,-1,-1+t),new o.P(-1+n,1,-1+t)]},e),r.parent=i,r.alwaysSelectAsActiveMesh=!0,r.isPickable=!1}return t}}no._Scale=.05;var ro=i("../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.js");dt.v.IncludesShadersStore.kernelBlurVaryingDeclaration="varying vec2 sampleCoord{X};";dt.v.IncludesShadersStore.packingFunctions="vec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}";dt.v.IncludesShadersStore.kernelBlurFragment="#ifdef DOF\nfactor=sampleCoC(sampleCoord{X}); \ncomputedWeight=KERNEL_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\n#endif\n";dt.v.IncludesShadersStore.kernelBlurFragment2="#ifdef DOF\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});\ncomputedWeight=KERNEL_DEP_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif\n";dt.v.ShadersStore.kernelBlurPixelShader="uniform sampler2D textureSampler;\nuniform vec2 delta;\nvarying vec2 sampleCenter;\n#ifdef DOF\nuniform sampler2D circleOfConfusionSampler;\nuniform vec2 cameraMinMaxZ;\nfloat sampleDistance(in vec2 offset) {\nfloat depth=texture2D(circleOfConfusionSampler,offset).g; \nreturn cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth; \n}\nfloat sampleCoC(in vec2 offset) {\nfloat coc=texture2D(circleOfConfusionSampler,offset).r; \nreturn coc; \n}\n#endif\n#include[0..varyingCount]\n#ifdef PACKEDFLOAT\n#include\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nfloat computedWeight=0.0;\n#ifdef PACKEDFLOAT \nfloat blend=0.;\n#else\nvec4 blend=vec4(0.);\n#endif\n#ifdef DOF\nfloat sumOfWeights=CENTER_WEIGHT; \nfloat factor=0.0;\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include[0..varyingCount]\n#include[0..depCount]\n#ifdef PACKEDFLOAT\ngl_FragColor=pack(blend);\n#else\ngl_FragColor=blend;\n#endif\n#ifdef DOF\ngl_FragColor/=sumOfWeights;\n#endif\n}";dt.v.IncludesShadersStore.kernelBlurVertex="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};";dt.v.ShadersStore.kernelBlurVertexShader="attribute vec2 position;\nuniform vec2 delta;\nvarying vec2 sampleCenter;\n#include[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nsampleCenter=(position*madd+madd);\n#include[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";class so extends _t.D{constructor(e,t,i,n,r,s=K.x.BILINEAR_SAMPLINGMODE,o,a,l=0,c="",h=!1){super(e,"kernelBlur",["delta","direction","cameraMinMaxZ"],["circleOfConfusionSampler"],n,r,s,o,a,null,l,"kernelBlur",{varyingCount:0,depCount:0},!0),this._blockCompilation=h,this._packedFloat=!1,this._staticDefines="",this._staticDefines=c,this.direction=t,this.onApplyObservable.add((e=>{this._outputTexture?e.setFloat2("delta",1/this._outputTexture.width*this.direction.x,1/this._outputTexture.height*this.direction.y):e.setFloat2("delta",1/this.width*this.direction.x,1/this.height*this.direction.y)})),this.kernel=i}set kernel(e){this._idealKernel!==e&&(e=Math.max(e,1),this._idealKernel=e,this._kernel=this._nearestBestKernel(e),this._blockCompilation||this._updateParameters())}get kernel(){return this._idealKernel}set packedFloat(e){this._packedFloat!==e&&(this._packedFloat=e,this._blockCompilation||this._updateParameters())}get packedFloat(){return this._packedFloat}getClassName(){return"BlurPostProcess"}updateEffect(e=null,t=null,i=null,n,r,s){this._updateParameters(r,s)}_updateParameters(e,t){const i=this._kernel,n=(i-1)/2;let r=[],s=[],o=0;for(let e=0;e0)return Math.max(e,3);return Math.max(t,3)}_gaussianWeight(e){const t=1/3,i=-e*e/(2*t*t);return 1/(Math.sqrt(2*Math.PI)*t)*Math.exp(i)}_glslFloat(e,t=8){return e.toFixed(t).replace(/0+$/,"")}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new so(e.name,e.direction,e.kernel,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable,e.textureType,void 0,!1)),e,i,n)}}(0,X.gn)([(0,Y.qC)("kernel")],so.prototype,"_kernel",void 0),(0,X.gn)([(0,Y.qC)("packedFloat")],so.prototype,"_packedFloat",void 0),(0,X.gn)([(0,Y.QC)()],so.prototype,"direction",void 0),(0,l.H)("BABYLON.BlurPostProcess",so);class oo extends Ot._{constructor(e,t,i,n,r=0,s=K.x.BILINEAR_SAMPLINGMODE,a=!0){if(super(e,t,i,n,!0,r,!1,s,a),this.mirrorPlane=new be.J(0,1,0,1),this._transformMatrix=o.y3.Zero(),this._mirrorMatrix=o.y3.Zero(),this._adaptiveBlurKernel=0,this._blurKernelX=0,this._blurKernelY=0,this._blurRatio=1,!(i=this.getScene()))return this;this.ignoreCameraViewport=!0,this._updateGammaSpace(),this._imageProcessingConfigChangeObserver=i.imageProcessingConfiguration.onUpdateParameters.add((()=>{this._updateGammaSpace()}));const l=i.getEngine();let c;l.supportsUniformBuffers&&(this._sceneUBO=i.createSceneUniformBuffer(`Scene for Mirror Texture (name "${e}")`)),this.onBeforeBindObservable.add((()=>{var t;null===(t=l._debugPushGroup)||void 0===t||t.call(l,`mirror generation for ${e}`,1)})),this.onAfterUnbindObservable.add((()=>{var e;null===(e=l._debugPopGroup)||void 0===e||e.call(l,1)})),this.onBeforeRenderObservable.add((()=>{this._sceneUBO&&(this._currentSceneUBO=i.getSceneUniformBuffer(),i.setSceneUniformBuffer(this._sceneUBO),i.getSceneUniformBuffer().unbindEffect()),o.y3.ReflectionToRef(this.mirrorPlane,this._mirrorMatrix),this._mirrorMatrix.multiplyToRef(i.getViewMatrix(),this._transformMatrix),i.setTransformMatrix(this._transformMatrix,i.getProjectionMatrix()),c=i.clipPlane,i.clipPlane=this.mirrorPlane,i.getEngine().cullBackFaces=!1,i._mirroredCameraPosition=o.P.TransformCoordinates(i.activeCamera.globalPosition,this._mirrorMatrix)})),this.onAfterRenderObservable.add((()=>{this._sceneUBO&&i.setSceneUniformBuffer(this._currentSceneUBO),i.updateTransformMatrix(),i.getEngine().cullBackFaces=null,i._mirroredCameraPosition=null,i.clipPlane=c}))}set blurRatio(e){this._blurRatio!==e&&(this._blurRatio=e,this._preparePostProcesses())}get blurRatio(){return this._blurRatio}set adaptiveBlurKernel(e){this._adaptiveBlurKernel=e,this._autoComputeBlurKernel()}set blurKernel(e){this.blurKernelX=e,this.blurKernelY=e}set blurKernelX(e){this._blurKernelX!==e&&(this._blurKernelX=e,this._preparePostProcesses())}get blurKernelX(){return this._blurKernelX}set blurKernelY(e){this._blurKernelY!==e&&(this._blurKernelY=e,this._preparePostProcesses())}get blurKernelY(){return this._blurKernelY}_autoComputeBlurKernel(){const e=this.getScene().getEngine(),t=this.getRenderWidth()/e.getRenderWidth(),i=this.getRenderHeight()/e.getRenderHeight();this.blurKernelX=this._adaptiveBlurKernel*t,this.blurKernelY=this._adaptiveBlurKernel*i}_onRatioRescale(){this._sizeRatio&&(this.resize(this._initialSizeParameter),this._adaptiveBlurKernel||this._preparePostProcesses()),this._adaptiveBlurKernel&&this._autoComputeBlurKernel()}_updateGammaSpace(){const e=this.getScene();e&&(this.gammaSpace=!e.imageProcessingConfiguration.isEnabled||!e.imageProcessingConfiguration.applyByPostProcess)}_preparePostProcesses(){if(this.clearPostProcesses(!0),this._blurKernelX&&this._blurKernelY){const e=this.getScene().getEngine(),t=e.getCaps().textureFloatRender&&e.getCaps().textureFloatLinearFiltering?1:2;this._blurX=new so("horizontal blur",new o.FM(1,0),this._blurKernelX,this._blurRatio,null,K.x.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurX.autoClear=!1,1===this._blurRatio&&this.samples<2&&this._texture?this._blurX.inputTexture=this._renderTarget:this._blurX.alwaysForcePOT=!0,this._blurY=new so("vertical blur",new o.FM(0,1),this._blurKernelY,this._blurRatio,null,K.x.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurY.autoClear=!1,this._blurY.alwaysForcePOT=1!==this._blurRatio,this.addPostProcess(this._blurX),this.addPostProcess(this._blurY)}else this._blurY&&(this.removePostProcess(this._blurY),this._blurY.dispose(),this._blurY=null),this._blurX&&(this.removePostProcess(this._blurX),this._blurX.dispose(),this._blurX=null)}clone(){const e=this.getScene();if(!e)return this;const t=this.getSize(),i=new oo(this.name,t.width,e,this._renderTargetOptions.generateMipMaps,this._renderTargetOptions.type,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.mirrorPlane=this.mirrorPlane.clone(),this.renderList&&(i.renderList=this.renderList.slice(0)),i}serialize(){if(!this.name)return null;const e=super.serialize();return e.mirrorPlane=this.mirrorPlane.asArray(),e}dispose(){var e;super.dispose();const t=this.getScene();t&&t.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver),null===(e=this._sceneUBO)||void 0===e||e.dispose()}}K.x._CreateMirror=(e,t,i,n)=>new oo(e,t,i,n);var ao=i("../../../node_modules/@babylonjs/core/Materials/Textures/cubeTexture.js"),lo=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),co=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js"),ho=i("../../../node_modules/@babylonjs/core/Materials/pushMaterial.js"),_o=i("../../../node_modules/@babylonjs/core/Materials/materialFlags.js");dt.v.IncludesShadersStore.backgroundFragmentDeclaration="uniform vec4 vEyePosition;\nuniform vec4 vPrimaryColor;\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nuniform vec4 vPrimaryColorShadow;\n#endif\nuniform float shadowLevel;\nuniform float alpha;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#endif\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/sceneUboDeclaration.js");dt.v.IncludesShadersStore.backgroundUboDeclaration="layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec4 vPrimaryColor;\nuniform vec4 vPrimaryColorShadow;\nuniform vec2 vDiffuseInfos;\nuniform vec2 vReflectionInfos;\nuniform mat4 diffuseMatrix;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\nuniform float pointSize;\nuniform float shadowLevel;\nuniform float alpha;\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n};\n#include\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/reflectionFunction.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragment.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragment.js");dt.v.ShadersStore.backgroundPixelShader="#ifdef TEXTURELODSUPPORT\n#extension GL_EXT_shader_texture_lod : enable\n#endif\nprecision highp float;\n#include<__decl__backgroundFragment>\n#include\n#define RECIPROCAL_PI2 0.15915494\nvarying vec3 vPositionW;\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif \n#ifdef MAINUV2 \nvarying vec2 vMainUV2; \n#endif \n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV==1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV==2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE;\n#endif\n#ifndef SHADOWONLY\n#define SHADOWONLY;\n#endif\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n#include\n#include\n#ifdef REFLECTIONFRESNEL\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\nvec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(0.0,1.0,0.0);\n#endif\nfloat shadow=1.;\nfloat globalShadow=0.;\nfloat shadowLightCount=0.;\n#include[0..maxSimultaneousLights]\n#ifdef SHADOWINUSE\nglobalShadow/=shadowLightCount;\n#else\nglobalShadow=1.0;\n#endif\n#ifndef BACKMAT_SHADOWONLY\nvec4 reflectionColor=vec4(1.,1.,1.,1.);\n#ifdef REFLECTION\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=reflectionVector;\n#else\nvec2 reflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n#ifdef REFLECTIONBLUR\nfloat reflectionLOD=vReflectionInfos.y;\n#ifdef TEXTURELODSUPPORT\nreflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\nreflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#else\nfloat lodReflectionNormalized=saturate(reflectionLOD);\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\nif(lodReflectionNormalizedDoubled<1.0){\nreflectionColor=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nreflectionSpecularMid,\nlodReflectionNormalizedDoubled\n);\n} else {\nreflectionColor=mix(\nreflectionSpecularMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#else\nvec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);\nreflectionColor=reflectionSample;\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef GAMMAREFLECTION\nreflectionColor.rgb=toLinearSpace(reflectionColor.rgb);\n#endif\n#ifdef REFLECTIONBGR\nreflectionColor.rgb=reflectionColor.bgr;\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#endif\nvec3 diffuseColor=vec3(1.,1.,1.);\nfloat finalAlpha=alpha;\n#ifdef DIFFUSE\nvec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef GAMMADIFFUSE\ndiffuseMap.rgb=toLinearSpace(diffuseMap.rgb);\n#endif\ndiffuseMap.rgb*=vDiffuseInfos.y;\n#ifdef DIFFUSEHASALPHA\nfinalAlpha*=diffuseMap.a;\n#endif\ndiffuseColor=diffuseMap.rgb;\n#endif\n#ifdef REFLECTIONFRESNEL\nvec3 colorBase=diffuseColor;\n#else\nvec3 colorBase=reflectionColor.rgb*diffuseColor;\n#endif\ncolorBase=max(colorBase,0.0);\n#ifdef USERGBCOLOR\nvec3 finalColor=colorBase;\n#else\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nvec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);\n#else\nvec3 mainColor=vPrimaryColor.rgb;\n#endif\nvec3 finalColor=colorBase*mainColor;\n#endif\n#ifdef REFLECTIONFRESNEL\nvec3 reflectionAmount=vReflectionControl.xxx;\nvec3 reflectionReflectance0=vReflectionControl.yyy;\nvec3 reflectionReflectance90=vReflectionControl.zzz;\nfloat VdotN=dot(normalize(vEyePosition.xyz),normalW);\nvec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);\nreflectionAmount*=planarReflectionFresnel;\n#ifdef REFLECTIONFALLOFF\nfloat reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w);\nreflectionDistanceFalloff*=reflectionDistanceFalloff;\nreflectionAmount*=reflectionDistanceFalloff;\n#endif\nfinalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount));\n#endif\n#ifdef OPACITYFRESNEL\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition.xyz-vBackgroundCenter));\nconst float startAngle=0.1;\nfloat fadeFactor=saturate(viewAngleToFloor/startAngle);\nfinalAlpha*=fadeFactor*fadeFactor;\n#endif\n#ifdef SHADOWINUSE\nfinalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);\n#endif\nvec4 color=vec4(finalColor,finalAlpha);\n#else\nvec4 color=vec4(vPrimaryColor.rgb,(1.0-clamp(globalShadow,0.,1.))*alpha);\n#endif\n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n#if !defined(SKIPFINALCOLORCLAMP)\ncolor.rgb=clamp(color.rgb,0.,30.0);\n#endif\n#else\ncolor=applyImageProcessing(color);\n#endif\n#ifdef PREMULTIPLYALPHA\ncolor.rgb*=color.a;\n#endif\n#ifdef NOISE\ncolor.rgb+=dither(vPositionW.xy,0.5);\ncolor=max(color,0.0);\n#endif\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";dt.v.IncludesShadersStore.backgroundVertexDeclaration="uniform mat4 view;\nuniform mat4 viewProjection;\nuniform float shadowLevel;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxFragmentDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxUboDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertex.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js");dt.v.ShadersStore.backgroundVertexShader="precision highp float;\n#include<__decl__backgroundVertex>\n#include\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n#include\n#include\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\nvarying vec2 vDiffuseUV;\n#endif\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=position;\n#endif\n#include\n#include\n#include\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n} else {\ngl_Position=viewProjectionR*finalWorld*vec4(position,1.0);\n}\n#else\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#endif\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normal);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));\nvec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));\nif (fFovMultiplier<=1.0) {\nvDirectionW=normalize(segment);\n} else {\nvDirectionW=normalize(vDirectionW+(vDirectionW-segment));\n}\n#endif\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\nif (vDiffuseInfos.x==0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";var uo=i("../../../node_modules/@babylonjs/core/Materials/effectFallbacks.js");class po extends co.H{constructor(){super(),this.DIFFUSE=!1,this.DIFFUSEDIRECTUV=0,this.GAMMADIFFUSE=!1,this.DIFFUSEHASALPHA=!1,this.OPACITYFRESNEL=!1,this.REFLECTIONBLUR=!1,this.REFLECTIONFRESNEL=!1,this.REFLECTIONFALLOFF=!1,this.TEXTURELODSUPPORT=!1,this.PREMULTIPLYALPHA=!1,this.USERGBCOLOR=!1,this.USEHIGHLIGHTANDSHADOWCOLORS=!1,this.BACKMAT_SHADOWONLY=!1,this.NOISE=!1,this.REFLECTIONBGR=!1,this.IMAGEPROCESSING=!1,this.VIGNETTE=!1,this.VIGNETTEBLENDMODEMULTIPLY=!1,this.VIGNETTEBLENDMODEOPAQUE=!1,this.TONEMAPPING=!1,this.TONEMAPPING_ACES=!1,this.CONTRAST=!1,this.COLORCURVES=!1,this.COLORGRADING=!1,this.COLORGRADING3D=!1,this.SAMPLER3DGREENDEPTH=!1,this.SAMPLER3DBGRMAP=!1,this.DITHER=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.EXPOSURE=!1,this.MULTIVIEW=!1,this.REFLECTION=!1,this.REFLECTIONMAP_3D=!1,this.REFLECTIONMAP_SPHERICAL=!1,this.REFLECTIONMAP_PLANAR=!1,this.REFLECTIONMAP_CUBIC=!1,this.REFLECTIONMAP_PROJECTION=!1,this.REFLECTIONMAP_SKYBOX=!1,this.REFLECTIONMAP_EXPLICIT=!1,this.REFLECTIONMAP_EQUIRECTANGULAR=!1,this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,this.INVERTCUBICMAP=!1,this.REFLECTIONMAP_OPPOSITEZ=!1,this.LODINREFLECTIONALPHA=!1,this.GAMMAREFLECTION=!1,this.RGBDREFLECTION=!1,this.EQUIRECTANGULAR_RELFECTION_FOV=!1,this.MAINUV1=!1,this.MAINUV2=!1,this.UV1=!1,this.UV2=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.SHADOWFLOAT=!1,this.LOGARITHMICDEPTH=!1,this.NONUNIFORMSCALING=!1,this.ALPHATEST=!1,this.rebuild()}}class fo extends ho.a{constructor(e,t){super(e,t),this.primaryColor=a.Wo.White(),this._primaryColorShadowLevel=0,this._primaryColorHighlightLevel=0,this.reflectionTexture=null,this.reflectionBlur=0,this.diffuseTexture=null,this._shadowLights=null,this.shadowLights=null,this.shadowLevel=0,this.sceneCenter=o.P.Zero(),this.opacityFresnel=!0,this.reflectionFresnel=!1,this.reflectionFalloffDistance=0,this.reflectionAmount=1,this.reflectionReflectance0=.05,this.reflectionReflectance90=.5,this.useRGBColor=!0,this.enableNoise=!1,this._fovMultiplier=1,this.useEquirectangularFOV=!1,this._maxSimultaneousLights=4,this.maxSimultaneousLights=4,this._shadowOnly=!1,this.shadowOnly=!1,this._imageProcessingObserver=null,this.switchToBGR=!1,this._renderTargets=new Gi.t(16),this._reflectionControls=o.Lt.Zero(),this._white=a.Wo.White(),this._primaryShadowColor=a.Wo.Black(),this._primaryHighlightColor=a.Wo.Black(),this._attachImageProcessingConfiguration(null),this.getRenderTargetTextures=()=>(this._renderTargets.reset(),this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._renderTargets.push(this._diffuseTexture),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._renderTargets.push(this._reflectionTexture),this._renderTargets)}get _perceptualColor(){return this.__perceptualColor}set _perceptualColor(e){this.__perceptualColor=e,this._computePrimaryColorFromPerceptualColor(),this._markAllSubMeshesAsLightsDirty()}get primaryColorShadowLevel(){return this._primaryColorShadowLevel}set primaryColorShadowLevel(e){this._primaryColorShadowLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()}get primaryColorHighlightLevel(){return this._primaryColorHighlightLevel}set primaryColorHighlightLevel(e){this._primaryColorHighlightLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()}set reflectionStandardFresnelWeight(e){let t=e;t<.5?(t*=2,this.reflectionReflectance0=fo.StandardReflectance0*t,this.reflectionReflectance90=fo.StandardReflectance90*t):(t=2*t-1,this.reflectionReflectance0=fo.StandardReflectance0+(1-fo.StandardReflectance0)*t,this.reflectionReflectance90=fo.StandardReflectance90+(1-fo.StandardReflectance90)*t)}get fovMultiplier(){return this._fovMultiplier}set fovMultiplier(e){isNaN(e)&&(e=1),this._fovMultiplier=Math.max(0,Math.min(2,e))}_attachImageProcessingConfiguration(e){e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((()=>{this._computePrimaryColorFromPerceptualColor(),this._markAllSubMeshesAsImageProcessingDirty()}))))}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}set imageProcessingConfiguration(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()}get cameraColorCurvesEnabled(){return this.imageProcessingConfiguration.colorCurvesEnabled}set cameraColorCurvesEnabled(e){this.imageProcessingConfiguration.colorCurvesEnabled=e}get cameraColorGradingEnabled(){return this.imageProcessingConfiguration.colorGradingEnabled}set cameraColorGradingEnabled(e){this.imageProcessingConfiguration.colorGradingEnabled=e}get cameraToneMappingEnabled(){return this._imageProcessingConfiguration.toneMappingEnabled}set cameraToneMappingEnabled(e){this._imageProcessingConfiguration.toneMappingEnabled=e}get cameraExposure(){return this._imageProcessingConfiguration.exposure}set cameraExposure(e){this._imageProcessingConfiguration.exposure=e}get cameraContrast(){return this._imageProcessingConfiguration.contrast}set cameraContrast(e){this._imageProcessingConfiguration.contrast=e}get cameraColorGradingTexture(){return this._imageProcessingConfiguration.colorGradingTexture}set cameraColorGradingTexture(e){this.imageProcessingConfiguration.colorGradingTexture=e}get cameraColorCurves(){return this.imageProcessingConfiguration.colorCurves}set cameraColorCurves(e){this.imageProcessingConfiguration.colorCurves=e}get hasRenderTargetTextures(){return!(!this._diffuseTexture||!this._diffuseTexture.isRenderTarget)||!(!this._reflectionTexture||!this._reflectionTexture.isRenderTarget)}needAlphaTesting(){return!0}needAlphaBlending(){return this.alpha<1||null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha||this._shadowOnly}isReadyForSubMesh(e,t,i=!1){if(t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new po);const n=this.getScene(),r=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;const s=n.getEngine();if(lo.G.PrepareDefinesForLights(n,e,r,!1,this._maxSimultaneousLights),r._needNormals=!0,lo.G.PrepareDefinesForMultiview(n,r),r._areTexturesDirty){if(r._needUVs=!1,n.texturesEnabled){if(n.getEngine().getCaps().textureLOD&&(r.TEXTURELODSUPPORT=!0),this._diffuseTexture&&_o.k.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;lo.G.PrepareDefinesForMergedUV(this._diffuseTexture,r,"DIFFUSE"),r.DIFFUSEHASALPHA=this._diffuseTexture.hasAlpha,r.GAMMADIFFUSE=this._diffuseTexture.gammaSpace,r.OPACITYFRESNEL=this._opacityFresnel}else r.DIFFUSE=!1,r.DIFFUSEDIRECTUV=0,r.DIFFUSEHASALPHA=!1,r.GAMMADIFFUSE=!1,r.OPACITYFRESNEL=!1;const e=this._reflectionTexture;if(e&&_o.k.ReflectionTextureEnabled){if(!e.isReadyOrNotBlocking())return!1;switch(r.REFLECTION=!0,r.GAMMAREFLECTION=e.gammaSpace,r.RGBDREFLECTION=e.isRGBD,r.REFLECTIONBLUR=this._reflectionBlur>0,r.LODINREFLECTIONALPHA=e.lodLevelInAlpha,r.EQUIRECTANGULAR_RELFECTION_FOV=this.useEquirectangularFOV,r.REFLECTIONBGR=this.switchToBGR,e.coordinatesMode===K.x.INVCUBIC_MODE&&(r.INVERTCUBICMAP=!0),r.REFLECTIONMAP_3D=e.isCube,r.REFLECTIONMAP_OPPOSITEZ=r.REFLECTIONMAP_3D&&this.getScene().useRightHandedSystem?!e.invertZ:e.invertZ,e.coordinatesMode){case K.x.EXPLICIT_MODE:r.REFLECTIONMAP_EXPLICIT=!0;break;case K.x.PLANAR_MODE:r.REFLECTIONMAP_PLANAR=!0;break;case K.x.PROJECTION_MODE:r.REFLECTIONMAP_PROJECTION=!0;break;case K.x.SKYBOX_MODE:r.REFLECTIONMAP_SKYBOX=!0;break;case K.x.SPHERICAL_MODE:r.REFLECTIONMAP_SPHERICAL=!0;break;case K.x.EQUIRECTANGULAR_MODE:r.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case K.x.FIXED_EQUIRECTANGULAR_MODE:r.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case K.x.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:r.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case K.x.CUBIC_MODE:case K.x.INVCUBIC_MODE:default:r.REFLECTIONMAP_CUBIC=!0}this.reflectionFresnel?(r.REFLECTIONFRESNEL=!0,r.REFLECTIONFALLOFF=this.reflectionFalloffDistance>0,this._reflectionControls.x=this.reflectionAmount,this._reflectionControls.y=this.reflectionReflectance0,this._reflectionControls.z=this.reflectionReflectance90,this._reflectionControls.w=1/this.reflectionFalloffDistance):(r.REFLECTIONFRESNEL=!1,r.REFLECTIONFALLOFF=!1)}else r.REFLECTION=!1,r.REFLECTIONFRESNEL=!1,r.REFLECTIONFALLOFF=!1,r.REFLECTIONBLUR=!1,r.REFLECTIONMAP_3D=!1,r.REFLECTIONMAP_SPHERICAL=!1,r.REFLECTIONMAP_PLANAR=!1,r.REFLECTIONMAP_CUBIC=!1,r.REFLECTIONMAP_PROJECTION=!1,r.REFLECTIONMAP_SKYBOX=!1,r.REFLECTIONMAP_EXPLICIT=!1,r.REFLECTIONMAP_EQUIRECTANGULAR=!1,r.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,r.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,r.INVERTCUBICMAP=!1,r.REFLECTIONMAP_OPPOSITEZ=!1,r.LODINREFLECTIONALPHA=!1,r.GAMMAREFLECTION=!1,r.RGBDREFLECTION=!1}r.PREMULTIPLYALPHA=7===this.alphaMode||8===this.alphaMode,r.USERGBCOLOR=this._useRGBColor,r.NOISE=this._enableNoise}if(r._areLightsDirty&&(r.USEHIGHLIGHTANDSHADOWCOLORS=!this._useRGBColor&&(0!==this._primaryColorShadowLevel||0!==this._primaryColorHighlightLevel),r.BACKMAT_SHADOWONLY=this._shadowOnly),r._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(r)}if(lo.G.PrepareDefinesForMisc(e,n,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),r),lo.G.PrepareDefinesForFrameBoundValues(n,s,r,i,null,t.getRenderingMesh().hasThinInstances),lo.G.PrepareDefinesForAttributes(e,r,!1,!0,!1)&&e&&(n.getEngine().getCaps().standardDerivatives||e.isVerticesDataPresent(le.o.NormalKind)||(e.createNormals(!0),u.Y.Warn("BackgroundMaterial: Normals have been created for the mesh: "+e.name))),r.isDirty){r.markAsProcessed(),n.resetCachedMaterial();const i=new uo.L;r.FOG&&i.addFallback(0,"FOG"),r.POINTSIZE&&i.addFallback(1,"POINTSIZE"),r.MULTIVIEW&&i.addFallback(0,"MULTIVIEW"),lo.G.HandleFallbacksForShadows(r,i,this._maxSimultaneousLights);const o=[le.o.PositionKind];r.NORMAL&&o.push(le.o.NormalKind),r.UV1&&o.push(le.o.UVKind),r.UV2&&o.push(le.o.UV2Kind),lo.G.PrepareAttributesForBones(o,e,r,i),lo.G.PrepareAttributesForInstances(o,r);const a=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","mBones","vPrimaryColor","vPrimaryColorShadow","vReflectionInfos","reflectionMatrix","vReflectionMicrosurfaceInfos","fFovMultiplier","shadowLevel","alpha","vBackgroundCenter","vReflectionControl","vDiffuseInfos","diffuseMatrix"],l=["diffuseSampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh"],c=["Material","Scene"];Xt.$&&(Xt.$.PrepareUniforms(a,r),Xt.$.PrepareSamplers(l,r)),lo.G.PrepareUniformsAndSamplersList({uniformsNames:a,uniformBuffersNames:c,samplers:l,defines:r,maxSimultaneousLights:this._maxSimultaneousLights});const h=r.toString(),_=n.getEngine().createEffect("background",{attributes:o,uniformsNames:a,uniformBuffersNames:c,samplers:l,defines:h,fallbacks:i,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s);t.setEffect(_,r,this._materialContext),this.buildUniformLayout()}return!(!t.effect||!t.effect.isReady()||(r._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=i,n.performancePriority!==R.a.BackwardCompatible&&(this.checkReadyOnlyOnce=!0),0))}_computePrimaryColorFromPerceptualColor(){this.__perceptualColor&&(this._primaryColor.copyFrom(this.__perceptualColor),this._primaryColor.toLinearSpaceToRef(this._primaryColor),this._imageProcessingConfiguration&&this._primaryColor.scaleToRef(1/this._imageProcessingConfiguration.exposure,this._primaryColor),this._computePrimaryColors())}_computePrimaryColors(){0===this._primaryColorShadowLevel&&0===this._primaryColorHighlightLevel||(this._primaryColor.scaleToRef(this._primaryColorShadowLevel,this._primaryShadowColor),this._primaryColor.subtractToRef(this._primaryShadowColor,this._primaryShadowColor),this._white.subtractToRef(this._primaryColor,this._primaryHighlightColor),this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel,this._primaryHighlightColor),this._primaryColor.addToRef(this._primaryHighlightColor,this._primaryHighlightColor))}buildUniformLayout(){this._uniformBuffer.addUniform("vPrimaryColor",4),this._uniformBuffer.addUniform("vPrimaryColorShadow",4),this._uniformBuffer.addUniform("vDiffuseInfos",2),this._uniformBuffer.addUniform("vReflectionInfos",2),this._uniformBuffer.addUniform("diffuseMatrix",16),this._uniformBuffer.addUniform("reflectionMatrix",16),this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos",3),this._uniformBuffer.addUniform("fFovMultiplier",1),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.addUniform("shadowLevel",1),this._uniformBuffer.addUniform("alpha",1),this._uniformBuffer.addUniform("vBackgroundCenter",3),this._uniformBuffer.addUniform("vReflectionControl",4),this._uniformBuffer.create()}unbind(){this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._uniformBuffer.setTexture("diffuseSampler",null),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture("reflectionSampler",null),super.unbind()}bindOnlyWorldMatrix(e){this._activeEffect.setMatrix("world",e)}bindForSubMesh(e,t,i){const n=this.getScene(),r=i.materialDefines;if(!r)return;const s=i.effect;if(!s)return;this._activeEffect=s,this.bindOnlyWorldMatrix(e),lo.G.BindBonesParameters(t,this._activeEffect);const o=this._mustRebind(n,s,t.visibility);if(o){this._uniformBuffer.bindToEffect(s,"Material"),this.bindViewProjection(s);const e=this._reflectionTexture;this._uniformBuffer.useUbo&&this.isFrozen&&this._uniformBuffer.isSync||(n.texturesEnabled&&(this._diffuseTexture&&_o.k.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),lo.G.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse")),e&&_o.k.ReflectionTextureEnabled&&(this._uniformBuffer.updateMatrix("reflectionMatrix",e.getReflectionTextureMatrix()),this._uniformBuffer.updateFloat2("vReflectionInfos",e.level,this._reflectionBlur),this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos",e.getSize().width,e.lodGenerationScale,e.lodGenerationOffset))),this.shadowLevel>0&&this._uniformBuffer.updateFloat("shadowLevel",this.shadowLevel),this._uniformBuffer.updateFloat("alpha",this.alpha),this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),r.USEHIGHLIGHTANDSHADOWCOLORS?(this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryHighlightColor,1),this._uniformBuffer.updateColor4("vPrimaryColorShadow",this._primaryShadowColor,1)):this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryColor,1)),this._uniformBuffer.updateFloat("fFovMultiplier",this._fovMultiplier),n.texturesEnabled&&(this._diffuseTexture&&_o.k.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),e&&_o.k.ReflectionTextureEnabled&&(r.REFLECTIONBLUR&&r.TEXTURELODSUPPORT?this._uniformBuffer.setTexture("reflectionSampler",e):r.REFLECTIONBLUR?(this._uniformBuffer.setTexture("reflectionSampler",e._lodTextureMid||e),this._uniformBuffer.setTexture("reflectionSamplerLow",e._lodTextureLow||e),this._uniformBuffer.setTexture("reflectionSamplerHigh",e._lodTextureHigh||e)):this._uniformBuffer.setTexture("reflectionSampler",e),r.REFLECTIONFRESNEL&&(this._uniformBuffer.updateFloat3("vBackgroundCenter",this.sceneCenter.x,this.sceneCenter.y,this.sceneCenter.z),this._uniformBuffer.updateFloat4("vReflectionControl",this._reflectionControls.x,this._reflectionControls.y,this._reflectionControls.z,this._reflectionControls.w)))),lo.G.BindClipPlane(this._activeEffect,n),n.bindEyePosition(s)}else n.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._uniformBuffer.bindToEffect(s,"Material"),this._needToBindSceneUbo=!0);!o&&this.isFrozen||(n.lightsEnabled&&lo.G.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights),this.bindView(s),lo.G.BindFogParameters(n,t,this._activeEffect,!0),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(t,this._activeEffect),this._uniformBuffer.update()}hasTexture(e){return!!super.hasTexture(e)||this._reflectionTexture===e||this._diffuseTexture===e}dispose(e=!1,t=!1){t&&(this.diffuseTexture&&this.diffuseTexture.dispose(),this.reflectionTexture&&this.reflectionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e)}clone(e){return Y.p4.Clone((()=>new fo(e,this.getScene())),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.BackgroundMaterial",e}getClassName(){return"BackgroundMaterial"}static Parse(e,t,i){return Y.p4.Parse((()=>new fo(e.name,t)),e,t,i)}}fo.StandardReflectance0=.05,fo.StandardReflectance90=.5,(0,X.gn)([(0,Y.n9)()],fo.prototype,"_primaryColor",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsLightsDirty")],fo.prototype,"primaryColor",void 0),(0,X.gn)([(0,Y.n9)()],fo.prototype,"__perceptualColor",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_primaryColorShadowLevel",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_primaryColorHighlightLevel",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsLightsDirty")],fo.prototype,"primaryColorHighlightLevel",null),(0,X.gn)([(0,Y.oU)()],fo.prototype,"_reflectionTexture",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"reflectionTexture",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_reflectionBlur",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"reflectionBlur",void 0),(0,X.gn)([(0,Y.oU)()],fo.prototype,"_diffuseTexture",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"diffuseTexture",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"shadowLights",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_shadowLevel",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"shadowLevel",void 0),(0,X.gn)([(0,Y.hd)()],fo.prototype,"_sceneCenter",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"sceneCenter",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_opacityFresnel",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"opacityFresnel",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_reflectionFresnel",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"reflectionFresnel",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_reflectionFalloffDistance",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"reflectionFalloffDistance",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_reflectionAmount",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"reflectionAmount",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_reflectionReflectance0",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"reflectionReflectance0",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_reflectionReflectance90",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"reflectionReflectance90",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_useRGBColor",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"useRGBColor",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_enableNoise",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"enableNoise",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_maxSimultaneousLights",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],fo.prototype,"maxSimultaneousLights",void 0),(0,X.gn)([(0,Y.qC)()],fo.prototype,"_shadowOnly",void 0),(0,X.gn)([(0,Y.wz)("_markAllSubMeshesAsLightsDirty")],fo.prototype,"shadowOnly",void 0),(0,X.gn)([(0,Y.rX)()],fo.prototype,"_imageProcessingConfiguration",void 0),(0,l.H)("BABYLON.BackgroundMaterial",fo);class mo{constructor(e,t){this._errorHandler=(e,t)=>{this.onErrorObservable.notifyObservers({message:e,exception:t})},this._options={...mo._GetDefaultOptions(),...e},this._scene=t,this.onErrorObservable=new s.y$,this._setupBackground(),this._setupImageProcessing()}static _GetDefaultOptions(){return{createGround:!0,groundSize:15,groundTexture:this._GroundTextureCDNUrl,groundColor:new a.Wo(.2,.2,.3).toLinearSpace().scale(3),groundOpacity:.9,enableGroundShadow:!0,groundShadowLevel:.5,enableGroundMirror:!1,groundMirrorSizeRatio:.3,groundMirrorBlurKernel:64,groundMirrorAmount:1,groundMirrorFresnelWeight:1,groundMirrorFallOffDistance:0,groundMirrorTextureType:0,groundYBias:1e-5,createSkybox:!0,skyboxSize:20,skyboxTexture:this._SkyboxTextureCDNUrl,skyboxColor:new a.Wo(.2,.2,.3).toLinearSpace().scale(3),backgroundYRotation:0,sizeAuto:!0,rootPosition:o.P.Zero(),setupImageProcessing:!0,environmentTexture:this._EnvironmentTextureCDNUrl,cameraExposure:.8,cameraContrast:1.2,toneMappingEnabled:!0}}get rootMesh(){return this._rootMesh}get skybox(){return this._skybox}get skyboxTexture(){return this._skyboxTexture}get skyboxMaterial(){return this._skyboxMaterial}get ground(){return this._ground}get groundTexture(){return this._groundTexture}get groundMirror(){return this._groundMirror}get groundMirrorRenderList(){return this._groundMirror?this._groundMirror.renderList:null}get groundMaterial(){return this._groundMaterial}updateOptions(e){const t={...this._options,...e};this._ground&&!t.createGround&&(this._ground.dispose(),this._ground=null),this._groundMaterial&&!t.createGround&&(this._groundMaterial.dispose(),this._groundMaterial=null),this._groundTexture&&this._options.groundTexture!=t.groundTexture&&(this._groundTexture.dispose(),this._groundTexture=null),this._skybox&&!t.createSkybox&&(this._skybox.dispose(),this._skybox=null),this._skyboxMaterial&&!t.createSkybox&&(this._skyboxMaterial.dispose(),this._skyboxMaterial=null),this._skyboxTexture&&this._options.skyboxTexture!=t.skyboxTexture&&(this._skyboxTexture.dispose(),this._skyboxTexture=null),this._groundMirror&&!t.enableGroundMirror&&(this._groundMirror.dispose(),this._groundMirror=null),this._scene.environmentTexture&&this._options.environmentTexture!=t.environmentTexture&&this._scene.environmentTexture.dispose(),this._options=t,this._setupBackground(),this._setupImageProcessing()}setMainColor(e){this.groundMaterial&&(this.groundMaterial.primaryColor=e),this.skyboxMaterial&&(this.skyboxMaterial.primaryColor=e),this.groundMirror&&(this.groundMirror.clearColor=new a.HE(e.r,e.g,e.b,1))}_setupImageProcessing(){this._options.setupImageProcessing&&(this._scene.imageProcessingConfiguration.contrast=this._options.cameraContrast,this._scene.imageProcessingConfiguration.exposure=this._options.cameraExposure,this._scene.imageProcessingConfiguration.toneMappingEnabled=this._options.toneMappingEnabled,this._setupEnvironmentTexture())}_setupEnvironmentTexture(){if(this._scene.environmentTexture)return;if(this._options.environmentTexture instanceof ro.V)return void(this._scene.environmentTexture=this._options.environmentTexture);const e=ao.B.CreateFromPrefilteredData(this._options.environmentTexture,this._scene);this._scene.environmentTexture=e}_setupBackground(){this._rootMesh||(this._rootMesh=new je.Kj("BackgroundHelper",this._scene)),this._rootMesh.rotation.y=this._options.backgroundYRotation;const e=this._getSceneSize();this._options.createGround&&(this._setupGround(e),this._setupGroundMaterial(),this._setupGroundDiffuseTexture(),this._options.enableGroundMirror&&this._setupGroundMirrorTexture(e),this._setupMirrorInGroundMaterial()),this._options.createSkybox&&(this._setupSkybox(e),this._setupSkyboxMaterial(),this._setupSkyboxReflectionTexture()),this._rootMesh.position.x=e.rootPosition.x,this._rootMesh.position.z=e.rootPosition.z,this._rootMesh.position.y=e.rootPosition.y}_getSceneSize(){let e=this._options.groundSize,t=this._options.skyboxSize,i=this._options.rootPosition;if(!this._scene.meshes||1===this._scene.meshes.length)return{groundSize:e,skyboxSize:t,rootPosition:i};const n=this._scene.getWorldExtends((e=>e!==this._ground&&e!==this._rootMesh&&e!==this._skybox)),r=n.max.subtract(n.min);if(this._options.sizeAuto){this._scene.activeCamera instanceof We&&this._scene.activeCamera.upperRadiusLimit&&(e=2*this._scene.activeCamera.upperRadiusLimit,t=e);const s=r.length();s>e&&(e=2*s,t=e),e*=1.1,t*=1.5,i=n.min.add(r.scale(.5)),i.y=n.min.y-this._options.groundYBias}return{groundSize:e,skyboxSize:t,rootPosition:i}}_setupGround(e){this._ground&&!this._ground.isDisposed()||(this._ground=(0,Ys.pT)("BackgroundPlane",{size:e.groundSize},this._scene),this._ground.rotation.x=Math.PI/2,this._ground.parent=this._rootMesh,this._ground.onDisposeObservable.add((()=>{this._ground=null}))),this._ground.receiveShadows=this._options.enableGroundShadow}_setupGroundMaterial(){this._groundMaterial||(this._groundMaterial=new fo("BackgroundPlaneMaterial",this._scene)),this._groundMaterial.alpha=this._options.groundOpacity,this._groundMaterial.alphaMode=8,this._groundMaterial.shadowLevel=this._options.groundShadowLevel,this._groundMaterial.primaryColor=this._options.groundColor,this._groundMaterial.useRGBColor=!1,this._groundMaterial.enableNoise=!0,this._ground&&(this._ground.material=this._groundMaterial)}_setupGroundDiffuseTexture(){this._groundMaterial&&(this._groundTexture||(this._options.groundTexture instanceof ro.V?this._groundMaterial.diffuseTexture=this._options.groundTexture:(this._groundTexture=new K.x(this._options.groundTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler),this._groundTexture.gammaSpace=!1,this._groundTexture.hasAlpha=!0,this._groundMaterial.diffuseTexture=this._groundTexture)))}_setupGroundMirrorTexture(e){const t=K.x.CLAMP_ADDRESSMODE;if(!this._groundMirror&&(this._groundMirror=new oo("BackgroundPlaneMirrorTexture",{ratio:this._options.groundMirrorSizeRatio},this._scene,!1,this._options.groundMirrorTextureType,K.x.BILINEAR_SAMPLINGMODE,!0),this._groundMirror.mirrorPlane=new be.J(0,-1,0,e.rootPosition.y),this._groundMirror.anisotropicFilteringLevel=1,this._groundMirror.wrapU=t,this._groundMirror.wrapV=t,this._groundMirror.renderList))for(let e=0;e{this._skybox=null}))),this._skybox.parent=this._rootMesh}_setupSkyboxMaterial(){this._skybox&&(this._skyboxMaterial||(this._skyboxMaterial=new fo("BackgroundSkyboxMaterial",this._scene)),this._skyboxMaterial.useRGBColor=!1,this._skyboxMaterial.primaryColor=this._options.skyboxColor,this._skyboxMaterial.enableNoise=!0,this._skybox.material=this._skyboxMaterial)}_setupSkyboxReflectionTexture(){this._skyboxMaterial&&(this._skyboxTexture||(this._options.skyboxTexture instanceof ro.V?this._skyboxMaterial.reflectionTexture=this._options.skyboxTexture:(this._skyboxTexture=new ao.B(this._options.skyboxTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler),this._skyboxTexture.coordinatesMode=K.x.SKYBOX_MODE,this._skyboxTexture.gammaSpace=!1,this._skyboxMaterial.reflectionTexture=this._skyboxTexture)))}dispose(){this._groundMaterial&&this._groundMaterial.dispose(!0,!0),this._skyboxMaterial&&this._skyboxMaterial.dispose(!0,!0),this._rootMesh.dispose(!1)}}mo._GroundTextureCDNUrl="https://assets.babylonjs.com/environments/backgroundGround.png",mo._SkyboxTextureCDNUrl="https://assets.babylonjs.com/environments/backgroundSkybox.dds",mo._EnvironmentTextureCDNUrl="https://assets.babylonjs.com/environments/environmentSpecular.env";class go extends Et.Y{constructor(e,t,i,n,r=null){super(e,n),this.onError=r,this._halfDome=!1,this._crossEye=!1,this._useDirectMapping=!1,this._textureMode=go.MODE_MONOSCOPIC,this._onBeforeCameraRenderObserver=null,this.onLoadErrorObservable=new s.y$,this.onLoadObservable=new s.y$,n=this.getScene(),e=e||"textureDome",i.resolution=0|Math.abs(i.resolution)||32,i.clickToPlay=Boolean(i.clickToPlay),i.autoPlay=void 0===i.autoPlay||Boolean(i.autoPlay),i.loop=void 0===i.loop||Boolean(i.loop),i.size=Math.abs(i.size)||(n.activeCamera?.48*n.activeCamera.maxZ:1e3),void 0===i.useDirectMapping?this._useDirectMapping=!0:this._useDirectMapping=i.useDirectMapping,void 0===i.faceForward&&(i.faceForward=!0),this._setReady(!1),i.mesh?this._mesh=i.mesh:this._mesh=en(e+"_mesh",{segments:i.resolution,diameter:i.size,updatable:!1,sideOrientation:je.Kj.BACKSIDE},n);const a=this._material=new fo(e+"_material",n);a.useEquirectangularFOV=!0,a.fovMultiplier=1,a.opacityFresnel=!1;const l=this._initTexture(t,n,i);if(this.texture=l,this._mesh.material=a,this._mesh.parent=this,this._halfDomeMask=en("",{slice:.5,diameter:.98*i.size,segments:2*i.resolution,sideOrientation:je.Kj.BACKSIDE},n),this._halfDomeMask.rotate(Br.RD.X,-Math.PI/2),this._halfDomeMask.parent=this._mesh,this._halfDome=!!i.halfDomeMode,this._halfDomeMask.setEnabled(this._halfDome),this._crossEye=!!i.crossEyeMode,this._texture.anisotropicFilteringLevel=1,this._texture.onLoadObservable.addOnce((()=>{this._setReady(!0)})),i.faceForward&&n.activeCamera){const e=n.activeCamera,t=o.P.Forward(),i=o.P.TransformNormal(t,e.getViewMatrix());i.normalize(),this.rotation.y=Math.acos(o.P.Dot(t,i))}this._changeTextureMode(this._textureMode)}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture=e,this._useDirectMapping?(this._texture.wrapU=K.x.CLAMP_ADDRESSMODE,this._texture.wrapV=K.x.CLAMP_ADDRESSMODE,this._material.diffuseTexture=this._texture):(this._texture.coordinatesMode=K.x.FIXED_EQUIRECTANGULAR_MIRRORED_MODE,this._texture.wrapV=K.x.CLAMP_ADDRESSMODE,this._material.reflectionTexture=this._texture),this._changeTextureMode(this._textureMode))}get mesh(){return this._mesh}get fovMultiplier(){return this._material.fovMultiplier}set fovMultiplier(e){this._material.fovMultiplier=e}get textureMode(){return this._textureMode}set textureMode(e){this._textureMode!==e&&this._changeTextureMode(e)}get halfDome(){return this._halfDome}set halfDome(e){this._halfDome=e,this._halfDomeMask.setEnabled(e),this._changeTextureMode(this._textureMode)}set crossEye(e){this._crossEye=e,this._changeTextureMode(this._textureMode)}get crossEye(){return this._crossEye}get material(){return this._material}_changeTextureMode(e){switch(this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._textureMode=e,this._texture.uScale=1,this._texture.vScale=1,this._texture.uOffset=0,this._texture.vOffset=0,this._texture.vAng=0,e){case go.MODE_MONOSCOPIC:this._halfDome&&(this._texture.uScale=2,this._texture.uOffset=-1);break;case go.MODE_SIDEBYSIDE:{this._texture.uScale=this._halfDome?.99999:.5;const e=this._halfDome?0:.5,t=this._halfDome?-.5:0;this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add((i=>{let n=i.isRightCamera;this._crossEye&&(n=!n),this._texture.uOffset=n?e:t}));break}case go.MODE_TOPBOTTOM:this._texture.vScale=this._halfDome?.99999:.5,this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add((e=>{let t=e.isRightCamera;this._crossEye&&(t=!t),this._texture.vOffset=t?.5:0}))}}dispose(e,t=!1){this._texture.dispose(),this._mesh.dispose(),this._material.dispose(),this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this.onLoadErrorObservable.clear(),this.onLoadObservable.clear(),super.dispose(e,t)}}go.MODE_MONOSCOPIC=0,go.MODE_TOPBOTTOM=1,go.MODE_SIDEBYSIDE=2;class bo extends go{get photoTexture(){return this.texture}set photoTexture(e){this.texture=e}get imageMode(){return this.textureMode}set imageMode(e){this.textureMode=e}_initTexture(e,t,i){return new K.x(e,t,!i.generateMipMaps,!this._useDirectMapping,void 0,(()=>{this.onLoadObservable.notifyObservers()}),((e,t)=>{this.onLoadErrorObservable.notifyObservers(e||"Unknown error occured"),this.onError&&this.onError(e,t)}))}}bo.MODE_MONOSCOPIC=go.MODE_MONOSCOPIC,bo.MODE_TOPBOTTOM=go.MODE_TOPBOTTOM,bo.MODE_SIDEBYSIDE=go.MODE_SIDEBYSIDE;var yo=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrMaterial.js"),vo=i("../../../node_modules/@babylonjs/core/Maths/sphericalPolynomial.js"),Ao=i("../../../node_modules/@babylonjs/core/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js");const Co=131072,So=131072;function xo(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const To=xo("DXT1"),Eo=xo("DXT3"),Ro=xo("DXT5"),Po=xo("DX10");class Io{static GetDDSInfo(e){const t=new Int32Array(e.buffer,e.byteOffset,31),i=new Int32Array(e.buffer,e.byteOffset,35);let n=1;t[2]&Co&&(n=Math.max(1,t[7]));const r=t[21],s=r===Po?i[32]:0;let o=0;switch(r){case 113:o=2;break;case 116:o=1;break;case Po:if(10===s){o=2;break}if(2===s){o=1;break}}return{width:t[4],height:t[3],mipmapCount:n,isFourCC:4==(4&t[20]),isRGB:64==(64&t[20]),isLuminance:(t[20]&So)===So,isCube:512==(512&t[28]),isCompressed:r===To||r===Eo||r===Ro,dxgiFormat:s,textureType:o}}static _GetHalfFloatAsFloatRGBAArrayBuffer(e,t,i,n,r,s){const o=new Float32Array(n),a=new Uint16Array(r,i);let l=0;for(let i=0;i>8)}static _GetRGBArrayBuffer(e,t,i,n,r,s,o,a){const l=new Uint8Array(n),c=new Uint8Array(r,i);let h=0;for(let i=0;i>8&255,T>>16&255,T>>24&255)))}var T;const E=Io._ExtractLongWordOrder(_[23]),R=Io._ExtractLongWordOrder(_[24]),P=Io._ExtractLongWordOrder(_[25]),I=Io._ExtractLongWordOrder(_[26]);x&&(A=e._getRGBABufferInternalSizedFormat(n.textureType)),b=1,_[2]&Co&&!1!==r&&(b=Math.max(1,_[7]));const M=a||0,D=e.getCaps();for(let r=M;r0?n.sphericalPolynomial=Ao.$.ConvertCubeMapToSphericalPolynomial({size:_[4],right:c[0],left:c[1],up:c[2],down:c[3],front:c[4],back:c[5],format:5,type:1,gammaSpace:!1}):n.sphericalPolynomial=void 0}}Io.StoreLODInAlphaChannel=!1,Fi.B.prototype.createPrefilteredCubeTexture=function(e,t,i,n,r=null,s=null,o,a=null,l=!0){return this.createCubeTexture(e,t,null,!1,(e=>{if(!e)return void(r&&r(null));const s=e.texture;if(l?e.info.sphericalPolynomial&&(s._sphericalPolynomial=e.info.sphericalPolynomial):s._sphericalPolynomial=new vo.i,s._source=Mt.S.CubePrefiltered,this.getCaps().textureLOD)return void(r&&r(s));const o=this._gl,a=e.width;if(!a)return;const c=[];for(let r=0;r<3;r++){const l=1-r/2,h=n,_=ve.R.Log2(a)*i+n,d=h+(_-h)*l,p=Math.round(Math.min(Math.max(d,0),_)),f=new Mt.l(this,Mt.S.Temp);if(f.type=s.type,f.format=s.format,f.width=Math.pow(2,Math.max(ve.R.Log2(a)-p,0)),f.height=f.width,f.isCube=!0,f._cachedWrapU=0,f._cachedWrapV=0,this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,f,!0),f.samplingMode=2,o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),e.isDDS){const t=e.info,i=e.data;this._unpackFlipY(t.isCompressed),Io.UploadDDSLevels(this,f,i,t,!0,6,p)}else u.Y.Warn("DDS is the only prefiltered cube map supported so far.");this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,null);const m=new ro.V(t);m._isCube=!0,m._texture=f,f.isReady=!0,c.push(m)}s._lodTextureHigh=c[2],s._lodTextureMid=c[1],s._lodTextureLow=c[0],r&&r(s)}),s,o,a,l,i,n)},k.D._TextureLoaders.push(new class{constructor(){this.supportCascades=!0}canLoad(e){return e.endsWith(".dds")}loadCubeData(e,t,i,n){const r=t.getEngine();let s,o=!1,a=1e3;if(Array.isArray(e))for(let i=0;i1)&&t.generateMipMaps,r._unpackFlipY(s.isCompressed),Io.UploadDDSLevels(r,t,n,s,o,6,-1,i),s.isFourCC||1!==s.mipmapCount?a=s.mipmapCount-1:r.generateMipMapsForCubemap(t)}else{const n=e;s=Io.GetDDSInfo(n),t.width=s.width,t.height=s.height,i&&(s.sphericalPolynomial=new vo.i),o=(s.isRGB||s.isLuminance||s.mipmapCount>1)&&t.generateMipMaps,r._unpackFlipY(s.isCompressed),Io.UploadDDSLevels(r,t,n,s,o,6),s.isFourCC||1!==s.mipmapCount?a=s.mipmapCount-1:r.generateMipMapsForCubemap(t,!1)}r._setCubeMapTextureParams(t,o,a),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n({isDDS:!0,width:t.width,info:s,data:e,texture:t})}loadData(e,t,i){const n=Io.GetDDSInfo(e),r=(n.isRGB||n.isLuminance||n.mipmapCount>1)&&t.generateMipMaps&&n.width>>n.mipmapCount-1==1;i(n.width,n.height,r,n.isFourCC,(()=>{Io.UploadDDSLevels(t.getEngine(),t,e,n,r,1)}))}}),k.D._TextureLoaders.push(new class{constructor(){this.supportCascades=!1}canLoad(e){return e.endsWith(".env")}loadCubeData(e,t,i,n,r){if(Array.isArray(e))return;const s=(0,Bn.qJ)(e);if(s){t.width=s.width,t.height=s.width;try{(0,Bn.qC)(t,s),(0,Bn.Ro)(t,e,s).then((()=>{t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n()}),(e=>{null==r||r("Can not upload environment levels",e)}))}catch(e){null==r||r("Can not upload environment file",e)}}else r&&r("Can not parse the environment file",null)}loadData(){throw".env not supported in 2d."}});class Mo{constructor(e,t){if(this.data=e,this.isInvalid=!1,!Mo.IsValid(e))return this.isInvalid=!0,void u.Y.Error("texture missing KTX identifier");const i=Uint32Array.BYTES_PER_ELEMENT,n=new DataView(this.data.buffer,this.data.byteOffset+12,13*i),r=67305985===n.getUint32(0,!0);this.glType=n.getUint32(1*i,r),this.glTypeSize=n.getUint32(2*i,r),this.glFormat=n.getUint32(3*i,r),this.glInternalFormat=n.getUint32(4*i,r),this.glBaseInternalFormat=n.getUint32(5*i,r),this.pixelWidth=n.getUint32(6*i,r),this.pixelHeight=n.getUint32(7*i,r),this.pixelDepth=n.getUint32(8*i,r),this.numberOfArrayElements=n.getUint32(9*i,r),this.numberOfFaces=n.getUint32(10*i,r),this.numberOfMipmapLevels=n.getUint32(11*i,r),this.bytesOfKeyValueData=n.getUint32(12*i,r),0===this.glType?(this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===t?this.loadType=Mo.COMPRESSED_2D:u.Y.Error("number of faces expected"+t+", but found "+this.numberOfFaces):u.Y.Error("texture arrays not currently supported"):u.Y.Error("only 2D textures currently supported")):u.Y.Error("only compressed formats currently supported")}uploadLevels(e,t){switch(this.loadType){case Mo.COMPRESSED_2D:this._upload2DCompressedLevels(e,t);case Mo.TEX_2D:case Mo.COMPRESSED_3D:case Mo.TEX_3D:}}_upload2DCompressedLevels(e,t){let i=Mo.HEADER_LEN+this.bytesOfKeyValueData,n=this.pixelWidth,r=this.pixelHeight;const s=t?this.numberOfMipmapLevels:1;for(let t=0;t=12){const t=new Uint8Array(e.buffer,e.byteOffset,12);if(171===t[0]&&75===t[1]&&84===t[2]&&88===t[3]&&32===t[4]&&49===t[5]&&49===t[6]&&187===t[7]&&13===t[8]&&10===t[9]&&26===t[10]&&10===t[11])return!0}return!1}}Mo.HEADER_LEN=64,Mo.COMPRESSED_2D=0,Mo.COMPRESSED_3D=1,Mo.TEX_2D=2,Mo.TEX_3D=3;var Do=i("../../../node_modules/@babylonjs/core/Misc/workerPool.js");class Oo{constructor(e,t=Oo.DefaultNumWorkers){this._engine=e,Oo._Initialize(t)}static GetDefaultNumWorkers(){return"object"==typeof navigator&&navigator.hardwareConcurrency?Math.min(Math.floor(.5*navigator.hardwareConcurrency),4):1}static _Initialize(e){Oo._WorkerPoolPromise||Oo._DecoderModulePromise||(e&&"function"==typeof Worker&&"undefined"!=typeof URL?Oo._WorkerPoolPromise=new Promise((t=>{const i=`(${wo})()`,n=URL.createObjectURL(new Blob([i],{type:"application/javascript"}));t(new Do.v(e,(()=>new Promise(((e,t)=>{const i=new Worker(n),r=e=>{i.removeEventListener("error",r),i.removeEventListener("message",s),t(e)},s=t=>{"init"===t.data.action&&(i.removeEventListener("error",r),i.removeEventListener("message",s),e(i))};i.addEventListener("error",r),i.addEventListener("message",s),i.postMessage({action:"init",urls:Oo.URLConfig})})))))})):"undefined"==typeof KTX2DECODER?Oo._DecoderModulePromise=V.w1.LoadScriptAsync(Oo.URLConfig.jsDecoderModule).then((()=>{KTX2DECODER.MSCTranscoder.UseFromWorkerThread=!1,KTX2DECODER.WASMMemoryManager.LoadBinariesFromCurrentThread=!0;const e=Oo.URLConfig;return null!==e.wasmUASTCToASTC&&(KTX2DECODER.LiteTranscoder_UASTC_ASTC.WasmModuleURL=e.wasmUASTCToASTC),null!==e.wasmUASTCToBC7&&(KTX2DECODER.LiteTranscoder_UASTC_BC7.WasmModuleURL=e.wasmUASTCToBC7),null!==e.wasmUASTCToRGBA_UNORM&&(KTX2DECODER.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL=e.wasmUASTCToRGBA_UNORM),null!==e.wasmUASTCToRGBA_SRGB&&(KTX2DECODER.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL=e.wasmUASTCToRGBA_SRGB),null!==e.jsMSCTranscoder&&(KTX2DECODER.MSCTranscoder.JSModuleURL=e.jsMSCTranscoder),null!==e.wasmMSCTranscoder&&(KTX2DECODER.MSCTranscoder.WasmModuleURL=e.wasmMSCTranscoder),null!==e.wasmZSTDDecoder&&(KTX2DECODER.ZSTDDecoder.WasmModuleURL=e.wasmZSTDDecoder),new KTX2DECODER.KTX2Decoder})):(KTX2DECODER.MSCTranscoder.UseFromWorkerThread=!1,KTX2DECODER.WASMMemoryManager.LoadBinariesFromCurrentThread=!0,Oo._DecoderModulePromise=Promise.resolve(new KTX2DECODER.KTX2Decoder)))}uploadAsync(e,t,i){const n=this._engine.getCaps(),r={astc:!!n.astc,bptc:!!n.bptc,s3tc:!!n.s3tc,pvrtc:!!n.pvrtc,etc2:!!n.etc2,etc1:!!n.etc1};if(Oo._WorkerPoolPromise)return Oo._WorkerPoolPromise.then((n=>new Promise(((s,o)=>{n.push(((n,a)=>{const l=e=>{n.removeEventListener("error",l),n.removeEventListener("message",c),o(e),a()},c=e=>{if("decoded"===e.data.action){if(n.removeEventListener("error",l),n.removeEventListener("message",c),e.data.success)try{this._createTexture(e.data.decodedData,t,i),s()}catch(e){o({message:e})}else o({message:e.data.msg});a()}};n.addEventListener("error",l),n.addEventListener("message",c);const h=new Uint8Array(e.byteLength);h.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),n.postMessage({action:"decode",data:h,caps:r,options:i},[h.buffer])}))}))));if(Oo._DecoderModulePromise)return Oo._DecoderModulePromise.then((i=>new Promise(((r,s)=>{i.decode(e,n).then((e=>{this._createTexture(e,t),r()})).catch((e=>{s({message:e})}))}))));throw new Error("KTX2 decoder module is not available")}_createTexture(e,t,i){if(this._engine._bindTextureDirectly(3553,t),i&&(i.transcodedFormat=e.transcodedFormat,i.isInGammaSpace=e.isInGammaSpace,i.hasAlpha=e.hasAlpha,i.transcoderName=e.transcoderName),32856===e.transcodedFormat?(t.type=0,t.format=5):t.format=e.transcodedFormat,t._gammaSpace=e.isInGammaSpace,t.generateMipMaps=e.mipmaps.length>1,e.errors)throw new Error("KTX2 container - could not transcode the data. "+e.errors);for(let i=0;i=12){const t=new Uint8Array(e.buffer,e.byteOffset,12);if(171===t[0]&&75===t[1]&&84===t[2]&&88===t[3]&&32===t[4]&&50===t[5]&&48===t[6]&&187===t[7]&&13===t[8]&&10===t[9]&&26===t[10]&&10===t[11])return!0}return!1}}function wo(){let e;onmessage=t=>{if(t.data)switch(t.data.action){case"init":{const i=t.data.urls;importScripts(i.jsDecoderModule),null!==i.wasmUASTCToASTC&&(KTX2DECODER.LiteTranscoder_UASTC_ASTC.WasmModuleURL=i.wasmUASTCToASTC),null!==i.wasmUASTCToBC7&&(KTX2DECODER.LiteTranscoder_UASTC_BC7.WasmModuleURL=i.wasmUASTCToBC7),null!==i.wasmUASTCToRGBA_UNORM&&(KTX2DECODER.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL=i.wasmUASTCToRGBA_UNORM),null!==i.wasmUASTCToRGBA_SRGB&&(KTX2DECODER.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL=i.wasmUASTCToRGBA_SRGB),null!==i.jsMSCTranscoder&&(KTX2DECODER.MSCTranscoder.JSModuleURL=i.jsMSCTranscoder),null!==i.wasmMSCTranscoder&&(KTX2DECODER.MSCTranscoder.WasmModuleURL=i.wasmMSCTranscoder),null!==i.wasmZSTDDecoder&&(KTX2DECODER.ZSTDDecoder.WasmModuleURL=i.wasmZSTDDecoder),e=new KTX2DECODER.KTX2Decoder,postMessage({action:"init"});break}case"decode":e.decode(t.data.data,t.data.caps,t.data.options).then((e=>{const t=[];for(let i=0;i{postMessage({action:"decoded",success:!1,msg:e})}))}}}Oo.URLConfig={jsDecoderModule:"https://preview.babylonjs.com/babylon.ktx2Decoder.js",wasmUASTCToASTC:null,wasmUASTCToBC7:null,wasmUASTCToRGBA_UNORM:null,wasmUASTCToRGBA_SRGB:null,jsMSCTranscoder:null,wasmMSCTranscoder:null,wasmZSTDDecoder:null},Oo.DefaultNumWorkers=Oo.GetDefaultNumWorkers(),k.D._TextureLoaders.unshift(new class{constructor(){this.supportCascades=!1}canLoad(e,t){return e.endsWith(".ktx")||e.endsWith(".ktx2")||"image/ktx"===t||"image/ktx2"===t}loadCubeData(e,t,i,n){if(Array.isArray(e))return;t._invertVScale=!t.invertY;const r=t.getEngine(),s=new Mo(e,6),o=s.numberOfMipmapLevels>1&&t.generateMipMaps;r._unpackFlipY(!0),s.uploadLevels(t,t.generateMipMaps),t.width=s.pixelWidth,t.height=s.pixelHeight,r._setCubeMapTextureParams(t,o,s.numberOfMipmapLevels-1),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n()}loadData(e,t,i,n){if(Mo.IsValid(e)){t._invertVScale=!t.invertY;const n=new Mo(e,1),r=function(e){switch(e){case 35916:return 33776;case 35918:return 33778;case 35919:return 33779;case 37493:return 37492;case 37497:return 37496;case 37495:return 37494;case 37840:return 37808;case 36493:return 36492}return null}(n.glInternalFormat);r?(t.format=r,t._useSRGBBuffer=t.getEngine()._getUseSRGBBuffer(!0,t.generateMipMaps),t._gammaSpace=!0):t.format=n.glInternalFormat,i(n.pixelWidth,n.pixelHeight,t.generateMipMaps,!0,(()=>{n.uploadLevels(t,t.generateMipMaps)}),n.isInvalid)}else Oo.IsValid(e)?new Oo(t.getEngine()).uploadAsync(e,t,n).then((()=>{i(t.width,t.height,t.generateMipMaps,!0,(()=>{}),!1)}),(e=>{u.Y.Warn(`Failed to load KTX2 texture data: ${e.message}`),i(0,0,!1,!1,(()=>{}),!0)})):(u.Y.Error("texture missing KTX identifier"),i(0,0,!1,!1,(()=>{}),!0))}});class Fo extends Ve.c{constructor(e,t,i){super(e,o.P.Zero(),t),this._xrSessionManager=i,this._firstFrame=!1,this._referenceQuaternion=o._f.Identity(),this._referencedPosition=new o.P,this._trackingState=$t.NOT_TRACKING,this.onBeforeCameraTeleport=new s.y$,this.onAfterCameraTeleport=new s.y$,this.onTrackingStateChanged=new s.y$,this.compensateOnFirstFrame=!0,this._rotate180=new o._f(0,1,0,0),this.minZ=.1,this.rotationQuaternion=new o._f,this.cameraRigMode=Le.V.RIG_MODE_CUSTOM,this.updateUpVectorFromRotation=!0,this._updateNumberOfRigCameras(1),this.freezeProjectionMatrix(),this._xrSessionManager.onXRSessionInit.add((()=>{this._referencedPosition.copyFromFloats(0,0,0),this._referenceQuaternion.copyFromFloats(0,0,0,1),this._firstFrame=this.compensateOnFirstFrame})),this._xrSessionManager.onXRFrameObservable.add((()=>{this._firstFrame&&this._updateFromXRSession(),this._updateReferenceSpace(),this._updateFromXRSession()}),void 0,!0)}get trackingState(){return this._trackingState}_setTrackingState(e){this._trackingState!==e&&(this._trackingState=e,this.onTrackingStateChanged.notifyObservers(e))}get realWorldHeight(){const e=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);return e&&e.transform?e.transform.position.y:0}_updateForDualEyeDebugging(){this._updateNumberOfRigCameras(2),this.rigCameras[0].viewport=new yt.l(0,0,.5,1),this.rigCameras[0].outputRenderTarget=null,this.rigCameras[1].viewport=new yt.l(.5,0,.5,1),this.rigCameras[1].outputRenderTarget=null}setTransformationFromNonVRCamera(e=this.getScene().activeCamera,t=!0){e&&e!==this&&(e.computeWorldMatrix().decompose(void 0,this.rotationQuaternion,this.position),this.position.y=0,o._f.FromEulerAnglesToRef(0,this.rotationQuaternion.toEulerAngles().y,0,this.rotationQuaternion),this._firstFrame=!0,t&&this._xrSessionManager.resetReferenceSpace())}getClassName(){return"WebXRCamera"}dispose(){super.dispose(),this._lastXRViewerPose=void 0}_updateFromXRSession(){const e=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);if(this._lastXRViewerPose=e||void 0,!e)return void this._setTrackingState($t.NOT_TRACKING);const t=e.emulatedPosition?$t.TRACKING_LOST:$t.TRACKING;if(this._setTrackingState(t),this.minZ!==this._cache.minZ||this.maxZ!==this._cache.maxZ){const e={depthFar:this.maxZ||1e4,depthNear:this.minZ};this._xrSessionManager.updateRenderState(e),this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ}if(e.transform){const t=e.transform.orientation;if(void 0===e.transform.orientation.x)return;const i=e.transform.position;this._referencedPosition.set(i.x,i.y,i.z),this._referenceQuaternion.set(t.x,t.y,t.z,t.w),this._scene.useRightHandedSystem||(this._referencedPosition.z*=-1,this._referenceQuaternion.z*=-1,this._referenceQuaternion.w*=-1),this._firstFrame?(this._firstFrame=!1,this.position.y+=this._referencedPosition.y,this._referenceQuaternion.copyFromFloats(0,0,0,1)):(this.rotationQuaternion.copyFrom(this._referenceQuaternion),this.position.copyFrom(this._referencedPosition))}this.rigCameras.length!==e.views.length&&this._updateNumberOfRigCameras(e.views.length),e.views.forEach(((e,t)=>{var i;const n=this.rigCameras[t];n.isLeftCamera||n.isRightCamera||("right"===e.eye?n._isRightCamera=!0:"left"===e.eye&&(n._isLeftCamera=!0));const r=e.transform.position,s=e.transform.orientation;n.parent=this.parent,n.position.set(r.x,r.y,r.z),n.rotationQuaternion.set(s.x,s.y,s.z,s.w),this._scene.useRightHandedSystem?n.rotationQuaternion.multiplyInPlace(this._rotate180):(n.position.z*=-1,n.rotationQuaternion.z*=-1,n.rotationQuaternion.w*=-1),o.y3.FromFloat32ArrayToRefScaled(e.projectionMatrix,0,1,n._projectionMatrix),this._scene.useRightHandedSystem||n._projectionMatrix.toggleProjectionMatrixHandInPlace(),0===t&&this._projectionMatrix.copyFrom(n._projectionMatrix);const a=this._xrSessionManager.getRenderTargetTextureForView(e);this._renderingMultiview=(null===(i=null==a?void 0:a._texture)||void 0===i?void 0:i.isMultiview)||!1,this._renderingMultiview?0==t&&(this._xrSessionManager.trySetViewportForView(this.viewport,e),this.outputRenderTarget=a):(this._xrSessionManager.trySetViewportForView(n.viewport,e),n.outputRenderTarget=a||this._xrSessionManager.getRenderTargetTextureForView(e))}))}_updateNumberOfRigCameras(e=1){for(;this.rigCameras.lengthe;){const e=this.rigCameras.pop();e&&e.dispose()}}_updateReferenceSpace(){if(!this.position.equals(this._referencedPosition)||!this.rotationQuaternion.equals(this._referenceQuaternion)){const e=o.jp.Matrix[0],t=o.jp.Matrix[1],i=o.jp.Matrix[2];o.y3.ComposeToRef(Fo._ScaleReadOnly,this._referenceQuaternion,this._referencedPosition,e),o.y3.ComposeToRef(Fo._ScaleReadOnly,this.rotationQuaternion,this.position,t),e.invert().multiplyToRef(t,i),i.invert(),this._scene.useRightHandedSystem||i.toggleModelMatrixHandInPlace(),i.decompose(void 0,this._referenceQuaternion,this._referencedPosition);const n=new XRRigidTransform({x:this._referencedPosition.x,y:this._referencedPosition.y,z:this._referencedPosition.z},{x:this._referenceQuaternion.x,y:this._referenceQuaternion.y,z:this._referenceQuaternion.z,w:this._referenceQuaternion.w});this._xrSessionManager.referenceSpace=this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(n)}}}Fo._ScaleReadOnly=o.P.One();var Bo=i("../../../node_modules/@babylonjs/core/XR/webXRFeaturesManager.js");class No{constructor(e){this._scene=e,this._nonVRCamera=null,this._attachedToElement=!1,this._spectatorCamera=null,this._originalSceneAutoClear=!0,this._supported=!1,this._spectatorMode=!1,this._lastTimestamp=0,this.onInitialXRPoseSetObservable=new s.y$,this.onStateChangedObservable=new s.y$,this.state=Zt.NOT_IN_XR,this.sessionManager=new li(e),this.camera=new Fo("webxr",e,this.sessionManager),this.featuresManager=new Bo.d(this.sessionManager),e.onDisposeObservable.addOnce((()=>{this.dispose()}))}static CreateAsync(e){const t=new No(e);return t.sessionManager.initializeAsync().then((()=>(t._supported=!0,t))).catch((e=>{throw t._setState(Zt.NOT_IN_XR),t.dispose(),e}))}dispose(){var e;this.exitXRAsync(),this.camera.dispose(),this.onStateChangedObservable.clear(),this.onInitialXRPoseSetObservable.clear(),this.sessionManager.dispose(),null===(e=this._spectatorCamera)||void 0===e||e.dispose(),this._nonVRCamera&&(this._scene.activeCamera=this._nonVRCamera)}async enterXRAsync(e,t,i=this.sessionManager.getWebXRRenderTarget(),n={}){var r,s,o;if(!this._supported)throw"WebXR not supported in this browser or environment";this._setState(Zt.ENTERING_XR),"viewer"!==t&&"local"!==t&&(n.optionalFeatures=n.optionalFeatures||[],n.optionalFeatures.push(t)),n=await this.featuresManager._extendXRSessionInitObject(n),"immersive-ar"===e&&"unbounded"!==t&&u.Y.Warn("We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode");try{await this.sessionManager.initializeSessionAsync(e,n),await this.sessionManager.setReferenceSpaceTypeAsync(t);const a=await i.initializeXRLayerAsync(this.sessionManager.session),l={depthFar:this.camera.maxZ||1e4,depthNear:this.camera.minZ};return this.featuresManager.getEnabledFeature(Bo.b.LAYERS)||(l.baseLayer=a),this.sessionManager.updateRenderState(l),this.sessionManager.runXRRenderLoop(),this._originalSceneAutoClear=this._scene.autoClear,this._nonVRCamera=this._scene.activeCamera,this._attachedToElement=!!(null===(s=null===(r=this._nonVRCamera)||void 0===r?void 0:r.inputs)||void 0===s?void 0:s.attachedToElement),null===(o=this._nonVRCamera)||void 0===o||o.detachControl(),this._scene.activeCamera=this.camera,"immersive-ar"!==e?this._nonXRToXRCamera():(this._scene.autoClear=!1,this.camera.compensateOnFirstFrame=!1,this.camera.position.set(0,0,0),this.camera.rotationQuaternion.set(0,0,0,1)),this.sessionManager.onXRSessionEnded.addOnce((()=>{this.state!==Zt.EXITING_XR&&this._setState(Zt.EXITING_XR),this.camera.rigCameras.forEach((e=>{e.outputRenderTarget=null})),this._scene.autoClear=this._originalSceneAutoClear,this._scene.activeCamera=this._nonVRCamera,this._attachedToElement&&this._nonVRCamera&&this._nonVRCamera.attachControl(!!this._nonVRCamera.inputs.noPreventDefault),"immersive-ar"!==e&&this.camera.compensateOnFirstFrame&&(this._nonVRCamera.setPosition?this._nonVRCamera.setPosition(this.camera.position):this._nonVRCamera.position.copyFrom(this.camera.position)),this._setState(Zt.NOT_IN_XR)})),this.sessionManager.onXRFrameObservable.addOnce((()=>{this._setState(Zt.IN_XR)})),this.sessionManager}catch(e){throw console.log(e),console.log(e.message),this._setState(Zt.NOT_IN_XR),e}}exitXRAsync(){return this.state!==Zt.IN_XR?Promise.resolve():(this._setState(Zt.EXITING_XR),this.sessionManager.exitXRAsync())}enableSpectatorMode(e){this._spectatorMode||(this._spectatorMode=!0,this._switchSpectatorMode(e))}disableSpecatatorMode(){this._spectatorMode&&(this._spectatorMode=!1,this._switchSpectatorMode())}_switchSpectatorMode(e){const t=1/((null==e?void 0:e.fps)?e.fps:1e3)*1e3,i=(null==e?void 0:e.preferredCameraIndex)?null==e?void 0:e.preferredCameraIndex:0,n=()=>{this._spectatorCamera&&this.sessionManager.currentTimestamp-this._lastTimestamp>=t&&(this._lastTimestamp=this.sessionManager.currentTimestamp,this._spectatorCamera.position.copyFrom(this.camera.rigCameras[i].globalPosition),this._spectatorCamera.rotationQuaternion.copyFrom(this.camera.rigCameras[i].absoluteRotation))};if(this._spectatorMode){if(i>=this.camera.rigCameras.length)throw new Error("the preferred camera index is beyond the length of rig camera array.");const e=()=>{this.state===Zt.IN_XR?(this._spectatorCamera=new lt("webxr-spectator",o.P.Zero(),this._scene),this._spectatorCamera.rotationQuaternion=new o._f,this._scene.activeCameras=[this.camera,this._spectatorCamera],this.sessionManager.onXRFrameObservable.add(n),this._scene.onAfterRenderCameraObservable.add((e=>{e===this.camera&&(this._scene.getEngine().framebufferDimensionsObject=null)}))):this.state===Zt.EXITING_XR&&(this.sessionManager.onXRFrameObservable.removeCallback(n),this._scene.activeCameras=null)};this.onStateChangedObservable.add(e),e()}else this.sessionManager.onXRFrameObservable.removeCallback(n),this._scene.activeCameras=[this.camera]}_nonXRToXRCamera(){this.camera.setTransformationFromNonVRCamera(this._nonVRCamera),this.onInitialXRPoseSetObservable.notifyObservers(this.camera)}_setState(e){this.state!==e&&(this.state=e,this.onStateChangedObservable.notifyObservers(this.state))}}class Lo{constructor(e,t,i=-1,n=[]){this.id=e,this.type=t,this._buttonIndex=i,this._axesIndices=n,this._axes={x:0,y:0},this._changes={},this._currentValue=0,this._hasChanges=!1,this._pressed=!1,this._touched=!1,this.onAxisValueChangedObservable=new s.y$,this.onButtonStateChangedObservable=new s.y$}get axes(){return this._axes}get changes(){return this._changes}get hasChanges(){return this._hasChanges}get pressed(){return this._pressed}get touched(){return this._touched}get value(){return this._currentValue}dispose(){this.onAxisValueChangedObservable.clear(),this.onButtonStateChangedObservable.clear()}isAxes(){return 0!==this._axesIndices.length}isButton(){return-1!==this._buttonIndex}update(e){let t=!1,i=!1;if(this._hasChanges=!1,this._changes={},this.isButton()){const i=e.buttons[this._buttonIndex];if(!i)return;this._currentValue!==i.value&&(this.changes.value={current:i.value,previous:this._currentValue},t=!0,this._currentValue=i.value),this._touched!==i.touched&&(this.changes.touched={current:i.touched,previous:this._touched},t=!0,this._touched=i.touched),this._pressed!==i.pressed&&(this.changes.pressed={current:i.pressed,previous:this._pressed},t=!0,this._pressed=i.pressed)}this.isAxes()&&(this._axes.x!==e.axes[this._axesIndices[0]]&&(this.changes.axes={current:{x:e.axes[this._axesIndices[0]],y:this._axes.y},previous:{x:this._axes.x,y:this._axes.y}},this._axes.x=e.axes[this._axesIndices[0]],i=!0),this._axes.y!==e.axes[this._axesIndices[1]]&&(this.changes.axes?this.changes.axes.current.y=e.axes[this._axesIndices[1]]:this.changes.axes={current:{x:this._axes.x,y:e.axes[this._axesIndices[1]]},previous:{x:this._axes.x,y:this._axes.y}},this._axes.y=e.axes[this._axesIndices[1]],i=!0)),t&&(this._hasChanges=!0,this.onButtonStateChangedObservable.notifyObservers(this)),i&&(this._hasChanges=!0,this.onAxisValueChangedObservable.notifyObservers(this._axes))}}Lo.BUTTON_TYPE="button",Lo.SQUEEZE_TYPE="squeeze",Lo.THUMBSTICK_TYPE="thumbstick",Lo.TOUCHPAD_TYPE="touchpad",Lo.TRIGGER_TYPE="trigger";class ko{constructor(e,t,i,n,r=!1,o){this.scene=e,this.layout=t,this.gamepadObject=i,this.handedness=n,this._doNotLoadControllerMesh=r,this._controllerCache=o,this._initComponent=e=>{if(!e)return;const t=this.layout.components[e],i=t.type,n=t.gamepadIndices.button,r=[];void 0!==t.gamepadIndices.xAxis&&void 0!==t.gamepadIndices.yAxis&&r.push(t.gamepadIndices.xAxis,t.gamepadIndices.yAxis),this.components[e]=new Lo(e,i,n,r)},this._modelReady=!1,this.components={},this.disableAnimation=!1,this.onModelLoadedObservable=new s.y$,t.components&&Object.keys(t.components).forEach(this._initComponent)}dispose(){this.getComponentIds().forEach((e=>this.getComponent(e).dispose())),this.rootMesh&&(this.rootMesh.getChildren(void 0,!0).forEach((e=>{e.setEnabled(!1)})),this.rootMesh.dispose(!!this._controllerCache,!this._controllerCache))}getAllComponentsOfType(e){return this.getComponentIds().map((e=>this.components[e])).filter((t=>t.type===e))}getComponent(e){return this.components[e]}getComponentIds(){return Object.keys(this.components)}getComponentOfType(e){return this.getAllComponentsOfType(e)[0]||null}getMainComponent(){return this.getComponent(this.layout.selectComponentId)}async loadModel(){const e=!this._getModelLoadingConstraints();let t=this._getGenericFilenameAndPath();return e?u.Y.Warn("Falling back to generic models"):t=this._getFilenameAndPath(),new Promise(((i,n)=>{const r=t=>{e?this._getGenericParentMesh(t):this._setRootMesh(t),this._processLoadedModel(t),this._modelReady=!0,this.onModelLoadedObservable.notifyObservers(this),i(!0)};if(this._controllerCache){const e=this._controllerCache.filter((e=>e.filename===t.filename&&e.path===t.path));if(e[0])return e[0].meshes.forEach((e=>e.setEnabled(!0))),void r(e[0].meshes)}Vs.n.ImportMesh("",t.path,t.filename,this.scene,(e=>{this._controllerCache&&this._controllerCache.push({...t,meshes:e}),r(e)}),null,((e,i)=>{u.Y.Log(i),u.Y.Warn(`Failed to retrieve controller model of type ${this.profileId} from the remote server: ${t.path}${t.filename}`),n(i)}))}))}updateFromXRFrame(e){this.getComponentIds().forEach((e=>this.getComponent(e).update(this.gamepadObject))),this.updateModel(e)}get handness(){return this.handedness}pulse(e,t,i=0){return this.gamepadObject.hapticActuators&&this.gamepadObject.hapticActuators[i]?this.gamepadObject.hapticActuators[i].pulse(e,t):Promise.resolve(!1)}_getChildByName(e,t){return e.getChildren((e=>e.name===t),!1)[0]}_getImmediateChildByName(e,t){return e.getChildren((e=>e.name==t),!0)[0]}_lerpTransform(e,t,i){if(!e.minMesh||!e.maxMesh||!e.valueMesh)return;if(!e.minMesh.rotationQuaternion||!e.maxMesh.rotationQuaternion||!e.valueMesh.rotationQuaternion)return;const n=i?.5*t+.5:t;o._f.SlerpToRef(e.minMesh.rotationQuaternion,e.maxMesh.rotationQuaternion,n,e.valueMesh.rotationQuaternion),o.P.LerpToRef(e.minMesh.position,e.maxMesh.position,n,e.valueMesh.position)}updateModel(e){this._modelReady&&this._updateModel(e)}_getGenericFilenameAndPath(){return{filename:"generic.babylon",path:"https://controllers.babylonjs.com/generic/"}}_getGenericParentMesh(e){this.rootMesh=new je.Kj(this.profileId+" "+this.handedness,this.scene),e.forEach((e=>{e.parent||(e.isPickable=!1,e.setParent(this.rootMesh))})),this.rootMesh.rotationQuaternion=o._f.FromEulerAngles(0,Math.PI,0)}}class Vo extends ko{constructor(e,t,i){super(e,Uo[i],t,i),this.profileId=Vo.ProfileId}_getFilenameAndPath(){return{filename:"generic.babylon",path:"https://controllers.babylonjs.com/generic/"}}_getModelLoadingConstraints(){return!0}_processLoadedModel(e){}_setRootMesh(e){this.rootMesh=new je.Kj(this.profileId+" "+this.handedness,this.scene),e.forEach((e=>{e.isPickable=!1,e.parent||e.setParent(this.rootMesh)})),this.rootMesh.rotationQuaternion=o._f.FromEulerAngles(0,Math.PI,0)}_updateModel(){}}Vo.ProfileId="generic-trigger";const Uo={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-trigger-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-trigger-right",assetPath:"right.glb"},none:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-trigger-none",assetPath:"none.glb"}};class Go extends ko{constructor(e,t,i,n,r){super(e,i.layouts[t.handedness||"none"],t.gamepad,t.handedness,void 0,r),this._repositoryUrl=n,this.controllerCache=r,this._buttonMeshMapping={},this._touchDots={},this.profileId=i.profileId}dispose(){super.dispose(),this.controllerCache||Object.keys(this._touchDots).forEach((e=>{this._touchDots[e].dispose()}))}_getFilenameAndPath(){return{filename:this.layout.assetPath,path:`${this._repositoryUrl}/profiles/${this.profileId}/`}}_getModelLoadingConstraints(){const e=Vs.n.IsPluginForExtensionAvailable(".glb");return e||u.Y.Warn("glTF / glb loader was not registered, using generic controller instead"),e}_processLoadedModel(e){this.getComponentIds().forEach((e=>{const t=this.layout.components[e];this._buttonMeshMapping[e]={mainMesh:this._getChildByName(this.rootMesh,t.rootNodeName),states:{}},Object.keys(t.visualResponses).forEach((i=>{const n=t.visualResponses[i];if("transform"===n.valueNodeProperty)this._buttonMeshMapping[e].states[i]={valueMesh:this._getChildByName(this.rootMesh,n.valueNodeName),minMesh:this._getChildByName(this.rootMesh,n.minNodeName),maxMesh:this._getChildByName(this.rootMesh,n.maxNodeName)};else{const r=t.type===Lo.TOUCHPAD_TYPE&&t.touchPointNodeName?t.touchPointNodeName:n.valueNodeName;if(this._buttonMeshMapping[e].states[i]={valueMesh:this._getChildByName(this.rootMesh,r)},t.type===Lo.TOUCHPAD_TYPE&&!this._touchDots[i]){const t=en(i+"dot",{diameter:.0015,segments:8},this.scene);t.material=new Yt.K(i+"mat",this.scene),t.material.diffuseColor=a.Wo.Red(),t.parent=this._buttonMeshMapping[e].states[i].valueMesh||null,t.isVisible=!1,this._touchDots[i]=t}}}))}))}_setRootMesh(e){let t;this.rootMesh=new je.Kj(this.profileId+"-"+this.handedness,this.scene),this.rootMesh.isPickable=!1;for(let i=0;i{const t=this.getComponent(e);if(!t.hasChanges)return;const i=this._buttonMeshMapping[e],n=this.layout.components[e];Object.keys(n.visualResponses).forEach((e=>{const r=n.visualResponses[e];let s=t.value;if("xAxis"===r.componentProperty?s=t.axes.x:"yAxis"===r.componentProperty&&(s=t.axes.y),"transform"===r.valueNodeProperty)this._lerpTransform(i.states[e],s,"button"!==r.componentProperty);else{const n=i.states[e].valueMesh;n&&(n.isVisible=t.touched||t.pressed),this._touchDots[e]&&(this._touchDots[e].isVisible=t.touched||t.pressed)}}))}))}}const jo=[];class Wo{static ClearProfilesCache(){this._ProfilesList=null,this._ProfileLoadingPromises={}}static DefaultFallbacks(){this.RegisterFallbacksForProfileId("google-daydream",["generic-touchpad"]),this.RegisterFallbacksForProfileId("htc-vive-focus",["generic-trigger-touchpad"]),this.RegisterFallbacksForProfileId("htc-vive",["generic-trigger-squeeze-touchpad"]),this.RegisterFallbacksForProfileId("magicleap-one",["generic-trigger-squeeze-touchpad"]),this.RegisterFallbacksForProfileId("windows-mixed-reality",["generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("microsoft-mixed-reality",["windows-mixed-reality","generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("oculus-go",["generic-trigger-touchpad"]),this.RegisterFallbacksForProfileId("oculus-touch-v2",["oculus-touch","generic-trigger-squeeze-thumbstick"]),this.RegisterFallbacksForProfileId("oculus-touch",["generic-trigger-squeeze-thumbstick"]),this.RegisterFallbacksForProfileId("samsung-gearvr",["windows-mixed-reality","generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("samsung-odyssey",["generic-touchpad"]),this.RegisterFallbacksForProfileId("valve-index",["generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("generic-hand-select",["generic-trigger"])}static FindFallbackWithProfileId(e){const t=this._Fallbacks[e]||[];return t.unshift(e),t}static GetMotionControllerWithXRInput(e,t,i){const n=[];i&&n.push(i),n.push(...e.profiles||[]),n.length&&!n[0]&&n.pop(),e.gamepad&&e.gamepad.id&&e.gamepad.id===(e.gamepad.id.match(/oculus touch/gi)?e.gamepad.id:void 0)&&n.push("oculus-touch-v2");const r=n.indexOf("windows-mixed-reality");if(-1!==r&&n.splice(r,0,"microsoft-mixed-reality"),n.length||n.push("generic-trigger"),this.UseOnlineRepository){const i=this.PrioritizeOnlineRepository?this._LoadProfileFromRepository:this._LoadProfilesFromAvailableControllers,r=this.PrioritizeOnlineRepository?this._LoadProfilesFromAvailableControllers:this._LoadProfileFromRepository;return i.call(this,n,e,t).catch((()=>r.call(this,n,e,t)))}return this._LoadProfilesFromAvailableControllers(n,e,t)}static RegisterController(e,t){this._AvailableControllers[e]=t}static RegisterFallbacksForProfileId(e,t){this._Fallbacks[e]?this._Fallbacks[e].push(...t):this._Fallbacks[e]=t}static UpdateProfilesList(){return this._ProfilesList=V.w1.LoadFileAsync(this.BaseRepositoryUrl+"/profiles/profilesList.json",!1).then((e=>JSON.parse(e.toString()))),this._ProfilesList}static ClearControllerCache(){jo.forEach((e=>{e.meshes.forEach((e=>{e.dispose(!1,!0)}))})),jo.length=0}static _LoadProfileFromRepository(e,t,i){return Promise.resolve().then((()=>this._ProfilesList?this._ProfilesList:this.UpdateProfilesList())).then((t=>{for(let i=0;i(this._ProfileLoadingPromises[e]||(this._ProfileLoadingPromises[e]=V.w1.LoadFileAsync(`${this.BaseRepositoryUrl}/profiles/${e}/profile.json`,!1).then((e=>JSON.parse(e)))),this._ProfileLoadingPromises[e]))).then((e=>new Go(i,t,e,this.BaseRepositoryUrl,this.DisableControllerCache?void 0:jo)))}static _LoadProfilesFromAvailableControllers(e,t,i){for(let n=0;nnew Vo(t,e.gamepad,e.handedness))),Wo.DefaultFallbacks();let zo=0;class Ho{constructor(e,t,i={}){this._scene=e,this.inputSource=t,this._options=i,this._tmpVector=new o.P,this._disposed=!1,this.onDisposeObservable=new s.y$,this.onMeshLoadedObservable=new s.y$,this.onMotionControllerInitObservable=new s.y$,this._uniqueId=`controller-${zo++}-${t.targetRayMode}-${t.handedness}`,this.pointer=new zi.x(`${this._uniqueId}-pointer`,e),this.pointer.rotationQuaternion=new o._f,this.inputSource.gripSpace&&(this.grip=new zi.x(`${this._uniqueId}-grip`,this._scene),this.grip.rotationQuaternion=new o._f),this._tmpVector.set(0,0,this._scene.useRightHandedSystem?-1:1),this.inputSource.gamepad&&"tracked-pointer"===this.inputSource.targetRayMode&&Wo.GetMotionControllerWithXRInput(t,e,this._options.forceControllerProfile).then((e=>{this.motionController=e,this.onMotionControllerInitObservable.notifyObservers(e),this._options.doNotLoadControllerMesh||this.motionController._doNotLoadControllerMesh||this.motionController.loadModel().then((e=>{var t;e&&this.motionController&&this.motionController.rootMesh&&(this._options.renderingGroupId&&(this.motionController.rootMesh.renderingGroupId=this._options.renderingGroupId,this.motionController.rootMesh.getChildMeshes(!1).forEach((e=>e.renderingGroupId=this._options.renderingGroupId))),this.onMeshLoadedObservable.notifyObservers(this.motionController.rootMesh),this.motionController.rootMesh.parent=this.grip||this.pointer,this.motionController.disableAnimation=!!this._options.disableMotionControllerAnimation),this._disposed&&(null===(t=this.motionController)||void 0===t||t.dispose())}))}),(()=>{V.w1.Warn("Could not find a matching motion controller for the registered input source")}))}get uniqueId(){return this._uniqueId}dispose(){this.grip&&this.grip.dispose(!0),this.motionController&&this.motionController.dispose(),this.pointer.dispose(!0),this.onMotionControllerInitObservable.clear(),this.onMeshLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._disposed=!0}getWorldPointerRayToRef(e,t=!1){const i=t&&this.grip?this.grip:this.pointer;o.P.TransformNormalToRef(this._tmpVector,i.getWorldMatrix(),e.direction),e.direction.normalize(),e.origin.copyFrom(i.absolutePosition),e.length=1e3}updateFromXRFrame(e,t,i){const n=e.getPose(this.inputSource.targetRaySpace,t);if(this._lastXRPose=n,n){const e=n.transform.position;this.pointer.position.set(e.x,e.y,e.z);const t=n.transform.orientation;this.pointer.rotationQuaternion.set(t.x,t.y,t.z,t.w),this._scene.useRightHandedSystem||(this.pointer.position.z*=-1,this.pointer.rotationQuaternion.z*=-1,this.pointer.rotationQuaternion.w*=-1),this.pointer.parent=i.parent}if(this.inputSource.gripSpace&&this.grip){const n=e.getPose(this.inputSource.gripSpace,t);if(n){const e=n.transform.position,t=n.transform.orientation;this.grip.position.set(e.x,e.y,e.z),this.grip.rotationQuaternion.set(t.x,t.y,t.z,t.w),this._scene.useRightHandedSystem||(this.grip.position.z*=-1,this.grip.rotationQuaternion.z*=-1,this.grip.rotationQuaternion.w*=-1)}this.grip.parent=i.parent}this.motionController&&this.motionController.updateFromXRFrame(e)}}class Xo{constructor(e,t,i={}){if(this.xrSessionManager=e,this.xrCamera=t,this._options=i,this.controllers=[],this.onControllerAddedObservable=new s.y$,this.onControllerRemovedObservable=new s.y$,this._onInputSourcesChange=e=>{this._addAndRemoveControllers(e.added,e.removed)},this._sessionEndedObserver=this.xrSessionManager.onXRSessionEnded.add((()=>{this._addAndRemoveControllers([],this.controllers.map((e=>e.inputSource)))})),this._sessionInitObserver=this.xrSessionManager.onXRSessionInit.add((e=>{e.addEventListener("inputsourceschange",this._onInputSourcesChange)})),this._frameObserver=this.xrSessionManager.onXRFrameObservable.add((e=>{this.controllers.forEach((t=>{t.updateFromXRFrame(e,this.xrSessionManager.referenceSpace,this.xrCamera)}))})),this._options.customControllersRepositoryURL&&(Wo.BaseRepositoryUrl=this._options.customControllersRepositoryURL),Wo.UseOnlineRepository=!this._options.disableOnlineControllerRepository,Wo.UseOnlineRepository)try{Wo.UpdateProfilesList().catch((()=>{Wo.UseOnlineRepository=!1}))}catch(e){Wo.UseOnlineRepository=!1}}_addAndRemoveControllers(e,t){const i=this.controllers.map((e=>e.inputSource));for(const t of e)if(-1===i.indexOf(t)){const e=new Ho(this.xrSessionManager.scene,t,{...this._options.controllerOptions||{},forceControllerProfile:this._options.forceInputProfile,doNotLoadControllerMesh:this._options.doNotLoadControllerMeshes,disableMotionControllerAnimation:this._options.disableControllerAnimation});this.controllers.push(e),this.onControllerAddedObservable.notifyObservers(e)}const n=[],r=[];this.controllers.forEach((e=>{-1===t.indexOf(e.inputSource)?n.push(e):r.push(e)})),this.controllers=n,r.forEach((e=>{this.onControllerRemovedObservable.notifyObservers(e),e.dispose()}))}dispose(){this.controllers.forEach((e=>{e.dispose()})),this.xrSessionManager.onXRFrameObservable.remove(this._frameObserver),this.xrSessionManager.onXRSessionInit.remove(this._sessionInitObserver),this.xrSessionManager.onXRSessionEnded.remove(this._sessionEndedObserver),this.onControllerAddedObservable.clear(),this.onControllerRemovedObservable.clear(),Wo.ClearControllerCache()}}var Yo=i("../../../node_modules/@babylonjs/core/XR/features/WebXRAbstractFeature.js");class Qo extends Yo.F{constructor(e,t){super(e),this._options=t,this._attachController=e=>{if(this._controllers[e.uniqueId])return;const{laserPointer:t,selectionMesh:i}=this._generateNewMeshPair(e.pointer);switch(this._controllers[e.uniqueId]={xrController:e,laserPointer:t,selectionMesh:i,meshUnderPointer:null,pick:null,tmpRay:new tt.z(new o.P,new o.P),disabledByNearInteraction:!1,id:Qo._IdCounter++},this._attachedController?!this._options.enablePointerSelectionOnAllControllers&&this._options.preferredHandedness&&e.inputSource.handedness===this._options.preferredHandedness&&(this._attachedController=e.uniqueId):this._options.enablePointerSelectionOnAllControllers||(this._attachedController=e.uniqueId),e.inputSource.targetRayMode){case"tracked-pointer":return this._attachTrackedPointerRayMode(e);case"gaze":return this._attachGazeMode(e);case"screen":return this._attachScreenRayMode(e)}},this._controllers={},this._tmpVectorForPickCompare=new o.P,this.disablePointerLighting=!0,this.disableSelectionMeshLighting=!0,this.displayLaserPointer=!0,this.displaySelectionMesh=!0,this.laserPointerPickedColor=new a.Wo(.9,.9,.9),this.laserPointerDefaultColor=new a.Wo(.7,.7,.7),this.selectionMeshDefaultColor=new a.Wo(.8,.8,.8),this.selectionMeshPickedColor=new a.Wo(.3,.3,1),this._identityMatrix=o.y3.Identity(),this._screenCoordinatesRef=o.P.Zero(),this._viewportRef=new yt.l(0,0,0,0),this._scene=this._xrSessionManager.scene}attach(){if(!super.attach())return!1;if(this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,(e=>{this._detachController(e.uniqueId)})),this._scene.constantlyUpdateMeshUnderPointer=!0,this._options.gazeCamera){const e=this._options.gazeCamera,{laserPointer:t,selectionMesh:i}=this._generateNewMeshPair(e);this._controllers.camera={webXRCamera:e,laserPointer:t,selectionMesh:i,meshUnderPointer:null,pick:null,tmpRay:new tt.z(new o.P,new o.P),disabledByNearInteraction:!1,id:Qo._IdCounter++},this._attachGazeMode()}return!0}detach(){return!!super.detach()&&(Object.keys(this._controllers).forEach((e=>{this._detachController(e)})),!0)}getMeshUnderPointer(e){return this._controllers[e]?this._controllers[e].meshUnderPointer:null}getXRControllerByPointerId(e){const t=Object.keys(this._controllers);for(let i=0;i{const t=this._controllers[e];if(!this._options.enablePointerSelectionOnAllControllers&&e!==this._attachedController||t.disabledByNearInteraction)return t.selectionMesh.isVisible=!1,t.laserPointer.isVisible=!1,void(t.pick=null);let i;if(t.laserPointer.isVisible=this.displayLaserPointer,t.xrController)i=t.xrController.pointer.position,t.xrController.getWorldPointerRayToRef(t.tmpRay);else{if(!t.webXRCamera)return;i=t.webXRCamera.position,t.webXRCamera.getForwardRayToRef(t.tmpRay)}if(this._options.maxPointerDistance&&(t.tmpRay.length=this._options.maxPointerDistance),!this._options.disableScenePointerVectorUpdate&&i){const e=this._xrSessionManager.scene,n=this._options.xrInput.xrCamera;n&&(n.viewport.toGlobalToRef(e.getEngine().getRenderWidth(),e.getEngine().getRenderHeight(),this._viewportRef),o.P.ProjectToRef(i,this._identityMatrix,e.getTransformMatrix(),this._viewportRef,this._screenCoordinatesRef),"number"!=typeof this._screenCoordinatesRef.x||"number"!=typeof this._screenCoordinatesRef.y||isNaN(this._screenCoordinatesRef.x)||isNaN(this._screenCoordinatesRef.y)||(e.pointerX=this._screenCoordinatesRef.x,e.pointerY=this._screenCoordinatesRef.y,t.screenCoordinates={x:this._screenCoordinatesRef.x,y:this._screenCoordinatesRef.y}))}let n=null;this._utilityLayerScene&&(n=this._utilityLayerScene.pickWithRay(t.tmpRay,this._utilityLayerScene.pointerMovePredicate||this.raySelectionPredicate));const r=this._scene.pickWithRay(t.tmpRay,this._scene.pointerMovePredicate||this.raySelectionPredicate);n&&n.hit?r&&r.hit?n.distance{if(t.pick){if(this._augmentPointerInit(l,t.id,t.screenCoordinates),t.laserPointer.material.alpha=0,s.isVisible=!1,t.pick.hit)if(this._pickingMoved(r,t.pick))a&&(this._options.disablePointerUpOnTouchOut||this._scene.simulatePointerUp(t.pick,l)),a=!1,o=0;else if(o>i/10&&(s.isVisible=!0),o+=this._scene.getEngine().getDeltaTime(),o>=i)this._scene.simulatePointerDown(t.pick,l),a=!0,this._options.disablePointerUpOnTouchOut&&this._scene.simulatePointerUp(t.pick,l),s.isVisible=!1;else{const e=1-o/i;s.scaling.set(e,e,e)}else a=!1,o=0;this._scene.simulatePointerMove(t.pick,l),r=t.pick}})),void 0!==this._options.renderingGroupId&&(s.renderingGroupId=this._options.renderingGroupId),e&&e.onDisposeObservable.addOnce((()=>{t.pick&&!this._options.disablePointerUpOnTouchOut&&a&&(this._scene.simulatePointerUp(t.pick,l),t.finalPointerUpTriggered=!0),s.dispose()}))}_attachScreenRayMode(e){const t=this._controllers[e.uniqueId];let i=!1;const n={pointerId:t.id,pointerType:"xr"};t.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((()=>{this._augmentPointerInit(n,t.id,t.screenCoordinates),!t.pick||this._options.disablePointerUpOnTouchOut&&i||(i?this._scene.simulatePointerMove(t.pick,n):(this._scene.simulatePointerDown(t.pick,n),t.pointerDownTriggered=!0,i=!0,this._options.disablePointerUpOnTouchOut&&this._scene.simulatePointerUp(t.pick,n)))})),e.onDisposeObservable.addOnce((()=>{this._augmentPointerInit(n,t.id,t.screenCoordinates),this._xrSessionManager.runInXRFrame((()=>{t.pick&&!t.finalPointerUpTriggered&&i&&!this._options.disablePointerUpOnTouchOut&&(this._scene.simulatePointerUp(t.pick,n),t.finalPointerUpTriggered=!0)}))}))}_attachTrackedPointerRayMode(e){const t=this._controllers[e.uniqueId];if(this._options.forceGazeMode)return this._attachGazeMode(e);const i={pointerId:t.id,pointerType:"xr"};if(t.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((()=>{t.laserPointer.material.disableLighting=this.disablePointerLighting,t.selectionMesh.material.disableLighting=this.disableSelectionMeshLighting,t.pick&&(this._augmentPointerInit(i,t.id,t.screenCoordinates),this._scene.simulatePointerMove(t.pick,i))})),e.inputSource.gamepad){const n=n=>{this._options.overrideButtonId&&(t.selectionComponent=n.getComponent(this._options.overrideButtonId)),t.selectionComponent||(t.selectionComponent=n.getMainComponent()),t.onButtonChangedObserver=t.selectionComponent.onButtonStateChangedObservable.add((n=>{if(n.changes.pressed){const r=n.changes.pressed.current;t.pick?(this._options.enablePointerSelectionOnAllControllers||e.uniqueId===this._attachedController)&&(this._augmentPointerInit(i,t.id,t.screenCoordinates),r?(this._scene.simulatePointerDown(t.pick,i),t.pointerDownTriggered=!0,t.selectionMesh.material.emissiveColor=this.selectionMeshPickedColor,t.laserPointer.material.emissiveColor=this.laserPointerPickedColor):(this._scene.simulatePointerUp(t.pick,i),t.selectionMesh.material.emissiveColor=this.selectionMeshDefaultColor,t.laserPointer.material.emissiveColor=this.laserPointerDefaultColor)):!r||this._options.enablePointerSelectionOnAllControllers||this._options.disableSwitchOnClick||(this._attachedController=e.uniqueId)}}))};e.motionController?n(e.motionController):e.onMotionControllerInitObservable.add(n)}else{const e=e=>{this._augmentPointerInit(i,t.id,t.screenCoordinates),t.xrController&&e.inputSource===t.xrController.inputSource&&t.pick&&(this._scene.simulatePointerDown(t.pick,i),t.pointerDownTriggered=!0,t.selectionMesh.material.emissiveColor=this.selectionMeshPickedColor,t.laserPointer.material.emissiveColor=this.laserPointerPickedColor)},n=e=>{this._augmentPointerInit(i,t.id,t.screenCoordinates),t.xrController&&e.inputSource===t.xrController.inputSource&&t.pick&&(this._scene.simulatePointerUp(t.pick,i),t.selectionMesh.material.emissiveColor=this.selectionMeshDefaultColor,t.laserPointer.material.emissiveColor=this.laserPointerDefaultColor)};t.eventListeners={selectend:n,selectstart:e},this._xrSessionManager.session.addEventListener("selectstart",e),this._xrSessionManager.session.addEventListener("selectend",n)}}_convertNormalToDirectionOfRay(e,t){return e&&Math.acos(o.P.Dot(e,t.direction)){const i=t.eventListeners&&t.eventListeners[e];i&&this._xrSessionManager.session.removeEventListener(e,i)})),!t.finalPointerUpTriggered&&t.pointerDownTriggered){const e={pointerId:t.id,pointerType:"xr"};this._xrSessionManager.runInXRFrame((()=>{this._augmentPointerInit(e,t.id,t.screenCoordinates),this._scene.simulatePointerUp(t.pick||new Ii.p,e),t.finalPointerUpTriggered=!0}))}this._xrSessionManager.scene.onBeforeRenderObservable.addOnce((()=>{try{if(t.selectionMesh.dispose(),t.laserPointer.dispose(),delete this._controllers[e],this._attachedController===e){const e=Object.keys(this._controllers);e.length?this._attachedController=e[0]:this._attachedController=""}}catch(e){V.w1.Warn("controller already detached.")}}))}}_generateNewMeshPair(e){const t=this._options.useUtilityLayer?this._options.customUtilityLayerScene||Qi.x.DefaultUtilityLayer.utilityLayerScene:this._scene,i=this._options.customLasterPointerMeshGenerator?this._options.customLasterPointerMeshGenerator():di("laserPointer",{height:1,diameterTop:2e-4,diameterBottom:.004,tessellation:20,subdivisions:1},t);i.parent=e;const n=new Yt.K("laserPointerMat",t);n.emissiveColor=this.laserPointerDefaultColor,n.alpha=.7,i.material=n,i.rotation.x=Math.PI/2,this._updatePointerDistance(i,1),i.isPickable=!1,i.isVisible=!1;const r=this._options.customSelectionMeshGenerator?this._options.customSelectionMeshGenerator():pi("gazeTracker",{diameter:.0105,thickness:.0075,tessellation:20},t);r.bakeCurrentTransformIntoVertices(),r.isPickable=!1,r.isVisible=!1;const s=new Yt.K("targetMat",t);return s.specularColor=a.Wo.Black(),s.emissiveColor=this.selectionMeshDefaultColor,s.backFaceCulling=!1,r.material=s,void 0!==this._options.renderingGroupId&&(i.renderingGroupId=this._options.renderingGroupId,r.renderingGroupId=this._options.renderingGroupId),{laserPointer:i,selectionMesh:r}}_pickingMoved(e,t){var i;if(!e.hit||!t.hit)return!0;if(!(e.pickedMesh&&e.pickedPoint&&t.pickedMesh&&t.pickedPoint))return!0;if(e.pickedMesh!==t.pickedMesh)return!0;null===(i=e.pickedPoint)||void 0===i||i.subtractToRef(t.pickedPoint,this._tmpVectorForPickCompare),this._tmpVectorForPickCompare.set(Math.abs(this._tmpVectorForPickCompare.x),Math.abs(this._tmpVectorForPickCompare.y),Math.abs(this._tmpVectorForPickCompare.z));const n=.01*(this._options.gazeModePointerMovedFactor||1)*t.distance;return this._tmpVectorForPickCompare.length()>n}_updatePointerDistance(e,t=100){e.scaling.y=t,this._scene.useRightHandedSystem&&(t*=-1),e.position.z=t/2+.05}_augmentPointerInit(e,t,i){e.pointerId=t,e.pointerType="xr",i&&(e.screenX=i.x,e.screenY=i.y)}get lasterPointerDefaultColor(){return this.laserPointerDefaultColor}}Qo._IdCounter=200,Qo.Name=Bo.b.POINTER_SELECTION,Qo.Version=1,Bo.d.AddWebXRFeature(Qo.Name,((e,t)=>()=>new Qo(e,t)),Qo.Version,!0);var qo,Ko,Zo,$o=i("../../../node_modules/@babylonjs/core/Materials/Node/nodeMaterial.js"),Jo=i("../../../node_modules/@babylonjs/core/Meshes/subMesh.js");Jo.P.prototype._projectOnTrianglesToRef=function(e,t,i,n,r,s){const a=o.jp.Vector3[0],l=o.jp.Vector3[1];let c=1/0;for(let s=this.indexStart;s{if(this._controllers[e.uniqueId])return;const{touchCollisionMesh:t,touchCollisionMeshFunction:i,hydrateCollisionMeshFunction:n}=this._generateNewTouchPointMesh(),r=this._generateVisualCue();switch(this._controllers[e.uniqueId]={xrController:e,meshUnderPointer:null,nearInteractionTargetMesh:null,pick:null,stalePick:null,touchCollisionMesh:t,touchCollisionMeshFunction:i,hydrateCollisionMeshFunction:n,currentAnimationState:qo.DEHYDRATED,grabRay:new tt.z(new o.P,new o.P),hoverInteraction:!1,nearInteraction:!1,grabInteraction:!1,id:ea._IdCounter++,pickedPointVisualCue:r},this._attachedController?!this._options.enableNearInteractionOnAllControllers&&this._options.preferredHandedness&&e.inputSource.handedness===this._options.preferredHandedness&&(this._attachedController=e.uniqueId):this._options.enableNearInteractionOnAllControllers||(this._attachedController=e.uniqueId),e.inputSource.targetRayMode){case"tracked-pointer":return this._attachNearInteractionMode(e);case"gaze":case"screen":return null}},this._controllers={},this._farInteractionFeature=null,this.selectionMeshDefaultColor=new a.Wo(.8,.8,.8),this.selectionMeshPickedColor=new a.Wo(.3,.3,1),this._hoverRadius=.1,this._pickRadius=.02,this._controllerPickRadius=.03,this._nearGrabLengthScale=5,this._scene=this._xrSessionManager.scene,void 0===this._options.nearInteractionControllerMode&&(this._options.nearInteractionControllerMode=Ko.CENTERED_IN_FRONT),this._options.farInteractionFeature&&(this._farInteractionFeature=this._options.farInteractionFeature)}attach(){return!!super.attach()&&(this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,(e=>{this._detachController(e.uniqueId)})),this._scene.constantlyUpdateMeshUnderPointer=!0,!0)}detach(){return!!super.detach()&&(Object.keys(this._controllers).forEach((e=>{this._detachController(e)})),!0)}getMeshUnderPointer(e){return this._controllers[e]?this._controllers[e].meshUnderPointer:null}getXRControllerByPointerId(e){const t=Object.keys(this._controllers);for(let i=0;ie.currentAnimationState)switch(e.currentAnimationState){case qo.DEHYDRATED:if(e.hydrateCollisionMeshFunction(!0),t===qo.HOVER)break;case qo.HOVER:if(e.touchCollisionMeshFunction(!0),t===qo.TOUCH)break}else switch(e.currentAnimationState){case qo.TOUCH:if(e.touchCollisionMeshFunction(!1),t===qo.HOVER)break;case qo.HOVER:if(e.hydrateCollisionMeshFunction(!1),t===qo.DEHYDRATED)break}e.currentAnimationState=t}}_processTouchPoint(e,t,i){var n;const r=this._controllers[e];r.grabRay.origin.copyFrom(t),i.toEulerAnglesToRef(o.jp.Vector3[0]),r.grabRay.direction.copyFrom(o.jp.Vector3[0]),this._options.nearInteractionControllerMode!==Ko.CENTERED_IN_FRONT||(null===(n=r.xrController)||void 0===n?void 0:n.inputSource.hand)||(r.xrController.getWorldPointerRayToRef(this._tmpRay),r.grabRay.origin.addInPlace(this._tmpRay.direction.scale(.05))),r.grabRay.length=this._nearGrabLengthScale*this._hoverRadius,r.touchCollisionMesh.position.copyFrom(r.grabRay.origin)}_onXRFrame(e){Object.keys(this._controllers).forEach((t=>{var i;const n=this._controllers[t],r=null===(i=n.xrController)||void 0===i?void 0:i.inputSource.hand;if(!this._options.enableNearInteractionOnAllControllers&&t!==this._attachedController||!n.xrController||!r&&(!this._options.nearInteractionControllerMode||!n.xrController.inputSource.gamepad))return void(n.pick=null);if(n.hoverInteraction=!1,n.nearInteraction=!1,!n.xrController)return;if(r){const i=r.get("index-finger-tip");if(i){const n=e.getJointPose(i,this._xrSessionManager.referenceSpace);if(n&&n.transform){const e=this._scene.useRightHandedSystem?1:-1;o.jp.Vector3[0].set(n.transform.position.x,n.transform.position.y,n.transform.position.z*e),o.jp.Quaternion[0].set(n.transform.orientation.x,n.transform.orientation.y,n.transform.orientation.z*e,n.transform.orientation.w*e),this._processTouchPoint(t,o.jp.Vector3[0],o.jp.Quaternion[0])}}}else if(n.xrController.inputSource.gamepad&&this._options.nearInteractionControllerMode!==Ko.DISABLED){let e=n.xrController.pointer;n.xrController.grip&&this._options.nearInteractionControllerMode===Ko.CENTERED_ON_CONTROLLER&&(e=n.xrController.grip),this._processTouchPoint(t,e.position,e.rotationQuaternion)}const s=(e,t)=>{let i=null;return i=t&&t.hit?e&&e.hit?t.distance{let t=new Ii.p,i=!1;const n=e&&e.pickedPoint&&e.hit;return(null==e?void 0:e.pickedPoint)&&(i=0===e.pickedPoint.x&&0===e.pickedPoint.y&&0===e.pickedPoint.z),n&&!i&&(t=e),t};if(!n.grabInteraction){let e=null,t=null;this._options.useUtilityLayer&&this._utilityLayerScene&&(t=this._pickWithSphere(n,this._hoverRadius,this._utilityLayerScene,(e=>this._nearInteractionPredicate(e))));const i=s(this._pickWithSphere(n,this._hoverRadius,this._scene,(e=>this._nearInteractionPredicate(e))),t);if(i&&i.hit&&(e=a(i),e.hit&&(n.hoverInteraction=!0)),n.hoverInteraction){let t=null;const i=r?this._pickRadius:this._controllerPickRadius;this._options.useUtilityLayer&&this._utilityLayerScene&&(t=this._pickWithSphere(n,i,this._utilityLayerScene,(e=>this._nearPickPredicate(e))));const o=a(s(this._pickWithSphere(n,i,this._scene,(e=>this._nearPickPredicate(e))),t));o.hit&&(e=o,n.nearInteraction=!0)}n.stalePick=n.pick,n.pick=e,n.pick&&n.pick.pickedPoint&&n.pick.hit?(n.meshUnderPointer=n.pick.pickedMesh,n.pickedPointVisualCue.position.copyFrom(n.pick.pickedPoint),n.pickedPointVisualCue.isVisible=!0,this._farInteractionFeature&&this._farInteractionFeature.attached&&this._farInteractionFeature._setPointerSelectionDisabledByPointerId(n.id,!0)):(n.meshUnderPointer=null,n.pickedPointVisualCue.isVisible=!1,this._farInteractionFeature&&this._farInteractionFeature.attached&&this._farInteractionFeature._setPointerSelectionDisabledByPointerId(n.id,!1))}let l=qo.DEHYDRATED;n.grabInteraction||n.nearInteraction?l=qo.TOUCH:n.hoverInteraction&&(l=qo.HOVER),this._handleTransitionAnimation(n,l)}))}get _utilityLayerScene(){return this._options.customUtilityLayerScene||Qi.x.DefaultUtilityLayer.utilityLayerScene}_generateVisualCue(){const e=this._options.useUtilityLayer?this._options.customUtilityLayerScene||Qi.x.DefaultUtilityLayer.utilityLayerScene:this._scene,t=en("nearInteraction",{diameter:.0105},e);t.bakeCurrentTransformIntoVertices(),t.isPickable=!1,t.isVisible=!1,t.rotationQuaternion=o._f.Identity();const i=new Yt.K("targetMat",e);return i.specularColor=a.Wo.Black(),i.emissiveColor=this.selectionMeshDefaultColor,i.backFaceCulling=!1,t.material=i,t}_isControllerReadyForNearInteraction(e){return!this._farInteractionFeature||this._farInteractionFeature._getPointerSelectionDisabledByPointerId(e)}_attachNearInteractionMode(e){const t=this._controllers[e.uniqueId],i={pointerId:t.id,pointerType:"xr-near"};t.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((()=>{(this._options.enableNearInteractionOnAllControllers||e.uniqueId===this._attachedController)&&t.xrController&&(t.xrController.inputSource.hand||this._options.nearInteractionControllerMode&&t.xrController.inputSource.gamepad)&&(t.pick&&(t.pick.ray=t.grabRay),t.pick&&this._isControllerReadyForNearInteraction(t.id)&&this._scene.simulatePointerMove(t.pick,i),t.nearInteraction&&t.pick&&t.pick.hit?t.nearInteractionTargetMesh||(this._scene.simulatePointerDown(t.pick,i),t.nearInteractionTargetMesh=t.meshUnderPointer):t.nearInteractionTargetMesh&&t.stalePick&&(this._scene.simulatePointerUp(t.stalePick,i),t.nearInteractionTargetMesh=null))}));const n=n=>{this._options.enableNearInteractionOnAllControllers||e.uniqueId===this._attachedController&&this._isControllerReadyForNearInteraction(t.id)?(t.pick&&(t.pick.ray=t.grabRay),n&&t.pick&&t.meshUnderPointer&&this._nearGrabPredicate(t.meshUnderPointer)?(t.grabInteraction=!0,t.pickedPointVisualCue.isVisible=!1,this._scene.simulatePointerDown(t.pick,i)):!n&&t.pick&&t.grabInteraction&&(this._scene.simulatePointerUp(t.pick,i),t.grabInteraction=!1,t.pickedPointVisualCue.isVisible=!0)):!n||this._options.enableNearInteractionOnAllControllers||this._options.disableSwitchOnClick||(this._attachedController=e.uniqueId)};if(e.inputSource.gamepad){const i=e=>{t.squeezeComponent=e.getComponent("grasp"),t.squeezeComponent?t.onSqueezeButtonChangedObserver=t.squeezeComponent.onButtonStateChangedObservable.add((e=>{if(e.changes.pressed){const t=e.changes.pressed.current;n(t)}})):(t.selectionComponent=e.getMainComponent(),t.onButtonChangedObserver=t.selectionComponent.onButtonStateChangedObservable.add((e=>{if(e.changes.pressed){const t=e.changes.pressed.current;n(t)}})))};e.motionController?i(e.motionController):e.onMotionControllerInitObservable.add(i)}else{const e=e=>{t.xrController&&e.inputSource===t.xrController.inputSource&&t.pick&&this._isControllerReadyForNearInteraction(t.id)&&t.meshUnderPointer&&this._nearGrabPredicate(t.meshUnderPointer)&&(t.grabInteraction=!0,t.pickedPointVisualCue.isVisible=!1,this._scene.simulatePointerDown(t.pick,i))},n=e=>{t.xrController&&e.inputSource===t.xrController.inputSource&&t.pick&&this._isControllerReadyForNearInteraction(t.id)&&(this._scene.simulatePointerUp(t.pick,i),t.grabInteraction=!1,t.pickedPointVisualCue.isVisible=!0)};t.eventListeners={selectend:n,selectstart:e},this._xrSessionManager.session.addEventListener("selectstart",e),this._xrSessionManager.session.addEventListener("selectend",n)}}_detachController(e){const t=this._controllers[e];if(t&&(t.squeezeComponent&&t.onSqueezeButtonChangedObserver&&t.squeezeComponent.onButtonStateChangedObservable.remove(t.onSqueezeButtonChangedObserver),t.selectionComponent&&t.onButtonChangedObserver&&t.selectionComponent.onButtonStateChangedObservable.remove(t.onButtonChangedObserver),t.onFrameObserver&&this._xrSessionManager.onXRFrameObservable.remove(t.onFrameObserver),t.eventListeners&&Object.keys(t.eventListeners).forEach((e=>{const i=t.eventListeners&&t.eventListeners[e];i&&this._xrSessionManager.session.removeEventListener(e,i)})),t.touchCollisionMesh.dispose(),t.pickedPointVisualCue.dispose(),this._xrSessionManager.runInXRFrame((()=>{const e={pointerId:t.id,pointerType:"xr-near"};this._scene.simulatePointerUp(new Ii.p,e)})),delete this._controllers[e],this._attachedController===e)){const e=Object.keys(this._controllers);e.length?this._attachedController=e[0]:this._attachedController=""}}_generateNewTouchPointMesh(){const e=this._options.useUtilityLayer?this._options.customUtilityLayerScene||Qi.x.DefaultUtilityLayer.utilityLayerScene:this._scene,t=en("PickSphere",{diameter:1},e);t.isVisible=!1,this._options.motionControllerOrbMaterial?t.material=this._options.motionControllerOrbMaterial:$o.O.ParseFromSnippetAsync("8RUNKL#3",e).then((e=>{t.material=e}));const i=new F;i.setEasingMode(O.EASINGMODE_EASEINOUT);const n=new o.P(this._controllerPickRadius,this._controllerPickRadius,this._controllerPickRadius),r=this._controllerPickRadius*(4/3),s=new o.P(r,r,r),a=this._controllerPickRadius*(7/6),l=new o.P(a,a,a),c=.8*this._controllerPickRadius,h=new o.P(c,c,c),_=1.5*this._controllerPickRadius,d=[{frame:0,value:n},{frame:10,value:new o.P(_,_,_)},{frame:18,value:s}],u=[{frame:0,value:s},{frame:10,value:h},{frame:18,value:n}],p=[{frame:0,value:o.P.ZeroReadOnly},{frame:12,value:l},{frame:15,value:n}],f=[{frame:0,value:n},{frame:10,value:o.P.ZeroReadOnly},{frame:15,value:o.P.ZeroReadOnly}],m=new y.f("touch","scaling",60,y.f.ANIMATIONTYPE_VECTOR3,y.f.ANIMATIONLOOPMODE_CONSTANT),g=new y.f("release","scaling",60,y.f.ANIMATIONTYPE_VECTOR3,y.f.ANIMATIONLOOPMODE_CONSTANT),b=new y.f("hydrate","scaling",60,y.f.ANIMATIONTYPE_VECTOR3,y.f.ANIMATIONLOOPMODE_CONSTANT),v=new y.f("dehydrate","scaling",60,y.f.ANIMATIONTYPE_VECTOR3,y.f.ANIMATIONLOOPMODE_CONSTANT);return m.setEasingFunction(i),g.setEasingFunction(i),b.setEasingFunction(i),v.setEasingFunction(i),m.setKeys(d),g.setKeys(u),b.setKeys(p),v.setKeys(f),{touchCollisionMesh:t,touchCollisionMeshFunction:i=>{const n=i?m:g;e.beginDirectAnimation(t,[n],0,18,!1,1)},hydrateCollisionMeshFunction:i=>{const n=i?b:v;i&&(t.isVisible=!0),e.beginDirectAnimation(t,[n],0,15,!1,1,(()=>{i||(t.isVisible=!1)}))}}}_pickWithSphere(e,t,i,n){const r=new Ii.p;if(r.distance=1/0,e.touchCollisionMesh&&e.xrController){const s=e.touchCollisionMesh.position,o=Ui.K.CreateFromCenterAndRadius(s,t);for(let t=0;th&&(c=0,l.copyFrom(t.center)),-1!==c&&c()=>new ea(e,t)),ea.Version,!0);class ta{constructor(e,t,i){this.element=e,this.sessionMode=t,this.referenceSpaceType=i}update(e){}}class ia{constructor(e,t){if(this._scene=e,this.options=t,this._activeButton=null,this._buttons=[],this.activeButtonChangedObservable=new s.y$,this._onSessionGranted=e=>{this._helper&&this._enterXRWithButtonIndex(0)},this.overlay=document.createElement("div"),this.overlay.classList.add("xr-button-overlay"),!t.ignoreSessionGrantedEvent&&navigator.xr&&navigator.xr.addEventListener("sessiongranted",this._onSessionGranted),"undefined"!=typeof window&&window.location&&"http:"===window.location.protocol&&"localhost"!==window.location.hostname)throw V.w1.Warn("WebXR can only be served over HTTPS"),new Error("WebXR can only be served over HTTPS");if(t.customButtons)this._buttons=t.customButtons;else{this.overlay.style.cssText="z-index:11;position: absolute; right: 20px;bottom: 50px;";const e=t.sessionMode||"immersive-vr",i=t.referenceSpaceType||"local-floor";let n=".babylonVRicon { color: #868686; border-color: #868686; border-style: solid; margin-left: 10px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url("+("undefined"==typeof SVGSVGElement?"https://cdn.babylonjs.com/Assets/vrButton.png":"data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A")+"); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }";n+='.babylonVRicon.vrdisplaypresenting { background-image: none;} .vrdisplaypresenting::after { content: "EXIT"} .xr-error::after { content: "ERROR"}';const r=document.createElement("style");r.appendChild(document.createTextNode(n)),document.getElementsByTagName("head")[0].appendChild(r);const s=document.createElement("button");s.className="babylonVRicon",s.title=`${e} - ${i}`,this._buttons.push(new ta(s,e,i)),this._buttons[this._buttons.length-1].update=function(e){this.element.style.display=null===e||e===this?"":"none",s.className="babylonVRicon"+(e===this?" vrdisplaypresenting":"")},this._updateButtons(null)}const i=e.getEngine().getInputElement();i&&i.parentNode&&(i.parentNode.appendChild(this.overlay),e.onDisposeObservable.addOnce((()=>{this.dispose()})))}async setHelperAsync(e,t){this._helper=e,this._renderTarget=t;const i=this._buttons.map((t=>e.sessionManager.isSessionSupportedAsync(t.sessionMode)));e.onStateChangedObservable.add((e=>{e==Zt.NOT_IN_XR&&this._updateButtons(null)})),(await Promise.all(i)).forEach(((e,t)=>{e?(this.overlay.appendChild(this._buttons[t].element),this._buttons[t].element.onclick=this._enterXRWithButtonIndex.bind(this,t)):V.w1.Warn(`Session mode "${this._buttons[t].sessionMode}" not supported in browser`)}))}static async CreateAsync(e,t,i){const n=new ia(e,i);return await n.setHelperAsync(t,i.renderTarget||void 0),n}async _enterXRWithButtonIndex(e=0){if(this._helper.state==Zt.IN_XR)await this._helper.exitXRAsync(),this._updateButtons(null);else if(this._helper.state==Zt.NOT_IN_XR)try{await this._helper.enterXRAsync(this._buttons[e].sessionMode,this._buttons[e].referenceSpaceType,this._renderTarget,{optionalFeatures:this.options.optionalFeatures,requiredFeatures:this.options.requiredFeatures}),this._updateButtons(this._buttons[e])}catch(t){this._updateButtons(null);const i=this._buttons[e].element,n=i.title;i.title="Error entering XR session : "+n,i.classList.add("xr-error"),this.options.onError&&this.options.onError(t)}}dispose(){const e=this._scene.getEngine().getInputElement();e&&e.parentNode&&e.parentNode.contains(this.overlay)&&e.parentNode.removeChild(this.overlay),this.activeButtonChangedObservable.clear(),navigator.xr.removeEventListener("sessiongranted",this._onSessionGranted)}_updateButtons(e){this._activeButton=e,this._buttons.forEach((e=>{e.update(this._activeButton)})),this.activeButtonChangedObservable.notifyObservers(this._activeButton)}}function na(e){var t;let i=0;const n=Date.now();e.observableParameters=null!==(t=e.observableParameters)&&void 0!==t?t:{};const r=e.contextObservable.add((t=>{const s=Date.now();i=s-n;const o={startTime:n,currentTime:s,deltaTime:i,completeRate:i/e.timeout,payload:t};e.onTick&&e.onTick(o),e.breakCondition&&e.breakCondition()&&(e.contextObservable.remove(r),e.onAborted&&e.onAborted(o)),i>=e.timeout&&(e.contextObservable.remove(r),e.onEnded&&e.onEnded(o))}),e.observableParameters.mask,e.observableParameters.insertFirst,e.observableParameters.scope);return r}!function(e){e[e.INIT=0]="INIT",e[e.STARTED=1]="STARTED",e[e.ENDED=2]="ENDED"}(Zo||(Zo={}));class ra extends Yo.F{constructor(e,t){super(e),this._options=t,this._controllers={},this._snappedToPoint=!1,this._tmpRay=new tt.z(new o.P,new o.P),this._tmpVector=new o.P,this._tmpQuaternion=new o._f,this.skipNextTeleportation=!1,this.backwardsMovementEnabled=!0,this.backwardsTeleportationDistance=.7,this.parabolicCheckRadius=5,this.parabolicRayEnabled=!0,this.straightRayEnabled=!0,this.rotationAngle=Math.PI/8,this.onTargetMeshPositionUpdatedObservable=new s.y$,this.teleportationEnabled=!0,this._rotationEnabled=!0,this._attachController=e=>{if(this._controllers[e.uniqueId]||this._options.forceHandedness&&e.inputSource.handedness!==this._options.forceHandedness)return;this._controllers[e.uniqueId]={xrController:e,teleportationState:{forward:!1,backwards:!1,rotating:!1,currentRotation:0,baseRotation:0}};const t=this._controllers[e.uniqueId];if("tracked-pointer"===t.xrController.inputSource.targetRayMode&&t.xrController.inputSource.gamepad){const i=()=>{if(e.motionController){const i=e.motionController.getComponentOfType(Lo.THUMBSTICK_TYPE)||e.motionController.getComponentOfType(Lo.TOUCHPAD_TYPE);if(!i||this._options.useMainComponentOnly){const i=e.motionController.getMainComponent();if(!i)return;t.teleportationComponent=i,t.onButtonChangedObserver=i.onButtonStateChangedObservable.add((()=>{this.teleportationEnabled&&i.changes.pressed&&(i.changes.pressed.current?(t.teleportationState.forward=!0,this._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y,t.teleportationState.currentRotation=0,na({timeout:this._options.timeToTeleport||3e3,contextObservable:this._xrSessionManager.onXRFrameObservable,breakCondition:()=>!i.pressed,onEnded:()=>{this._currentTeleportationControllerId===t.xrController.uniqueId&&t.teleportationState.forward&&this._teleportForward(e.uniqueId)}})):(t.teleportationState.forward=!1,this._currentTeleportationControllerId=""))}))}else t.teleportationComponent=i,t.onAxisChangedObserver=i.onAxisValueChangedObservable.add((i=>{if(i.y<=.7&&t.teleportationState.backwards&&(t.teleportationState.backwards=!1),i.y>.7&&!t.teleportationState.forward&&this.backwardsMovementEnabled&&!this.snapPointsOnly&&!t.teleportationState.backwards){t.teleportationState.backwards=!0,this._tmpQuaternion.copyFrom(this._options.xrInput.xrCamera.rotationQuaternion),this._tmpQuaternion.toEulerAnglesToRef(this._tmpVector),this._tmpVector.x=0,this._tmpVector.z=0,o._f.FromEulerVectorToRef(this._tmpVector,this._tmpQuaternion),this._tmpVector.set(0,0,this.backwardsTeleportationDistance*(this._xrSessionManager.scene.useRightHandedSystem?1:-1)),this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion,this._tmpVector),this._tmpVector.addInPlace(this._options.xrInput.xrCamera.position),this._tmpRay.origin.copyFrom(this._tmpVector),this._tmpRay.length=this._options.xrInput.xrCamera.realWorldHeight+.1,this._tmpRay.direction.set(0,-1,0);const e=this._xrSessionManager.scene.pickWithRay(this._tmpRay,(e=>-1!==this._floorMeshes.indexOf(e)));e&&e.pickedPoint&&(this._options.xrInput.xrCamera.position.x=e.pickedPoint.x,this._options.xrInput.xrCamera.position.z=e.pickedPoint.z)}if(i.y<-.7&&!this._currentTeleportationControllerId&&!t.teleportationState.rotating&&this.teleportationEnabled&&(t.teleportationState.forward=!0,this._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y),i.x){if(t.teleportationState.forward)this._currentTeleportationControllerId===t.xrController.uniqueId&&(this.rotationEnabled?setTimeout((()=>{t.teleportationState.currentRotation=Math.atan2(i.x,i.y*(this._xrSessionManager.scene.useRightHandedSystem?1:-1))})):t.teleportationState.currentRotation=0);else if(!t.teleportationState.rotating&&Math.abs(i.x)>.7){t.teleportationState.rotating=!0;const e=this.rotationAngle*(i.x>0?1:-1)*(this._xrSessionManager.scene.useRightHandedSystem?-1:1);o._f.FromEulerAngles(0,e,0).multiplyToRef(this._options.xrInput.xrCamera.rotationQuaternion,this._options.xrInput.xrCamera.rotationQuaternion)}}else t.teleportationState.rotating=!1;0===i.x&&0===i.y&&t.teleportationState.forward&&this._teleportForward(e.uniqueId)}))}};e.motionController?i():e.onMotionControllerInitObservable.addOnce((()=>{i()}))}else this._xrSessionManager.scene.onPointerObservable.add((i=>{i.type===Z.kD.POINTERDOWN?(t.teleportationState.forward=!0,this._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y,t.teleportationState.currentRotation=0,na({timeout:this._options.timeToTeleport||3e3,contextObservable:this._xrSessionManager.onXRFrameObservable,onEnded:()=>{this._currentTeleportationControllerId===t.xrController.uniqueId&&t.teleportationState.forward&&this._teleportForward(e.uniqueId)}})):i.type===Z.kD.POINTERUP&&(t.teleportationState.forward=!1,this._currentTeleportationControllerId="")}))},this._options.teleportationTargetMesh||this._createDefaultTargetMesh(),this._floorMeshes=this._options.floorMeshes||[],this._snapToPositions=this._options.snapPositions||[],this._setTargetMeshVisibility(!1)}get rotationEnabled(){return this._rotationEnabled}set rotationEnabled(e){if(this._rotationEnabled=e,this._options.teleportationTargetMesh){const t=this._options.teleportationTargetMesh.getChildMeshes(!1,(e=>"rotationCone"===e.name));t[0]&&t[0].setEnabled(e)}}get teleportationTargetMesh(){return this._options.teleportationTargetMesh||null}get snapPointsOnly(){return!!this._options.snapPointsOnly}set snapPointsOnly(e){this._options.snapPointsOnly=e}addFloorMesh(e){this._floorMeshes.push(e)}addBlockerMesh(e){this._options.pickBlockerMeshes=this._options.pickBlockerMeshes||[],this._options.pickBlockerMeshes.push(e)}addSnapPoint(e){this._snapToPositions.push(e)}attach(){return!!super.attach()&&(this._currentTeleportationControllerId="",this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,(e=>{this._detachController(e.uniqueId)})),!0)}detach(){return!!super.detach()&&(Object.keys(this._controllers).forEach((e=>{this._detachController(e)})),this._setTargetMeshVisibility(!1),this._currentTeleportationControllerId="",this._controllers={},!0)}dispose(){super.dispose(),this._options.teleportationTargetMesh&&this._options.teleportationTargetMesh.dispose(!1,!0)}removeFloorMesh(e){const t=this._floorMeshes.indexOf(e);-1!==t&&this._floorMeshes.splice(t,1)}removeBlockerMesh(e){this._options.pickBlockerMeshes=this._options.pickBlockerMeshes||[];const t=this._options.pickBlockerMeshes.indexOf(e);-1!==t&&this._options.pickBlockerMeshes.splice(t,1)}removeFloorMeshByName(e){const t=this._xrSessionManager.scene.getMeshByName(e);t&&this.removeFloorMesh(t)}removeSnapPoint(e){let t=this._snapToPositions.indexOf(e);if(-1===t)for(let i=0;i{if(this._options.pickBlockerMeshes&&-1!==this._options.pickBlockerMeshes.indexOf(e))return!0;const t=this._floorMeshes.indexOf(e);return-1!==t&&this._floorMeshes[t].absolutePosition.y!(!this._options.pickBlockerMeshes||-1===this._options.pickBlockerMeshes.indexOf(e))||-1!==this._floorMeshes.indexOf(e)));if(o&&o.pickedMesh&&this._options.pickBlockerMeshes&&-1!==this._options.pickBlockerMeshes.indexOf(o.pickedMesh))return;o&&o.pickedPoint&&(t=!0,this._setTargetMeshPosition(o),this._setTargetMeshVisibility(!0),this._showParabolicPath(o))}this._setTargetMeshVisibility(t)}else this._setTargetMeshVisibility(!1)}else this._setTargetMeshVisibility(!1)}_createDefaultTargetMesh(){this._options.defaultTargetMeshOptions=this._options.defaultTargetMeshOptions||{};const e=this._options.useUtilityLayer?this._options.customUtilityLayerScene||Qi.x.DefaultUtilityLayer.utilityLayerScene:this._xrSessionManager.scene,t=yi("teleportationTarget",{width:2,height:2,subdivisions:2},e);if(t.isPickable=!1,this._options.defaultTargetMeshOptions.teleportationCircleMaterial)t.material=this._options.defaultTargetMeshOptions.teleportationCircleMaterial;else{const i=512,n=new Qt.c("teleportationPlaneDynamicTexture",i,e,!0);n.hasAlpha=!0;const r=n.getContext(),s=i/2,o=i/2,a=200;r.beginPath(),r.arc(s,o,a,0,2*Math.PI,!1),r.fillStyle=this._options.defaultTargetMeshOptions.teleportationFillColor||"#444444",r.fill(),r.lineWidth=10,r.strokeStyle=this._options.defaultTargetMeshOptions.teleportationBorderColor||"#FFFFFF",r.stroke(),r.closePath(),n.update();const l=new Yt.K("teleportationPlaneMaterial",e);l.diffuseTexture=n,t.material=l}const i=pi("torusTeleportation",{diameter:.75,thickness:.1,tessellation:20},e);if(i.isPickable=!1,i.parent=t,!this._options.defaultTargetMeshOptions.disableAnimation){const t=new y.f("animationInnerCircle","position.y",30,y.f.ANIMATIONTYPE_FLOAT,y.f.ANIMATIONLOOPMODE_CYCLE),n=[];n.push({frame:0,value:0}),n.push({frame:30,value:.4}),n.push({frame:60,value:0}),t.setKeys(n);const r=new B;r.setEasingMode(O.EASINGMODE_EASEINOUT),t.setEasingFunction(r),i.animations=[],i.animations.push(t),e.beginAnimation(i,0,60,!0)}const n=di("rotationCone",{diameterTop:0,tessellation:4},e);if(n.isPickable=!1,n.scaling.set(.5,.12,.2),n.rotate(ne.RD.X,Math.PI/2),n.position.z=.6,n.parent=i,this._options.defaultTargetMeshOptions.torusArrowMaterial)i.material=this._options.defaultTargetMeshOptions.torusArrowMaterial,n.material=this._options.defaultTargetMeshOptions.torusArrowMaterial;else{const t=new Yt.K("torusConsMat",e);t.disableLighting=!!this._options.defaultTargetMeshOptions.disableLighting,t.disableLighting?t.emissiveColor=new a.Wo(.3,.3,1):t.diffuseColor=new a.Wo(.3,.3,1),t.alpha=.9,i.material=t,n.material=t,this._teleportationRingMaterial=t}void 0!==this._options.renderingGroupId&&(t.renderingGroupId=this._options.renderingGroupId,i.renderingGroupId=this._options.renderingGroupId,n.renderingGroupId=this._options.renderingGroupId),this._options.teleportationTargetMesh=t}_detachController(e){const t=this._controllers[e];t&&(t.teleportationComponent&&(t.onAxisChangedObserver&&t.teleportationComponent.onAxisValueChangedObservable.remove(t.onAxisChangedObserver),t.onButtonChangedObserver&&t.teleportationComponent.onButtonStateChangedObservable.remove(t.onButtonChangedObserver)),delete this._controllers[e])}_findClosestSnapPointWithRadius(e,t=this._options.snapToPositionRadius||.8){let i=null,n=Number.MAX_VALUE;if(this._snapToPositions.length){const r=t*t;this._snapToPositions.forEach((t=>{const s=o.P.DistanceSquared(t,e);s<=r&&s{t.isVisible=e})),e?this._selectionFeature&&this._selectionFeature.detach():(this._quadraticBezierCurve&&(this._quadraticBezierCurve.dispose(),this._quadraticBezierCurve=null),this._selectionFeature&&this._selectionFeature.attach()))}_showParabolicPath(e){if(!e.pickedPoint)return;const t=this._options.useUtilityLayer?this._options.customUtilityLayerScene||Qi.x.DefaultUtilityLayer.utilityLayerScene:this._xrSessionManager.scene,i=this._controllers[this._currentTeleportationControllerId],n=D.j_.CreateQuadraticBezier(i.xrController.pointer.absolutePosition,e.ray.origin,e.pickedPoint,25);this._options.generateRayPathMesh?this._quadraticBezierCurve=this._options.generateRayPathMesh(n.getPoints(),e):this._quadraticBezierCurve=un("teleportation path line",{points:n.getPoints(),instance:this._quadraticBezierCurve,updatable:!0},t),this._quadraticBezierCurve.isPickable=!1,void 0!==this._options.renderingGroupId&&(this._quadraticBezierCurve.renderingGroupId=this._options.renderingGroupId)}_teleportForward(e){const t=this._controllers[e];if(t&&t.teleportationState.forward&&this.teleportationEnabled&&(t.teleportationState.forward=!1,this._currentTeleportationControllerId="",!this.snapPointsOnly||this._snappedToPoint))if(this.skipNextTeleportation)this.skipNextTeleportation=!1;else if(this._options.teleportationTargetMesh&&this._options.teleportationTargetMesh.isVisible){const e=this._options.xrInput.xrCamera.realWorldHeight;this._options.xrInput.xrCamera.onBeforeCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position),this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position),this._options.xrInput.xrCamera.position.y+=e,o._f.FromEulerAngles(0,t.teleportationState.currentRotation-(this._xrSessionManager.scene.useRightHandedSystem?Math.PI:0),0).multiplyToRef(this._options.xrInput.xrCamera.rotationQuaternion,this._options.xrInput.xrCamera.rotationQuaternion),this._options.xrInput.xrCamera.onAfterCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position)}}}ra.Name=Bo.b.TELEPORTATION,ra.Version=1,Bo.d.AddWebXRFeature(ra.Name,((e,t)=>()=>new ra(e,t)),ra.Version,!0);class sa{constructor(){}static CreateAsync(e,t={}){const i=new sa;if(e.onDisposeObservable.addOnce((()=>{i.dispose()})),!t.disableDefaultUI){const n={renderTarget:i.renderTarget,...t.uiOptions||{}};t.optionalFeatures&&("boolean"==typeof t.optionalFeatures?n.optionalFeatures=["hit-test","anchors","plane-detection","hand-tracking"]:n.optionalFeatures=t.optionalFeatures),i.enterExitUI=new ia(e,n)}return No.CreateAsync(e).then((e=>{if(i.baseExperience=e,t.ignoreNativeCameraTransformation&&(i.baseExperience.camera.compensateOnFirstFrame=!1),i.input=new Xo(e.sessionManager,e.camera,{controllerOptions:{renderingGroupId:t.renderingGroupId},...t.inputOptions||{}}),!t.disablePointerSelection){const e={...t.pointerSelectionOptions,xrInput:i.input,renderingGroupId:t.renderingGroupId};i.pointerSelection=i.baseExperience.featuresManager.enableFeature(Qo.Name,t.useStablePlugins?"stable":"latest",e),t.disableTeleportation||(i.teleportation=i.baseExperience.featuresManager.enableFeature(ra.Name,t.useStablePlugins?"stable":"latest",{floorMeshes:t.floorMeshes,xrInput:i.input,renderingGroupId:t.renderingGroupId,...t.teleportationOptions}),i.teleportation.setSelectionFeature(i.pointerSelection))}return t.disableNearInteraction||(i.nearInteraction=i.baseExperience.featuresManager.enableFeature(ea.Name,t.useStablePlugins?"stable":"latest",{xrInput:i.input,farInteractionFeature:i.pointerSelection,renderingGroupId:t.renderingGroupId,useUtilityLayer:!0,enableNearInteractionOnAllControllers:!0,...t.nearInteractionOptions})),i.renderTarget=i.baseExperience.sessionManager.getWebXRRenderTarget(t.outputCanvasOptions),t.disableDefaultUI?void 0:i.enterExitUI.setHelperAsync(i.baseExperience,i.renderTarget)})).then((()=>i)).catch((e=>(u.Y.Error("Error initializing XR"),u.Y.Error(e),i)))}dispose(){this.baseExperience&&this.baseExperience.dispose(),this.input&&this.input.dispose(),this.enterExitUI&&this.enterExitUI.dispose(),this.renderTarget&&this.renderTarget.dispose()}}function oa(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.srcObject=null,e.src="",e.removeAttribute("src")}R.x.prototype.createDefaultLight=function(e=!1){if(e&&this.lights)for(let e=0;ee.isVisible&&e.isEnabled())),n=t.max.subtract(t.min),r=t.min.add(n.scale(.5));let s,a=1.5*n.length();if(isFinite(a)||(a=1,r.copyFromFloats(0,0,0)),e){const e=new We("default camera",-Math.PI/2,Math.PI/2,a,r,this);e.lowerRadiusLimit=.01*a,e.wheelPrecision=100/a,s=e}else{const e=new Ve.c("default camera",new o.P(r.x,r.y,-a),this);e.setTarget(r),s=e}s.minZ=.01*a,s.maxZ=1e3*a,s.speed=.2*a,this.activeCamera=s,i&&s.attachControl()}},R.x.prototype.createDefaultCameraOrLight=function(e=!1,t=!1,i=!1){this.createDefaultLight(t),this.createDefaultCamera(e,t,i)},R.x.prototype.createDefaultSkybox=function(e,t=!1,i=1e3,n=0,r=!0){if(!e)return u.Y.Warn("Can not create default skybox without environment texture."),null;r&&e&&(this.environmentTexture=e);const s=(0,$i.NR)("hdrSkyBox",{size:i},this);if(t){const t=new yo.Y("skyBox",this);t.backFaceCulling=!1,t.reflectionTexture=e.clone(),t.reflectionTexture&&(t.reflectionTexture.coordinatesMode=K.x.SKYBOX_MODE),t.microSurface=1-n,t.disableLighting=!0,t.twoSidedLighting=!0,s.material=t}else{const t=new Yt.K("skyBox",this);t.backFaceCulling=!1,t.reflectionTexture=e.clone(),t.reflectionTexture&&(t.reflectionTexture.coordinatesMode=K.x.SKYBOX_MODE),t.disableLighting=!0,s.material=t}return s.isPickable=!1,s.infiniteDistance=!0,s.ignoreCameraMaxZ=!0,s},R.x.prototype.createDefaultEnvironment=function(e){return mo?new mo(e,this):null},R.x.prototype.createDefaultVRExperience=function(e={}){return new Ti(this,e)},R.x.prototype.createDefaultXRExperienceAsync=function(e={}){return sa.CreateAsync(this,e).then((e=>e))};class aa extends K.x{constructor(e,t,i,n=!1,r=!1,s=K.x.TRILINEAR_SAMPLINGMODE,o={},a){super(null,i,!n,r),this._onUserActionRequestedObservable=null,this._stillImageCaptured=!1,this._displayingPosterTexture=!1,this._frameId=-1,this._currentSrc=null,this._errorFound=!1,this._createInternalTexture=()=>{if(null!=this._texture){if(!this._displayingPosterTexture)return;this._texture.dispose(),this._displayingPosterTexture=!1}if(!this._getEngine().needPOTTextures||V.w1.IsExponentOfTwo(this.video.videoWidth)&&V.w1.IsExponentOfTwo(this.video.videoHeight)?(this.wrapU=K.x.WRAP_ADDRESSMODE,this.wrapV=K.x.WRAP_ADDRESSMODE):(this.wrapU=K.x.CLAMP_ADDRESSMODE,this.wrapV=K.x.CLAMP_ADDRESSMODE,this._generateMipMaps=!1),this._texture=this._getEngine().createDynamicTexture(this.video.videoWidth,this.video.videoHeight,this._generateMipMaps,this.samplingMode),this.video.autoplay||this._settings.poster)this._updateInternalTexture(),this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this);else{const e=this.video.onplaying,t=this.video.muted;this.video.muted=!0,this.video.onplaying=()=>{this.video.muted=t,this.video.onplaying=e,this._updateInternalTexture(),this._errorFound||this.video.pause(),this.onLoadObservable.hasObservers()&&this.onLoadObservable.notifyObservers(this)},this._handlePlay()}},this._reset=()=>{null!=this._texture&&(this._displayingPosterTexture||(this._texture.dispose(),this._texture=null))},this._updateInternalTexture=()=>{if(null==this._texture)return;if(this.video.readyState=this.video.HAVE_CURRENT_DATA;!this._settings.poster||this._settings.autoPlay&&l?l&&this._createInternalTexture():(this._texture=this._getEngine().createTexture(this._settings.poster,!1,!this.invertY,i),this._displayingPosterTexture=!0)}get onUserActionRequestedObservable(){return this._onUserActionRequestedObservable||(this._onUserActionRequestedObservable=new s.y$),this._onUserActionRequestedObservable}_processError(e){this._errorFound=!0,this._onError?this._onError(null==e?void 0:e.message):u.Y.Error(null==e?void 0:e.message)}_handlePlay(){this._errorFound=!1,this.video.play().catch((e=>{if("NotAllowedError"===(null==e?void 0:e.name)){if(this._onUserActionRequestedObservable&&this._onUserActionRequestedObservable.hasObservers())return void this._onUserActionRequestedObservable.notifyObservers(this);if(!this.video.muted)return u.Y.Warn("Unable to autoplay a video with sound. Trying again with muted turned true"),this.video.muted=!0,this._errorFound=!1,void this.video.play().catch((e=>{this._processError(e)}))}this._processError(e)}))}getClassName(){return"VideoTexture"}_getName(e){return e instanceof HTMLVideoElement?e.currentSrc:"object"==typeof e?e.toString():e}_getVideo(e){if(e.isNative)return e;if(e instanceof HTMLVideoElement)return V.w1.SetCorsBehavior(e.currentSrc,e),e;const t=document.createElement("video");return"string"==typeof e?(V.w1.SetCorsBehavior(e,t),t.src=e):(V.w1.SetCorsBehavior(e[0],t),e.forEach((e=>{const i=document.createElement("source");i.src=e,t.appendChild(i)}))),this.onDisposeObservable.addOnce((()=>{oa(t)})),t}_rebuild(){this.update()}update(){this.autoUpdateTexture&&this.updateTexture(!0)}updateTexture(e){e&&(this.video.paused&&this._stillImageCaptured||(this._stillImageCaptured=!0,this._updateInternalTexture()))}updateURL(e){this.video.src=e,this._currentSrc=e}clone(){return new aa(this.name,this._currentSrc,this.getScene(),this._generateMipMaps,this.invertY,this.samplingMode,this._settings)}dispose(){super.dispose(),this._currentSrc=null,this._onUserActionRequestedObservable&&(this._onUserActionRequestedObservable.clear(),this._onUserActionRequestedObservable=null),this.video.removeEventListener(this._createInternalTextureOnEvent,this._createInternalTexture),this.video.removeEventListener("paused",this._updateInternalTexture),this.video.removeEventListener("seeked",this._updateInternalTexture),this.video.removeEventListener("emptied",this._reset),this.video.pause()}static CreateFromStreamAsync(e,t,i,n=!0){const r=e.getEngine().createVideoElement(i);return e.getEngine()._badOS&&(document.body.appendChild(r),r.style.transform="scale(0.0001, 0.0001)",r.style.opacity="0",r.style.position="fixed",r.style.bottom="0px",r.style.right="0px"),r.setAttribute("autoplay",""),r.setAttribute("muted","true"),r.setAttribute("playsinline",""),r.muted=!0,r.isNative||(void 0!==r.mozSrcObject?r.mozSrcObject=t:"object"==typeof r.srcObject?r.srcObject=t:r.src=window.URL&&window.URL.createObjectURL(t)),new Promise((t=>{const i=()=>{const s=new aa("video",r,e,!0,n);e.getEngine()._badOS&&s.onDisposeObservable.addOnce((()=>{r.remove()})),s.onDisposeObservable.addOnce((()=>{oa(r)})),t(s),r.removeEventListener("playing",i)};r.addEventListener("playing",i),r.play()}))}static CreateFromWebCamAsync(e,t,i=!1,n=!0){let r;if(t&&t.deviceId&&(r={exact:t.deviceId}),navigator.mediaDevices)return navigator.mediaDevices.getUserMedia({video:t,audio:i}).then((i=>this.CreateFromStreamAsync(e,i,t,n)));{const s=navigator.getUserMedia||navigator.mozGetUserMedia;s&&s({video:{deviceId:r,width:{min:t&&t.minWidth||256,max:t&&t.maxWidth||640},height:{min:t&&t.minHeight||256,max:t&&t.maxHeight||480}},audio:i},(i=>this.CreateFromStreamAsync(e,i,t,n)),(function(e){u.Y.Error(e.name)}))}return Promise.reject("No support for userMedia on this device")}static CreateFromWebCam(e,t,i,n=!1,r=!0){this.CreateFromWebCamAsync(e,i,n,r).then((function(e){t&&t(e)})).catch((function(e){u.Y.Error(e.name)}))}}class la extends go{get videoTexture(){return this._texture}get videoMode(){return this.textureMode}set videoMode(e){this.textureMode=e}_initTexture(e,t,i){const n={loop:i.loop,autoPlay:i.autoPlay,autoUpdateTexture:!0,poster:i.poster},r=new aa((this.name||"videoDome")+"_texture",e,t,i.generateMipMaps,this._useDirectMapping,K.x.TRILINEAR_SAMPLINGMODE,n);return i.clickToPlay&&(this._pointerObserver=t.onPointerObservable.add((e=>{var t;(null===(t=e.pickInfo)||void 0===t?void 0:t.pickedMesh)===this.mesh&&this._texture.video.play()}),Z.kD.POINTERDOWN)),this._textureObserver=r.onLoadObservable.add((()=>{this.onLoadObservable.notifyObservers()})),r}dispose(e,t=!1){this._texture.onLoadObservable.remove(this._textureObserver),this._scene.onPointerObservable.remove(this._pointerObserver),super.dispose(e,t)}}la.MODE_MONOSCOPIC=go.MODE_MONOSCOPIC,la.MODE_TOPBOTTOM=go.MODE_TOPBOTTOM,la.MODE_SIDEBYSIDE=go.MODE_SIDEBYSIDE;class ca{constructor(e){this.engine=e,this._captureGPUFrameTime=!1,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new Pn.z,this._onBeginFrameObserver=null,this._onEndFrameObserver=null,this._onBeforeShaderCompilationObserver=null,this._onAfterShaderCompilationObserver=null}get gpuFrameTimeCounter(){return this.engine.getGPUFrameTimeCounter()}get captureGPUFrameTime(){return this._captureGPUFrameTime}set captureGPUFrameTime(e){e!==this._captureGPUFrameTime&&(this._captureGPUFrameTime=e,this.engine.captureGPUFrameTime(e))}get shaderCompilationTimeCounter(){return this._shaderCompilationTime}get captureShaderCompilationTime(){return this._captureShaderCompilationTime}set captureShaderCompilationTime(e){e!==this._captureShaderCompilationTime&&(this._captureShaderCompilationTime=e,e?(this._onBeforeShaderCompilationObserver=this.engine.onBeforeShaderCompilationObservable.add((()=>{this._shaderCompilationTime.fetchNewFrame(),this._shaderCompilationTime.beginMonitoring()})),this._onAfterShaderCompilationObserver=this.engine.onAfterShaderCompilationObservable.add((()=>{this._shaderCompilationTime.endMonitoring()}))):(this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null))}dispose(){this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.engine.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null,this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null,this.engine=null}}class ha{constructor(e){this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new Pn.z,this._captureRenderTargetsRenderTime=!1,this._renderTargetsRenderTime=new Pn.z,this._captureFrameTime=!1,this._frameTime=new Pn.z,this._captureRenderTime=!1,this._renderTime=new Pn.z,this._captureInterFrameTime=!1,this._interFrameTime=new Pn.z,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new Pn.z,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new Pn.z,this._capturePhysicsTime=!1,this._physicsTime=new Pn.z,this._captureAnimationsTime=!1,this._animationsTime=new Pn.z,this._captureCameraRenderTime=!1,this._cameraRenderTime=new Pn.z,this._onBeforeActiveMeshesEvaluationObserver=null,this._onAfterActiveMeshesEvaluationObserver=null,this._onBeforeRenderTargetsRenderObserver=null,this._onAfterRenderTargetsRenderObserver=null,this._onAfterRenderObserver=null,this._onBeforeDrawPhaseObserver=null,this._onAfterDrawPhaseObserver=null,this._onBeforeAnimationsObserver=null,this._onBeforeParticlesRenderingObserver=null,this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver=null,this._onAfterSpritesRenderingObserver=null,this._onBeforePhysicsObserver=null,this._onAfterPhysicsObserver=null,this._onAfterAnimationsObserver=null,this._onBeforeCameraRenderObserver=null,this._onAfterCameraRenderObserver=null,this._onBeforeAnimationsObserver=e.onBeforeAnimationsObservable.add((()=>{this._captureActiveMeshesEvaluationTime&&this._activeMeshesEvaluationTime.fetchNewFrame(),this._captureRenderTargetsRenderTime&&this._renderTargetsRenderTime.fetchNewFrame(),this._captureFrameTime&&(V.w1.StartPerformanceCounter("Scene rendering"),this._frameTime.beginMonitoring()),this._captureInterFrameTime&&this._interFrameTime.endMonitoring(),this._captureParticlesRenderTime&&this._particlesRenderTime.fetchNewFrame(),this._captureSpritesRenderTime&&this._spritesRenderTime.fetchNewFrame(),this._captureAnimationsTime&&this._animationsTime.beginMonitoring(),this.scene.getEngine()._drawCalls.fetchNewFrame()})),this._onAfterRenderObserver=e.onAfterRenderObservable.add((()=>{this._captureFrameTime&&(V.w1.EndPerformanceCounter("Scene rendering"),this._frameTime.endMonitoring()),this._captureRenderTime&&this._renderTime.endMonitoring(!1),this._captureInterFrameTime&&this._interFrameTime.beginMonitoring()}))}get activeMeshesEvaluationTimeCounter(){return this._activeMeshesEvaluationTime}get captureActiveMeshesEvaluationTime(){return this._captureActiveMeshesEvaluationTime}set captureActiveMeshesEvaluationTime(e){e!==this._captureActiveMeshesEvaluationTime&&(this._captureActiveMeshesEvaluationTime=e,e?(this._onBeforeActiveMeshesEvaluationObserver=this.scene.onBeforeActiveMeshesEvaluationObservable.add((()=>{V.w1.StartPerformanceCounter("Active meshes evaluation"),this._activeMeshesEvaluationTime.beginMonitoring()})),this._onAfterActiveMeshesEvaluationObserver=this.scene.onAfterActiveMeshesEvaluationObservable.add((()=>{V.w1.EndPerformanceCounter("Active meshes evaluation"),this._activeMeshesEvaluationTime.endMonitoring()}))):(this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null))}get renderTargetsRenderTimeCounter(){return this._renderTargetsRenderTime}get captureRenderTargetsRenderTime(){return this._captureRenderTargetsRenderTime}set captureRenderTargetsRenderTime(e){e!==this._captureRenderTargetsRenderTime&&(this._captureRenderTargetsRenderTime=e,e?(this._onBeforeRenderTargetsRenderObserver=this.scene.onBeforeRenderTargetsRenderObservable.add((()=>{V.w1.StartPerformanceCounter("Render targets rendering"),this._renderTargetsRenderTime.beginMonitoring()})),this._onAfterRenderTargetsRenderObserver=this.scene.onAfterRenderTargetsRenderObservable.add((()=>{V.w1.EndPerformanceCounter("Render targets rendering"),this._renderTargetsRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null))}get particlesRenderTimeCounter(){return this._particlesRenderTime}get captureParticlesRenderTime(){return this._captureParticlesRenderTime}set captureParticlesRenderTime(e){e!==this._captureParticlesRenderTime&&(this._captureParticlesRenderTime=e,e?(this._onBeforeParticlesRenderingObserver=this.scene.onBeforeParticlesRenderingObservable.add((()=>{V.w1.StartPerformanceCounter("Particles"),this._particlesRenderTime.beginMonitoring()})),this._onAfterParticlesRenderingObserver=this.scene.onAfterParticlesRenderingObservable.add((()=>{V.w1.EndPerformanceCounter("Particles"),this._particlesRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null))}get spritesRenderTimeCounter(){return this._spritesRenderTime}get captureSpritesRenderTime(){return this._captureSpritesRenderTime}set captureSpritesRenderTime(e){e!==this._captureSpritesRenderTime&&(this._captureSpritesRenderTime=e,this.scene.spriteManagers&&(e?(this._onBeforeSpritesRenderingObserver=this.scene.onBeforeSpritesRenderingObservable.add((()=>{V.w1.StartPerformanceCounter("Sprites"),this._spritesRenderTime.beginMonitoring()})),this._onAfterSpritesRenderingObserver=this.scene.onAfterSpritesRenderingObservable.add((()=>{V.w1.EndPerformanceCounter("Sprites"),this._spritesRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null,this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null)))}get physicsTimeCounter(){return this._physicsTime}get capturePhysicsTime(){return this._capturePhysicsTime}set capturePhysicsTime(e){e!==this._capturePhysicsTime&&this.scene.onBeforePhysicsObservable&&(this._capturePhysicsTime=e,e?(this._onBeforePhysicsObserver=this.scene.onBeforePhysicsObservable.add((()=>{V.w1.StartPerformanceCounter("Physics"),this._physicsTime.beginMonitoring()})),this._onAfterPhysicsObserver=this.scene.onAfterPhysicsObservable.add((()=>{V.w1.EndPerformanceCounter("Physics"),this._physicsTime.endMonitoring()}))):(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null,this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null))}get animationsTimeCounter(){return this._animationsTime}get captureAnimationsTime(){return this._captureAnimationsTime}set captureAnimationsTime(e){e!==this._captureAnimationsTime&&(this._captureAnimationsTime=e,e?this._onAfterAnimationsObserver=this.scene.onAfterAnimationsObservable.add((()=>{this._animationsTime.endMonitoring()})):(this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null))}get frameTimeCounter(){return this._frameTime}get captureFrameTime(){return this._captureFrameTime}set captureFrameTime(e){this._captureFrameTime=e}get interFrameTimeCounter(){return this._interFrameTime}get captureInterFrameTime(){return this._captureInterFrameTime}set captureInterFrameTime(e){this._captureInterFrameTime=e}get renderTimeCounter(){return this._renderTime}get captureRenderTime(){return this._captureRenderTime}set captureRenderTime(e){e!==this._captureRenderTime&&(this._captureRenderTime=e,e?(this._onBeforeDrawPhaseObserver=this.scene.onBeforeDrawPhaseObservable.add((()=>{this._renderTime.beginMonitoring(),V.w1.StartPerformanceCounter("Main render")})),this._onAfterDrawPhaseObserver=this.scene.onAfterDrawPhaseObservable.add((()=>{this._renderTime.endMonitoring(!1),V.w1.EndPerformanceCounter("Main render")}))):(this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null))}get cameraRenderTimeCounter(){return this._cameraRenderTime}get captureCameraRenderTime(){return this._captureCameraRenderTime}set captureCameraRenderTime(e){e!==this._captureCameraRenderTime&&(this._captureCameraRenderTime=e,e?(this._onBeforeCameraRenderObserver=this.scene.onBeforeCameraRenderObservable.add((e=>{this._cameraRenderTime.beginMonitoring(),V.w1.StartPerformanceCounter(`Rendering camera ${e.name}`)})),this._onAfterCameraRenderObserver=this.scene.onAfterCameraRenderObservable.add((e=>{this._cameraRenderTime.endMonitoring(!1),V.w1.EndPerformanceCounter(`Rendering camera ${e.name}`)}))):(this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null))}get drawCallsCounter(){return this.scene.getEngine()._drawCalls}dispose(){this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=null,this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null,this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null,this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver),this._onBeforeAnimationsObserver=null,this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver&&(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null),this._onAfterSpritesRenderingObserver&&(this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null),this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null,this._onBeforePhysicsObserver&&(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null),this._onAfterPhysicsObserver&&(this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null),this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null,this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null,this.scene=null}}dt.v.ShadersStore.glowMapGenerationPixelShader="#if defined(DIFFUSE_ISLINEAR) || defined(EMISSIVE_ISLINEAR)\n#include\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;\nuniform sampler2D opacitySampler;\nuniform float opacityIntensity;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef VERTEXALPHA\nvarying vec4 vColor;\n#endif\nuniform vec4 glowColor;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include\nvec4 finalColor=glowColor;\n#ifdef DIFFUSE\nvec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);\n#ifdef DIFFUSE_ISLINEAR\nalbedoTexture=toGammaSpace(albedoTexture);\n#endif\n#ifdef GLOW\nfinalColor.a*=albedoTexture.a;\n#endif\n#ifdef HIGHLIGHT\nfinalColor.a=albedoTexture.a;\n#endif\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vUVOpacity);\n#ifdef OPACITYRGB\nfinalColor.a*=getLuminance(opacityMap.rgb);\n#else\nfinalColor.a*=opacityMap.a;\n#endif\nfinalColor.a*=opacityIntensity;\n#endif\n#ifdef VERTEXALPHA\nfinalColor.a*=vColor.a;\n#endif\n#ifdef ALPHATEST\nif (finalColor.a\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nuniform mat4 viewProjection;\nvarying vec4 vPosition;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;\nuniform mat4 opacityMatrix;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef VERTEXALPHA\nattribute vec4 color;\nvarying vec4 vColor;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef CUBEMAP\nvPosition=worldPos;\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*worldPos;\ngl_Position=vPosition;\n#endif\n#ifdef DIFFUSE\n#ifdef DIFFUSEUV1\nvUVDiffuse=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef DIFFUSEUV2\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef OPACITY\n#ifdef OPACITYUV1\nvUVOpacity=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef OPACITYUV2\nvUVOpacity=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvUVEmissive=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef EMISSIVEUV2\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef VERTEXALPHA\nvColor=color;\n#endif\n#include\n}";var _a=i("../../../node_modules/@babylonjs/core/Misc/devTools.js");class da{constructor(e,t){this._vertexBuffers={},this._maxSize=0,this._mainTextureDesiredSize={width:0,height:0},this._shouldRender=!0,this._postProcesses=[],this._textures=[],this._emissiveTextureAndColor={texture:null,color:new a.HE},this.neutralColor=new a.HE,this.isEnabled=!0,this.disableBoundingBoxesFromEffectLayer=!1,this.onDisposeObservable=new s.y$,this.onBeforeRenderMainTextureObservable=new s.y$,this.onBeforeComposeObservable=new s.y$,this.onBeforeRenderMeshToEffect=new s.y$,this.onAfterRenderMeshToEffect=new s.y$,this.onAfterComposeObservable=new s.y$,this.onSizeChangedObservable=new s.y$,this._materialForRendering={},this.name=e,this._scene=t||m.l.LastCreatedScene,da._SceneComponentInitialization(this._scene),this._engine=this._scene.getEngine(),this._maxSize=this._engine.getCaps().maxTextureSize,this._scene.effectLayers.push(this),this._mergeDrawWrapper=[],this._generateIndexBuffer(),this._generateVertexBuffer()}get camera(){return this._effectLayerOptions.camera}get renderingGroupId(){return this._effectLayerOptions.renderingGroupId}set renderingGroupId(e){this._effectLayerOptions.renderingGroupId=e}get mainTexture(){return this._mainTexture}setMaterialForRendering(e,t){if(this._mainTexture.setMaterialForRendering(e,t),Array.isArray(e))for(let i=0;i{if(!e.isReady(!1))return!1;if(0===t&&e.subMeshes)for(let t=0;t{let r;this.onBeforeRenderMainTextureObservable.notifyObservers(this);const s=this._scene.getEngine();if(n.length){for(s.setColorWrite(!1),r=0;r{e.clear(this.neutralColor,!0,!0,!0)})),this._scene.getBoundingBoxRenderer){const e=this._scene.getBoundingBoxRenderer().enabled;this._mainTexture.onBeforeBindObservable.add((()=>{this._scene.getBoundingBoxRenderer().enabled=!this.disableBoundingBoxesFromEffectLayer&&e})),this._mainTexture.onAfterUnbindObservable.add((()=>{this._scene.getBoundingBoxRenderer().enabled=e}))}}_addCustomEffectDefines(e){}_isReady(e,t,i){var n;const r=this._scene.getEngine(),s=e.getMesh(),o=null===(n=s._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===n?void 0:n[r.currentRenderPassId];if(o)return o.isReadyForSubMesh(s,e,t);const a=e.getMaterial();if(!a)return!1;if(this._useMeshMaterial(e.getRenderingMesh()))return a.isReadyForSubMesh(e.getMesh(),e,t);const l=[],c=[le.o.PositionKind];let h=!1,_=!1;if(a){const e=a.needAlphaTesting(),t=a.getAlphaTestTexture(),i=t&&t.hasAlpha&&(a.useAlphaFromDiffuseTexture||a._useAlphaFromAlbedoTexture);t&&(e||i)&&(l.push("#define DIFFUSE"),s.isVerticesDataPresent(le.o.UV2Kind)&&1===t.coordinatesIndex?(l.push("#define DIFFUSEUV2"),_=!0):s.isVerticesDataPresent(le.o.UVKind)&&(l.push("#define DIFFUSEUV1"),h=!0),e&&(l.push("#define ALPHATEST"),l.push("#define ALPHATESTVALUE 0.4")),t.gammaSpace||l.push("#define DIFFUSE_ISLINEAR"));const n=a.opacityTexture;n&&(l.push("#define OPACITY"),s.isVerticesDataPresent(le.o.UV2Kind)&&1===n.coordinatesIndex?(l.push("#define OPACITYUV2"),_=!0):s.isVerticesDataPresent(le.o.UVKind)&&(l.push("#define OPACITYUV1"),h=!0))}i&&(l.push("#define EMISSIVE"),s.isVerticesDataPresent(le.o.UV2Kind)&&1===i.coordinatesIndex?(l.push("#define EMISSIVEUV2"),_=!0):s.isVerticesDataPresent(le.o.UVKind)&&(l.push("#define EMISSIVEUV1"),h=!0),i.gammaSpace||l.push("#define EMISSIVE_ISLINEAR")),s.useVertexColors&&s.isVerticesDataPresent(le.o.ColorKind)&&s.hasVertexAlpha&&a.transparencyMode!==on.F.MATERIAL_OPAQUE&&(c.push(le.o.ColorKind),l.push("#define VERTEXALPHA")),h&&(c.push(le.o.UVKind),l.push("#define UV1")),_&&(c.push(le.o.UV2Kind),l.push("#define UV2"));const d=new uo.L;if(s.useBones&&s.computeBonesUsingShaders){c.push(le.o.MatricesIndicesKind),c.push(le.o.MatricesWeightsKind),s.numBoneInfluencers>4&&(c.push(le.o.MatricesIndicesExtraKind),c.push(le.o.MatricesWeightsExtraKind)),l.push("#define NUM_BONE_INFLUENCERS "+s.numBoneInfluencers);const e=s.skeleton;e&&e.isUsingTextureForMatrices?l.push("#define BONETEXTURE"):l.push("#define BonesPerMesh "+(e?e.bones.length+1:0)),s.numBoneInfluencers>0&&d.addCPUSkinningFallback(0,s)}else l.push("#define NUM_BONE_INFLUENCERS 0");const u=s.morphTargetManager;let p=0;u&&u.numInfluencers>0&&(l.push("#define MORPHTARGETS"),p=u.numInfluencers,l.push("#define NUM_MORPH_INFLUENCERS "+p),u.isUsingTextureForTargets&&l.push("#define MORPHTARGETS_TEXTURE"),lo.G.PrepareAttributesForMorphTargetsInfluencers(c,s,p)),t&&(l.push("#define INSTANCES"),lo.G.PushAttributesForInstances(c),e.getRenderingMesh().hasThinInstances&&l.push("#define THIN_INSTANCES"));const f=this._scene;f.clipPlane&&l.push("#define CLIPPLANE"),f.clipPlane2&&l.push("#define CLIPPLANE2"),f.clipPlane3&&l.push("#define CLIPPLANE3"),f.clipPlane4&&l.push("#define CLIPPLANE4"),f.clipPlane5&&l.push("#define CLIPPLANE5"),f.clipPlane6&&l.push("#define CLIPPLANE6"),this._addCustomEffectDefines(l);const m=e._getDrawWrapper(void 0,!0),g=m.defines,b=l.join("\n");return g!==b&&m.setEffect(this._engine.createEffect("glowMapGeneration",c,["world","mBones","viewProjection","glowColor","morphTargetInfluences","boneTextureWidth","diffuseMatrix","emissiveMatrix","opacityMatrix","opacityIntensity","morphTargetTextureInfo","morphTargetTextureIndices","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6"],["diffuseSampler","emissiveSampler","opacitySampler","boneSampler","morphTargets"],b,d,void 0,void 0,{maxSimultaneousMorphTargets:p}),b),m.effect.isReady()}render(){for(let e=0;eo.setMatrix("world",t)))}else this._mainTexture.resetRefreshCounter();this.onAfterRenderMeshToEffect.notifyObservers(s)}_useMeshMaterial(e){return!1}_rebuild(){const e=this._vertexBuffers[le.o.PositionKind];e&&e._rebuild(),this._generateIndexBuffer()}_disposeTextureAndPostProcesses(){this._mainTexture.dispose();for(let e=0;e-1&&this._scene.effectLayers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderMainTextureObservable.clear(),this.onBeforeComposeObservable.clear(),this.onBeforeRenderMeshToEffect.clear(),this.onAfterRenderMeshToEffect.clear(),this.onAfterComposeObservable.clear(),this.onSizeChangedObservable.clear()}getClassName(){return"EffectLayer"}static Parse(e,t,i){return V.w1.Instantiate(e.customType).Parse(e,t,i)}}da._SceneComponentInitialization=e=>{throw(0,_a.S)("EffectLayerSceneComponent")},(0,X.gn)([(0,Y.qC)()],da.prototype,"name",void 0),(0,X.gn)([(0,Y.XX)()],da.prototype,"neutralColor",void 0),(0,X.gn)([(0,Y.qC)()],da.prototype,"isEnabled",void 0),(0,X.gn)([(0,Y.VE)()],da.prototype,"camera",null),(0,X.gn)([(0,Y.qC)()],da.prototype,"renderingGroupId",null),(0,X.gn)([(0,Y.qC)()],da.prototype,"disableBoundingBoxesFromEffectLayer",void 0),n.p.AddParser(z.l.NAME_EFFECTLAYER,((e,t,i,n)=>{if(e.effectLayers){i.effectLayers||(i.effectLayers=new Array);for(let r=0;r{this.scene.addEffectLayer(e)}))}removeFromContainer(e,t){e.effectLayers&&e.effectLayers.forEach((e=>{this.scene.removeEffectLayer(e),t&&e.dispose()}))}dispose(){const e=this.scene.effectLayers;for(;e.length;)e[0].dispose()}_isReadyForMesh(e,t){const i=this._engine.currentRenderPassId,n=this.scene.effectLayers;for(const r of n){if(!r.hasMesh(e))continue;const n=r._mainTexture;this._engine.currentRenderPassId=n.renderPassId;for(const n of e.subMeshes)if(!r.isReady(n,t))return this._engine.currentRenderPassId=i,!1}return this._engine.currentRenderPassId=i,!0}_renderMainTexture(e){this._renderEffects=!1,this._needStencil=!1;let t=!1;const i=this.scene.effectLayers;if(i&&i.length>0){this._previousStencilState=this._engine.getStencilBuffer();for(const n of i)if(n.shouldRender()&&(!n.camera||n.camera.cameraRigMode===Le.V.RIG_MODE_NONE&&e===n.camera||n.camera.cameraRigMode!==Le.V.RIG_MODE_NONE&&n.camera._rigCameras.indexOf(e)>-1)){this._renderEffects=!0,this._needStencil=this._needStencil||n.needStencil();const e=n._mainTexture;e._shouldRender()&&(this.scene.incrementRenderId(),e.render(!1,!1),t=!0)}this.scene.incrementRenderId()}return t}_setStencil(){this._needStencil&&this._engine.setStencilBuffer(!0)}_setStencilBack(){this._needStencil&&this._engine.setStencilBuffer(this._previousStencilState)}_draw(e){if(this._renderEffects){this._engine.setDepthBuffer(!1);const t=this.scene.effectLayers;for(let i=0;i{let t=e._getComponent(z.l.NAME_EFFECTLAYER);t||(t=new ua(e),e._addComponent(t))};dt.v.ShadersStore.glowMapMergePixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#ifdef EMISSIVE\nuniform sampler2D textureSampler2;\n#endif\nuniform float offset;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef EMISSIVE\nbaseColor+=texture2D(textureSampler2,vUV);\nbaseColor*=offset;\n#else\nbaseColor.a=abs(offset-baseColor.a);\n#ifdef STROKE\nfloat alpha=smoothstep(.0,.1,baseColor.a);\nbaseColor.a=alpha;\nbaseColor.rgb=baseColor.rgb*alpha;\n#endif\n#endif\n#if LDR\nbaseColor=clamp(baseColor,0.,1.0);\n#endif\ngl_FragColor=baseColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";dt.v.ShadersStore.glowMapMergeVertexShader="attribute vec2 position;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}",n.p.prototype.getGlowLayerByName=function(e){for(let t=0;t{e.setTexture("textureSampler",this._mainTexture)})),this._verticalBlurPostprocess1=new so("GlowLayerVBP1",new o.FM(0,1),s,{width:e,height:t},null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,i),this._horizontalBlurPostprocess2=new so("GlowLayerHBP2",new o.FM(1,0),s,{width:n,height:r},null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,i),this._horizontalBlurPostprocess2.width=n,this._horizontalBlurPostprocess2.height=r,this._horizontalBlurPostprocess2.externalTextureSamplerBinding=!0,this._horizontalBlurPostprocess2.onApplyObservable.add((e=>{e.setTexture("textureSampler",this._blurTexture1)})),this._verticalBlurPostprocess2=new so("GlowLayerVBP2",new o.FM(0,1),s,{width:n,height:r},null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,i),this._postProcesses=[this._horizontalBlurPostprocess1,this._verticalBlurPostprocess1,this._horizontalBlurPostprocess2,this._verticalBlurPostprocess2],this._postProcesses1=[this._horizontalBlurPostprocess1,this._verticalBlurPostprocess1],this._postProcesses2=[this._horizontalBlurPostprocess2,this._verticalBlurPostprocess2],this._mainTexture.samples=this._options.mainTextureSamples,this._mainTexture.onAfterUnbindObservable.add((()=>{const e=this._blurTexture1.renderTarget;if(e){this._scene.postProcessManager.directRender(this._postProcesses1,e,!0);const t=this._blurTexture2.renderTarget;t&&this._scene.postProcessManager.directRender(this._postProcesses2,t,!0),this._engine.unBindFramebuffer(null!=t?t:e,!0)}})),this._postProcesses.map((e=>{e.autoClear=!1}))}_getEffectiveBlurKernelSize(){return this._options.blurKernelSize/2}isReady(e,t){const i=e.getMaterial(),n=e.getRenderingMesh();if(!i||!n)return!1;const r=i.emissiveTexture;return super._isReady(e,t,r)}needStencil(){return!1}_canRenderMesh(e,t){return!0}_internalRender(e){e.setTexture("textureSampler",this._blurTexture1),e.setTexture("textureSampler2",this._blurTexture2),e.setFloat("offset",this._intensity);const t=this._engine,i=t.getStencilBuffer();t.setStencilBuffer(!1),t.drawElementsType(on.F.TriangleFillMode,0,6),t.setStencilBuffer(i)}_setEmissiveTextureAndColor(e,t,i){var n;let r=1;this.customEmissiveTextureSelector?this._emissiveTextureAndColor.texture=this.customEmissiveTextureSelector(e,t,i):i?(this._emissiveTextureAndColor.texture=i.emissiveTexture,this._emissiveTextureAndColor.texture&&(r=this._emissiveTextureAndColor.texture.level)):this._emissiveTextureAndColor.texture=null,this.customEmissiveColorSelector?this.customEmissiveColorSelector(e,t,i,this._emissiveTextureAndColor.color):i.emissiveColor?(r*=null!==(n=i.emissiveIntensity)&&void 0!==n?n:1,this._emissiveTextureAndColor.color.set(i.emissiveColor.r*r,i.emissiveColor.g*r,i.emissiveColor.b*r,i.alpha)):this._emissiveTextureAndColor.color.set(this.neutralColor.r,this.neutralColor.g,this.neutralColor.b,this.neutralColor.a)}_shouldRenderMesh(e){return this.hasMesh(e)}_addCustomEffectDefines(e){e.push("#define GLOW")}addExcludedMesh(e){-1===this._excludedMeshes.indexOf(e.uniqueId)&&this._excludedMeshes.push(e.uniqueId)}removeExcludedMesh(e){const t=this._excludedMeshes.indexOf(e.uniqueId);-1!==t&&this._excludedMeshes.splice(t,1)}addIncludedOnlyMesh(e){-1===this._includedOnlyMeshes.indexOf(e.uniqueId)&&this._includedOnlyMeshes.push(e.uniqueId)}removeIncludedOnlyMesh(e){const t=this._includedOnlyMeshes.indexOf(e.uniqueId);-1!==t&&this._includedOnlyMeshes.splice(t,1)}hasMesh(e){return!!super.hasMesh(e)&&(this._includedOnlyMeshes.length?-1!==this._includedOnlyMeshes.indexOf(e.uniqueId):!this._excludedMeshes.length||-1===this._excludedMeshes.indexOf(e.uniqueId))}_useMeshMaterial(e){return 0!=this._meshesUsingTheirOwnMaterials.length&&this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId)>-1}referenceMeshToUseItsOwnMaterial(e){e.resetDrawCache(this._mainTexture.renderPassId),this._meshesUsingTheirOwnMaterials.push(e.uniqueId),e.onDisposeObservable.add((()=>{this._disposeMesh(e)}))}unReferenceMeshFromUsingItsOwnMaterial(e){let t=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);for(;t>=0;)this._meshesUsingTheirOwnMaterials.splice(t,1),t=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);e.resetDrawCache(this._mainTexture.renderPassId)}_disposeMesh(e){this.removeIncludedOnlyMesh(e),this.removeExcludedMesh(e)}getClassName(){return"GlowLayer"}serialize(){const e=Y.p4.Serialize(this);let t;if(e.customType="BABYLON.GlowLayer",e.includedMeshes=[],this._includedOnlyMeshes.length)for(t=0;tnew pa(e.name,t,e.options)),e,t,i);let r;for(r=0;r{e.setFloat2("screenSize",this.width,this.height),e.setVector2("direction",this.direction),e.setFloat("blurWidth",this.kernel)}))}}class ma extends da{constructor(e,t,i){super(e,t),this.name=e,this.innerGlow=!0,this.outerGlow=!0,this.onBeforeBlurObservable=new s.y$,this.onAfterBlurObservable=new s.y$,this._instanceGlowingMeshStencilReference=ma.GlowingMeshStencilReference++,this._meshes={},this._excludedMeshes={},this.neutralColor=ma.NeutralColor,this._engine.isStencilEnable||u.Y.Warn("Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }"),this._options={mainTextureRatio:.5,blurTextureSizeRatio:.5,blurHorizontalSize:1,blurVerticalSize:1,alphaBlendingMode:2,camera:null,renderingGroupId:-1,...i},this._init({alphaBlendingMode:this._options.alphaBlendingMode,camera:this._options.camera,mainTextureFixedSize:this._options.mainTextureFixedSize,mainTextureRatio:this._options.mainTextureRatio,renderingGroupId:this._options.renderingGroupId}),this._shouldRender=!1}set blurHorizontalSize(e){this._horizontalBlurPostprocess.kernel=e,this._options.blurHorizontalSize=e}set blurVerticalSize(e){this._verticalBlurPostprocess.kernel=e,this._options.blurVerticalSize=e}get blurHorizontalSize(){return this._horizontalBlurPostprocess.kernel}get blurVerticalSize(){return this._verticalBlurPostprocess.kernel}getEffectName(){return ma.EffectName}_numInternalDraws(){return 2}_createMergeEffect(){return this._engine.createEffect("glowMapMerge",[le.o.PositionKind],["offset"],["textureSampler"],this._options.isStroke?"#define STROKE \n":void 0)}_createTextureAndPostProcesses(){let e=this._mainTextureDesiredSize.width*this._options.blurTextureSizeRatio,t=this._mainTextureDesiredSize.height*this._options.blurTextureSizeRatio;e=this._engine.needPOTTextures?k.D.GetExponentOfTwo(e,this._maxSize):e,t=this._engine.needPOTTextures?k.D.GetExponentOfTwo(t,this._maxSize):t;let i=0;i=this._engine.getCaps().textureHalfFloatRender?2:0,this._blurTexture=new Ot._("HighlightLayerBlurRTT",{width:e,height:t},this._scene,!1,!0,i),this._blurTexture.wrapU=K.x.CLAMP_ADDRESSMODE,this._blurTexture.wrapV=K.x.CLAMP_ADDRESSMODE,this._blurTexture.anisotropicFilteringLevel=16,this._blurTexture.updateSamplingMode(K.x.TRILINEAR_SAMPLINGMODE),this._blurTexture.renderParticles=!1,this._blurTexture.ignoreCameraViewport=!0,this._textures=[this._blurTexture],2===this._options.alphaBlendingMode?(this._downSamplePostprocess=new ht.Q("HighlightLayerPPP",this._options.blurTextureSizeRatio,null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._downSamplePostprocess.externalTextureSamplerBinding=!0,this._downSamplePostprocess.onApplyObservable.add((e=>{e.setTexture("textureSampler",this._mainTexture)})),this._horizontalBlurPostprocess=new fa("HighlightLayerHBP",new o.FM(1,0),this._options.blurHorizontalSize,1,null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._horizontalBlurPostprocess.onApplyObservable.add((i=>{i.setFloat2("screenSize",e,t)})),this._verticalBlurPostprocess=new fa("HighlightLayerVBP",new o.FM(0,1),this._options.blurVerticalSize,1,null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._verticalBlurPostprocess.onApplyObservable.add((i=>{i.setFloat2("screenSize",e,t)})),this._postProcesses=[this._downSamplePostprocess,this._horizontalBlurPostprocess,this._verticalBlurPostprocess]):(this._horizontalBlurPostprocess=new so("HighlightLayerHBP",new o.FM(1,0),this._options.blurHorizontalSize/2,{width:e,height:t},null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,i),this._horizontalBlurPostprocess.width=e,this._horizontalBlurPostprocess.height=t,this._horizontalBlurPostprocess.externalTextureSamplerBinding=!0,this._horizontalBlurPostprocess.onApplyObservable.add((e=>{e.setTexture("textureSampler",this._mainTexture)})),this._verticalBlurPostprocess=new so("HighlightLayerVBP",new o.FM(0,1),this._options.blurVerticalSize/2,{width:e,height:t},null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,i),this._postProcesses=[this._horizontalBlurPostprocess,this._verticalBlurPostprocess]),this._mainTexture.onAfterUnbindObservable.add((()=>{this.onBeforeBlurObservable.notifyObservers(this);const e=this._blurTexture.renderTarget;e&&(this._scene.postProcessManager.directRender(this._postProcesses,e,!0),this._engine.unBindFramebuffer(e,!0)),this.onAfterBlurObservable.notifyObservers(this)})),this._postProcesses.map((e=>{e.autoClear=!1}))}needStencil(){return!0}isReady(e,t){const i=e.getMaterial(),n=e.getRenderingMesh();if(!i||!n||!this._meshes)return!1;let r=null;const s=this._meshes[n.uniqueId];return s&&s.glowEmissiveOnly&&i&&(r=i.emissiveTexture),super._isReady(e,t,r)}_internalRender(e,t){e.setTexture("textureSampler",this._blurTexture);const i=this._engine;i.cacheStencilState(),i.setStencilOperationPass(7681),i.setStencilOperationFail(7680),i.setStencilOperationDepthFail(7680),i.setStencilMask(0),i.setStencilBuffer(!0),i.setStencilFunctionReference(this._instanceGlowingMeshStencilReference),this.outerGlow&&0===t&&(e.setFloat("offset",0),i.setStencilFunction(517),i.drawElementsType(on.F.TriangleFillMode,0,6)),this.innerGlow&&1===t&&(e.setFloat("offset",1),i.setStencilFunction(514),i.drawElementsType(on.F.TriangleFillMode,0,6)),i.restoreStencilState()}shouldRender(){return!!super.shouldRender()&&!!this._meshes}_shouldRenderMesh(e){return!(this._excludedMeshes&&this._excludedMeshes[e.uniqueId]||!super.hasMesh(e))}_canRenderMesh(e,t){return!0}_addCustomEffectDefines(e){e.push("#define HIGHLIGHT")}_setEmissiveTextureAndColor(e,t,i){const n=this._meshes[e.uniqueId];n?this._emissiveTextureAndColor.color.set(n.color.r,n.color.g,n.color.b,1):this._emissiveTextureAndColor.color.set(this.neutralColor.r,this.neutralColor.g,this.neutralColor.b,this.neutralColor.a),n&&n.glowEmissiveOnly&&i?(this._emissiveTextureAndColor.texture=i.emissiveTexture,this._emissiveTextureAndColor.color.set(1,1,1,1)):this._emissiveTextureAndColor.texture=null}addExcludedMesh(e){this._excludedMeshes&&(this._excludedMeshes[e.uniqueId]||(this._excludedMeshes[e.uniqueId]={mesh:e,beforeBind:e.onBeforeBindObservable.add((e=>{e.getEngine().setStencilBuffer(!1)})),afterRender:e.onAfterRenderObservable.add((e=>{e.getEngine().setStencilBuffer(!0)}))}))}removeExcludedMesh(e){if(!this._excludedMeshes)return;const t=this._excludedMeshes[e.uniqueId];t&&(t.beforeBind&&e.onBeforeBindObservable.remove(t.beforeBind),t.afterRender&&e.onAfterRenderObservable.remove(t.afterRender)),this._excludedMeshes[e.uniqueId]=null}hasMesh(e){return!!this._meshes&&!!super.hasMesh(e)&&void 0!==this._meshes[e.uniqueId]&&null!==this._meshes[e.uniqueId]}addMesh(e,t,i=!1){if(!this._meshes)return;const n=this._meshes[e.uniqueId];n?n.color=t:(this._meshes[e.uniqueId]={mesh:e,color:t,observerHighlight:e.onBeforeBindObservable.add((e=>{this.isEnabled&&(this._excludedMeshes&&this._excludedMeshes[e.uniqueId]?this._defaultStencilReference(e):e.getScene().getEngine().setStencilFunctionReference(this._instanceGlowingMeshStencilReference))})),observerDefault:e.onAfterRenderObservable.add((e=>{this.isEnabled&&this._defaultStencilReference(e)})),glowEmissiveOnly:i},e.onDisposeObservable.add((()=>{this._disposeMesh(e)}))),this._shouldRender=!0}removeMesh(e){if(!this._meshes)return;const t=this._meshes[e.uniqueId];t&&(t.observerHighlight&&e.onBeforeBindObservable.remove(t.observerHighlight),t.observerDefault&&e.onAfterRenderObservable.remove(t.observerDefault),delete this._meshes[e.uniqueId]),this._shouldRender=!1;for(const e in this._meshes)if(this._meshes[e]){this._shouldRender=!0;break}}removeAllMeshes(){if(this._meshes)for(const e in this._meshes)if(Object.prototype.hasOwnProperty.call(this._meshes,e)){const t=this._meshes[e];t&&this.removeMesh(t.mesh)}}_defaultStencilReference(e){e.getScene().getEngine().setStencilFunctionReference(ma.NormalMeshStencilReference)}_disposeMesh(e){this.removeMesh(e),this.removeExcludedMesh(e)}dispose(){if(this._meshes){for(const e in this._meshes){const t=this._meshes[e];t&&t.mesh&&(t.observerHighlight&&t.mesh.onBeforeBindObservable.remove(t.observerHighlight),t.observerDefault&&t.mesh.onAfterRenderObservable.remove(t.observerDefault))}this._meshes=null}if(this._excludedMeshes){for(const e in this._excludedMeshes){const t=this._excludedMeshes[e];t&&(t.beforeBind&&t.mesh.onBeforeBindObservable.remove(t.beforeBind),t.afterRender&&t.mesh.onAfterRenderObservable.remove(t.afterRender))}this._excludedMeshes=null}super.dispose()}getClassName(){return"HighlightLayer"}serialize(){const e=Y.p4.Serialize(this);if(e.customType="BABYLON.HighlightLayer",e.meshes=[],this._meshes)for(const t in this._meshes){const i=this._meshes[t];i&&e.meshes.push({glowEmissiveOnly:i.glowEmissiveOnly,color:i.color.asArray(),meshId:i.mesh.id})}if(e.excludedMeshes=[],this._excludedMeshes)for(const t in this._excludedMeshes){const i=this._excludedMeshes[t];i&&e.excludedMeshes.push(i.mesh.id)}return e}static Parse(e,t,i){const n=Y.p4.Parse((()=>new ma(e.name,t,e.options)),e,t,i);let r;for(r=0;ri.activeCamera&&e.material&&e.isVisible&&e.isEnabled()&&e.isBlocker&&0!=(e.layerMask&i.activeCamera.layerMask);const n=i.getEngine(),r=[];r.push(1,1),r.push(-1,1),r.push(-1,-1),r.push(1,-1),this._vertexBuffers[le.o.PositionKind]=new le.o(n,r,le.o.PositionKind,!1,!1,2),this._createIndexBuffer()}get scene(){return this._scene}_createIndexBuffer(){const e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)}get isEnabled(){return this._isEnabled}set isEnabled(e){this._isEnabled=e}getScene(){return this._scene}getEmitter(){return this._emitter}setEmitter(e){this._emitter=e}getEmitterPosition(){return this._emitter.getAbsolutePosition?this._emitter.getAbsolutePosition():this._emitter.position}computeEffectivePosition(e){let t=this.getEmitterPosition();t=o.P.Project(t,o.y3.Identity(),this._scene.getTransformMatrix(),e),this._positionX=t.x,this._positionY=t.y,t=o.P.TransformCoordinates(this.getEmitterPosition(),this._scene.getViewMatrix()),this.viewportBorder>0&&(e.x-=this.viewportBorder,e.y-=this.viewportBorder,e.width+=2*this.viewportBorder,e.height+=2*this.viewportBorder,t.x+=this.viewportBorder,t.y+=this.viewportBorder,this._positionX+=this.viewportBorder,this._positionY+=this.viewportBorder);const i=this._scene.useRightHandedSystem;return!!(t.z>0&&!i||t.z<0&&i)&&(this._positionX>e.x&&this._positionXe.y&&(this._positionY,e.y,e.height),!0)}_isVisible(){if(!this._isEnabled||!this._scene.activeCamera)return!1;const e=this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition),t=e.length();e.normalize();const i=new tt.z(this._scene.activeCamera.globalPosition,e),n=this._scene.pickWithRay(i,this.meshesSelectionPredicate,!0);return!n||!n.hit||n.distance>t}render(){if(!this._scene.activeCamera)return!1;const e=this._scene.getEngine(),t=this._scene.activeCamera.viewport.toGlobal(e.getRenderWidth(!0),e.getRenderHeight(!0));if(!this.computeEffectivePosition(t))return!1;if(!this._isVisible())return!1;let i,n;i=this._positionXt.x+t.width-this.borderLimit?this._positionX-t.x-t.width+this.borderLimit:0,n=this._positionYt.y+t.height-this.borderLimit?this._positionY-t.y-t.height+this.borderLimit:0;let r=i>n?i:n;r-=this.viewportBorder,r>this.borderLimit&&(r=this.borderLimit);let s=1-ve.R.Clamp(r/this.borderLimit,0,1);if(s<0)return!1;s>1&&(s=1),this.viewportBorder>0&&(t.x+=this.viewportBorder,t.y+=this.viewportBorder,t.width-=2*this.viewportBorder,t.height-=2*this.viewportBorder,this._positionX-=this.viewportBorder,this._positionY-=this.viewportBorder);const a=t.x+t.width/2,l=t.y+t.height/2,c=a-this._positionX,h=l-this._positionY;e.setState(!1),e.setDepthBuffer(!1);for(let i=0;i{throw(0,_a.S)("LensFlareSystemSceneComponent")},n.p.AddParser(z.l.NAME_LENSFLARESYSTEM,((e,t,i,n)=>{if(void 0!==e.lensFlareSystems&&null!==e.lensFlareSystems){i.lensFlareSystems||(i.lensFlareSystems=new Array);for(let r=0,s=e.lensFlareSystems.length;r{this.scene.addLensFlareSystem(e)}))}removeFromContainer(e,t){e.lensFlareSystems&&e.lensFlareSystems.forEach((e=>{this.scene.removeLensFlareSystem(e),t&&e.dispose()}))}serialize(e){e.lensFlareSystems=[];const t=this.scene.lensFlareSystems;for(const i of t)e.lensFlareSystems.push(i.serialize())}dispose(){const e=this.scene.lensFlareSystems;for(;e.length;)e[0].dispose()}_draw(e){if(this.scene.lensFlaresEnabled){const t=this.scene.lensFlareSystems;V.w1.StartPerformanceCounter("Lens flares",t.length>0);for(const i of t)0!=(e.layerMask&i.layerMask)&&i.render();V.w1.EndPerformanceCounter("Lens flares",t.length>0)}}}ba._SceneComponentInitialization=e=>{let t=e._getComponent(z.l.NAME_LENSFLARESYSTEM);t||(t=new ya(e),e._addComponent(t))};var va=i("../../../node_modules/@babylonjs/core/Lights/light.js"),Aa=(i("../../../node_modules/@babylonjs/core/Lights/shadowLight.js"),i("../../../node_modules/@babylonjs/core/Rendering/renderingManager.js"));dt.v.IncludesShadersStore.bayerDitherFunctions="float bayerDither2(vec2 _P) {\nreturn mod(2.0*_P.y+_P.x+1.0,4.0);\n}\nfloat bayerDither4(vec2 _P) {\nvec2 P1=mod(_P,2.0); \nvec2 P2=floor(0.5*mod(_P,4.0)); \nreturn 4.0*bayerDither2(P1)+bayerDither2(P2);\n}\nfloat bayerDither8(vec2 _P) {\nvec2 P1=mod(_P,2.0); \nvec2 P2=floor(0.5 *mod(_P,4.0)); \nvec2 P4=floor(0.25*mod(_P,8.0)); \nreturn 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);\n}\n";dt.v.IncludesShadersStore.shadowMapFragmentExtraDeclaration="#if SM_FLOAT==0\n#include\n#endif\n#if SM_SOFTTRANSPARENTSHADOW==1\n#include\nuniform float softTransparentShadowSM;\n#endif\nvarying float vDepthMetricSM;\n#if SM_USEDISTANCE==1\nuniform vec3 lightDataSM;\nvarying vec3 vPositionWSM;\n#endif\nuniform vec3 biasAndScaleSM;\nuniform vec2 depthValuesSM;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nvarying float zSM;\n#endif\n";dt.v.IncludesShadersStore.shadowMapFragment="float depthSM=vDepthMetricSM;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\n#if SM_USEDISTANCE==1\ndepthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\ndepthSM=(-zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#else\ndepthSM=(zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#endif\n#endif\n#ifdef USE_REVERSE_DEPTHBUFFER\ngl_FragDepth=clamp(1.0-depthSM,0.0,1.0);\n#else\ngl_FragDepth=clamp(depthSM,0.0,1.0); \n#endif\n#elif SM_USEDISTANCE==1\ndepthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#endif\n#if SM_ESM==1\ndepthSM=clamp(exp(-min(87.,biasAndScaleSM.z*depthSM)),0.,1.);\n#endif\n#if SM_FLOAT==1\ngl_FragColor=vec4(depthSM,1.0,1.0,1.0);\n#else\ngl_FragColor=pack(depthSM);\n#endif\nreturn;";dt.v.ShadersStore.shadowMapPixelShader="#include\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include\n#ifdef ALPHATEST\nfloat alphaFromAlphaTexture=texture2D(diffuseSampler,vUV).a;\nif (alphaFromAlphaTexture=softTransparentShadowSM*alphaFromAlphaTexture) discard;\n#else\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM) discard;\n#endif\n#endif\n#include\n}";dt.v.IncludesShadersStore.sceneVertexDeclaration="uniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec4 vEyePosition;\n";dt.v.IncludesShadersStore.meshVertexDeclaration="uniform mat4 world;\nuniform float visibility;\n";dt.v.IncludesShadersStore.shadowMapVertexDeclaration="#include\n#include\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/meshUboDeclaration.js");dt.v.IncludesShadersStore.shadowMapUboDeclaration="layout(std140,column_major) uniform;\n#include\n#include\n";dt.v.IncludesShadersStore.shadowMapVertexExtraDeclaration="#if SM_NORMALBIAS==1\nuniform vec3 lightDataSM;\n#endif\nuniform vec3 biasAndScaleSM;\nuniform vec2 depthValuesSM;\nvarying float vDepthMetricSM;\n#if SM_USEDISTANCE==1\nvarying vec3 vPositionWSM;\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nvarying float zSM;\n#endif\n";dt.v.IncludesShadersStore.shadowMapVertexNormalBias="#if SM_NORMALBIAS==1\n#if SM_DIRECTIONINLIGHTDATA==1\nvec3 worldLightDirSM=normalize(-lightDataSM.xyz);\n#else\nvec3 directionToLightSM=lightDataSM.xyz-worldPos.xyz;\nvec3 worldLightDirSM=normalize(directionToLightSM);\n#endif\nfloat ndlSM=dot(vNormalW,worldLightDirSM);\nfloat sinNLSM=sqrt(1.0-ndlSM*ndlSM);\nfloat normalBiasSM=biasAndScaleSM.y*sinNLSM;\nworldPos.xyz-=vNormalW*normalBiasSM;\n#endif\n";dt.v.IncludesShadersStore.shadowMapVertexMetric="#if SM_USEDISTANCE==1\nvPositionWSM=worldPos.xyz;\n#endif\n#if SM_DEPTHTEXTURE==1\n#ifdef IS_NDC_HALF_ZRANGE\n#define BIASFACTOR 0.5\n#else\n#define BIASFACTOR 1.0\n#endif\n#ifdef USE_REVERSE_DEPTHBUFFER\ngl_Position.z-=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;\n#else\ngl_Position.z+=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;\n#endif\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nzSM=gl_Position.z;\ngl_Position.z=0.0;\n#elif SM_USEDISTANCE==0\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetricSM=(-gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#else\nvDepthMetricSM=(gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#endif\n#endif\n";dt.v.ShadersStore.shadowMapVertexShader="attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#endif\n#include\n#include<__decl__shadowMapVertex>\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normWorldSM=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvec3 vNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));\nvNormalW=normalize(normWorldSM*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormWorldSM=transposeMat3(inverseMat3(normWorldSM));\n#endif\nvec3 vNormalW=normalize(normWorldSM*normalUpdated);\n#endif\n#endif\n#include\ngl_Position=viewProjection*worldPos;\n#include\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include\n}";dt.v.ShadersStore.depthBoxBlurPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 colorDepth=vec4(0.0);\nfor (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\n}";dt.v.IncludesShadersStore.shadowMapFragmentSoftTransparentShadow="#if SM_SOFTTRANSPARENTSHADOW==1\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM*alpha) discard;\n#endif\n";class Ca{constructor(e,t,i){this.onBeforeShadowMapRenderObservable=new s.y$,this.onAfterShadowMapRenderObservable=new s.y$,this.onBeforeShadowMapRenderMeshObservable=new s.y$,this.onAfterShadowMapRenderMeshObservable=new s.y$,this._bias=5e-5,this._normalBias=0,this._blurBoxOffset=1,this._blurScale=2,this._blurKernel=1,this._useKernelBlur=!1,this._filter=Ca.FILTER_NONE,this._filteringQuality=Ca.QUALITY_HIGH,this._contactHardeningLightSizeUVRatio=.1,this._darkness=0,this._transparencyShadow=!1,this.enableSoftTransparentShadow=!1,this.useOpacityTextureForTransparentShadow=!1,this.frustumEdgeFalloff=0,this.forceBackFacesOnly=!1,this._lightDirection=o.P.Zero(),this._viewMatrix=o.y3.Zero(),this._projectionMatrix=o.y3.Zero(),this._transformMatrix=o.y3.Zero(),this._cachedPosition=new o.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new o.P(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=o.y3.Identity(),this._mapSize=e,this._light=t,this._scene=t.getScene(),t._shadowGenerator=this,this.id=t.id,this._useUBO=this._scene.getEngine().supportsUniformBuffers,this._useUBO&&(this._sceneUBOs=[],this._sceneUBOs.push(this._scene.createSceneUniformBuffer(`Scene for Shadow Generator (light "${this._light.name}")`))),Ca._SceneComponentInitialization(this._scene);const n=this._scene.getEngine().getCaps();i?n.textureFloatRender&&n.textureFloatLinearFiltering?this._textureType=1:n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering?this._textureType=2:this._textureType=0:n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering?this._textureType=2:n.textureFloatRender&&n.textureFloatLinearFiltering?this._textureType=1:this._textureType=0,this._initializeGenerator(),this._applyFilterValues()}get bias(){return this._bias}set bias(e){this._bias=e}get normalBias(){return this._normalBias}set normalBias(e){this._normalBias=e}get blurBoxOffset(){return this._blurBoxOffset}set blurBoxOffset(e){this._blurBoxOffset!==e&&(this._blurBoxOffset=e,this._disposeBlurPostProcesses())}get blurScale(){return this._blurScale}set blurScale(e){this._blurScale!==e&&(this._blurScale=e,this._disposeBlurPostProcesses())}get blurKernel(){return this._blurKernel}set blurKernel(e){this._blurKernel!==e&&(this._blurKernel=e,this._disposeBlurPostProcesses())}get useKernelBlur(){return this._useKernelBlur}set useKernelBlur(e){this._useKernelBlur!==e&&(this._useKernelBlur=e,this._disposeBlurPostProcesses())}get depthScale(){return void 0!==this._depthScale?this._depthScale:this._light.getDepthScale()}set depthScale(e){this._depthScale=e}_validateFilter(e){return e}get filter(){return this._filter}set filter(e){if(e=this._validateFilter(e),this._light.needCube()){if(e===Ca.FILTER_BLUREXPONENTIALSHADOWMAP)return void(this.useExponentialShadowMap=!0);if(e===Ca.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)return void(this.useCloseExponentialShadowMap=!0);if(e===Ca.FILTER_PCF||e===Ca.FILTER_PCSS)return void(this.usePoissonSampling=!0)}e!==Ca.FILTER_PCF&&e!==Ca.FILTER_PCSS||this._scene.getEngine()._features.supportShadowSamplers?this._filter!==e&&(this._filter=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty()):this.usePoissonSampling=!0}get usePoissonSampling(){return this.filter===Ca.FILTER_POISSONSAMPLING}set usePoissonSampling(e){const t=this._validateFilter(Ca.FILTER_POISSONSAMPLING);(e||this.filter===Ca.FILTER_POISSONSAMPLING)&&(this.filter=e?t:Ca.FILTER_NONE)}get useExponentialShadowMap(){return this.filter===Ca.FILTER_EXPONENTIALSHADOWMAP}set useExponentialShadowMap(e){const t=this._validateFilter(Ca.FILTER_EXPONENTIALSHADOWMAP);(e||this.filter===Ca.FILTER_EXPONENTIALSHADOWMAP)&&(this.filter=e?t:Ca.FILTER_NONE)}get useBlurExponentialShadowMap(){return this.filter===Ca.FILTER_BLUREXPONENTIALSHADOWMAP}set useBlurExponentialShadowMap(e){const t=this._validateFilter(Ca.FILTER_BLUREXPONENTIALSHADOWMAP);(e||this.filter===Ca.FILTER_BLUREXPONENTIALSHADOWMAP)&&(this.filter=e?t:Ca.FILTER_NONE)}get useCloseExponentialShadowMap(){return this.filter===Ca.FILTER_CLOSEEXPONENTIALSHADOWMAP}set useCloseExponentialShadowMap(e){const t=this._validateFilter(Ca.FILTER_CLOSEEXPONENTIALSHADOWMAP);(e||this.filter===Ca.FILTER_CLOSEEXPONENTIALSHADOWMAP)&&(this.filter=e?t:Ca.FILTER_NONE)}get useBlurCloseExponentialShadowMap(){return this.filter===Ca.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP}set useBlurCloseExponentialShadowMap(e){const t=this._validateFilter(Ca.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP);(e||this.filter===Ca.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)&&(this.filter=e?t:Ca.FILTER_NONE)}get usePercentageCloserFiltering(){return this.filter===Ca.FILTER_PCF}set usePercentageCloserFiltering(e){const t=this._validateFilter(Ca.FILTER_PCF);(e||this.filter===Ca.FILTER_PCF)&&(this.filter=e?t:Ca.FILTER_NONE)}get filteringQuality(){return this._filteringQuality}set filteringQuality(e){this._filteringQuality!==e&&(this._filteringQuality=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty())}get useContactHardeningShadow(){return this.filter===Ca.FILTER_PCSS}set useContactHardeningShadow(e){const t=this._validateFilter(Ca.FILTER_PCSS);(e||this.filter===Ca.FILTER_PCSS)&&(this.filter=e?t:Ca.FILTER_NONE)}get contactHardeningLightSizeUVRatio(){return this._contactHardeningLightSizeUVRatio}set contactHardeningLightSizeUVRatio(e){this._contactHardeningLightSizeUVRatio=e}get darkness(){return this._darkness}set darkness(e){this.setDarkness(e)}getDarkness(){return this._darkness}setDarkness(e){return this._darkness=e>=1?1:e<=0?0:e,this}get transparencyShadow(){return this._transparencyShadow}set transparencyShadow(e){this.setTransparencyShadow(e)}setTransparencyShadow(e){return this._transparencyShadow=e,this}getShadowMap(){return this._shadowMap}getShadowMapForRendering(){return this._shadowMap2?this._shadowMap2:this._shadowMap}getClassName(){return Ca.CLASSNAME}addShadowCaster(e,t=!0){if(!this._shadowMap)return this;if(this._shadowMap.renderList||(this._shadowMap.renderList=[]),-1===this._shadowMap.renderList.indexOf(e)&&this._shadowMap.renderList.push(e),t)for(const t of e.getChildMeshes())-1===this._shadowMap.renderList.indexOf(t)&&this._shadowMap.renderList.push(t);return this}removeShadowCaster(e,t=!0){if(!this._shadowMap||!this._shadowMap.renderList)return this;const i=this._shadowMap.renderList.indexOf(e);if(-1!==i&&this._shadowMap.renderList.splice(i,1),t)for(const t of e.getChildren())this.removeShadowCaster(t);return this}getLight(){return this._light}get mapSize(){return this._mapSize}set mapSize(e){this._mapSize=e,this._light._markMeshesAsLightDirty(),this.recreateShadowMap()}_initializeGenerator(){this._light._markMeshesAsLightDirty(),this._initializeShadowMap()}_createTargetRenderTexture(){const e=this._scene.getEngine();e._features.supportDepthStencilTexture?(this._shadowMap=new Ot._(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube(),void 0,!1,!1),this._shadowMap.createDepthStencilTexture(e.useReverseDepthBuffer?516:513,!0)):this._shadowMap=new Ot._(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube())}_initializeShadowMap(){if(this._createTargetRenderTexture(),null===this._shadowMap)return;this._shadowMap.wrapU=K.x.CLAMP_ADDRESSMODE,this._shadowMap.wrapV=K.x.CLAMP_ADDRESSMODE,this._shadowMap.anisotropicFilteringLevel=1,this._shadowMap.updateSamplingMode(K.x.BILINEAR_SAMPLINGMODE),this._shadowMap.renderParticles=!1,this._shadowMap.ignoreCameraViewport=!0,this._storedUniqueId&&(this._shadowMap.uniqueId=this._storedUniqueId),this._shadowMap.customRenderFunction=this._renderForShadowMap.bind(this),this._shadowMap.customIsReadyFunction=()=>!0;const e=this._scene.getEngine();this._shadowMap.onBeforeBindObservable.add((()=>{var t;this._currentSceneUBO=this._scene.getSceneUniformBuffer(),null===(t=e._debugPushGroup)||void 0===t||t.call(e,`shadow map generation for pass id ${e.currentRenderPassId}`,1)})),this._shadowMap.onBeforeRenderObservable.add((t=>{this._sceneUBOs&&this._scene.setSceneUniformBuffer(this._sceneUBOs[0]),this._currentFaceIndex=t,this._filter===Ca.FILTER_PCF&&e.setColorWrite(!1),this.getTransformMatrix(),this._scene.setTransformMatrix(this._viewMatrix,this._projectionMatrix),this._useUBO&&(this._scene.getSceneUniformBuffer().unbindEffect(),this._scene.finalizeSceneUbo())})),this._shadowMap.onAfterUnbindObservable.add((()=>{var t,i;if(this._sceneUBOs&&this._scene.setSceneUniformBuffer(this._currentSceneUBO),this._scene.updateTransformMatrix(),this._filter===Ca.FILTER_PCF&&e.setColorWrite(!0),!this.useBlurExponentialShadowMap&&!this.useBlurCloseExponentialShadowMap)return void(null===(t=e._debugPopGroup)||void 0===t||t.call(e,1));const n=this.getShadowMapForRendering();n&&(this._scene.postProcessManager.directRender(this._blurPostProcesses,n.renderTarget,!0),e.unBindFramebuffer(n.renderTarget,!0),null===(i=e._debugPopGroup)||void 0===i||i.call(e,1))}));const t=new a.HE(0,0,0,0),i=new a.HE(1,1,1,1);this._shadowMap.onClearObservable.add((e=>{this._filter===Ca.FILTER_PCF?e.clear(i,!1,!0,!1):this.useExponentialShadowMap||this.useBlurExponentialShadowMap?e.clear(t,!0,!0,!1):e.clear(i,!0,!0,!1)})),this._shadowMap.onResizeObservable.add((e=>{this._storedUniqueId=this._shadowMap.uniqueId,this._mapSize=e.getRenderSize(),this._light._markMeshesAsLightDirty(),this.recreateShadowMap()}));for(let e=Aa.$.MIN_RENDERINGGROUPS;e{e.setTexture("textureSampler",this._shadowMap)})),this._kernelBlurYPostprocess=new so(this._light.name+"KernelBlurY",new o.FM(0,1),this.blurKernel,1,null,K.x.BILINEAR_SAMPLINGMODE,e,!1,this._textureType),this._kernelBlurXPostprocess.autoClear=!1,this._kernelBlurYPostprocess.autoClear=!1,0===this._textureType&&(this._kernelBlurXPostprocess.packedFloat=!0,this._kernelBlurYPostprocess.packedFloat=!0),this._blurPostProcesses=[this._kernelBlurXPostprocess,this._kernelBlurYPostprocess]):(this._boxBlurPostprocess=new _t.D(this._light.name+"DepthBoxBlur","depthBoxBlur",["screenSize","boxOffset"],[],1,null,K.x.BILINEAR_SAMPLINGMODE,e,!1,"#define OFFSET "+this._blurBoxOffset,this._textureType),this._boxBlurPostprocess.externalTextureSamplerBinding=!0,this._boxBlurPostprocess.onApplyObservable.add((e=>{e.setFloat2("screenSize",t,t),e.setTexture("textureSampler",this._shadowMap)})),this._boxBlurPostprocess.autoClear=!1,this._blurPostProcesses=[this._boxBlurPostprocess])}_renderForShadowMap(e,t,i,n){let r;if(n.length)for(r=0;r{s===r||e?(s.getMeshUniformBuffer().bindToEffect(h,"Mesh"),s.transferToEffect(e?t:_)):(r.getMeshUniformBuffer().bindToEffect(h,"Mesh"),r.transferToEffect(t))})),this.forceBackFacesOnly&&a.setState(!0,0,!1,!1,l.cullBackFaces),this.onAfterShadowMapRenderObservable.notifyObservers(h),this.onAfterShadowMapRenderMeshObservable.notifyObservers(r)}else this._shadowMap&&this._shadowMap.resetRefreshCounter()}_applyFilterValues(){this._shadowMap&&(this.filter===Ca.FILTER_NONE||this.filter===Ca.FILTER_PCSS?this._shadowMap.updateSamplingMode(K.x.NEAREST_SAMPLINGMODE):this._shadowMap.updateSamplingMode(K.x.BILINEAR_SAMPLINGMODE))}forceCompilation(e,t){const i={useInstances:!1,...t},n=this.getShadowMap();if(!n)return void(e&&e(this));const r=n.renderList;if(!r)return void(e&&e(this));const s=new Array;for(const e of r)s.push(...e.subMeshes);if(0===s.length)return void(e&&e(this));let o=0;const a=()=>{var t,n;if(this._scene&&this._scene.getEngine()){for(;this.isReady(s[o],i.useInstances,null!==(n=null===(t=s[o].getMaterial())||void 0===t?void 0:t.needAlphaBlendingForMesh(s[o].getMesh()))&&void 0!==n&&n);)if(o++,o>=s.length)return void(e&&e(this));setTimeout(a,16)}};a()}forceCompilationAsync(e){return new Promise((t=>{this.forceCompilation((()=>{t()}),e)}))}_isReadyCustomDefines(e,t,i){}_prepareShadowDefines(e,t,i,n){i.push("#define SM_FLOAT "+(0!==this._textureType?"1":"0")),i.push("#define SM_ESM "+(this.useExponentialShadowMap||this.useBlurExponentialShadowMap?"1":"0")),i.push("#define SM_DEPTHTEXTURE "+(this.usePercentageCloserFiltering||this.useContactHardeningShadow?"1":"0"));const r=e.getMesh();return i.push("#define SM_NORMALBIAS "+(this.normalBias&&r.isVerticesDataPresent(le.o.NormalKind)?"1":"0")),i.push("#define SM_DIRECTIONINLIGHTDATA "+(this.getLight().getTypeID()===va._.LIGHTTYPEID_DIRECTIONALLIGHT?"1":"0")),i.push("#define SM_USEDISTANCE "+(this._light.needCube()?"1":"0")),i.push("#define SM_SOFTTRANSPARENTSHADOW "+(this.enableSoftTransparentShadow&&n?"1":"0")),this._isReadyCustomDefines(i,e,t),i}isReady(e,t,i){var n;const r=e.getMaterial(),s=null==r?void 0:r.shadowDepthWrapper,o=[];if(this._prepareShadowDefines(e,t,o,i),s){if(!s.isReadyForSubMesh(e,o,this,t,this._scene.getEngine().currentRenderPassId))return!1}else{const i=e._getDrawWrapper(void 0,!0);let s=i.effect,a=i.defines;const l=[le.o.PositionKind],c=e.getMesh();if(this.normalBias&&c.isVerticesDataPresent(le.o.NormalKind)&&(l.push(le.o.NormalKind),o.push("#define NORMAL"),c.nonUniformScaling&&o.push("#define NONUNIFORMSCALING")),r&&r.needAlphaTesting()){let e=null;if(e=this.useOpacityTextureForTransparentShadow?r.opacityTexture:r.getAlphaTestTexture(),e){if(!e.isReady())return!1;const t=null!==(n=r.alphaCutOff)&&void 0!==n?n:Ca.DEFAULT_ALPHA_CUTOFF;o.push("#define ALPHATEST"),o.push(`#define ALPHATESTVALUE ${t}${t%1==0?".":""}`),c.isVerticesDataPresent(le.o.UVKind)&&(l.push(le.o.UVKind),o.push("#define UV1")),c.isVerticesDataPresent(le.o.UV2Kind)&&1===e.coordinatesIndex&&(l.push(le.o.UV2Kind),o.push("#define UV2"))}}const h=new uo.L;if(c.useBones&&c.computeBonesUsingShaders&&c.skeleton){l.push(le.o.MatricesIndicesKind),l.push(le.o.MatricesWeightsKind),c.numBoneInfluencers>4&&(l.push(le.o.MatricesIndicesExtraKind),l.push(le.o.MatricesWeightsExtraKind));const e=c.skeleton;o.push("#define NUM_BONE_INFLUENCERS "+c.numBoneInfluencers),c.numBoneInfluencers>0&&h.addCPUSkinningFallback(0,c),e.isUsingTextureForMatrices?o.push("#define BONETEXTURE"):o.push("#define BonesPerMesh "+(e.bones.length+1))}else o.push("#define NUM_BONE_INFLUENCERS 0");const _=c.morphTargetManager;let d=0;_&&_.numInfluencers>0&&(o.push("#define MORPHTARGETS"),d=_.numInfluencers,o.push("#define NUM_MORPH_INFLUENCERS "+d),_.isUsingTextureForTargets&&o.push("#define MORPHTARGETS_TEXTURE"),lo.G.PrepareAttributesForMorphTargetsInfluencers(l,c,d));const u=this._scene;if(u.clipPlane&&o.push("#define CLIPPLANE"),u.clipPlane2&&o.push("#define CLIPPLANE2"),u.clipPlane3&&o.push("#define CLIPPLANE3"),u.clipPlane4&&o.push("#define CLIPPLANE4"),u.clipPlane5&&o.push("#define CLIPPLANE5"),u.clipPlane6&&o.push("#define CLIPPLANE6"),t&&(o.push("#define INSTANCES"),lo.G.PushAttributesForInstances(l),e.getRenderingMesh().hasThinInstances&&o.push("#define THIN_INSTANCES")),this.customShaderOptions&&this.customShaderOptions.defines)for(const e of this.customShaderOptions.defines)-1===o.indexOf(e)&&o.push(e);const p=o.join("\n");if(a!==p){a=p;let e="shadowMap";const t=["world","mBones","viewProjection","diffuseMatrix","lightDataSM","depthValuesSM","biasAndScaleSM","morphTargetInfluences","boneTextureWidth","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","softTransparentShadowSM","morphTargetTextureInfo","morphTargetTextureIndices"],n=["diffuseSampler","boneSampler","morphTargets"],r=["Scene","Mesh"];if(this.customShaderOptions){if(e=this.customShaderOptions.shaderName,this.customShaderOptions.attributes)for(const e of this.customShaderOptions.attributes)-1===l.indexOf(e)&&l.push(e);if(this.customShaderOptions.uniforms)for(const e of this.customShaderOptions.uniforms)-1===t.indexOf(e)&&t.push(e);if(this.customShaderOptions.samplers)for(const e of this.customShaderOptions.samplers)-1===n.indexOf(e)&&n.push(e)}const o=this._scene.getEngine();s=o.createEffect(e,{attributes:l,uniformsNames:t,uniformBuffersNames:r,samplers:n,defines:p,fallbacks:h,onCompiled:null,onError:null,indexParameters:{maxSimultaneousMorphTargets:d}},o),i.setEffect(s,a)}if(!s.isReady())return!1}return(this.useBlurExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(this._blurPostProcesses&&this._blurPostProcesses.length||this._initializeBlurRTTAndPostProcesses()),!(this._kernelBlurXPostprocess&&!this._kernelBlurXPostprocess.isReady()||this._kernelBlurYPostprocess&&!this._kernelBlurYPostprocess.isReady()||this._boxBlurPostprocess&&!this._boxBlurPostprocess.isReady())}prepareDefines(e,t){const i=this._scene,n=this._light;i.shadowsEnabled&&n.shadowEnabled&&(e["SHADOW"+t]=!0,this.useContactHardeningShadow?(e["SHADOWPCSS"+t]=!0,this._filteringQuality===Ca.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===Ca.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)):this.usePercentageCloserFiltering?(e["SHADOWPCF"+t]=!0,this._filteringQuality===Ca.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===Ca.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)):this.usePoissonSampling?e["SHADOWPOISSON"+t]=!0:this.useExponentialShadowMap||this.useBlurExponentialShadowMap?e["SHADOWESM"+t]=!0:(this.useCloseExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(e["SHADOWCLOSEESM"+t]=!0),n.needCube()&&(e["SHADOWCUBE"+t]=!0))}bindShadowLight(e,t){const i=this._light,n=this._scene;if(!n.shadowsEnabled||!i.shadowEnabled)return;const r=n.activeCamera;if(!r)return;const s=this.getShadowMap();s&&(i.needCube()||t.setMatrix("lightMatrix"+e,this.getTransformMatrix()),this._filter===Ca.FILTER_PCF?(t.setDepthStencilTexture("shadowSampler"+e,this.getShadowMapForRendering()),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),s.getSize().width,1/s.getSize().width,this.frustumEdgeFalloff,e)):this._filter===Ca.FILTER_PCSS?(t.setDepthStencilTexture("shadowSampler"+e,this.getShadowMapForRendering()),t.setTexture("depthSampler"+e,this.getShadowMapForRendering()),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),1/s.getSize().width,this._contactHardeningLightSizeUVRatio*s.getSize().width,this.frustumEdgeFalloff,e)):(t.setTexture("shadowSampler"+e,this.getShadowMapForRendering()),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),this.blurScale/s.getSize().width,this.depthScale,this.frustumEdgeFalloff,e)),i._uniformBuffer.updateFloat2("depthValues",this.getLight().getDepthMinZ(r),this.getLight().getDepthMinZ(r)+this.getLight().getDepthMaxZ(r),e))}getTransformMatrix(){const e=this._scene;if(this._currentRenderId===e.getRenderId()&&this._currentFaceIndexCache===this._currentFaceIndex)return this._transformMatrix;this._currentRenderId=e.getRenderId(),this._currentFaceIndexCache=this._currentFaceIndex;let t=this._light.position;if(this._light.computeTransformedInformation()&&(t=this._light.transformedPosition),o.P.NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex),this._lightDirection),1===Math.abs(o.P.Dot(this._lightDirection,o.P.Up()))&&(this._lightDirection.z=1e-13),this._light.needProjectionMatrixCompute()||!this._cachedPosition||!this._cachedDirection||!t.equals(this._cachedPosition)||!this._lightDirection.equals(this._cachedDirection)){this._cachedPosition.copyFrom(t),this._cachedDirection.copyFrom(this._lightDirection),o.y3.LookAtLHToRef(t,t.add(this._lightDirection),o.P.Up(),this._viewMatrix);const e=this.getShadowMap();if(e){const t=e.renderList;t&&this._light.setShadowProjectionMatrix(this._projectionMatrix,this._viewMatrix,t)}this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix)}return this._transformMatrix}recreateShadowMap(){const e=this._shadowMap;if(!e)return;const t=e.renderList;if(this._disposeRTTandPostProcesses(),this._initializeGenerator(),this.filter=this._filter,this._applyFilterValues(),t){this._shadowMap.renderList||(this._shadowMap.renderList=[]);for(const e of t)this._shadowMap.renderList.push(e)}else this._shadowMap.renderList=null}_disposeBlurPostProcesses(){this._shadowMap2&&(this._shadowMap2.dispose(),this._shadowMap2=null),this._boxBlurPostprocess&&(this._boxBlurPostprocess.dispose(),this._boxBlurPostprocess=null),this._kernelBlurXPostprocess&&(this._kernelBlurXPostprocess.dispose(),this._kernelBlurXPostprocess=null),this._kernelBlurYPostprocess&&(this._kernelBlurYPostprocess.dispose(),this._kernelBlurYPostprocess=null),this._blurPostProcesses=[]}_disposeRTTandPostProcesses(){this._shadowMap&&(this._shadowMap.dispose(),this._shadowMap=null),this._disposeBlurPostProcesses()}_disposeSceneUBOs(){if(this._sceneUBOs){for(const e of this._sceneUBOs)e.dispose();this._sceneUBOs=[]}}dispose(){this._disposeRTTandPostProcesses(),this._disposeSceneUBOs(),this._light&&(this._light._shadowGenerator=null,this._light._markMeshesAsLightDirty()),this.onBeforeShadowMapRenderMeshObservable.clear(),this.onBeforeShadowMapRenderObservable.clear(),this.onAfterShadowMapRenderMeshObservable.clear(),this.onAfterShadowMapRenderObservable.clear()}serialize(){const e={},t=this.getShadowMap();if(!t)return e;if(e.className=this.getClassName(),e.lightId=this._light.id,e.id=this.id,e.mapSize=t.getRenderSize(),e.forceBackFacesOnly=this.forceBackFacesOnly,e.darkness=this.getDarkness(),e.transparencyShadow=this._transparencyShadow,e.frustumEdgeFalloff=this.frustumEdgeFalloff,e.bias=this.bias,e.normalBias=this.normalBias,e.usePercentageCloserFiltering=this.usePercentageCloserFiltering,e.useContactHardeningShadow=this.useContactHardeningShadow,e.contactHardeningLightSizeUVRatio=this.contactHardeningLightSizeUVRatio,e.filteringQuality=this.filteringQuality,e.useExponentialShadowMap=this.useExponentialShadowMap,e.useBlurExponentialShadowMap=this.useBlurExponentialShadowMap,e.useCloseExponentialShadowMap=this.useBlurExponentialShadowMap,e.useBlurCloseExponentialShadowMap=this.useBlurExponentialShadowMap,e.usePoissonSampling=this.usePoissonSampling,e.depthScale=this.depthScale,e.blurBoxOffset=this.blurBoxOffset,e.blurKernel=this.blurKernel,e.blurScale=this.blurScale,e.useKernelBlur=this.useKernelBlur,e.renderList=[],t.renderList)for(let i=0;i{throw(0,_a.S)("ShadowGeneratorSceneComponent")};dt.v.ShadersStore.depthPixelShader="#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include\nvarying float vDepthMetric;\n#ifdef PACKED\n#include\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#ifdef NONLINEARDEPTH\n#ifdef PACKED\ngl_FragColor=pack(gl_FragCoord.z);\n#else\ngl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0);\n#endif\n#else\n#ifdef PACKED\ngl_FragColor=pack(vDepthMetric);\n#else\ngl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0);\n#endif\n#endif\n}";dt.v.ShadersStore.depthVertexShader="attribute vec3 position;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nuniform mat4 viewProjection;\nuniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvarying float vDepthMetric;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#include\ngl_Position=viewProjection*worldPos;\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetric=((-gl_Position.z+depthValues.x)/(depthValues.y));\n#else\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\n#endif\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n";class Sa{constructor(e,t=1,i=null,n=!1,r=K.x.TRILINEAR_SAMPLINGMODE){this.enabled=!0,this.forceDepthWriteTransparentMeshes=!1,this.useOnlyInActiveCamera=!1,this._scene=e,this._storeNonLinearDepth=n,this.isPacked=0===t,this.isPacked?this._clearColor=new a.HE(1,1,1,1):this._clearColor=new a.HE(1,0,0,1),Sa._SceneComponentInitialization(this._scene);const s=e.getEngine();this._camera=i,r!==K.x.NEAREST_SAMPLINGMODE&&(1!==t||s._caps.textureFloatLinearFiltering||(r=K.x.NEAREST_SAMPLINGMODE),2!==t||s._caps.textureHalfFloatLinearFiltering||(r=K.x.NEAREST_SAMPLINGMODE));const o=this.isPacked||!s._features.supportExtendedTextureFormats?5:6;this._depthMap=new Ot._("DepthRenderer",{width:s.getRenderWidth(),height:s.getRenderHeight()},this._scene,!1,!0,t,!1,r,void 0,void 0,void 0,o),this._depthMap.wrapU=K.x.CLAMP_ADDRESSMODE,this._depthMap.wrapV=K.x.CLAMP_ADDRESSMODE,this._depthMap.refreshRate=1,this._depthMap.renderParticles=!1,this._depthMap.renderList=null,this._depthMap.activeCamera=this._camera,this._depthMap.ignoreCameraViewport=!0,this._depthMap.useCameraPostProcesses=!1,this._depthMap.onClearObservable.add((e=>{e.clear(this._clearColor,!0,!0,!0)})),this._depthMap.onBeforeBindObservable.add((()=>{var e;null===(e=s._debugPushGroup)||void 0===e||e.call(s,"depth renderer",1)})),this._depthMap.onAfterUnbindObservable.add((()=>{var e;null===(e=s._debugPopGroup)||void 0===e||e.call(s,1)})),this._depthMap.customIsReadyFunction=(e,t)=>{if(!e.isReady(!1))return!1;if(0===t&&e.subMeshes)for(let t=0;t{var t,i;const n=e.getRenderingMesh(),r=e.getEffectiveMesh(),s=this._scene,o=s.getEngine(),a=e.getMaterial();if(r._internalAbstractMeshDataInfo._isActiveIntermediate=!1,!a||r.infiniteDistance||a.disableDepthWrite||0===e.verticesCount||e._renderId===s.getRenderId())return;const l=r._getWorldMatrixDeterminant()<0;let c=null!==(t=n.overrideMaterialSideOrientation)&&void 0!==t?t:a.sideOrientation;l&&(c=0===c?1:0);const h=0===c;o.setState(a.backFaceCulling,0,!1,h,a.cullBackFaces);const _=n._getInstancesRenderList(e._id,!!e.getReplacementMesh());if(_.mustReturn)return;const d=o.getCaps().instancedArrays&&(null!==_.visibleInstances[e._id]&&void 0!==_.visibleInstances[e._id]||n.hasThinInstances),u=this._camera||s.activeCamera;if(this.isReady(e,d)&&u){e._renderId=s.getRenderId();const t=null===(i=r._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===i?void 0:i[o.currentRenderPassId];let l=e._getDrawWrapper();!l&&t&&(l=t._getDrawWrapper());const c=u.mode===Le.V.ORTHOGRAPHIC_CAMERA;if(!l)return;const h=l.effect;let p,f;if(o.enableEffect(l),d||n._bind(e,h,a.fillMode),t?t.bindForSubMesh(r.getWorldMatrix(),r,e):(h.setMatrix("viewProjection",s.getTransformMatrix()),h.setMatrix("world",r.getWorldMatrix())),c?(p=!o.useReverseDepthBuffer&&o.isNDCHalfZRange?0:1,f=o.useReverseDepthBuffer&&o.isNDCHalfZRange?0:1):(p=o.useReverseDepthBuffer&&o.isNDCHalfZRange?u.minZ:o.isNDCHalfZRange?0:u.minZ,f=o.useReverseDepthBuffer&&o.isNDCHalfZRange?0:u.maxZ),h.setFloat2("depthValues",p,p+f),!t){if(a&&a.needAlphaTesting()){const e=a.getAlphaTestTexture();e&&(h.setTexture("diffuseSampler",e),h.setMatrix("diffuseMatrix",e.getTextureMatrix()))}if(n.useBones&&n.computeBonesUsingShaders&&n.skeleton){const e=n.skeleton;if(e.isUsingTextureForMatrices){const t=e.getTransformMatrixTexture(n);if(!t)return;h.setTexture("boneSampler",t),h.setFloat("boneTextureWidth",4*(e.bones.length+1))}else h.setMatrices("mBones",e.getTransformMatrices(n))}lo.G.BindClipPlane(h,s),lo.G.BindMorphTargetParameters(n,h),n.morphTargetManager&&n.morphTargetManager.isUsingTextureForTargets&&n.morphTargetManager._bind(h)}n._processRendering(r,e,h,a.fillMode,_,d,((e,t)=>h.setMatrix("world",t)))}};this._depthMap.customRenderFunction=(e,t,i,n)=>{let r;if(n.length)for(r=0;r4&&(c.push(le.o.MatricesIndicesExtraKind),c.push(le.o.MatricesWeightsExtraKind)),l.push("#define NUM_BONE_INFLUENCERS "+r.numBoneInfluencers),l.push("#define BonesPerMesh "+(r.skeleton?r.skeleton.bones.length+1:0));const t=e.getRenderingMesh().skeleton;(null==t?void 0:t.isUsingTextureForMatrices)&&l.push("#define BONETEXTURE")}else l.push("#define NUM_BONE_INFLUENCERS 0");const h=r.morphTargetManager;let _=0;h&&h.numInfluencers>0&&(_=h.numInfluencers,l.push("#define MORPHTARGETS"),l.push("#define NUM_MORPH_INFLUENCERS "+_),h.isUsingTextureForTargets&&l.push("#define MORPHTARGETS_TEXTURE"),lo.G.PrepareAttributesForMorphTargetsInfluencers(c,r,_)),t&&(l.push("#define INSTANCES"),lo.G.PushAttributesForInstances(c),e.getRenderingMesh().hasThinInstances&&l.push("#define THIN_INSTANCES")),this._storeNonLinearDepth&&l.push("#define NONLINEARDEPTH"),this.isPacked&&l.push("#define PACKED"),s.clipPlane&&l.push("#define CLIPPLANE"),s.clipPlane2&&l.push("#define CLIPPLANE2"),s.clipPlane3&&l.push("#define CLIPPLANE3"),s.clipPlane4&&l.push("#define CLIPPLANE4"),s.clipPlane5&&l.push("#define CLIPPLANE5"),s.clipPlane6&&l.push("#define CLIPPLANE6");const d=e._getDrawWrapper(void 0,!0),u=d.defines,p=l.join("\n");return u!==p&&d.setEffect(n.createEffect("depth",c,["world","mBones","boneTextureWidth","viewProjection","diffuseMatrix","depthValues","morphTargetInfluences","morphTargetTextureInfo","morphTargetTextureIndices","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6"],["diffuseSampler","morphTargets","boneSampler"],p,void 0,void 0,void 0,{maxSimultaneousMorphTargets:_}),p),d.effect.isReady()}getDepthMap(){return this._depthMap}dispose(){const e=[];for(const t in this._scene._depthRenderer)this._scene._depthRenderer[t]===this&&e.push(t);if(e.length>0){this._depthMap.dispose();for(const t of e)delete this._scene._depthRenderer[t]}}}Sa._SceneComponentInitialization=e=>{throw(0,_a.S)("DepthRendererSceneComponent")};var xa=i("../../../node_modules/@babylonjs/core/PostProcesses/postProcessManager.js");dt.v.ShadersStore.minmaxReduxPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#if defined(INITIAL)\nuniform sampler2D sourceTexture;\nuniform vec2 texSize;\nvoid main(void)\n{\nivec2 coord=ivec2(vUV*(texSize-1.0));\nfloat f1=texelFetch(sourceTexture,coord,0).r;\nfloat f2=texelFetch(sourceTexture,coord+ivec2(1,0),0).r;\nfloat f3=texelFetch(sourceTexture,coord+ivec2(1,1),0).r;\nfloat f4=texelFetch(sourceTexture,coord+ivec2(0,1),0).r;\nfloat minz=min(min(min(f1,f2),f3),f4);\n#ifdef DEPTH_REDUX\nfloat maxz=max(max(max(sign(1.0-f1)*f1,sign(1.0-f2)*f2),sign(1.0-f3)*f3),sign(1.0-f4)*f4);\n#else\nfloat maxz=max(max(max(f1,f2),f3),f4);\n#endif\nglFragColor=vec4(minz,maxz,0.,0.);\n}\n#elif defined(MAIN)\nuniform vec2 texSize;\nvoid main(void)\n{\nivec2 coord=ivec2(vUV*(texSize-1.0));\nvec2 f1=texelFetch(textureSampler,coord,0).rg;\nvec2 f2=texelFetch(textureSampler,coord+ivec2(1,0),0).rg;\nvec2 f3=texelFetch(textureSampler,coord+ivec2(1,1),0).rg;\nvec2 f4=texelFetch(textureSampler,coord+ivec2(0,1),0).rg;\nfloat minz=min(min(min(f1.x,f2.x),f3.x),f4.x);\nfloat maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);\nglFragColor=vec4(minz,maxz,0.,0.);\n}\n#elif defined(ONEBEFORELAST)\nuniform ivec2 texSize;\nvoid main(void)\n{\nivec2 coord=ivec2(vUV*vec2(texSize-1));\nvec2 f1=texelFetch(textureSampler,coord % texSize,0).rg;\nvec2 f2=texelFetch(textureSampler,(coord+ivec2(1,0)) % texSize,0).rg;\nvec2 f3=texelFetch(textureSampler,(coord+ivec2(1,1)) % texSize,0).rg;\nvec2 f4=texelFetch(textureSampler,(coord+ivec2(0,1)) % texSize,0).rg;\nfloat minz=min(f1.x,f2.x);\nfloat maxz=max(f1.y,f2.y);\nglFragColor=vec4(minz,maxz,0.,0.);\n}\n#elif defined(LAST)\nvoid main(void)\n{\nglFragColor=vec4(0.);\nif (true) { \ndiscard;\n}\n}\n#endif\n";class Ta{constructor(e){this.onAfterReductionPerformed=new s.y$,this._forceFullscreenViewport=!0,this._activated=!1,this._camera=e,this._postProcessManager=new xa.O(e.getScene()),this._onContextRestoredObserver=e.getEngine().onContextRestoredObservable.add((()=>{this._postProcessManager._rebuild()}))}get sourceTexture(){return this._sourceTexture}setSourceTexture(e,t,i=2,n=!0){if(e===this._sourceTexture)return;this.dispose(!1),this._sourceTexture=e,this._reductionSteps=[],this._forceFullscreenViewport=n;const r=this._camera.getScene(),s=new _t.D("Initial reduction phase","minmaxRedux",["texSize"],["sourceTexture"],1,null,1,r.getEngine(),!1,"#define INITIAL"+(t?"\n#define DEPTH_REDUX":""),i,void 0,void 0,void 0,7);s.autoClear=!1,s.forceFullscreenViewport=n;let o=this._sourceTexture.getRenderWidth(),a=this._sourceTexture.getRenderHeight();s.onApply=((e,t)=>i=>{i.setTexture("sourceTexture",this._sourceTexture),i.setFloat2("texSize",e,t)})(o,a),this._reductionSteps.push(s);let l=1;for(;o>1||a>1;){o=Math.max(Math.round(o/2),1),a=Math.max(Math.round(a/2),1);const e=new _t.D("Reduction phase "+l,"minmaxRedux",["texSize"],null,{width:o,height:a},null,1,r.getEngine(),!1,"#define "+(1==o&&1==a?"LAST":1==o||1==a?"ONEBEFORELAST":"MAIN"),i,void 0,void 0,void 0,7);if(e.autoClear=!1,e.forceFullscreenViewport=n,e.onApply=((e,t)=>i=>{1==e||1==t?i.setInt2("texSize",e,t):i.setFloat2("texSize",e,t)})(o,a),this._reductionSteps.push(e),l++,1==o&&1==a){const t=(e,t,i)=>{const n=new Float32Array(4*e*t),s={min:0,max:0};return()=>{r.getEngine()._readTexturePixels(i.inputTexture.texture,e,t,-1,0,n,!1),s.min=n[0],s.max=n[1],this.onAfterReductionPerformed.notifyObservers(s)}};e.onAfterRenderObservable.add(t(o,a,e))}}}get refreshRate(){return this._sourceTexture?this._sourceTexture.refreshRate:-1}set refreshRate(e){this._sourceTexture&&(this._sourceTexture.refreshRate=e)}get activated(){return this._activated}activate(){!this._onAfterUnbindObserver&&this._sourceTexture&&(this._onAfterUnbindObserver=this._sourceTexture.onAfterUnbindObservable.add((()=>{var e,t;const i=this._camera.getScene().getEngine();null===(e=i._debugPushGroup)||void 0===e||e.call(i,"min max reduction",1),this._reductionSteps[0].activate(this._camera),this._postProcessManager.directRender(this._reductionSteps,this._reductionSteps[0].inputTexture,this._forceFullscreenViewport),i.unBindFramebuffer(this._reductionSteps[0].inputTexture,!1),null===(t=i._debugPopGroup)||void 0===t||t.call(i,1)})),this._activated=!0)}deactivate(){this._onAfterUnbindObserver&&this._sourceTexture&&(this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=null,this._activated=!1)}dispose(e=!0){if(e&&(this.onAfterReductionPerformed.clear(),this._onContextRestoredObserver&&(this._camera.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)),this.deactivate(),this._reductionSteps){for(let e=0;et&&(e=0,t=1),e<0&&(e=0),t>1&&(t=1),this._minDistance=e,this._maxDistance=t,this._breaksAreDirty=!0)}get minDistance(){return this._minDistance}get maxDistance(){return this._maxDistance}getClassName(){return Oa.CLASSNAME}getCascadeMinExtents(e){return e>=0&&e=0&&ethis._scene.activeCamera.maxZ||(this._shadowMaxZ=e,this._light._markMeshesAsLightDirty(),this._breaksAreDirty=!0):this._shadowMaxZ=e}get debug(){return this._debug}set debug(e){this._debug=e,this._light._markMeshesAsLightDirty()}get depthClamp(){return this._depthClamp}set depthClamp(e){this._depthClamp=e}get cascadeBlendPercentage(){return this._cascadeBlendPercentage}set cascadeBlendPercentage(e){this._cascadeBlendPercentage=e,this._light._markMeshesAsLightDirty()}get lambda(){return this._lambda}set lambda(e){const t=Math.min(Math.max(e,0),1);this._lambda!=t&&(this._lambda=t,this._breaksAreDirty=!0)}getCascadeViewMatrix(e){return e>=0&&e=0&&e=0&&e{let t=e.min,i=e.max;t>=i&&(t=0,i=1),t==this._minDistance&&i==this._maxDistance||this.setMinMaxDistance(t,i)})),this._depthReducer.setDepthRenderer(this._depthRenderer)),this._depthReducer.activate()}}get autoCalcDepthBoundsRefreshRate(){var e,t,i;return null!==(i=null===(t=null===(e=this._depthReducer)||void 0===e?void 0:e.depthRenderer)||void 0===t?void 0:t.getDepthMap().refreshRate)&&void 0!==i?i:-1}set autoCalcDepthBoundsRefreshRate(e){var t;(null===(t=this._depthReducer)||void 0===t?void 0:t.depthRenderer)&&(this._depthReducer.depthRenderer.getDepthMap().refreshRate=e)}splitFrustum(){this._breaksAreDirty=!0}_splitFrustum(){const e=this._scene.activeCamera;if(!e)return;const t=e.minZ,i=e.maxZ,n=i-t,r=this._minDistance,s=t+r*n,o=t+(this._shadowMaxZ=t?Math.min((this._shadowMaxZ-t)/(i-t),this._maxDistance):this._maxDistance)*n,a=o-s,l=o/s;for(let e=0;e{this._sceneUBOs&&this._scene.setSceneUniformBuffer(this._sceneUBOs[t]),this._currentLayer=t,this._filter===Ca.FILTER_PCF&&e.setColorWrite(!1),this._scene.setTransformMatrix(this.getCascadeViewMatrix(t),this.getCascadeProjectionMatrix(t)),this._useUBO&&(this._scene.getSceneUniformBuffer().unbindEffect(),this._scene.finalizeSceneUbo())})),this._shadowMap.onBeforeBindObservable.add((()=>{var t;this._currentSceneUBO=this._scene.getSceneUniformBuffer(),null===(t=e._debugPushGroup)||void 0===t||t.call(e,`cascaded shadow map generation for pass id ${e.currentRenderPassId}`,1),this._breaksAreDirty&&this._splitFrustum(),this._computeMatrices()})),this._splitFrustum()}_bindCustomEffectForRenderSubMeshForShadowMap(e,t){t.setMatrix("viewProjection",this.getCascadeTransformMatrix(this._currentLayer))}_isReadyCustomDefines(e){e.push("#define SM_DEPTHCLAMP "+(this._depthClamp&&this._filter!==Ca.FILTER_PCSS?"1":"0"))}prepareDefines(e,t){super.prepareDefines(e,t);const i=this._scene,n=this._light;if(!i.shadowsEnabled||!n.shadowEnabled)return;e["SHADOWCSM"+t]=!0,e["SHADOWCSMDEBUG"+t]=this.debug,e["SHADOWCSMNUM_CASCADES"+t]=this.numCascades,e["SHADOWCSM_RIGHTHANDED"+t]=i.useRightHandedSystem;const r=i.activeCamera;r&&this._shadowMaxZnew Oa(e,t)));return void 0!==e.numCascades&&(i.numCascades=e.numCascades),void 0!==e.debug&&(i.debug=e.debug),void 0!==e.stabilizeCascades&&(i.stabilizeCascades=e.stabilizeCascades),void 0!==e.lambda&&(i.lambda=e.lambda),void 0!==e.cascadeBlendPercentage&&(i.cascadeBlendPercentage=e.cascadeBlendPercentage),void 0!==e.depthClamp&&(i.depthClamp=e.depthClamp),void 0!==e.autoCalcDepthBounds&&(i.autoCalcDepthBounds=e.autoCalcDepthBounds),void 0!==e.shadowMaxZ&&(i.shadowMaxZ=e.shadowMaxZ),void 0!==e.penumbraDarkness&&(i.penumbraDarkness=e.penumbraDarkness),void 0!==e.freezeShadowCastersBoundingInfo&&(i.freezeShadowCastersBoundingInfo=e.freezeShadowCastersBoundingInfo),void 0!==e.minDistance&&void 0!==e.maxDistance&&i.setMinMaxDistance(e.minDistance,e.maxDistance),i}}Oa._FrustumCornersNDCSpace=[new o.P(-1,1,-1),new o.P(1,1,-1),new o.P(1,-1,-1),new o.P(-1,-1,-1),new o.P(-1,1,1),new o.P(1,1,1),new o.P(1,-1,1),new o.P(-1,-1,1)],Oa.CLASSNAME="CascadedShadowGenerator",Oa.DEFAULT_CASCADES_COUNT=4,Oa.MIN_CASCADES_COUNT=2,Oa.MAX_CASCADES_COUNT=4,Oa._SceneComponentInitialization=e=>{throw(0,_a.S)("ShadowGeneratorSceneComponent")},n.p.AddParser(z.l.NAME_SHADOWGENERATOR,((e,t)=>{if(void 0!==e.shadowGenerators&&null!==e.shadowGenerators)for(let i=0,n=e.shadowGenerators.length;i{let t=e._getComponent(z.l.NAME_SHADOWGENERATOR);t||(t=new wa(e),e._addComponent(t))};var Fa=i("../../../node_modules/@babylonjs/core/Lights/pointLight.js");class Ba{constructor(e,t="",i="black"){this._renderingCanvas=e,this._loadingText=t,this._loadingDivBackgroundColor=i,this._resizeLoadingUI=()=>{const e=this._renderingCanvas.getBoundingClientRect(),t=window.getComputedStyle(this._renderingCanvas).position;this._loadingDiv&&(this._loadingDiv.style.position="fixed"===t?"fixed":"absolute",this._loadingDiv.style.left=e.left+"px",this._loadingDiv.style.top=e.top+"px",this._loadingDiv.style.width=e.width+"px",this._loadingDiv.style.height=e.height+"px")}}displayLoadingUI(){if(this._loadingDiv)return;this._loadingDiv=document.createElement("div"),this._loadingDiv.id="babylonjsLoadingDiv",this._loadingDiv.style.opacity="0",this._loadingDiv.style.transition="opacity 1.5s ease",this._loadingDiv.style.pointerEvents="none",this._loadingDiv.style.display="grid",this._loadingDiv.style.gridTemplateRows="100%",this._loadingDiv.style.gridTemplateColumns="100%",this._loadingDiv.style.justifyItems="center",this._loadingDiv.style.alignItems="center",this._loadingTextDiv=document.createElement("div"),this._loadingTextDiv.style.position="absolute",this._loadingTextDiv.style.left="0",this._loadingTextDiv.style.top="50%",this._loadingTextDiv.style.marginTop="80px",this._loadingTextDiv.style.width="100%",this._loadingTextDiv.style.height="20px",this._loadingTextDiv.style.fontFamily="Arial",this._loadingTextDiv.style.fontSize="14px",this._loadingTextDiv.style.color="white",this._loadingTextDiv.style.textAlign="center",this._loadingTextDiv.style.zIndex="1",this._loadingTextDiv.innerHTML="Loading",this._loadingDiv.appendChild(this._loadingTextDiv),this._loadingTextDiv.innerHTML=this._loadingText,this._style=document.createElement("style"),this._style.type="text/css",this._style.innerHTML="@-webkit-keyframes spin1 { 0% { -webkit-transform: rotate(0deg);}\n 100% { -webkit-transform: rotate(360deg);}\n } @keyframes spin1 { 0% { transform: rotate(0deg);}\n 100% { transform: rotate(360deg);}\n }",document.getElementsByTagName("head")[0].appendChild(this._style);const e=!!window.SVGSVGElement,t=new Image;Ba.DefaultLogoUrl?t.src=Ba.DefaultLogoUrl:t.src=e?"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik05MC4wOSwwLDAsNTJWMTU2bDkwLjA5LDUyLDkwLjA4LTUyVjUyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxODAuMTcgNTIuMDEgMTUxLjk3IDM1LjczIDEyNC44NSA1MS4zOSAxNTMuMDUgNjcuNjcgMTgwLjE3IDUyLjAxIi8+PHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjI3LjEyIDY3LjY3IDExNy4yMSAxNS42NiA5MC4wOCAwIDAgNTIuMDEgMjcuMTIgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iNjEuODkgMTIwLjMgOTAuMDggMTM2LjU4IDExOC4yOCAxMjAuMyA5MC4wOCAxMDQuMDIgNjEuODkgMTIwLjMiLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDE1My4wNSAxNDAuMzcgOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyAwIDUyLjAxIDAgMTU2LjAzIDkwLjA4IDIwOC4wNCAxODAuMTcgMTU2LjAzIDE4MC4xNyA1Mi4wMSAxNTMuMDUgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iOTAuMDggNzEuNDYgNjEuODkgODcuNzQgNjEuODkgMTIwLjMgOTAuMDggMTA0LjAyIDExOC4yOCAxMjAuMyAxMTguMjggODcuNzQgOTAuMDggNzEuNDYiLz48cG9seWdvbiBjbGFzcz0iY2xzLTQiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDExOC4yOCA4Ny43NCAxMTguMjggMTIwLjMgOTAuMDggMTM2LjU4IDkwLjA4IDE3Ni43MiAxNTMuMDUgMTQwLjM3IDE1My4wNSA2Ny42NyIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIyNy4xMiA2Ny42NyA2MS44OSA4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+":"https://cdn.babylonjs.com/Assets/babylonLogo.png",t.style.width="150px",t.style.gridColumn="1",t.style.gridRow="1",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.position="absolute";const i=document.createElement("div");i.style.width="300px",i.style.gridColumn="1",i.style.gridRow="1",i.style.top="50%",i.style.left="50%",i.style.transform="translate(-50%, -50%)",i.style.position="absolute";const n=new Image;if(Ba.DefaultSpinnerUrl?n.src=Ba.DefaultSpinnerUrl:n.src=e?"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJsMy4zNi01LjEsMy41Mi01YzEuMjMtMS42MywyLjQxLTMuMjksMy42NS00LjkxczIuNTMtMy4yMSwzLjgyLTQuNzlBMTg1LjIsMTg1LjIsMCwwLDEsODMuNCw2Ny40M2EyMDgsMjA4LDAsMCwxLDE5LTE1LjY2YzMuMzUtMi40MSw2Ljc0LTQuNzgsMTAuMjUtN3M3LjExLTQuMjgsMTAuNzUtNi4zMmM3LjI5LTQsMTQuNzMtOCwyMi41My0xMS40OSwzLjktMS43Miw3Ljg4LTMuMywxMi00LjY0YTEwNC4yMiwxMDQuMjIsMCwwLDEsMTIuNDQtMy4yMyw2Mi40NCw2Mi40NCwwLDAsMSwxMi43OC0xLjM5QTI1LjkyLDI1LjkyLDAsMCwxLDE5NiwyMS40NGE2LjU1LDYuNTUsMCwwLDEsMi4wNSw5LDYuNjYsNi42NiwwLDAsMS0xLjY0LDEuNzhsLS40MS4yOWEyMi4wNywyMi4wNywwLDAsMS01Ljc4LDMsMzAuNDIsMzAuNDIsMCwwLDEtNS42NywxLjYyLDM3LjgyLDM3LjgyLDAsMCwxLTUuNjkuNzFjLTEsMC0xLjkuMTgtMi44NS4yNmwtMi44NS4yNHEtNS43Mi41MS0xMS40OCwxLjFjLTMuODQuNC03LjcxLjgyLTExLjU4LDEuNGExMTIuMzQsMTEyLjM0LDAsMCwwLTIyLjk0LDUuNjFjLTMuNzIsMS4zNS03LjM0LDMtMTAuOTQsNC42NHMtNy4xNCwzLjUxLTEwLjYsNS41MUExNTEuNiwxNTEuNiwwLDAsMCw2OC41Niw4N0M2Ny4yMyw4OC40OCw2Niw5MCw2NC42NCw5MS41NnMtMi41MSwzLjE1LTMuNzUsNC43M2wtMy41NCw0LjljLTEuMTMsMS42Ni0yLjIzLDMuMzUtMy4zMyw1YTEyNywxMjcsMCwwLDAtMTAuOTMsMjEuNDksMS41OCwxLjU4LDAsMSwxLTMtMS4xNVM0MC4xOSwxMjYuNDcsNDAuMjEsMTI2LjQzWiIvPjxyZWN0IGNsYXNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg==":"https://cdn.babylonjs.com/Assets/loadingIcon.png",n.style.animation="spin1 0.75s infinite linear",n.style.webkitAnimation="spin1 0.75s infinite linear",n.style.transformOrigin="50% 50%",n.style.webkitTransformOrigin="50% 50%",!e){const e={w:16,h:18.5},i={w:30,h:30};t.style.width=`${e.w}vh`,t.style.height=`${e.h}vh`,t.style.left=`calc(50% - ${e.w/2}vh)`,t.style.top=`calc(50% - ${e.h/2}vh)`,n.style.width=`${i.w}vh`,n.style.height=`${i.h}vh`,n.style.left=`calc(50% - ${i.w/2}vh)`,n.style.top=`calc(50% - ${i.h/2}vh)`}i.appendChild(n),this._loadingDiv.appendChild(t),this._loadingDiv.appendChild(i),this._resizeLoadingUI(),window.addEventListener("resize",this._resizeLoadingUI),this._loadingDiv.style.backgroundColor=this._loadingDivBackgroundColor,document.body.appendChild(this._loadingDiv),this._loadingDiv.style.opacity="1"}hideLoadingUI(){this._loadingDiv&&(this._loadingDiv.style.opacity="0",this._loadingDiv.addEventListener("transitionend",(()=>{this._loadingTextDiv&&(this._loadingTextDiv.remove(),this._loadingTextDiv=null),this._loadingDiv&&(this._loadingDiv.remove(),this._loadingDiv=null),this._style&&(this._style.remove(),this._style=null),window.removeEventListener("resize",this._resizeLoadingUI)})))}set loadingUIText(e){this._loadingText=e,this._loadingTextDiv&&(this._loadingTextDiv.innerHTML=this._loadingText)}get loadingUIText(){return this._loadingText}get loadingUIBackgroundColor(){return this._loadingDivBackgroundColor}set loadingUIBackgroundColor(e){this._loadingDivBackgroundColor=e,this._loadingDiv&&(this._loadingDiv.style.backgroundColor=this._loadingDivBackgroundColor)}}Ba.DefaultLogoUrl="",Ba.DefaultSpinnerUrl="",k.D.DefaultLoadingScreenFactory=e=>new Ba(e);var Na=i("../../../node_modules/@babylonjs/core/Meshes/geometry.js"),La=i("../../../node_modules/@babylonjs/core/Materials/multiMaterial.js");class ka{static ConvertPanoramaToCubemap(e,t,i,n){if(!e)throw"ConvertPanoramaToCubemap: input cannot be null";if(e.length!=t*i*3)throw"ConvertPanoramaToCubemap: input size is wrong";return{front:this.CreateCubemapTexture(n,this.FACE_FRONT,e,t,i),back:this.CreateCubemapTexture(n,this.FACE_BACK,e,t,i),left:this.CreateCubemapTexture(n,this.FACE_LEFT,e,t,i),right:this.CreateCubemapTexture(n,this.FACE_RIGHT,e,t,i),up:this.CreateCubemapTexture(n,this.FACE_UP,e,t,i),down:this.CreateCubemapTexture(n,this.FACE_DOWN,e,t,i),size:n,type:1,format:4,gammaSpace:!1}}static CreateCubemapTexture(e,t,i,n,r){const s=new ArrayBuffer(e*e*4*3),o=new Float32Array(s),a=t[1].subtract(t[0]).scale(1/e),l=t[3].subtract(t[2]).scale(1/e),c=1/e;let h=0;for(let s=0;sMath.PI;)r-=2*Math.PI;let o=r/Math.PI;const a=s/Math.PI;o=.5*o+.5;let l=Math.round(o*i);l<0?l=0:l>=i&&(l=i-1);let c=Math.round(a*n);c<0?c=0:c>=n&&(c=n-1);const h=n-c-1;return{r:t[h*i*3+3*l+0],g:t[h*i*3+3*l+1],b:t[h*i*3+3*l+2]}}}ka.FACE_LEFT=[new o.P(-1,-1,-1),new o.P(1,-1,-1),new o.P(-1,1,-1),new o.P(1,1,-1)],ka.FACE_RIGHT=[new o.P(1,-1,1),new o.P(-1,-1,1),new o.P(1,1,1),new o.P(-1,1,1)],ka.FACE_FRONT=[new o.P(1,-1,-1),new o.P(1,-1,1),new o.P(1,1,-1),new o.P(1,1,1)],ka.FACE_BACK=[new o.P(-1,-1,1),new o.P(-1,-1,-1),new o.P(-1,1,1),new o.P(-1,1,-1)],ka.FACE_DOWN=[new o.P(1,1,-1),new o.P(1,1,1),new o.P(-1,1,-1),new o.P(-1,1,1)],ka.FACE_UP=[new o.P(-1,-1,-1),new o.P(-1,-1,1),new o.P(1,-1,-1),new o.P(1,-1,1)];class Va{static _Ldexp(e,t){return t>1023?e*Math.pow(2,1023)*Math.pow(2,t-1023):t<-1074?e*Math.pow(2,-1074)*Math.pow(2,t+1074):e*Math.pow(2,t)}static _Rgbe2float(e,t,i,n,r,s){r>0?(r=this._Ldexp(1,r-136),e[s+0]=t*r,e[s+1]=i*r,e[s+2]=n*r):(e[s+0]=0,e[s+1]=0,e[s+2]=0)}static _ReadStringLine(e,t){let i="",n="";for(let r=t;r32767)throw"HDR Bad header format, unsupported size";return o+=n.length+1,{height:t,width:i,dataPosition:o}}static GetCubeMapTextureData(e,t){const i=new Uint8Array(e),n=this.RGBE_ReadHeader(i),r=this.RGBE_ReadPixels(i,n);return ka.ConvertPanoramaToCubemap(r,n.width,n.height,t)}static RGBE_ReadPixels(e,t){return this._RGBEReadPixelsRLE(e,t)}static _RGBEReadPixelsRLE(e,t){let i=t.height;const n=t.width;let r,s,o,a,l,c=t.dataPosition,h=0,_=0,d=0;const u=new ArrayBuffer(4*n),p=new Uint8Array(u),f=new ArrayBuffer(t.width*t.height*4*3),m=new Float32Array(f);for(;i>0;){if(r=e[c++],s=e[c++],o=e[c++],a=e[c++],2!=r||2!=s||128&o||t.width<8||t.width>32767)return this._RGBEReadPixelsNOTRLE(e,t);if((o<<8|a)!=n)throw"HDR Bad header format, wrong scan line width";for(h=0,d=0;d<4;d++)for(_=(d+1)*n;h<_;)if(r=e[c++],s=e[c++],r>128){if(l=r-128,0==l||l>_-h)throw"HDR Bad Format, bad scanline data (run)";for(;l-- >0;)p[h++]=s}else{if(l=r,0==l||l>_-h)throw"HDR Bad Format, bad scanline data (non-run)";if(p[h++]=s,--l>0)for(let t=0;t0;){for(l=0;l{this._indexBuffer=e.createIndexBuffer(t.indices);for(const e in this._vertexBuffers)this._vertexBuffers[e]._rebuild()}))}setViewport(e=this._fullscreenViewport){this._engine.setViewport(e)}bindBuffers(e){this._engine.bindBuffers(this._vertexBuffers,this._indexBuffer,e)}applyEffectWrapper(e){this._engine.depthCullingState.depthTest=!1,this._engine.stencilState.stencilTest=!1,this._engine.enableEffect(e._drawWrapper),this.bindBuffers(e.effect),e.onApplyObservable.notifyObservers({})}restoreStates(){this._engine.depthCullingState.depthTest=!0,this._engine.stencilState.stencilTest=!0}draw(){this._engine.drawElementsType(0,0,6)}_isRenderTargetTexture(e){return void 0!==e.renderTarget}render(e,t=null){if(!e.effect.isReady())return;this.setViewport();const i=null===t?null:this._isRenderTargetTexture(t)?t.renderTarget:t;i&&this._engine.bindFramebuffer(i),this.applyEffectWrapper(e),this.draw(),i&&this._engine.unBindFramebuffer(i),this.restoreStates()}dispose(){const e=this._vertexBuffers[le.o.PositionKind];e&&(e.dispose(),delete this._vertexBuffers[le.o.PositionKind]),this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._onContextRestoredObserver&&(this._engine.onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)}}Ua._DefaultOptions={positions:[1,1,-1,1,-1,-1,1,-1],indices:[0,1,2,0,2,3]};class Ga{constructor(e){let t;this.onApplyObservable=new s.y$;const i=e.uniformNames||[];e.vertexShader?t={fragmentSource:e.fragmentShader,vertexSource:e.vertexShader,spectorName:e.name||"effectWrapper"}:(i.push("scale"),t={fragmentSource:e.fragmentShader,vertex:"postprocess",spectorName:e.name||"effectWrapper"},this.onApplyObservable.add((()=>{this.effect.setFloat2("scale",1,1)})));const n=e.defines?e.defines.join("\n"):"";this._drawWrapper=new Tn.q(e.engine),e.useShaderStore?(t.fragment=t.fragmentSource,t.vertex||(t.vertex=t.vertexSource),delete t.fragmentSource,delete t.vertexSource,this.effect=e.engine.createEffect(t,e.attributeNames||["position"],i,e.samplerNames,n,void 0,e.onCompiled,void 0,void 0,e.shaderLanguage)):(this.effect=new mn.Q(t,e.attributeNames||["position"],i,e.samplerNames,e.engine,n,void 0,e.onCompiled,void 0,void 0,void 0,e.shaderLanguage),this._onContextRestoredObserver=e.engine.onContextRestoredObservable.add((()=>{this.effect._pipelineContext=null,this.effect._wasPreviouslyReady=!1,this.effect._prepareEffect()})))}get effect(){return this._drawWrapper.effect}set effect(e){this._drawWrapper.effect=e}dispose(){this._onContextRestoredObserver&&(this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null),this.effect.dispose()}}dt.v.ShadersStore.hdrFilteringVertexShader="attribute vec2 position;\nvarying vec3 direction;\nuniform vec3 up;\nuniform vec3 right;\nuniform vec3 front;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nmat3 view=mat3(up,right,front);\ndirection=view*vec3(position,1.0);\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/importanceSampling.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBRDFFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/hdrFilteringFunctions.js");dt.v.ShadersStore.hdrFilteringPixelShader="#include\n#include\n#include\n#include\nuniform float alphaG;\nuniform samplerCube inputTexture;\nuniform vec2 vFilteringInfo;\nuniform float hdrScale;\nvarying vec3 direction;\nvoid main() {\nvec3 color=radiance(alphaG,inputTexture,direction,vFilteringInfo);\ngl_FragColor=vec4(color*hdrScale,1.0);\n}";class ja{constructor(e,t={}){this._lodGenerationOffset=0,this._lodGenerationScale=.8,this.quality=4096,this.hdrScale=1,this._engine=e,this.hdrScale=t.hdrScale||this.hdrScale,this.quality=t.quality||this.quality}_createRenderTarget(e){let t=0;this._engine.getCaps().textureHalfFloatRender?t=2:this._engine.getCaps().textureFloatRender&&(t=1);const i=this._engine.createRenderTargetCubeTexture(e,{format:5,type:t,createMipMaps:!0,generateMipMaps:!1,generateDepthBuffer:!1,generateStencilBuffer:!1,samplingMode:1});return this._engine.updateTextureWrappingMode(i.texture,0,0,0),this._engine.updateTextureSamplingMode(3,i.texture,!0),i}_prefilterInternal(e){const t=e.getSize().width,i=ve.R.ILog2(t)+1,n=this._effectWrapper.effect,r=this._createRenderTarget(t);this._effectRenderer.setViewport();const s=e.getInternalTexture();s&&this._engine.updateTextureSamplingMode(3,s,!0),this._effectRenderer.applyEffectWrapper(this._effectWrapper);const o=[[new Br.P(0,0,-1),new Br.P(0,-1,0),new Br.P(1,0,0)],[new Br.P(0,0,1),new Br.P(0,-1,0),new Br.P(-1,0,0)],[new Br.P(1,0,0),new Br.P(0,0,1),new Br.P(0,1,0)],[new Br.P(1,0,0),new Br.P(0,0,-1),new Br.P(0,-1,0)],[new Br.P(1,0,0),new Br.P(0,-1,0),new Br.P(0,0,1)],[new Br.P(-1,0,0),new Br.P(0,-1,0),new Br.P(0,0,-1)]];n.setFloat("hdrScale",this.hdrScale),n.setFloat2("vFilteringInfo",e.getSize().width,i),n.setTexture("inputTexture",e);for(let e=0;e<6;e++){n.setVector3("up",o[e][0]),n.setVector3("right",o[e][1]),n.setVector3("front",o[e][2]);for(let s=0;s{this._effectRenderer=new Ua(this._engine),this._effectWrapper=this._createEffect(e),this._effectWrapper.effect.executeWhenCompiled((()=>{this._prefilterInternal(e),this._effectRenderer.dispose(),this._effectWrapper.dispose(),i(),t&&t()}))})):(u.Y.Warn("HDR prefiltering is not available in WebGL 1., you can use real time filtering instead."),Promise.reject("HDR prefiltering is not available in WebGL 1., you can use real time filtering instead."))}}i("../../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.polynomial.js");class Wa extends ro.V{constructor(e,t,i,n=!1,r=!0,a=!1,l=!1,c=null,h=null){var _;super(t),this._generateHarmonics=!0,this._onError=null,this._isBlocking=!0,this._rotationY=0,this.boundingBoxPosition=o.P.Zero(),this.onLoadObservable=new s.y$,e&&(this._coordinatesMode=K.x.CUBIC_MODE,this.name=e,this.url=e,this.hasAlpha=!1,this.isCube=!0,this._textureMatrix=o.y3.Identity(),this._prefilterOnLoad=l,this._onLoad=()=>{this.onLoadObservable.notifyObservers(this),c&&c()},this._onError=h,this.gammaSpace=a,this._noMipmap=n,this._size=i,this._generateHarmonics=r,this._texture=this._getFromCache(e,this._noMipmap,void 0,void 0,void 0,this.isCube),this._texture?this._texture.isReady?V.w1.SetImmediate((()=>this._onLoad())):this._texture.onLoadedObservable.add(this._onLoad):(null===(_=this.getScene())||void 0===_?void 0:_.useDelayedTextureLoading)?this.delayLoadState=4:this._loadTexture())}set isBlocking(e){this._isBlocking=e}get isBlocking(){return this._isBlocking}set rotationY(e){this._rotationY=e,this.setReflectionTextureMatrix(o.y3.RotationY(this._rotationY))}get rotationY(){return this._rotationY}set boundingBoxSize(e){if(this._boundingBoxSize&&this._boundingBoxSize.equals(e))return;this._boundingBoxSize=e;const t=this.getScene();t&&t.markAllMaterialsAsDirty(1)}get boundingBoxSize(){return this._boundingBoxSize}getClassName(){return"HDRCubeTexture"}_loadTexture(){const e=this._getEngine(),t=e.getCaps();let i=0;if(t.textureFloat&&t.textureFloatLinearFiltering?i=1:t.textureHalfFloat&&t.textureHalfFloatLinearFiltering&&(i=2),e._features.allowTexturePrefiltering&&this._prefilterOnLoad){const t=this._onLoad,i=new ja(e);this._onLoad=()=>{i.prefilter(this,t)}}this._texture=e.createRawCubeTextureFromUrl(this.url,this.getScene(),this._size,4,i,this._noMipmap,(e=>{this.lodGenerationOffset=0,this.lodGenerationScale=.8;const t=Va.GetCubeMapTextureData(e,this._size);if(this._generateHarmonics){const e=Ao.$.ConvertCubeMapToSphericalPolynomial(t);this.sphericalPolynomial=e}const n=[];let r=null,s=null;for(let e=0;e<6;e++){2===i?s=new Uint16Array(this._size*this._size*3):0===i&&(r=new Uint8Array(this._size*this._size*3));const o=t[Wa._FacesMapping[e]];if(this.gammaSpace||s||r)for(let e=0;e255){const e=255/s;t*=e,i*=e,n*=e}r[3*e+0]=t,r[3*e+1]=i,r[3*e+2]=n}s?n.push(s):r?n.push(r):n.push(o)}return n}),null,this._onLoad,this._onError)}clone(){const e=new Wa(this.url,this.getScene()||this._getEngine(),this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace);return e.level=this.level,e.wrapU=this.wrapU,e.wrapV=this.wrapV,e.coordinatesIndex=this.coordinatesIndex,e.coordinatesMode=this.coordinatesMode,e}delayLoad(){4===this.delayLoadState&&(this.delayLoadState=1,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||this._loadTexture())}getReflectionTextureMatrix(){return this._textureMatrix}setReflectionTextureMatrix(e){var t;this._textureMatrix=e,e.updateFlag!==this._textureMatrix.updateFlag&&e.isIdentity()!==this._textureMatrix.isIdentity()&&(null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(1,(e=>-1!==e.getActiveTextures().indexOf(this))))}dispose(){this.onLoadObservable.clear(),super.dispose()}static Parse(e,t,i){let n=null;return e.name&&!e.isRenderTarget&&(n=new Wa(i+e.name,t,e.size,e.noMipmap,e.generateHarmonics,e.useInGammaSpace),n.name=e.name,n.hasAlpha=e.hasAlpha,n.level=e.level,n.coordinatesMode=e.coordinatesMode,n.isBlocking=e.isBlocking),n&&(e.boundingBoxPosition&&(n.boundingBoxPosition=o.P.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(n.boundingBoxSize=o.P.FromArray(e.boundingBoxSize)),e.rotationY&&(n.rotationY=e.rotationY)),n}serialize(){if(!this.name)return null;const e={};return e.name=this.name,e.hasAlpha=this.hasAlpha,e.isCube=!0,e.level=this.level,e.size=this._size,e.coordinatesMode=this.coordinatesMode,e.useInGammaSpace=this.gammaSpace,e.generateHarmonics=this._generateHarmonics,e.customType="BABYLON.HDRCubeTexture",e.noMipmap=this._noMipmap,e.isBlocking=this._isBlocking,e.rotationY=this._rotationY,e}}Wa._FacesMapping=["right","left","up","down","front","back"],(0,l.H)("BABYLON.HDRCubeTexture",Wa);var za=i("../../../node_modules/@babylonjs/core/Morph/morphTargetManager.js"),Ha=i("../../../node_modules/@babylonjs/core/Physics/physicsJoint.js");class Xa{constructor(e,t=Xa.DefaultPluginFactory()){if(this._physicsPlugin=t,this._impostors=[],this._joints=[],this._subTimeStep=0,this._uniqueIdCounter=0,!this._physicsPlugin.isSupported())throw new Error("Physics Engine "+this._physicsPlugin.name+" cannot be found. Please make sure it is included.");e=e||new o.P(0,-9.807,0),this.setGravity(e),this.setTimeStep()}static DefaultPluginFactory(){throw(0,_a.S)("CannonJSPlugin")}setGravity(e){this.gravity=e,this._physicsPlugin.setGravity(this.gravity)}setTimeStep(e=1/60){this._physicsPlugin.setTimeStep(e)}getTimeStep(){return this._physicsPlugin.getTimeStep()}setSubTimeStep(e=0){this._subTimeStep=e}getSubTimeStep(){return this._subTimeStep}dispose(){this._impostors.forEach((function(e){e.dispose()})),this._physicsPlugin.dispose()}getPhysicsPluginName(){return this._physicsPlugin.name}addImpostor(e){this._impostors.push(e),e.uniqueId=this._uniqueIdCounter++,e.parent||this._physicsPlugin.generatePhysicsBody(e)}removeImpostor(e){const t=this._impostors.indexOf(e);t>-1&&this._impostors.splice(t,1).length&&this.getPhysicsPlugin().removePhysicsBody(e)}addJoint(e,t,i){const n={mainImpostor:e,connectedImpostor:t,joint:i};i.physicsPlugin=this._physicsPlugin,this._joints.push(n),this._physicsPlugin.generateJoint(n)}removeJoint(e,t,i){const n=this._joints.filter((function(n){return n.connectedImpostor===t&&n.joint===i&&n.mainImpostor===e}));n.length&&this._physicsPlugin.removeJoint(n[0])}_step(e){this._impostors.forEach((e=>{e.isBodyInitRequired()&&this._physicsPlugin.generatePhysicsBody(e)})),e>.1?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._impostors)}getPhysicsPlugin(){return this._physicsPlugin}getImpostors(){return this._impostors}getImpostorForPhysicsObject(e){for(let t=0;t0&&(this._physicsBodiesToRemoveAfterStep.forEach((e=>{"function"==typeof this.world.removeBody?this.world.removeBody(e):this.world.remove(e)})),this._physicsBodiesToRemoveAfterStep.length=0)}applyImpulse(e,t,i){const n=new this.BJSCANNON.Vec3(i.x,i.y,i.z),r=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyImpulse(r,n)}applyForce(e,t,i){const n=new this.BJSCANNON.Vec3(i.x,i.y,i.z),r=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyForce(r,n)}generatePhysicsBody(e){if(this._removeMarkedPhysicsBodiesFromWorld(),e.parent)e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate());else{if(e.isBodyInitRequired()){const t=this._createShape(e);if(!t)return void u.Y.Warn("It was not possible to create a physics body for this object.");const i=e.physicsBody;i&&this.removePhysicsBody(e);const n=this._addMaterial("mat-"+e.uniqueId,e.getParam("friction"),e.getParam("restitution")),r={mass:e.getParam("mass"),material:n},s=e.getParam("nativeOptions");for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&(r[e]=s[e]);e.physicsBody=new this.BJSCANNON.Body(r),e.physicsBody.addEventListener("collide",e.onCollide),this.world.addEventListener("preStep",e.beforeStep),this.world.addEventListener("postStep",e.afterStep),e.physicsBody.addShape(t),"function"==typeof this.world.addBody?this.world.addBody(e.physicsBody):this.world.add(e.physicsBody),i&&["force","torque","velocity","angularVelocity"].forEach((function(t){const n=i[t];e.physicsBody[t].set(n.x,n.y,n.z)})),this._processChildMeshes(e)}this._updatePhysicsBodyTransformation(e)}}_processChildMeshes(e){const t=e.object.getChildMeshes?e.object.getChildMeshes(!0):[],i=e.object.rotationQuaternion;if(i?i.conjugateToRef(this._tmpQuaternion):this._tmpQuaternion.set(0,0,0,1),t.length){const i=t=>{if(!t.rotationQuaternion)return;const n=t.getPhysicsImpostor();if(n&&n.parent!==e&&t.parent){const i=t.getAbsolutePosition().subtract(t.parent.getAbsolutePosition()),r=t.rotationQuaternion.multiply(this._tmpQuaternion);n.physicsBody&&(this.removePhysicsBody(n),n.physicsBody=null),n.parent=e,n.resetUpdateFlags(),e.physicsBody.addShape(this._createShape(n),new this.BJSCANNON.Vec3(i.x,i.y,i.z),new this.BJSCANNON.Quaternion(r.x,r.y,r.z,r.w)),e.physicsBody.mass+=n.getParam("mass")}t.getChildMeshes(!0).filter((e=>!!e.physicsImpostor)).forEach(i)};t.filter((e=>!!e.physicsImpostor)).forEach(i)}}removePhysicsBody(e){e.physicsBody.removeEventListener("collide",e.onCollide),this.world.removeEventListener("preStep",e.beforeStep),this.world.removeEventListener("postStep",e.afterStep),-1===this._physicsBodiesToRemoveAfterStep.indexOf(e.physicsBody)&&this._physicsBodiesToRemoveAfterStep.push(e.physicsBody)}generateJoint(e){const t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(!t||!i)return;let n;const r=e.joint.jointData,s={pivotA:r.mainPivot?(new this.BJSCANNON.Vec3).set(r.mainPivot.x,r.mainPivot.y,r.mainPivot.z):null,pivotB:r.connectedPivot?(new this.BJSCANNON.Vec3).set(r.connectedPivot.x,r.connectedPivot.y,r.connectedPivot.z):null,axisA:r.mainAxis?(new this.BJSCANNON.Vec3).set(r.mainAxis.x,r.mainAxis.y,r.mainAxis.z):null,axisB:r.connectedAxis?(new this.BJSCANNON.Vec3).set(r.connectedAxis.x,r.connectedAxis.y,r.connectedAxis.z):null,maxForce:r.nativeParams.maxForce,collideConnected:!!r.collision};switch(e.joint.type){case Ha.q7.HingeJoint:case Ha.q7.Hinge2Joint:n=new this.BJSCANNON.HingeConstraint(t,i,s);break;case Ha.q7.DistanceJoint:n=new this.BJSCANNON.DistanceConstraint(t,i,r.maxDistance||2);break;case Ha.q7.SpringJoint:{const e=r;n=new this.BJSCANNON.Spring(t,i,{restLength:e.length,stiffness:e.stiffness,damping:e.damping,localAnchorA:s.pivotA,localAnchorB:s.pivotB});break}case Ha.q7.LockJoint:n=new this.BJSCANNON.LockConstraint(t,i,s);break;case Ha.q7.PointToPointJoint:case Ha.q7.BallAndSocketJoint:default:n=new this.BJSCANNON.PointToPointConstraint(t,s.pivotA,i,s.pivotB,s.maxForce)}n.collideConnected=!!r.collision,e.joint.physicsJoint=n,e.joint.type!==Ha.q7.SpringJoint?this.world.addConstraint(n):(e.joint.jointData.forceApplicationCallback=e.joint.jointData.forceApplicationCallback||function(){n.applyForce()},e.mainImpostor.registerAfterPhysicsStep(e.joint.jointData.forceApplicationCallback))}removeJoint(e){e.joint.type!==Ha.q7.SpringJoint?this.world.removeConstraint(e.joint.physicsJoint):e.mainImpostor.unregisterAfterPhysicsStep(e.joint.jointData.forceApplicationCallback)}_addMaterial(e,t,i){let n,r;for(n=0;n1e3*i));e++);this.time+=n;const a=this.time%i/i,l=e,c=this.bodies;for(let e=0;e!==c.length;e++){const i=c[e];i.type!==t.Body.STATIC&&i.sleepState!==t.Body.SLEEPING?(i.position.vsub(i.previousPosition,l),l.scale(a,l),i.position.vadd(l,i.interpolatedPosition)):(i.interpolatedPosition.set(i.position.x,i.position.y,i.position.z),i.interpolatedQuaternion.set(i.quaternion.x,i.quaternion.y,i.quaternion.z,i.quaternion.w))}}}}raycast(e,t){return this._cannonRaycastResult.reset(),this.world.raycastClosest(e,t,{},this._cannonRaycastResult),this._raycastResult.reset(e,t),this._cannonRaycastResult.hasHit&&(this._raycastResult.setHitData({x:this._cannonRaycastResult.hitNormalWorld.x,y:this._cannonRaycastResult.hitNormalWorld.y,z:this._cannonRaycastResult.hitNormalWorld.z},{x:this._cannonRaycastResult.hitPointWorld.x,y:this._cannonRaycastResult.hitPointWorld.y,z:this._cannonRaycastResult.hitPointWorld.z}),this._raycastResult.setHitDistance(this._cannonRaycastResult.distance)),this._raycastResult}}Xa.DefaultPluginFactory=()=>new Qa;class qa{constructor(e=!0,t,i=OIMO){this._useDeltaForWorldStep=e,this.name="OimoJSPlugin",this._fixedTimeStep=1/60,this._tmpImpostorsArray=[],this._tmpPositionVector=o.P.Zero(),this.BJSOIMO=i,this.world=new this.BJSOIMO.World({iterations:t}),this.world.clear(),this._raycastResult=new Ya}setGravity(e){this.world.gravity.set(e.x,e.y,e.z)}setTimeStep(e){this.world.timeStep=e}getTimeStep(){return this.world.timeStep}executeStep(e,t){t.forEach((function(e){e.beforeStep()})),this.world.timeStep=this._useDeltaForWorldStep?e:this._fixedTimeStep,this.world.step(),t.forEach((e=>{e.afterStep(),this._tmpImpostorsArray[e.uniqueId]=e}));let i=this.world.contacts;for(;null!==i;){if(i.touching&&!i.body1.sleeping&&!i.body2.sleeping){i=i.next;continue}const e=this._tmpImpostorsArray[+i.body1.name],t=this._tmpImpostorsArray[+i.body2.name];e&&t?(e.onCollide({body:t.physicsBody,point:null,distance:0,impulse:0,normal:null}),t.onCollide({body:e.physicsBody,point:null,distance:0,impulse:0,normal:null}),i=i.next):i=i.next}}applyImpulse(e,t,i){const n=e.physicsBody.mass;e.physicsBody.applyImpulse(i.scale(this.world.invScale),t.scale(this.world.invScale*n))}applyForce(e,t,i){u.Y.Warn("Oimo doesn't support applying force. Using impulse instead."),this.applyImpulse(e,t,i)}generatePhysicsBody(e){if(e.parent)e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate());else{if(e.isBodyInitRequired()){const i={name:e.uniqueId,config:[e.getParam("mass")||.001,e.getParam("friction"),e.getParam("restitution")],size:[],type:[],pos:[],posShape:[],rot:[],rotShape:[],move:0!==e.getParam("mass"),density:e.getParam("mass"),friction:e.getParam("friction"),restitution:e.getParam("restitution"),world:this.world},n=[e];(t=e.object).getChildMeshes&&t.getChildMeshes().forEach((function(e){e.physicsImpostor&&n.push(e.physicsImpostor)}));const r=e=>Math.max(e,Xa.Epsilon),s=new o._f;n.forEach((t=>{if(!t.object.rotationQuaternion)return;const n=t.object.rotationQuaternion;s.copyFrom(n),t.object.rotationQuaternion.set(0,0,0,1),t.object.computeWorldMatrix(!0);const o=s.toEulerAngles(),a=t.getObjectExtents(),l=57.29577951308232;if(t===e){const t=e.getObjectCenter();e.object.getAbsolutePivotPoint().subtractToRef(t,this._tmpPositionVector),this._tmpPositionVector.divideInPlace(e.object.scaling),i.pos.push(t.x),i.pos.push(t.y),i.pos.push(t.z),i.posShape.push(0,0,0),i.rotShape.push(0,0,0)}else{const e=t.object.position.clone();i.posShape.push(e.x),i.posShape.push(e.y),i.posShape.push(e.z),i.rotShape.push(o.x*l,o.y*l,o.z*l)}switch(t.object.rotationQuaternion.copyFrom(s),t.type){case tn.Q.ParticleImpostor:u.Y.Warn("No Particle support in OIMO.js. using SphereImpostor instead");case tn.Q.SphereImpostor:{const e=a.x,t=a.y,n=a.z,s=Math.max(r(e),r(t),r(n))/2;i.type.push("sphere"),i.size.push(s),i.size.push(s),i.size.push(s);break}case tn.Q.CylinderImpostor:{const e=r(a.x)/2,t=r(a.y);i.type.push("cylinder"),i.size.push(e),i.size.push(t),i.size.push(t);break}case tn.Q.PlaneImpostor:case tn.Q.BoxImpostor:default:{const e=r(a.x),t=r(a.y),n=r(a.z);i.type.push("box"),i.size.push(e),i.size.push(t),i.size.push(n);break}}t.object.rotationQuaternion=n})),e.physicsBody=this.world.add(i),e.physicsBody.resetQuaternion(s),e.physicsBody.updatePosition(0)}else this._tmpPositionVector.copyFromFloats(0,0,0);e.setDeltaPosition(this._tmpPositionVector)}var t}removePhysicsBody(e){this.world.removeRigidBody(e.physicsBody)}generateJoint(e){const t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(!t||!i)return;const n=e.joint.jointData,r=n.nativeParams||{};let s;const o={body1:t,body2:i,axe1:r.axe1||(n.mainAxis?n.mainAxis.asArray():null),axe2:r.axe2||(n.connectedAxis?n.connectedAxis.asArray():null),pos1:r.pos1||(n.mainPivot?n.mainPivot.asArray():null),pos2:r.pos2||(n.connectedPivot?n.connectedPivot.asArray():null),min:r.min,max:r.max,collision:r.collision||n.collision,spring:r.spring,world:this.world};switch(e.joint.type){case Ha.q7.BallAndSocketJoint:s="jointBall";break;case Ha.q7.SpringJoint:{u.Y.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");const e=n;o.min=e.length||o.min,o.max=Math.max(o.min,o.max)}case Ha.q7.DistanceJoint:s="jointDistance",o.max=n.maxDistance;break;case Ha.q7.PrismaticJoint:s="jointPrisme";break;case Ha.q7.SliderJoint:s="jointSlide";break;case Ha.q7.WheelJoint:s="jointWheel";break;case Ha.q7.HingeJoint:default:s="jointHinge"}o.type=s,e.joint.physicsJoint=this.world.add(o)}removeJoint(e){try{this.world.removeJoint(e.joint.physicsJoint)}catch(e){u.Y.Warn(e)}}isSupported(){return void 0!==this.BJSOIMO}setTransformationFromPhysicsBody(e){if(!e.physicsBody.sleeping){if(e.physicsBody.shapes.next){let t=e.physicsBody.shapes;for(;t.next;)t=t.next;e.object.position.set(t.position.x,t.position.y,t.position.z)}else{const t=e.physicsBody.getPosition();e.object.position.set(t.x,t.y,t.z)}if(e.object.rotationQuaternion){const t=e.physicsBody.getQuaternion();e.object.rotationQuaternion.set(t.x,t.y,t.z,t.w)}}}setPhysicsBodyTransformation(e,t,i){const n=e.physicsBody;e.physicsBody.shapes.next||(n.position.set(t.x,t.y,t.z),n.orientation.set(i.x,i.y,i.z,i.w),n.syncShapes(),n.awake())}setLinearVelocity(e,t){e.physicsBody.linearVelocity.set(t.x,t.y,t.z)}setAngularVelocity(e,t){e.physicsBody.angularVelocity.set(t.x,t.y,t.z)}getLinearVelocity(e){const t=e.physicsBody.linearVelocity;return t?new o.P(t.x,t.y,t.z):null}getAngularVelocity(e){const t=e.physicsBody.angularVelocity;return t?new o.P(t.x,t.y,t.z):null}setBodyMass(e,t){const i=0===t;e.physicsBody.shapes.density=i?1:t,e.physicsBody.setupMass(i?2:1)}getBodyMass(e){return e.physicsBody.shapes.density}getBodyFriction(e){return e.physicsBody.shapes.friction}setBodyFriction(e,t){e.physicsBody.shapes.friction=t}getBodyRestitution(e){return e.physicsBody.shapes.restitution}setBodyRestitution(e,t){e.physicsBody.shapes.restitution=t}sleepBody(e){e.physicsBody.sleep()}wakeUpBody(e){e.physicsBody.awake()}updateDistanceJoint(e,t,i){e.physicsJoint.limitMotor.upperLimit=t,void 0!==i&&(e.physicsJoint.limitMotor.lowerLimit=i)}setMotor(e,t,i,n){void 0!==i?u.Y.Warn("OimoJS plugin currently has unexpected behavior when using setMotor with force parameter"):i=1e6,t*=-1;const r=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;r&&r.setMotor(t,i)}setLimit(e,t,i,n){const r=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;r&&r.setLimit(t,void 0===i?-t:i)}syncMeshWithImpostor(e,t){const i=t.physicsBody;e.position.x=i.position.x,e.position.y=i.position.y,e.position.z=i.position.z,e.rotationQuaternion&&(e.rotationQuaternion.x=i.orientation.x,e.rotationQuaternion.y=i.orientation.y,e.rotationQuaternion.z=i.orientation.z,e.rotationQuaternion.w=i.orientation.w)}getRadius(e){return e.physicsBody.shapes.radius}getBoxSizeToRef(e,t){const i=e.physicsBody.shapes;t.x=2*i.halfWidth,t.y=2*i.halfHeight,t.z=2*i.halfDepth}dispose(){this.world.clear()}raycast(e,t){return u.Y.Warn("raycast is not currently supported by the Oimo physics plugin"),this._raycastResult.reset(e,t),this._raycastResult}}class Ka{constructor(e=!0,t=Ammo,i=null){this._useDeltaForWorldStep=e,this.bjsAMMO={},this.name="AmmoJSPlugin",this._timeStep=1/60,this._fixedTimeStep=1/60,this._maxSteps=5,this._tmpQuaternion=new o._f,this._tmpContactCallbackResult=!1,this._tmpContactPoint=new o.P,this._tmpContactNormal=new o.P,this._tmpVec3=new o.P,this._tmpMatrix=new o.y3,"function"!=typeof t?(this.bjsAMMO=t,this.isSupported()?(this._collisionConfiguration=new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration,this._dispatcher=new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration),this._overlappingPairCache=i||new this.bjsAMMO.btDbvtBroadphase,this._solver=new this.bjsAMMO.btSequentialImpulseConstraintSolver,this._softBodySolver=new this.bjsAMMO.btDefaultSoftBodySolver,this.world=new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher,this._overlappingPairCache,this._solver,this._collisionConfiguration,this._softBodySolver),this._tmpAmmoConcreteContactResultCallback=new this.bjsAMMO.ConcreteContactResultCallback,this._tmpAmmoConcreteContactResultCallback.addSingleResult=e=>{const t=(e=this.bjsAMMO.wrapPointer(e,this.bjsAMMO.btManifoldPoint)).getPositionWorldOnA(),i=e.m_normalWorldOnB;this._tmpContactPoint.x=t.x(),this._tmpContactPoint.y=t.y(),this._tmpContactPoint.z=t.z(),this._tmpContactNormal.x=i.x(),this._tmpContactNormal.y=i.y(),this._tmpContactNormal.z=i.z(),this._tmpContactImpulse=e.getAppliedImpulse(),this._tmpContactDistance=e.getDistance(),this._tmpContactCallbackResult=!0},this._raycastResult=new Ya,this._tmpAmmoTransform=new this.bjsAMMO.btTransform,this._tmpAmmoTransform.setIdentity(),this._tmpAmmoQuaternion=new this.bjsAMMO.btQuaternion(0,0,0,1),this._tmpAmmoVectorA=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorB=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorC=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorD=new this.bjsAMMO.btVector3(0,0,0)):u.Y.Error("AmmoJS is not available. Please make sure you included the js file.")):u.Y.Error("AmmoJS is not ready. Please make sure you await Ammo() before using the plugin.")}setGravity(e){this._tmpAmmoVectorA.setValue(e.x,e.y,e.z),this.world.setGravity(this._tmpAmmoVectorA),this.world.getWorldInfo().set_m_gravity(this._tmpAmmoVectorA)}setTimeStep(e){this._timeStep=e}setFixedTimeStep(e){this._fixedTimeStep=e}setMaxSteps(e){this._maxSteps=e}getTimeStep(){return this._timeStep}_isImpostorInContact(e){return this._tmpContactCallbackResult=!1,this.world.contactTest(e.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult}_isImpostorPairInContact(e,t){return this._tmpContactCallbackResult=!1,this.world.contactPairTest(e.physicsBody,t.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult}_stepSimulation(e=1/60,t=10,i=1/60){if(0==t)this.world.stepSimulation(e,0);else for(;t>0&&e>0;)e-i0&&this._isImpostorInContact(e))for(const t of e._onPhysicsCollideCallbacks)for(const i of t.otherImpostors)(e.physicsBody.isActive()||i.physicsBody.isActive())&&this._isImpostorPairInContact(e,i)&&(e.onCollide({body:i.physicsBody,point:this._tmpContactPoint,distance:this._tmpContactDistance,impulse:this._tmpContactImpulse,normal:this._tmpContactNormal}),i.onCollide({body:e.physicsBody,point:this._tmpContactPoint,distance:this._tmpContactDistance,impulse:this._tmpContactImpulse,normal:this._tmpContactNormal}))}_afterSoftStep(e){e.type===tn.Q.RopeImpostor?this._ropeStep(e):this._softbodyOrClothStep(e)}_ropeStep(e){const t=e.physicsBody.get_m_nodes(),i=t.size();let n,r,s,a,l;const c=new Array;for(let e=0;e{this.bjsAMMO.destroy(e)})),e._pluginData.toDispose=[]))}generateJoint(e){const t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(!t||!i)return;const n=e.joint.jointData;let r;switch(n.mainPivot||(n.mainPivot=new o.P(0,0,0)),n.connectedPivot||(n.connectedPivot=new o.P(0,0,0)),e.joint.type){case Ha.q7.DistanceJoint:{const e=n.maxDistance;e&&(n.mainPivot=new o.P(0,-e/2,0),n.connectedPivot=new o.P(0,e/2,0)),r=new this.bjsAMMO.btPoint2PointConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z));break}case Ha.q7.HingeJoint:{n.mainAxis||(n.mainAxis=new o.P(0,0,0)),n.connectedAxis||(n.connectedAxis=new o.P(0,0,0));const e=new this.bjsAMMO.btVector3(n.mainAxis.x,n.mainAxis.y,n.mainAxis.z),s=new this.bjsAMMO.btVector3(n.connectedAxis.x,n.connectedAxis.y,n.connectedAxis.z);r=new this.bjsAMMO.btHingeConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z),e,s);break}case Ha.q7.BallAndSocketJoint:r=new this.bjsAMMO.btPoint2PointConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z));break;default:u.Y.Warn("JointType not currently supported by the Ammo plugin, falling back to PhysicsJoint.BallAndSocketJoint"),r=new this.bjsAMMO.btPoint2PointConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z))}this.world.addConstraint(r,!e.joint.jointData.collision),e.joint.physicsJoint=r}removeJoint(e){this.world&&this.world.removeConstraint(e.joint.physicsJoint)}_addMeshVerts(e,t,i){let n=0;if(i&&i.getIndices&&i.getWorldMatrix&&i.getChildMeshes){let r=i.getIndices();r||(r=[]);let s,a=i.getVerticesData(le.o.PositionKind);if(a||(a=[]),t&&t!==i){let e;e=t.rotationQuaternion?t.rotationQuaternion:t.rotation?o._f.FromEulerAngles(t.rotation.x,t.rotation.y,t.rotation.z):o._f.Identity(),o.y3.Compose(o.P.One(),e,t.position).invertToRef(this._tmpMatrix),s=i.computeWorldMatrix(!1).multiply(this._tmpMatrix)}else o.y3.ScalingToRef(i.scaling.x,i.scaling.y,i.scaling.z,this._tmpMatrix),s=this._tmpMatrix;const l=r.length/3;for(let t=0;t{n+=this._addMeshVerts(e,t,i)}))}return n}_softVertexData(e){const t=e.object;if(t&&t.getIndices&&t.getWorldMatrix&&t.getChildMeshes){let e=t.getIndices();e||(e=[]);let i=t.getVerticesData(le.o.PositionKind);i||(i=[]);let n=t.getVerticesData(le.o.NormalKind);n||(n=[]),t.computeWorldMatrix(!1);const r=[],s=[];for(let e=0;ee*e)).reduce(((e,t)=>e+t)))t=r.length,i=t/3-1,this._tmpAmmoVectorA.setValue(r[0],r[1],r[2]),this._tmpAmmoVectorB.setValue(r[t-3],r[t-2],r[t-1]);else{e._isFromLine=!1;const n=e.getParam("path");if(null===e.getParam("shape"))return u.Y.Warn("No shape available for extruded mesh"),new this.bjsAMMO.btCompoundShape;t=n.length,i=t-1,this._tmpAmmoVectorA.setValue(n[0].x,n[0].y,n[0].z),this._tmpAmmoVectorB.setValue(n[t-1].x,n[t-1].y,n[t-1].z)}e.segments=i;let o=e.getParam("fixedPoints");o=o>3?3:o;const a=(new this.bjsAMMO.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,i-1,o);return a.get_m_cfg().set_collisions(17),a}_createCustom(e){let t=null;return this.onCreateCustomShape&&(t=this.onCreateCustomShape(e)),null==t&&(t=new this.bjsAMMO.btCompoundShape),t}_addHullVerts(e,t,i){let n=0;if(i&&i.getIndices&&i.getWorldMatrix&&i.getChildMeshes){let r=i.getIndices();r||(r=[]);let s=i.getVerticesData(le.o.PositionKind);s||(s=[]),i.computeWorldMatrix(!1);const a=r.length/3;for(let t=0;t{n+=this._addHullVerts(e,t,i)}))}return n}_createShape(e,t=!1){const i=e.object;let n;const r=e.getObjectExtents();if(!t){const t=e.object.getChildMeshes?e.object.getChildMeshes(!0):[];n=new this.bjsAMMO.btCompoundShape;let i=0;if(t.forEach((e=>{const t=e.getPhysicsImpostor();if(t){if(t.type==tn.Q.MeshImpostor)throw"A child MeshImpostor is not supported. Only primitive impostors are supported as children (eg. box or sphere)";const r=this._createShape(t),s=e.parent.getWorldMatrix().clone(),a=new o.P;s.decompose(a),this._tmpAmmoTransform.getOrigin().setValue(e.position.x*a.x,e.position.y*a.y,e.position.z*a.z),this._tmpAmmoQuaternion.setValue(e.rotationQuaternion.x,e.rotationQuaternion.y,e.rotationQuaternion.z,e.rotationQuaternion.w),this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion),n.addChildShape(this._tmpAmmoTransform,r),t.dispose(),i++}})),i>0){if(e.type!=tn.Q.NoImpostor){const t=this._createShape(e,!0);t&&(this._tmpAmmoTransform.getOrigin().setValue(0,0,0),this._tmpAmmoQuaternion.setValue(0,0,0,1),this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion),n.addChildShape(this._tmpAmmoTransform,t))}return n}this.bjsAMMO.destroy(n),n=null}switch(e.type){case tn.Q.SphereImpostor:if(ve.R.WithinEpsilon(r.x,r.y,1e-4)&&ve.R.WithinEpsilon(r.x,r.z,1e-4))n=new this.bjsAMMO.btSphereShape(r.x/2);else{const e=[new this.bjsAMMO.btVector3(0,0,0)],t=[1];n=new this.bjsAMMO.btMultiSphereShape(e,t,1),n.setLocalScaling(new this.bjsAMMO.btVector3(r.x/2,r.y/2,r.z/2))}break;case tn.Q.CapsuleImpostor:{const e=r.x/2;n=new this.bjsAMMO.btCapsuleShape(e,r.y-2*e)}break;case tn.Q.CylinderImpostor:this._tmpAmmoVectorA.setValue(r.x/2,r.y/2,r.z/2),n=new this.bjsAMMO.btCylinderShape(this._tmpAmmoVectorA);break;case tn.Q.PlaneImpostor:case tn.Q.BoxImpostor:this._tmpAmmoVectorA.setValue(r.x/2,r.y/2,r.z/2),n=new this.bjsAMMO.btBoxShape(this._tmpAmmoVectorA);break;case tn.Q.MeshImpostor:if(0==e.getParam("mass")){if(this.onCreateCustomMeshImpostor)n=this.onCreateCustomMeshImpostor(e);else{const t=new this.bjsAMMO.btTriangleMesh;e._pluginData.toDispose.push(t);const r=this._addMeshVerts(t,i,i);n=0==r?new this.bjsAMMO.btCompoundShape:new this.bjsAMMO.btBvhTriangleMeshShape(t)}break}case tn.Q.ConvexHullImpostor:if(this.onCreateCustomConvexHullImpostor)n=this.onCreateCustomConvexHullImpostor(e);else{const t=new this.bjsAMMO.btConvexHullShape;0==this._addHullVerts(t,i,i)?(e._pluginData.toDispose.push(t),n=new this.bjsAMMO.btCompoundShape):n=t}break;case tn.Q.NoImpostor:n=new this.bjsAMMO.btSphereShape(r.x/2);break;case tn.Q.CustomImpostor:n=this._createCustom(e);break;case tn.Q.SoftbodyImpostor:n=this._createSoftbody(e);break;case tn.Q.ClothImpostor:n=this._createCloth(e);break;case tn.Q.RopeImpostor:n=this._createRope(e);break;default:u.Y.Warn("The impostor type is not currently supported by the ammo plugin.")}return n}setTransformationFromPhysicsBody(e){e.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.object.position.set(this._tmpAmmoTransform.getOrigin().x(),this._tmpAmmoTransform.getOrigin().y(),this._tmpAmmoTransform.getOrigin().z()),e.object.rotationQuaternion?e.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()):e.object.rotation&&(this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()),this._tmpQuaternion.toEulerAnglesToRef(e.object.rotation))}setPhysicsBodyTransformation(e,t,i){const n=e.physicsBody.getWorldTransform();if(Math.abs(n.getOrigin().x()-t.x)>$.kn||Math.abs(n.getOrigin().y()-t.y)>$.kn||Math.abs(n.getOrigin().z()-t.z)>$.kn||Math.abs(n.getRotation().x()-i.x)>$.kn||Math.abs(n.getRotation().y()-i.y)>$.kn||Math.abs(n.getRotation().z()-i.z)>$.kn||Math.abs(n.getRotation().w()-i.w)>$.kn)if(this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),n.setOrigin(this._tmpAmmoVectorA),this._tmpAmmoQuaternion.setValue(i.x,i.y,i.z,i.w),n.setRotation(this._tmpAmmoQuaternion),e.physicsBody.setWorldTransform(n),0==e.mass){const t=e.physicsBody.getMotionState();t&&t.setWorldTransform(n)}else e.physicsBody.activate()}isSupported(){return void 0!==this.bjsAMMO}setLinearVelocity(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.linearVelocity(this._tmpAmmoVectorA):e.physicsBody.setLinearVelocity(this._tmpAmmoVectorA)}setAngularVelocity(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.angularVelocity(this._tmpAmmoVectorA):e.physicsBody.setAngularVelocity(this._tmpAmmoVectorA)}getLinearVelocity(e){let t;if(t=e.soft?e.physicsBody.linearVelocity():e.physicsBody.getLinearVelocity(),!t)return null;const i=new o.P(t.x(),t.y(),t.z());return this.bjsAMMO.destroy(t),i}getAngularVelocity(e){let t;if(t=e.soft?e.physicsBody.angularVelocity():e.physicsBody.getAngularVelocity(),!t)return null;const i=new o.P(t.x(),t.y(),t.z());return this.bjsAMMO.destroy(t),i}setBodyMass(e,t){e.soft?e.physicsBody.setTotalMass(t,!1):e.physicsBody.setMassProps(t),e._pluginData.mass=t}getBodyMass(e){return e._pluginData.mass||0}getBodyFriction(e){return e._pluginData.friction||0}setBodyFriction(e,t){e.soft?e.physicsBody.get_m_cfg().set_kDF(t):e.physicsBody.setFriction(t),e._pluginData.friction=t}getBodyRestitution(e){return e._pluginData.restitution||0}setBodyRestitution(e,t){e.physicsBody.setRestitution(t),e._pluginData.restitution=t}getBodyPressure(e){return e.soft?e._pluginData.pressure||0:(u.Y.Warn("Pressure is not a property of a rigid body"),0)}setBodyPressure(e,t){e.soft?e.type===tn.Q.SoftbodyImpostor?(e.physicsBody.get_m_cfg().set_kPR(t),e._pluginData.pressure=t):(e.physicsBody.get_m_cfg().set_kPR(0),e._pluginData.pressure=0):u.Y.Warn("Pressure can only be applied to a softbody")}getBodyStiffness(e){return e.soft?e._pluginData.stiffness||0:(u.Y.Warn("Stiffness is not a property of a rigid body"),0)}setBodyStiffness(e,t){e.soft?(t=(t=t<0?0:t)>1?1:t,e.physicsBody.get_m_materials().at(0).set_m_kLST(t),e._pluginData.stiffness=t):u.Y.Warn("Stiffness cannot be applied to a rigid body")}getBodyVelocityIterations(e){return e.soft?e._pluginData.velocityIterations||0:(u.Y.Warn("Velocity iterations is not a property of a rigid body"),0)}setBodyVelocityIterations(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_viterations(t),e._pluginData.velocityIterations=t):u.Y.Warn("Velocity iterations cannot be applied to a rigid body")}getBodyPositionIterations(e){return e.soft?e._pluginData.positionIterations||0:(u.Y.Warn("Position iterations is not a property of a rigid body"),0)}setBodyPositionIterations(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_piterations(t),e._pluginData.positionIterations=t):u.Y.Warn("Position iterations cannot be applied to a rigid body")}appendAnchor(e,t,i,n,r=1,s=!1){const o=e.segments,a=Math.round((o-1)*i)+o*(o-1-Math.round((o-1)*n));e.physicsBody.appendAnchor(a,t.physicsBody,s,r)}appendHook(e,t,i,n=1,r=!1){const s=Math.round(e.segments*i);e.physicsBody.appendAnchor(s,t.physicsBody,r,n)}sleepBody(e){e.physicsBody.forceActivationState(0)}wakeUpBody(e){e.physicsBody.activate()}updateDistanceJoint(){u.Y.Warn("updateDistanceJoint is not currently supported by the Ammo physics plugin")}setMotor(e,t,i){e.physicsJoint.enableAngularMotor(!0,t,i)}setLimit(){u.Y.Warn("setLimit is not currently supported by the Ammo physics plugin")}syncMeshWithImpostor(e,t){t.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.position.x=this._tmpAmmoTransform.getOrigin().x(),e.position.y=this._tmpAmmoTransform.getOrigin().y(),e.position.z=this._tmpAmmoTransform.getOrigin().z(),e.rotationQuaternion&&(e.rotationQuaternion.x=this._tmpAmmoTransform.getRotation().x(),e.rotationQuaternion.y=this._tmpAmmoTransform.getRotation().y(),e.rotationQuaternion.z=this._tmpAmmoTransform.getRotation().z(),e.rotationQuaternion.w=this._tmpAmmoTransform.getRotation().w())}getRadius(e){return e.getObjectExtents().x/2}getBoxSizeToRef(e,t){const i=e.getObjectExtents();t.x=i.x,t.y=i.y,t.z=i.z}dispose(){this.bjsAMMO.destroy(this.world),this.bjsAMMO.destroy(this._solver),this.bjsAMMO.destroy(this._overlappingPairCache),this.bjsAMMO.destroy(this._dispatcher),this.bjsAMMO.destroy(this._collisionConfiguration),this.bjsAMMO.destroy(this._tmpAmmoVectorA),this.bjsAMMO.destroy(this._tmpAmmoVectorB),this.bjsAMMO.destroy(this._tmpAmmoVectorC),this.bjsAMMO.destroy(this._tmpAmmoTransform),this.bjsAMMO.destroy(this._tmpAmmoQuaternion),this.bjsAMMO.destroy(this._tmpAmmoConcreteContactResultCallback),this.world=null}raycast(e,t){this._tmpAmmoVectorRCA=new this.bjsAMMO.btVector3(e.x,e.y,e.z),this._tmpAmmoVectorRCB=new this.bjsAMMO.btVector3(t.x,t.y,t.z);const i=new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB);return this.world.rayTest(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB,i),this._raycastResult.reset(e,t),i.hasHit()&&(this._raycastResult.setHitData({x:i.get_m_hitNormalWorld().x(),y:i.get_m_hitNormalWorld().y(),z:i.get_m_hitNormalWorld().z()},{x:i.get_m_hitPointWorld().x(),y:i.get_m_hitPointWorld().y(),z:i.get_m_hitPointWorld().z()}),this._raycastResult.calculateHitDistance()),this.bjsAMMO.destroy(i),this.bjsAMMO.destroy(this._tmpAmmoVectorRCA),this.bjsAMMO.destroy(this._tmpAmmoVectorRCB),this._raycastResult}}Ka._DISABLE_COLLISION_FLAG=4,Ka._KINEMATIC_FLAG=2,Ka._DISABLE_DEACTIVATION_FLAG=4,n.p.prototype.removeReflectionProbe=function(e){if(!this.reflectionProbes)return-1;const t=this.reflectionProbes.indexOf(e);return-1!==t&&this.reflectionProbes.splice(t,1),t},n.p.prototype.addReflectionProbe=function(e){this.reflectionProbes||(this.reflectionProbes=[]),this.reflectionProbes.push(e)};class Za{constructor(e,t,i,n=!0,r=!1,s=!1){if(this.name=e,this._viewMatrix=o.y3.Identity(),this._target=o.P.Zero(),this._add=o.P.Zero(),this._invertYAxis=!1,this.position=o.P.Zero(),this.metadata=null,this._parentContainer=null,this._scene=i,i.getEngine().supportsUniformBuffers){this._sceneUBOs=[];for(let t=0;t<6;++t)this._sceneUBOs.push(i.createSceneUniformBuffer(`Scene for Reflection Probe (name "${e}") face #${t}`))}this._scene.reflectionProbes||(this._scene.reflectionProbes=new Array),this._scene.reflectionProbes.push(this);let a=0;if(r){const e=this._scene.getEngine().getCaps();e.textureHalfFloatRender?a=2:e.textureFloatRender&&(a=1)}this._renderTargetTexture=new Ot._(e,t,i,n,!0,a,!0),this._renderTargetTexture.gammaSpace=!s;const l=i.getEngine().useReverseDepthBuffer;let c;this._renderTargetTexture.onBeforeRenderObservable.add((e=>{switch(this._sceneUBOs&&(i.setSceneUniformBuffer(this._sceneUBOs[e]),i.getSceneUniformBuffer().unbindEffect()),e){case 0:this._add.copyFromFloats(1,0,0);break;case 1:this._add.copyFromFloats(-1,0,0);break;case 2:this._add.copyFromFloats(0,this._invertYAxis?1:-1,0);break;case 3:this._add.copyFromFloats(0,this._invertYAxis?-1:1,0);break;case 4:this._add.copyFromFloats(0,0,i.useRightHandedSystem?-1:1);break;case 5:this._add.copyFromFloats(0,0,i.useRightHandedSystem?1:-1)}this._attachedMesh&&this.position.copyFrom(this._attachedMesh.getAbsolutePosition()),this.position.addToRef(this._add,this._target);const t=i.useRightHandedSystem?o.y3.LookAtRHToRef:o.y3.LookAtLHToRef,n=i.useRightHandedSystem?o.y3.PerspectiveFovRH:o.y3.PerspectiveFovLH;t(this.position,this._target,o.P.Up(),this._viewMatrix),i.activeCamera&&(this._projectionMatrix=n(Math.PI/2,1,l?i.activeCamera.maxZ:i.activeCamera.minZ,l?i.activeCamera.minZ:i.activeCamera.maxZ,this._scene.getEngine().isNDCHalfZRange),i.setTransformMatrix(this._viewMatrix,this._projectionMatrix),i.activeCamera.isRigCamera&&!this._renderTargetTexture.activeCamera&&(this._renderTargetTexture.activeCamera=i.activeCamera.rigParent||null)),i._forcedViewPosition=this.position})),this._renderTargetTexture.onBeforeBindObservable.add((()=>{var t,n;this._currentSceneUBO=i.getSceneUniformBuffer(),null===(n=(t=i.getEngine())._debugPushGroup)||void 0===n||n.call(t,`reflection probe generation for ${e}`,1),c=this._scene.imageProcessingConfiguration.applyByPostProcess,s&&(i.imageProcessingConfiguration.applyByPostProcess=!0)})),this._renderTargetTexture.onAfterUnbindObservable.add((()=>{var e,t;i.imageProcessingConfiguration.applyByPostProcess=c,i._forcedViewPosition=null,this._sceneUBOs&&i.setSceneUniformBuffer(this._currentSceneUBO),i.updateTransformMatrix(!0),null===(t=(e=i.getEngine())._debugPopGroup)||void 0===t||t.call(e,1)}))}get samples(){return this._renderTargetTexture.samples}set samples(e){this._renderTargetTexture.samples=e}get refreshRate(){return this._renderTargetTexture.refreshRate}set refreshRate(e){this._renderTargetTexture.refreshRate=e}getScene(){return this._scene}get cubeTexture(){return this._renderTargetTexture}get renderList(){return this._renderTargetTexture.renderList}attachToMesh(e){this._attachedMesh=e}setRenderingAutoClearDepthStencil(e,t){this._renderTargetTexture.setRenderingAutoClearDepthStencil(e,t)}dispose(){const e=this._scene.reflectionProbes.indexOf(this);if(-1!==e&&this._scene.reflectionProbes.splice(e,1),this._parentContainer){const e=this._parentContainer.reflectionProbes.indexOf(this);e>-1&&this._parentContainer.reflectionProbes.splice(e,1),this._parentContainer=null}if(this._renderTargetTexture&&(this._renderTargetTexture.dispose(),this._renderTargetTexture=null),this._sceneUBOs){for(const e of this._sceneUBOs)e.dispose();this._sceneUBOs=[]}}toString(e){let t="Name: "+this.name;return e&&(t+=", position: "+this.position.toString(),this._attachedMesh&&(t+=", attached mesh: "+this._attachedMesh.name)),t}getClassName(){return"ReflectionProbe"}serialize(){const e=Y.p4.Serialize(this,this._renderTargetTexture.serialize());return e.isReflectionProbe=!0,e.metadata=this.metadata,e}static Parse(e,t,i){let n=null;if(t.reflectionProbes)for(let i=0;in||new Za(e.name,e.renderTargetSize,t,e._generateMipMaps)),e,t,i),n.cubeTexture._waitingRenderList=e.renderList,e._attachedMesh&&n.attachToMesh(t.getMeshById(e._attachedMesh)),e.metadata&&(n.metadata=e.metadata),n}}(0,X.gn)([(0,Y.RR)()],Za.prototype,"_attachedMesh",void 0),(0,X.gn)([(0,Y.hd)()],Za.prototype,"position",void 0);class $a{}$a.LoaderInjectedPhysicsEngine=void 0;let Ja={},el={};const tl=(e,t,i,n)=>{if(!t.materials)return null;for(let r=0,s=t.materials.length;r{for(const n in t)if(e.name===t[n])return i.push(e.id),!0;return void 0!==e.parentId&&-1!==i.indexOf(e.parentId)&&(i.push(e.id),!0)},nl=(e,t)=>e+" of "+(t?t.file+" from "+t.name+" version: "+t.version+", exporter version: "+t.exporter_version:"unknown"),rl=(e,t)=>{const i=t;if(t._waitingData.lods){if(t._waitingData.lods.ids&&t._waitingData.lods.ids.length>0){const n=t._waitingData.lods.ids,r=i.isEnabled(!1);if(t._waitingData.lods.distances){const s=t._waitingData.lods.distances;if(s.length>=n.length){const t=s.length>n.length?s[s.length-1]:0;i.setEnabled(!1);for(let t=0;t0&&i.addLODLevel(t,null),!0===r&&i.setEnabled(!0)}else V.w1.Warn("Invalid level of detail distances for "+t.name)}}t._waitingData.lods=null}},sl=(e,t,i)=>{if("number"!=typeof e){const n=i.getLastEntryById(e);return n&&null!=t?n.instances[parseInt(t)]:n}const n=Ja[e];return n&&null!=t?n.instances[parseInt(t)]:n},ol=(e,t)=>"number"!=typeof e?t.getLastMaterialById(e,!0):el[e],al=(e,t,i,r,s=!1)=>{const o=new L.TJ(e);let a="importScene has failed JSON parse";try{var c=JSON.parse(t);a="";const r=Vs.n.loggingLevel===Vs.n.DETAILED_LOGGING;let h,_;if(void 0!==c.environmentTexture&&null!==c.environmentTexture){const t=void 0===c.isPBR||c.isPBR;if(c.environmentTextureType&&"BABYLON.HDRCubeTexture"===c.environmentTextureType){const n=c.environmentTextureSize?c.environmentTextureSize:128,r=new Wa((c.environmentTexture.match(/https?:\/\//g)?"":i)+c.environmentTexture,e,n,!0,!t,void 0,c.environmentTexturePrefilterOnLoad);c.environmentTextureRotationY&&(r.rotationY=c.environmentTextureRotationY),e.environmentTexture=r}else if("object"==typeof c.environmentTexture){const t=ao.B.Parse(c.environmentTexture,e,i);e.environmentTexture=t}else if(c.environmentTexture.endsWith(".env")){const t=new ao.B((c.environmentTexture.match(/https?:\/\//g)?"":i)+c.environmentTexture,e,c.environmentTextureForcedExtension);c.environmentTextureRotationY&&(t.rotationY=c.environmentTextureRotationY),e.environmentTexture=t}else{const t=ao.B.CreateFromPrefilteredData((c.environmentTexture.match(/https?:\/\//g)?"":i)+c.environmentTexture,e,c.environmentTextureForcedExtension);c.environmentTextureRotationY&&(t.rotationY=c.environmentTextureRotationY),e.environmentTexture=t}if(!0===c.createDefaultSkybox){const i=void 0!==e.activeCamera&&null!==e.activeCamera?(e.activeCamera.maxZ-e.activeCamera.minZ)/2:1e3,n=c.skyboxBlurLevel||0;e.createDefaultSkybox(e.environmentTexture,t,i,n)}o.environmentTexture=e.environmentTexture}if(void 0!==c.environmentIntensity&&null!==c.environmentIntensity&&(e.environmentIntensity=c.environmentIntensity),void 0!==c.lights&&null!==c.lights)for(h=0,_=c.lights.length;h<_;h++){const t=c.lights[h],i=va._.Parse(t,e);i&&(Ja[t.uniqueId]=i,o.lights.push(i),i._parentContainer=o,a+=0===h?"\n\tLights:":"",a+="\n\t\t"+i.toString(r))}if(void 0!==c.reflectionProbes&&null!==c.reflectionProbes)for(h=0,_=c.reflectionProbes.length;h<_;h++){const t=c.reflectionProbes[h],n=Za.Parse(t,e,i);n&&(o.reflectionProbes.push(n),n._parentContainer=o,a+=0===h?"\n\tReflection Probes:":"",a+="\n\t\t"+n.toString(r))}if(void 0!==c.animations&&null!==c.animations)for(h=0,_=c.animations.length;h<_;h++){const t=c.animations[h],i=(0,l.q)("BABYLON.Animation");if(i){const n=i.Parse(t);e.animations.push(n),o.animations.push(n),a+=0===h?"\n\tAnimations:":"",a+="\n\t\t"+n.toString(r)}}if(void 0!==c.materials&&null!==c.materials)for(h=0,_=c.materials.length;h<_;h++){const t=c.materials[h],n=on.F.Parse(t,e,i);n&&(el[t.uniqueId||t.id]=n,o.materials.push(n),n._parentContainer=o,a+=0===h?"\n\tMaterials:":"",a+="\n\t\t"+n.toString(r),n.getActiveTextures().forEach((e=>{-1==o.textures.indexOf(e)&&(o.textures.push(e),e._parentContainer=o)})))}if(void 0!==c.multiMaterials&&null!==c.multiMaterials)for(h=0,_=c.multiMaterials.length;h<_;h++){const t=c.multiMaterials[h],i=La.G.ParseMultiMaterial(t,e);el[t.uniqueId||t.id]=i,o.multiMaterials.push(i),i._parentContainer=o,a+=0===h?"\n\tMultiMaterials:":"",a+="\n\t\t"+i.toString(r),i.getActiveTextures().forEach((e=>{-1==o.textures.indexOf(e)&&(o.textures.push(e),e._parentContainer=o)}))}if(void 0!==c.morphTargetManagers&&null!==c.morphTargetManagers)for(const t of c.morphTargetManagers){const i=za.O.Parse(t,e);o.morphTargetManagers.push(i),i._parentContainer=o}if(void 0!==c.skeletons&&null!==c.skeletons)for(h=0,_=c.skeletons.length;h<_;h++){const t=c.skeletons[h],i=ae.O.Parse(t,e);o.skeletons.push(i),i._parentContainer=o,a+=0===h?"\n\tSkeletons:":"",a+="\n\t\t"+i.toString(r)}const d=c.geometries;if(null!=d){const t=new Array,n=d.vertexData;if(null!=n)for(h=0,_=n.length;h<_;h++){const r=n[h];t.push(Na.Z.Parse(r,e,i))}t.forEach((e=>{e&&(o.geometries.push(e),e._parentContainer=o)}))}if(void 0!==c.transformNodes&&null!==c.transformNodes)for(h=0,_=c.transformNodes.length;h<_;h++){const t=c.transformNodes[h],n=Et.Y.Parse(t,e,i);Ja[t.uniqueId]=n,o.transformNodes.push(n),n._parentContainer=o}if(void 0!==c.meshes&&null!==c.meshes)for(h=0,_=c.meshes.length;h<_;h++){const t=c.meshes[h],n=je.Kj.Parse(t,e,i);if(Ja[t.uniqueId]=n,o.meshes.push(n),n._parentContainer=o,n.hasInstances)for(const e of n.instances)o.meshes.push(e),e._parentContainer=o;a+=0===h?"\n\tMeshes:":"",a+="\n\t\t"+n.toString(r)}if(void 0!==c.cameras&&null!==c.cameras)for(h=0,_=c.cameras.length;h<_;h++){const t=c.cameras[h],i=Le.V.Parse(t,e);Ja[t.uniqueId]=i,o.cameras.push(i),i._parentContainer=o,a+=0===h?"\n\tCameras:":"",a+="\n\t\t"+i.toString(r)}if(void 0!==c.postProcesses&&null!==c.postProcesses)for(h=0,_=c.postProcesses.length;h<_;h++){const t=c.postProcesses[h],n=_t.D.Parse(t,e,i);n&&(o.postProcesses.push(n),n._parentContainer=o,a+=0===h?"\nPostprocesses:":"",a+="\n\t\t"+n.toString())}if(void 0!==c.animationGroups&&null!==c.animationGroups)for(h=0,_=c.animationGroups.length;h<_;h++){const t=c.animationGroups[h],i=N.O.Parse(t,e);o.animationGroups.push(i),i._parentContainer=o,a+=0===h?"\n\tAnimationGroups:":"",a+="\n\t\t"+i.toString(r)}for(h=0,_=e.cameras.length;h<_;h++){const t=e.cameras[h];null!==t._waitingParentId&&(t.parent=sl(t._waitingParentId,t._waitingParentInstanceIndex,e),t._waitingParentId=null,t._waitingParentInstanceIndex=null)}for(h=0,_=e.lights.length;h<_;h++){const t=e.lights[h];t&&null!==t._waitingParentId&&(t.parent=sl(t._waitingParentId,t._waitingParentInstanceIndex,e),t._waitingParentId=null,t._waitingParentInstanceIndex=null)}for(h=0,_=e.transformNodes.length;h<_;h++){const t=e.transformNodes[h];null!==t._waitingParentId&&(t.parent=sl(t._waitingParentId,t._waitingParentInstanceIndex,e),t._waitingParentId=null,t._waitingParentInstanceIndex=null)}for(h=0,_=e.meshes.length;h<_;h++){const t=e.meshes[h];null!==t._waitingParentId&&(t.parent=sl(t._waitingParentId,t._waitingParentInstanceIndex,e),t._waitingParentId=null,t._waitingParentInstanceIndex=null),t._waitingData.lods&&rl(e,t)}for(e.multiMaterials.forEach((t=>{t._waitingSubMaterialsUniqueIds.forEach((i=>{t.subMaterials.push(ol(i,e))})),t._waitingSubMaterialsUniqueIds=[]})),e.meshes.forEach((t=>{null!==t._waitingMaterialId&&(t.material=ol(t._waitingMaterialId,e),t._waitingMaterialId=null)})),h=0,_=e.skeletons.length;h<_;h++){const t=e.skeletons[h];t._hasWaitingData&&(null!=t.bones&&t.bones.forEach((t=>{if(t._waitingTransformNodeId){const i=e.getLastEntryById(t._waitingTransformNodeId);i&&t.linkTransformNode(i),t._waitingTransformNodeId=null}})),t._hasWaitingData=null)}for(h=0,_=e.meshes.length;h<_;h++){const t=e.meshes[h];t._waitingData.freezeWorldMatrix?(t.freezeWorldMatrix(),t._waitingData.freezeWorldMatrix=null):t.computeWorldMatrix(!0)}for(h=0,_=e.lights.length;h<_;h++){const t=e.lights[h];if(t._excludedMeshesIds.length>0){for(let i=0;i0){for(let i=0;i{e._loadedUniqueId=""})),n.p.Parse(c,e,o,i),h=0,_=e.meshes.length;h<_;h++){const t=e.meshes[h];t._waitingData.actions&&(b.Parse(t._waitingData.actions,t,e),t._waitingData.actions=null)}void 0!==c.actions&&null!==c.actions&&b.Parse(c.actions,null,e)}catch(e){const t=nl("loadAssets",c?c.producer:"Unknown")+a;if(!r)throw u.Y.Log(t),e;r(t,e)}finally{Ja={},el={},s||o.removeAllFromScene(),null!==a&&Vs.n.loggingLevel!==Vs.n.NO_LOGGING&&u.Y.Log(nl("loadAssets",c?c.producer:"Unknown")+(Vs.n.loggingLevel!==Vs.n.MINIMAL_LOGGING?a:""))}return o};Vs.n.RegisterPlugin({name:"babylon.js",extensions:".babylon",canDirectLoad:e=>-1!==e.indexOf("babylon"),importMesh:(e,t,i,r,s,o,a,l)=>{var c;let h="importMesh has failed JSON parse";try{var _=JSON.parse(i);h="";const l=Vs.n.loggingLevel===Vs.n.DETAILED_LOGGING;e?Array.isArray(e)||(e=[e]):e=null;const d=new Array,p=new Map,f=[];if(void 0!==_.transformNodes&&null!==_.transformNodes)for(let e=0,i=_.transformNodes.length;e{!0!==e&&_.geometries[i]&&Array.isArray(_.geometries[i])&&_.geometries[i].forEach((n=>{n.id===f.geometryId&&("vertexData"===i&&Na.Z.Parse(n,t,r),e=!0)}))})),!1===e&&u.Y.Warn("Geometry not found for mesh "+f.id)}if(f.materialUniqueId||f.materialId){const e=f.materialUniqueId?o:n;let i=-1!==e.indexOf(f.materialUniqueId||f.materialId);if(!1===i&&void 0!==_.multiMaterials&&null!==_.multiMaterials){const n=(i,n)=>{e.push(i);const s=tl(n,_,t,r);s&&s.material&&(el[s.parsedMaterial.uniqueId||s.parsedMaterial.id]=s.material,h+="\n\tMaterial "+s.material.toString(l))};for(let r=0,s=_.multiMaterials.length;rn(e,(t=>t.uniqueId===e)))):s.materials.forEach((e=>n(e,(t=>t.id===e)))),e.push(s.uniqueId||s.id);const r=La.G.ParseMultiMaterial(s,t);el[s.uniqueId||s.id]=r,r&&(i=!0,h+="\n\tMulti-Material "+r.toString(l));break}}}if(!1===i){e.push(f.materialUniqueId||f.materialId);const i=tl((e=>f.materialUniqueId&&e.uniqueId===f.materialUniqueId||e.id===f.materialId),_,t,r);i&&i.material?(el[i.parsedMaterial.uniqueId||i.parsedMaterial.id]=i.material,h+="\n\tMaterial "+i.material.toString(l)):u.Y.Warn("Material not found for mesh "+f.id)}}if(f.skeletonId>-1&&void 0!==_.skeletons&&null!==_.skeletons&&!(i.indexOf(f.skeletonId)>-1))for(let e=0,n=_.skeletons.length;e-1&&void 0!==_.morphTargetManagers&&null!==_.morphTargetManagers&&!(m.indexOf(f.morphTargetManagerId)>-1))for(let e=0,i=_.morphTargetManagers.length;e{e._waitingSubMaterialsUniqueIds.forEach((i=>{e.subMaterials.push(ol(i,t))})),e._waitingSubMaterialsUniqueIds=[]})),t.meshes.forEach((e=>{null!==e._waitingMaterialId&&(e.material=ol(e._waitingMaterialId,t),e._waitingMaterialId=null)}));for(let e=0,i=t.transformNodes.length;e-1&&f.splice(e,1)}g._waitingParentId=null}g._waitingData.lods&&rl(t,g)}for(const e of f)e.dispose();for(let e=0,i=t.skeletons.length;e{if(e._waitingTransformNodeId){const i=t.getLastEntryById(e._waitingTransformNodeId);i&&e.linkTransformNode(i),e._waitingTransformNodeId=null}})),i._hasWaitingData=null)}for(let e=0,i=t.meshes.length;e{let r="importScene has failed JSON parse";try{var s=JSON.parse(t);if(r="",void 0!==s.useDelayedTextureLoading&&null!==s.useDelayedTextureLoading&&(e.useDelayedTextureLoading=s.useDelayedTextureLoading&&!Vs.n.ForceFullSceneLoadingForIncremental),void 0!==s.autoClear&&null!==s.autoClear&&(e.autoClear=s.autoClear),void 0!==s.clearColor&&null!==s.clearColor&&(e.clearColor=a.HE.FromArray(s.clearColor)),void 0!==s.ambientColor&&null!==s.ambientColor&&(e.ambientColor=a.Wo.FromArray(s.ambientColor)),void 0!==s.gravity&&null!==s.gravity&&(e.gravity=o.P.FromArray(s.gravity)),void 0!==s.useRightHandedSystem&&(e.useRightHandedSystem=!!s.useRightHandedSystem),s.fogMode&&0!==s.fogMode)switch(e.fogMode=s.fogMode,e.fogColor=a.Wo.FromArray(s.fogColor),e.fogStart=s.fogStart,e.fogEnd=s.fogEnd,e.fogDensity=s.fogDensity,r+="\tFog mode for scene: ",e.fogMode){case 1:r+="exp\n";break;case 2:r+="exp2\n";break;case 3:r+="linear\n"}if(s.physicsEnabled){let t;"cannon"===s.physicsEngine||s.physicsEngine===Qa.name?t=new Qa(void 0,void 0,$a.LoaderInjectedPhysicsEngine):"oimo"===s.physicsEngine||s.physicsEngine===qa.name?t=new qa(void 0,$a.LoaderInjectedPhysicsEngine):"ammo"!==s.physicsEngine&&s.physicsEngine!==Ka.name||(t=new Ka(void 0,$a.LoaderInjectedPhysicsEngine,void 0)),r="\tPhysics engine "+(s.physicsEngine?s.physicsEngine:"oimo")+" enabled\n";const i=s.physicsGravity?o.P.FromArray(s.physicsGravity):null;e.enablePhysics(i,t)}return void 0!==s.metadata&&null!==s.metadata&&(e.metadata=s.metadata),void 0!==s.collisionsEnabled&&null!==s.collisionsEnabled&&(e.collisionsEnabled=s.collisionsEnabled),!!al(e,t,i,n,!0)&&(s.autoAnimate&&e.beginAnimation(e,s.autoAnimateFrom,s.autoAnimateTo,s.autoAnimateLoop,s.autoAnimateSpeed||1),void 0!==s.activeCameraID&&null!==s.activeCameraID&&e.setActiveCameraById(s.activeCameraID),!0)}catch(e){const t=nl("importScene",s?s.producer:"Unknown")+r;if(!n)throw u.Y.Log(t),e;n(t,e)}finally{null!==r&&Vs.n.loggingLevel!==Vs.n.NO_LOGGING&&u.Y.Log(nl("importScene",s?s.producer:"Unknown")+(Vs.n.loggingLevel!==Vs.n.MINIMAL_LOGGING?r:""))}return!1},loadAssetContainer:(e,t,i,n)=>al(e,t,i,n)}),i("../../../node_modules/@babylonjs/core/Loading/sceneLoaderFlags.js"),i("../../../node_modules/@babylonjs/core/Materials/colorCurves.js");class ll{constructor(e={}){this._isEnabled=!0,this.bias=void 0===e.bias?0:e.bias,this.power=void 0===e.power?1:e.power,this.leftColor=e.leftColor||a.Wo.White(),this.rightColor=e.rightColor||a.Wo.Black(),!1===e.isEnabled&&(this.isEnabled=!1)}get isEnabled(){return this._isEnabled}set isEnabled(e){this._isEnabled!==e&&(this._isEnabled=e,k.D.MarkAllMaterialsAsDirty(20))}clone(){const e=new ll;return g.j.DeepCopy(this,e),e}equals(e){return e&&this.bias===e.bias&&this.power===e.power&&this.leftColor.equals(e.leftColor)&&this.rightColor.equals(e.rightColor)&&this.isEnabled===e.isEnabled}serialize(){return{isEnabled:this.isEnabled,leftColor:this.leftColor.asArray(),rightColor:this.rightColor.asArray(),bias:this.bias,power:this.power}}static Parse(e){return new ll({isEnabled:e.isEnabled,leftColor:a.Wo.FromArray(e.leftColor),rightColor:a.Wo.FromArray(e.rightColor),bias:e.bias,power:e.power||1})}}Y.p4._FresnelParametersParser=ll.Parse;var cl=i("../../../node_modules/@babylonjs/core/Materials/thinMaterialHelper.js");i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrAnisotropicConfiguration.js");var hl=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrBaseMaterial.js");class _l extends hl.m{constructor(e,t){super(e,t),this.maxSimultaneousLights=4,this.disableLighting=!1,this.invertNormalMapX=!1,this.invertNormalMapY=!1,this.emissiveColor=new a.Wo(0,0,0),this.occlusionStrength=1,this.useLightmapAsShadowmap=!1,this._useAlphaFromAlbedoTexture=!0,this._useAmbientInGrayScale=!0}get doubleSided(){return this._twoSidedLighting}set doubleSided(e){this._twoSidedLighting!==e&&(this._twoSidedLighting=e,this.backFaceCulling=!e,this._markAllSubMeshesAsTexturesDirty())}getClassName(){return"PBRBaseSimpleMaterial"}}(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsLightsDirty")],_l.prototype,"maxSimultaneousLights",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsLightsDirty")],_l.prototype,"disableLighting",void 0),(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_reflectionTexture")],_l.prototype,"environmentTexture",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],_l.prototype,"invertNormalMapX",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],_l.prototype,"invertNormalMapY",void 0),(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_bumpTexture")],_l.prototype,"normalTexture",void 0),(0,X.gn)([(0,Y.n9)("emissive"),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],_l.prototype,"emissiveColor",void 0),(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],_l.prototype,"emissiveTexture",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_ambientTextureStrength")],_l.prototype,"occlusionStrength",void 0),(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_ambientTexture")],_l.prototype,"occlusionTexture",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_alphaCutOff")],_l.prototype,"alphaCutOff",void 0),(0,X.gn)([(0,Y.qC)()],_l.prototype,"doubleSided",null),(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty",null)],_l.prototype,"lightmapTexture",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],_l.prototype,"useLightmapAsShadowmap",void 0);var dl=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrClearCoatConfiguration.js"),ul=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrIridescenceConfiguration.js");class pl extends _l{constructor(e,t){super(e,t),this._useRoughnessFromMetallicTextureAlpha=!1,this._useRoughnessFromMetallicTextureGreen=!0,this._useMetallnessFromMetallicTextureBlue=!0,this.metallic=1,this.roughness=1}getClassName(){return"PBRMetallicRoughnessMaterial"}clone(e){const t=Y.p4.Clone((()=>new pl(e,this.getScene())),this);return t.id=e,t.name=e,this.clearCoat.copyTo(t.clearCoat),this.anisotropy.copyTo(t.anisotropy),this.brdf.copyTo(t.brdf),this.sheen.copyTo(t.sheen),this.subSurface.copyTo(t.subSurface),t}serialize(){const e=Y.p4.Serialize(this);return e.customType="BABYLON.PBRMetallicRoughnessMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e.iridescence=this.iridescence.serialize(),e}static Parse(e,t,i){const n=Y.p4.Parse((()=>new pl(e.name,t)),e,t,i);return e.clearCoat&&n.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&n.anisotropy.parse(e.anisotropy,t,i),e.brdf&&n.brdf.parse(e.brdf,t,i),e.sheen&&n.sheen.parse(e.sheen,t,i),e.subSurface&&n.subSurface.parse(e.subSurface,t,i),e.iridescence&&n.iridescence.parse(e.iridescence,t,i),n}}(0,X.gn)([(0,Y.n9)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_albedoColor")],pl.prototype,"baseColor",void 0),(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],pl.prototype,"baseTexture",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],pl.prototype,"metallic",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty")],pl.prototype,"roughness",void 0),(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_metallicTexture")],pl.prototype,"metallicRoughnessTexture",void 0),(0,l.H)("BABYLON.PBRMetallicRoughnessMaterial",pl);class fl extends _l{constructor(e,t){super(e,t),this._useMicroSurfaceFromReflectivityMapAlpha=!0}get useMicroSurfaceFromReflectivityMapAlpha(){return this._useMicroSurfaceFromReflectivityMapAlpha}getClassName(){return"PBRSpecularGlossinessMaterial"}clone(e){const t=Y.p4.Clone((()=>new fl(e,this.getScene())),this);return t.id=e,t.name=e,this.clearCoat.copyTo(t.clearCoat),this.anisotropy.copyTo(t.anisotropy),this.brdf.copyTo(t.brdf),this.sheen.copyTo(t.sheen),this.subSurface.copyTo(t.subSurface),t}serialize(){const e=Y.p4.Serialize(this);return e.customType="BABYLON.PBRSpecularGlossinessMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e.iridescence=this.iridescence.serialize(),e}static Parse(e,t,i){const n=Y.p4.Parse((()=>new fl(e.name,t)),e,t,i);return e.clearCoat&&n.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&n.anisotropy.parse(e.anisotropy,t,i),e.brdf&&n.brdf.parse(e.brdf,t,i),e.sheen&&n.sheen.parse(e.sheen,t,i),e.subSurface&&n.subSurface.parse(e.subSurface,t,i),e.iridescence&&n.iridescence.parse(e.iridescence,t,i),n}}(0,X.gn)([(0,Y.n9)("diffuse"),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_albedoColor")],fl.prototype,"diffuseColor",void 0),(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],fl.prototype,"diffuseTexture",void 0),(0,X.gn)([(0,Y.n9)("specular"),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_reflectivityColor")],fl.prototype,"specularColor",void 0),(0,X.gn)([(0,Y.qC)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_microSurface")],fl.prototype,"glossiness",void 0),(0,X.gn)([(0,Y.oU)(),(0,Y.wz)("_markAllSubMeshesAsTexturesDirty","_reflectivityTexture")],fl.prototype,"specularGlossinessTexture",void 0),(0,l.H)("BABYLON.PBRSpecularGlossinessMaterial",fl),i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrSheenConfiguration.js"),i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrSubSurfaceConfiguration.js");class ml extends ro.V{constructor(e,t,i=null){if(super(t),e)if(this._textureMatrix=o.y3.Identity(),this.name=e,this.url=e,this._onLoad=i,this._texture=this._getFromCache(e,!0),this._texture)this._triggerOnLoad();else{const e=this.getScene();e&&e.useDelayedTextureLoading?this.delayLoadState=4:this._loadTexture()}}_triggerOnLoad(){this._onLoad&&this._onLoad()}getTextureMatrix(){return this._textureMatrix}_load3dlTexture(){const e=this._getEngine();let t;t=e._features.support3DTextures?e.createRawTexture3D(null,1,1,1,5,!1,!1,2,null,0):e.createRawTexture(null,1,1,5,!1,!1,2,null,0),this._texture=t,this._texture.isReady=!1,this.isCube=!1,this.is3D=e._features.support3DTextures,this.wrapU=0,this.wrapV=0,this.wrapR=0,this.anisotropicFilteringLevel=1;const i=i=>{if("string"!=typeof i)return;let n,r=null,s=null;const o=i.split("\n");let a=0,l=0,c=0,h=0,_=0;for(let e=0;e0&&(e+1)%4==0)r[e]=255;else{const t=s[e];r[e]=t/_*255}t.is3D?(t.updateSize(a,a,a),e.updateRawTexture3D(t,r,5,!1)):(t.updateSize(a*a,a),e.updateRawTexture(t,r,5,!1)),t.isReady=!0,this._triggerOnLoad()},n=this.getScene();return n?n._loadFile(this.url,i):e._loadFile(this.url,i),this._texture}_loadTexture(){this.url&&this.url.toLocaleLowerCase().indexOf(".3dl")==this.url.length-4&&this._load3dlTexture()}clone(){const e=new ml(this.url,this.getScene()||this._getEngine());return e.level=this.level,e}delayLoad(){4===this.delayLoadState&&(this.delayLoadState=1,this._texture=this._getFromCache(this.url,!0),this._texture||this._loadTexture())}static Parse(e,t){let i=null;return e.name&&!e.isRenderTarget&&(i=new ml(e.name,t),i.name=e.name,i.level=e.level),i}serialize(){if(!this.name)return null;const e={};return e.name=this.name,e.level=this.level,e.customType="BABYLON.ColorGradingTexture",e}}ml._NoneEmptyLineRegex=/\S+/,(0,l.H)("BABYLON.ColorGradingTexture",ml);var gl=i("../../../node_modules/@babylonjs/core/Misc/fileTools.js");class bl extends ro.V{constructor(e,t,i,n=!1,r=!0,s=null,o=null){if(super(t),this._onLoad=null,this._onError=null,!e)throw new Error("Image url is not set");this._coordinatesMode=K.x.CUBIC_MODE,this.name=e,this.url=e,this._size=i,this._noMipmap=n,this.gammaSpace=r,this._onLoad=s,this._onError=o,this.hasAlpha=!1,this.isCube=!0,this._texture=this._getFromCache(e,this._noMipmap,void 0,void 0,void 0,this.isCube),this._texture?s&&(this._texture.isReady?V.w1.SetImmediate((()=>s())):this._texture.onLoadedObservable.add(s)):t.useDelayedTextureLoading?this.delayLoadState=4:this._loadImage(this._loadTexture.bind(this),this._onError)}_loadImage(e,t){const i=document.createElement("canvas");(0,gl.r6)(this.url,(t=>{this._width=t.width,this._height=t.height,i.width=this._width,i.height=this._height;const n=i.getContext("2d");n.drawImage(t,0,0);const r=n.getImageData(0,0,t.width,t.height);this._buffer=r.data.buffer,i.remove(),e()}),((e,i)=>{t&&t(`${this.getClassName()} could not be loaded`,i)}),null)}_loadTexture(){const e=this.getScene();e&&(this._texture=e.getEngine().createRawCubeTextureFromUrl(this.url,e,this._size,4,e.getEngine().getCaps().textureFloat?1:7,this._noMipmap,(()=>{const e=this._getFloat32ArrayFromArrayBuffer(this._buffer),t=ka.ConvertPanoramaToCubemap(e,this._width,this._height,this._size),i=[];for(let e=0;e<6;e++){const n=t[bl._FacesMapping[e]];i.push(n)}return i}),null,this._onLoad,this._onError))}_getFloat32ArrayFromArrayBuffer(e){const t=new DataView(e),i=new Float32Array(3*e.byteLength/4);let n=0;for(let r=0;rt.length)return void u.Y.Error("Unable to load TGA file - Not enough data");i+=n.id_length;let r,s=!1,o=!1,a=!1;switch(n.image_type){case 9:s=!0;case 1:o=!0;break;case 10:s=!0;case 2:break;case 11:s=!0;case 3:a=!0}const l=n.pixel_size>>3,c=n.width*n.height*l;let h,_,d,p,f,m,g;if(o&&(h=t.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),s){let e,n,s;r=new Uint8Array(c);let o=0;const a=new Uint8Array(l);for(;i>4){default:case 2:_=0,p=1,g=n.width,d=0,f=1,m=n.height;break;case 0:_=0,p=1,g=n.width,d=n.height-1,f=-1,m=-1;break;case 3:_=n.width-1,p=-1,g=-1,d=0,f=1,m=n.height;break;case 1:_=n.width-1,p=-1,g=-1,d=n.height-1,f=-1,m=-1}const b="_getImageData"+(a?"Grey":"")+n.pixel_size+"bits",y=Cl[b](n,h,r,d,f,m,_,p,g);e.getEngine()._uploadDataToTextureDirectly(e,y)}yl._DefaultOptions={generateMipMaps:!1,samplingMode:2,engine:null,scene:null};const Cl={GetTGAHeader:vl,UploadContent:Al,_getImageData8bits:function(e,t,i,n,r,s,o,a,l){const c=i,h=t,_=e.width,d=e.height;let u,p,f,m=0;const g=new Uint8Array(_*d*4);for(f=n;f!==s;f+=r)for(p=o;p!==l;p+=a,m++)u=c[m],g[4*(p+_*f)+3]=255,g[4*(p+_*f)+2]=h[3*u+0],g[4*(p+_*f)+1]=h[3*u+1],g[4*(p+_*f)+0]=h[3*u+2];return g},_getImageData16bits:function(e,t,i,n,r,s,o,a,l){const c=i,h=e.width,_=e.height;let d,u,p,f=0;const m=new Uint8Array(h*_*4);for(p=n;p!==s;p+=r)for(u=o;u!==l;u+=a,f+=2){d=c[f+0]+(c[f+1]<<8);const e=255*((31744&d)>>10)/31|0,t=255*((992&d)>>5)/31|0,i=255*(31&d)/31|0;m[4*(u+h*p)+0]=e,m[4*(u+h*p)+1]=t,m[4*(u+h*p)+2]=i,m[4*(u+h*p)+3]=32768&d?0:255}return m},_getImageData24bits:function(e,t,i,n,r,s,o,a,l){const c=i,h=e.width,_=e.height;let d,u,p=0;const f=new Uint8Array(h*_*4);for(u=n;u!==s;u+=r)for(d=o;d!==l;d+=a,p+=3)f[4*(d+h*u)+3]=255,f[4*(d+h*u)+2]=c[p+0],f[4*(d+h*u)+1]=c[p+1],f[4*(d+h*u)+0]=c[p+2];return f},_getImageData32bits:function(e,t,i,n,r,s,o,a,l){const c=i,h=e.width,_=e.height;let d,u,p=0;const f=new Uint8Array(h*_*4);for(u=n;u!==s;u+=r)for(d=o;d!==l;d+=a,p+=4)f[4*(d+h*u)+2]=c[p+0],f[4*(d+h*u)+1]=c[p+1],f[4*(d+h*u)+0]=c[p+2],f[4*(d+h*u)+3]=c[p+3];return f},_getImageDataGrey8bits:function(e,t,i,n,r,s,o,a,l){const c=i,h=e.width,_=e.height;let d,u,p,f=0;const m=new Uint8Array(h*_*4);for(p=n;p!==s;p+=r)for(u=o;u!==l;u+=a,f++)d=c[f],m[4*(u+h*p)+0]=d,m[4*(u+h*p)+1]=d,m[4*(u+h*p)+2]=d,m[4*(u+h*p)+3]=255;return m},_getImageDataGrey16bits:function(e,t,i,n,r,s,o,a,l){const c=i,h=e.width,_=e.height;let d,u,p=0;const f=new Uint8Array(h*_*4);for(u=n;u!==s;u+=r)for(d=o;d!==l;d+=a,p+=2)f[4*(d+h*u)+0]=c[p+0],f[4*(d+h*u)+1]=c[p+0],f[4*(d+h*u)+2]=c[p+0],f[4*(d+h*u)+3]=c[p+1];return f}};var Sl;k.D._TextureLoaders.push(new class{constructor(){this.supportCascades=!1}canLoad(e){return e.endsWith(".tga")}loadCubeData(){throw".env not supported in Cube."}loadData(e,t,i){const n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=vl(n);i(r.width,r.height,t.generateMipMaps,!1,(()=>{Al(t,n)}))}}),k.D._TextureLoaders.push(new class{constructor(){this.supportCascades=!1}canLoad(e){return e.endsWith(".hdr")}loadCubeData(){throw".env not supported in Cube."}loadData(e,t,i){const n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=Va.RGBE_ReadHeader(n),s=Va.RGBE_ReadPixels(n,r),o=r.width*r.height,a=new Float32Array(4*o);for(let e=0;e{const e=t.getEngine();t.type=1,t.format=5,t._gammaSpace=!1,e._uploadDataToTextureDirectly(t,a)}))}}),function(e){e[e.cTFETC1=0]="cTFETC1",e[e.cTFETC2=1]="cTFETC2",e[e.cTFBC1=2]="cTFBC1",e[e.cTFBC3=3]="cTFBC3",e[e.cTFBC4=4]="cTFBC4",e[e.cTFBC5=5]="cTFBC5",e[e.cTFBC7=6]="cTFBC7",e[e.cTFPVRTC1_4_RGB=8]="cTFPVRTC1_4_RGB",e[e.cTFPVRTC1_4_RGBA=9]="cTFPVRTC1_4_RGBA",e[e.cTFASTC_4x4=10]="cTFASTC_4x4",e[e.cTFATC_RGB=11]="cTFATC_RGB",e[e.cTFATC_RGBA_INTERPOLATED_ALPHA=12]="cTFATC_RGBA_INTERPOLATED_ALPHA",e[e.cTFRGBA32=13]="cTFRGBA32",e[e.cTFRGB565=14]="cTFRGB565",e[e.cTFBGR565=15]="cTFBGR565",e[e.cTFRGBA4444=16]="cTFRGBA4444",e[e.cTFFXT1_RGB=17]="cTFFXT1_RGB",e[e.cTFPVRTC2_4_RGB=18]="cTFPVRTC2_4_RGB",e[e.cTFPVRTC2_4_RGBA=19]="cTFPVRTC2_4_RGBA",e[e.cTFETC2_EAC_R11=20]="cTFETC2_EAC_R11",e[e.cTFETC2_EAC_RG11=21]="cTFETC2_EAC_RG11"}(Sl||(Sl={}));const xl={JSModuleURL:"https://cdn.babylonjs.com/basisTranscoder/1/basis_transcoder.js",WasmModuleURL:"https://cdn.babylonjs.com/basisTranscoder/1/basis_transcoder.wasm"};let Tl=null,El=null,Rl=0;const Pl=(e,t)=>{const i=e instanceof ArrayBuffer?new Uint8Array(e):e;return new Promise(((e,n)=>{(Tl||(Tl=new Promise(((e,t)=>{El?e(El):V.w1.LoadFileAsync(xl.WasmModuleURL).then((i=>{if("function"!=typeof URL)return t("Basis transcoder requires an environment with a URL constructor");const n=URL.createObjectURL(new Blob([`(${Ol})()`],{type:"application/javascript"}));El=new Worker(n);const r=i=>{"init"===i.data.action?(El.removeEventListener("message",r),e(El)):"error"===i.data.action&&t(i.data.error||"error initializing worker")};El.addEventListener("message",r),El.postMessage({action:"init",url:xl.JSModuleURL,wasmBinary:i})})).catch(t)}))),Tl).then((()=>{const r=Rl++,s=t=>{"transcode"===t.data.action&&t.data.id===r&&(El.removeEventListener("message",s),t.data.success?e(t.data):n("Transcode is not supported on this device"))};El.addEventListener("message",s);const o=new Uint8Array(i.byteLength);o.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)),El.postMessage({action:"transcode",id:r,imageData:o,config:t,ignoreSupportedFormats:!1},[o.buffer])}),(e=>{n(e)}))}))},Il=(e,t)=>{let i=t._gl.TEXTURE_2D;e.isCube&&(i=t._gl.TEXTURE_CUBE_MAP),t._bindTextureDirectly(i,e,!0)},Ml=(e,t)=>{const i=e.getEngine();for(let n=0;n{i._releaseTexture(t),Il(e,i)}))}else{e.width=r.width,e.height=r.height,e.generateMipMaps=t.fileInfo.images[n].levels.length>1;const s=Dl.GetInternalFormatFromBasisFormat(t.format,i);e.format=s,Il(e,i),t.fileInfo.images[n].levels.forEach(((t,r)=>{i._uploadCompressedDataToTextureDirectly(e,s,t.width,t.height,t.transcodedPixels,n,r)})),!i._features.basisNeedsPOT||ve.R.Log2(e.width)%1==0&&ve.R.Log2(e.height)%1==0||(V.w1.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1."),e._cachedWrapU=K.x.CLAMP_ADDRESSMODE,e._cachedWrapV=K.x.CLAMP_ADDRESSMODE)}}},Dl={JSModuleURL:xl.JSModuleURL,WasmModuleURL:xl.WasmModuleURL,GetInternalFormatFromBasisFormat:(e,t)=>{let i;switch(e){case Sl.cTFETC1:i=36196;break;case Sl.cTFBC1:i=33776;break;case Sl.cTFBC4:i=33779;break;case Sl.cTFASTC_4x4:i=37808;break;case Sl.cTFETC2:i=37496;break;case Sl.cTFBC7:i=36492}if(void 0===i)throw"The chosen Basis transcoder format is not currently supported";return i},TranscodeAsync:Pl,LoadTextureFromTranscodeResult:Ml};function Ol(){let e=null;function t(e,t,i,n,r){const s=e.getImageTranscodedSizeInBytes(t,i,n);let o=new Uint8Array(s);return e.transcodeImage(o,t,i,n,1,0)?(r&&(o=function(e,t,i,n){const r=new Uint16Array(4),s=new Uint16Array(i*n),o=i/4,a=n/4;for(let t=0;t>2&3],s[c++]=r[l>>4&3],s[c++]=r[l>>6&3]}}return s}(o,0,e.getImageWidth(t,i)+3&-4,e.getImageHeight(t,i)+3&-4)),o):null}onmessage=i=>{if("init"===i.data.action){if(!e){try{importScripts(i.data.url)}catch(e){postMessage({action:"error",error:e})}e=BASIS({wasmBinary:i.data.wasmBinary})}null!==e&&e.then((e=>{BASIS=e,e.initializeBasis(),postMessage({action:"init"})}))}else if("transcode"===i.data.action){const e=i.data.config,n=i.data.imageData,r=new BASIS.BasisFile(n),s=function(e){const t=e.getHasAlpha(),i=e.getNumImages(),n=[];for(let t=0;t{const i=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;Ml(t,e),t.getEngine()._setCubeMapTextureParams(t,i),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n()})).catch((e=>{V.w1.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),t.isReady=!0,r&&r(e)}))}loadData(e,t,i){const n=t.getEngine().getCaps(),r={supportedCompressionFormats:{etc1:!!n.etc1,s3tc:!!n.s3tc,pvrtc:!!n.pvrtc,etc2:!!n.etc2,astc:!!n.astc,bc7:!!n.bptc}};Pl(e,r).then((e=>{const n=e.fileInfo.images[0].levels[0],r=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;i(n.width,n.height,r,-1!==e.format,(()=>{Ml(t,e)}))})).catch((e=>{V.w1.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),V.w1.Warn(`Failed to transcode Basis file: ${e}`),i(0,0,!1,!1,(()=>{}),!0)}))}});class wl extends Ot._{constructor(e,t,i,n,r,s){const o=!(!r||!r.generateMipMaps)&&r.generateMipMaps,a=!(!r||!r.generateDepthTexture)&&r.generateDepthTexture,l=r&&r.depthTextureFormat?r.depthTextureFormat:15,c=!r||void 0===r.doNotChangeAspectRatio||r.doNotChangeAspectRatio,h=!(!r||!r.drawOnlyOnFirstAttachmentByDefault)&&r.drawOnlyOnFirstAttachmentByDefault;if(super(e,t,n,o,c,void 0,void 0,void 0,void 0,void 0,void 0,void 0,!0),!this.isSupported)return void this.dispose();const _=[],d=[],u=[];this._initTypes(i,_,d,u,r);const p=!r||void 0===r.generateDepthBuffer||r.generateDepthBuffer,f=!(!r||void 0===r.generateStencilBuffer)&&r.generateStencilBuffer;this._size=t,this._multiRenderTargetOptions={samplingModes:d,generateMipMaps:o,generateDepthBuffer:p,generateStencilBuffer:f,generateDepthTexture:a,depthTextureFormat:l,types:_,textureCount:i,useSRGBBuffers:u},this._count=i,this._drawOnlyOnFirstAttachmentByDefault=h,i>0&&(this._createInternalTextures(),this._createTextures(s))}get isSupported(){var e,t;return null!==(t=null===(e=this._engine)||void 0===e?void 0:e.getCaps().drawBuffersExtension)&&void 0!==t&&t}get textures(){return this._textures}get count(){return this._count}get depthTexture(){return this._textures[this._textures.length-1]}set wrapU(e){if(this._textures)for(let t=0;t{this.onAfterRenderObservable.notifyObservers(t)}))}dispose(e=!1){this._releaseTextures(),e?this._texture=null:this.releaseInternalTextures(),super.dispose()}releaseInternalTextures(){var e,t;const i=null===(e=this._renderTarget)||void 0===e?void 0:e.textures;if(i){for(let e=i.length-1;e>=0;e--)this._textures[e]._texture=null;null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=null}}}class Fl{constructor(e,t,i){this.id=e,this.scale=t,this.offset=i}}class Bl{constructor(e,t,i,n){var r,s,o,l,c,h,_,d,u,p,f,m,g;return this.name=e,this.meshes=t,this.scene=n,this.options=i,this.options.map=null!==(r=this.options.map)&&void 0!==r?r:["ambientTexture","bumpTexture","diffuseTexture","emissiveTexture","lightmapTexture","opacityTexture","reflectionTexture","refractionTexture","specularTexture"],this.options.uvsIn=null!==(s=this.options.uvsIn)&&void 0!==s?s:le.o.UVKind,this.options.uvsOut=null!==(o=this.options.uvsOut)&&void 0!==o?o:le.o.UVKind,this.options.layout=null!==(l=this.options.layout)&&void 0!==l?l:Bl.LAYOUT_STRIP,this.options.layout===Bl.LAYOUT_COLNUM&&(this.options.colnum=null!==(c=this.options.colnum)&&void 0!==c?c:8),this.options.updateInputMeshes=null===(h=this.options.updateInputMeshes)||void 0===h||h,this.options.disposeSources=null===(_=this.options.disposeSources)||void 0===_||_,this._expecting=0,this.options.fillBlanks=null===(d=this.options.fillBlanks)||void 0===d||d,!0===this.options.fillBlanks&&(this.options.customFillColor=null!==(u=this.options.customFillColor)&&void 0!==u?u:"black"),this.options.frameSize=null!==(p=this.options.frameSize)&&void 0!==p?p:256,this.options.paddingRatio=null!==(f=this.options.paddingRatio)&&void 0!==f?f:.0115,this._paddingValue=Math.ceil(this.options.frameSize*this.options.paddingRatio),this._paddingValue%2!=0&&this._paddingValue++,this.options.paddingMode=null!==(m=this.options.paddingMode)&&void 0!==m?m:Bl.SUBUV_WRAP,this.options.paddingMode===Bl.SUBUV_COLOR&&(this.options.paddingColor=null!==(g=this.options.paddingColor)&&void 0!==g?g:new a.HE(0,0,0,1)),this.sets={},this.frames=[],this}_createFrames(e){const t=this._calculateSize(),i=new o.FM(1,1).divide(t);let n=0;const r=this._expecting,s=this.meshes.length,l=Object.keys(this.sets);for(let e=0;e{this._calculateMeshUVFrames(c,h,t,i,this.options.updateInputMeshes||!1)};for(let i=0;i{n++,u.update(!1);const i=p.getImageData(0,0,_,_),s=this.sets[g];if(s.getContext().putImageData(i,t.x*f.x,t.y*f.y),u.dispose(),s.update(!1),n==r)return d(),void e()},g=l[o]||"_blank";if(s&&null!==s[g]){const e=s[g],t=new Image;e instanceof Qt.c?t.src=e.getContext().canvas.toDataURL("image/png"):t.src=e.url,V.w1.SetCorsBehavior(t.src,t),t.onload=()=>{p.fillStyle="rgba(0,0,0,0)",p.fillRect(0,0,_,_),u.update(!1),p.setTransform(1,0,0,-1,0,0);const e=[0,0,1,0,1,1,0,1,-1,1,-1,0,-2,0,-1,1,-1];switch(this.options.paddingMode){case 0:for(let i=0;i<9;i++)p.drawImage(t,0,0,t.width,t.height,h+c*e[i],h+c*e[i+1]-_,c,c);break;case 1:for(let i=0;i{e.dispose&&e.dispose()};for(let e=0;e{try{if(0===this.meshes.length)return void e();let t=0;const i=i=>{if(t++,this.options.map){for(let e=0;e{i(s)}));else if(t++,t===this.meshes.length)return this._createFrames(e)}}catch(e){return t(e)}}))}dispose(){const e=Object.keys(this.sets);for(let t=0;t{const i={name:this.name,sets:{},options:{},frames:[]},n=Object.keys(this.sets),r=Object.keys(this.options);try{for(let r=0;re.isAttribute&&"matricesIndices"===e.name));t||(t=new Yl.S("matricesIndices"),t.setAsAttribute("matricesIndices")),t.output.connectTo(this.matricesIndices)}if(!this.matricesWeights.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"matricesWeights"===e.name));t||(t=new Yl.S("matricesWeights"),t.setAsAttribute("matricesWeights")),t.output.connectTo(this.matricesWeights)}if(!this.world.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.World));t||(t=new Yl.S("world"),t.setAsSystemValue(jl.$.World)),t.output.connectTo(this.world)}}provideFallbacks(e,t){e&&e.useBones&&e.computeBonesUsingShaders&&e.skeleton&&t.addCPUSkinningFallback(0,e)}bind(e,t,i){lo.G.BindBonesParameters(i,e)}prepareDefines(e,t,i){i._areAttributesDirty&&lo.G.PrepareDefinesForBones(e,i)}_buildBlock(e){super._buildBlock(e),e.sharedData.blocksWithFallbacks.push(this),e.sharedData.forcedBindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e.uniforms.push("boneTextureWidth"),e.uniforms.push("mBones"),e.samplers.push("boneSampler");const t=`//${this.name}`;e._emitFunctionFromInclude("bonesDeclaration",t,{removeAttributes:!0,removeUniforms:!1,removeVaryings:!0,removeIfDef:!1});const i=e._getFreeVariableName("influence");e.compilationString+=e._emitCodeFromInclude("bonesVertex",t,{replaceStrings:[{search:/finalWorld=finalWorld\*influence;/,replace:""},{search:/influence/gm,replace:i}]});const n=this._outputs[0],r=this.world;return e.compilationString+="#if NUM_BONE_INFLUENCERS>0\r\n",e.compilationString+=this._declareOutput(n,e)+` = ${r.associatedVariableName} * ${i};\r\n`,e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(n,e)+` = ${r.associatedVariableName};\r\n`,e.compilationString+="#endif\r\n",this}}(0,l.H)("BABYLON.BonesBlock",Ql);class ql extends Xl.k{constructor(e){super(e,Ul.u.Vertex),this.registerInput("world0",Gl.E.Vector4),this.registerInput("world1",Gl.E.Vector4),this.registerInput("world2",Gl.E.Vector4),this.registerInput("world3",Gl.E.Vector4),this.registerInput("world",Gl.E.Matrix,!0),this.registerOutput("output",Gl.E.Matrix),this.registerOutput("instanceID",Gl.E.Float)}getClassName(){return"InstancesBlock"}get world0(){return this._inputs[0]}get world1(){return this._inputs[1]}get world2(){return this._inputs[2]}get world3(){return this._inputs[3]}get world(){return this._inputs[4]}get output(){return this._outputs[0]}get instanceID(){return this._outputs[1]}autoConfigure(e){if(!this.world0.connectedPoint){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"world0"===e.name));t||(t=new Yl.S("world0"),t.setAsAttribute("world0")),t.output.connectTo(this.world0)}if(!this.world1.connectedPoint){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"world1"===e.name));t||(t=new Yl.S("world1"),t.setAsAttribute("world1")),t.output.connectTo(this.world1)}if(!this.world2.connectedPoint){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"world2"===e.name));t||(t=new Yl.S("world2"),t.setAsAttribute("world2")),t.output.connectTo(this.world2)}if(!this.world3.connectedPoint){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"world3"===e.name));t||(t=new Yl.S("world3"),t.setAsAttribute("world3")),t.output.connectTo(this.world3)}if(!this.world.connectedPoint){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"world"===e.name));t||(t=new Yl.S("world"),t.setAsSystemValue(jl.$.World)),t.output.connectTo(this.world)}this.world.define="!INSTANCES || THIN_INSTANCES"}prepareDefines(e,t,i,n=!1,r){let s=!1;i.INSTANCES!==n&&(i.setValue("INSTANCES",n),s=!0),r&&i.THIN_INSTANCES!==!!(null==r?void 0:r.getRenderingMesh().hasThinInstances)&&(i.setValue("THIN_INSTANCES",!!(null==r?void 0:r.getRenderingMesh().hasThinInstances)),s=!0),s&&i.markAsUnprocessed()}_buildBlock(e){super._buildBlock(e);const t=e.sharedData.scene.getEngine();e.sharedData.blocksWithDefines.push(this);const i=this._outputs[0],n=this._outputs[1],r=this.world0,s=this.world1,o=this.world2,a=this.world3;return e.compilationString+="#ifdef INSTANCES\r\n",e.compilationString+=this._declareOutput(i,e)+` = mat4(${r.associatedVariableName}, ${s.associatedVariableName}, ${o.associatedVariableName}, ${a.associatedVariableName});\r\n`,e.compilationString+="#ifdef THIN_INSTANCES\r\n",e.compilationString+=`${i.associatedVariableName} = ${this.world.associatedVariableName} * ${i.associatedVariableName};\r\n`,e.compilationString+="#endif\r\n",t._caps.canUseGLInstanceID?e.compilationString+=this._declareOutput(n,e)+" = float(gl_InstanceID);\r\n":e.compilationString+=this._declareOutput(n,e)+" = 0.0;\r\n",e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(i,e)+` = ${this.world.associatedVariableName};\r\n`,e.compilationString+=this._declareOutput(n,e)+" = 0.0;\r\n",e.compilationString+="#endif\r\n",this}}(0,l.H)("BABYLON.InstancesBlock",ql);class Kl extends Xl.k{constructor(e){super(e,Ul.u.Vertex),this.registerInput("position",Gl.E.Vector3),this.registerInput("normal",Gl.E.Vector3),this.registerInput("tangent",Gl.E.Vector4),this.tangent.acceptedConnectionPointTypes.push(Gl.E.Vector3),this.registerInput("uv",Gl.E.Vector2),this.registerOutput("positionOutput",Gl.E.Vector3),this.registerOutput("normalOutput",Gl.E.Vector3),this.registerOutput("tangentOutput",Gl.E.Vector4),this.registerOutput("uvOutput",Gl.E.Vector2)}getClassName(){return"MorphTargetsBlock"}get position(){return this._inputs[0]}get normal(){return this._inputs[1]}get tangent(){return this._inputs[2]}get uv(){return this._inputs[3]}get positionOutput(){return this._outputs[0]}get normalOutput(){return this._outputs[1]}get tangentOutput(){return this._outputs[2]}get uvOutput(){return this._outputs[3]}initialize(e){e._excludeVariableName("morphTargetInfluences")}autoConfigure(e){if(!this.position.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"position"===e.name));t||(t=new Yl.S("position"),t.setAsAttribute()),t.output.connectTo(this.position)}if(!this.normal.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"normal"===e.name));t||(t=new Yl.S("normal"),t.setAsAttribute("normal")),t.output.connectTo(this.normal)}if(!this.tangent.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"tangent"===e.name));t||(t=new Yl.S("tangent"),t.setAsAttribute("tangent")),t.output.connectTo(this.tangent)}if(!this.uv.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"uv"===e.name));t||(t=new Yl.S("uv"),t.setAsAttribute("uv")),t.output.connectTo(this.uv)}}prepareDefines(e,t,i){if(e.morphTargetManager){const t=e.morphTargetManager;(null==t?void 0:t.isUsingTextureForTargets)&&t.numInfluencers!==i.NUM_MORPH_INFLUENCERS&&i.markAsAttributesDirty()}i._areAttributesDirty&&lo.G.PrepareDefinesForMorphTargets(e,i)}bind(e,t,i){i&&i.morphTargetManager&&i.morphTargetManager.numInfluencers>0&&(lo.G.BindMorphTargetParameters(i,e),i.morphTargetManager.isUsingTextureForTargets&&i.morphTargetManager._bind(e))}replaceRepeatableContent(e,t,i,n){const r=this.position,s=this.normal,o=this.tangent,a=this.uv,l=this.positionOutput,c=this.normalOutput,h=this.tangentOutput,_=this.uvOutput,d=e,u=n.NUM_MORPH_INFLUENCERS,p=i.morphTargetManager,f=p&&p.supportsNormals&&n.NORMAL,m=p&&p.supportsTangents&&n.TANGENT,g=p&&p.supportsUVs&&n.UV1;let b="";(null==p?void 0:p.isUsingTextureForTargets)&&u>0&&(b+="float vertexID;\r\n");for(let e=0;e0)for(let e=0;ee.isSystemValue&&e.systemValue===jl.$.World));t||(t=new Yl.S("world"),t.setAsSystemValue(jl.$.World)),t.output.connectTo(this.world)}if(!this.normal.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"normal"===e.name));t||(t=new Yl.S("normal"),t.setAsAttribute("normal")),t.output.connectTo(this.normal)}if(!this.tangent.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"tangent"===e.name&&e.type===Gl.E.Vector4));t||(t=new Yl.S("tangent"),t.setAsAttribute("tangent")),t.output.connectTo(this.tangent)}}prepareDefines(e,t,i){var n,r,s,o;const a=this.normal,l=this.tangent;let c=a.isConnected;(null===(n=a.connectInputBlock)||void 0===n?void 0:n.isAttribute)&&!e.isVerticesDataPresent(null===(r=a.connectInputBlock)||void 0===r?void 0:r.name)&&(c=!1);let h=l.isConnected;(null===(s=l.connectInputBlock)||void 0===s?void 0:s.isAttribute)&&!e.isVerticesDataPresent(null===(o=l.connectInputBlock)||void 0===o?void 0:o.name)&&(h=!1);const _=c&&h;i.setValue("TBNBLOCK",_,!0)}_buildBlock(e){super._buildBlock(e);const t=this.normal,i=this.tangent,n=this.world,r=this.TBN,s=this.row0,o=this.row1,a=this.row2;return e.target===Ul.u.Fragment&&(e.compilationString+=`\n // ${this.name}\n vec3 tbnNormal = normalize(${t.associatedVariableName}).xyz;\n vec3 tbnTangent = normalize(${i.associatedVariableName}.xyz);\n vec3 tbnBitangent = cross(tbnNormal, tbnTangent) * ${i.associatedVariableName}.w;\n mat3 ${r.associatedVariableName} = mat3(${n.associatedVariableName}) * mat3(tbnTangent, tbnBitangent, tbnNormal);\n `,s.hasEndpoints&&(e.compilationString+=this._declareOutput(s,e)+` = vec3(${r.associatedVariableName}[0][0], ${r.associatedVariableName}[0][1], ${r.associatedVariableName}[0][2]);\r\n`),o.hasEndpoints&&(e.compilationString+=this._declareOutput(o,e)+` = vec3(${r.associatedVariableName}[1[0], ${r.associatedVariableName}[1][1], ${r.associatedVariableName}[1][2]);\r\n`),a.hasEndpoints&&(e.compilationString+=this._declareOutput(a,e)+` = vec3(${r.associatedVariableName}[2][0], ${r.associatedVariableName}[2][1], ${r.associatedVariableName}[2][2]);\r\n`),e.sharedData.blocksWithDefines.push(this)),this}}(0,l.H)("BABYLON.TBNBlock",tc),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentMainFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentFunctions.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragment.js");class ic extends Xl.k{constructor(e){super(e,Ul.u.Fragment),this._tangentSpaceParameterName="",this.invertX=!1,this.invertY=!1,this.useParallaxOcclusion=!1,this._isUnique=!0,this.registerInput("worldPosition",Gl.E.Vector4,!1),this.registerInput("worldNormal",Gl.E.Vector4,!1),this.registerInput("worldTangent",Gl.E.Vector4,!0),this.registerInput("uv",Gl.E.Vector2,!1),this.registerInput("normalMapColor",Gl.E.Color3,!1),this.registerInput("strength",Gl.E.Float,!1),this.registerInput("viewDirection",Gl.E.Vector3,!0),this.registerInput("parallaxScale",Gl.E.Float,!0),this.registerInput("parallaxHeight",Gl.E.Float,!0),this.registerInput("TBN",Gl.E.Object,!0,Ul.u.VertexAndFragment,new Hl("TBN",this,zl.Ab.Input,tc,"TBNBlock")),this.registerOutput("output",Gl.E.Vector4),this.registerOutput("uvOffset",Gl.E.Vector2)}getClassName(){return"PerturbNormalBlock"}get worldPosition(){return this._inputs[0]}get worldNormal(){return this._inputs[1]}get worldTangent(){return this._inputs[2]}get uv(){return this._inputs[3]}get normalMapColor(){return this._inputs[4]}get strength(){return this._inputs[5]}get viewDirection(){return this._inputs[6]}get parallaxScale(){return this._inputs[7]}get parallaxHeight(){return this._inputs[8]}get TBN(){return this._inputs[9]}get output(){return this._outputs[0]}get uvOffset(){return this._outputs[1]}prepareDefines(e,t,i){const n=this.normalMapColor.connectedPoint._ownerBlock.samplerName,r=this.viewDirection.isConnected&&(this.useParallaxOcclusion&&n||!this.useParallaxOcclusion&&this.parallaxHeight.isConnected);i.setValue("BUMP",!0),i.setValue("PARALLAX",r,!0),i.setValue("PARALLAXOCCLUSION",this.useParallaxOcclusion,!0)}bind(e,t){t.getScene()._mirroredCameraPosition?e.setFloat2(this._tangentSpaceParameterName,this.invertX?1:-1,this.invertY?1:-1):e.setFloat2(this._tangentSpaceParameterName,this.invertX?-1:1,this.invertY?-1:1)}autoConfigure(e){if(!this.uv.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"uv"===e.name));t||(t=new Yl.S("uv"),t.setAsAttribute()),t.output.connectTo(this.uv)}if(!this.strength.isConnected){const e=new Yl.S("strength");e.value=1,e.output.connectTo(this.strength)}}_buildBlock(e){super._buildBlock(e);const t=`//${this.name}`,i=this.uv,n=this.worldPosition,r=this.worldNormal,s=this.worldTangent;e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),this._tangentSpaceParameterName=e._getFreeDefineName("tangentSpaceParameter"),e._emitUniformFromString(this._tangentSpaceParameterName,"vec2");let o=null;this.normalMapColor.connectedPoint&&(o=this.normalMapColor.connectedPoint._ownerBlock.samplerName);const a=this.viewDirection.isConnected&&(this.useParallaxOcclusion&&o||!this.useParallaxOcclusion&&this.parallaxHeight.isConnected),l=this.parallaxScale.isConnectedToInputBlock?this.parallaxScale.connectInputBlock.isConstant?e._emitFloat(this.parallaxScale.connectInputBlock.value):this.parallaxScale.associatedVariableName:"0.05",c=this.strength.isConnectedToInputBlock&&this.strength.connectInputBlock.isConstant?`\r\n#if !defined(NORMALXYSCALE)\r\n1.0/\r\n#endif\r\n${e._emitFloat(this.strength.connectInputBlock.value)}`:`\r\n#if !defined(NORMALXYSCALE)\r\n1.0/\r\n#endif\r\n${this.strength.associatedVariableName}`;e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");const h={search:/defined\(TANGENT\)/g,replace:s.isConnected?"defined(TANGENT)":"defined(IGNORE)"},_=this.TBN;_.isConnected?e.compilationString+=`\n #ifdef TBNBLOCK\n mat3 vTBN = ${_.associatedVariableName};\n #endif\n `:s.isConnected&&(e.compilationString+=`vec3 tbnNormal = normalize(${r.associatedVariableName}.xyz);\r\n`,e.compilationString+=`vec3 tbnTangent = normalize(${s.associatedVariableName}.xyz);\r\n`,e.compilationString+="vec3 tbnBitangent = cross(tbnNormal, tbnTangent);\r\n",e.compilationString+="mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r\n"),e._emitFunctionFromInclude("bumpFragmentMainFunctions",t,{replaceStrings:[h,{search:/varying mat3 vTBN/g,replace:""}]}),e._emitFunctionFromInclude("bumpFragmentFunctions",t,{replaceStrings:[{search:/#include\(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump\)/g,replace:""},{search:/uniform sampler2D bumpSampler;/g,replace:""},{search:/vec2 parallaxOcclusion\(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale\)/g,replace:"#define inline\r\nvec2 parallaxOcclusion(vec3 vViewDirCoT, vec3 vNormalCoT, vec2 texCoord, float parallaxScale, sampler2D bumpSampler)"},{search:/vec2 parallaxOffset\(vec3 viewDir,float heightScale\)/g,replace:"vec2 parallaxOffset(vec3 viewDir, float heightScale, float height_)"},{search:/texture2D\(bumpSampler,vBumpUV\)\.w/g,replace:"height_"}]});const d=a&&o?`texture2D(${o}, ${i.associatedVariableName} + uvOffset).xyz`:this.normalMapColor.associatedVariableName;return e.compilationString+=this._declareOutput(this.output,e)+" = vec4(0.);\r\n",e.compilationString+=e._emitCodeFromInclude("bumpFragment",t,{replaceStrings:[{search:/perturbNormal\(TBN,texture2D\(bumpSampler,vBumpUV\+uvOffset\).xyz,vBumpInfos.y\)/g,replace:`perturbNormal(TBN, ${d}, vBumpInfos.y)`},{search:/parallaxOcclusion\(invTBN\*-viewDirectionW,invTBN\*normalW,vBumpUV,vBumpInfos.z\)/g,replace:`parallaxOcclusion((invTBN * -viewDirectionW), (invTBN * normalW), vBumpUV, vBumpInfos.z, ${a&&this.useParallaxOcclusion?o:"bumpSampler"})`},{search:/parallaxOffset\(invTBN\*viewDirectionW,vBumpInfos\.z\)/g,replace:`parallaxOffset(invTBN * viewDirectionW, vBumpInfos.z, ${a?this.parallaxHeight.associatedVariableName:"0."})`},{search:/vTangentSpaceParams/g,replace:this._tangentSpaceParameterName},{search:/vBumpInfos.y/g,replace:c},{search:/vBumpInfos.z/g,replace:l},{search:/vBumpUV/g,replace:i.associatedVariableName},{search:/vPositionW/g,replace:n.associatedVariableName+".xyz"},{search:/normalW=/g,replace:this.output.associatedVariableName+".xyz = "},{search:/mat3\(normalMatrix\)\*normalW/g,replace:"mat3(normalMatrix) * "+this.output.associatedVariableName+".xyz"},{search:/normalW/g,replace:r.associatedVariableName+".xyz"},{search:/viewDirectionW/g,replace:a?this.viewDirection.associatedVariableName:"vec3(0.)"},h]}),this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode()+`${this._codeVariableName}.invertX = ${this.invertX};\r\n`;return e+=`${this._codeVariableName}.invertY = ${this.invertY};\r\n`,e+=`${this._codeVariableName}.useParallaxOcclusion = ${this.useParallaxOcclusion};\r\n`,e}serialize(){const e=super.serialize();return e.invertX=this.invertX,e.invertY=this.invertY,e.useParallaxOcclusion=this.useParallaxOcclusion,e}_deserialize(e,t,i){super._deserialize(e,t,i),this.invertX=e.invertX,this.invertY=e.invertY,this.useParallaxOcclusion=!!e.useParallaxOcclusion}}(0,X.gn)([(0,Jl.p)("Invert X axis",Jl.U.Boolean,"PROPERTIES",{notifiers:{update:!1}})],ic.prototype,"invertX",void 0),(0,X.gn)([(0,Jl.p)("Invert Y axis",Jl.U.Boolean,"PROPERTIES",{notifiers:{update:!1}})],ic.prototype,"invertY",void 0),(0,X.gn)([(0,Jl.p)("Use parallax occlusion",Jl.U.Boolean)],ic.prototype,"useParallaxOcclusion",void 0),(0,l.H)("BABYLON.PerturbNormalBlock",ic);class nc extends Xl.k{constructor(e){super(e,Ul.u.Fragment,!0),this.registerInput("value",Gl.E.Float,!0),this.registerInput("cutoff",Gl.E.Float,!0)}getClassName(){return"DiscardBlock"}get value(){return this._inputs[0]}get cutoff(){return this._inputs[1]}_buildBlock(e){if(super._buildBlock(e),e.sharedData.hints.needAlphaTesting=!0,this.cutoff.isConnected&&this.value.isConnected)return e.compilationString+=`if (${this.value.associatedVariableName} < ${this.cutoff.associatedVariableName}) discard;\r\n`,this}}(0,l.H)("BABYLON.DiscardBlock",nc);class rc extends Xl.k{constructor(e){super(e,Ul.u.Fragment),this.registerOutput("output",Gl.E.Float,Ul.u.Fragment)}getClassName(){return"FrontFacingBlock"}get output(){return this._outputs[0]}_buildBlock(e){if(super._buildBlock(e),e.target===Ul.u.Vertex)throw"FrontFacingBlock must only be used in a fragment shader";const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = gl_FrontFacing ? 1.0 : 0.0;\r\n",this}}(0,l.H)("BABYLON.FrontFacingBlock",rc);class sc extends Xl.k{constructor(e){super(e,Ul.u.Fragment),this.registerInput("input",Gl.E.AutoDetect,!1),this.registerOutput("dx",Gl.E.BasedOnInput),this.registerOutput("dy",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._outputs[1]._typeConnectionSource=this._inputs[0]}getClassName(){return"DerivativeBlock"}get input(){return this._inputs[0]}get dx(){return this._outputs[0]}get dy(){return this._outputs[1]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0],i=this._outputs[1];return e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable"),t.hasEndpoints&&(e.compilationString+=this._declareOutput(t,e)+` = dFdx(${this.input.associatedVariableName});\r\n`),i.hasEndpoints&&(e.compilationString+=this._declareOutput(i,e)+` = dFdy(${this.input.associatedVariableName});\r\n`),this}}(0,l.H)("BABYLON.DerivativeBlock",sc);class oc extends Xl.k{constructor(e){super(e,Ul.u.Fragment),this.registerOutput("xy",Gl.E.Vector2,Ul.u.Fragment),this.registerOutput("xyz",Gl.E.Vector3,Ul.u.Fragment),this.registerOutput("xyzw",Gl.E.Vector4,Ul.u.Fragment),this.registerOutput("x",Gl.E.Float,Ul.u.Fragment),this.registerOutput("y",Gl.E.Float,Ul.u.Fragment),this.registerOutput("z",Gl.E.Float,Ul.u.Fragment),this.registerOutput("w",Gl.E.Float,Ul.u.Fragment)}getClassName(){return"FragCoordBlock"}get xy(){return this._outputs[0]}get xyz(){return this._outputs[1]}get xyzw(){return this._outputs[2]}get x(){return this._outputs[3]}get y(){return this._outputs[4]}get z(){return this._outputs[5]}get output(){return this._outputs[6]}writeOutputs(e){let t="";for(const i of this._outputs)i.hasEndpoints&&(t+=`${this._declareOutput(i,e)} = gl_FragCoord.${i.name};\r\n`);return t}_buildBlock(e){if(super._buildBlock(e),e.target===Ul.u.Vertex)throw"FragCoordBlock must only be used in a fragment shader";return e.compilationString+=this.writeOutputs(e),this}}(0,l.H)("BABYLON.FragCoordBlock",oc);class ac extends Xl.k{constructor(e){super(e,Ul.u.Fragment),this.registerOutput("xy",Gl.E.Vector2,Ul.u.Fragment),this.registerOutput("x",Gl.E.Float,Ul.u.Fragment),this.registerOutput("y",Gl.E.Float,Ul.u.Fragment)}getClassName(){return"ScreenSizeBlock"}get xy(){return this._outputs[0]}get x(){return this._outputs[1]}get y(){return this._outputs[2]}bind(e){const t=this._scene.getEngine();e.setFloat2(this._varName,t.getRenderWidth(),t.getRenderHeight())}writeOutputs(e,t){let i="";for(const n of this._outputs)n.hasEndpoints&&(i+=`${this._declareOutput(n,e)} = ${t}.${n.name};\r\n`);return i}_buildBlock(e){if(super._buildBlock(e),this._scene=e.sharedData.scene,e.target===Ul.u.Vertex)throw"ScreenSizeBlock must only be used in a fragment shader";return e.sharedData.bindableBlocks.push(this),this._varName=e._getFreeVariableName("screenSize"),e._emitUniformFromString(this._varName,"vec2"),e.compilationString+=this.writeOutputs(e,this._varName),this}}(0,l.H)("BABYLON.ScreenSizeBlock",ac);class lc extends Xl.k{constructor(e){super(e,Ul.u.Fragment),this.registerInput("vector",Gl.E.Vector3),this.registerInput("worldViewProjection",Gl.E.Matrix),this.registerOutput("output",Gl.E.Vector2),this.registerOutput("x",Gl.E.Float),this.registerOutput("y",Gl.E.Float),this.inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector4)}getClassName(){return"ScreenSpaceBlock"}get vector(){return this._inputs[0]}get worldViewProjection(){return this._inputs[1]}get output(){return this._outputs[0]}get x(){return this._outputs[1]}get y(){return this._outputs[2]}autoConfigure(e){if(!this.worldViewProjection.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.WorldViewProjection));t||(t=new Yl.S("worldViewProjection"),t.setAsSystemValue(jl.$.WorldViewProjection)),t.output.connectTo(this.worldViewProjection)}}_buildBlock(e){super._buildBlock(e);const t=this.vector,i=this.worldViewProjection;if(!t.connectedPoint)return;const n=i.associatedVariableName,r=e._getFreeVariableName("screenSpaceTemp");switch(t.connectedPoint.type){case Gl.E.Vector3:e.compilationString+=`vec4 ${r} = ${n} * vec4(${t.associatedVariableName}, 1.0);\r\n`;break;case Gl.E.Vector4:e.compilationString+=`vec4 ${r} = ${n} * ${t.associatedVariableName};\r\n`}return e.compilationString+=`${r}.xy /= ${r}.w;`,e.compilationString+=`${r}.xy = ${r}.xy * 0.5 + vec2(0.5, 0.5);`,this.output.hasEndpoints&&(e.compilationString+=this._declareOutput(this.output,e)+` = ${r}.xy;\r\n`),this.x.hasEndpoints&&(e.compilationString+=this._declareOutput(this.x,e)+` = ${r}.x;\r\n`),this.y.hasEndpoints&&(e.compilationString+=this._declareOutput(this.y,e)+` = ${r}.y;\r\n`),this}}(0,l.H)("BABYLON.ScreenSpaceBlock",lc);class cc extends Xl.k{constructor(e){super(e,Ul.u.Fragment),this.registerInput("input",Gl.E.Vector2),this.registerInput("strength",Gl.E.Float),this.registerInput("center",Gl.E.Vector2),this.registerInput("offset",Gl.E.Vector2),this.registerOutput("output",Gl.E.Vector2),this.registerOutput("x",Gl.E.Float),this.registerOutput("y",Gl.E.Float)}getClassName(){return"TwirlBlock"}get input(){return this._inputs[0]}get strength(){return this._inputs[1]}get center(){return this._inputs[2]}get offset(){return this._inputs[3]}get output(){return this._outputs[0]}get x(){return this._outputs[1]}get y(){return this._outputs[2]}autoConfigure(){if(!this.center.isConnected){const e=new Yl.S("center");e.value=new o.FM(.5,.5),e.output.connectTo(this.center)}if(!this.strength.isConnected){const e=new Yl.S("strength");e.value=1,e.output.connectTo(this.strength)}if(!this.offset.isConnected){const e=new Yl.S("offset");e.value=new o.FM(0,0),e.output.connectTo(this.offset)}}_buildBlock(e){super._buildBlock(e);const t=e._getFreeVariableName("delta"),i=e._getFreeVariableName("angle"),n=e._getFreeVariableName("x"),r=e._getFreeVariableName("y"),s=e._getFreeVariableName("result");return e.compilationString+=`\n vec2 ${t} = ${this.input.associatedVariableName} - ${this.center.associatedVariableName};\n float ${i} = ${this.strength.associatedVariableName} * length(${t});\n float ${n} = cos(${i}) * ${t}.x - sin(${i}) * ${t}.y;\n float ${r} = sin(${i}) * ${t}.x + cos(${i}) * ${t}.y;\n vec2 ${s} = vec2(${n} + ${this.center.associatedVariableName}.x + ${this.offset.associatedVariableName}.x, ${r} + ${this.center.associatedVariableName}.y + ${this.offset.associatedVariableName}.y);\n `,this.output.hasEndpoints&&(e.compilationString+=this._declareOutput(this.output,e)+` = ${s};\r\n`),this.x.hasEndpoints&&(e.compilationString+=this._declareOutput(this.x,e)+` = ${s}.x;\r\n`),this.y.hasEndpoints&&(e.compilationString+=this._declareOutput(this.y,e)+` = ${s}.y;\r\n`),this}}(0,l.H)("BABYLON.TwirlBlock",cc);class hc extends Xl.k{constructor(e){super(e,Ul.u.Fragment),this.registerInput("input",Gl.E.Float),this.registerInput("position",Gl.E.Vector3),this.registerInput("normal",Gl.E.Vector3),this.registerInput("tangent",Gl.E.Vector3),this.registerOutput("output",Gl.E.Vector3),this._inputs[3].acceptedConnectionPointTypes.push(Gl.E.Vector4)}getClassName(){return"HeightToNormalBlock"}get input(){return this._inputs[0]}get position(){return this._inputs[1]}get normal(){return this._inputs[2]}get tangent(){return this._inputs[3]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable"),e._emitFunction("heightToNormal","\n vec3 heightToNormal(in float height, in vec3 position, in vec3 tangent, in vec3 normal) {\n vec3 biTangent = cross(tangent, normal);\n mat3 TBN = mat3(tangent, biTangent, normal);\n vec3 worlddX = dFdx(position * 100.0);\n vec3 worlddY = dFdy(position * 100.0);\n vec3 crossX = cross(normal, worlddX);\n vec3 crossY = cross(normal, worlddY);\n float d = abs(dot(crossY, worlddX));\n vec3 inToNormal = vec3(((((height + dFdx(height)) - height) * crossY) + (((height + dFdy(height)) - height) * crossX)) * sign(d));\n inToNormal.y *= -1.0;\n vec3 result = normalize((d * normal) - inToNormal);\n return TBN * result;\n }","// heightToNormal"),e.compilationString+=this._declareOutput(t,e)+` = heightToNormal(${this.input.associatedVariableName}, ${this.position.associatedVariableName}, ${this.tangent.associatedVariableName}.xyz, ${this.normal.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.HeightToNormalBlock",hc);class _c extends Xl.k{constructor(e){super(e,Ul.u.VertexAndFragment,!1),this.registerInput("worldPosition",Gl.E.Vector4,!1,Ul.u.Vertex),this.registerInput("view",Gl.E.Matrix,!1,Ul.u.Vertex),this.registerInput("input",Gl.E.Color3,!1,Ul.u.Fragment),this.registerInput("fogColor",Gl.E.Color3,!1,Ul.u.Fragment),this.registerOutput("output",Gl.E.Color3,Ul.u.Fragment),this.input.acceptedConnectionPointTypes.push(Gl.E.Color4),this.fogColor.acceptedConnectionPointTypes.push(Gl.E.Color4)}getClassName(){return"FogBlock"}get worldPosition(){return this._inputs[0]}get view(){return this._inputs[1]}get input(){return this._inputs[2]}get fogColor(){return this._inputs[3]}get output(){return this._outputs[0]}autoConfigure(e){if(!this.view.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.View));t||(t=new Yl.S("view"),t.setAsSystemValue(jl.$.View)),t.output.connectTo(this.view)}if(!this.fogColor.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.FogColor));t||(t=new Yl.S("fogColor",void 0,Gl.E.Color3),t.setAsSystemValue(jl.$.FogColor)),t.output.connectTo(this.fogColor)}}prepareDefines(e,t,i){const n=e.getScene();i.setValue("FOG",t.fogEnabled&&lo.G.GetFogState(e,n))}bind(e,t,i){if(!i)return;const n=i.getScene();e.setFloat4(this._fogParameters,n.fogMode,n.fogStart,n.fogEnd,n.fogDensity)}_buildBlock(e){if(super._buildBlock(e),e.target===Ul.u.Fragment){e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),e._emitFunctionFromInclude("fogFragmentDeclaration",`//${this.name}`,{removeUniforms:!0,removeVaryings:!0,removeIfDef:!1,replaceStrings:[{search:/float CalcFogFactor\(\)/,replace:"float CalcFogFactor(vec3 vFogDistance, vec4 vFogInfos)"}]});const t=e._getFreeVariableName("fog"),i=this.input,n=this.fogColor;this._fogParameters=e._getFreeVariableName("fogParameters");const r=this._outputs[0];e._emitUniformFromString(this._fogParameters,"vec4"),e.compilationString+="#ifdef FOG\r\n",e.compilationString+=`float ${t} = CalcFogFactor(${this._fogDistanceName}, ${this._fogParameters});\r\n`,e.compilationString+=this._declareOutput(r,e)+` = ${t} * ${i.associatedVariableName}.rgb + (1.0 - ${t}) * ${n.associatedVariableName}.rgb;\r\n`,e.compilationString+=`#else\r\n${this._declareOutput(r,e)} = ${i.associatedVariableName}.rgb;\r\n`,e.compilationString+="#endif\r\n"}else{const t=this.worldPosition,i=this.view;this._fogDistanceName=e._getFreeVariableName("vFogDistance"),e._emitVaryingFromString(this._fogDistanceName,"vec3"),e.compilationString+=`${this._fogDistanceName} = (${i.associatedVariableName} * ${t.associatedVariableName}).xyz;\r\n`}return this}}(0,l.H)("BABYLON.FogBlock",_c);class dc extends Xl.k{constructor(e){super(e,Ul.u.VertexAndFragment),this._isUnique=!0,this.registerInput("worldPosition",Gl.E.Vector4,!1,Ul.u.Vertex),this.registerInput("worldNormal",Gl.E.Vector4,!1,Ul.u.Fragment),this.registerInput("cameraPosition",Gl.E.Vector3,!1,Ul.u.Fragment),this.registerInput("glossiness",Gl.E.Float,!0,Ul.u.Fragment),this.registerInput("glossPower",Gl.E.Float,!0,Ul.u.Fragment),this.registerInput("diffuseColor",Gl.E.Color3,!0,Ul.u.Fragment),this.registerInput("specularColor",Gl.E.Color3,!0,Ul.u.Fragment),this.registerInput("view",Gl.E.Matrix,!0),this.registerOutput("diffuseOutput",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("specularOutput",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("shadow",Gl.E.Float,Ul.u.Fragment)}getClassName(){return"LightBlock"}get worldPosition(){return this._inputs[0]}get worldNormal(){return this._inputs[1]}get cameraPosition(){return this._inputs[2]}get glossiness(){return this._inputs[3]}get glossPower(){return this._inputs[4]}get diffuseColor(){return this._inputs[5]}get specularColor(){return this._inputs[6]}get view(){return this._inputs[7]}get diffuseOutput(){return this._outputs[0]}get specularOutput(){return this._outputs[1]}get shadow(){return this._outputs[2]}autoConfigure(e){if(!this.cameraPosition.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.CameraPosition));t||(t=new Yl.S("cameraPosition"),t.setAsSystemValue(jl.$.CameraPosition)),t.output.connectTo(this.cameraPosition)}}prepareDefines(e,t,i){if(!i._areLightsDirty)return;const n=e.getScene();if(this.light){const t={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};lo.G.PrepareDefinesForLight(n,e,this.light,this._lightId,i,!0,t),t.needRebuild&&i.rebuild()}else lo.G.PrepareDefinesForLights(n,e,i,!0,t.maxSimultaneousLights)}updateUniformsAndSamples(e,t,i,n){for(let r=0;r=0;lo.G.PrepareUniformsAndSamplersForLight(r,e.uniforms,e.samplers,i["PROJECTEDLIGHTTEXTURE"+r],n,t)}}bind(e,t,i){if(!i)return;const n=i.getScene();this.light?lo.G.BindLight(this.light,this._lightId,n,e,!0):lo.G.BindLights(n,i,e,!0,t.maxSimultaneousLights)}_injectVertexCode(e){const t=this.worldPosition,i=`//${this.name}`;this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",i,{repeatKey:"maxSimultaneousLights"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));const n="v_"+t.associatedVariableName;e._emitVaryingFromString(n,"vec4")&&(e.compilationString+=`${n} = ${t.associatedVariableName};\r\n`),this.light?e.compilationString+=e._emitCodeFromInclude("shadowsVertex",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:t.associatedVariableName}]}):(e.compilationString+=`vec4 worldPos = ${t.associatedVariableName};\r\n`,this.view.isConnected&&(e.compilationString+=`mat4 view = ${this.view.associatedVariableName};\r\n`),e.compilationString+=e._emitCodeFromInclude("shadowsVertex",i,{repeatKey:"maxSimultaneousLights"}))}_buildBlock(e){if(super._buildBlock(e),e.target!==Ul.u.Fragment)return void this._injectVertexCode(e);e.sharedData.forcedBindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this);const t=`//${this.name}`,i=this.worldPosition;e._emitFunctionFromInclude("helperFunctions",t),e._emitFunctionFromInclude("lightsFragmentFunctions",t,{replaceStrings:[{search:/vPositionW/g,replace:"v_"+i.associatedVariableName+".xyz"}]}),e._emitFunctionFromInclude("shadowsFragmentFunctions",t,{replaceStrings:[{search:/vPositionW/g,replace:"v_"+i.associatedVariableName+".xyz"}]}),this.light?e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",t,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",t,{repeatKey:"maxSimultaneousLights"}),0===this._lightId&&(e._registerTempVariable("viewDirectionW")&&(e.compilationString+=`vec3 viewDirectionW = normalize(${this.cameraPosition.associatedVariableName} - ${"v_"+i.associatedVariableName}.xyz);\r\n`),e.compilationString+="lightingInfo info;\r\n",e.compilationString+="float shadow = 1.;\r\n",e.compilationString+=`float glossiness = ${this.glossiness.isConnected?this.glossiness.associatedVariableName:"1.0"} * ${this.glossPower.isConnected?this.glossPower.associatedVariableName:"1024.0"};\r\n`,e.compilationString+="vec3 diffuseBase = vec3(0., 0., 0.);\r\n",e.compilationString+="vec3 specularBase = vec3(0., 0., 0.);\r\n",e.compilationString+=`vec3 normalW = ${this.worldNormal.associatedVariableName}.xyz;\r\n`),this.light?e.compilationString+=e._emitCodeFromInclude("lightFragment",t,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]}):e.compilationString+=e._emitCodeFromInclude("lightFragment",t,{repeatKey:"maxSimultaneousLights"});const n=this.diffuseOutput,r=this.specularOutput;return e.compilationString+=this._declareOutput(n,e)+` = diffuseBase${this.diffuseColor.isConnected?" * "+this.diffuseColor.associatedVariableName:""};\r\n`,r.hasEndpoints&&(e.compilationString+=this._declareOutput(r,e)+` = specularBase${this.specularColor.isConnected?" * "+this.specularColor.associatedVariableName:""};\r\n`),this.shadow.hasEndpoints&&(e.compilationString+=this._declareOutput(this.shadow,e)+" = shadow;\r\n"),this}serialize(){const e=super.serialize();return this.light&&(e.lightId=this.light.id),e}_deserialize(e,t,i){super._deserialize(e,t,i),e.lightId&&(this.light=t.getLightById(e.lightId))}}(0,l.H)("BABYLON.LightBlock",dc);class uc extends Xl.k{constructor(e){super(e,Ul.u.VertexAndFragment),this.registerOutput("source",Gl.E.Object,Ul.u.VertexAndFragment,new Hl("source",this,zl.Ab.Output,uc,"ImageSourceBlock"))}get texture(){return this._texture}set texture(e){var t;if(this._texture===e)return;const i=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:m.l.LastCreatedScene;!e&&i&&i.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this._texture))),this._texture=e,e&&i&&i.markAllMaterialsAsDirty(1,(t=>t.hasTexture(e)))}get samplerName(){return this._samplerName}bind(e){this.texture&&e.setTexture(this._samplerName,this.texture)}isReady(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())}getClassName(){return"ImageSourceBlock"}get source(){return this._outputs[0]}_buildBlock(e){return super._buildBlock(e),e.target===Ul.u.Vertex&&(this._samplerName=e._getFreeVariableName(this.name+"Sampler"),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.bindableBlocks.push(this)),e._emit2DSampler(this._samplerName),this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode();return this.texture?(e+=`${this._codeVariableName}.texture = new BABYLON.Texture("${this.texture.name}", null, ${this.texture.noMipmap}, ${this.texture.invertY}, ${this.texture.samplingMode});\r\n`,e+=`${this._codeVariableName}.texture.wrapU = ${this.texture.wrapU};\r\n`,e+=`${this._codeVariableName}.texture.wrapV = ${this.texture.wrapV};\r\n`,e+=`${this._codeVariableName}.texture.uAng = ${this.texture.uAng};\r\n`,e+=`${this._codeVariableName}.texture.vAng = ${this.texture.vAng};\r\n`,e+=`${this._codeVariableName}.texture.wAng = ${this.texture.wAng};\r\n`,e+=`${this._codeVariableName}.texture.uOffset = ${this.texture.uOffset};\r\n`,e+=`${this._codeVariableName}.texture.vOffset = ${this.texture.vOffset};\r\n`,e+=`${this._codeVariableName}.texture.uScale = ${this.texture.uScale};\r\n`,e+=`${this._codeVariableName}.texture.vScale = ${this.texture.vScale};\r\n`,e+=`${this._codeVariableName}.texture.coordinatesMode = ${this.texture.coordinatesMode};\r\n`,e):e}serialize(){const e=super.serialize();return this.texture&&!this.texture.isRenderTarget&&"VideoTexture"!==this.texture.getClassName()&&(e.texture=this.texture.serialize()),e}_deserialize(e,t,i){super._deserialize(e,t,i),e.texture&&!$o.O.IgnoreTexturesAtLoadTime&&void 0!==e.texture.url&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=K.x.Parse(e.texture,t,i))}}(0,l.H)("BABYLON.ImageSourceBlock",uc);class pc extends Xl.k{constructor(e,t=!1){super(e,t?Ul.u.Fragment:Ul.u.VertexAndFragment),this._convertToGammaSpace=!1,this._convertToLinearSpace=!1,this.disableLevelMultiplication=!1,this._fragmentOnly=t,this.registerInput("uv",Gl.E.Vector2,!1,Ul.u.VertexAndFragment),this.registerInput("source",Gl.E.Object,!0,Ul.u.VertexAndFragment,new Hl("source",this,zl.Ab.Input,uc,"ImageSourceBlock")),this.registerOutput("rgba",Gl.E.Color4,Ul.u.Neutral),this.registerOutput("rgb",Gl.E.Color3,Ul.u.Neutral),this.registerOutput("r",Gl.E.Float,Ul.u.Neutral),this.registerOutput("g",Gl.E.Float,Ul.u.Neutral),this.registerOutput("b",Gl.E.Float,Ul.u.Neutral),this.registerOutput("a",Gl.E.Float,Ul.u.Neutral),this.registerOutput("level",Gl.E.Float,Ul.u.Neutral),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector3),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector4),this._inputs[0]._prioritizeVertex=!t}get texture(){var e;return this.source.isConnected?(null===(e=this.source.connectedPoint)||void 0===e?void 0:e.ownerBlock).texture:this._texture}set texture(e){var t;if(this._texture===e)return;const i=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:m.l.LastCreatedScene;!e&&i&&i.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this._texture))),this._texture=e,e&&i&&i.markAllMaterialsAsDirty(1,(t=>t.hasTexture(e)))}get samplerName(){return this._imageSource?this._imageSource.samplerName:this._samplerName}get hasImageSource(){return!!this._imageSource}set convertToGammaSpace(e){var t;if(e!==this._convertToGammaSpace&&(this._convertToGammaSpace=e,this.texture)){const e=null!==(t=this.texture.getScene())&&void 0!==t?t:m.l.LastCreatedScene;null==e||e.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this.texture)))}}get convertToGammaSpace(){return this._convertToGammaSpace}set convertToLinearSpace(e){var t;if(e!==this._convertToLinearSpace&&(this._convertToLinearSpace=e,this.texture)){const e=null!==(t=this.texture.getScene())&&void 0!==t?t:m.l.LastCreatedScene;null==e||e.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this.texture)))}}get convertToLinearSpace(){return this._convertToLinearSpace}getClassName(){return"TextureBlock"}get uv(){return this._inputs[0]}get source(){return this._inputs[1]}get rgba(){return this._outputs[0]}get rgb(){return this._outputs[1]}get r(){return this._outputs[2]}get g(){return this._outputs[3]}get b(){return this._outputs[4]}get a(){return this._outputs[5]}get level(){return this._outputs[6]}get target(){if(this._fragmentOnly)return Ul.u.Fragment;if(!this.uv.isConnected)return Ul.u.VertexAndFragment;if(this.uv.sourceBlock.isInput)return Ul.u.VertexAndFragment;let e=this.uv.connectedPoint;for(;e;){if(e.target===Ul.u.Fragment)return Ul.u.Fragment;if(e.target===Ul.u.Vertex)return Ul.u.VertexAndFragment;if(e.target===Ul.u.Neutral||e.target===Ul.u.VertexAndFragment){const t=e.ownerBlock;if(t.target===Ul.u.Fragment)return Ul.u.Fragment;e=null;for(const i of t.inputs)if(i.connectedPoint){e=i.connectedPoint;break}}}return Ul.u.VertexAndFragment}set target(e){}autoConfigure(e){if(!this.uv.isConnected)if(e.mode===Wl.a.PostProcess){const t=e.getBlockByPredicate((e=>"uv"===e.name));t&&t.connectTo(this)}else{const t=e.mode===Wl.a.Particle?"particle_uv":"uv";let i=e.getInputBlockByPredicate((e=>e.isAttribute&&e.name===t));i||(i=new Yl.S("uv"),i.setAsAttribute(t)),i.output.connectTo(this.uv)}}initializeDefines(e,t,i){i._areTexturesDirty&&void 0!==this._mainUVDefineName&&i.setValue(this._mainUVDefineName,!1,!0)}prepareDefines(e,t,i){if(!i._areTexturesDirty)return;if(!this.texture||!this.texture.getTextureMatrix)return void(this._isMixed&&(i.setValue(this._defineName,!1,!0),i.setValue(this._mainUVDefineName,!0,!0)));const n=this.convertToGammaSpace&&this.texture&&!this.texture.gammaSpace,r=this.convertToLinearSpace&&this.texture&&this.texture.gammaSpace;i.setValue(this._linearDefineName,n,!0),i.setValue(this._gammaDefineName,r,!0),this._isMixed&&(this.texture.getTextureMatrix().isIdentityAs3x2()?(i.setValue(this._defineName,!1,!0),i.setValue(this._mainUVDefineName,!0,!0)):(i.setValue(this._defineName,!0),null==i[this._mainUVDefineName]&&i.setValue(this._mainUVDefineName,!1,!0)))}isReady(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())}bind(e){this.texture&&(this._isMixed&&(e.setFloat(this._textureInfoName,this.texture.level),e.setMatrix(this._textureTransformName,this.texture.getTextureMatrix())),this._imageSource||e.setTexture(this._samplerName,this.texture))}get _isMixed(){return this.target!==Ul.u.Fragment}_injectVertexCode(e){const t=this.uv;if(this._defineName=e._getFreeDefineName("UVTRANSFORM"),this._mainUVDefineName="VMAIN"+t.associatedVariableName.toUpperCase(),this._mainUVName="vMain"+t.associatedVariableName,this._transformedUVName=e._getFreeVariableName("transformedUV"),this._textureTransformName=e._getFreeVariableName("textureTransform"),this._textureInfoName=e._getFreeVariableName("textureInfoName"),this.level.associatedVariableName=this._textureInfoName,e._emitVaryingFromString(this._transformedUVName,"vec2",this._defineName),e._emitVaryingFromString(this._mainUVName,"vec2",this._mainUVDefineName),e._emitUniformFromString(this._textureTransformName,"mat4",this._defineName),e.compilationString+=`#ifdef ${this._defineName}\r\n`,e.compilationString+=`${this._transformedUVName} = vec2(${this._textureTransformName} * vec4(${t.associatedVariableName}.xy, 1.0, 0.0));\r\n`,e.compilationString+=`#elif defined(${this._mainUVDefineName})\r\n`,e.compilationString+=`${this._mainUVName} = ${t.associatedVariableName}.xy;\r\n`,e.compilationString+="#endif\r\n",this._outputs.some((e=>e.isConnectedInVertexShader))){this._writeTextureRead(e,!0);for(const t of this._outputs)t.hasEndpoints&&"level"!==t.name&&this._writeOutput(e,t,t.name,!0)}}_generateTextureLookup(e){const t=this.samplerName;e.compilationString+=`#ifdef ${this._defineName}\r\n`,e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${t}, ${this._transformedUVName});\r\n`,e.compilationString+=`#elif defined(${this._mainUVDefineName})\r\n`,e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${t}, ${this._mainUVName?this._mainUVName:this.uv.associatedVariableName});\r\n`,e.compilationString+="#endif\r\n"}_writeTextureRead(e,t=!1){const i=this.uv;if(t){if(e.target===Ul.u.Fragment)return;this._generateTextureLookup(e)}else this.uv.ownerBlock.target!==Ul.u.Fragment?this._generateTextureLookup(e):e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${this.samplerName}, ${i.associatedVariableName});\r\n`}_generateConversionCode(e,t,i){"a"!==i&&(this.texture&&this.texture.gammaSpace||(e.compilationString+=`#ifdef ${this._linearDefineName}\n ${t.associatedVariableName} = toGammaSpace(${t.associatedVariableName});\n #endif\n `),e.compilationString+=`#ifdef ${this._gammaDefineName}\n ${t.associatedVariableName} = toLinearSpace(${t.associatedVariableName});\n #endif\n `)}_writeOutput(e,t,i,n=!1){if(n){if(e.target===Ul.u.Fragment)return;return e.compilationString+=`${this._declareOutput(t,e)} = ${this._tempTextureRead}.${i};\r\n`,void this._generateConversionCode(e,t,i)}if(this.uv.ownerBlock.target===Ul.u.Fragment)return e.compilationString+=`${this._declareOutput(t,e)} = ${this._tempTextureRead}.${i};\r\n`,void this._generateConversionCode(e,t,i);let r="";this.disableLevelMultiplication||(r=` * ${this._textureInfoName}`),e.compilationString+=`${this._declareOutput(t,e)} = ${this._tempTextureRead}.${i}${r};\r\n`,this._generateConversionCode(e,t,i)}_buildBlock(e){if(super._buildBlock(e),this.source.isConnected?this._imageSource=this.source.connectedPoint.ownerBlock:this._imageSource=null,(e.target===Ul.u.Vertex||this._fragmentOnly||e.target===Ul.u.Fragment&&void 0===this._tempTextureRead)&&(this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA")),(!this._isMixed&&e.target===Ul.u.Fragment||this._isMixed&&e.target===Ul.u.Vertex)&&(this._imageSource||(this._samplerName=e._getFreeVariableName(this.name+"Sampler"),e._emit2DSampler(this._samplerName)),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this)),e.target!==Ul.u.Fragment)return void this._injectVertexCode(e);if(!this._outputs.some((e=>e.isConnectedInFragmentShader)))return;this._isMixed&&!this._imageSource&&e._emit2DSampler(this._samplerName);const t=`//${this.name}`;e._emitFunctionFromInclude("helperFunctions",t),this._isMixed&&e._emitUniformFromString(this._textureInfoName,"float"),this._writeTextureRead(e);for(const t of this._outputs)t.hasEndpoints&&"level"!==t.name&&this._writeOutput(e,t,t.name);return this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode();return e+=`${this._codeVariableName}.convertToGammaSpace = ${this.convertToGammaSpace};\r\n`,e+=`${this._codeVariableName}.convertToLinearSpace = ${this.convertToLinearSpace};\r\n`,e+=`${this._codeVariableName}.disableLevelMultiplication = ${this.disableLevelMultiplication};\r\n`,this.texture?(e+=`${this._codeVariableName}.texture = new BABYLON.Texture("${this.texture.name}", null, ${this.texture.noMipmap}, ${this.texture.invertY}, ${this.texture.samplingMode});\r\n`,e+=`${this._codeVariableName}.texture.wrapU = ${this.texture.wrapU};\r\n`,e+=`${this._codeVariableName}.texture.wrapV = ${this.texture.wrapV};\r\n`,e+=`${this._codeVariableName}.texture.uAng = ${this.texture.uAng};\r\n`,e+=`${this._codeVariableName}.texture.vAng = ${this.texture.vAng};\r\n`,e+=`${this._codeVariableName}.texture.wAng = ${this.texture.wAng};\r\n`,e+=`${this._codeVariableName}.texture.uOffset = ${this.texture.uOffset};\r\n`,e+=`${this._codeVariableName}.texture.vOffset = ${this.texture.vOffset};\r\n`,e+=`${this._codeVariableName}.texture.uScale = ${this.texture.uScale};\r\n`,e+=`${this._codeVariableName}.texture.vScale = ${this.texture.vScale};\r\n`,e+=`${this._codeVariableName}.texture.coordinatesMode = ${this.texture.coordinatesMode};\r\n`,e):e}serialize(){const e=super.serialize();return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,e.fragmentOnly=this._fragmentOnly,e.disableLevelMultiplication=this.disableLevelMultiplication,this.hasImageSource||!this.texture||this.texture.isRenderTarget||"VideoTexture"===this.texture.getClassName()||(e.texture=this.texture.serialize()),e}_deserialize(e,t,i){super._deserialize(e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,this._fragmentOnly=!!e.fragmentOnly,this.disableLevelMultiplication=!!e.disableLevelMultiplication,e.texture&&!$o.O.IgnoreTexturesAtLoadTime&&void 0!==e.texture.url&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=K.x.Parse(e.texture,t,i))}}(0,l.H)("BABYLON.TextureBlock",pc);class fc extends Xl.k{constructor(e){super(e,Ul.u.VertexAndFragment)}get texture(){return this._texture}set texture(e){var t;if(this._texture===e)return;const i=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:m.l.LastCreatedScene;!e&&i&&i.markAllMaterialsAsDirty(1,(e=>e.hasTexture(this._texture))),this._texture=e,e&&i&&i.markAllMaterialsAsDirty(1,(t=>t.hasTexture(e)))}getClassName(){return"ReflectionTextureBaseBlock"}_getTexture(){return this.texture}autoConfigure(e){if(!this.position.isConnected){let t=e.getInputBlockByPredicate((e=>e.isAttribute&&"position"===e.name));t||(t=new Yl.S("position"),t.setAsAttribute()),t.output.connectTo(this.position)}if(!this.world.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.World));t||(t=new Yl.S("world"),t.setAsSystemValue(jl.$.World)),t.output.connectTo(this.world)}if(this.view&&!this.view.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.View));t||(t=new Yl.S("view"),t.setAsSystemValue(jl.$.View)),t.output.connectTo(this.view)}}prepareDefines(e,t,i){if(!i._areTexturesDirty)return;const n=this._getTexture();n&&n.getTextureMatrix&&(i.setValue(this._define3DName,n.isCube,!0),i.setValue(this._defineLocalCubicName,!!n.boundingBoxSize,!0),i.setValue(this._defineExplicitName,0===n.coordinatesMode,!0),i.setValue(this._defineSkyboxName,5===n.coordinatesMode,!0),i.setValue(this._defineCubicName,3===n.coordinatesMode||6===n.coordinatesMode,!0),i.setValue("INVERTCUBICMAP",6===n.coordinatesMode,!0),i.setValue(this._defineSphericalName,1===n.coordinatesMode,!0),i.setValue(this._definePlanarName,2===n.coordinatesMode,!0),i.setValue(this._defineProjectionName,4===n.coordinatesMode,!0),i.setValue(this._defineEquirectangularName,7===n.coordinatesMode,!0),i.setValue(this._defineEquirectangularFixedName,8===n.coordinatesMode,!0),i.setValue(this._defineMirroredEquirectangularFixedName,9===n.coordinatesMode,!0))}isReady(){const e=this._getTexture();return!(e&&!e.isReadyOrNotBlocking())}bind(e,t,i){const n=this._getTexture();if(i&&n&&(e.setMatrix(this._reflectionMatrixName,n.getReflectionTextureMatrix()),n.isCube?e.setTexture(this._cubeSamplerName,n):e.setTexture(this._2DSamplerName,n),n.boundingBoxSize)){const t=n;e.setVector3(this._reflectionPositionName,t.boundingBoxPosition),e.setVector3(this._reflectionSizeName,t.boundingBoxSize)}}handleVertexSide(e){this._define3DName=e._getFreeDefineName("REFLECTIONMAP_3D"),this._defineCubicName=e._getFreeDefineName("REFLECTIONMAP_CUBIC"),this._defineSphericalName=e._getFreeDefineName("REFLECTIONMAP_SPHERICAL"),this._definePlanarName=e._getFreeDefineName("REFLECTIONMAP_PLANAR"),this._defineProjectionName=e._getFreeDefineName("REFLECTIONMAP_PROJECTION"),this._defineExplicitName=e._getFreeDefineName("REFLECTIONMAP_EXPLICIT"),this._defineEquirectangularName=e._getFreeDefineName("REFLECTIONMAP_EQUIRECTANGULAR"),this._defineLocalCubicName=e._getFreeDefineName("USE_LOCAL_REFLECTIONMAP_CUBIC"),this._defineMirroredEquirectangularFixedName=e._getFreeDefineName("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"),this._defineEquirectangularFixedName=e._getFreeDefineName("REFLECTIONMAP_EQUIRECTANGULAR_FIXED"),this._defineSkyboxName=e._getFreeDefineName("REFLECTIONMAP_SKYBOX"),this._defineOppositeZ=e._getFreeDefineName("REFLECTIONMAP_OPPOSITEZ"),this._reflectionMatrixName=e._getFreeVariableName("reflectionMatrix"),e._emitUniformFromString(this._reflectionMatrixName,"mat4");let t="";const i="v_"+this.worldPosition.associatedVariableName;return e._emitVaryingFromString(i,"vec4")&&(t+=`${i} = ${this.worldPosition.associatedVariableName};\r\n`),this._positionUVWName=e._getFreeVariableName("positionUVW"),this._directionWName=e._getFreeVariableName("directionW"),e._emitVaryingFromString(this._positionUVWName,"vec3",this._defineSkyboxName)&&(t+=`#ifdef ${this._defineSkyboxName}\r\n`,t+=`${this._positionUVWName} = ${this.position.associatedVariableName}.xyz;\r\n`,t+="#endif\r\n"),e._emitVaryingFromString(this._directionWName,"vec3",`defined(${this._defineEquirectangularFixedName}) || defined(${this._defineMirroredEquirectangularFixedName})`)&&(t+=`#if defined(${this._defineEquirectangularFixedName}) || defined(${this._defineMirroredEquirectangularFixedName})\r\n`,t+=`${this._directionWName} = normalize(vec3(${this.world.associatedVariableName} * vec4(${this.position.associatedVariableName}.xyz, 0.0)));\r\n`,t+="#endif\r\n"),t}handleFragmentSideInits(e){e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),this._cubeSamplerName=e._getFreeVariableName(this.name+"CubeSampler"),e.samplers.push(this._cubeSamplerName),this._2DSamplerName=e._getFreeVariableName(this.name+"2DSampler"),e.samplers.push(this._2DSamplerName),e._samplerDeclaration+=`#ifdef ${this._define3DName}\r\n`,e._samplerDeclaration+=`uniform samplerCube ${this._cubeSamplerName};\r\n`,e._samplerDeclaration+="#else\r\n",e._samplerDeclaration+=`uniform sampler2D ${this._2DSamplerName};\r\n`,e._samplerDeclaration+="#endif\r\n",e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this);const t=`//${this.name}`;e._emitFunction("ReciprocalPI","#define RECIPROCAL_PI2 0.15915494",""),e._emitFunctionFromInclude("helperFunctions",t),e._emitFunctionFromInclude("reflectionFunction",t,{replaceStrings:[{search:/vec3 computeReflectionCoords/g,replace:"void DUMMYFUNC"}]}),this._reflectionColorName=e._getFreeVariableName("reflectionColor"),this._reflectionVectorName=e._getFreeVariableName("reflectionUVW"),this._reflectionCoordsName=e._getFreeVariableName("reflectionCoords"),this._reflectionPositionName=e._getFreeVariableName("vReflectionPosition"),e._emitUniformFromString(this._reflectionPositionName,"vec3"),this._reflectionSizeName=e._getFreeVariableName("vReflectionPosition"),e._emitUniformFromString(this._reflectionSizeName,"vec3")}handleFragmentSideCodeReflectionCoords(e,t,i=!1,n=!1){t||(t=`v_${this.worldPosition.associatedVariableName}`);const r=this._reflectionMatrixName,s=`normalize(${this._directionWName})`,o=`${this._positionUVWName}`,a=`${this.cameraPosition.associatedVariableName}`,l=`${this.view.associatedVariableName}`;e+=".xyz";let c=`\n #ifdef ${this._defineMirroredEquirectangularFixedName}\n vec3 ${this._reflectionVectorName} = computeMirroredFixedEquirectangularCoords(${t}, ${e}, ${s});\n #endif\n\n #ifdef ${this._defineEquirectangularFixedName}\n vec3 ${this._reflectionVectorName} = computeFixedEquirectangularCoords(${t}, ${e}, ${s});\n #endif\n\n #ifdef ${this._defineEquirectangularName}\n vec3 ${this._reflectionVectorName} = computeEquirectangularCoords(${t}, ${e}, ${a}.xyz, ${r});\n #endif\n\n #ifdef ${this._defineSphericalName}\n vec3 ${this._reflectionVectorName} = computeSphericalCoords(${t}, ${e}, ${l}, ${r});\n #endif\n\n #ifdef ${this._definePlanarName}\n vec3 ${this._reflectionVectorName} = computePlanarCoords(${t}, ${e}, ${a}.xyz, ${r});\n #endif\n\n #ifdef ${this._defineCubicName}\n #ifdef ${this._defineLocalCubicName}\n vec3 ${this._reflectionVectorName} = computeCubicLocalCoords(${t}, ${e}, ${a}.xyz, ${r}, ${this._reflectionSizeName}, ${this._reflectionPositionName});\n #else\n vec3 ${this._reflectionVectorName} = computeCubicCoords(${t}, ${e}, ${a}.xyz, ${r});\n #endif\n #endif\n\n #ifdef ${this._defineProjectionName}\n vec3 ${this._reflectionVectorName} = computeProjectionCoords(${t}, ${l}, ${r});\n #endif\n\n #ifdef ${this._defineSkyboxName}\n vec3 ${this._reflectionVectorName} = computeSkyBoxCoords(${o}, ${r});\n #endif\n\n #ifdef ${this._defineExplicitName}\n vec3 ${this._reflectionVectorName} = vec3(0, 0, 0);\n #endif\r\n`;return n||(c+=`#ifdef ${this._defineOppositeZ}\n ${this._reflectionVectorName}.z *= -1.0;\n #endif\r\n`),i||(c+=`\n #ifdef ${this._define3DName}\n vec3 ${this._reflectionCoordsName} = ${this._reflectionVectorName};\n #else\n vec2 ${this._reflectionCoordsName} = ${this._reflectionVectorName}.xy;\n #ifdef ${this._defineProjectionName}\n ${this._reflectionCoordsName} /= ${this._reflectionVectorName}.z;\n #endif\n ${this._reflectionCoordsName}.y = 1.0 - ${this._reflectionCoordsName}.y;\n #endif\r\n`),c}handleFragmentSideCodeReflectionColor(e,t=".rgb"){let i=`${"vec"+(0===t.length?"4":t.length-1)} ${this._reflectionColorName};\n #ifdef ${this._define3DName}\r\n`;return i+=e?`${this._reflectionColorName} = textureCubeLodEXT(${this._cubeSamplerName}, ${this._reflectionVectorName}, ${e})${t};\r\n`:`${this._reflectionColorName} = textureCube(${this._cubeSamplerName}, ${this._reflectionVectorName})${t};\r\n`,i+="\n #else\r\n",i+=e?`${this._reflectionColorName} = texture2DLodEXT(${this._2DSamplerName}, ${this._reflectionCoordsName}, ${e})${t};\r\n`:`${this._reflectionColorName} = texture2D(${this._2DSamplerName}, ${this._reflectionCoordsName})${t};\r\n`,i+="#endif\r\n",i}writeOutputs(e,t){let i="";if(e.target===Ul.u.Fragment)for(const n of this._outputs)n.hasEndpoints&&(i+=`${this._declareOutput(n,e)} = ${t}.${n.name};\r\n`);return i}_buildBlock(e){return super._buildBlock(e),this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode();if(!this.texture)return e;if(this.texture.isCube){const t=this.texture.forcedExtension;e+=`${this._codeVariableName}.texture = new BABYLON.CubeTexture("${this.texture.name}", undefined, undefined, ${this.texture.noMipmap}, null, undefined, undefined, undefined, ${this.texture._prefiltered}, ${t?'"'+t+'"':"null"});\r\n`}else e+=`${this._codeVariableName}.texture = new BABYLON.Texture("${this.texture.name}", null);\r\n`;return e+=`${this._codeVariableName}.texture.coordinatesMode = ${this.texture.coordinatesMode};\r\n`,e}serialize(){const e=super.serialize();return this.texture&&!this.texture.isRenderTarget&&(e.texture=this.texture.serialize()),e}_deserialize(e,t,i){super._deserialize(e,t,i),e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,e.texture.isCube?this.texture=ao.B.Parse(e.texture,t,i):this.texture=K.x.Parse(e.texture,t,i))}}(0,l.H)("BABYLON.ReflectionTextureBaseBlock",fc),(0,l.H)("BABYLON.ReflectionTextureBlock",class extends fc{constructor(e){super(e),this.registerInput("position",Gl.E.Vector3,!1,Ul.u.Vertex),this.registerInput("worldPosition",Gl.E.Vector4,!1,Ul.u.Vertex),this.registerInput("worldNormal",Gl.E.Vector4,!1,Ul.u.Fragment),this.registerInput("world",Gl.E.Matrix,!1,Ul.u.Vertex),this.registerInput("cameraPosition",Gl.E.Vector3,!1,Ul.u.Fragment),this.registerInput("view",Gl.E.Matrix,!1,Ul.u.Fragment),this.registerOutput("rgb",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("rgba",Gl.E.Color4,Ul.u.Fragment),this.registerOutput("r",Gl.E.Float,Ul.u.Fragment),this.registerOutput("g",Gl.E.Float,Ul.u.Fragment),this.registerOutput("b",Gl.E.Float,Ul.u.Fragment),this.registerOutput("a",Gl.E.Float,Ul.u.Fragment),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector4)}getClassName(){return"ReflectionTextureBlock"}get position(){return this._inputs[0]}get worldPosition(){return this._inputs[1]}get worldNormal(){return this._inputs[2]}get world(){return this._inputs[3]}get cameraPosition(){return this._inputs[4]}get view(){return this._inputs[5]}get rgb(){return this._outputs[0]}get rgba(){return this._outputs[1]}get r(){return this._outputs[2]}get g(){return this._outputs[3]}get b(){return this._outputs[4]}get a(){return this._outputs[5]}autoConfigure(e){if(super.autoConfigure(e),!this.cameraPosition.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.CameraPosition));t||(t=new Yl.S("cameraPosition"),t.setAsSystemValue(jl.$.CameraPosition)),t.output.connectTo(this.cameraPosition)}}_buildBlock(e){if(super._buildBlock(e),!this.texture)return e.compilationString+=this.writeOutputs(e,"vec4(0.)"),this;if(e.target!==Ul.u.Fragment)return e.compilationString+=this.handleVertexSide(e),this;this.handleFragmentSideInits(e);const t=e._getFreeVariableName("normalWUnit");return e.compilationString+=`vec4 ${t} = normalize(${this.worldNormal.associatedVariableName});\r\n`,e.compilationString+=this.handleFragmentSideCodeReflectionCoords(t),e.compilationString+=this.handleFragmentSideCodeReflectionColor(void 0,""),e.compilationString+=this.writeOutputs(e,this._reflectionColorName),this}}),i("../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Dual/currentScreenBlock.js");class mc extends Xl.k{constructor(e){super(e,Ul.u.VertexAndFragment),this.useNonLinearDepth=!1,this.force32itsFloat=!1,this._isUnique=!0,this.registerInput("uv",Gl.E.Vector2,!1,Ul.u.VertexAndFragment),this.registerOutput("depth",Gl.E.Float,Ul.u.Neutral),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector3),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector4),this._inputs[0]._prioritizeVertex=!1}getClassName(){return"SceneDepthBlock"}get uv(){return this._inputs[0]}get depth(){return this._outputs[0]}initialize(e){e._excludeVariableName("textureSampler")}get target(){return this.uv.isConnected?this.uv.sourceBlock.isInput?Ul.u.VertexAndFragment:Ul.u.Fragment:Ul.u.VertexAndFragment}_getTexture(e){return e.enableDepthRenderer(void 0,this.useNonLinearDepth,this.force32itsFloat).getDepthMap()}bind(e,t){const i=this._getTexture(t.getScene());e.setTexture(this._samplerName,i)}_injectVertexCode(e){const t=this.uv;if(t.connectedPoint.ownerBlock.isInput&&(t.connectedPoint.ownerBlock.isAttribute||e._emitUniformFromString(t.associatedVariableName,"vec"+(t.type===Gl.E.Vector3?"3":t.type===Gl.E.Vector4?"4":"2"))),this._mainUVName="vMain"+t.associatedVariableName,e._emitVaryingFromString(this._mainUVName,"vec2"),e.compilationString+=`${this._mainUVName} = ${t.associatedVariableName}.xy;\r\n`,this._outputs.some((e=>e.isConnectedInVertexShader))){this._writeTextureRead(e,!0);for(const t of this._outputs)t.hasEndpoints&&this._writeOutput(e,t,"r",!0)}}_writeTextureRead(e,t=!1){const i=this.uv;if(t){if(e.target===Ul.u.Fragment)return;e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${this._samplerName}, ${i.associatedVariableName}.xy);\r\n`}else this.uv.ownerBlock.target!==Ul.u.Fragment?e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${this._samplerName}, ${this._mainUVName});\r\n`:e.compilationString+=`vec4 ${this._tempTextureRead} = texture2D(${this._samplerName}, ${i.associatedVariableName}.xy);\r\n`}_writeOutput(e,t,i,n=!1){if(n){if(e.target===Ul.u.Fragment)return;e.compilationString+=`${this._declareOutput(t,e)} = ${this._tempTextureRead}.${i};\r\n`}else this.uv.ownerBlock.target,Ul.u.Fragment,e.compilationString+=`${this._declareOutput(t,e)} = ${this._tempTextureRead}.${i};\r\n`}_buildBlock(e){if(super._buildBlock(e),this._samplerName=e._getFreeVariableName(this.name+"Sampler"),this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),e.sharedData.bindableBlocks.indexOf(this)<0&&e.sharedData.bindableBlocks.push(this),e.target!==Ul.u.Fragment)return e._emit2DSampler(this._samplerName),void this._injectVertexCode(e);if(this._outputs.some((e=>e.isConnectedInFragmentShader))){e._emit2DSampler(this._samplerName),this._writeTextureRead(e);for(const t of this._outputs)t.hasEndpoints&&this._writeOutput(e,t,"r");return this}}serialize(){const e=super.serialize();return e.useNonLinearDepth=this.useNonLinearDepth,e.force32itsFloat=this.force32itsFloat,e}_deserialize(e,t,i){super._deserialize(e,t,i),this.useNonLinearDepth=e.useNonLinearDepth,this.force32itsFloat=e.force32itsFloat}}(0,X.gn)([(0,Jl.p)("Use non linear depth",Jl.U.Boolean,"ADVANCED",{notifiers:{activatePreviewCommand:!0,callback:e=>e.disableDepthRenderer()}})],mc.prototype,"useNonLinearDepth",void 0),(0,X.gn)([(0,Jl.p)("Force 32 bits float",Jl.U.Boolean,"ADVANCED",{notifiers:{activatePreviewCommand:!0,callback:e=>e.disableDepthRenderer()}})],mc.prototype,"force32itsFloat",void 0),(0,l.H)("BABYLON.SceneDepthBlock",mc);class gc extends Xl.k{constructor(e){super(e,Ul.u.VertexAndFragment,!0),this.registerInput("worldPosition",Gl.E.Vector4,!1)}getClassName(){return"ClipPlanesBlock"}initialize(e){e._excludeVariableName("vClipPlane"),e._excludeVariableName("fClipDistance"),e._excludeVariableName("vClipPlane2"),e._excludeVariableName("fClipDistance2"),e._excludeVariableName("vClipPlane3"),e._excludeVariableName("fClipDistance3"),e._excludeVariableName("vClipPlane4"),e._excludeVariableName("fClipDistance4"),e._excludeVariableName("vClipPlane5"),e._excludeVariableName("fClipDistance5"),e._excludeVariableName("vClipPlane6"),e._excludeVariableName("fClipDistance6")}get worldPosition(){return this._inputs[0]}get target(){return Ul.u.VertexAndFragment}set target(e){}prepareDefines(e,t,i){const n=e.getScene(),r=void 0!==n.clipPlane&&null!==n.clipPlane,s=void 0!==n.clipPlane2&&null!==n.clipPlane2,o=void 0!==n.clipPlane3&&null!==n.clipPlane3,a=void 0!==n.clipPlane4&&null!==n.clipPlane4,l=void 0!==n.clipPlane5&&null!==n.clipPlane5,c=void 0!==n.clipPlane6&&null!==n.clipPlane6;i.setValue("CLIPPLANE",r,!0),i.setValue("CLIPPLANE2",s,!0),i.setValue("CLIPPLANE3",o,!0),i.setValue("CLIPPLANE4",a,!0),i.setValue("CLIPPLANE5",l,!0),i.setValue("CLIPPLANE6",c,!0)}bind(e,t,i){if(!i)return;const n=i.getScene();lo.G.BindClipPlane(e,n)}_buildBlock(e){super._buildBlock(e);const t=`//${this.name}`;if(e.target!==Ul.u.Fragment){const i=this.worldPosition;return e._emitFunctionFromInclude("clipPlaneVertexDeclaration",t,{replaceStrings:[{search:/uniform vec4 vClipPlane\d*;/g,replace:""}]}),e.compilationString+=e._emitCodeFromInclude("clipPlaneVertex",t,{replaceStrings:[{search:/worldPos/g,replace:i.associatedVariableName}]}),e._emitUniformFromString("vClipPlane","vec4"),e._emitUniformFromString("vClipPlane2","vec4"),e._emitUniformFromString("vClipPlane3","vec4"),e._emitUniformFromString("vClipPlane4","vec4"),e._emitUniformFromString("vClipPlane5","vec4"),void e._emitUniformFromString("vClipPlane6","vec4")}return e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e._emitFunctionFromInclude("clipPlaneFragmentDeclaration",t),e.compilationString+=e._emitCodeFromInclude("clipPlaneFragment",t),this}}(0,l.H)("BABYLON.ClipPlanesBlock",gc),i("../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Input/animatedInputBlockTypes.js"),i("../../../node_modules/@babylonjs/core/Materials/Node/Blocks/multiplyBlock.js");class bc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("left",Gl.E.AutoDetect),this.registerInput("right",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._linkConnectionTypes(0,1)}getClassName(){return"AddBlock"}get left(){return this._inputs[0]}get right(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = ${this.left.associatedVariableName} + ${this.right.associatedVariableName};\r\n`,this}}(0,l.H)("BABYLON.AddBlock",bc);class yc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("input",Gl.E.AutoDetect),this.registerInput("factor",Gl.E.Float),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0]}getClassName(){return"ScaleBlock"}get input(){return this._inputs[0]}get factor(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = ${this.input.associatedVariableName} * ${this.factor.associatedVariableName};\r\n`,this}}(0,l.H)("BABYLON.ScaleBlock",yc);class vc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.minimum=0,this.maximum=1,this.registerInput("value",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0]}getClassName(){return"ClampBlock"}get value(){return this._inputs[0]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = clamp(${this.value.associatedVariableName}, ${this._writeFloat(this.minimum)}, ${this._writeFloat(this.maximum)});\r\n`,this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode()+`${this._codeVariableName}.minimum = ${this.minimum};\r\n`;return e+=`${this._codeVariableName}.maximum = ${this.maximum};\r\n`,e}serialize(){const e=super.serialize();return e.minimum=this.minimum,e.maximum=this.maximum,e}_deserialize(e,t,i){super._deserialize(e,t,i),this.minimum=e.minimum,this.maximum=e.maximum}}(0,X.gn)([(0,Jl.p)("Minimum",Jl.U.Float)],vc.prototype,"minimum",void 0),(0,X.gn)([(0,Jl.p)("Maximum",Jl.U.Float)],vc.prototype,"maximum",void 0),(0,l.H)("BABYLON.ClampBlock",vc);class Ac extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("left",Gl.E.AutoDetect),this.registerInput("right",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.Vector3),this._linkConnectionTypes(0,1),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Float),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Matrix),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Vector2),this._inputs[1].excludedConnectionPointTypes.push(Gl.E.Float),this._inputs[1].excludedConnectionPointTypes.push(Gl.E.Matrix),this._inputs[1].excludedConnectionPointTypes.push(Gl.E.Vector2)}getClassName(){return"CrossBlock"}get left(){return this._inputs[0]}get right(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = cross(${this.left.associatedVariableName}.xyz, ${this.right.associatedVariableName}.xyz);\r\n`,this}}(0,l.H)("BABYLON.CrossBlock",Ac);class Cc extends Xl.k{constructor(e){super(e)}get options(){return this._options}set options(e){this._deserializeOptions(e)}getClassName(){return"CustomBlock"}_buildBlock(e){super._buildBlock(e);let t=this._code,i=this._options.functionName;this._inputs.forEach((n=>{const r=new RegExp("\\{TYPE_"+n.name+"\\}","gm"),s=e._getGLType(n.type);t=t.replace(r,s),i=i.replace(r,s)})),this._outputs.forEach((n=>{const r=new RegExp("\\{TYPE_"+n.name+"\\}","gm"),s=e._getGLType(n.type);t=t.replace(r,s),i=i.replace(r,s)})),e._emitFunction(i,t,""),this._outputs.forEach((t=>{e.compilationString+=this._declareOutput(t,e)+";\r\n"})),e.compilationString+=i+"(";let n=!1;return this._inputs.forEach(((t,i)=>{i>0&&(e.compilationString+=", "),e.compilationString+=t.associatedVariableName,n=!0})),this._outputs.forEach(((t,i)=>{(i>0||n)&&(e.compilationString+=", "),e.compilationString+=t.associatedVariableName})),e.compilationString+=");\r\n",this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode();return e+=`${this._codeVariableName}.options = ${JSON.stringify(this._options)};\r\n`,e}serialize(){const e=super.serialize();return e.options=this._options,e}_deserialize(e,t,i){this._deserializeOptions(e.options),super._deserialize(e,t,i)}_deserializeOptions(e){var t,i,n;this._options=e,this._code=e.code.join("\r\n")+"\r\n",this.name=this.name||e.name,this.target=Ul.u[e.target],null===(t=e.inParameters)||void 0===t||t.forEach(((e,t)=>{const i=Gl.E[e.type];this.registerInput(e.name,i),Object.defineProperty(this,e.name,{get:function(){return this._inputs[t]},enumerable:!0,configurable:!0})})),null===(i=e.outParameters)||void 0===i||i.forEach(((e,t)=>{this.registerOutput(e.name,Gl.E[e.type]),Object.defineProperty(this,e.name,{get:function(){return this._outputs[t]},enumerable:!0,configurable:!0}),"BasedOnInput"===e.type&&(this._outputs[t]._typeConnectionSource=this._findInputByName(e.typeFromInput)[0])})),null===(n=e.inLinkedConnectionTypes)||void 0===n||n.forEach((e=>{this._linkConnectionTypes(this._findInputByName(e.input1)[1],this._findInputByName(e.input2)[1])}))}_findInputByName(e){if(!e)return null;for(let t=0;te.systemValue===jl.$.CameraPosition));t||(t=new Yl.S("cameraPosition"),t.setAsSystemValue(jl.$.CameraPosition)),t.output.connectTo(this.cameraPosition)}}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = normalize(${this.cameraPosition.associatedVariableName} - ${this.worldPosition.associatedVariableName}.xyz);\r\n`,this}}(0,l.H)("BABYLON.ViewDirectionBlock",Oc),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fresnelFunction.js");class wc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("worldNormal",Gl.E.Vector4),this.registerInput("viewDirection",Gl.E.Vector3),this.registerInput("bias",Gl.E.Float),this.registerInput("power",Gl.E.Float),this.registerOutput("fresnel",Gl.E.Float)}getClassName(){return"FresnelBlock"}get worldNormal(){return this._inputs[0]}get viewDirection(){return this._inputs[1]}get bias(){return this._inputs[2]}get power(){return this._inputs[3]}get fresnel(){return this._outputs[0]}autoConfigure(e){if(!this.viewDirection.isConnected){const t=new Oc("View direction");t.output.connectTo(this.viewDirection),t.autoConfigure(e)}if(!this.bias.isConnected){const e=new Yl.S("bias");e.value=0,e.output.connectTo(this.bias)}if(!this.power.isConnected){const e=new Yl.S("power");e.value=1,e.output.connectTo(this.power)}}_buildBlock(e){super._buildBlock(e);const t=`//${this.name}`;return e._emitFunctionFromInclude("fresnelFunction",t,{removeIfDef:!0}),e.compilationString+=this._declareOutput(this.fresnel,e)+` = computeFresnelTerm(${this.viewDirection.associatedVariableName}.xyz, ${this.worldNormal.associatedVariableName}.xyz, ${this.bias.associatedVariableName}, ${this.power.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.FresnelBlock",wc);class Fc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("left",Gl.E.AutoDetect),this.registerInput("right",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._linkConnectionTypes(0,1)}getClassName(){return"MaxBlock"}get left(){return this._inputs[0]}get right(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = max(${this.left.associatedVariableName}, ${this.right.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.MaxBlock",Fc);class Bc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("left",Gl.E.AutoDetect),this.registerInput("right",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._linkConnectionTypes(0,1)}getClassName(){return"MinBlock"}get left(){return this._inputs[0]}get right(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = min(${this.left.associatedVariableName}, ${this.right.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.MinBlock",Bc);class Nc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("left",Gl.E.AutoDetect),this.registerInput("right",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.Float),this._linkConnectionTypes(0,1),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Float),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Matrix),this._inputs[1].excludedConnectionPointTypes.push(Gl.E.Float),this._inputs[1].excludedConnectionPointTypes.push(Gl.E.Matrix)}getClassName(){return"DistanceBlock"}get left(){return this._inputs[0]}get right(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = length(${this.left.associatedVariableName} - ${this.right.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.DistanceBlock",Nc);class Lc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("value",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.Float),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Float),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Matrix)}getClassName(){return"LengthBlock"}get value(){return this._inputs[0]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = length(${this.value.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.LengthBlock",Lc);class kc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("value",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0]}getClassName(){return"NegateBlock"}get value(){return this._inputs[0]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = -1.0 * ${this.value.associatedVariableName};\r\n`,this}}(0,l.H)("BABYLON.NegateBlock",kc);class Vc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("value",Gl.E.AutoDetect),this.registerInput("power",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._linkConnectionTypes(0,1)}getClassName(){return"PowBlock"}get value(){return this._inputs[0]}get power(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = pow(${this.value.associatedVariableName}, ${this.power.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.PowBlock",Vc);class Uc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("seed",Gl.E.Vector2),this.registerOutput("output",Gl.E.Float),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector3),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector4),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Color3),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Color4)}getClassName(){return"RandomNumberBlock"}get seed(){return this._inputs[0]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0],i=`//${this.name}`;return e._emitFunctionFromInclude("helperFunctions",i),e.compilationString+=this._declareOutput(t,e)+` = getRand(${this.seed.associatedVariableName}.xy);\r\n`,this}}(0,l.H)("BABYLON.RandomNumberBlock",Uc);class Gc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("x",Gl.E.Float),this.registerInput("y",Gl.E.Float),this.registerOutput("output",Gl.E.Float)}getClassName(){return"ArcTan2Block"}get x(){return this._inputs[0]}get y(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = atan(${this.x.associatedVariableName}, ${this.y.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.ArcTan2Block",Gc);class jc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("value",Gl.E.AutoDetect),this.registerInput("edge0",Gl.E.Float),this.registerInput("edge1",Gl.E.Float),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0]}getClassName(){return"SmoothStepBlock"}get value(){return this._inputs[0]}get edge0(){return this._inputs[1]}get edge1(){return this._inputs[2]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = smoothstep(${this.edge0.associatedVariableName}, ${this.edge1.associatedVariableName}, ${this.value.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.SmoothStepBlock",jc);class Wc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("input",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._outputs[0].excludedConnectionPointTypes.push(Gl.E.Matrix)}getClassName(){return"ReciprocalBlock"}get input(){return this._inputs[0]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = 1. / ${this.input.associatedVariableName};\r\n`,this}}(0,l.H)("BABYLON.ReciprocalBlock",Wc);class zc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("value",Gl.E.AutoDetect),this.registerInput("reference",Gl.E.AutoDetect),this.registerInput("distance",Gl.E.Float),this.registerInput("replacement",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._linkConnectionTypes(0,1),this._linkConnectionTypes(0,3),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Float),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Matrix),this._inputs[1].excludedConnectionPointTypes.push(Gl.E.Float),this._inputs[1].excludedConnectionPointTypes.push(Gl.E.Matrix),this._inputs[3].excludedConnectionPointTypes.push(Gl.E.Float),this._inputs[3].excludedConnectionPointTypes.push(Gl.E.Matrix)}getClassName(){return"ReplaceColorBlock"}get value(){return this._inputs[0]}get reference(){return this._inputs[1]}get distance(){return this._inputs[2]}get replacement(){return this._inputs[3]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+";\r\n",e.compilationString+=`if (length(${this.value.associatedVariableName} - ${this.reference.associatedVariableName}) < ${this.distance.associatedVariableName}) {\r\n`,e.compilationString+=`${t.associatedVariableName} = ${this.replacement.associatedVariableName};\r\n`,e.compilationString+="} else {\r\n",e.compilationString+=`${t.associatedVariableName} = ${this.value.associatedVariableName};\r\n`,e.compilationString+="}\r\n",this}}(0,l.H)("BABYLON.ReplaceColorBlock",zc);class Hc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("value",Gl.E.AutoDetect),this.registerInput("steps",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._linkConnectionTypes(0,1),this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Matrix),this._inputs[1].excludedConnectionPointTypes.push(Gl.E.Matrix)}getClassName(){return"PosterizeBlock"}get value(){return this._inputs[0]}get steps(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = floor(${this.value.associatedVariableName} / (1.0 / ${this.steps.associatedVariableName})) * (1.0 / ${this.steps.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.PosterizeBlock",Hc),function(e){e[e.SawTooth=0]="SawTooth",e[e.Square=1]="Square",e[e.Triangle=2]="Triangle"}($l||($l={}));class Xc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.kind=$l.SawTooth,this.registerInput("input",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._inputs[0].excludedConnectionPointTypes.push(Gl.E.Matrix)}getClassName(){return"WaveBlock"}get input(){return this._inputs[0]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];switch(this.kind){case $l.SawTooth:e.compilationString+=this._declareOutput(t,e)+` = ${this.input.associatedVariableName} - floor(0.5 + ${this.input.associatedVariableName});\r\n`;break;case $l.Square:e.compilationString+=this._declareOutput(t,e)+` = 1.0 - 2.0 * round(fract(${this.input.associatedVariableName}));\r\n`;break;case $l.Triangle:e.compilationString+=this._declareOutput(t,e)+` = 2.0 * abs(2.0 * (${this.input.associatedVariableName} - floor(0.5 + ${this.input.associatedVariableName}))) - 1.0;\r\n`}return this}serialize(){const e=super.serialize();return e.kind=this.kind,e}_deserialize(e,t,i){super._deserialize(e,t,i),this.kind=e.kind}}(0,l.H)("BABYLON.WaveBlock",Xc);class Yc{constructor(e,t){this.step=e,this.color=t}get step(){return this._step}set step(e){this._step=e}get color(){return this._color}set color(e){this._color=e}}class Qc extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.colorSteps=[new Yc(0,a.Wo.Black()),new Yc(1,a.Wo.White())],this.onValueChangedObservable=new s.y$,this.registerInput("gradient",Gl.E.Float),this.registerOutput("output",Gl.E.Color3),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector2),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector3),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector4),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Color3),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Color4)}colorStepsUpdated(){this.onValueChangedObservable.notifyObservers(this)}getClassName(){return"GradientBlock"}get gradient(){return this._inputs[0]}get output(){return this._outputs[0]}_writeColorConstant(e){const t=this.colorSteps[e];return`vec3(${t.color.r}, ${t.color.g}, ${t.color.b})`}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];if(!this.colorSteps.length||!this.gradient.connectedPoint)return void(e.compilationString+=this._declareOutput(t,e)+" = vec3(0., 0., 0.);\r\n");const i=e._getFreeVariableName("gradientTempColor"),n=e._getFreeVariableName("gradientTempPosition");e.compilationString+=`vec3 ${i} = ${this._writeColorConstant(0)};\r\n`,e.compilationString+=`float ${n};\r\n`;let r=this.gradient.associatedVariableName;this.gradient.connectedPoint.type!==Gl.E.Float&&(r+=".x");for(let t=1;te.systemValue===jl.$.View));t||(t=new Yl.S("view"),t.setAsSystemValue(jl.$.View)),t.output.connectTo(this.view)}}prepareDefines(e,t,i){super.prepareDefines(e,t,i);const n=this._getTexture(),r=n&&n.getTextureMatrix;i.setValue("SS_REFRACTION",r,!0),r&&(i.setValue(this._define3DName,n.isCube,!0),i.setValue(this._defineLODRefractionAlpha,n.lodLevelInAlpha,!0),i.setValue(this._defineLinearSpecularRefraction,n.linearSpecularLOD,!0),i.setValue(this._defineOppositeZ,this._scene.useRightHandedSystem?!n.invertZ:n.invertZ,!0),i.setValue("SS_LINKREFRACTIONTOTRANSPARENCY",this.linkRefractionWithTransparency,!0),i.setValue("SS_GAMMAREFRACTION",n.gammaSpace,!0),i.setValue("SS_RGBDREFRACTION",n.isRGBD,!0),i.setValue("SS_USE_LOCAL_REFRACTIONMAP_CUBIC",!!n.boundingBoxSize,!0),i.setValue("SS_USE_THICKNESS_AS_DEPTH",this.useThicknessAsDepth,!0))}isReady(){const e=this._getTexture();return!(e&&!e.isReadyOrNotBlocking())}bind(e,t,i){var n,r,s,o;super.bind(e,t,i);const a=this._getTexture();if(!a)return;a.isCube?e.setTexture(this._cubeSamplerName,a):e.setTexture(this._2DSamplerName,a),e.setMatrix(this._refractionMatrixName,a.getReflectionTextureMatrix());let l=1;a.isCube||a.depth&&(l=a.depth);const c=null!==(o=null!==(r=null===(n=this.volumeIndexOfRefraction.connectInputBlock)||void 0===n?void 0:n.value)&&void 0!==r?r:null===(s=this.indexOfRefractionConnectionPoint.connectInputBlock)||void 0===s?void 0:s.value)&&void 0!==o?o:1.5;e.setFloat4(this._vRefractionInfosName,a.level,1/c,l,this.invertRefractionY?-1:1),e.setFloat4(this._vRefractionMicrosurfaceInfosName,a.getSize().width,a.lodGenerationScale,a.lodGenerationOffset,1/c);const h=a.getSize().width;if(e.setFloat2(this._vRefractionFilteringInfoName,h,ve.R.Log2(h)),a.boundingBoxSize){const t=a;e.setVector3("vRefractionPosition",t.boundingBoxPosition),e.setVector3("vRefractionSize",t.boundingBoxSize)}}getCode(e){return e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),this._cubeSamplerName=e._getFreeVariableName(this.name+"CubeSampler"),e.samplers.push(this._cubeSamplerName),this._2DSamplerName=e._getFreeVariableName(this.name+"2DSampler"),e.samplers.push(this._2DSamplerName),this._define3DName=e._getFreeDefineName("SS_REFRACTIONMAP_3D"),e._samplerDeclaration+=`#ifdef ${this._define3DName}\r\n`,e._samplerDeclaration+=`uniform samplerCube ${this._cubeSamplerName};\r\n`,e._samplerDeclaration+="#else\r\n",e._samplerDeclaration+=`uniform sampler2D ${this._2DSamplerName};\r\n`,e._samplerDeclaration+="#endif\r\n",e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),this._defineLODRefractionAlpha=e._getFreeDefineName("SS_LODINREFRACTIONALPHA"),this._defineLinearSpecularRefraction=e._getFreeDefineName("SS_LINEARSPECULARREFRACTION"),this._defineOppositeZ=e._getFreeDefineName("SS_REFRACTIONMAP_OPPOSITEZ"),this._refractionMatrixName=e._getFreeVariableName("refractionMatrix"),e._emitUniformFromString(this._refractionMatrixName,"mat4"),e._emitFunction("sampleRefraction",`\n #ifdef ${this._define3DName}\n #define sampleRefraction(s, c) textureCube(s, c)\n #else\n #define sampleRefraction(s, c) texture2D(s, c)\n #endif\r\n`,`//${this.name}`),e._emitFunction("sampleRefractionLod",`\n #ifdef ${this._define3DName}\n #define sampleRefractionLod(s, c, l) textureCubeLodEXT(s, c, l)\n #else\n #define sampleRefractionLod(s, c, l) texture2DLodEXT(s, c, l)\n #endif\r\n`,`//${this.name}`),this._vRefractionMicrosurfaceInfosName=e._getFreeVariableName("vRefractionMicrosurfaceInfos"),e._emitUniformFromString(this._vRefractionMicrosurfaceInfosName,"vec4"),this._vRefractionInfosName=e._getFreeVariableName("vRefractionInfos"),e._emitUniformFromString(this._vRefractionInfosName,"vec4"),this._vRefractionFilteringInfoName=e._getFreeVariableName("vRefractionFilteringInfo"),e._emitUniformFromString(this._vRefractionFilteringInfoName,"vec2"),e._emitUniformFromString("vRefractionPosition","vec3"),e._emitUniformFromString("vRefractionSize","vec3"),""}_buildBlock(e){return this._scene=e.sharedData.scene,this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode();return this.texture&&(e=this.texture.isCube?`${this._codeVariableName}.texture = new BABYLON.CubeTexture("${this.texture.name}");\r\n`:`${this._codeVariableName}.texture = new BABYLON.Texture("${this.texture.name}");\r\n`,e+=`${this._codeVariableName}.texture.coordinatesMode = ${this.texture.coordinatesMode};\r\n`),e+=`${this._codeVariableName}.linkRefractionWithTransparency = ${this.linkRefractionWithTransparency};\r\n`,e+=`${this._codeVariableName}.invertRefractionY = ${this.invertRefractionY};\r\n`,e+=`${this._codeVariableName}.useThicknessAsDepth = ${this.useThicknessAsDepth};\r\n`,e}serialize(){const e=super.serialize();return this.texture&&!this.texture.isRenderTarget&&(e.texture=this.texture.serialize()),e.linkRefractionWithTransparency=this.linkRefractionWithTransparency,e.invertRefractionY=this.invertRefractionY,e.useThicknessAsDepth=this.useThicknessAsDepth,e}_deserialize(e,t,i){super._deserialize(e,t,i),e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,e.texture.isCube?this.texture=ao.B.Parse(e.texture,t,i):this.texture=K.x.Parse(e.texture,t,i)),this.linkRefractionWithTransparency=e.linkRefractionWithTransparency,this.invertRefractionY=e.invertRefractionY,this.useThicknessAsDepth=!!e.useThicknessAsDepth}}(0,X.gn)([(0,Jl.p)("Link refraction to transparency",Jl.U.Boolean,"ADVANCED",{notifiers:{update:!0}})],ch.prototype,"linkRefractionWithTransparency",void 0),(0,X.gn)([(0,Jl.p)("Invert refraction Y",Jl.U.Boolean,"ADVANCED",{notifiers:{update:!0}})],ch.prototype,"invertRefractionY",void 0),(0,X.gn)([(0,Jl.p)("Use thickness as depth",Jl.U.Boolean,"ADVANCED",{notifiers:{update:!0}})],ch.prototype,"useThicknessAsDepth",void 0),(0,l.H)("BABYLON.RefractionBlock",ch);class hh extends Xl.k{constructor(e){super(e,Ul.u.Fragment),this._isUnique=!0,this.registerInput("thickness",Gl.E.Float,!1,Ul.u.Fragment),this.registerInput("tintColor",Gl.E.Color3,!0,Ul.u.Fragment),this.registerInput("translucencyIntensity",Gl.E.Float,!0,Ul.u.Fragment),this.registerInput("translucencyDiffusionDist",Gl.E.Color3,!0,Ul.u.Fragment),this.registerInput("refraction",Gl.E.Object,!0,Ul.u.Fragment,new Hl("refraction",this,zl.Ab.Input,ch,"RefractionBlock")),this.registerOutput("subsurface",Gl.E.Object,Ul.u.Fragment,new Hl("subsurface",this,zl.Ab.Output,hh,"SubSurfaceBlock"))}initialize(e){e._excludeVariableName("subSurfaceOut"),e._excludeVariableName("vThicknessParam"),e._excludeVariableName("vTintColor"),e._excludeVariableName("vSubSurfaceIntensity")}getClassName(){return"SubSurfaceBlock"}get thickness(){return this._inputs[0]}get tintColor(){return this._inputs[1]}get translucencyIntensity(){return this._inputs[2]}get translucencyDiffusionDist(){return this._inputs[3]}get refraction(){return this._inputs[4]}get subsurface(){return this._outputs[0]}autoConfigure(){if(!this.thickness.isConnected){const e=new Yl.S("SubSurface thickness",Ul.u.Fragment,Gl.E.Float);e.value=0,e.output.connectTo(this.thickness)}}prepareDefines(e,t,i){super.prepareDefines(e,t,i);const n=this.translucencyDiffusionDist.isConnected||this.translucencyIntensity.isConnected;i.setValue("SUBSURFACE",n||this.refraction.isConnected,!0),i.setValue("SS_TRANSLUCENCY",n,!0),i.setValue("SS_THICKNESSANDMASK_TEXTURE",!1,!0),i.setValue("SS_REFRACTIONINTENSITY_TEXTURE",!1,!0),i.setValue("SS_TRANSLUCENCYINTENSITY_TEXTURE",!1,!0),i.setValue("SS_MASK_FROM_THICKNESS_TEXTURE",!1,!0),i.setValue("SS_USE_GLTF_TEXTURES",!1,!0)}static GetCode(e,t,i,n){var r,s,o,a,l,c,h,_,d,u,p,f,m,g,b,y;let v="";const A=(null==t?void 0:t.thickness.isConnected)?t.thickness.associatedVariableName:"0.",C=(null==t?void 0:t.tintColor.isConnected)?t.tintColor.associatedVariableName:"vec3(1.)",S=(null==t?void 0:t.translucencyIntensity.isConnected)?null==t?void 0:t.translucencyIntensity.associatedVariableName:"1.",x=(null==t?void 0:t.translucencyDiffusionDist.isConnected)?null==t?void 0:t.translucencyDiffusionDist.associatedVariableName:"vec3(1.)",T=(null==t?void 0:t.refraction.isConnected)?null===(r=null==t?void 0:t.refraction.connectedPoint)||void 0===r?void 0:r.ownerBlock:null,E=(null==T?void 0:T.tintAtDistance.isConnected)?T.tintAtDistance.associatedVariableName:"1.",R=(null==T?void 0:T.intensity.isConnected)?T.intensity.associatedVariableName:"1.",P=(null==T?void 0:T.view.isConnected)?T.view.associatedVariableName:"";return v+=null!==(s=null==T?void 0:T.getCode(e))&&void 0!==s?s:"",v+=`subSurfaceOutParams subSurfaceOut;\n\n #ifdef SUBSURFACE\n vec2 vThicknessParam = vec2(0., ${A});\n vec4 vTintColor = vec4(${C}, ${E});\n vec3 vSubSurfaceIntensity = vec3(${R}, ${S}, 0.);\n\n subSurfaceBlock(\n vSubSurfaceIntensity,\n vThicknessParam,\n vTintColor,\n normalW,\n specularEnvironmentReflectance,\n #ifdef SS_THICKNESSANDMASK_TEXTURE\n vec4(0.),\n #endif\n #ifdef REFLECTION\n #ifdef SS_TRANSLUCENCY\n ${null==i?void 0:i._reflectionMatrixName},\n #ifdef USESPHERICALFROMREFLECTIONMAP\n #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\n reflectionOut.irradianceVector,\n #endif\n #if defined(REALTIME_FILTERING)\n ${null==i?void 0:i._cubeSamplerName},\n ${null==i?void 0:i._vReflectionFilteringInfoName},\n #endif\n #endif\n #ifdef USEIRRADIANCEMAP\n irradianceSampler,\n #endif\n #endif\n #endif\n #if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\n surfaceAlbedo,\n #endif\n #ifdef SS_REFRACTION\n ${n}.xyz,\n viewDirectionW,\n ${P},\n ${null!==(o=null==T?void 0:T._vRefractionInfosName)&&void 0!==o?o:""},\n ${null!==(a=null==T?void 0:T._refractionMatrixName)&&void 0!==a?a:""},\n ${null!==(l=null==T?void 0:T._vRefractionMicrosurfaceInfosName)&&void 0!==l?l:""},\n vLightingIntensity,\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\n alpha,\n #endif\n #ifdef ${null!==(c=null==T?void 0:T._defineLODRefractionAlpha)&&void 0!==c?c:"IGNORE"}\n NdotVUnclamped,\n #endif\n #ifdef ${null!==(h=null==T?void 0:T._defineLinearSpecularRefraction)&&void 0!==h?h:"IGNORE"}\n roughness,\n #endif\n alphaG,\n #ifdef ${null!==(_=null==T?void 0:T._define3DName)&&void 0!==_?_:"IGNORE"}\n ${null!==(d=null==T?void 0:T._cubeSamplerName)&&void 0!==d?d:""},\n #else\n ${null!==(u=null==T?void 0:T._2DSamplerName)&&void 0!==u?u:""},\n #endif\n #ifndef LODBASEDMICROSFURACE\n #ifdef ${null!==(p=null==T?void 0:T._define3DName)&&void 0!==p?p:"IGNORE"}\n ${null!==(f=null==T?void 0:T._cubeSamplerName)&&void 0!==f?f:""},\n ${null!==(m=null==T?void 0:T._cubeSamplerName)&&void 0!==m?m:""},\n #else\n ${null!==(g=null==T?void 0:T._2DSamplerName)&&void 0!==g?g:""},\n ${null!==(b=null==T?void 0:T._2DSamplerName)&&void 0!==b?b:""},\n #endif\n #endif\n #ifdef ANISOTROPIC\n anisotropicOut,\n #endif\n #ifdef REALTIME_FILTERING\n ${null!==(y=null==T?void 0:T._vRefractionFilteringInfoName)&&void 0!==y?y:""},\n #endif\n #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\n vRefractionPosition,\n vRefractionSize,\n #endif\n #endif\n #ifdef SS_TRANSLUCENCY\n ${x},\n #endif\n subSurfaceOut\n );\n\n #ifdef SS_REFRACTION\n surfaceAlbedo = subSurfaceOut.surfaceAlbedo;\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\n alpha = subSurfaceOut.alpha;\n #endif\n #endif\n #else\n subSurfaceOut.specularEnvironmentReflectance = specularEnvironmentReflectance;\n #endif\r\n`,v}_buildBlock(e){return e.target===Ul.u.Fragment&&e.sharedData.blocksWithDefines.push(this),this}}(0,l.H)("BABYLON.SubSurfaceBlock",hh);const _h={ambientClr:["finalAmbient",""],diffuseDir:["finalDiffuse",""],specularDir:["finalSpecularScaled","!defined(UNLIT) && defined(SPECULARTERM)"],clearcoatDir:["finalClearCoatScaled","!defined(UNLIT) && defined(CLEARCOAT)"],sheenDir:["finalSheenScaled","!defined(UNLIT) && defined(SHEEN)"],diffuseInd:["finalIrradiance","!defined(UNLIT) && defined(REFLECTION)"],specularInd:["finalRadianceScaled","!defined(UNLIT) && defined(REFLECTION)"],clearcoatInd:["clearcoatOut.finalClearCoatRadianceScaled","!defined(UNLIT) && defined(REFLECTION) && defined(CLEARCOAT)"],sheenInd:["sheenOut.finalSheenRadianceScaled","!defined(UNLIT) && defined(REFLECTION) && defined(SHEEN) && defined(ENVIRONMENTBRDF)"],refraction:["subSurfaceOut.finalRefraction","!defined(UNLIT) && defined(SS_REFRACTION)"],lighting:["finalColor.rgb",""],shadow:["shadow",""],alpha:["alpha",""]};class dh extends Xl.k{constructor(e){super(e,Ul.u.VertexAndFragment),this._environmentBRDFTexture=null,this._metallicReflectanceColor=a.Wo.White(),this._metallicF0Factor=1,this.directIntensity=1,this.environmentIntensity=1,this.specularIntensity=1,this.lightFalloff=0,this.useAlphaTest=!1,this.alphaTestCutoff=.5,this.useAlphaBlending=!1,this.useRadianceOverAlpha=!0,this.useSpecularOverAlpha=!0,this.enableSpecularAntiAliasing=!1,this.realTimeFiltering=!1,this.realTimeFilteringQuality=8,this.useEnergyConservation=!0,this.useRadianceOcclusion=!0,this.useHorizonOcclusion=!0,this.unlit=!1,this.forceNormalForward=!1,this.debugMode=0,this.debugLimit=0,this.debugFactor=1,this._isUnique=!0,this.registerInput("worldPosition",Gl.E.Vector4,!1,Ul.u.Vertex),this.registerInput("worldNormal",Gl.E.Vector4,!1,Ul.u.Fragment),this.registerInput("view",Gl.E.Matrix,!1),this.registerInput("cameraPosition",Gl.E.Vector3,!1,Ul.u.Fragment),this.registerInput("perturbedNormal",Gl.E.Vector4,!0,Ul.u.Fragment),this.registerInput("baseColor",Gl.E.Color3,!0,Ul.u.Fragment),this.registerInput("metallic",Gl.E.Float,!1,Ul.u.Fragment),this.registerInput("roughness",Gl.E.Float,!1,Ul.u.Fragment),this.registerInput("ambientOcc",Gl.E.Float,!0,Ul.u.Fragment),this.registerInput("opacity",Gl.E.Float,!0,Ul.u.Fragment),this.registerInput("indexOfRefraction",Gl.E.Float,!0,Ul.u.Fragment),this.registerInput("ambientColor",Gl.E.Color3,!0,Ul.u.Fragment),this.registerInput("reflection",Gl.E.Object,!0,Ul.u.Fragment,new Hl("reflection",this,zl.Ab.Input,oh,"ReflectionBlock")),this.registerInput("clearcoat",Gl.E.Object,!0,Ul.u.Fragment,new Hl("clearcoat",this,zl.Ab.Input,ah,"ClearCoatBlock")),this.registerInput("sheen",Gl.E.Object,!0,Ul.u.Fragment,new Hl("sheen",this,zl.Ab.Input,nh,"SheenBlock")),this.registerInput("subsurface",Gl.E.Object,!0,Ul.u.Fragment,new Hl("subsurface",this,zl.Ab.Input,hh,"SubSurfaceBlock")),this.registerInput("anisotropy",Gl.E.Object,!0,Ul.u.Fragment,new Hl("anisotropy",this,zl.Ab.Input,sh,"AnisotropyBlock")),this.registerInput("iridescence",Gl.E.Object,!0,Ul.u.Fragment,new Hl("iridescence",this,zl.Ab.Input,lh,"IridescenceBlock")),this.registerOutput("ambientClr",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("diffuseDir",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("specularDir",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("clearcoatDir",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("sheenDir",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("diffuseInd",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("specularInd",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("clearcoatInd",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("sheenInd",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("refraction",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("lighting",Gl.E.Color3,Ul.u.Fragment),this.registerOutput("shadow",Gl.E.Float,Ul.u.Fragment),this.registerOutput("alpha",Gl.E.Float,Ul.u.Fragment)}initialize(e){e._excludeVariableName("vLightingIntensity"),e._excludeVariableName("geometricNormalW"),e._excludeVariableName("normalW"),e._excludeVariableName("faceNormal"),e._excludeVariableName("albedoOpacityOut"),e._excludeVariableName("surfaceAlbedo"),e._excludeVariableName("alpha"),e._excludeVariableName("aoOut"),e._excludeVariableName("baseColor"),e._excludeVariableName("reflectivityOut"),e._excludeVariableName("microSurface"),e._excludeVariableName("roughness"),e._excludeVariableName("NdotVUnclamped"),e._excludeVariableName("NdotV"),e._excludeVariableName("alphaG"),e._excludeVariableName("AARoughnessFactors"),e._excludeVariableName("environmentBrdf"),e._excludeVariableName("ambientMonochrome"),e._excludeVariableName("seo"),e._excludeVariableName("eho"),e._excludeVariableName("environmentRadiance"),e._excludeVariableName("irradianceVector"),e._excludeVariableName("environmentIrradiance"),e._excludeVariableName("diffuseBase"),e._excludeVariableName("specularBase"),e._excludeVariableName("preInfo"),e._excludeVariableName("info"),e._excludeVariableName("shadow"),e._excludeVariableName("finalDiffuse"),e._excludeVariableName("finalAmbient"),e._excludeVariableName("ambientOcclusionForDirectDiffuse"),e._excludeVariableName("finalColor"),e._excludeVariableName("vClipSpacePosition"),e._excludeVariableName("vDebugMode")}getClassName(){return"PBRMetallicRoughnessBlock"}get worldPosition(){return this._inputs[0]}get worldNormal(){return this._inputs[1]}get view(){return this._inputs[2]}get cameraPosition(){return this._inputs[3]}get perturbedNormal(){return this._inputs[4]}get baseColor(){return this._inputs[5]}get metallic(){return this._inputs[6]}get roughness(){return this._inputs[7]}get ambientOcc(){return this._inputs[8]}get opacity(){return this._inputs[9]}get indexOfRefraction(){return this._inputs[10]}get ambientColor(){return this._inputs[11]}get reflection(){return this._inputs[12]}get clearcoat(){return this._inputs[13]}get sheen(){return this._inputs[14]}get subsurface(){return this._inputs[15]}get anisotropy(){return this._inputs[16]}get iridescence(){return this._inputs[17]}get ambientClr(){return this._outputs[0]}get diffuseDir(){return this._outputs[1]}get specularDir(){return this._outputs[2]}get clearcoatDir(){return this._outputs[3]}get sheenDir(){return this._outputs[4]}get diffuseInd(){return this._outputs[5]}get specularInd(){return this._outputs[6]}get clearcoatInd(){return this._outputs[7]}get sheenInd(){return this._outputs[8]}get refraction(){return this._outputs[9]}get lighting(){return this._outputs[10]}get shadow(){return this._outputs[11]}get alpha(){return this._outputs[12]}autoConfigure(e){if(!this.cameraPosition.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.CameraPosition));t||(t=new Yl.S("cameraPosition"),t.setAsSystemValue(jl.$.CameraPosition)),t.output.connectTo(this.cameraPosition)}if(!this.view.isConnected){let t=e.getInputBlockByPredicate((e=>e.systemValue===jl.$.View));t||(t=new Yl.S("view"),t.setAsSystemValue(jl.$.View)),t.output.connectTo(this.view)}}prepareDefines(e,t,i){i.setValue("PBR",!0),i.setValue("METALLICWORKFLOW",!0),i.setValue("DEBUGMODE",this.debugMode,!0),i.setValue("NORMALXYSCALE",!0),i.setValue("BUMP",this.perturbedNormal.isConnected,!0),i.setValue("LODBASEDMICROSFURACE",this._scene.getEngine().getCaps().textureLOD),i.setValue("ALBEDO",!1,!0),i.setValue("OPACITY",this.opacity.isConnected,!0),i.setValue("AMBIENT",!0,!0),i.setValue("AMBIENTINGRAYSCALE",!1,!0),i.setValue("REFLECTIVITY",!1,!0),i.setValue("AOSTOREINMETALMAPRED",!1,!0),i.setValue("METALLNESSSTOREINMETALMAPBLUE",!1,!0),i.setValue("ROUGHNESSSTOREINMETALMAPALPHA",!1,!0),i.setValue("ROUGHNESSSTOREINMETALMAPGREEN",!1,!0),this.lightFalloff===hl.m.LIGHTFALLOFF_STANDARD?(i.setValue("USEPHYSICALLIGHTFALLOFF",!1),i.setValue("USEGLTFLIGHTFALLOFF",!1)):this.lightFalloff===hl.m.LIGHTFALLOFF_GLTF?(i.setValue("USEPHYSICALLIGHTFALLOFF",!1),i.setValue("USEGLTFLIGHTFALLOFF",!0)):(i.setValue("USEPHYSICALLIGHTFALLOFF",!0),i.setValue("USEGLTFLIGHTFALLOFF",!1));const n=this.alphaTestCutoff.toString();i.setValue("ALPHABLEND",this.useAlphaBlending,!0),i.setValue("ALPHAFROMALBEDO",!1,!0),i.setValue("ALPHATEST",this.useAlphaTest,!0),i.setValue("ALPHATESTVALUE",n.indexOf(".")<0?n+".":n,!0),i.setValue("OPACITYRGB",!1,!0),i.setValue("RADIANCEOVERALPHA",this.useRadianceOverAlpha,!0),i.setValue("SPECULAROVERALPHA",this.useSpecularOverAlpha,!0),i.setValue("SPECULARAA",this._scene.getEngine().getCaps().standardDerivatives&&this.enableSpecularAntiAliasing,!0),i.setValue("REALTIME_FILTERING",this.realTimeFiltering,!0);const r=e.getScene();if(r.getEngine()._features.needTypeSuffixInShaderConstants?i.setValue("NUM_SAMPLES",this.realTimeFilteringQuality+"u",!0):i.setValue("NUM_SAMPLES",""+this.realTimeFilteringQuality,!0),i.setValue("BRDF_V_HEIGHT_CORRELATED",!0),i.setValue("MS_BRDF_ENERGY_CONSERVATION",this.useEnergyConservation,!0),i.setValue("RADIANCEOCCLUSION",this.useRadianceOcclusion,!0),i.setValue("HORIZONOCCLUSION",this.useHorizonOcclusion,!0),i.setValue("UNLIT",this.unlit,!0),i.setValue("FORCENORMALFORWARD",this.forceNormalForward,!0),this._environmentBRDFTexture&&_o.k.ReflectionTextureEnabled?(i.setValue("ENVIRONMENTBRDF",!0),i.setValue("ENVIRONMENTBRDF_RGBD",this._environmentBRDFTexture.isRGBD,!0)):(i.setValue("ENVIRONMENTBRDF",!1),i.setValue("ENVIRONMENTBRDF_RGBD",!1)),i._areImageProcessingDirty&&t.imageProcessingConfiguration&&t.imageProcessingConfiguration.prepareDefines(i),i._areLightsDirty)if(this.light){const t={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};lo.G.PrepareDefinesForLight(r,e,this.light,this._lightId,i,!0,t),t.needRebuild&&i.rebuild()}else lo.G.PrepareDefinesForLights(r,e,i,!0,t.maxSimultaneousLights),i._needNormals=!0,lo.G.PrepareDefinesForMultiview(r,i)}updateUniformsAndSamples(e,t,i,n){for(let r=0;r=0;lo.G.PrepareUniformsAndSamplersForLight(r,e.uniforms,e.samplers,i["PROJECTEDLIGHTTEXTURE"+r],n,t)}}isReady(e,t,i){return!(this._environmentBRDFTexture&&!this._environmentBRDFTexture.isReady()||i._areImageProcessingDirty&&t.imageProcessingConfiguration&&!t.imageProcessingConfiguration.isReady())}bind(e,t,i){var n,r;if(!i)return;const s=i.getScene();this.light?lo.G.BindLight(this.light,this._lightId,s,e,!0):lo.G.BindLights(s,i,e,!0,t.maxSimultaneousLights),e.setTexture(this._environmentBrdfSamplerName,this._environmentBRDFTexture),e.setFloat2("vDebugMode",this.debugLimit,this.debugFactor);const o=this._scene.ambientColor;o&&e.setColor3("ambientFromScene",o);const l=s.useRightHandedSystem===(null!=s._mirroredCameraPosition);e.setFloat(this._invertNormalName,l?-1:1),e.setFloat4("vLightingIntensity",this.directIntensity,1,this.environmentIntensity*this._scene.environmentIntensity,this.specularIntensity);const c=null!==(r=null===(n=this.indexOfRefraction.connectInputBlock)||void 0===n?void 0:n.value)&&void 0!==r?r:1.5,h=Math.pow((c-1)/(c+1),2);this._metallicReflectanceColor.scaleToRef(h*this._metallicF0Factor,a.zZ.Color3[0]);const _=this._metallicF0Factor;e.setColor4(this._vMetallicReflectanceFactorsName,a.zZ.Color3[0],_),t.imageProcessingConfiguration&&t.imageProcessingConfiguration.bind(e)}_injectVertexCode(e){var t,i;const n=this.worldPosition,r=`//${this.name}`;this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",r,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",r,{repeatKey:"maxSimultaneousLights"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));const s="v_"+n.associatedVariableName;e._emitVaryingFromString(s,"vec4")&&(e.compilationString+=`${s} = ${n.associatedVariableName};\r\n`);const o=this.reflection.isConnected?null===(t=this.reflection.connectedPoint)||void 0===t?void 0:t.ownerBlock:null;o&&(o.viewConnectionPoint=this.view),e.compilationString+=null!==(i=null==o?void 0:o.handleVertexSide(e))&&void 0!==i?i:"",e._emitUniformFromString("vDebugMode","vec2","defined(IGNORE) || DEBUGMODE > 0"),e._emitUniformFromString("ambientFromScene","vec3"),e._emitVaryingFromString("vClipSpacePosition","vec4","defined(IGNORE) || DEBUGMODE > 0")&&(e._injectAtEnd+="#if DEBUGMODE > 0\r\n",e._injectAtEnd+="vClipSpacePosition = gl_Position;\r\n",e._injectAtEnd+="#endif\r\n"),this.light?e.compilationString+=e._emitCodeFromInclude("shadowsVertex",r,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:n.associatedVariableName}]}):(e.compilationString+=`vec4 worldPos = ${n.associatedVariableName};\r\n`,this.view.isConnected&&(e.compilationString+=`mat4 view = ${this.view.associatedVariableName};\r\n`),e.compilationString+=e._emitCodeFromInclude("shadowsVertex",r,{repeatKey:"maxSimultaneousLights"}))}_getAlbedoOpacityCode(){let e="albedoOpacityOutParams albedoOpacityOut;\r\n";return e+=`albedoOpacityBlock(\n vec4(${this.baseColor.isConnected?this.baseColor.associatedVariableName:"vec3(1.)"}, 1.),\n #ifdef ALBEDO\n vec4(1.),\n vec2(1., 1.),\n #endif\n #ifdef OPACITY\n vec4(${this.opacity.isConnected?this.opacity.associatedVariableName:"1."}),\n vec2(1., 1.),\n #endif\n albedoOpacityOut\n );\n\n vec3 surfaceAlbedo = albedoOpacityOut.surfaceAlbedo;\n float alpha = albedoOpacityOut.alpha;\r\n`,e}_getAmbientOcclusionCode(){let e="ambientOcclusionOutParams aoOut;\r\n";return e+=`ambientOcclusionBlock(\n #ifdef AMBIENT\n vec3(${this.ambientOcc.isConnected?this.ambientOcc.associatedVariableName:"1."}),\n vec4(0., 1.0, 1.0, 0.),\n #endif\n aoOut\n );\r\n`,e}_getReflectivityCode(e){let t="reflectivityOutParams reflectivityOut;\r\n";return this._vMetallicReflectanceFactorsName=e._getFreeVariableName("vMetallicReflectanceFactors"),e._emitUniformFromString(this._vMetallicReflectanceFactorsName,"vec4"),t+=`vec3 baseColor = surfaceAlbedo;\n\n reflectivityBlock(\n vec4(${this.metallic.associatedVariableName}, ${this.roughness.associatedVariableName}, 0., 0.),\n #ifdef METALLICWORKFLOW\n surfaceAlbedo,\n ${this._vMetallicReflectanceFactorsName},\n #endif\n #ifdef REFLECTIVITY\n vec3(0., 0., 1.),\n vec4(1.),\n #endif\n #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\n aoOut.ambientOcclusionColor,\n #endif\n #ifdef MICROSURFACEMAP\n microSurfaceTexel, <== not handled!\n #endif\n reflectivityOut\n );\n\n float microSurface = reflectivityOut.microSurface;\n float roughness = reflectivityOut.roughness;\n\n #ifdef METALLICWORKFLOW\n surfaceAlbedo = reflectivityOut.surfaceAlbedo;\n #endif\n #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\n aoOut.ambientOcclusionColor = reflectivityOut.ambientOcclusionColor;\n #endif\r\n`,t}_buildBlock(e){var t,i,n,r,s,o,a,l,c,h,_,d,u,p,f,m,g,b,y,v,A,C,S,x,T,E,R,P,I,M,D,O,w,F,B,N,L,k,V,U,G;super._buildBlock(e),this._scene=e.sharedData.scene,this._environmentBRDFTexture||(this._environmentBRDFTexture=(0,rh.$)(this._scene));const j=this.reflection.isConnected?null===(t=this.reflection.connectedPoint)||void 0===t?void 0:t.ownerBlock:null;if(j&&(j.worldPositionConnectionPoint=this.worldPosition,j.cameraPositionConnectionPoint=this.cameraPosition,j.worldNormalConnectionPoint=this.worldNormal),e.target!==Ul.u.Fragment)return this._injectVertexCode(e),this;e.sharedData.forcedBindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e.sharedData.blockingBlocks.push(this);const W=`//${this.name}`,z="v_"+this.worldPosition.associatedVariableName,H=this.perturbedNormal;this._environmentBrdfSamplerName=e._getFreeVariableName("environmentBrdfSampler"),e._emit2DSampler(this._environmentBrdfSamplerName),e.sharedData.hints.needAlphaBlending=e.sharedData.hints.needAlphaBlending||this.useAlphaBlending,e.sharedData.hints.needAlphaTesting=e.sharedData.hints.needAlphaTesting||this.useAlphaTest,e._emitExtension("lod","#extension GL_EXT_shader_texture_lod : enable","defined(LODBASEDMICROSFURACE)"),e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable"),e.uniforms.push("exposureLinear"),e.uniforms.push("contrast"),e.uniforms.push("vInverseScreenSize"),e.uniforms.push("vignetteSettings1"),e.uniforms.push("vignetteSettings2"),e.uniforms.push("vCameraColorCurveNegative"),e.uniforms.push("vCameraColorCurveNeutral"),e.uniforms.push("vCameraColorCurvePositive"),e.uniforms.push("txColorTransform"),e.uniforms.push("colorTransformSettings"),e.uniforms.push("ditherIntensity"),this.light?e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",W,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",W,{repeatKey:"maxSimultaneousLights"}),e._emitFunctionFromInclude("helperFunctions",W),e._emitFunctionFromInclude("importanceSampling",W),e._emitFunctionFromInclude("pbrHelperFunctions",W),e._emitFunctionFromInclude("imageProcessingDeclaration",W),e._emitFunctionFromInclude("imageProcessingFunctions",W),e._emitFunctionFromInclude("shadowsFragmentFunctions",W,{replaceStrings:[{search:/vPositionW/g,replace:z+".xyz"}]}),e._emitFunctionFromInclude("pbrDirectLightingSetupFunctions",W,{replaceStrings:[{search:/vPositionW/g,replace:z+".xyz"}]}),e._emitFunctionFromInclude("pbrDirectLightingFalloffFunctions",W),e._emitFunctionFromInclude("pbrBRDFFunctions",W,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(i=null==j?void 0:j._defineSkyboxName)&&void 0!==i?i:"REFLECTIONMAP_SKYBOX"}]}),e._emitFunctionFromInclude("hdrFilteringFunctions",W),e._emitFunctionFromInclude("pbrDirectLightingFunctions",W,{replaceStrings:[{search:/vPositionW/g,replace:z+".xyz"}]}),e._emitFunctionFromInclude("pbrIBLFunctions",W),e._emitFunctionFromInclude("pbrBlockAlbedoOpacity",W),e._emitFunctionFromInclude("pbrBlockReflectivity",W),e._emitFunctionFromInclude("pbrBlockAmbientOcclusion",W),e._emitFunctionFromInclude("pbrBlockAlphaFresnel",W),e._emitFunctionFromInclude("pbrBlockAnisotropic",W),e._emitUniformFromString("vLightingIntensity","vec4"),this._vNormalWName=e._getFreeVariableName("vNormalW"),e.compilationString+=`vec4 ${this._vNormalWName} = normalize(${this.worldNormal.associatedVariableName});\r\n`,e._registerTempVariable("viewDirectionW")&&(e.compilationString+=`vec3 viewDirectionW = normalize(${this.cameraPosition.associatedVariableName} - ${z}.xyz);\r\n`),e.compilationString+=`vec3 geometricNormalW = ${this._vNormalWName}.xyz;\r\n`,e.compilationString+=`vec3 normalW = ${H.isConnected?"normalize("+H.associatedVariableName+".xyz)":"geometricNormalW"};\r\n`,this._invertNormalName=e._getFreeVariableName("invertNormal"),e._emitUniformFromString(this._invertNormalName,"float"),e.compilationString+=e._emitCodeFromInclude("pbrBlockNormalFinal",W,{replaceStrings:[{search:/vPositionW/g,replace:z+".xyz"},{search:/vEyePosition.w/g,replace:this._invertNormalName}]}),e.compilationString+=this._getAlbedoOpacityCode(),e.compilationString+=e._emitCodeFromInclude("depthPrePass",W),e.compilationString+=this._getAmbientOcclusionCode(),e.compilationString+=e._emitCodeFromInclude("pbrBlockLightmapInit",W),e.compilationString+="#ifdef UNLIT\n vec3 diffuseBase = vec3(1., 1., 1.);\n #else\r\n",e.compilationString+=this._getReflectivityCode(e),e.compilationString+=e._emitCodeFromInclude("pbrBlockGeometryInfo",W,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(n=null==j?void 0:j._defineSkyboxName)&&void 0!==n?n:"REFLECTIONMAP_SKYBOX"},{search:/REFLECTIONMAP_3D/g,replace:null!==(r=null==j?void 0:j._define3DName)&&void 0!==r?r:"REFLECTIONMAP_3D"}]});const X=this.anisotropy.isConnected?null===(s=this.anisotropy.connectedPoint)||void 0===s?void 0:s.ownerBlock:null;X&&(X.worldPositionConnectionPoint=this.worldPosition,X.worldNormalConnectionPoint=this.worldNormal,e.compilationString+=X.getCode(e,!this.perturbedNormal.isConnected)),j&&j.hasTexture&&(e.compilationString+=j.getCode(e,X?"anisotropicOut.anisotropicNormal":"normalW")),e._emitFunctionFromInclude("pbrBlockReflection",W,{replaceStrings:[{search:/computeReflectionCoords/g,replace:"computeReflectionCoordsPBR"},{search:/REFLECTIONMAP_3D/g,replace:null!==(o=null==j?void 0:j._define3DName)&&void 0!==o?o:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(a=null==j?void 0:j._defineOppositeZ)&&void 0!==a?a:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(l=null==j?void 0:j._defineProjectionName)&&void 0!==l?l:"REFLECTIONMAP_PROJECTION"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(c=null==j?void 0:j._defineSkyboxName)&&void 0!==c?c:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(h=null==j?void 0:j._defineLODReflectionAlpha)&&void 0!==h?h:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(_=null==j?void 0:j._defineLinearSpecularReflection)&&void 0!==_?_:"LINEARSPECULARREFLECTION"},{search:/vReflectionFilteringInfo/g,replace:null!==(d=null==j?void 0:j._vReflectionFilteringInfoName)&&void 0!==d?d:"vReflectionFilteringInfo"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockReflectance0",W,{replaceStrings:[{search:/metallicReflectanceFactors/g,replace:this._vMetallicReflectanceFactorsName}]});const Y=this.sheen.isConnected?null===(u=this.sheen.connectedPoint)||void 0===u?void 0:u.ownerBlock:null;Y&&(e.compilationString+=Y.getCode(j)),e._emitFunctionFromInclude("pbrBlockSheen",W,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(p=null==j?void 0:j._define3DName)&&void 0!==p?p:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(f=null==j?void 0:j._defineSkyboxName)&&void 0!==f?f:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(m=null==j?void 0:j._defineLODReflectionAlpha)&&void 0!==m?m:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(g=null==j?void 0:j._defineLinearSpecularReflection)&&void 0!==g?g:"LINEARSPECULARREFLECTION"}]});const Q=this.iridescence.isConnected?null===(b=this.iridescence.connectedPoint)||void 0===b?void 0:b.ownerBlock:null;e.compilationString+=lh.GetCode(Q),e._emitFunctionFromInclude("pbrBlockIridescence",W,{replaceStrings:[]});const q=this.clearcoat.isConnected?null===(y=this.clearcoat.connectedPoint)||void 0===y?void 0:y.ownerBlock:null,K=!this.perturbedNormal.isConnected&&!this.anisotropy.isConnected,Z=this.perturbedNormal.isConnected&&(null===(A=(null===(v=this.perturbedNormal.connectedPoint)||void 0===v?void 0:v.ownerBlock).worldTangent)||void 0===A?void 0:A.isConnected),$=this.anisotropy.isConnected&&(null===(C=this.anisotropy.connectedPoint)||void 0===C?void 0:C.ownerBlock).worldTangent.isConnected;let J=Z||!this.perturbedNormal.isConnected&&$;e.compilationString+=ah.GetCode(e,q,j,z,K,J,this.worldNormal.associatedVariableName),K&&(J=null!==(S=null==q?void 0:q.worldTangent.isConnected)&&void 0!==S&&S),e._emitFunctionFromInclude("pbrBlockClearcoat",W,{replaceStrings:[{search:/computeReflectionCoords/g,replace:"computeReflectionCoordsPBR"},{search:/REFLECTIONMAP_3D/g,replace:null!==(x=null==j?void 0:j._define3DName)&&void 0!==x?x:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(T=null==j?void 0:j._defineOppositeZ)&&void 0!==T?T:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(E=null==j?void 0:j._defineProjectionName)&&void 0!==E?E:"REFLECTIONMAP_PROJECTION"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(R=null==j?void 0:j._defineSkyboxName)&&void 0!==R?R:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(P=null==j?void 0:j._defineLODReflectionAlpha)&&void 0!==P?P:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(I=null==j?void 0:j._defineLinearSpecularReflection)&&void 0!==I?I:"LINEARSPECULARREFLECTION"},{search:/defined\(TANGENT\)/g,replace:J?"defined(TANGENT)":"defined(IGNORE)"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockReflectance",W,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(M=null==j?void 0:j._defineSkyboxName)&&void 0!==M?M:"REFLECTIONMAP_SKYBOX"},{search:/REFLECTIONMAP_3D/g,replace:null!==(D=null==j?void 0:j._define3DName)&&void 0!==D?D:"REFLECTIONMAP_3D"}]});const ee=this.subsurface.isConnected?null===(O=this.subsurface.connectedPoint)||void 0===O?void 0:O.ownerBlock:null,te=this.subsurface.isConnected?null===(F=(null===(w=this.subsurface.connectedPoint)||void 0===w?void 0:w.ownerBlock).refraction.connectedPoint)||void 0===F?void 0:F.ownerBlock:null;te&&(te.viewConnectionPoint=this.view,te.indexOfRefractionConnectionPoint=this.indexOfRefraction),e.compilationString+=hh.GetCode(e,ee,j,z),e._emitFunctionFromInclude("pbrBlockSubSurface",W,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(B=null==j?void 0:j._define3DName)&&void 0!==B?B:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(N=null==j?void 0:j._defineOppositeZ)&&void 0!==N?N:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(L=null==j?void 0:j._defineProjectionName)&&void 0!==L?L:"REFLECTIONMAP_PROJECTION"},{search:/SS_REFRACTIONMAP_3D/g,replace:null!==(k=null==te?void 0:te._define3DName)&&void 0!==k?k:"SS_REFRACTIONMAP_3D"},{search:/SS_LODINREFRACTIONALPHA/g,replace:null!==(V=null==te?void 0:te._defineLODRefractionAlpha)&&void 0!==V?V:"SS_LODINREFRACTIONALPHA"},{search:/SS_LINEARSPECULARREFRACTION/g,replace:null!==(U=null==te?void 0:te._defineLinearSpecularRefraction)&&void 0!==U?U:"SS_LINEARSPECULARREFRACTION"},{search:/SS_REFRACTIONMAP_OPPOSITEZ/g,replace:null!==(G=null==te?void 0:te._defineOppositeZ)&&void 0!==G?G:"SS_REFRACTIONMAP_OPPOSITEZ"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockDirectLighting",W),this.light?e.compilationString+=e._emitCodeFromInclude("lightFragment",W,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]}):e.compilationString+=e._emitCodeFromInclude("lightFragment",W,{repeatKey:"maxSimultaneousLights"}),e.compilationString+=e._emitCodeFromInclude("pbrBlockFinalLitComponents",W),e.compilationString+="#endif\r\n";const ie=this.ambientColor.isConnected?this.ambientColor.associatedVariableName:"vec3(0., 0., 0.)";let ne=hl.m.DEFAULT_AO_ON_ANALYTICAL_LIGHTS.toString();-1===ne.indexOf(".")&&(ne+="."),e.compilationString+=e._emitCodeFromInclude("pbrBlockFinalUnlitComponents",W,{replaceStrings:[{search:/vec3 finalEmissive[\s\S]*?finalEmissive\*=vLightingIntensity\.y;/g,replace:""},{search:/vAmbientColor/g,replace:ie+" * ambientFromScene"},{search:/vAmbientInfos\.w/g,replace:ne}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockFinalColorComposition",W,{replaceStrings:[{search:/finalEmissive/g,replace:"vec3(0.)"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockImageProcessing",W,{replaceStrings:[{search:/visibility/g,replace:"1."}]}),e.compilationString+=e._emitCodeFromInclude("pbrDebug",W,{replaceStrings:[{search:/vNormalW/g,replace:this._vNormalWName},{search:/vPositionW/g,replace:z},{search:/albedoTexture\.rgb;/g,replace:"vec3(1.);\r\ngl_FragColor.rgb = toGammaSpace(gl_FragColor.rgb);\r\n"}]});for(const t of this._outputs)if(t.hasEndpoints){const i=_h[t.name];if(i){const[n,r]=i;r&&(e.compilationString+=`#if ${r}\r\n`),e.compilationString+=`${this._declareOutput(t,e)} = ${n};\r\n`,r&&(e.compilationString+="#else\r\n",e.compilationString+=`${this._declareOutput(t,e)} = vec3(0.);\r\n`,e.compilationString+="#endif\r\n")}else console.error(`There's no remapping for the ${t.name} end point! No code generated`)}return this}_dumpPropertiesCode(){let e=super._dumpPropertiesCode();return e+=`${this._codeVariableName}.lightFalloff = ${this.lightFalloff};\r\n`,e+=`${this._codeVariableName}.useAlphaTest = ${this.useAlphaTest};\r\n`,e+=`${this._codeVariableName}.alphaTestCutoff = ${this.alphaTestCutoff};\r\n`,e+=`${this._codeVariableName}.useAlphaBlending = ${this.useAlphaBlending};\r\n`,e+=`${this._codeVariableName}.useRadianceOverAlpha = ${this.useRadianceOverAlpha};\r\n`,e+=`${this._codeVariableName}.useSpecularOverAlpha = ${this.useSpecularOverAlpha};\r\n`,e+=`${this._codeVariableName}.enableSpecularAntiAliasing = ${this.enableSpecularAntiAliasing};\r\n`,e+=`${this._codeVariableName}.realTimeFiltering = ${this.realTimeFiltering};\r\n`,e+=`${this._codeVariableName}.realTimeFilteringQuality = ${this.realTimeFilteringQuality};\r\n`,e+=`${this._codeVariableName}.useEnergyConservation = ${this.useEnergyConservation};\r\n`,e+=`${this._codeVariableName}.useRadianceOcclusion = ${this.useRadianceOcclusion};\r\n`,e+=`${this._codeVariableName}.useHorizonOcclusion = ${this.useHorizonOcclusion};\r\n`,e+=`${this._codeVariableName}.unlit = ${this.unlit};\r\n`,e+=`${this._codeVariableName}.forceNormalForward = ${this.forceNormalForward};\r\n`,e+=`${this._codeVariableName}.debugMode = ${this.debugMode};\r\n`,e+=`${this._codeVariableName}.debugLimit = ${this.debugLimit};\r\n`,e+=`${this._codeVariableName}.debugFactor = ${this.debugFactor};\r\n`,e}serialize(){const e=super.serialize();return this.light&&(e.lightId=this.light.id),e.lightFalloff=this.lightFalloff,e.useAlphaTest=this.useAlphaTest,e.alphaTestCutoff=this.alphaTestCutoff,e.useAlphaBlending=this.useAlphaBlending,e.useRadianceOverAlpha=this.useRadianceOverAlpha,e.useSpecularOverAlpha=this.useSpecularOverAlpha,e.enableSpecularAntiAliasing=this.enableSpecularAntiAliasing,e.realTimeFiltering=this.realTimeFiltering,e.realTimeFilteringQuality=this.realTimeFilteringQuality,e.useEnergyConservation=this.useEnergyConservation,e.useRadianceOcclusion=this.useRadianceOcclusion,e.useHorizonOcclusion=this.useHorizonOcclusion,e.unlit=this.unlit,e.forceNormalForward=this.forceNormalForward,e.debugMode=this.debugMode,e.debugLimit=this.debugLimit,e.debugFactor=this.debugFactor,e}_deserialize(e,t,i){var n,r;super._deserialize(e,t,i),e.lightId&&(this.light=t.getLightById(e.lightId)),this.lightFalloff=null!==(n=e.lightFalloff)&&void 0!==n?n:0,this.useAlphaTest=e.useAlphaTest,this.alphaTestCutoff=e.alphaTestCutoff,this.useAlphaBlending=e.useAlphaBlending,this.useRadianceOverAlpha=e.useRadianceOverAlpha,this.useSpecularOverAlpha=e.useSpecularOverAlpha,this.enableSpecularAntiAliasing=e.enableSpecularAntiAliasing,this.realTimeFiltering=!!e.realTimeFiltering,this.realTimeFilteringQuality=null!==(r=e.realTimeFilteringQuality)&&void 0!==r?r:8,this.useEnergyConservation=e.useEnergyConservation,this.useRadianceOcclusion=e.useRadianceOcclusion,this.useHorizonOcclusion=e.useHorizonOcclusion,this.unlit=e.unlit,this.forceNormalForward=!!e.forceNormalForward,this.debugMode=e.debugMode,this.debugLimit=e.debugLimit,this.debugFactor=e.debugFactor}}var uh;(0,X.gn)([(0,Jl.p)("Direct lights",Jl.U.Float,"INTENSITY",{min:0,max:1,notifiers:{update:!0}})],dh.prototype,"directIntensity",void 0),(0,X.gn)([(0,Jl.p)("Environment lights",Jl.U.Float,"INTENSITY",{min:0,max:1,notifiers:{update:!0}})],dh.prototype,"environmentIntensity",void 0),(0,X.gn)([(0,Jl.p)("Specular highlights",Jl.U.Float,"INTENSITY",{min:0,max:1,notifiers:{update:!0}})],dh.prototype,"specularIntensity",void 0),(0,X.gn)([(0,Jl.p)("Light falloff",Jl.U.List,"LIGHTING & COLORS",{notifiers:{update:!0},options:[{label:"Physical",value:hl.m.LIGHTFALLOFF_PHYSICAL},{label:"GLTF",value:hl.m.LIGHTFALLOFF_GLTF},{label:"Standard",value:hl.m.LIGHTFALLOFF_STANDARD}]})],dh.prototype,"lightFalloff",void 0),(0,X.gn)([(0,Jl.p)("Alpha Testing",Jl.U.Boolean,"OPACITY")],dh.prototype,"useAlphaTest",void 0),(0,X.gn)([(0,Jl.p)("Alpha CutOff",Jl.U.Float,"OPACITY",{min:0,max:1,notifiers:{update:!0}})],dh.prototype,"alphaTestCutoff",void 0),(0,X.gn)([(0,Jl.p)("Alpha blending",Jl.U.Boolean,"OPACITY")],dh.prototype,"useAlphaBlending",void 0),(0,X.gn)([(0,Jl.p)("Radiance over alpha",Jl.U.Boolean,"RENDERING",{notifiers:{update:!0}})],dh.prototype,"useRadianceOverAlpha",void 0),(0,X.gn)([(0,Jl.p)("Specular over alpha",Jl.U.Boolean,"RENDERING",{notifiers:{update:!0}})],dh.prototype,"useSpecularOverAlpha",void 0),(0,X.gn)([(0,Jl.p)("Specular anti-aliasing",Jl.U.Boolean,"RENDERING",{notifiers:{update:!0}})],dh.prototype,"enableSpecularAntiAliasing",void 0),(0,X.gn)([(0,Jl.p)("Realtime filtering",Jl.U.Boolean,"RENDERING",{notifiers:{update:!0}})],dh.prototype,"realTimeFiltering",void 0),(0,X.gn)([(0,Jl.p)("Realtime filtering quality",Jl.U.List,"RENDERING",{notifiers:{update:!0},options:[{label:"Low",value:8},{label:"Medium",value:16},{label:"High",value:64}]})],dh.prototype,"realTimeFilteringQuality",void 0),(0,X.gn)([(0,Jl.p)("Energy Conservation",Jl.U.Boolean,"ADVANCED",{notifiers:{update:!0}})],dh.prototype,"useEnergyConservation",void 0),(0,X.gn)([(0,Jl.p)("Radiance occlusion",Jl.U.Boolean,"ADVANCED",{notifiers:{update:!0}})],dh.prototype,"useRadianceOcclusion",void 0),(0,X.gn)([(0,Jl.p)("Horizon occlusion",Jl.U.Boolean,"ADVANCED",{notifiers:{update:!0}})],dh.prototype,"useHorizonOcclusion",void 0),(0,X.gn)([(0,Jl.p)("Unlit",Jl.U.Boolean,"ADVANCED",{notifiers:{update:!0}})],dh.prototype,"unlit",void 0),(0,X.gn)([(0,Jl.p)("Force normal forward",Jl.U.Boolean,"ADVANCED",{notifiers:{update:!0}})],dh.prototype,"forceNormalForward",void 0),(0,X.gn)([(0,Jl.p)("Debug mode",Jl.U.List,"DEBUG",{notifiers:{update:!0},options:[{label:"None",value:0},{label:"Normalized position",value:1},{label:"Normals",value:2},{label:"Tangents",value:3},{label:"Bitangents",value:4},{label:"Bump Normals",value:5},{label:"ClearCoat Normals",value:8},{label:"ClearCoat Tangents",value:9},{label:"ClearCoat Bitangents",value:10},{label:"Anisotropic Normals",value:11},{label:"Anisotropic Tangents",value:12},{label:"Anisotropic Bitangents",value:13},{label:"Env Refraction",value:40},{label:"Env Reflection",value:41},{label:"Env Clear Coat",value:42},{label:"Direct Diffuse",value:50},{label:"Direct Specular",value:51},{label:"Direct Clear Coat",value:52},{label:"Direct Sheen",value:53},{label:"Env Irradiance",value:54},{label:"Surface Albedo",value:60},{label:"Reflectance 0",value:61},{label:"Metallic",value:62},{label:"Metallic F0",value:71},{label:"Roughness",value:63},{label:"AlphaG",value:64},{label:"NdotV",value:65},{label:"ClearCoat Color",value:66},{label:"ClearCoat Roughness",value:67},{label:"ClearCoat NdotV",value:68},{label:"Transmittance",value:69},{label:"Refraction Transmittance",value:70},{label:"SEO",value:80},{label:"EHO",value:81},{label:"Energy Factor",value:82},{label:"Specular Reflectance",value:83},{label:"Clear Coat Reflectance",value:84},{label:"Sheen Reflectance",value:85},{label:"Luminance Over Alpha",value:86},{label:"Alpha",value:87}]})],dh.prototype,"debugMode",void 0),(0,X.gn)([(0,Jl.p)("Split position",Jl.U.Float,"DEBUG",{min:-1,max:1,notifiers:{update:!0}})],dh.prototype,"debugLimit",void 0),(0,X.gn)([(0,Jl.p)("Output factor",Jl.U.Float,"DEBUG",{min:0,max:5,notifiers:{update:!0}})],dh.prototype,"debugFactor",void 0),(0,l.H)("BABYLON.PBRMetallicRoughnessBlock",dh),i("../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Particle/particleTextureBlock.js"),i("../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Particle/particleRampGradientBlock.js"),i("../../../node_modules/@babylonjs/core/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js");class ph extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("left",Gl.E.AutoDetect),this.registerInput("right",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0],this._linkConnectionTypes(0,1)}getClassName(){return"ModBlock"}get left(){return this._inputs[0]}get right(){return this._inputs[1]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+` = mod(${this.left.associatedVariableName}, ${this.right.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.ModBlock",ph);class fh extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("row0",Gl.E.Vector4),this.registerInput("row1",Gl.E.Vector4),this.registerInput("row2",Gl.E.Vector4),this.registerInput("row3",Gl.E.Vector4),this.registerOutput("output",Gl.E.Matrix)}getClassName(){return"MatrixBuilder"}get row0(){return this._inputs[0]}get row1(){return this._inputs[1]}get row2(){return this._inputs[2]}get row3(){return this._inputs[3]}get output(){return this._outputs[0]}autoConfigure(){if(!this.row0.isConnected){const e=new Yl.S("row0");e.value=new o.Lt(1,0,0,0),e.output.connectTo(this.row0)}if(!this.row1.isConnected){const e=new Yl.S("row1");e.value=new o.Lt(0,1,0,0),e.output.connectTo(this.row1)}if(!this.row2.isConnected){const e=new Yl.S("row2");e.value=new o.Lt(0,0,1,0),e.output.connectTo(this.row2)}if(!this.row3.isConnected){const e=new Yl.S("row3");e.value=new o.Lt(0,0,0,1),e.output.connectTo(this.row3)}}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0],i=this.row0,n=this.row1,r=this.row2,s=this.row3;return e.compilationString+=this._declareOutput(t,e)+` = mat4(${i.associatedVariableName}, ${n.associatedVariableName}, ${r.associatedVariableName}, ${s.associatedVariableName});\r\n`,this}}(0,l.H)("BABYLON.MatrixBuilder",fh),function(e){e[e.Equal=0]="Equal",e[e.NotEqual=1]="NotEqual",e[e.LessThan=2]="LessThan",e[e.GreaterThan=3]="GreaterThan",e[e.LessOrEqual=4]="LessOrEqual",e[e.GreaterOrEqual=5]="GreaterOrEqual",e[e.Xor=6]="Xor",e[e.Or=7]="Or",e[e.And=8]="And"}(uh||(uh={}));class mh extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.condition=uh.LessThan,this.registerInput("a",Gl.E.Float),this.registerInput("b",Gl.E.Float),this.registerInput("true",Gl.E.AutoDetect,!0),this.registerInput("false",Gl.E.AutoDetect,!0),this.registerOutput("output",Gl.E.BasedOnInput),this._linkConnectionTypes(2,3),this._outputs[0]._typeConnectionSource=this._inputs[2],this._outputs[0]._defaultConnectionPointType=Gl.E.Float}getClassName(){return"ConditionalBlock"}get a(){return this._inputs[0]}get b(){return this._inputs[1]}get true(){return this._inputs[2]}get false(){return this._inputs[3]}get output(){return this._outputs[0]}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0],i=this.true.isConnected?this.true.associatedVariableName:"1.0",n=this.false.isConnected?this.false.associatedVariableName:"0.0";switch(this.condition){case uh.Equal:e.compilationString+=this._declareOutput(t,e)+` = ${this.a.associatedVariableName} == ${this.b.associatedVariableName} ? ${i} : ${n};\r\n`;break;case uh.NotEqual:e.compilationString+=this._declareOutput(t,e)+` = ${this.a.associatedVariableName} != ${this.b.associatedVariableName} ? ${i} : ${n};\r\n`;break;case uh.LessThan:e.compilationString+=this._declareOutput(t,e)+` = ${this.a.associatedVariableName} < ${this.b.associatedVariableName} ? ${i} : ${n};\r\n`;break;case uh.LessOrEqual:e.compilationString+=this._declareOutput(t,e)+` = ${this.a.associatedVariableName} <= ${this.b.associatedVariableName} ? ${i} : ${n};\r\n`;break;case uh.GreaterThan:e.compilationString+=this._declareOutput(t,e)+` = ${this.a.associatedVariableName} > ${this.b.associatedVariableName} ? ${i} : ${n};\r\n`;break;case uh.GreaterOrEqual:e.compilationString+=this._declareOutput(t,e)+` = ${this.a.associatedVariableName} >= ${this.b.associatedVariableName} ? ${i} : ${n};\r\n`;break;case uh.Xor:e.compilationString+=this._declareOutput(t,e)+` = (mod(${this.a.associatedVariableName} + ${this.b.associatedVariableName}, 2.0) > 0.0) ? ${i} : ${n};\r\n`;break;case uh.Or:e.compilationString+=this._declareOutput(t,e)+` = (min(${this.a.associatedVariableName} + ${this.b.associatedVariableName}, 1.0) > 0.0) ? ${i} : ${n};\r\n`;break;case uh.And:e.compilationString+=this._declareOutput(t,e)+` = (${this.a.associatedVariableName} * ${this.b.associatedVariableName} > 0.0) ? ${i} : ${n};\r\n`}return this}serialize(){const e=super.serialize();return e.condition=this.condition,e}_deserialize(e,t,i){super._deserialize(e,t,i),this.condition=e.condition}_dumpPropertiesCode(){return super._dumpPropertiesCode()+`${this._codeVariableName}.condition = BABYLON.ConditionalBlockConditions.${uh[this.condition]};\r\n`}}(0,l.H)("BABYLON.ConditionalBlock",mh);class gh extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.octaves=6,this.registerInput("seed",Gl.E.AutoDetect),this.registerInput("chaos",Gl.E.AutoDetect,!0),this.registerInput("offsetX",Gl.E.Float,!0),this.registerInput("offsetY",Gl.E.Float,!0),this.registerInput("offsetZ",Gl.E.Float,!0),this.registerOutput("output",Gl.E.Float),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector2),this._inputs[0].acceptedConnectionPointTypes.push(Gl.E.Vector3),this._linkConnectionTypes(0,1)}getClassName(){return"CloudBlock"}get seed(){return this._inputs[0]}get chaos(){return this._inputs[1]}get offsetX(){return this._inputs[2]}get offsetY(){return this._inputs[3]}get offsetZ(){return this._inputs[4]}get output(){return this._outputs[0]}_buildBlock(e){var t,i;if(super._buildBlock(e),!this.seed.isConnected)return;if(!this._outputs[0].hasEndpoints)return;const n=`fbm${this.octaves}`;e._emitFunction("CloudBlockCode","\n\n float cloudRandom(in float p) { p = fract(p * 0.011); p *= p + 7.5; p *= p + p; return fract(p); }\n\n // Based on Morgan McGuire @morgan3d\n // https://www.shadertoy.com/view/4dS3Wd\n float cloudNoise(in vec2 x, in vec2 chaos) {\n vec2 step = chaos * vec2(75., 120.) + vec2(75., 120.);\n\n vec2 i = floor(x);\n vec2 f = fract(x);\n\n float n = dot(i, step);\n\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(\n mix(cloudRandom(n + dot(step, vec2(0, 0))), cloudRandom(n + dot(step, vec2(1, 0))), u.x),\n mix(cloudRandom(n + dot(step, vec2(0, 1))), cloudRandom(n + dot(step, vec2(1, 1))), u.x),\n u.y\n );\n }\n\n float cloudNoise(in vec3 x, in vec3 chaos) {\n vec3 step = chaos * vec3(60., 120., 75.) + vec3(60., 120., 75.);\n\n vec3 i = floor(x);\n vec3 f = fract(x);\n\n float n = dot(i, step);\n\n vec3 u = f * f * (3.0 - 2.0 * f);\n return mix(mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 0))), cloudRandom(n + dot(step, vec3(1, 0, 0))), u.x),\n mix( cloudRandom(n + dot(step, vec3(0, 1, 0))), cloudRandom(n + dot(step, vec3(1, 1, 0))), u.x), u.y),\n mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 1))), cloudRandom(n + dot(step, vec3(1, 0, 1))), u.x),\n mix( cloudRandom(n + dot(step, vec3(0, 1, 1))), cloudRandom(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);\n }","// CloudBlockCode"),e._emitFunction("CloudBlockCodeFBM"+this.octaves,"\n float fbm(in vec2 st, in vec2 chaos) {\n // Initial values\n float value = 0.0;\n float amplitude = .5;\n float frequency = 0.;\n\n // Loop of octaves\n for (int i = 0; i < OCTAVES; i++) {\n value += amplitude * cloudNoise(st, chaos);\n st *= 2.0;\n amplitude *= 0.5;\n }\n return value;\n }\n\n float fbm(in vec3 x, in vec3 chaos) {\n // Initial values\n float value = 0.0;\n float amplitude = 0.5;\n for (int i = 0; i < OCTAVES; ++i) {\n value += amplitude * cloudNoise(x, chaos);\n x = x * 2.0;\n amplitude *= 0.5;\n }\n return value;\n }".replace(/fbm/gi,n).replace(/OCTAVES/gi,(0|this.octaves).toString()),"// CloudBlockCode FBM");const r=e._getFreeVariableName("st"),s=(null===(t=this.seed.connectedPoint)||void 0===t?void 0:t.type)===Gl.E.Vector2?"vec2":"vec3";e.compilationString+=`${s} ${r} = ${this.seed.associatedVariableName};\r\n`,this.offsetX.isConnected&&(e.compilationString+=`${r}.x += 0.1 * ${this.offsetX.associatedVariableName};\r\n`),this.offsetY.isConnected&&(e.compilationString+=`${r}.y += 0.1 * ${this.offsetY.associatedVariableName};\r\n`),this.offsetZ.isConnected&&"vec3"===s&&(e.compilationString+=`${r}.z += 0.1 * ${this.offsetZ.associatedVariableName};\r\n`);let o="";return o=this.chaos.isConnected?this.chaos.associatedVariableName:(null===(i=this.seed.connectedPoint)||void 0===i?void 0:i.type)===Gl.E.Vector2?"vec2(0., 0.)":"vec3(0., 0., 0.)",e.compilationString+=this._declareOutput(this._outputs[0],e)+` = ${n}(${r}, ${o});\r\n`,this}_dumpPropertiesCode(){return super._dumpPropertiesCode()+`${this._codeVariableName}.octaves = ${this.octaves};\r\n`}serialize(){const e=super.serialize();return e.octaves=this.octaves,e}_deserialize(e,t,i){super._deserialize(e,t,i),this.octaves=e.octaves}}(0,X.gn)([(0,Jl.p)("Octaves",Jl.U.Int)],gh.prototype,"octaves",void 0),(0,l.H)("BABYLON.CloudBlock",gh);class bh extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("seed",Gl.E.Vector2),this.registerInput("offset",Gl.E.Float),this.registerInput("density",Gl.E.Float),this.registerOutput("output",Gl.E.Float),this.registerOutput("cells",Gl.E.Float)}getClassName(){return"VoronoiNoiseBlock"}get seed(){return this._inputs[0]}get offset(){return this._inputs[1]}get density(){return this._inputs[2]}get output(){return this._outputs[0]}get cells(){return this._outputs[1]}_buildBlock(e){if(super._buildBlock(e),!this.seed.isConnected)return;let t="vec2 voronoiRandom(vec2 seed, float offset){\n mat2 m = mat2(15.27, 47.63, 99.41, 89.98);\n vec2 uv = fract(sin(m * seed) * 46839.32);\n return vec2(sin(uv.y * offset) * 0.5 + 0.5, cos(uv.x * offset) * 0.5 + 0.5);\n }\n ";e._emitFunction("voronoiRandom",t,"// Voronoi random generator"),t="void voronoi(vec2 seed, float offset, float density, out float outValue, out float cells){\n vec2 g = floor(seed * density);\n vec2 f = fract(seed * density);\n float t = 8.0;\n vec3 res = vec3(8.0, 0.0, 0.0);\n\n for(int y=-1; y<=1; y++)\n {\n for(int x=-1; x<=1; x++)\n {\n vec2 lattice = vec2(x,y);\n vec2 randomOffset = voronoiRandom(lattice + g, offset);\n float d = distance(lattice + randomOffset, f);\n if(d < res.x)\n {\n res = vec3(d, randomOffset.x, randomOffset.y);\n outValue = res.x;\n cells = res.y;\n }\n }\n }\n }\n ",e._emitFunction("voronoi",t,"// Voronoi");const i=e._getFreeVariableName("tempOutput"),n=e._getFreeVariableName("tempCells");return e.compilationString+=`float ${i} = 0.0;\r\n`,e.compilationString+=`float ${n} = 0.0;\r\n`,e.compilationString+=`voronoi(${this.seed.associatedVariableName}, ${this.offset.associatedVariableName}, ${this.density.associatedVariableName}, ${i}, ${n});\r\n`,this.output.hasEndpoints&&(e.compilationString+=this._declareOutput(this.output,e)+` = ${i};\r\n`),this.cells.hasEndpoints&&(e.compilationString+=this._declareOutput(this.cells,e)+` = ${n};\r\n`),this}}(0,l.H)("BABYLON.VoronoiNoiseBlock",bh);class yh extends Xl.k{constructor(e){super(e,Ul.u.Neutral),this.registerInput("input",Gl.E.AutoDetect),this.registerOutput("output",Gl.E.BasedOnInput),this._outputs[0]._typeConnectionSource=this._inputs[0]}getClassName(){return"ElbowBlock"}get input(){return this._inputs[0]}get output(){return this._outputs[0]}get target(){const e=this._inputs[0];if(e.isConnected){const t=e.connectedPoint.ownerBlock;if(t.target!==Ul.u.VertexAndFragment)return t.target;if(e.connectedPoint.target!==Ul.u.VertexAndFragment)return e.connectedPoint.target}return this._target}set target(e){0==(this._target&e)&&(this._target=e)}_buildBlock(e){super._buildBlock(e);const t=this._outputs[0],i=this._inputs[0];return e.compilationString+=this._declareOutput(t,e)+` = ${i.associatedVariableName};\r\n`,this}}(0,l.H)("BABYLON.ElbowBlock",yh),i("../../../node_modules/@babylonjs/core/Misc/guid.js"),i("../../../node_modules/@babylonjs/core/Materials/materialPluginBase.js"),i("../../../node_modules/@babylonjs/core/Materials/materialPluginManager.js"),i("../../../node_modules/@babylonjs/core/Materials/materialPluginEvent.js"),i("../../../node_modules/@babylonjs/core/Materials/material.detailMapConfiguration.js"),i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrBRDFConfiguration.js"),i("../../../node_modules/@babylonjs/core/Maths/math.functions.js"),i("../../../node_modules/@babylonjs/core/Meshes/Compression/dracoCompression.js"),i("../../../node_modules/@babylonjs/core/Meshes/Compression/meshoptCompression.js");class vh{constructor(e,t){this.normal=e,this.w=t}static FromPoints(e,t,i){const n=i.subtract(e),r=t.subtract(e);if(0===n.lengthSquared()||0===r.lengthSquared())return null;const s=o.P.Normalize(o.P.Cross(n,r));return new vh(s,o.P.Dot(s,e))}clone(){return new vh(this.normal.clone(),this.w)}flip(){this.normal.scaleInPlace(-1),this.w=-this.w}splitPolygon(e,t,i,n,r){let s=0;const a=[];let l,c;for(l=0;lvh.EPSILON?1:0;s|=t,a.push(t)}switch(s){case 0:(o.P.Dot(this.normal,e.plane.normal)>0?t:i).push(e);break;case 1:n.push(e);break;case 2:r.push(e);break;case 3:{const t=[],i=[];for(l=0;l=3&&(s=new Ah(t,e.shared),s.plane&&n.push(s)),i.length>=3&&(s=new Ah(i,e.shared),s.plane&&r.push(s));break}}}}vh.EPSILON=1e-5;class Ah{constructor(e,t){this.vertices=e,this.shared=t,this.plane=vh.FromPoints(e[0].pos,e[1].pos,e[2].pos)}clone(){const e=this.vertices.map((e=>e.clone()));return new Ah(e,this.shared)}flip(){this.vertices.reverse().map((e=>{e.flip()})),this.plane.flip()}}je.Kj._GoldbergMeshParser=(e,t)=>Ch.Parse(e,t);class Ch extends je.Kj{constructor(){super(...arguments),this.goldbergData={faceColors:[],faceCenters:[],faceZaxis:[],faceXaxis:[],faceYaxis:[],nbSharedFaces:0,nbUnsharedFaces:0,nbFaces:0,nbFacesAtPole:0,adjacentFaces:[]}}relatedGoldbergFace(e,t){return void 0===t?(e>this.goldbergData.nbUnsharedFaces-1&&(u.Y.Warn("Maximum number of unshared faces used"),e=this.goldbergData.nbUnsharedFaces-1),this.goldbergData.nbUnsharedFaces+e):(e>11&&(u.Y.Warn("Last pole used"),e=11),t>this.goldbergData.nbFacesAtPole-1&&(u.Y.Warn("Maximum number of faces at a pole used"),t=this.goldbergData.nbFacesAtPole-1),12+e*this.goldbergData.nbFacesAtPole+t)}_changeGoldbergFaceColors(e){for(let t=0;t1&&(h=1),l.push(h,_);for(let e=0;e<6;e++)h=s.x+o*Math.cos(a+e*Math.PI/3),_=s.y+o*Math.sin(a+e*Math.PI/3),h<0&&(h=0),h>1&&(h=1),c.push(h,_);for(let e=n;ea.HE.FromArray(e))),i.faceCenters=i.faceCenters.map((e=>o.P.FromArray(e))),i.faceZaxis=i.faceZaxis.map((e=>o.P.FromArray(e))),i.faceXaxis=i.faceXaxis.map((e=>o.P.FromArray(e))),i.faceYaxis=i.faceYaxis.map((e=>o.P.FromArray(e)));const n=new Ch(e.name,t);return n.goldbergData=i,n}}function Sh(e){const t=e.pattern||je.Kj.NO_FLIP,i=e.tileWidth||e.tileSize||1,n=e.tileHeight||e.tileSize||1,r=e.alignHorizontal||0,s=e.alignVertical||0,o=e.width||e.size||1,a=Math.floor(o/i);let l=o-a*i;const c=e.height||e.size||1,h=Math.floor(c/n);let _=c-h*n;const d=i*a/2,u=n*h/2;let p=0,f=0,m=0,g=0,b=0,y=0;if(l>0||_>0){switch(m=-d,g=-u,b=d,y=u,r){case je.Kj.CENTER:l/=2,m-=l,b+=l;break;case je.Kj.LEFT:b+=l,p=-l/2;break;case je.Kj.RIGHT:m-=l,p=l/2}switch(s){case je.Kj.CENTER:_/=2,g-=_,y+=_;break;case je.Kj.BOTTOM:y+=_,f=-_/2;break;case je.Kj.TOP:g-=_,f=_/2}}const v=[],A=[],C=[];C[0]=[0,0,1,0,1,1,0,1],C[1]=[0,0,1,0,1,1,0,1],t!==je.Kj.ROTATE_TILE&&t!==je.Kj.ROTATE_ROW||(C[1]=[1,1,0,1,0,0,1,0]),t!==je.Kj.FLIP_TILE&&t!==je.Kj.FLIP_ROW||(C[1]=[1,0,0,0,0,1,1,1]),t!==je.Kj.FLIP_N_ROTATE_TILE&&t!==je.Kj.FLIP_N_ROTATE_ROW||(C[1]=[0,1,1,1,1,0,0,0]);let S=[];const x=[],T=[];let E=0;for(let e=0;e0||_>0){const e=_>0&&(s===je.Kj.CENTER||s===je.Kj.TOP),o=_>0&&(s===je.Kj.CENTER||s===je.Kj.BOTTOM),c=l>0&&(r===je.Kj.CENTER||r===je.Kj.RIGHT),C=l>0&&(r===je.Kj.CENTER||r===je.Kj.LEFT);let R,P,I,M,D=[];if(e&&c&&(v.push(m+p,g+f,0),v.push(-d+p,g+f,0),v.push(-d+p,g+_+f,0),v.push(m+p,g+_+f,0),T.push(E,E+1,E+3,E+1,E+2,E+3),E+=4,R=1-l/i,P=1-_/n,I=1,M=1,D=[R,P,I,P,I,M,R,M],t===je.Kj.ROTATE_ROW&&(D=[1-R,1-P,1-I,1-P,1-I,1-M,1-R,1-M]),t===je.Kj.FLIP_ROW&&(D=[1-R,P,1-I,P,1-I,M,1-R,M]),t===je.Kj.FLIP_N_ROTATE_ROW&&(D=[R,1-P,I,1-P,I,1-M,R,1-M]),S=S.concat(D),x.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),e&&C&&(v.push(d+p,g+f,0),v.push(b+p,g+f,0),v.push(b+p,g+_+f,0),v.push(d+p,g+_+f,0),T.push(E,E+1,E+3,E+1,E+2,E+3),E+=4,R=0,P=1-_/n,I=l/i,M=1,D=[R,P,I,P,I,M,R,M],(t===je.Kj.ROTATE_ROW||t===je.Kj.ROTATE_TILE&&a%2==0)&&(D=[1-R,1-P,1-I,1-P,1-I,1-M,1-R,1-M]),(t===je.Kj.FLIP_ROW||t===je.Kj.FLIP_TILE&&a%2==0)&&(D=[1-R,P,1-I,P,1-I,M,1-R,M]),(t===je.Kj.FLIP_N_ROTATE_ROW||t===je.Kj.FLIP_N_ROTATE_TILE&&a%2==0)&&(D=[R,1-P,I,1-P,I,1-M,R,1-M]),S=S.concat(D),x.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),o&&c&&(v.push(m+p,u+f,0),v.push(-d+p,u+f,0),v.push(-d+p,y+f,0),v.push(m+p,y+f,0),T.push(E,E+1,E+3,E+1,E+2,E+3),E+=4,R=1-l/i,P=0,I=1,M=_/n,D=[R,P,I,P,I,M,R,M],(t===je.Kj.ROTATE_ROW&&h%2==1||t===je.Kj.ROTATE_TILE&&h%1==0)&&(D=[1-R,1-P,1-I,1-P,1-I,1-M,1-R,1-M]),(t===je.Kj.FLIP_ROW&&h%2==1||t===je.Kj.FLIP_TILE&&h%2==0)&&(D=[1-R,P,1-I,P,1-I,M,1-R,M]),(t===je.Kj.FLIP_N_ROTATE_ROW&&h%2==1||t===je.Kj.FLIP_N_ROTATE_TILE&&h%2==0)&&(D=[R,1-P,I,1-P,I,1-M,R,1-M]),S=S.concat(D),x.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),o&&C&&(v.push(d+p,u+f,0),v.push(b+p,u+f,0),v.push(b+p,y+f,0),v.push(d+p,y+f,0),T.push(E,E+1,E+3,E+1,E+2,E+3),E+=4,R=0,P=0,I=l/i,M=_/n,D=[R,P,I,P,I,M,R,M],(t===je.Kj.ROTATE_ROW&&h%2==1||t===je.Kj.ROTATE_TILE&&(h+a)%2==1)&&(D=[1-R,1-P,1-I,1-P,1-I,1-M,1-R,1-M]),(t===je.Kj.FLIP_ROW&&h%2==1||t===je.Kj.FLIP_TILE&&(h+a)%2==1)&&(D=[1-R,P,1-I,P,1-I,M,1-R,M]),(t===je.Kj.FLIP_N_ROTATE_ROW&&h%2==1||t===je.Kj.FLIP_N_ROTATE_TILE&&(h+a)%2==1)&&(D=[R,1-P,I,1-P,I,1-M,R,1-M]),S=S.concat(D),x.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),A.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),e){const e=[];R=0,P=1-_/n,I=1,M=1,e[0]=[R,P,I,P,I,M,R,M],e[1]=[R,P,I,P,I,M,R,M],t!==je.Kj.ROTATE_TILE&&t!==je.Kj.ROTATE_ROW||(e[1]=[1-R,1-P,1-I,1-P,1-I,1-M,1-R,1-M]),t!==je.Kj.FLIP_TILE&&t!==je.Kj.FLIP_ROW||(e[1]=[1-R,P,1-I,P,1-I,M,1-R,M]),t!==je.Kj.FLIP_N_ROTATE_TILE&&t!==je.Kj.FLIP_N_ROTATE_ROW||(e[1]=[R,1-P,I,1-P,I,1-M,R,1-M]);for(let n=0;ne+P))),P+=x[e].length,i)for(let t=0;t<4;t++)S.push(i[e].r,i[e].g,i[e].b,i[e].a)}const I=new o.P(0,0,m),M=o.y3.RotationY(Math.PI);y=x[0].map((e=>o.P.TransformNormal(e,M).add(I))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[]),v=T[0].map((e=>o.P.TransformNormal(e,M))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[]),y=y.concat(x[1].map((e=>e.subtract(I))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[])),v=v.concat(T[1].map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[]));const D=new o.P(p,0,0),O=o.y3.RotationY(-Math.PI/2);y=y.concat(x[2].map((e=>o.P.TransformNormal(e,O).add(D))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[])),v=v.concat(T[2].map((e=>o.P.TransformNormal(e,O))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[]));const w=o.y3.RotationY(Math.PI/2);y=y.concat(x[3].map((e=>o.P.TransformNormal(e,w).subtract(D))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[])),v=v.concat(T[3].map((e=>o.P.TransformNormal(e,w))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[]));const F=new o.P(0,f,0),B=o.y3.RotationX(Math.PI/2);y=y.concat(x[4].map((e=>o.P.TransformNormal(e,B).add(F))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[])),v=v.concat(T[4].map((e=>o.P.TransformNormal(e,B))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[]));const N=o.y3.RotationX(-Math.PI/2);y=y.concat(x[5].map((e=>o.P.TransformNormal(e,N).subtract(F))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[])),v=v.concat(T[5].map((e=>o.P.TransformNormal(e,N))).map((e=>[e.x,e.y,e.z])).reduce(((e,t)=>e.concat(t)),[])),ci.x._ComputeSides(u,y,C,v,A);const L=new ci.x;if(L.indices=C,L.positions=y,L.normals=v,L.uvs=A,i){const e=u===ci.x.DOUBLESIDE?S.concat(S):S;L.colors=e}return L}function Th(e){const t=new Array,i=new Array,n=new Array,r=new Array,s=e.radius||2,a=e.tube||.5,l=e.radialSegments||32,c=e.tubularSegments||32,h=e.p||2,_=e.q||3,d=0===e.sideOrientation?0:e.sideOrientation||ci.x.DEFAULTSIDE,u=e=>{const t=Math.cos(e),i=Math.sin(e),n=_/h*e,r=Math.cos(n),a=s*(2+r)*.5*t,l=s*(2+r)*i*.5,c=s*Math.sin(n)*.5;return new o.P(a,l,c)};let p,f;for(p=0;p<=l;p++){const e=p%l/l*2*h*Math.PI,t=u(e),n=u(e+.01),s=n.subtract(t);let _=n.add(t);const d=o.P.Cross(s,_);for(_=o.P.Cross(d,s),d.normalize(),_.normalize(),f=0;fEh(e,{radius:t,tube:i,radialSegments:n,tubularSegments:r,p:s,q:o,sideOrientation:c,updatable:l},a);class Rh extends o.FM{constructor(e,t){super(e.x,e.y),this.index=t}}class Ph{constructor(){this.elements=new Array}add(e){const t=new Array;return e.forEach((e=>{const i=new Rh(e,this.elements.length);t.push(i),this.elements.push(i)})),t}computeBounds(){const e=new o.FM(this.elements[0].x,this.elements[0].y),t=new o.FM(this.elements[0].x,this.elements[0].y);return this.elements.forEach((i=>{i.xt.x&&(t.x=i.x),i.yt.y&&(t.y=i.y)})),{min:e,max:t,width:t.x-e.x,height:t.y-e.y}}}class Ih{constructor(e,t,i,n=earcut){let r;this._points=new Ph,this._outlinepoints=new Ph,this._holes=new Array,this._epoints=new Array,this._eholes=new Array,this.bjsEarcut=n,this._name=e,this._scene=i||m.l.LastCreatedScene,r=t instanceof D.ZZ?t.getPoints():t,this._addToepoint(r),this._points.add(r),this._outlinepoints.add(r),void 0===this.bjsEarcut&&u.Y.Warn("Earcut was not found, the polygon will not be built.")}_addToepoint(e){for(const t of e)this._epoints.push(t.x,t.y)}addHole(e){this._points.add(e);const t=new Ph;return t.add(e),this._holes.push(t),this._eholes.push(this._epoints.length/2),this._addToepoint(e),this}build(e=!1,t=0,i=2){const n=new je.Kj(this._name,this._scene),r=this.buildVertexData(t,i);return n.setVerticesData(le.o.PositionKind,r.positions,e),n.setVerticesData(le.o.NormalKind,r.normals,e),n.setVerticesData(le.o.UVKind,r.uvs,e),n.setIndices(r.indices),n}buildVertexData(e=0,t=2){const i=new ci.x,n=new Array,r=new Array,s=new Array,o=this._points.computeBounds();this._points.elements.forEach((e=>{n.push(0,1,0),r.push(e.x,0,e.y),s.push((e.x-o.min.x)/o.width,(e.y-o.min.y)/o.height)}));const a=new Array,l=this.bjsEarcut(this._epoints,this._eholes,2);for(let e=0;e0){const i=r.length/3;this._points.elements.forEach((t=>{n.push(0,-1,0),r.push(t.x,-e,t.y),s.push(1-(t.x-o.min.x)/o.width,1-(t.y-o.min.y)/o.height)}));const l=a.length;for(let e=0;e{this._addSide(r,n,s,a,o,i,e,!0,t)}))}return i.indices=a,i.positions=r,i.normals=n,i.uvs=s,i}_addSide(e,t,i,n,r,s,a,l,c){let h=e.length/3,_=0;for(let d=0;dc?S<$.kn-1?new o.P(u.x,0,u.y).subtract(new o.P(p.x,0,p.y)).normalize():b.add(g).normalize():v;const x=o.P.Dot(y,g);C=x>c?x<$.kn-1?new o.P(p.x,0,p.y).subtract(new o.P(u.x,0,u.y)).normalize():y.add(g).normalize():v,i.push(_/r.width,0),i.push(_/r.width,1),_+=g.length(),i.push(_/r.width,0),i.push(_/r.width,1),t.push(A.x,A.y,A.z),t.push(A.x,A.y,A.z),t.push(C.x,C.y,C.z),t.push(C.x,C.y,C.z),l?(n.push(h),n.push(h+2),n.push(h+1),n.push(h+1),n.push(h+2),n.push(h+3)):(n.push(h),n.push(h+1),n.push(h+2),n.push(h+1),n.push(h+3),n.push(h+2)),h+=4}}}function Mh(e,t,i,n,r,s,l){const c=i||new Array(3),h=n,_=[],d=l||!1;for(let e=0;e<3;e++)void 0===c[e]&&(c[e]=new o.Lt(0,0,1,1)),h&&void 0===h[e]&&(h[e]=new a.HE(1,1,1,1));const u=e.getVerticesData(le.o.PositionKind),p=e.getVerticesData(le.o.NormalKind),f=e.getVerticesData(le.o.UVKind),m=e.getIndices(),g=u.length/9;let b=0,y=0,v=0,A=0,C=0;const S=[0];if(d)for(let e=g;e1?1:t.arc:1,r=void 0===t.closed||t.closed,s=t.shape,a=t.radius||1,l=t.tessellation||64,c=t.clip||0,h=t.updatable,_=je.Kj._GetDefaultSideOrientation(t.sideOrientation),d=t.cap||je.Kj.NO_CAP,u=2*Math.PI,p=new Array,f=t.invertUV||!1;let m=0,g=0;const b=u/l*n;let y,v;for(m=0;m<=l-c;m++){for(v=[],d!=je.Kj.CAP_START&&d!=je.Kj.CAP_ALL||(v.push(new o.P(0,s[0].y,0)),v.push(new o.P(Math.cos(m*b)*s[0].x*a,s[0].y,Math.sin(m*b)*s[0].x*a))),g=0;g1)?1:t.arc||1;const u=(e,t,i,n,r,s,a,l)=>{const c=t.getTangents(),h=t.getNormals(),_=t.getDistances(),d=2*Math.PI/r*l,u=s||(()=>n);let p,f,m,g;const b=o.jp.Matrix[0];let y=a===je.Kj.NO_CAP||a===je.Kj.CAP_END?0:2;for(let t=0;t{const n=Array();for(let r=0;r3?0:c,f=u(n,p,new Array,s,a,l,c,t.arc);const m=bn(e,{pathArray:f,closePath:!0,closeArray:!1,updatable:_,sideOrientation:d,invertUV:h,frontUVs:t.frontUVs,backUVs:t.backUVs},i);return m._creationDataStorage.pathArray=f,m._creationDataStorage.path3D=p,m._creationDataStorage.tessellation=a,m._creationDataStorage.cap=c,m._creationDataStorage.arc=t.arc,m._creationDataStorage.radius=s,m}ci.x.CreatePolygon=Mh,je.Kj.CreatePolygon=(e,t,i,n,r,s,o=earcut)=>Dh(e,{shape:t,holes:n,updatable:r,sideOrientation:s},i,o),je.Kj.ExtrudePolygon=(e,t,i,n,r,s,o,a=earcut)=>Oh(e,{shape:t,holes:r,depth:i,updatable:s,sideOrientation:o},n,a),je.Kj.CreateLathe=(e,t,i,n,r,s,o)=>wh(e,{shape:t,radius:i,tessellation:n,sideOrientation:o,updatable:s},r),je.Kj.CreateTube=(e,t,i,n,r,s,o,a,l,c)=>Fh(e,{path:t,radius:i,tessellation:n,radiusFunction:r,arc:1,cap:s,updatable:a,sideOrientation:l,instance:c},o);var Bh=i("../../../node_modules/@babylonjs/core/Meshes/Builders/icoSphereBuilder.js"),Nh=i("../../../node_modules/@babylonjs/core/Maths/math.vertexFormat.js");function Lh(e,t,i){const n=t.getIndices(),r=t.getVerticesData(le.o.PositionKind),s=t.getVerticesData(le.o.NormalKind),a=t.getVerticesData(le.o.UVKind),l=i.position||o.P.Zero();let c=i.normal||o.P.Up();const h=i.size||o.P.One(),_=i.angle||0;if(!c){const e=new o.P(0,0,1),i=t.getScene().activeCamera,n=o.P.TransformCoordinates(e,i.getWorldMatrix());c=i.globalPosition.subtract(n)}const d=-Math.atan2(c.z,c.x)-Math.PI/2,u=Math.sqrt(c.x*c.x+c.z*c.z),p=Math.atan2(c.y,u),f=o.y3.RotationYawPitchRoll(d,p,_).multiply(o.y3.Translation(l.x,l.y,l.z)),m=o.y3.Invert(f),g=t.getWorldMatrix().multiply(m),b=new ci.x;b.indices=[],b.positions=[],b.normals=[],b.uvs=[];let y=0;const v=e=>{const t=new Nh.e;if(!n||!r||!s)return t;const l=n[e];if(t.position=new o.P(r[3*l],r[3*l+1],r[3*l+2]),t.position=o.P.TransformCoordinates(t.position,g),t.normal=new o.P(s[3*l],s[3*l+1],s[3*l+2]),t.normal=o.P.TransformNormal(t.normal,g),i.captureUVS&&a){const e=a[2*l+1];t.uv=new o.FM(a[2*l],hi.e.UseOpenGLOrientationForUV?1-e:e)}return t},A=(e,t)=>{if(0===e.length)return e;const i=.5*Math.abs(o.P.Dot(h,t)),n=(e,n)=>{const r=o.P.GetClipFactor(e.position,n.position,t,i);return new Nh.e(o.P.Lerp(e.position,n.position,r),o.P.Lerp(e.normal,n.normal,r))},r=new Array;for(let s=0;s0,u=o.P.Dot(e[s+1].position,t)-i>0,p=o.P.Dot(e[s+2].position,t)-i>0;switch(a=(d?1:0)+(u?1:0)+(p?1:0),a){case 0:r.push(e[s]),r.push(e[s+1]),r.push(e[s+2]);break;case 1:if(d&&(l=e[s+1],c=e[s+2],h=n(e[s],l),_=n(e[s],c)),u){l=e[s],c=e[s+2],h=n(e[s+1],l),_=n(e[s+1],c),r.push(h),r.push(c.clone()),r.push(l.clone()),r.push(c.clone()),r.push(h.clone()),r.push(_);break}p&&(l=e[s],c=e[s+1],h=n(e[s+2],l),_=n(e[s+2],c)),l&&c&&h&&_&&(r.push(l.clone()),r.push(c.clone()),r.push(h),r.push(_),r.push(h.clone()),r.push(c.clone()));break;case 2:d||(l=e[s].clone(),c=n(l,e[s+1]),h=n(l,e[s+2]),r.push(l),r.push(c),r.push(h)),u||(l=e[s+1].clone(),c=n(l,e[s+2]),h=n(l,e[s]),r.push(l),r.push(c),r.push(h)),p||(l=e[s+2].clone(),c=n(l,e[s]),h=n(l,e[s+1]),r.push(l),r.push(c),r.push(h))}}return r};for(let e=0;eLh(e,t,{position:i,normal:n,size:r,angle:s});class kh{constructor(e=0,t=0){this.x=e,this.y=t,e!==Math.floor(e)&&(Math.floor(e),u.Y.Warn("x is not an integer, floor(x) used")),t!==Math.floor(t)&&(Math.floor(t),u.Y.Warn("y is not an integer, floor(y) used"))}clone(){return new kh(this.x,this.y)}rotate60About(e){const t=this.x;return this.x=e.x+e.y-this.y,this.y=t+this.y-e.x,this}rotateNeg60About(e){const t=this.x;return this.x=t+this.y-e.y,this.y=e.x+e.y-t,this}rotate120(e,t){e!==Math.floor(e)&&(Math.floor(e),u.Y.Warn("m not an integer only floor(m) used")),t!==Math.floor(t)&&(Math.floor(t),u.Y.Warn("n not an integer only floor(n) used"));const i=this.x;return this.x=e-i-this.y,this.y=t+i,this}rotateNeg120(e,t){e!==Math.floor(e)&&(Math.floor(e),u.Y.Warn("m is not an integer, floor(m) used")),t!==Math.floor(t)&&(Math.floor(t),u.Y.Warn("n is not an integer, floor(n) used"));const i=this.x;return this.x=this.y-t,this.y=e+t-i-this.y,this}toCartesianOrigin(e,t){const i=o.P.Zero();return i.x=e.x+2*this.x*t+this.y*t,i.y=e.y+Math.sqrt(3)*this.y*t,i}static Zero(){return new kh(0,0)}}class Vh{constructor(){this.cartesian=[],this.vertices=[],this.max=[],this.min=[],this.closestTo=[],this.innerFacets=[],this.isoVecsABOB=[],this.isoVecsOBOA=[],this.isoVecsBAOA=[],this.vertexTypes=[],this.IDATA=new Uh("icosahedron","Regular",[[0,$.Q_,-1],[-$.Q_,1,0],[-1,0,-$.Q_],[1,0,-$.Q_],[$.Q_,1,0],[0,$.Q_,1],[-1,0,$.Q_],[-$.Q_,-1,0],[0,-$.Q_,-1],[$.Q_,-1,0],[1,0,$.Q_],[0,-$.Q_,1]],[[0,2,1],[0,3,2],[0,4,3],[0,5,4],[0,1,5],[7,6,1],[8,7,2],[9,8,3],[10,9,4],[6,10,5],[2,7,1],[3,8,2],[4,9,3],[5,10,4],[1,6,5],[11,6,7],[11,7,8],[11,8,9],[11,9,10],[11,10,6]])}setIndices(){let e=12;const t={},i=this.m,n=this.n;let r,s,o,a,l,c=i,h=1,_=0;0!==n&&(c=ve.R.HCF(i,n)),h=i/c,_=n/c;const d=kh.Zero(),u=new kh(i,n),p=new kh(-n,i+n),f=kh.Zero(),m=kh.Zero(),g=kh.Zero();let b,y,v,A,C=[];const S=[],x=this.vertByDist,T=(i,n,r,s)=>{b=i+"|"+r,y=n+"|"+s,b in t||y in t?b in t&&!(y in t)?t[y]=t[b]:y in t&&!(b in t)&&(t[b]=t[y]):(t[b]=e,t[y]=e,e++),x[r][0]>2?S[t[b]]=[-x[r][0],x[r][1],t[b]]:S[t[b]]=[C[x[r][0]],x[r][1],t[b]]};this.IDATA.edgematch=[[1,"B"],[2,"B"],[3,"B"],[4,"B"],[0,"B"],[10,"O",14,"A"],[11,"O",10,"A"],[12,"O",11,"A"],[13,"O",12,"A"],[14,"O",13,"A"],[0,"O"],[1,"O"],[2,"O"],[3,"O"],[4,"O"],[19,"B",5,"A"],[15,"B",6,"A"],[16,"B",7,"A"],[17,"B",8,"A"],[18,"B",9,"A"]];for(let y=0;y<20;y++){if(C=this.IDATA.face[y],o=C[2],a=C[1],l=C[0],v=d.x+"|"+d.y,b=y+"|"+v,b in t||(t[b]=o,S[o]=[C[x[v][0]],x[v][1]]),v=u.x+"|"+u.y,b=y+"|"+v,b in t||(t[b]=a,S[a]=[C[x[v][0]],x[v][1]]),v=p.x+"|"+p.y,b=y+"|"+v,b in t||(t[b]=l,S[l]=[C[x[v][0]],x[v][1]]),r=this.IDATA.edgematch[y][0],s=this.IDATA.edgematch[y][1],"B"===s)for(let e=1;e2?S[t[b]]=[-x[v][0],x[v][1],t[b]]:S[t[b]]=[C[x[v][0]],x[v][1],t[b]])}this.closestTo=S,this.vecToidx=t}calcCoeffs(){const e=this.m,t=this.n,i=Math.sqrt(3)/3,n=e*e+t*t+e*t;this.coau=(e+t)/n,this.cobu=-t/n,this.coav=-i*(e-t)/n,this.cobv=i*(2*e+t)/n}createInnerFacets(){const e=this.m,t=this.n;for(let i=0;i0&&e0){const n=ve.R.HCF(e,t),r=e/n,s=t/n;for(let o=1;oe.x-t.x)),i.sort(((e,t)=>e.y-t.y));const o=new Array(e+t+1),a=new Array(e+t+1);for(let e=0;e{const r=i.clone();return"A"===n&&r.rotateNeg120(e,t),"B"===n&&r.rotate120(e,t),r.x<0?r.y:r.x+r.y},d=[],u=[],p=[],f=[],m={},g=[];let b=-1,y=-1;for(let e=0;ee[2]-t[2])),g.sort(((e,t)=>e[3]-t[3])),g.sort(((e,t)=>e[1]-t[1])),g.sort(((e,t)=>e[0]-t[0]));for(let e=0;et.vecToidx[e+i])))}mapABOBtoDATA(e,t){const i=t.IDATA.edgematch[e][0];for(let n=0;n-1?i[e][1]>0&&t[i[e][0]].push([e,i[e][1]]):t[12].push([e,i[e][0]]);const n=[];for(let e=0;e<12;e++)n[e]=e;let r=12;for(let e=0;e<12;e++){t[e].sort(((e,t)=>e[1]-t[1]));for(let i=0;ie[3]-t[3]));for(let e=0;e0;)r=t[a],this.face[r].indexOf(o)>-1?(s=(this.face[r].indexOf(o)+1)%3,o=this.face[r][s],i.push(o),n.push(r),t.splice(a,1),a=0):a++;return this.adjacentFaces.push(i),n}toGoldbergPolyhedronData(){const e=new Uh("GeoDual","Goldberg",[],[]);e.name="GD dual";const t=this.vertex.length,i=new Array(t);for(let e=0;e{n=0,r=0,s=0,o=this.face[t];for(let e=0;e<3;e++)a=this.vertex[o[e]],n+=a[0],r+=a[1],s+=a[2];e.vertex[t]=[n/3,r/3,s/3]}));return e}static BuildGeodesicData(e){const t=new Gh("Geodesic-m-n","Geodesic",[[0,$.Q_,-1],[-$.Q_,1,0],[-1,0,-$.Q_],[1,0,-$.Q_],[$.Q_,1,0],[0,$.Q_,1],[-1,0,$.Q_],[-$.Q_,-1,0],[0,-$.Q_,-1],[$.Q_,-1,0],[1,0,$.Q_],[0,-$.Q_,1]],[]);e.setIndices(),e.calcCoeffs(),e.createInnerFacets(),e.edgeVecsABOB(),e.mapABOBtoOBOA(),e.mapABOBtoBAOA();for(let i=0;ic){const e=h;h=c,c=e,u.Y.Warn("n > m therefore m and n swapped")}const _=new Vh;_.build(c,h);const d=Gh.BuildGeodesicData(_),p=d.toGoldbergPolyhedronData(),f=new Ch(e,i);t.sideOrientation=je.Kj._GetDefaultSideOrientation(t.sideOrientation),f._originalBuilderSideOrientation=t.sideOrientation;const m=function(e,t){const i=e.size,n=e.sizeX||i||1,r=e.sizeY||i||1,s=e.sizeZ||i||1,a=0===e.sideOrientation?0:e.sideOrientation||ci.x.DEFAULTSIDE,l=new Array,c=new Array,h=new Array,_=new Array;let d=1/0,u=-1/0,p=1/0,f=-1/0;for(let e=0;en){const e=r;r=n,n=e,u.Y.Warn("n > m therefore m and n swapped")}const s=new Vh;return s.build(n,r),Ks(e,{custom:Gh.BuildGeodesicData(s),size:t.size,sizeX:t.sizeX,sizeY:t.sizeY,sizeZ:t.sizeZ,faceUV:t.faceUV,faceColors:t.faceColors,flat:t.flat,updatable:t.updatable,sideOrientation:t.sideOrientation,frontUVs:t.frontUVs,backUVs:t.backUVs},i)},CreateGoldberg:jh,CreateDecal:Lh,CreateCapsule:rn};class zh{constructor(){this.running=!1,this._simplificationArray=[]}addTask(e){this._simplificationArray.push(e)}executeNext(){const e=this._simplificationArray.pop();e?(this.running=!0,this.runSimplification(e)):this.running=!1}runSimplification(e){if(e.parallelProcessing)e.settings.forEach((t=>{this._getSimplifier(e).simplify(t,(i=>{void 0!==t.distance&&e.mesh.addLODLevel(t.distance,i),i.isVisible=!0,t.quality===e.settings[e.settings.length-1].quality&&e.successCallback&&e.successCallback(),this.executeNext()}))}));else{const t=this._getSimplifier(e),i=(i,n)=>{t.simplify(i,(t=>{void 0!==i.distance&&e.mesh.addLODLevel(i.distance,t),t.isVisible=!0,n()}))};V.$g.Run(e.settings.length,(t=>{i(e.settings[t.index],(()=>{t.executeNext()}))}),(()=>{e.successCallback&&e.successCallback(),this.executeNext()}))}}_getSimplifier(e){return e.simplificationType,Hh.QUADRATIC,new Kh(e.mesh)}}var Hh;!function(e){e[e.QUADRATIC=0]="QUADRATIC"}(Hh||(Hh={}));class Xh{constructor(e){this._vertices=e,this.error=new Array(4),this.deleted=!1,this.isDirty=!1,this.deletePending=!1,this.borderFactor=0}}class Yh{constructor(e,t){this.position=e,this.id=t,this.isBorder=!0,this.q=new Qh,this.triangleCount=0,this.triangleStart=0,this.originalOffsets=[]}updatePosition(e){this.position.copyFrom(e)}}class Qh{constructor(e){this.data=new Array(10);for(let t=0;t<10;++t)e&&e[t]?this.data[t]=e[t]:this.data[t]=0}det(e,t,i,n,r,s,o,a,l){return this.data[e]*this.data[r]*this.data[l]+this.data[i]*this.data[n]*this.data[a]+this.data[t]*this.data[s]*this.data[o]-this.data[i]*this.data[r]*this.data[o]-this.data[e]*this.data[s]*this.data[a]-this.data[t]*this.data[n]*this.data[l]}addInPlace(e){for(let t=0;t<10;++t)this.data[t]+=e.data[t]}addArrayInPlace(e){for(let t=0;t<10;++t)this.data[t]+=e[t]}add(e){const t=new Qh;for(let i=0;i<10;++i)t.data[i]=this.data[i]+e.data[i];return t}static FromData(e,t,i,n){return new Qh(Qh.DataFromNumbers(e,t,i,n))}static DataFromNumbers(e,t,i,n){return[e*e,e*t,e*i,e*n,t*t,t*i,t*n,i*i,i*n,n*n]}}class qh{constructor(e,t){this.vertexId=e,this.triangleId=t}}class Kh{constructor(e){this._mesh=e,this.syncIterations=5e3,this.aggressiveness=7,this.decimationIterations=100,this.boundingBoxEpsilon=$.kn}simplify(e,t){this._initDecimatedMesh(),V.$g.Run(this._mesh.subMeshes.length,(t=>{this._initWithMesh(t.index,(()=>{this._runDecimation(e,t.index,(()=>{t.executeNext()}))}),e.optimizeMesh)}),(()=>{setTimeout((()=>{t(this._reconstructedMesh)}),0)}))}_runDecimation(e,t,i){const n=~~(this._triangles.length*e.quality);let r=0;const s=this._triangles.length,a=(e,t)=>{setTimeout((()=>{e%5==0&&this._updateMesh(0===e);for(let e=0;e{const t=~~((this._triangles.length/2+e)%this._triangles.length),n=this._triangles[t];if(n&&!(n.error[3]>i||n.deleted||n.isDirty))for(let e=0;e<3;++e)if(n.error[e]{-1===h.indexOf(e)&&(e.deletePending=!0,h.push(e))})),h.length%2!=0)continue;s.q=a.q.add(s.q),s.updatePosition(l);const _=this._references.length;r=this._updateTriangles(s,s,t,r),r=this._updateTriangles(s,a,i,r);const d=this._references.length-_;if(d<=s.triangleCount){if(d)for(let e=0;es-r<=n))}),0)};V.$g.Run(this.decimationIterations,(e=>{s-r<=n?e.breakLoop():a(e.index,(()=>{e.executeNext()}))}),(()=>{setTimeout((()=>{this._reconstructMesh(t),i()}),0)}))}_initWithMesh(e,t,i){this._vertices=[],this._triangles=[];const n=this._mesh.getVerticesData(le.o.PositionKind),r=this._mesh.getIndices(),s=this._mesh.subMeshes[e],a=e=>{if(i)for(let t=0;t>0,(e=>{if(!n)return;const t=e+s.verticesStart,i=o.P.FromArray(n,3*t),r=a(i)||new Yh(i,this._vertices.length);r.originalOffsets.push(t),r.id===this._vertices.length&&this._vertices.push(r),l.push(r.id)}),(()=>{V.$g.SyncAsyncForLoop(s.indexCount/3,this.syncIterations,(e=>{if(!r)return;const t=3*(s.indexStart/3+e),i=r[t+0],n=r[t+1],o=r[t+2],a=this._vertices[l[i-s.verticesStart]],c=this._vertices[l[n-s.verticesStart]],h=this._vertices[l[o-s.verticesStart]],_=new Xh([a,c,h]);_.originalOffset=t,this._triangles.push(_)}),(()=>{this._init(t)}))}))}_init(e){V.$g.SyncAsyncForLoop(this._triangles.length,this.syncIterations,(e=>{const t=this._triangles[e];t.normal=o.P.Cross(t._vertices[1].position.subtract(t._vertices[0].position),t._vertices[2].position.subtract(t._vertices[0].position)).normalize();for(let e=0;e<3;e++)t._vertices[e].q.addArrayInPlace(Qh.DataFromNumbers(t.normal.x,t.normal.y,t.normal.z,-o.P.Dot(t.normal,t._vertices[0].position)))}),(()=>{V.$g.SyncAsyncForLoop(this._triangles.length,this.syncIterations,(e=>{const t=this._triangles[e];for(let e=0;e<3;++e)t.error[e]=this._calculateError(t._vertices[e],t._vertices[(e+1)%3]);t.error[3]=Math.min(t.error[0],t.error[1],t.error[2])}),(()=>{e()}))}))}_reconstructMesh(e){const t=[];let i,n,r;for(i=0;i{s.push(e.position.x),s.push(e.position.y),s.push(e.position.z),c&&c.length&&(o.push(c[3*t]),o.push(c[3*t+1]),o.push(c[3*t+2])),h&&h.length&&(a.push(h[2*t]),a.push(h[2*t+1])),_&&_.length&&(l.push(_[4*t]),l.push(_[4*t+1]),l.push(_[4*t+2]),l.push(_[4*t+3])),++d}))}const u=this._reconstructedMesh.getTotalIndices(),p=this._reconstructedMesh.getTotalVertices(),f=this._reconstructedMesh.subMeshes;this._reconstructedMesh.subMeshes=[];const m=this._reconstructedMesh.getIndices(),g=this._mesh.getIndices();for(i=0;i{const t=g[n.originalOffset+e];let i=n._vertices[e].originalOffsets.indexOf(t);i<0&&(i=0),m.push(n._vertices[e].id+i+p)}));this._reconstructedMesh.setIndices(m),this._reconstructedMesh.setVerticesData(le.o.PositionKind,s),o.length>0&&this._reconstructedMesh.setVerticesData(le.o.NormalKind,o),a.length>0&&this._reconstructedMesh.setVerticesData(le.o.UVKind,a),l.length>0&&this._reconstructedMesh.setVerticesData(le.o.ColorKind,l);const b=this._mesh.subMeshes[e];e>0&&(this._reconstructedMesh.subMeshes=[],f.forEach((e=>{Jo.P.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())})),Jo.P.AddToMesh(b.materialIndex,p,d,u,3*t.length,this._reconstructedMesh))}_initDecimatedMesh(){this._reconstructedMesh=new je.Kj(this._mesh.name+"Decimated",this._mesh.getScene()),this._reconstructedMesh.material=this._mesh.material,this._reconstructedMesh.parent=this._mesh.parent,this._reconstructedMesh.isVisible=!1,this._reconstructedMesh.renderingGroupId=this._mesh.renderingGroupId}_isFlipped(e,t,i,n,r){for(let s=0;s.999)return!0;const u=o.P.Cross(_,d).normalize();if(n[s]=!1,o.P.Dot(u,a.normal)<.2)return!0}return!1}_updateTriangles(e,t,i,n){let r=n;for(let n=0;nnew $h(e,t,i);class $h{constructor(e,t,i=!1){this._idbFactory="undefined"!=typeof indexedDB?indexedDB:void 0,this._currentSceneUrl=$h._ReturnFullUrlLocation(e),this._db=null,this._enableSceneOffline=!1,this._enableTexturesOffline=!1,this._manifestVersionFound=0,this._mustUpdateRessources=!1,this._hasReachedQuota=!1,$h.IDBStorageEnabled?i?(this._enableSceneOffline=!0,this._enableTexturesOffline=!0,this._manifestVersionFound=1,V.w1.SetImmediate((()=>{t(!0)}))):this._checkManifestFile(t):t(!0)}get enableSceneOffline(){return this._enableSceneOffline}get enableTexturesOffline(){return this._enableTexturesOffline}_checkManifestFile(e){const t=()=>{this._enableSceneOffline=!1,this._enableTexturesOffline=!1,e(!1)},i=()=>{try{if("function"==typeof URL&&0===this._currentSceneUrl.indexOf("http")){const e=new URL(this._currentSceneUrl);return e.pathname+=".manifest",e.toString()}}catch(e){}return`${this._currentSceneUrl}.manifest`};let n=!1,r=i();const s=new Ll.g;navigator.onLine&&(n=!0,r=r+(null==r.match(/\?/)?"?":"&")+Date.now()),s.open("GET",r),s.addEventListener("load",(()=>{if(200===s.status||$h._ValidateXHRData(s,1))try{const t=JSON.parse(s.response);this._enableSceneOffline=t.enableSceneOffline,this._enableTexturesOffline=t.enableTexturesOffline&&$h._IsUASupportingBlobStorage,t.version&&!isNaN(parseInt(t.version))&&(this._manifestVersionFound=t.version),e(!0)}catch(e){t()}else t()}),!1),s.addEventListener("error",(()=>{if(n){n=!1;const e=i();s.open("GET",e),s.send()}else t()}),!1);try{s.send()}catch(t){u.Y.Error("Error on XHR send request."),e(!1)}}open(e,t){const i=()=>{this._isSupported=!1,t&&t()};if(this._idbFactory&&(this._enableSceneOffline||this._enableTexturesOffline))if(this._db)e&&e();else{this._hasReachedQuota=!1,this._isSupported=!0;const t=this._idbFactory.open("babylonjs",1);t.onerror=()=>{i()},t.onblocked=()=>{u.Y.Error("IDB request blocked. Please reload the page."),i()},t.onsuccess=()=>{this._db=t.result,e()},t.onupgradeneeded=e=>{if(this._db=e.target.result,this._db)try{this._db.createObjectStore("scenes",{keyPath:"sceneUrl"}),this._db.createObjectStore("versions",{keyPath:"sceneUrl"}),this._db.createObjectStore("textures",{keyPath:"textureUrl"})}catch(e){u.Y.Error("Error while creating object stores. Exception: "+e.message),i()}}}else this._isSupported=!1,t&&t()}loadImage(e,t){const i=$h._ReturnFullUrlLocation(e),n=()=>{this._hasReachedQuota||null===this._db?t.src=e:this._saveImageIntoDBAsync(i,t)};this._mustUpdateRessources?n():this._loadImageFromDBAsync(i,t,n)}_loadImageFromDBAsync(e,t,i){if(this._isSupported&&null!==this._db){let n;const r=this._db.transaction(["textures"]);r.onabort=()=>{t.src=e},r.oncomplete=()=>{let r;n&&"function"==typeof URL?(r=URL.createObjectURL(n.data),t.onerror=()=>{u.Y.Error("Error loading image from blob URL: "+r+" switching back to web url: "+e),t.src=e},t.src=r):i()};const s=r.objectStore("textures").get(e);s.onsuccess=e=>{n=e.target.result},s.onerror=()=>{u.Y.Error("Error loading texture "+e+" from DB."),t.src=e}}else u.Y.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),t.src=e}_saveImageIntoDBAsync(e,t){let i;if(this._isSupported){const n=()=>{let e;if(i&&"function"==typeof URL)try{e=URL.createObjectURL(i)}catch(t){e=URL.createObjectURL(i)}e&&(t.src=e)};if($h._IsUASupportingBlobStorage){const r=new Ll.g;r.open("GET",e),r.responseType="blob",r.addEventListener("load",(()=>{if(200===r.status&&this._db){i=r.response;const s=this._db.transaction(["textures"],"readwrite");s.onabort=e=>{try{const t=e.target.error;t&&"QuotaExceededError"===t.name&&(this._hasReachedQuota=!0)}catch(e){}n()},s.oncomplete=()=>{n()};const o={textureUrl:e,data:i};try{const e=s.objectStore("textures").put(o);e.onsuccess=()=>{},e.onerror=()=>{n()}}catch(i){25===i.code&&($h._IsUASupportingBlobStorage=!1,this._enableTexturesOffline=!1),t.src=e}}else t.src=e}),!1),r.addEventListener("error",(()=>{u.Y.Error("Error in XHR request in BABYLON.Database."),t.src=e}),!1),r.send()}else t.src=e}else u.Y.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),t.src=e}_checkVersionFromDB(e,t){this._loadVersionFromDBAsync(e,t,(()=>{this._saveVersionIntoDBAsync(e,t)}))}_loadVersionFromDBAsync(e,t,i){if(this._isSupported&&this._db){let n;try{const r=this._db.transaction(["versions"]);r.oncomplete=()=>{n?this._manifestVersionFound!==n.data?(this._mustUpdateRessources=!0,i()):t(n.data):(this._mustUpdateRessources=!0,i())},r.onabort=()=>{t(-1)};const s=r.objectStore("versions").get(e);s.onsuccess=e=>{n=e.target.result},s.onerror=()=>{u.Y.Error("Error loading version for scene "+e+" from DB."),t(-1)}}catch(e){u.Y.Error("Error while accessing 'versions' object store (READ OP). Exception: "+e.message),t(-1)}}else u.Y.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),t(-1)}_saveVersionIntoDBAsync(e,t){if(this._isSupported&&!this._hasReachedQuota&&this._db)try{const i=this._db.transaction(["versions"],"readwrite");i.onabort=e=>{try{const t=e.target.error;t&&"QuotaExceededError"===t.name&&(this._hasReachedQuota=!0)}catch(e){}t(-1)},i.oncomplete=()=>{t(this._manifestVersionFound)};const n={sceneUrl:e,data:this._manifestVersionFound},r=i.objectStore("versions").put(n);r.onsuccess=()=>{},r.onerror=()=>{u.Y.Error("Error in DB add version request in BABYLON.Database.")}}catch(e){u.Y.Error("Error while accessing 'versions' object store (WRITE OP). Exception: "+e.message),t(-1)}else t(-1)}loadFile(e,t,i,n,r){const s=$h._ReturnFullUrlLocation(e),o=()=>{this._saveFileAsync(s,t,i,r,n)};this._checkVersionFromDB(s,(e=>{-1!==e?this._mustUpdateRessources?this._saveFileAsync(s,t,i,r,n):this._loadFileAsync(s,t,o):n&&n()}))}_loadFileAsync(e,t,i){if(this._isSupported&&this._db){let n,r;n=-1!==e.indexOf(".babylon")?"scenes":"textures";const s=this._db.transaction([n]);s.oncomplete=()=>{r?t(r.data):i()},s.onabort=()=>{i()};const o=s.objectStore(n).get(e);o.onsuccess=e=>{r=e.target.result},o.onerror=()=>{u.Y.Error("Error loading file "+e+" from DB."),i()}}else u.Y.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),t()}_saveFileAsync(e,t,i,n,r){if(this._isSupported){let s;s=-1!==e.indexOf(".babylon")?"scenes":"textures";const o=new Ll.g;let a;o.open("GET",e+(null==e.match(/\?/)?"?":"&")+Date.now()),n&&(o.responseType="arraybuffer"),i&&(o.onprogress=i),o.addEventListener("load",(()=>{if(200===o.status||o.status<400&&$h._ValidateXHRData(o,n?6:1))if(a=n?o.response:o.responseText,!this._hasReachedQuota&&this._db){const i=this._db.transaction([s],"readwrite");let n;i.onabort=e=>{try{const t=e.target.error;t&&"QuotaExceededError"===t.name&&(this._hasReachedQuota=!0)}catch(e){}t(a)},i.oncomplete=()=>{t(a)},n="scenes"===s?{sceneUrl:e,data:a,version:this._manifestVersionFound}:{textureUrl:e,data:a};try{const e=i.objectStore(s).put(n);e.onsuccess=()=>{},e.onerror=()=>{u.Y.Error("Error in DB add file request in BABYLON.Database.")}}catch(e){t(a)}}else t(a);else o.status>=400&&r?r(o):t()}),!1),o.addEventListener("error",(()=>{u.Y.Error("error on XHR request."),r&&r()}),!1),o.send()}else u.Y.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),r&&r()}static _ValidateXHRData(e,t=7){try{if(1&t){if(e.responseText&&e.responseText.length>0)return!0;if(1===t)return!1}if(2&t){const i=vl(e.response);if(i.width&&i.height&&i.width>0&&i.height>0)return!0;if(2===t)return!1}if(4&t){const t=new Uint8Array(e.response,0,3);return 68===t[0]&&68===t[1]&&83===t[2]}}catch(e){}return!1}}$h._IsUASupportingBlobStorage=!0,$h.IDBStorageEnabled=!1,$h._ParseURL=e=>{document.createElement("a").href=e;const t=e.substring(0,e.lastIndexOf("#")),i=e.substring(t.lastIndexOf("/")+1,e.length);return e.substring(0,e.indexOf(i,0))},$h._ReturnFullUrlLocation=e=>-1===e.indexOf("http:/")&&-1===e.indexOf("https:/")&&"undefined"!=typeof window?$h._ParseURL(window.location.href)+e:e;var Jh=i("../../../node_modules/@babylonjs/core/Particles/baseParticleSystem.js"),e_=i("../../../node_modules/@babylonjs/core/Particles/EmitterTypes/index.js"),t_=i("../../../node_modules/@babylonjs/core/Particles/EmitterTypes/customParticleEmitter.js");class i_{constructor(e){this._isUbo(e)?(this.setMatrix3x3=e.updateMatrix3x3.bind(e),this.setMatrix2x2=e.updateMatrix2x2.bind(e),this.setFloat=e.updateFloat.bind(e),this.setFloat2=e.updateFloat2.bind(e),this.setFloat3=e.updateFloat3.bind(e),this.setFloat4=e.updateFloat4.bind(e),this.setFloatArray=e.updateFloatArray.bind(e),this.setArray=e.updateArray.bind(e),this.setIntArray=e.updateIntArray.bind(e),this.setMatrix=e.updateMatrix.bind(e),this.setMatrices=e.updateMatrices.bind(e),this.setVector3=e.updateVector3.bind(e),this.setVector4=e.updateVector4.bind(e),this.setColor3=e.updateColor3.bind(e),this.setColor4=e.updateColor4.bind(e),this.setDirectColor4=e.updateDirectColor4.bind(e),this.setInt=e.updateInt.bind(e),this.setInt2=e.updateInt2.bind(e),this.setInt3=e.updateInt3.bind(e),this.setInt4=e.updateInt4.bind(e)):(this.setMatrix3x3=e.setMatrix3x3.bind(e),this.setMatrix2x2=e.setMatrix2x2.bind(e),this.setFloat=e.setFloat.bind(e),this.setFloat2=e.setFloat2.bind(e),this.setFloat3=e.setFloat3.bind(e),this.setFloat4=e.setFloat4.bind(e),this.setFloatArray=e.setFloatArray.bind(e),this.setArray=e.setArray.bind(e),this.setIntArray=e.setIntArray.bind(e),this.setMatrix=e.setMatrix.bind(e),this.setMatrices=e.setMatrices.bind(e),this.setVector3=e.setVector3.bind(e),this.setVector4=e.setVector4.bind(e),this.setColor3=e.setColor3.bind(e),this.setColor4=e.setColor4.bind(e),this.setDirectColor4=e.setDirectColor4.bind(e),this.setInt=e.setInt.bind(e),this.setInt2=e.setInt2.bind(e),this.setInt3=e.setInt3.bind(e),this.setInt4=e.setInt4.bind(e))}_isUbo(e){return void 0!==e.addUniform}}dt.v.ShadersStore.gpuUpdateParticlesPixelShader="#version 300 es\nvoid main() {\ndiscard;\n}\n";dt.v.ShadersStore.gpuUpdateParticlesVertexShader="#version 300 es\n#define PI 3.14159\nuniform float currentCount;\nuniform float timeDelta;\nuniform float stopFactor;\n#ifndef LOCAL\nuniform mat4 emitterWM;\n#endif\nuniform vec2 lifeTime;\nuniform vec2 emitPower;\nuniform vec2 sizeRange;\nuniform vec4 scaleRange;\n#ifndef COLORGRADIENTS\nuniform vec4 color1;\nuniform vec4 color2;\n#endif\nuniform vec3 gravity;\nuniform sampler2D randomSampler;\nuniform sampler2D randomSampler2;\nuniform vec4 angleRange;\n#ifdef BOXEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\nuniform vec3 minEmitBox;\nuniform vec3 maxEmitBox;\n#endif\n#ifdef POINTEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#endif\n#ifdef HEMISPHERICEMITTER\nuniform float radius;\nuniform float radiusRange;\nuniform float directionRandomizer;\n#endif\n#ifdef SPHEREEMITTER\nuniform float radius;\nuniform float radiusRange;\n#ifdef DIRECTEDSPHEREEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CYLINDEREMITTER\nuniform float radius;\nuniform float height;\nuniform float radiusRange;\n#ifdef DIRECTEDCYLINDEREMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CONEEMITTER\nuniform vec2 radius;\nuniform float coneAngle;\nuniform vec2 height;\nuniform float directionRandomizer;\n#endif\nin vec3 position;\n#ifdef CUSTOMEMITTER\nin vec3 initialPosition;\n#endif\nin float age;\nin float life;\nin vec4 seed;\nin vec3 size;\n#ifndef COLORGRADIENTS\nin vec4 color;\n#endif\nin vec3 direction;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nin float angle;\n#else\nin vec2 angle;\n#endif\n#ifdef ANIMATESHEET\nin float cellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nin float cellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nin vec3 noiseCoordinates1;\nin vec3 noiseCoordinates2;\n#endif\nout vec3 outPosition;\n#ifdef CUSTOMEMITTER\nout vec3 outInitialPosition;\n#endif\nout float outAge;\nout float outLife;\nout vec4 outSeed;\nout vec3 outSize;\n#ifndef COLORGRADIENTS\nout vec4 outColor;\n#endif\nout vec3 outDirection;\n#ifndef BILLBOARD\nout vec3 outInitialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nout float outAngle;\n#else\nout vec2 outAngle;\n#endif\n#ifdef ANIMATESHEET\nout float outCellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nout float outCellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nout vec3 outNoiseCoordinates1;\nout vec3 outNoiseCoordinates2;\n#endif\n#ifdef SIZEGRADIENTS\nuniform sampler2D sizeGradientSampler;\n#endif \n#ifdef ANGULARSPEEDGRADIENTS\nuniform sampler2D angularSpeedGradientSampler;\n#endif \n#ifdef VELOCITYGRADIENTS\nuniform sampler2D velocityGradientSampler;\n#endif\n#ifdef LIMITVELOCITYGRADIENTS\nuniform sampler2D limitVelocityGradientSampler;\nuniform float limitVelocityDamping;\n#endif\n#ifdef DRAGGRADIENTS\nuniform sampler2D dragGradientSampler;\n#endif\n#ifdef NOISE\nuniform vec3 noiseStrength;\nuniform sampler2D noiseSampler;\n#endif\n#ifdef ANIMATESHEET\nuniform vec4 cellInfos;\n#endif\nvec3 getRandomVec3(float offset) {\nreturn texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;\n}\nvec4 getRandomVec4(float offset) {\nreturn texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));\n}\nvoid main() {\nfloat newAge=age+timeDelta; \nif (newAge>=life && stopFactor != 0.) {\nvec3 newPosition;\nvec3 newDirection;\nvec4 randoms=getRandomVec4(seed.x);\noutLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;\noutAge=newAge-life;\noutSeed=seed;\n#ifdef SIZEGRADIENTS \noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\n#else\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\n#endif\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;\noutSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a; \n#ifndef COLORGRADIENTS\noutColor=color1+(color2-color1)*randoms.b;\n#endif\n#ifndef ANGULARSPEEDGRADIENTS \noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;\noutAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#else\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#endif \n#ifdef POINTEMITTER\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nnewPosition=vec3(0,0,0);\nnewDirection=direction1+(direction2-direction1)*randoms3;\n#elif defined(BOXEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nnewPosition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;\nnewDirection=direction1+(direction2-direction1)*randoms3; \n#elif defined(HEMISPHERICEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nnewPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\nnewDirection=newPosition+directionRandomizer*randoms3; \n#elif defined(SPHEREEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nnewPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\n#ifdef DIRECTEDSPHEREEMITTER\nnewDirection=normalize(direction1+(direction2-direction1)*randoms3);\n#else\nnewDirection=normalize(newPosition+directionRandomizer*randoms3);\n#endif\n#elif defined(CYLINDEREMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nfloat yPos=(randoms2.x-0.5)*height;\nfloat angle=randoms2.y*PI*2.;\nfloat inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));\nfloat positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));\nfloat xPos=positionRadius*cos(angle);\nfloat zPos=positionRadius*sin(angle);\nnewPosition=vec3(xPos,yPos,zPos);\n#ifdef DIRECTEDCYLINDEREMITTER\nnewDirection=direction1+(direction2-direction1)*randoms3;\n#else\nangle=angle+((randoms3.x-0.5)*PI)*directionRandomizer;\nnewDirection=vec3(cos(angle),(randoms3.y-0.5)*directionRandomizer,sin(angle));\nnewDirection=normalize(newDirection);\n#endif\n#elif defined(CONEEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nfloat s=2.0*PI*randoms2.x;\n#ifdef CONEEMITTERSPAWNPOINT\nfloat h=0.0001;\n#else\nfloat h=randoms2.y*height.y;\nh=1.-h*h; \n#endif\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;\nlRadius=lRadius*h;\nfloat randX=lRadius*sin(s);\nfloat randZ=lRadius*cos(s);\nfloat randY=h *height.x;\nnewPosition=vec3(randX,randY,randZ); \nif (abs(cos(coneAngle))==1.0) {\nnewDirection=vec3(0.,1.0,0.);\n} else {\nvec3 randoms3=getRandomVec3(seed.z);\nnewDirection=normalize(newPosition+directionRandomizer*randoms3); \n}\n#elif defined(CUSTOMEMITTER)\nnewPosition=initialPosition;\noutInitialPosition=initialPosition;\n#else \nnewPosition=vec3(0.,0.,0.);\nnewDirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\n#endif\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\n#ifdef LOCAL\noutPosition=newPosition;\n#else\noutPosition=(emitterWM*vec4(newPosition,1.)).xyz;\n#endif\n#ifdef CUSTOMEMITTER\noutDirection=direction;\n#ifndef BILLBOARD \noutInitialDirection=direction;\n#endif\n#else\n#ifdef LOCAL\nvec3 initial=newDirection;\n#else \nvec3 initial=(emitterWM*vec4(newDirection,0.)).xyz;\n#endif\noutDirection=initial*power;\n#ifndef BILLBOARD \noutInitialDirection=initial;\n#endif\n#endif\n#ifdef ANIMATESHEET \noutCellIndex=cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=randoms.a*outLife;\n#endif \n#endif\n#ifdef NOISE\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif\n} else {\nfloat directionScale=timeDelta;\noutAge=newAge;\nfloat ageGradient=newAge/life;\n#ifdef VELOCITYGRADIENTS\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#ifdef DRAGGRADIENTS\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#if defined(CUSTOMEMITTER)\noutPosition=position+(direction-position)*ageGradient; \noutInitialPosition=initialPosition;\n#else\noutPosition=position+direction*directionScale;\n#endif\noutLife=life;\noutSeed=seed;\n#ifndef COLORGRADIENTS \noutColor=color;\n#endif\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;\noutSize.yz=size.yz;\n#else\noutSize=size;\n#endif \n#ifndef BILLBOARD \noutInitialDirection=initialDirection;\n#endif\n#ifdef CUSTOMEMITTER\noutDirection=direction;\n#else\nvec3 updatedDirection=direction+gravity*timeDelta;\n#ifdef LIMITVELOCITYGRADIENTS\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;\nfloat currentVelocity=length(updatedDirection);\nif (currentVelocity>limitVelocity) {\nupdatedDirection=updatedDirection*limitVelocityDamping;\n}\n#endif\noutDirection=updatedDirection;\n#ifdef NOISE\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;\nvec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;\noutDirection=outDirection+force*timeDelta;\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif \n#endif \n#ifdef ANGULARSPEEDGRADIENTS\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;\noutAngle=angle+angularSpeed*timeDelta;\n#else\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\n#endif\n#ifdef ANIMATESHEET \nfloat offsetAge=outAge;\nfloat dist=cellInfos.y-cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=cellStartOffset;\noffsetAge+=cellStartOffset;\n#else\nfloat cellStartOffset=0.;\n#endif \nfloat ratio=0.;\nif (cellInfos.w==1.0) {\nratio=clamp(mod(cellStartOffset+cellInfos.z*offsetAge,life)/life,0.,1.0);\n}\nelse {\nratio=clamp(cellStartOffset+cellInfos.z*offsetAge/life,0.,1.0);\n}\noutCellIndex=float(int(cellInfos.x+ratio*dist));\n#endif\n}\n}",(0,l.H)("BABYLON.WebGL2ParticleSystem",class{constructor(e,t){this._renderVAO=[],this._updateVAO=[],this.alignDataInBuffer=!1,this._parent=e,this._engine=t,this._updateEffectOptions={attributes:["position","initialPosition","age","life","seed","size","color","direction","initialDirection","angle","cellIndex","cellStartOffset","noiseCoordinates1","noiseCoordinates2"],uniformsNames:["currentCount","timeDelta","emitterWM","lifeTime","color1","color2","sizeRange","scaleRange","gravity","emitPower","direction1","direction2","minEmitBox","maxEmitBox","radius","directionRandomizer","height","coneAngle","stopFactor","angleRange","radiusRange","cellInfos","noiseStrength","limitVelocityDamping"],uniformBuffersNames:[],samplers:["randomSampler","randomSampler2","sizeGradientSampler","angularSpeedGradientSampler","velocityGradientSampler","limitVelocityGradientSampler","noiseSampler","dragGradientSampler"],defines:"",fallbacks:null,onCompiled:null,onError:null,indexParameters:null,maxSimultaneousLights:0,transformFeedbackVaryings:[]}}isUpdateBufferCreated(){return!!this._updateEffect}isUpdateBufferReady(){var e,t;return null!==(t=null===(e=this._updateEffect)||void 0===e?void 0:e.isReady())&&void 0!==t&&t}createUpdateBuffer(e){return this._updateEffectOptions.transformFeedbackVaryings=["outPosition"],this._updateEffectOptions.transformFeedbackVaryings.push("outAge"),this._updateEffectOptions.transformFeedbackVaryings.push("outSize"),this._updateEffectOptions.transformFeedbackVaryings.push("outLife"),this._updateEffectOptions.transformFeedbackVaryings.push("outSeed"),this._updateEffectOptions.transformFeedbackVaryings.push("outDirection"),this._parent.particleEmitterType instanceof t_.E&&this._updateEffectOptions.transformFeedbackVaryings.push("outInitialPosition"),this._parent._colorGradientsTexture||this._updateEffectOptions.transformFeedbackVaryings.push("outColor"),this._parent._isBillboardBased||this._updateEffectOptions.transformFeedbackVaryings.push("outInitialDirection"),this._parent.noiseTexture&&(this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates1"),this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates2")),this._updateEffectOptions.transformFeedbackVaryings.push("outAngle"),this._parent.isAnimationSheetEnabled&&(this._updateEffectOptions.transformFeedbackVaryings.push("outCellIndex"),this._parent.spriteRandomStartCell&&this._updateEffectOptions.transformFeedbackVaryings.push("outCellStartOffset")),this._updateEffectOptions.defines=e,this._updateEffect=new mn.Q("gpuUpdateParticles",this._updateEffectOptions,this._engine),new i_(this._updateEffect)}createVertexBuffers(e,t){this._updateVAO.push(this._createUpdateVAO(e)),this._renderVAO.push(this._engine.recordVertexArrayObject(t,null,this._parent._getWrapper(this._parent.blendMode).effect)),this._engine.bindArrayBuffer(null)}createParticleBuffer(e){return e}bindDrawBuffers(e){this._engine.bindVertexArrayObject(this._renderVAO[e],null)}preUpdateParticleBuffer(){const e=this._engine;if(this._engine.enableEffect(this._updateEffect),!e.setState)throw new Error("GPU particles cannot work without a full Engine. ThinEngine is not supported")}updateParticleBuffer(e,t,i){this._updateEffect.setTexture("randomSampler",this._parent._randomTexture),this._updateEffect.setTexture("randomSampler2",this._parent._randomTexture2),this._parent._sizeGradientsTexture&&this._updateEffect.setTexture("sizeGradientSampler",this._parent._sizeGradientsTexture),this._parent._angularSpeedGradientsTexture&&this._updateEffect.setTexture("angularSpeedGradientSampler",this._parent._angularSpeedGradientsTexture),this._parent._velocityGradientsTexture&&this._updateEffect.setTexture("velocityGradientSampler",this._parent._velocityGradientsTexture),this._parent._limitVelocityGradientsTexture&&this._updateEffect.setTexture("limitVelocityGradientSampler",this._parent._limitVelocityGradientsTexture),this._parent._dragGradientsTexture&&this._updateEffect.setTexture("dragGradientSampler",this._parent._dragGradientsTexture),this._parent.noiseTexture&&this._updateEffect.setTexture("noiseSampler",this._parent.noiseTexture),this._engine.bindVertexArrayObject(this._updateVAO[e],null);const n=this._engine;n.bindTransformFeedbackBuffer(t.getBuffer()),n.setRasterizerState(!1),n.beginTransformFeedback(!0),n.drawArraysType(3,0,i),n.endTransformFeedback(),n.setRasterizerState(!0),n.bindTransformFeedbackBuffer(null)}releaseBuffers(){}releaseVertexBuffers(){for(let e=0;ee)return void i(t[0],t[0],1);for(let n=0;n=r.gradient&&e<=s.gradient)return void i(r,s,(e-r.gradient)/(s.gradient-r.gradient))}const n=t.length-1;i(t[n],t[n],1)}}class a_{constructor(e){this.particleSystem=e,this.position=o.P.Zero(),this.direction=o.P.Zero(),this.color=new a.HE(0,0,0,0),this.colorStep=new a.HE(0,0,0,0),this.lifeTime=1,this.age=0,this.size=0,this.scale=new o.FM(1,1),this.angle=0,this.angularSpeed=0,this.cellIndex=0,this._attachedSubEmitters=null,this._currentColor1=new a.HE(0,0,0,0),this._currentColor2=new a.HE(0,0,0,0),this._currentSize1=0,this._currentSize2=0,this._currentAngularSpeed1=0,this._currentAngularSpeed2=0,this._currentVelocity1=0,this._currentVelocity2=0,this._currentLimitVelocity1=0,this._currentLimitVelocity2=0,this._currentDrag1=0,this._currentDrag2=0,this.id=a_._Count++,this.particleSystem.isAnimationSheetEnabled&&this._updateCellInfoFromSystem()}_updateCellInfoFromSystem(){this.cellIndex=this.particleSystem.startSpriteCellID}updateCellIndex(){let e=this.age,t=this.particleSystem.spriteCellChangeSpeed;this.particleSystem.spriteRandomStartCell&&(void 0===this._randomCellOffset&&(this._randomCellOffset=Math.random()*this.lifeTime),0===t?(t=1,e=this._randomCellOffset):e+=this._randomCellOffset);const i=this._initialEndSpriteCellID-this._initialStartSpriteCellID;let n;n=this._initialSpriteCellLoop?ve.R.Clamp(e*t%this.lifeTime/this.lifeTime):ve.R.Clamp(e*t/this.lifeTime),this.cellIndex=this._initialStartSpriteCellID+n*i|0}_inheritParticleInfoToSubEmitter(e){if(e.particleSystem.emitter.position){const t=e.particleSystem.emitter;if(t.position.copyFrom(this.position),e.inheritDirection){const e=o.jp.Vector3[0];this.direction.normalizeToRef(e),t.setDirection(e,0,Math.PI/2)}}else e.particleSystem.emitter.copyFrom(this.position);this.direction.scaleToRef(e.inheritedVelocityAmount/2,o.jp.Vector3[0]),e.particleSystem._inheritedVelocityOffset.copyFrom(o.jp.Vector3[0])}_inheritParticleInfoToSubEmitters(){this._attachedSubEmitters&&this._attachedSubEmitters.length>0&&this._attachedSubEmitters.forEach((e=>{this._inheritParticleInfoToSubEmitter(e)}))}_reset(){this.age=0,this.id=a_._Count++,this._currentColorGradient=null,this._currentSizeGradient=null,this._currentAngularSpeedGradient=null,this._currentVelocityGradient=null,this._currentLimitVelocityGradient=null,this._currentDragGradient=null,this.cellIndex=this.particleSystem.startSpriteCellID,this._randomCellOffset=void 0}copyTo(e){e.position.copyFrom(this.position),this._initialDirection?e._initialDirection?e._initialDirection.copyFrom(this._initialDirection):e._initialDirection=this._initialDirection.clone():e._initialDirection=null,e.direction.copyFrom(this.direction),this._localPosition&&(e._localPosition?e._localPosition.copyFrom(this._localPosition):e._localPosition=this._localPosition.clone()),e.color.copyFrom(this.color),e.colorStep.copyFrom(this.colorStep),e.lifeTime=this.lifeTime,e.age=this.age,e._randomCellOffset=this._randomCellOffset,e.size=this.size,e.scale.copyFrom(this.scale),e.angle=this.angle,e.angularSpeed=this.angularSpeed,e.particleSystem=this.particleSystem,e.cellIndex=this.cellIndex,e.id=this.id,e._attachedSubEmitters=this._attachedSubEmitters,this._currentColorGradient&&(e._currentColorGradient=this._currentColorGradient,e._currentColor1.copyFrom(this._currentColor1),e._currentColor2.copyFrom(this._currentColor2)),this._currentSizeGradient&&(e._currentSizeGradient=this._currentSizeGradient,e._currentSize1=this._currentSize1,e._currentSize2=this._currentSize2),this._currentAngularSpeedGradient&&(e._currentAngularSpeedGradient=this._currentAngularSpeedGradient,e._currentAngularSpeed1=this._currentAngularSpeed1,e._currentAngularSpeed2=this._currentAngularSpeed2),this._currentVelocityGradient&&(e._currentVelocityGradient=this._currentVelocityGradient,e._currentVelocity1=this._currentVelocity1,e._currentVelocity2=this._currentVelocity2),this._currentLimitVelocityGradient&&(e._currentLimitVelocityGradient=this._currentLimitVelocityGradient,e._currentLimitVelocity1=this._currentLimitVelocity1,e._currentLimitVelocity2=this._currentLimitVelocity2),this._currentDragGradient&&(e._currentDragGradient=this._currentDragGradient,e._currentDrag1=this._currentDrag1,e._currentDrag2=this._currentDrag2),this.particleSystem.isAnimationSheetEnabled&&(e._initialStartSpriteCellID=this._initialStartSpriteCellID,e._initialEndSpriteCellID=this._initialEndSpriteCellID,e._initialSpriteCellLoop=this._initialSpriteCellLoop),this.particleSystem.useRampGradients&&(e.remapData&&this.remapData?e.remapData.copyFrom(this.remapData):e.remapData=new o.Lt(0,0,0,0)),this._randomNoiseCoordinates1&&(e._randomNoiseCoordinates1?(e._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1),e._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2)):(e._randomNoiseCoordinates1=this._randomNoiseCoordinates1.clone(),e._randomNoiseCoordinates2=this._randomNoiseCoordinates2.clone()))}}var l_;a_._Count=0,function(e){e[e.ATTACHED=0]="ATTACHED",e[e.END=1]="END"}(l_||(l_={}));class c_{constructor(e){if(this.particleSystem=e,this.type=l_.END,this.inheritDirection=!1,this.inheritedVelocityAmount=0,!e.emitter||!e.emitter.dispose){const t=(0,l.q)("BABYLON.AbstractMesh");e.emitter=new t("SubemitterSystemEmitter",e.getScene()),e._disposeEmitterOnDispose=!0}}clone(){let e=this.particleSystem.emitter;e?e instanceof o.P?e=e.clone():-1!==e.getClassName().indexOf("Mesh")&&(e=new((0,l.q)("BABYLON.Mesh"))("",e.getScene()),e.isVisible=!1):e=new o.P;const t=new c_(this.particleSystem.clone(this.particleSystem.name,e));return t.particleSystem.name+="Clone",t.type=this.type,t.inheritDirection=this.inheritDirection,t.inheritedVelocityAmount=this.inheritedVelocityAmount,t.particleSystem._disposeEmitterOnDispose=!0,t.particleSystem.disposeOnStop=!0,t}serialize(e=!1){const t={};return t.type=this.type,t.inheritDirection=this.inheritDirection,t.inheritedVelocityAmount=this.inheritedVelocityAmount,t.particleSystem=this.particleSystem.serialize(e),t}static _ParseParticleSystem(e,t,i,n=!1){throw(0,_a.S)("ParseParticle")}static Parse(e,t,i){const n=e.particleSystem,r=new c_(c_._ParseParticleSystem(n,t,i,!0));return r.type=e.type,r.inheritDirection=e.inheritDirection,r.inheritedVelocityAmount=e.inheritedVelocityAmount,r.particleSystem._isSubEmitter=!0,r}dispose(){this.particleSystem.dispose()}}i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js"),i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js");dt.v.ShadersStore.particlesPixelShader="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#include\n#include\n#include\n#include\n#include\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\nuniform sampler2D rampSampler;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec4 textureColor=texture2D(diffuseSampler,vUV);\nvec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n#ifdef RAMPGRADIENT\nfloat alpha=baseColor.a;\nfloat remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);\nvec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));\nbaseColor.rgb*=rampColor.rgb;\nfloat finalAlpha=baseColor.a;\nbaseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);\n#endif\n#ifdef BLENDMULTIPLYMODE\nfloat sourceAlpha=vColor.a*textureColor.a;\nbaseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);\n#endif\n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\nbaseColor=applyImageProcessing(baseColor);\n#endif\n#endif\ngl_FragColor=baseColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js");dt.v.ShadersStore.particlesVertexShader="attribute vec3 position;\nattribute vec4 color;\nattribute float angle;\nattribute vec2 size;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD\nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\n#ifdef ANIMATESHEET\nuniform vec3 particlesInfos; \n#endif\nvarying vec2 vUV;\nvarying vec4 vColor;\nvarying vec3 vPositionW;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform mat4 invView;\n#endif\n#include\n#include\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix= mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix= mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec2 cornerPos;\ncornerPos=(vec2(offset.x-0.5,offset.y -0.5)-translationPivot)*size+translationPivot;\n#ifdef BILLBOARD\nvec3 rotatedCorner;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=position-eyePosition;\nyaxis.y=0.;\nvPositionW=rotate(normalize(yaxis),rotatedCorner);\nvec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=position-eyePosition;\nvPositionW=rotateAlign(toCamera,rotatedCorner);\nvec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;\nvPositionW=(invView*vec4(viewPos,1)).xyz;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\ngl_Position=projection*vec4(viewPos,1.0);\n#else\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=normalize(direction);\nvPositionW=rotate(yaxis,rotatedCorner);\ngl_Position=projection*view*vec4(vPositionW,1.0);\n#endif\nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex*particlesInfos.z);\nfloat columnOffset=cellIndex-rowOffset/particlesInfos.z;\nvec2 uvScale=particlesInfos.xy;\nvec2 uvOffset=vec2(offset.x ,1.0-offset.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvec4 worldPos=vec4(vPositionW,1.0);\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}";class h_ extends Jh.U{constructor(e,t,i,n=null,r=!1,l=.01){super(e),this._emitterInverseWorldMatrix=o.y3.Identity(),this._inheritedVelocityOffset=new o.P,this.onDisposeObservable=new s.y$,this.onStoppedObservable=new s.y$,this._particles=new Array,this._stockParticles=new Array,this._newPartsExcess=0,this._vertexBuffers={},this._scaledColorStep=new a.HE(0,0,0,0),this._colorDiff=new a.HE(0,0,0,0),this._scaledDirection=o.P.Zero(),this._scaledGravity=o.P.Zero(),this._currentRenderId=-1,this._useInstancing=!1,this._started=!1,this._stopped=!1,this._actualFrame=0,this._currentEmitRate1=0,this._currentEmitRate2=0,this._currentStartSize1=0,this._currentStartSize2=0,this._rawTextureWidth=256,this._useRampGradients=!1,this._disposeEmitterOnDispose=!1,this.isLocal=!1,this._onBeforeDrawParticlesObservable=null,this.recycleParticle=e=>{const t=this._particles.pop();t!==e&&t.copyTo(e),this._stockParticles.push(t)},this._createParticle=()=>{let e;if(0!==this._stockParticles.length?(e=this._stockParticles.pop(),e._reset()):e=new a_(this),this._subEmitters&&this._subEmitters.length>0){const t=this._subEmitters[Math.floor(Math.random()*this._subEmitters.length)];e._attachedSubEmitters=[],t.forEach((t=>{if(t.type===l_.ATTACHED){const i=t.clone();e._attachedSubEmitters.push(i),i.particleSystem.start()}}))}return e},this._emitFromParticle=e=>{if(!this._subEmitters||0===this._subEmitters.length)return;const t=Math.floor(Math.random()*this._subEmitters.length);this._subEmitters[t].forEach((t=>{if(t.type===l_.END){const i=t.clone();e._inheritParticleInfoToSubEmitter(i),i.particleSystem._rootParticleSystem=this,this.activeSubSystems.push(i.particleSystem),i.particleSystem.start()}}))},this._capacity=t,this._epsilon=l,this._isAnimationSheetEnabled=r,i&&"Scene"!==i.getClassName()?(this._engine=i,this.defaultProjectionMatrix=o.y3.PerspectiveFovLH(.8,1,.1,100,this._engine.isNDCHalfZRange)):(this._scene=i||m.l.LastCreatedScene,this._engine=this._scene.getEngine(),this.uniqueId=this._scene.getUniqueId(),this._scene.particleSystems.push(this)),this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObject=null),this._attachImageProcessingConfiguration(null),this._customWrappers={0:new Tn.q(this._engine)},this._customWrappers[0].effect=n,this._drawWrappers=[],this._useInstancing=this._engine.getCaps().instancedArrays,this._createIndexBuffer(),this._createVertexBuffers(),this.particleEmitterType=new e_.S3;let c=null;this.updateFunction=e=>{var t;let i=null;this.noiseTexture&&(i=this.noiseTexture.getSize(),null===(t=this.noiseTexture.getContent())||void 0===t||t.then((e=>{c=e})));for(let t=0;tn.lifeTime){const e=n.age-s;r=(n.lifeTime-s)*r/e,n.age=n.lifeTime}const l=n.age/n.lifeTime;this._colorGradients&&this._colorGradients.length>0?o_.GetCurrentGradient(l,this._colorGradients,((e,t,i)=>{e!==n._currentColorGradient&&(n._currentColor1.copyFrom(n._currentColor2),t.getColorToRef(n._currentColor2),n._currentColorGradient=e),a.HE.LerpToRef(n._currentColor1,n._currentColor2,i,n.color)})):(n.colorStep.scaleToRef(r,this._scaledColorStep),n.color.addInPlace(this._scaledColorStep),n.color.a<0&&(n.color.a=0)),this._angularSpeedGradients&&this._angularSpeedGradients.length>0&&o_.GetCurrentGradient(l,this._angularSpeedGradients,((e,t,i)=>{e!==n._currentAngularSpeedGradient&&(n._currentAngularSpeed1=n._currentAngularSpeed2,n._currentAngularSpeed2=t.getFactor(),n._currentAngularSpeedGradient=e),n.angularSpeed=ve.R.Lerp(n._currentAngularSpeed1,n._currentAngularSpeed2,i)})),n.angle+=n.angularSpeed*r;let h=r;if(this._velocityGradients&&this._velocityGradients.length>0&&o_.GetCurrentGradient(l,this._velocityGradients,((e,t,i)=>{e!==n._currentVelocityGradient&&(n._currentVelocity1=n._currentVelocity2,n._currentVelocity2=t.getFactor(),n._currentVelocityGradient=e),h*=ve.R.Lerp(n._currentVelocity1,n._currentVelocity2,i)})),n.direction.scaleToRef(h,this._scaledDirection),this._limitVelocityGradients&&this._limitVelocityGradients.length>0&&o_.GetCurrentGradient(l,this._limitVelocityGradients,((e,t,i)=>{e!==n._currentLimitVelocityGradient&&(n._currentLimitVelocity1=n._currentLimitVelocity2,n._currentLimitVelocity2=t.getFactor(),n._currentLimitVelocityGradient=e);const r=ve.R.Lerp(n._currentLimitVelocity1,n._currentLimitVelocity2,i);n.direction.length()>r&&n.direction.scaleInPlace(this.limitVelocityDamping)})),this._dragGradients&&this._dragGradients.length>0&&o_.GetCurrentGradient(l,this._dragGradients,((e,t,i)=>{e!==n._currentDragGradient&&(n._currentDrag1=n._currentDrag2,n._currentDrag2=t.getFactor(),n._currentDragGradient=e);const r=ve.R.Lerp(n._currentDrag1,n._currentDrag2,i);this._scaledDirection.scaleInPlace(1-r)})),this.isLocal&&n._localPosition?(n._localPosition.addInPlace(this._scaledDirection),o.P.TransformCoordinatesToRef(n._localPosition,this._emitterWorldMatrix,n.position)):n.position.addInPlace(this._scaledDirection),c&&i&&n._randomNoiseCoordinates1){const e=this._fetchR(n._randomNoiseCoordinates1.x,n._randomNoiseCoordinates1.y,i.width,i.height,c),t=this._fetchR(n._randomNoiseCoordinates1.z,n._randomNoiseCoordinates2.x,i.width,i.height,c),s=this._fetchR(n._randomNoiseCoordinates2.y,n._randomNoiseCoordinates2.z,i.width,i.height,c),a=o.jp.Vector3[0],l=o.jp.Vector3[1];a.copyFromFloats((2*e-1)*this.noiseStrength.x,(2*t-1)*this.noiseStrength.y,(2*s-1)*this.noiseStrength.z),a.scaleToRef(r,l),n.direction.addInPlace(l)}this.gravity.scaleToRef(r,this._scaledGravity),n.direction.addInPlace(this._scaledGravity),this._sizeGradients&&this._sizeGradients.length>0&&o_.GetCurrentGradient(l,this._sizeGradients,((e,t,i)=>{e!==n._currentSizeGradient&&(n._currentSize1=n._currentSize2,n._currentSize2=t.getFactor(),n._currentSizeGradient=e),n.size=ve.R.Lerp(n._currentSize1,n._currentSize2,i)})),this._useRampGradients&&(this._colorRemapGradients&&this._colorRemapGradients.length>0&&o_.GetCurrentGradient(l,this._colorRemapGradients,((e,t,i)=>{const r=ve.R.Lerp(e.factor1,t.factor1,i),s=ve.R.Lerp(e.factor2,t.factor2,i);n.remapData.x=r,n.remapData.y=s-r})),this._alphaRemapGradients&&this._alphaRemapGradients.length>0&&o_.GetCurrentGradient(l,this._alphaRemapGradients,((e,t,i)=>{const r=ve.R.Lerp(e.factor1,t.factor1,i),s=ve.R.Lerp(e.factor2,t.factor2,i);n.remapData.z=r,n.remapData.w=s-r}))),this._isAnimationSheetEnabled&&n.updateCellIndex(),n._inheritParticleInfoToSubEmitters(),n.age>=n.lifeTime&&(this._emitFromParticle(n),n._attachedSubEmitters&&(n._attachedSubEmitters.forEach((e=>{e.particleSystem.disposeOnStop=!0,e.particleSystem.stop()})),n._attachedSubEmitters=null),this.recycleParticle(n),t--)}}}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get useRampGradients(){return this._useRampGradients}set useRampGradients(e){this._useRampGradients!==e&&(this._useRampGradients=e,this._resetEffect())}get particles(){return this._particles}getActiveCount(){return this._particles.length}getClassName(){return"ParticleSystem"}isStopping(){return this._stopped&&this.isAlive()}getCustomEffect(e=0){var t,i;return null!==(i=null===(t=this._customWrappers[e])||void 0===t?void 0:t.effect)&&void 0!==i?i:this._customWrappers[0].effect}_getCustomDrawWrapper(e=0){var t;return null!==(t=this._customWrappers[e])&&void 0!==t?t:this._customWrappers[0]}setCustomEffect(e,t=0){this._customWrappers[t]=new Tn.q(this._engine),this._customWrappers[t].effect=e,this._customWrappers[t].drawContext&&(this._customWrappers[t].drawContext.useInstancing=this._useInstancing)}get onBeforeDrawParticlesObservable(){return this._onBeforeDrawParticlesObservable||(this._onBeforeDrawParticlesObservable=new s.y$),this._onBeforeDrawParticlesObservable}get vertexShaderName(){return"particles"}get vertexBuffers(){return this._vertexBuffers}get indexBuffer(){return this._indexBuffer}_addFactorGradient(e,t,i,n){const r=new s_(t,i,n);e.push(r),e.sort(((e,t)=>e.gradientt.gradient?1:0))}_removeFactorGradient(e,t){if(!e)return;let i=0;for(const n of e){if(n.gradient===t){e.splice(i,1);break}i++}}addLifeTimeGradient(e,t,i){return this._lifeTimeGradients||(this._lifeTimeGradients=[]),this._addFactorGradient(this._lifeTimeGradients,e,t,i),this}removeLifeTimeGradient(e){return this._removeFactorGradient(this._lifeTimeGradients,e),this}addSizeGradient(e,t,i){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t,i),this}removeSizeGradient(e){return this._removeFactorGradient(this._sizeGradients,e),this}addColorRemapGradient(e,t,i){return this._colorRemapGradients||(this._colorRemapGradients=[]),this._addFactorGradient(this._colorRemapGradients,e,t,i),this}removeColorRemapGradient(e){return this._removeFactorGradient(this._colorRemapGradients,e),this}addAlphaRemapGradient(e,t,i){return this._alphaRemapGradients||(this._alphaRemapGradients=[]),this._addFactorGradient(this._alphaRemapGradients,e,t,i),this}removeAlphaRemapGradient(e){return this._removeFactorGradient(this._alphaRemapGradients,e),this}addAngularSpeedGradient(e,t,i){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t,i),this}removeAngularSpeedGradient(e){return this._removeFactorGradient(this._angularSpeedGradients,e),this}addVelocityGradient(e,t,i){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t,i),this}removeVelocityGradient(e){return this._removeFactorGradient(this._velocityGradients,e),this}addLimitVelocityGradient(e,t,i){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t,i),this}removeLimitVelocityGradient(e){return this._removeFactorGradient(this._limitVelocityGradients,e),this}addDragGradient(e,t,i){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t,i),this}removeDragGradient(e){return this._removeFactorGradient(this._dragGradients,e),this}addEmitRateGradient(e,t,i){return this._emitRateGradients||(this._emitRateGradients=[]),this._addFactorGradient(this._emitRateGradients,e,t,i),this}removeEmitRateGradient(e){return this._removeFactorGradient(this._emitRateGradients,e),this}addStartSizeGradient(e,t,i){return this._startSizeGradients||(this._startSizeGradients=[]),this._addFactorGradient(this._startSizeGradients,e,t,i),this}removeStartSizeGradient(e){return this._removeFactorGradient(this._startSizeGradients,e),this}_createRampGradientTexture(){if(!this._rampGradients||!this._rampGradients.length||this._rampGradientsTexture||!this._scene)return;const e=new Uint8Array(4*this._rawTextureWidth),t=a.zZ.Color3[0];for(let i=0;i{a.Wo.LerpToRef(n.color,r.color,s,t),e[4*i]=255*t.r,e[4*i+1]=255*t.g,e[4*i+2]=255*t.b,e[4*i+3]=255}))}this._rampGradientsTexture=q.l.CreateRGBATexture(e,this._rawTextureWidth,1,this._scene,!1,!1,1)}getRampGradients(){return this._rampGradients}forceRefreshGradients(){this._syncRampGradientTexture()}_syncRampGradientTexture(){this._rampGradients&&(this._rampGradients.sort(((e,t)=>e.gradientt.gradient?1:0)),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._createRampGradientTexture())}addRampGradient(e,t){this._rampGradients||(this._rampGradients=[]);const i=new r_(e,t);return this._rampGradients.push(i),this._syncRampGradientTexture(),this}removeRampGradient(e){return this._removeGradientAndTexture(e,this._rampGradients,this._rampGradientsTexture),this._rampGradientsTexture=null,this._rampGradients&&this._rampGradients.length>0&&this._createRampGradientTexture(),this}addColorGradient(e,t,i){this._colorGradients||(this._colorGradients=[]);const n=new n_(e,t,i);return this._colorGradients.push(n),this._colorGradients.sort(((e,t)=>e.gradientt.gradient?1:0)),this}removeColorGradient(e){if(!this._colorGradients)return this;let t=0;for(const i of this._colorGradients){if(i.gradient===e){this._colorGradients.splice(t,1);break}t++}return this}resetDrawCache(){for(const e of this._drawWrappers)if(e)for(const t of e)null==t||t.dispose();this._drawWrappers=[]}_fetchR(e,t,i,n,r){return r[4*(((e=.5*Math.abs(e)+.5)*i%i|0)+((t=.5*Math.abs(t)+.5)*n%n|0)*i)]/255}_reset(){this._resetEffect()}_resetEffect(){this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._vertexArrayObject&&(this._engine.releaseVertexArrayObject(this._vertexArrayObject),this._vertexArrayObject=null),this._createVertexBuffers()}_createVertexBuffers(){this._vertexBufferSize=this._useInstancing?10:12,this._isAnimationSheetEnabled&&(this._vertexBufferSize+=1),this._isBillboardBased&&this.billboardMode!==h_.BILLBOARDMODE_STRETCHED||(this._vertexBufferSize+=3),this._useRampGradients&&(this._vertexBufferSize+=4);const e=this._engine,t=this._vertexBufferSize*(this._useInstancing?1:4);this._vertexData=new Float32Array(this._capacity*t),this._vertexBuffer=new le.l(e,this._vertexData,!0,t);let i=0;const n=this._vertexBuffer.createVertexBuffer(le.o.PositionKind,i,3,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[le.o.PositionKind]=n,i+=3;const r=this._vertexBuffer.createVertexBuffer(le.o.ColorKind,i,4,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[le.o.ColorKind]=r,i+=4;const s=this._vertexBuffer.createVertexBuffer("angle",i,1,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.angle=s,i+=1;const o=this._vertexBuffer.createVertexBuffer("size",i,2,this._vertexBufferSize,this._useInstancing);if(this._vertexBuffers.size=o,i+=2,this._isAnimationSheetEnabled){const e=this._vertexBuffer.createVertexBuffer("cellIndex",i,1,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.cellIndex=e,i+=1}if(!this._isBillboardBased||this.billboardMode===h_.BILLBOARDMODE_STRETCHED){const e=this._vertexBuffer.createVertexBuffer("direction",i,3,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.direction=e,i+=3}if(this._useRampGradients){const e=this._vertexBuffer.createVertexBuffer("remapData",i,4,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.remapData=e,i+=4}let a;if(this._useInstancing){const t=new Float32Array([0,0,1,0,0,1,1,1]);this._spriteBuffer=new le.l(e,t,!1,2),a=this._spriteBuffer.createVertexBuffer("offset",0,2)}else a=this._vertexBuffer.createVertexBuffer("offset",i,2,this._vertexBufferSize,this._useInstancing),i+=2;this._vertexBuffers.offset=a,this.resetDrawCache()}_createIndexBuffer(){if(this._useInstancing)return;const e=[];let t=0;for(let i=0;i{e instanceof h_?this._subEmitters.push([new c_(e)]):e instanceof c_?this._subEmitters.push([e]):e instanceof Array&&this._subEmitters.push(e)}))}start(e=this.startDelay){var t;if(!this.targetStopDuration&&this._hasTargetStopDurationDependantGradient())throw"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";if(e)setTimeout((()=>{this.start(0)}),e);else{if(this._prepareSubEmitterInternalArray(),this._started=!0,this._stopped=!1,this._actualFrame=0,this._subEmitters&&0!=this._subEmitters.length&&(this.activeSubSystems=new Array),this._emitRateGradients&&(this._emitRateGradients.length>0&&(this._currentEmitRateGradient=this._emitRateGradients[0],this._currentEmitRate1=this._currentEmitRateGradient.getFactor(),this._currentEmitRate2=this._currentEmitRate1),this._emitRateGradients.length>1&&(this._currentEmitRate2=this._emitRateGradients[1].getFactor())),this._startSizeGradients&&(this._startSizeGradients.length>0&&(this._currentStartSizeGradient=this._startSizeGradients[0],this._currentStartSize1=this._currentStartSizeGradient.getFactor(),this._currentStartSize2=this._currentStartSize1),this._startSizeGradients.length>1&&(this._currentStartSize2=this._startSizeGradients[1].getFactor())),this.preWarmCycles){-1!==(null===(t=this.emitter)||void 0===t?void 0:t.getClassName().indexOf("Mesh"))&&this.emitter.computeWorldMatrix(!0);const e=this.noiseTexture;if(e&&e.onGeneratedObservable)e.onGeneratedObservable.addOnce((()=>{setTimeout((()=>{for(let t=0;t0&&this._scene&&this._scene.beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop)}}stop(e=!0){this._stopped||(this.onStoppedObservable.notifyObservers(this),this._stopped=!0,e&&this._stopSubEmitters())}reset(){this._stockParticles.length=0,this._particles.length=0}_appendParticleVertex(e,t,i,n){let r=e*this._vertexBufferSize;if(this._vertexData[r++]=t.position.x+this.worldOffset.x,this._vertexData[r++]=t.position.y+this.worldOffset.y,this._vertexData[r++]=t.position.z+this.worldOffset.z,this._vertexData[r++]=t.color.r,this._vertexData[r++]=t.color.g,this._vertexData[r++]=t.color.b,this._vertexData[r++]=t.color.a,this._vertexData[r++]=t.angle,this._vertexData[r++]=t.scale.x*t.size,this._vertexData[r++]=t.scale.y*t.size,this._isAnimationSheetEnabled&&(this._vertexData[r++]=t.cellIndex),this._isBillboardBased)this.billboardMode===h_.BILLBOARDMODE_STRETCHED&&(this._vertexData[r++]=t.direction.x,this._vertexData[r++]=t.direction.y,this._vertexData[r++]=t.direction.z);else if(t._initialDirection){let e=t._initialDirection;this.isLocal&&(o.P.TransformNormalToRef(e,this._emitterWorldMatrix,o.jp.Vector3[0]),e=o.jp.Vector3[0]),0===e.x&&0===e.z&&(e.x=.001),this._vertexData[r++]=e.x,this._vertexData[r++]=e.y,this._vertexData[r++]=e.z}else{let e=t.direction;this.isLocal&&(o.P.TransformNormalToRef(e,this._emitterWorldMatrix,o.jp.Vector3[0]),e=o.jp.Vector3[0]),0===e.x&&0===e.z&&(e.x=.001),this._vertexData[r++]=e.x,this._vertexData[r++]=e.y,this._vertexData[r++]=e.z}this._useRampGradients&&t.remapData&&(this._vertexData[r++]=t.remapData.x,this._vertexData[r++]=t.remapData.y,this._vertexData[r++]=t.remapData.z,this._vertexData[r++]=t.remapData.w),this._useInstancing||(this._isAnimationSheetEnabled&&(0===i?i=this._epsilon:1===i&&(i=1-this._epsilon),0===n?n=this._epsilon:1===n&&(n=1-this._epsilon)),this._vertexData[r++]=i,this._vertexData[r++]=n)}_stopSubEmitters(){this.activeSubSystems&&(this.activeSubSystems.forEach((e=>{e.stop(!0)})),this.activeSubSystems=new Array)}_removeFromRoot(){if(!this._rootParticleSystem)return;const e=this._rootParticleSystem.activeSubSystems.indexOf(this);-1!==e&&this._rootParticleSystem.activeSubSystems.splice(e,1),this._rootParticleSystem=null}_update(e){if(this._alive=this._particles.length>0,this.emitter.position){const e=this.emitter;this._emitterWorldMatrix=e.getWorldMatrix()}else{const e=this.emitter;this._emitterWorldMatrix=o.y3.Translation(e.x,e.y,e.z)}let t;this._emitterWorldMatrix.invertToRef(this._emitterInverseWorldMatrix),this.updateFunction(this._particles);for(let i=0;i0){const e=ve.R.Clamp(this._actualFrame/this.targetStopDuration);o_.GetCurrentGradient(e,this._lifeTimeGradients,((i,n)=>{const r=i,s=n,o=r.getFactor(),a=s.getFactor(),l=(e-r.gradient)/(s.gradient-r.gradient);t.lifeTime=ve.R.Lerp(o,a,l)}))}else t.lifeTime=ve.R.RandomRange(this.minLifeTime,this.maxLifeTime);const e=ve.R.RandomRange(this.minEmitPower,this.maxEmitPower);if(this.startPositionFunction?this.startPositionFunction(this._emitterWorldMatrix,t.position,t,this.isLocal):this.particleEmitterType.startPositionFunction(this._emitterWorldMatrix,t.position,t,this.isLocal),this.isLocal&&(t._localPosition?t._localPosition.copyFrom(t.position):t._localPosition=t.position.clone(),o.P.TransformCoordinatesToRef(t._localPosition,this._emitterWorldMatrix,t.position)),this.startDirectionFunction?this.startDirectionFunction(this._emitterWorldMatrix,t.direction,t,this.isLocal):this.particleEmitterType.startDirectionFunction(this._emitterWorldMatrix,t.direction,t,this.isLocal,this._emitterInverseWorldMatrix),0===e?t._initialDirection?t._initialDirection.copyFrom(t.direction):t._initialDirection=t.direction.clone():t._initialDirection=null,t.direction.scaleInPlace(e),this._sizeGradients&&0!==this._sizeGradients.length?(t._currentSizeGradient=this._sizeGradients[0],t._currentSize1=t._currentSizeGradient.getFactor(),t.size=t._currentSize1,this._sizeGradients.length>1?t._currentSize2=this._sizeGradients[1].getFactor():t._currentSize2=t._currentSize1):t.size=ve.R.RandomRange(this.minSize,this.maxSize),t.scale.copyFromFloats(ve.R.RandomRange(this.minScaleX,this.maxScaleX),ve.R.RandomRange(this.minScaleY,this.maxScaleY)),this._startSizeGradients&&this._startSizeGradients[0]&&this.targetStopDuration){const e=this._actualFrame/this.targetStopDuration;o_.GetCurrentGradient(e,this._startSizeGradients,((e,i,n)=>{e!==this._currentStartSizeGradient&&(this._currentStartSize1=this._currentStartSize2,this._currentStartSize2=i.getFactor(),this._currentStartSizeGradient=e);const r=ve.R.Lerp(this._currentStartSize1,this._currentStartSize2,n);t.scale.scaleInPlace(r)}))}if(this._angularSpeedGradients&&0!==this._angularSpeedGradients.length?(t._currentAngularSpeedGradient=this._angularSpeedGradients[0],t.angularSpeed=t._currentAngularSpeedGradient.getFactor(),t._currentAngularSpeed1=t.angularSpeed,this._angularSpeedGradients.length>1?t._currentAngularSpeed2=this._angularSpeedGradients[1].getFactor():t._currentAngularSpeed2=t._currentAngularSpeed1):t.angularSpeed=ve.R.RandomRange(this.minAngularSpeed,this.maxAngularSpeed),t.angle=ve.R.RandomRange(this.minInitialRotation,this.maxInitialRotation),this._velocityGradients&&this._velocityGradients.length>0&&(t._currentVelocityGradient=this._velocityGradients[0],t._currentVelocity1=t._currentVelocityGradient.getFactor(),this._velocityGradients.length>1?t._currentVelocity2=this._velocityGradients[1].getFactor():t._currentVelocity2=t._currentVelocity1),this._limitVelocityGradients&&this._limitVelocityGradients.length>0&&(t._currentLimitVelocityGradient=this._limitVelocityGradients[0],t._currentLimitVelocity1=t._currentLimitVelocityGradient.getFactor(),this._limitVelocityGradients.length>1?t._currentLimitVelocity2=this._limitVelocityGradients[1].getFactor():t._currentLimitVelocity2=t._currentLimitVelocity1),this._dragGradients&&this._dragGradients.length>0&&(t._currentDragGradient=this._dragGradients[0],t._currentDrag1=t._currentDragGradient.getFactor(),this._dragGradients.length>1?t._currentDrag2=this._dragGradients[1].getFactor():t._currentDrag2=t._currentDrag1),this._colorGradients&&0!==this._colorGradients.length)t._currentColorGradient=this._colorGradients[0],t._currentColorGradient.getColorToRef(t.color),t._currentColor1.copyFrom(t.color),this._colorGradients.length>1?this._colorGradients[1].getColorToRef(t._currentColor2):t._currentColor2.copyFrom(t.color);else{const e=ve.R.RandomRange(0,1);a.HE.LerpToRef(this.color1,this.color2,e,t.color),this.colorDead.subtractToRef(t.color,this._colorDiff),this._colorDiff.scaleToRef(1/t.lifeTime,t.colorStep)}this._isAnimationSheetEnabled&&(t._initialStartSpriteCellID=this.startSpriteCellID,t._initialEndSpriteCellID=this.endSpriteCellID,t._initialSpriteCellLoop=this.spriteCellLoop),t.direction.addInPlace(this._inheritedVelocityOffset),this._useRampGradients&&(t.remapData=new o.Lt(0,1,0,1)),this.noiseTexture&&(t._randomNoiseCoordinates1?(t._randomNoiseCoordinates1.copyFromFloats(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2.copyFromFloats(Math.random(),Math.random(),Math.random())):(t._randomNoiseCoordinates1=new o.P(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2=new o.P(Math.random(),Math.random(),Math.random()))),t._inheritParticleInfoToSubEmitters()}}static _GetAttributeNamesOrOptions(e=!1,t=!1,i=!1){const n=[le.o.PositionKind,le.o.ColorKind,"angle","offset","size"];return e&&n.push("cellIndex"),t||n.push("direction"),i&&n.push("remapData"),n}static _GetEffectCreationOptions(e=!1,t=!1){const i=["invView","view","projection","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","textureMask","translationPivot","eyePosition"];return e&&i.push("particlesInfos"),t&&i.push("logarithmicDepthConstant"),i}fillDefines(e,t){if(this._scene&&(this._scene.clipPlane&&e.push("#define CLIPPLANE"),this._scene.clipPlane2&&e.push("#define CLIPPLANE2"),this._scene.clipPlane3&&e.push("#define CLIPPLANE3"),this._scene.clipPlane4&&e.push("#define CLIPPLANE4"),this._scene.clipPlane5&&e.push("#define CLIPPLANE5"),this._scene.clipPlane6&&e.push("#define CLIPPLANE6")),this._isAnimationSheetEnabled&&e.push("#define ANIMATESHEET"),this.useLogarithmicDepth&&e.push("#define LOGARITHMICDEPTH"),t===h_.BLENDMODE_MULTIPLY&&e.push("#define BLENDMULTIPLYMODE"),this._useRampGradients&&e.push("#define RAMPGRADIENT"),this._isBillboardBased)switch(e.push("#define BILLBOARD"),this.billboardMode){case h_.BILLBOARDMODE_Y:e.push("#define BILLBOARDY");break;case h_.BILLBOARDMODE_STRETCHED:e.push("#define BILLBOARDSTRETCHED");break;case h_.BILLBOARDMODE_ALL:e.push("#define BILLBOARDMODE_ALL")}this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e.push(this._imageProcessingConfigurationDefines.toString()))}fillUniformsAttributesAndSamplerNames(e,t,i){t.push(...h_._GetAttributeNamesOrOptions(this._isAnimationSheetEnabled,this._isBillboardBased&&this.billboardMode!==h_.BILLBOARDMODE_STRETCHED,this._useRampGradients)),e.push(...h_._GetEffectCreationOptions(this._isAnimationSheetEnabled,this.useLogarithmicDepth)),i.push("diffuseSampler","rampSampler"),this._imageProcessingConfiguration&&(Xt.$.PrepareUniforms(e,this._imageProcessingConfigurationDefines),Xt.$.PrepareSamplers(i,this._imageProcessingConfigurationDefines))}_getWrapper(e){const t=this._getCustomDrawWrapper(e);if(null==t?void 0:t.effect)return t;const i=[];this.fillDefines(i,e);const n=this._engine._features.supportRenderPasses?this._engine.currentRenderPassId:0;let r=this._drawWrappers[n];r||(r=this._drawWrappers[n]=[]);let s=r[e];s||(s=new Tn.q(this._engine),s.drawContext&&(s.drawContext.useInstancing=this._useInstancing),r[e]=s);const o=i.join("\n");if(s.defines!==o){const e=[],t=[],i=[];this.fillUniformsAttributesAndSamplerNames(t,e,i),s.setEffect(this._engine.createEffect("particles",e,t,i,o),o)}return s}animate(e=!1){var t;if(!this._started)return;if(!e&&this._scene){if(!this.isReady())return;if(this._currentRenderId===this._scene.getFrameId())return;this._currentRenderId=this._scene.getFrameId()}let i;if(this._scaledUpdateSpeed=this.updateSpeed*(e?this.preWarmStepOffset:(null===(t=this._scene)||void 0===t?void 0:t.getAnimationRatio())||1),this.manualEmitCount>-1)i=this.manualEmitCount,this._newPartsExcess=0,this.manualEmitCount=0;else{let e=this.emitRate;if(this._emitRateGradients&&this._emitRateGradients.length>0&&this.targetStopDuration){const t=this._actualFrame/this.targetStopDuration;o_.GetCurrentGradient(t,this._emitRateGradients,((t,i,n)=>{t!==this._currentEmitRateGradient&&(this._currentEmitRate1=this._currentEmitRate2,this._currentEmitRate2=i.getFactor(),this._currentEmitRateGradient=t),e=ve.R.Lerp(this._currentEmitRate1,this._currentEmitRate2,n)}))}i=e*this._scaledUpdateSpeed>>0,this._newPartsExcess+=e*this._scaledUpdateSpeed-i}if(this._newPartsExcess>1&&(i+=this._newPartsExcess>>0,this._newPartsExcess-=this._newPartsExcess>>0),this._alive=!1,this._stopped?i=0:(this._actualFrame+=this._scaledUpdateSpeed,this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()),this._update(i),this._stopped&&(this._alive||(this._started=!1,this.onAnimationEnd&&this.onAnimationEnd(),this.disposeOnStop&&this._scene&&this._scene._toBeDisposed.push(this))),!e){let e=0;for(let t=0;t=0&&(a.invertToRef(o.jp.Matrix[0]),r.setMatrix("invView",o.jp.Matrix[0])),void 0!==this._vertexArrayObject?(this._vertexArrayObject||(this._vertexArrayObject=this._engine.recordVertexArrayObject(this._vertexBuffers,this._indexBuffer,r)),this._engine.bindVertexArrayObject(this._vertexArrayObject,this._indexBuffer)):s.bindBuffers(this._vertexBuffers,this._indexBuffer,r),this.useLogarithmicDepth&&this._scene&&lo.G.BindLogDepth(l,r,this._scene),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(r),e){case h_.BLENDMODE_ADD:s.setAlphaMode(1);break;case h_.BLENDMODE_ONEONE:s.setAlphaMode(6);break;case h_.BLENDMODE_STANDARD:s.setAlphaMode(2);break;case h_.BLENDMODE_MULTIPLY:s.setAlphaMode(4)}return this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(r),this._useInstancing?s.drawArraysType(7,0,4,this._particles.length):s.drawElementsType(0,0,6*this._particles.length),this._particles.length}render(){if(!this.isReady()||!this._particles.length)return 0;const e=this._engine;e.setState&&(e.setState(!1),this.forceDepthWrite&&e.setDepthWrite(!0));let t=0;return t=this.blendMode===h_.BLENDMODE_MULTIPLYADD?this._render(h_.BLENDMODE_MULTIPLY)+this._render(h_.BLENDMODE_ADD):this._render(this.blendMode),this._engine.unbindInstanceAttributes(),this._engine.setAlphaMode(0),t}dispose(e=!0){if(this.resetDrawCache(),this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._indexBuffer&&(this._engine._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this._vertexArrayObject&&(this._engine.releaseVertexArrayObject(this._vertexArrayObject),this._vertexArrayObject=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._removeFromRoot(),this.subEmitters&&!this._subEmitters&&this._prepareSubEmitterInternalArray(),this._subEmitters&&this._subEmitters.length){for(let e=0;e-1&&this._scene.particleSystems.splice(e,1),this._scene._activeParticleSystems.dispose()}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onStoppedObservable.clear(),this.reset()}clone(e,t){const i={...this._customWrappers};let n=null;const r=this._engine;if(r.createEffectForParticles&&null!=this.customShader){n=this.customShader;const e=n.shaderOptions.defines.length>0?n.shaderOptions.defines.join("\n"):"",t=r.createEffectForParticles(n.shaderPath.fragmentElement,n.shaderOptions.uniforms,n.shaderOptions.samplers,e);i[0]?i[0].effect=t:this.setCustomEffect(t,0)}const s=this.serialize(),o=h_.Parse(s,this._scene||this._engine,this._rootUrl);return o.name=e,o.customShader=n,o._customWrappers=i,void 0===t&&(t=this.emitter),this.noiseTexture&&(o.noiseTexture=this.noiseTexture.clone()),o.emitter=t,this.preventAutoStart||o.start(),o}serialize(e=!1){const t={};if(h_._Serialize(t,this,e),t.textureMask=this.textureMask.asArray(),t.customShader=this.customShader,t.preventAutoStart=this.preventAutoStart,this.subEmitters){t.subEmitters=[],this._subEmitters||this._prepareSubEmitterInternalArray();for(const i of this._subEmitters){const n=[];for(const t of i)n.push(t.serialize(e));t.subEmitters.push(n)}}return t}static _Serialize(e,t,i){if(e.name=t.name,e.id=t.id,e.capacity=t.getCapacity(),e.disposeOnStop=t.disposeOnStop,e.manualEmitCount=t.manualEmitCount,t.emitter.position){const i=t.emitter;e.emitterId=i.id}else{const i=t.emitter;e.emitter=i.asArray()}t.particleEmitterType&&(e.particleEmitterType=t.particleEmitterType.serialize()),t.particleTexture&&(i?e.texture=t.particleTexture.serialize():(e.textureName=t.particleTexture.name,e.invertY=!!t.particleTexture._invertY)),e.isLocal=t.isLocal,Y.p4.AppendSerializedAnimations(t,e),e.beginAnimationOnStart=t.beginAnimationOnStart,e.beginAnimationFrom=t.beginAnimationFrom,e.beginAnimationTo=t.beginAnimationTo,e.beginAnimationLoop=t.beginAnimationLoop,e.startDelay=t.startDelay,e.renderingGroupId=t.renderingGroupId,e.isBillboardBased=t.isBillboardBased,e.billboardMode=t.billboardMode,e.minAngularSpeed=t.minAngularSpeed,e.maxAngularSpeed=t.maxAngularSpeed,e.minSize=t.minSize,e.maxSize=t.maxSize,e.minScaleX=t.minScaleX,e.maxScaleX=t.maxScaleX,e.minScaleY=t.minScaleY,e.maxScaleY=t.maxScaleY,e.minEmitPower=t.minEmitPower,e.maxEmitPower=t.maxEmitPower,e.minLifeTime=t.minLifeTime,e.maxLifeTime=t.maxLifeTime,e.emitRate=t.emitRate,e.gravity=t.gravity.asArray(),e.noiseStrength=t.noiseStrength.asArray(),e.color1=t.color1.asArray(),e.color2=t.color2.asArray(),e.colorDead=t.colorDead.asArray(),e.updateSpeed=t.updateSpeed,e.targetStopDuration=t.targetStopDuration,e.blendMode=t.blendMode,e.preWarmCycles=t.preWarmCycles,e.preWarmStepOffset=t.preWarmStepOffset,e.minInitialRotation=t.minInitialRotation,e.maxInitialRotation=t.maxInitialRotation,e.startSpriteCellID=t.startSpriteCellID,e.spriteCellLoop=t.spriteCellLoop,e.endSpriteCellID=t.endSpriteCellID,e.spriteCellChangeSpeed=t.spriteCellChangeSpeed,e.spriteCellWidth=t.spriteCellWidth,e.spriteCellHeight=t.spriteCellHeight,e.spriteRandomStartCell=t.spriteRandomStartCell,e.isAnimationSheetEnabled=t.isAnimationSheetEnabled,e.useLogarithmicDepth=t.useLogarithmicDepth;const n=t.getColorGradients();if(n){e.colorGradients=[];for(const t of n){const i={gradient:t.gradient,color1:t.color1.asArray()};t.color2?i.color2=t.color2.asArray():i.color2=t.color1.asArray(),e.colorGradients.push(i)}}const r=t.getRampGradients();if(r){e.rampGradients=[];for(const t of r){const i={gradient:t.gradient,color:t.color.asArray()};e.rampGradients.push(i)}e.useRampGradients=t.useRampGradients}const s=t.getColorRemapGradients();if(s){e.colorRemapGradients=[];for(const t of s){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.colorRemapGradients.push(i)}}const o=t.getAlphaRemapGradients();if(o){e.alphaRemapGradients=[];for(const t of o){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.alphaRemapGradients.push(i)}}const a=t.getSizeGradients();if(a){e.sizeGradients=[];for(const t of a){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.sizeGradients.push(i)}}const l=t.getAngularSpeedGradients();if(l){e.angularSpeedGradients=[];for(const t of l){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.angularSpeedGradients.push(i)}}const c=t.getVelocityGradients();if(c){e.velocityGradients=[];for(const t of c){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.velocityGradients.push(i)}}const h=t.getDragGradients();if(h){e.dragGradients=[];for(const t of h){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.dragGradients.push(i)}}const _=t.getEmitRateGradients();if(_){e.emitRateGradients=[];for(const t of _){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.emitRateGradients.push(i)}}const d=t.getStartSizeGradients();if(d){e.startSizeGradients=[];for(const t of d){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.startSizeGradients.push(i)}}const u=t.getLifeTimeGradients();if(u){e.lifeTimeGradients=[];for(const t of u){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.lifeTimeGradients.push(i)}}const p=t.getLimitVelocityGradients();if(p){e.limitVelocityGradients=[];for(const t of p){const i={gradient:t.gradient,factor1:t.factor1};void 0!==t.factor2?i.factor2=t.factor2:i.factor2=t.factor1,e.limitVelocityGradients.push(i)}e.limitVelocityDamping=t.limitVelocityDamping}t.noiseTexture&&(e.noiseTexture=t.noiseTexture.serialize())}static _Parse(e,t,i,n){var r,s,c;let h;h=i instanceof Fi.B?null:i;const _=(0,l.q)("BABYLON.Texture");if(_&&h&&(e.texture?t.particleTexture=_.Parse(e.texture,h,n):e.textureName&&(t.particleTexture=new _(n+e.textureName,h,!1,void 0===e.invertY||e.invertY),t.particleTexture.name=e.textureName)),e.emitterId||0===e.emitterId||void 0!==e.emitter?e.emitterId&&h?t.emitter=h.getLastMeshById(e.emitterId):t.emitter=o.P.FromArray(e.emitter):t.emitter=o.P.Zero(),t.isLocal=!!e.isLocal,void 0!==e.renderingGroupId&&(t.renderingGroupId=e.renderingGroupId),void 0!==e.isBillboardBased&&(t.isBillboardBased=e.isBillboardBased),void 0!==e.billboardMode&&(t.billboardMode=e.billboardMode),void 0!==e.useLogarithmicDepth&&(t.useLogarithmicDepth=e.useLogarithmicDepth),e.animations){for(let i=0;i0?h.shaderOptions.defines.join("\n"):"";c=o.createEffectForParticles(h.shaderPath.fragmentElement,h.shaderOptions.uniforms,h.shaderOptions.samplers,t)}const _=new h_(s,r||e.capacity,t,c,e.isAnimationSheetEnabled);if(_.customShader=h,_._rootUrl=i,e.id&&(_.id=e.id),e.subEmitters){_.subEmitters=[];for(const n of e.subEmitters){const e=[];for(const r of n)e.push(c_.Parse(r,t,i));_.subEmitters.push(e)}}return h_._Parse(e,_,t,i),e.textureMask&&(_.textureMask=a.HE.FromArray(e.textureMask)),e.preventAutoStart&&(_.preventAutoStart=e.preventAutoStart),n||_.preventAutoStart||_.start(),_}}h_.BILLBOARDMODE_Y=2,h_.BILLBOARDMODE_ALL=7,h_.BILLBOARDMODE_STRETCHED=8,c_._ParseParticleSystem=h_.Parse;var __=i("../../../node_modules/@babylonjs/core/Particles/EmitterTypes/boxParticleEmitter.js");dt.v.IncludesShadersStore.clipPlaneFragmentDeclaration2="#ifdef CLIPPLANE\nin float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nin float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nin float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nin float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nin float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nin float fClipDistance6;\n#endif\n";dt.v.ShadersStore.gpuRenderParticlesPixelShader="precision highp float;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform sampler2D diffuseSampler;\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include \n#include\n#include\n#include\n#include\nvoid main() {\n#include \nvec4 textureColor=texture2D(diffuseSampler,vUV);\ngl_FragColor=textureColor*vColor;\n#ifdef BLENDMULTIPLYMODE\nfloat alpha=vColor.a*textureColor.a;\ngl_FragColor.rgb=gl_FragColor.rgb*alpha+vec3(1.0)*(1.0-alpha);\n#endif \n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ngl_FragColor.rgb=toLinearSpace(gl_FragColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\ngl_FragColor.rgb=toLinearSpace(gl_FragColor.rgb);\ngl_FragColor=applyImageProcessing(gl_FragColor);\n#endif\n#endif\n}\n";dt.v.IncludesShadersStore.clipPlaneVertexDeclaration2="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nout float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nout float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nout float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nout float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;\nout float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;\nout float fClipDistance6;\n#endif\n";dt.v.ShadersStore.gpuRenderParticlesVertexShader="precision highp float;\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\nuniform vec3 worldOffset;\n#ifdef LOCAL\nuniform mat4 emitterWM;\n#endif\nattribute vec3 position;\nattribute float age;\nattribute float life;\nattribute vec3 size;\n#ifndef BILLBOARD\nattribute vec3 initialDirection;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\nattribute float angle;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\nattribute vec2 offset;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying vec4 vColor;\nvarying vec3 vPositionW;\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform mat4 invView;\n#endif\n#include\n#include\n#ifdef COLORGRADIENTS\nuniform sampler2D colorGradientSampler;\n#else\nuniform vec4 colorDead;\nattribute vec4 color;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 sheetInfos;\n#endif\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix= mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\n#ifdef LOCAL\nreturn ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;\n#else\nreturn (position+worldOffset)+alignedCorner;\n#endif\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix= mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\n#ifdef LOCAL\nreturn ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;\n#else\nreturn (position+worldOffset)+alignedCorner;\n#endif\n}\n#endif\nvoid main() {\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/sheetInfos.z);\nfloat columnOffset=cellIndex-rowOffset*sheetInfos.z;\nvec2 uvScale=sheetInfos.xy;\nvec2 uvOffset=vec2(uv.x ,1.0-uv.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=uv;\n#endif\nfloat ratio=age/life;\n#ifdef COLORGRADIENTS\nvColor=texture2D(colorGradientSampler,vec2(ratio,0));\n#else\nvColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);\n#endif\nvec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;\n#ifdef BILLBOARD\nvec4 rotatedCorner;\nrotatedCorner.w=0.;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=(position+worldOffset)-eyePosition;\nyaxis.y=0.;\nvPositionW=rotate(normalize(yaxis),rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(vPositionW,1.0));\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=(position+worldOffset)-eyePosition;\nvPositionW=rotateAlign(toCamera,rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(vPositionW,1.0));\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n#ifdef LOCAL\nvec4 viewPosition=view*vec4(((emitterWM*vec4(position,1.0)).xyz+worldOffset),1.0)+rotatedCorner;\n#else\nvec4 viewPosition=view*vec4((position+worldOffset),1.0)+rotatedCorner;\n#endif\nvPositionW=(invView*viewPosition).xyz;\n#endif\n#else\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=0.;\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nvec3 yaxis=normalize(initialDirection);\nvPositionW=rotate(yaxis,rotatedCorner);\nvec4 viewPosition=view*vec4(vPositionW,1.0);\n#endif\ngl_Position=projection*viewPosition;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvec4 worldPos=vec4(vPositionW,1.0);\n#endif\n#include\n#include\n}";class d_ extends Jh.U{constructor(e,t,i,n=null,r=!1){if(super(e),this.layerMask=268435455,this._accumulatedCount=0,this._targetIndex=0,this._currentRenderId=-1,this._currentRenderingCameraUniqueId=-1,this._started=!1,this._stopped=!1,this._timeDelta=0,this._actualFrame=0,this._rawTextureWidth=256,this.onDisposeObservable=new s.y$,this.onStoppedObservable=new s.y$,this.forceDepthWrite=!1,this._preWarmDone=!1,this.isLocal=!1,this._onBeforeDrawParticlesObservable=null,i&&"Scene"!==i.getClassName()?(this._engine=i,this.defaultProjectionMatrix=o.y3.PerspectiveFovLH(.8,1,.1,100,this._engine.isNDCHalfZRange)):(this._scene=i||m.l.LastCreatedScene,this._engine=this._scene.getEngine(),this.uniqueId=this._scene.getUniqueId(),this._scene.particleSystems.push(this)),this._engine.getCaps().supportComputeShaders){if(!(0,l.q)("BABYLON.ComputeShaderParticleSystem"))throw new Error("The ComputeShaderParticleSystem class is not available! Make sure you have imported it.");this._platform=new((0,l.q)("BABYLON.ComputeShaderParticleSystem"))(this,this._engine)}else{if(!(0,l.q)("BABYLON.WebGL2ParticleSystem"))throw new Error("The WebGL2ParticleSystem class is not available! Make sure you have imported it.");this._platform=new((0,l.q)("BABYLON.WebGL2ParticleSystem"))(this,this._engine)}this._customWrappers={0:new Tn.q(this._engine)},this._customWrappers[0].effect=n,this._drawWrappers={0:new Tn.q(this._engine)},this._drawWrappers[0].drawContext&&(this._drawWrappers[0].drawContext.useInstancing=!0),this._attachImageProcessingConfiguration(null),(t=null!=t?t:{}).randomTextureSize||delete t.randomTextureSize;const a={capacity:5e4,randomTextureSize:this._engine.getCaps().maxTextureSize,...t},c=t;isFinite(c)&&(a.capacity=c),this._capacity=a.capacity,this._activeCount=a.capacity,this._currentActiveCount=0,this._isAnimationSheetEnabled=r,this.particleEmitterType=new __.S;const h=Math.min(this._engine.getCaps().maxTextureSize,a.randomTextureSize);let _=[];for(let e=0;e{this.start(0)}),e):(this._started=!0,this._stopped=!1,this._preWarmDone=!1,this.beginAnimationOnStart&&this.animations&&this.animations.length>0&&this._scene&&this._scene.beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop))}stop(){this._stopped||(this._stopped=!0)}reset(){this._releaseBuffers(),this._platform.releaseVertexBuffers(),this._currentActiveCount=0,this._targetIndex=0}getClassName(){return"GPUParticleSystem"}getCustomEffect(e=0){var t,i;return null!==(i=null===(t=this._customWrappers[e])||void 0===t?void 0:t.effect)&&void 0!==i?i:this._customWrappers[0].effect}_getCustomDrawWrapper(e=0){var t;return null!==(t=this._customWrappers[e])&&void 0!==t?t:this._customWrappers[0]}setCustomEffect(e,t=0){this._customWrappers[t]=new Tn.q(this._engine),this._customWrappers[t].effect=e}get onBeforeDrawParticlesObservable(){return this._onBeforeDrawParticlesObservable||(this._onBeforeDrawParticlesObservable=new s.y$),this._onBeforeDrawParticlesObservable}get vertexShaderName(){return"gpuRenderParticles"}_removeGradientAndTexture(e,t,i){return super._removeGradientAndTexture(e,t,i),this._releaseBuffers(),this}addColorGradient(e,t){this._colorGradients||(this._colorGradients=[]);const i=new n_(e,t);return this._colorGradients.push(i),this._refreshColorGradient(!0),this._releaseBuffers(),this}_refreshColorGradient(e=!1){this._colorGradients&&(e&&this._colorGradients.sort(((e,t)=>e.gradientt.gradient?1:0)),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null))}forceRefreshGradients(){this._refreshColorGradient(),this._refreshFactorGradient(this._sizeGradients,"_sizeGradientsTexture"),this._refreshFactorGradient(this._angularSpeedGradients,"_angularSpeedGradientsTexture"),this._refreshFactorGradient(this._velocityGradients,"_velocityGradientsTexture"),this._refreshFactorGradient(this._limitVelocityGradients,"_limitVelocityGradientsTexture"),this._refreshFactorGradient(this._dragGradients,"_dragGradientsTexture"),this.reset()}removeColorGradient(e){return this._removeGradientAndTexture(e,this._colorGradients,this._colorGradientsTexture),this._colorGradientsTexture=null,this}resetDrawCache(){var e;for(const t in this._drawWrappers)null===(e=this._drawWrappers[t].drawContext)||void 0===e||e.reset()}_addFactorGradient(e,t,i){const n=new s_(t,i);e.push(n),this._releaseBuffers()}addSizeGradient(e,t){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t),this._refreshFactorGradient(this._sizeGradients,"_sizeGradientsTexture",!0),this._releaseBuffers(),this}removeSizeGradient(e){return this._removeGradientAndTexture(e,this._sizeGradients,this._sizeGradientsTexture),this._sizeGradientsTexture=null,this}_refreshFactorGradient(e,t,i=!1){if(!e)return;i&&e.sort(((e,t)=>e.gradientt.gradient?1:0));const n=this;n[t]&&(n[t].dispose(),n[t]=null)}addAngularSpeedGradient(e,t){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t),this._refreshFactorGradient(this._angularSpeedGradients,"_angularSpeedGradientsTexture",!0),this._releaseBuffers(),this}removeAngularSpeedGradient(e){return this._removeGradientAndTexture(e,this._angularSpeedGradients,this._angularSpeedGradientsTexture),this._angularSpeedGradientsTexture=null,this}addVelocityGradient(e,t){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t),this._refreshFactorGradient(this._velocityGradients,"_velocityGradientsTexture",!0),this._releaseBuffers(),this}removeVelocityGradient(e){return this._removeGradientAndTexture(e,this._velocityGradients,this._velocityGradientsTexture),this._velocityGradientsTexture=null,this}addLimitVelocityGradient(e,t){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t),this._refreshFactorGradient(this._limitVelocityGradients,"_limitVelocityGradientsTexture",!0),this._releaseBuffers(),this}removeLimitVelocityGradient(e){return this._removeGradientAndTexture(e,this._limitVelocityGradients,this._limitVelocityGradientsTexture),this._limitVelocityGradientsTexture=null,this}addDragGradient(e,t){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t),this._refreshFactorGradient(this._dragGradients,"_dragGradientsTexture",!0),this._releaseBuffers(),this}removeDragGradient(e){return this._removeGradientAndTexture(e,this._dragGradients,this._dragGradientsTexture),this._dragGradientsTexture=null,this}addEmitRateGradient(){return this}removeEmitRateGradient(){return this}addStartSizeGradient(){return this}removeStartSizeGradient(){return this}addColorRemapGradient(){return this}removeColorRemapGradient(){return this}addAlphaRemapGradient(){return this}removeAlphaRemapGradient(){return this}addRampGradient(){return this}removeRampGradient(){return this}getRampGradients(){return null}get useRampGradients(){return!1}set useRampGradients(e){}addLifeTimeGradient(){return this}removeLifeTimeGradient(){return this}_reset(){this._releaseBuffers()}_createVertexBuffers(e,t,i){const n={};n.position=t.createVertexBuffer("position",0,3,this._attributesStrideSize,!0);let r=3;n.age=t.createVertexBuffer("age",r,1,this._attributesStrideSize,!0),r+=1,n.size=t.createVertexBuffer("size",r,3,this._attributesStrideSize,!0),r+=3,n.life=t.createVertexBuffer("life",r,1,this._attributesStrideSize,!0),r+=1,r+=4,this.billboardMode===h_.BILLBOARDMODE_STRETCHED&&(n.direction=t.createVertexBuffer("direction",r,3,this._attributesStrideSize,!0)),r+=3,this._platform.alignDataInBuffer&&(r+=1),this.particleEmitterType instanceof t_.E&&(r+=3,this._platform.alignDataInBuffer&&(r+=1)),this._colorGradientsTexture||(n.color=t.createVertexBuffer("color",r,4,this._attributesStrideSize,!0),r+=4),this._isBillboardBased||(n.initialDirection=t.createVertexBuffer("initialDirection",r,3,this._attributesStrideSize,!0),r+=3,this._platform.alignDataInBuffer&&(r+=1)),this.noiseTexture&&(n.noiseCoordinates1=t.createVertexBuffer("noiseCoordinates1",r,3,this._attributesStrideSize,!0),r+=3,this._platform.alignDataInBuffer&&(r+=1),n.noiseCoordinates2=t.createVertexBuffer("noiseCoordinates2",r,3,this._attributesStrideSize,!0),r+=3,this._platform.alignDataInBuffer&&(r+=1)),n.angle=t.createVertexBuffer("angle",r,1,this._attributesStrideSize,!0),this._angularSpeedGradientsTexture?r++:r+=2,this._isAnimationSheetEnabled&&(n.cellIndex=t.createVertexBuffer("cellIndex",r,1,this._attributesStrideSize,!0),r+=1,this.spriteRandomStartCell&&(n.cellStartOffset=t.createVertexBuffer("cellStartOffset",r,1,this._attributesStrideSize,!0),r+=1)),n.offset=i.createVertexBuffer("offset",0,2),n.uv=i.createVertexBuffer("uv",2,2),this._platform.createVertexBuffers(e,n),this.resetDrawCache()}_initialize(e=!1){if(this._buffer0&&!e)return;const t=this._engine,i=new Array;this._attributesStrideSize=21,this._targetIndex=0,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1),this.particleEmitterType instanceof t_.E&&(this._attributesStrideSize+=3,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1)),this.isBillboardBased||(this._attributesStrideSize+=3,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1)),this._colorGradientsTexture&&(this._attributesStrideSize-=4),this._angularSpeedGradientsTexture&&(this._attributesStrideSize-=1),this._isAnimationSheetEnabled&&(this._attributesStrideSize+=1,this.spriteRandomStartCell&&(this._attributesStrideSize+=1)),this.noiseTexture&&(this._attributesStrideSize+=6,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=2)),this._platform.alignDataInBuffer&&(this._attributesStrideSize+=3-(this._attributesStrideSize+3&3));const n=this.particleEmitterType instanceof t_.E,r=o.jp.Vector3[0];let s=0;for(let e=0;e0;)i.push(0)}const a=new Float32Array([.5,.5,1,1,-.5,.5,0,1,.5,-.5,1,0,-.5,-.5,0,0]),l=this._platform.createParticleBuffer(i),c=this._platform.createParticleBuffer(i);this._buffer0=new le.l(t,l,!1,this._attributesStrideSize),this._buffer1=new le.l(t,c,!1,this._attributesStrideSize),this._spriteBuffer=new le.l(t,a,!1,4),this._createVertexBuffers(this._buffer0,this._buffer1,this._spriteBuffer),this._createVertexBuffers(this._buffer1,this._buffer0,this._spriteBuffer),this._sourceBuffer=this._buffer0,this._targetBuffer=this._buffer1}_recreateUpdateEffect(){let e=this.particleEmitterType?this.particleEmitterType.getEffectDefines():"";this._isBillboardBased&&(e+="\n#define BILLBOARD"),this._colorGradientsTexture&&(e+="\n#define COLORGRADIENTS"),this._sizeGradientsTexture&&(e+="\n#define SIZEGRADIENTS"),this._angularSpeedGradientsTexture&&(e+="\n#define ANGULARSPEEDGRADIENTS"),this._velocityGradientsTexture&&(e+="\n#define VELOCITYGRADIENTS"),this._limitVelocityGradientsTexture&&(e+="\n#define LIMITVELOCITYGRADIENTS"),this._dragGradientsTexture&&(e+="\n#define DRAGGRADIENTS"),this.isAnimationSheetEnabled&&(e+="\n#define ANIMATESHEET",this.spriteRandomStartCell&&(e+="\n#define ANIMATESHEETRANDOMSTART")),this.noiseTexture&&(e+="\n#define NOISE"),this.isLocal&&(e+="\n#define LOCAL"),this._platform.isUpdateBufferCreated()&&this._cachedUpdateDefines===e||(this._cachedUpdateDefines=e,this._updateBuffer=this._platform.createUpdateBuffer(e))}_getWrapper(e){const t=this._getCustomDrawWrapper(e);if(null==t?void 0:t.effect)return t;const i=[];this.fillDefines(i,e);let n=this._drawWrappers[e];n||(n=new Tn.q(this._engine),n.drawContext&&(n.drawContext.useInstancing=!0),this._drawWrappers[e]=n);const r=i.join("\n");if(n.defines!==r){const e=[],t=[],i=[];this.fillUniformsAttributesAndSamplerNames(t,e,i),n.setEffect(this._engine.createEffect("gpuRenderParticles",e,t,i,r),r)}return n}static _GetAttributeNamesOrOptions(e=!1,t=!1,i=!1,n=!1){const r=[le.o.PositionKind,"age","life","size","angle"];return e||r.push(le.o.ColorKind),t&&r.push("cellIndex"),i||r.push("initialDirection"),n||r.push("direction"),r.push("offset",le.o.UVKind),r}static _GetEffectCreationOptions(e=!1,t=!1){const i=["emitterWM","worldOffset","view","projection","colorDead","invView","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","translationPivot","eyePosition"];return e&&i.push("sheetInfos"),t&&i.push("logarithmicDepthConstant"),i}fillDefines(e,t=0){if(this._scene&&(this._scene.clipPlane&&e.push("#define CLIPPLANE"),this._scene.clipPlane2&&e.push("#define CLIPPLANE2"),this._scene.clipPlane3&&e.push("#define CLIPPLANE3"),this._scene.clipPlane4&&e.push("#define CLIPPLANE4"),this._scene.clipPlane5&&e.push("#define CLIPPLANE5"),this._scene.clipPlane6&&e.push("#define CLIPPLANE6")),t===h_.BLENDMODE_MULTIPLY&&e.push("#define BLENDMULTIPLYMODE"),this.isLocal&&e.push("#define LOCAL"),this.useLogarithmicDepth&&e.push("#define LOGARITHMICDEPTH"),this._isBillboardBased)switch(e.push("#define BILLBOARD"),this.billboardMode){case h_.BILLBOARDMODE_Y:e.push("#define BILLBOARDY");break;case h_.BILLBOARDMODE_STRETCHED:e.push("#define BILLBOARDSTRETCHED");break;case h_.BILLBOARDMODE_ALL:e.push("#define BILLBOARDMODE_ALL")}this._colorGradientsTexture&&e.push("#define COLORGRADIENTS"),this.isAnimationSheetEnabled&&e.push("#define ANIMATESHEET"),this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e.push(""+this._imageProcessingConfigurationDefines.toString()))}fillUniformsAttributesAndSamplerNames(e,t,i){t.push(...d_._GetAttributeNamesOrOptions(!!this._colorGradientsTexture,this._isAnimationSheetEnabled,this._isBillboardBased,this._isBillboardBased&&this.billboardMode===h_.BILLBOARDMODE_STRETCHED)),e.push(...d_._GetEffectCreationOptions(this._isAnimationSheetEnabled,this.useLogarithmicDepth)),i.push("diffuseSampler","colorGradientSampler"),this._imageProcessingConfiguration&&(Xt.$.PrepareUniforms(e,this._imageProcessingConfigurationDefines),Xt.$.PrepareSamplers(i,this._imageProcessingConfigurationDefines))}animate(e=!1){var t;this._timeDelta=this.updateSpeed*(e?this.preWarmStepOffset:(null===(t=this._scene)||void 0===t?void 0:t.getAnimationRatio())||1),this._actualFrame+=this._timeDelta,this._stopped||this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()}_createFactorGradientTexture(e,t){const i=this[t];if(!e||!e.length||i)return;const n=new Float32Array(this._rawTextureWidth);for(let t=0;t{n[t]=ve.R.Lerp(e.factor1,i.factor1,r)}))}this[t]=q.l.CreateRTexture(n,this._rawTextureWidth,1,this._scene||this._engine,!1,!1,1)}_createSizeGradientTexture(){this._createFactorGradientTexture(this._sizeGradients,"_sizeGradientsTexture")}_createAngularSpeedGradientTexture(){this._createFactorGradientTexture(this._angularSpeedGradients,"_angularSpeedGradientsTexture")}_createVelocityGradientTexture(){this._createFactorGradientTexture(this._velocityGradients,"_velocityGradientsTexture")}_createLimitVelocityGradientTexture(){this._createFactorGradientTexture(this._limitVelocityGradients,"_limitVelocityGradientsTexture")}_createDragGradientTexture(){this._createFactorGradientTexture(this._dragGradients,"_dragGradientsTexture")}_createColorGradientTexture(){if(!this._colorGradients||!this._colorGradients.length||this._colorGradientsTexture)return;const e=new Uint8Array(4*this._rawTextureWidth),t=a.zZ.Color4[0];for(let i=0;i{a.HE.LerpToRef(n.color1,r.color1,s,t),e[4*i]=255*t.r,e[4*i+1]=255*t.g,e[4*i+2]=255*t.b,e[4*i+3]=255*t.a}))}this._colorGradientsTexture=q.l.CreateRGBATexture(e,this._rawTextureWidth,1,this._scene,!1,!1,1)}_render(e,t){var i,n;const r=this._getWrapper(e),s=r.effect;this._engine.enableEffect(r);const a=(null===(i=this._scene)||void 0===i?void 0:i.getViewMatrix())||o.y3.IdentityReadOnly;if(s.setMatrix("view",a),s.setMatrix("projection",null!==(n=this.defaultProjectionMatrix)&&void 0!==n?n:this._scene.getProjectionMatrix()),s.setTexture("diffuseSampler",this.particleTexture),s.setVector2("translationPivot",this.translationPivot),s.setVector3("worldOffset",this.worldOffset),this.isLocal&&s.setMatrix("emitterWM",t),this._colorGradientsTexture?s.setTexture("colorGradientSampler",this._colorGradientsTexture):s.setDirectColor4("colorDead",this.colorDead),this._isAnimationSheetEnabled&&this.particleTexture){const e=this.particleTexture.getBaseSize();s.setFloat3("sheetInfos",this.spriteCellWidth/e.width,this.spriteCellHeight/e.height,e.width/this.spriteCellWidth)}if(this._isBillboardBased&&this._scene){const e=this._scene.activeCamera;s.setVector3("eyePosition",e.globalPosition)}const l=s.defines;if(this._scene&&(this._scene.clipPlane||this._scene.clipPlane2||this._scene.clipPlane3||this._scene.clipPlane4||this._scene.clipPlane5||this._scene.clipPlane6)&&lo.G.BindClipPlane(s,this._scene),l.indexOf("#define BILLBOARDMODE_ALL")>=0){const e=a.clone();e.invert(),s.setMatrix("invView",e)}switch(this.useLogarithmicDepth&&this._scene&&lo.G.BindLogDepth(l,s,this._scene),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(s),e){case h_.BLENDMODE_ADD:this._engine.setAlphaMode(1);break;case h_.BLENDMODE_ONEONE:this._engine.setAlphaMode(6);break;case h_.BLENDMODE_STANDARD:this._engine.setAlphaMode(2);break;case h_.BLENDMODE_MULTIPLY:this._engine.setAlphaMode(4)}return this._platform.bindDrawBuffers(this._targetIndex,s),this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(s),this._engine.drawArraysType(7,0,4,this._currentActiveCount),this._engine.setAlphaMode(0),this._currentActiveCount}render(e=!1,t=!1){if(!this._started)return 0;if(this._createColorGradientTexture(),this._createSizeGradientTexture(),this._createAngularSpeedGradientTexture(),this._createVelocityGradientTexture(),this._createLimitVelocityGradientTexture(),this._createDragGradientTexture(),this._recreateUpdateEffect(),!this.isReady())return 0;if(!e&&this._scene){if(!this._preWarmDone&&this.preWarmCycles){for(let e=0;e1){const e=0|this._accumulatedCount;this._accumulatedCount-=e,this._currentActiveCount=Math.min(this._activeCount,this._currentActiveCount+e)}if(!this._currentActiveCount)return 0;let i;if(this.emitter.position)i=this.emitter.getWorldMatrix();else{const e=this.emitter;i=o.y3.Translation(e.x,e.y,e.z)}const n=this._engine;this._platform.preUpdateParticleBuffer(),this._updateBuffer.setFloat("currentCount",this._currentActiveCount),this._updateBuffer.setFloat("timeDelta",this._timeDelta),this._updateBuffer.setFloat("stopFactor",this._stopped?0:1),this._updateBuffer.setInt("randomTextureSize",this._randomTextureSize),this._updateBuffer.setFloat2("lifeTime",this.minLifeTime,this.maxLifeTime),this._updateBuffer.setFloat2("emitPower",this.minEmitPower,this.maxEmitPower),this._colorGradientsTexture||(this._updateBuffer.setDirectColor4("color1",this.color1),this._updateBuffer.setDirectColor4("color2",this.color2)),this._updateBuffer.setFloat2("sizeRange",this.minSize,this.maxSize),this._updateBuffer.setFloat4("scaleRange",this.minScaleX,this.maxScaleX,this.minScaleY,this.maxScaleY),this._updateBuffer.setFloat4("angleRange",this.minAngularSpeed,this.maxAngularSpeed,this.minInitialRotation,this.maxInitialRotation),this._updateBuffer.setVector3("gravity",this.gravity),this._limitVelocityGradientsTexture&&this._updateBuffer.setFloat("limitVelocityDamping",this.limitVelocityDamping),this.particleEmitterType&&this.particleEmitterType.applyToShader(this._updateBuffer),this._isAnimationSheetEnabled&&this._updateBuffer.setFloat4("cellInfos",this.startSpriteCellID,this.endSpriteCellID,this.spriteCellChangeSpeed,this.spriteCellLoop?1:0),this.noiseTexture&&this._updateBuffer.setVector3("noiseStrength",this.noiseStrength),this.isLocal||this._updateBuffer.setMatrix("emitterWM",i),this._platform.updateParticleBuffer(this._targetIndex,this._targetBuffer,this._currentActiveCount);let r=0;e||t||(n.setState(!1),this.forceDepthWrite&&n.setDepthWrite(!0),r=this.blendMode===h_.BLENDMODE_MULTIPLYADD?this._render(h_.BLENDMODE_MULTIPLY,i)+this._render(h_.BLENDMODE_ADD,i):this._render(this.blendMode,i),this._engine.setAlphaMode(0)),this._targetIndex++,2===this._targetIndex&&(this._targetIndex=0);const s=this._sourceBuffer;return this._sourceBuffer=this._targetBuffer,this._targetBuffer=s,r}rebuild(){this._initialize(!0)}_releaseBuffers(){this._buffer0&&(this._buffer0.dispose(),this._buffer0=null),this._buffer1&&(this._buffer1.dispose(),this._buffer1=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._platform.releaseBuffers()}dispose(e=!0){for(const e in this._drawWrappers)this._drawWrappers[e].dispose();if(this._drawWrappers={},this._scene){const e=this._scene.particleSystems.indexOf(this);e>-1&&this._scene.particleSystems.splice(e,1)}this._releaseBuffers(),this._platform.releaseVertexBuffers(),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null),this._sizeGradientsTexture&&(this._sizeGradientsTexture.dispose(),this._sizeGradientsTexture=null),this._angularSpeedGradientsTexture&&(this._angularSpeedGradientsTexture.dispose(),this._angularSpeedGradientsTexture=null),this._velocityGradientsTexture&&(this._velocityGradientsTexture.dispose(),this._velocityGradientsTexture=null),this._limitVelocityGradientsTexture&&(this._limitVelocityGradientsTexture.dispose(),this._limitVelocityGradientsTexture=null),this._dragGradientsTexture&&(this._dragGradientsTexture.dispose(),this._dragGradientsTexture=null),this._randomTexture&&(this._randomTexture.dispose(),this._randomTexture=null),this._randomTexture2&&(this._randomTexture2.dispose(),this._randomTexture2=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this.onStoppedObservable.clear(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()}clone(e,t){const i={...this._customWrappers};let n=null;const r=this._engine;if(r.createEffectForParticles&&null!=this.customShader){n=this.customShader;const e=n.shaderOptions.defines.length>0?n.shaderOptions.defines.join("\n"):"";i[0]=r.createEffectForParticles(n.shaderPath.fragmentElement,n.shaderOptions.uniforms,n.shaderOptions.samplers,e,void 0,void 0,void 0,this)}const s=this.serialize(),o=d_.Parse(s,this._scene||this._engine,this._rootUrl);return o.name=e,o.customShader=n,o._customWrappers=i,void 0===t&&(t=this.emitter),this.noiseTexture&&(o.noiseTexture=this.noiseTexture.clone()),o.emitter=t,o}serialize(e=!1){const t={};return h_._Serialize(t,this,e),t.activeParticleCount=this.activeParticleCount,t.randomTextureSize=this._randomTextureSize,t.customShader=this.customShader,t}static Parse(e,t,i,n=!1,r){const s=e.name;let o,a;t instanceof Fi.B?o=t:(a=t,o=a.getEngine());const l=new d_(s,{capacity:r||e.capacity,randomTextureSize:e.randomTextureSize},t,null,e.isAnimationSheetEnabled);if(l._rootUrl=i,e.customShader&&o.createEffectForParticles){const t=e.customShader,i=t.shaderOptions.defines.length>0?t.shaderOptions.defines.join("\n"):"",n=o.createEffectForParticles(t.shaderPath.fragmentElement,t.shaderOptions.uniforms,t.shaderOptions.samplers,i,void 0,void 0,void 0,l);l.setCustomEffect(n,0),l.customShader=t}return e.id&&(l.id=e.id),e.activeParticleCount&&(l.activeParticleCount=e.activeParticleCount),h_._Parse(e,l,t,i),e.preventAutoStart&&(l.preventAutoStart=e.preventAutoStart),n||l.preventAutoStart||l.start(),l}}class u_{constructor(){this._emitterNodeIsOwned=!0,this.systems=new Array}get emitterNode(){return this._emitterNode}set emitterNode(e){this._emitterNodeIsOwned&&this._emitterNode&&(this._emitterNode.dispose&&this._emitterNode.dispose(),this._emitterNodeIsOwned=!1);for(const t of this.systems)t.emitter=e;this._emitterNode=e}setEmitterAsSphere(e,t,i){this._emitterNodeIsOwned&&this._emitterNode&&this._emitterNode.dispose&&this._emitterNode.dispose(),this._emitterNodeIsOwned=!0,this._emitterCreationOptions={kind:"Sphere",options:e,renderingGroupId:t};const n=en("emitterSphere",{diameter:e.diameter,segments:e.segments},i);n.renderingGroupId=t;const r=new Yt.K("emitterSphereMaterial",i);r.emissiveColor=e.color,n.material=r;for(const e of this.systems)e.emitter=n;this._emitterNode=n}start(e){for(const t of this.systems)e&&(t.emitter=e),t.start()}dispose(){for(const e of this.systems)e.dispose();this.systems.length=0,this._emitterNode&&(this._emitterNode.dispose&&this._emitterNode.dispose(),this._emitterNode=null)}serialize(e=!1){const t={systems:[]};for(const i of this.systems)t.systems.push(i.serialize(e));return this._emitterNode&&(t.emitter=this._emitterCreationOptions),t}static Parse(e,t,i=!1,n){const r=new u_,s=this.BaseAssetsUrl+"/textures/";t=t||m.l.LastCreatedScene;for(const o of e.systems)r.systems.push(i?d_.Parse(o,t,s,!0,n):h_.Parse(o,t,s,!0,n));if(e.emitter){const i=e.emitter.options;"Sphere"===e.emitter.kind&&r.setEmitterAsSphere({diameter:i.diameter,segments:i.segments,color:a.Wo.FromArray(i.color)},e.emitter.renderingGroupId,t)}return r}}u_.BaseAssetsUrl="https://assets.babylonjs.com/particles";class p_{static CreateDefault(e,t=500,i,n=!1){let r;return r=n?new d_("default system",{capacity:t},i):new h_("default system",t,i),r.emitter=e,r.particleTexture=new K.x("https://assets.babylonjs.com/textures/flare.png",r.getScene()),r.createConeEmitter(.1,Math.PI/4),r.color1=new a.HE(1,1,1,1),r.color2=new a.HE(1,1,1,1),r.colorDead=new a.HE(1,1,1,0),r.minSize=.1,r.maxSize=.1,r.minEmitPower=2,r.maxEmitPower=2,r.updateSpeed=1/60,r.emitRate=30,r}static CreateAsync(e,t,i=!1,n){t||(t=m.l.LastCreatedScene);const r={};return t.addPendingData(r),new Promise(((s,o)=>{if(i&&!d_.IsSupported)return t.removePendingData(r),o("Particle system with GPU is not supported.");V.w1.LoadFile(`${p_.BaseAssetsUrl}/systems/${e}.json`,(e=>{t.removePendingData(r);const o=JSON.parse(e.toString());return s(u_.Parse(o,t,i,n))}),void 0,void 0,void 0,(()=>(t.removePendingData(r),o(`An error occurred with the creation of your particle system. Check if your type '${e}' exists.`))))}))}static ExportSet(e){const t=new u_;for(const i of e)t.systems.push(i);return t}static ParseFromFileAsync(e,t,i,n=!1,r="",s){return new Promise(((o,a)=>{const l=new Ll.g;l.addEventListener("readystatechange",(()=>{if(4==l.readyState)if(200==l.status){const t=JSON.parse(l.responseText);let a;a=n?d_.Parse(t,i,r,!1,s):h_.Parse(t,i,r,!1,s),e&&(a.name=e),o(a)}else a("Unable to load the particle system")})),l.open("GET",t),l.send()}))}static ParseFromSnippetAsync(e,t,i=!1,n="",r){if("_BLANK"===e){const e=this.CreateDefault(null);return e.start(),Promise.resolve(e)}return new Promise(((s,o)=>{const a=new Ll.g;a.addEventListener("readystatechange",(()=>{if(4==a.readyState)if(200==a.status){const o=JSON.parse(JSON.parse(a.responseText).jsonPayload),l=JSON.parse(o.particleSystem);let c;c=i?d_.Parse(l,t,n,!1,r):h_.Parse(l,t,n,!1,r),c.snippetId=e,s(c)}else o("Unable to load the snippet "+e)})),a.open("GET",this.SnippetUrl+"/"+e.replace(/#/g,"/")),a.send()}))}}var f_,m_,g_;p_.BaseAssetsUrl=u_.BaseAssetsUrl,p_.SnippetUrl="https://snippet.babylonjs.com",p_.CreateFromSnippetAsync=p_.ParseFromSnippetAsync,n.p.AddParser(z.l.NAME_PARTICLESYSTEM,((e,t,i,r)=>{const s=n.p.GetIndividualParser(z.l.NAME_PARTICLESYSTEM);if(s&&void 0!==e.particleSystems&&null!==e.particleSystems)for(let n=0,o=e.particleSystems.length;ne.activeParticleCount?d_.Parse(e,t,i):h_.Parse(e,t,i))),k.D.prototype.createEffectForParticles=function(e,t=[],i=[],n="",r,s,o,a){var l;let c=[],h=[];const _=[];return a?a.fillUniformsAttributesAndSamplerNames(h,c,_):(c=h_._GetAttributeNamesOrOptions(),h=h_._GetEffectCreationOptions()),-1===n.indexOf(" BILLBOARD")&&(n+="\n#define BILLBOARD\n"),-1===i.indexOf("diffuseSampler")&&i.push("diffuseSampler"),this.createEffect({vertex:null!==(l=null==a?void 0:a.vertexShaderName)&&void 0!==l?l:"particles",fragmentElement:e},c,h.concat(t),_.concat(i),n,r,s,o)},je.Kj.prototype.getEmittedParticleSystems=function(){const e=new Array;for(let t=0;t0)for(this._physicsTimeAccumulator+=e;this._physicsTimeAccumulator>t;)this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(t/1e3),this.onAfterPhysicsObservable.notifyObservers(this),this._physicsTimeAccumulator-=t;else this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(e/1e3),this.onAfterPhysicsObservable.notifyObservers(this)}},Object.defineProperty(zi.x.prototype,"physicsImpostor",{get:function(){return this._physicsImpostor},set:function(e){this._physicsImpostor!==e&&(this._disposePhysicsObserver&&this.onDisposeObservable.remove(this._disposePhysicsObserver),this._physicsImpostor=e,e&&(this._disposePhysicsObserver=this.onDisposeObservable.add((()=>{this.physicsImpostor&&(this.physicsImpostor.dispose(),this.physicsImpostor=null)}))))},enumerable:!0,configurable:!0}),zi.x.prototype.getPhysicsImpostor=function(){return this.physicsImpostor},zi.x.prototype.applyImpulse=function(e,t){return this.physicsImpostor?(this.physicsImpostor.applyImpulse(e,t),this):this},zi.x.prototype.setPhysicsLinkWith=function(e,t,i,n){return this.physicsImpostor&&e.physicsImpostor?(this.physicsImpostor.createJoint(e.physicsImpostor,Ha.q7.HingeJoint,{mainPivot:t,connectedPivot:i,nativeParams:n}),this):this};class b_{constructor(e){this.name=z.l.NAME_PHYSICSENGINE,this.scene=e,this.scene.onBeforePhysicsObservable=new s.y$,this.scene.onAfterPhysicsObservable=new s.y$,this.scene.getDeterministicFrameTime=()=>this.scene._physicsEngine?1e3*this.scene._physicsEngine.getTimeStep():1e3/60}register(){}rebuild(){}dispose(){this.scene.onBeforePhysicsObservable.clear(),this.scene.onAfterPhysicsObservable.clear(),this.scene._physicsEngine&&this.scene.disablePhysicsEngine()}}!function(e){e[e.Constant=0]="Constant",e[e.Linear=1]="Linear"}(m_||(m_={})),function(e){e[e.Center=0]="Center",e[e.Perpendicular=1]="Perpendicular"}(g_||(g_={}));dt.v.ShadersStore.blackAndWhitePixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float degree;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec3 color=texture2D(textureSampler,vUV).rgb;\nfloat luminance=dot(color,vec3(0.3,0.59,0.11)); \nvec3 blackAndWhite=vec3(luminance,luminance,luminance);\ngl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);\n}";class y_ extends _t.D{constructor(e,t,i,n,r,s){super(e,"blackAndWhite",["degree"],null,t,i,n,r,s),this.degree=1,this.onApplyObservable.add((e=>{e.setFloat("degree",this.degree)}))}getClassName(){return"BlackAndWhitePostProcess"}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new y_(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)),e,i,n)}}(0,X.gn)([(0,Y.qC)()],y_.prototype,"degree",void 0),(0,l.H)("BABYLON.BlackAndWhitePostProcess",y_);class v_{constructor(e,t,i,n){this._name=t,this._singleInstance=n||!0,this._getPostProcesses=i,this._cameras={},this._indicesForCamera={},this._postProcesses={}}get isSupported(){for(const e in this._postProcesses)if(Object.prototype.hasOwnProperty.call(this._postProcesses,e)){const t=this._postProcesses[e];for(let e=0;e{const t=n.attachPostProcess(e);this._indicesForCamera[r].push(t)})),this._cameras[r]||(this._cameras[r]=n)}}_detachCameras(e){const t=V.w1.MakeArray(e||this._cameras);if(t)for(let e=0;e{i.detachPostProcess(e)})),this._cameras[n]&&(this._cameras[n]=null)}}_enable(e){const t=V.w1.MakeArray(e||this._cameras);if(t)for(let e=0;e{t[e].attachPostProcess(i,this._indicesForCamera[n][r])}))}}_disable(e){const t=V.w1.MakeArray(e||this._cameras);if(t)for(let e=0;e{i.detachPostProcess(e)}))}}getPostProcesses(e){return this._singleInstance?this._postProcesses[0]:e?this._postProcesses[e.name]:null}}dt.v.ShadersStore.extractHighlightsPixelShader="#include\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float threshold;\nuniform float exposure;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\ngl_FragColor=texture2D(textureSampler,vUV);\nfloat luma=dot(LuminanceEncodeApprox,gl_FragColor.rgb*exposure);\ngl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;\n}";class A_ extends _t.D{constructor(e,t,i,n,r,s,o=0,a=!1){super(e,"extractHighlights",["threshold","exposure"],null,t,i,n,r,s,null,o,void 0,null,a),this.threshold=.9,this._exposure=1,this._inputPostProcess=null,this.onApplyObservable.add((e=>{this.externalTextureSamplerBinding=!!this._inputPostProcess,this._inputPostProcess&&e.setTextureFromPostProcess("textureSampler",this._inputPostProcess),e.setFloat("threshold",Math.pow(this.threshold,$.zp)),e.setFloat("exposure",this._exposure)}))}getClassName(){return"ExtractHighlightsPostProcess"}}(0,X.gn)([(0,Y.qC)()],A_.prototype,"threshold",void 0),(0,l.H)("BABYLON.ExtractHighlightsPostProcess",A_);dt.v.ShadersStore.bloomMergePixelShader="uniform sampler2D textureSampler;\nuniform sampler2D bloomBlur;\nvarying vec2 vUV;\nuniform float bloomWeight;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec3 blurred=texture2D(bloomBlur,vUV).rgb;\ngl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight); \n}\n";class C_ extends _t.D{constructor(e,t,i,n,r,s,o,a,l,c=0,h=!1){super(e,"bloomMerge",["bloomWeight"],["bloomBlur"],r,s,o,a,l,null,c,void 0,null,!0),this.weight=1,this.weight=n,this.externalTextureSamplerBinding=!0,this.onApplyObservable.add((e=>{e.setTextureFromPostProcess("textureSampler",t),e.setTextureFromPostProcessOutput("bloomBlur",i),e.setFloat("bloomWeight",this.weight)})),h||this.updateEffect()}getClassName(){return"BloomMergePostProcess"}}(0,X.gn)([(0,Y.qC)()],C_.prototype,"weight",void 0),(0,l.H)("BABYLON.BloomMergePostProcess",C_);class S_ extends v_{constructor(e,t,i,n,r=0,s=!1){super(e.getEngine(),"bloom",(()=>this._effects),!0),this._bloomScale=t,this._effects=[],this._downscale=new A_("highlights",1,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,s),this._blurX=new so("horizontal blur",new o.FM(1,0),10,t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,void 0,s),this._blurX.alwaysForcePOT=!0,this._blurX.autoClear=!1,this._blurY=new so("vertical blur",new o.FM(0,1),10,t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,void 0,s),this._blurY.alwaysForcePOT=!0,this._blurY.autoClear=!1,this.kernel=n,this._effects=[this._downscale,this._blurX,this._blurY],this._merge=new C_("bloomMerge",this._downscale,this._blurY,i,t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,s),this._merge.autoClear=!1,this._effects.push(this._merge)}get threshold(){return this._downscale.threshold}set threshold(e){this._downscale.threshold=e}get weight(){return this._merge.weight}set weight(e){this._merge.weight=e}get kernel(){return this._blurX.kernel/this._bloomScale}set kernel(e){this._blurX.kernel=e*this._bloomScale,this._blurY.kernel=e*this._bloomScale}disposeEffects(e){for(let t=0;t{e.setFloat("chromatic_aberration",this.aberrationAmount),e.setFloat("screen_width",t),e.setFloat("screen_height",i),e.setFloat("radialIntensity",this.radialIntensity),e.setFloat2("direction",this.direction.x,this.direction.y),e.setFloat2("centerPosition",this.centerPosition.x,this.centerPosition.y)}))}getClassName(){return"ChromaticAberrationPostProcess"}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new x_(e.name,e.screenWidth,e.screenHeight,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable,e.textureType,!1)),e,i,n)}}(0,X.gn)([(0,Y.qC)()],x_.prototype,"aberrationAmount",void 0),(0,X.gn)([(0,Y.qC)()],x_.prototype,"radialIntensity",void 0),(0,X.gn)([(0,Y.qC)()],x_.prototype,"direction",void 0),(0,X.gn)([(0,Y.qC)()],x_.prototype,"centerPosition",void 0),(0,X.gn)([(0,Y.qC)()],x_.prototype,"screenWidth",void 0),(0,X.gn)([(0,Y.qC)()],x_.prototype,"screenHeight",void 0),(0,l.H)("BABYLON.ChromaticAberrationPostProcess",x_);dt.v.ShadersStore.circleOfConfusionPixelShader="uniform sampler2D depthSampler;\nvarying vec2 vUV;\nuniform vec2 cameraMinMaxZ;\nuniform float focusDistance;\nuniform float cocPrecalculation;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nfloat depth=texture2D(depthSampler,vUV).r;\nfloat pixelDistance=(cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth)*1000.0; \nfloat coc=abs(cocPrecalculation* ((focusDistance-pixelDistance)/pixelDistance));\ncoc=clamp(coc,0.0,1.0);\ngl_FragColor=vec4(coc,depth,coc,1.0);\n}\n";class T_ extends _t.D{constructor(e,t,i,n,r,s,o,a=0,l=!1){super(e,"circleOfConfusion",["cameraMinMaxZ","focusDistance","cocPrecalculation"],["depthSampler"],i,n,r,s,o,null,a,void 0,null,l),this.lensSize=50,this.fStop=1.4,this.focusDistance=2e3,this.focalLength=50,this._depthTexture=null,this._depthTexture=t,this.onApplyObservable.add((e=>{if(!this._depthTexture)return void u.Y.Warn("No depth texture set on CircleOfConfusionPostProcess");e.setTexture("depthSampler",this._depthTexture);const t=this.lensSize/this.fStop*this.focalLength/(this.focusDistance-this.focalLength);e.setFloat("focusDistance",this.focusDistance),e.setFloat("cocPrecalculation",t),e.setFloat2("cameraMinMaxZ",this._depthTexture.activeCamera.minZ,this._depthTexture.activeCamera.maxZ)}))}getClassName(){return"CircleOfConfusionPostProcess"}set depthTexture(e){this._depthTexture=e}}(0,X.gn)([(0,Y.qC)()],T_.prototype,"lensSize",void 0),(0,X.gn)([(0,Y.qC)()],T_.prototype,"fStop",void 0),(0,X.gn)([(0,Y.qC)()],T_.prototype,"focusDistance",void 0),(0,X.gn)([(0,Y.qC)()],T_.prototype,"focalLength",void 0),(0,l.H)("BABYLON.CircleOfConfusionPostProcess",T_);dt.v.ShadersStore.colorCorrectionPixelShader="uniform sampler2D textureSampler; \nuniform sampler2D colorTable; \nvarying vec2 vUV;\nconst float SLICE_COUNT=16.0; \nvec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {\nfloat sliceSize=1.0/width; \nfloat slicePixelSize=sliceSize/width; \nfloat sliceInnerSize=slicePixelSize*(width-1.0); \nfloat zSlice0=min(floor(uv.z*width),width-1.0);\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\nfloat s0=xOffset+(zSlice0*sliceSize);\nfloat s1=xOffset+(zSlice1*sliceSize);\nvec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));\nvec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));\nfloat zOffset=mod(uv.z*width,1.0);\nvec4 result=mix(slice0Color,slice1Color,zOffset);\nreturn result;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 screen_color=texture2D(textureSampler,vUV);\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\n}";class E_ extends _t.D{constructor(e,t,i,n,r,s,o){super(e,"colorCorrection",null,["colorTable"],i,n,r,s,o);const a=(null==n?void 0:n.getScene())||null;this._colorTableTexture=new K.x(t,a,!0,!1,K.x.TRILINEAR_SAMPLINGMODE),this._colorTableTexture.anisotropicFilteringLevel=1,this._colorTableTexture.wrapU=K.x.CLAMP_ADDRESSMODE,this._colorTableTexture.wrapV=K.x.CLAMP_ADDRESSMODE,this.colorTableUrl=t,this.onApply=e=>{e.setTexture("colorTable",this._colorTableTexture)}}getClassName(){return"ColorCorrectionPostProcess"}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new E_(e.name,e.colorTableUrl,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)),e,i,n)}}(0,X.gn)([(0,Y.qC)()],E_.prototype,"colorTableUrl",void 0),(0,l.H)("BABYLON.ColorCorrectionPostProcess",E_);dt.v.ShadersStore.convolutionPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform float kernel[9];\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 colorSum =\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\nfloat kernelWeight =\nkernel[0] +\nkernel[1] +\nkernel[2] +\nkernel[3] +\nkernel[4] +\nkernel[5] +\nkernel[6] +\nkernel[7] +\nkernel[8];\nif (kernelWeight<=0.0) {\nkernelWeight=1.0;\n}\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\n}";class R_ extends _t.D{constructor(e,t,i,n,r,s,o,a=0){super(e,"convolution",["kernel","screenSize"],null,i,n,r,s,o,null,a),this.kernel=t,this.onApply=e=>{e.setFloat2("screenSize",this.width,this.height),e.setArray("kernel",this.kernel)}}getClassName(){return"ConvolutionPostProcess"}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new R_(e.name,e.kernel,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable,e.textureType)),e,i,n)}}R_.EdgeDetect0Kernel=[1,0,-1,0,0,0,-1,0,1],R_.EdgeDetect1Kernel=[0,1,0,1,-4,1,0,1,0],R_.EdgeDetect2Kernel=[-1,-1,-1,-1,8,-1,-1,-1,-1],R_.SharpenKernel=[0,-1,0,-1,5,-1,0,-1,0],R_.EmbossKernel=[-2,-1,0,-1,1,1,0,1,2],R_.GaussianKernel=[0,1,0,1,1,1,0,1,0],(0,X.gn)([(0,Y.qC)()],R_.prototype,"kernel",void 0),(0,l.H)("BABYLON.ConvolutionPostProcess",R_);class P_ extends so{constructor(e,t,i,n,r,s,o,a=null,l=K.x.BILINEAR_SAMPLINGMODE,c,h,_=0,d=!1){super(e,i,n,r,s,2,c,h,_,"#define DOF 1\r\n",d),this.direction=i,this.externalTextureSamplerBinding=!!a,this.onApplyObservable.add((e=>{null!=a&&e.setTextureFromPostProcess("textureSampler",a),e.setTextureFromPostProcessOutput("circleOfConfusionSampler",o),t.activeCamera&&e.setFloat2("cameraMinMaxZ",t.activeCamera.minZ,t.activeCamera.maxZ)}))}getClassName(){return"DepthOfFieldBlurPostProcess"}}(0,X.gn)([(0,Y.qC)()],P_.prototype,"direction",void 0),(0,l.H)("BABYLON.DepthOfFieldBlurPostProcess",P_);dt.v.ShadersStore.depthOfFieldMergePixelShader="uniform sampler2D textureSampler;\nvarying vec2 vUV;\nuniform sampler2D circleOfConfusionSampler;\nuniform sampler2D blurStep0;\n#if BLUR_LEVEL>0\nuniform sampler2D blurStep1;\n#endif\n#if BLUR_LEVEL>1\nuniform sampler2D blurStep2;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nfloat coc=texture2D(circleOfConfusionSampler,vUV).r;\n#if BLUR_LEVEL==0\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred0=texture2D(blurStep0,vUV);\ngl_FragColor=mix(original,blurred0,coc);\n#endif\n#if BLUR_LEVEL==1\nif(coc<0.5){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(original,blurred1,coc/0.5);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV); \nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);\n}\n#endif\n#if BLUR_LEVEL==2\nif(coc<0.33){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(original,blurred2,coc/0.33);\n}else if(coc<0.66){\nvec4 blurred1=texture2D(blurStep1,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);\n}\n#endif\n}\n";class I_ extends _t.D{constructor(e,t,i,n,r,s,o,a,l,c=0,h=!1){super(e,"depthOfFieldMerge",[],["circleOfConfusionSampler","blurStep0","blurStep1","blurStep2"],r,s,o,a,l,null,c,void 0,null,!0),this._blurSteps=n,this.externalTextureSamplerBinding=!0,this.onApplyObservable.add((e=>{e.setTextureFromPostProcess("textureSampler",t),e.setTextureFromPostProcessOutput("circleOfConfusionSampler",i),n.forEach(((t,i)=>{e.setTextureFromPostProcessOutput("blurStep"+(n.length-i-1),t)}))})),h||this.updateEffect()}getClassName(){return"DepthOfFieldMergePostProcess"}updateEffect(e=null,t=null,i=null,n,r,s){e||(e="",e+="#define BLUR_LEVEL "+(this._blurSteps.length-1)+"\n"),super.updateEffect(e,t,i,n,r,s)}}var M_;!function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High"}(M_||(M_={}));class D_ extends v_{constructor(e,t,i=M_.Low,n=0,r=!1){super(e.getEngine(),"depth of field",(()=>this._effects),!0),this._effects=[],this._circleOfConfusion=new T_("circleOfConfusion",t,1,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n,r),this._depthOfFieldBlurY=[],this._depthOfFieldBlurX=[];let s=1,a=15;switch(i){case M_.High:s=3,a=51;break;case M_.Medium:s=2,a=31;break;default:a=15,s=1}const l=a/Math.pow(2,s-1);let c=1;for(let t=0;tnew O_(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)),e,i,n)}}(0,l.H)("BABYLON.DisplayPassPostProcess",O_);dt.v.ShadersStore.filterPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 kernelMatrix;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\ngl_FragColor=vec4(updatedColor,1.0);\n}";class w_ extends _t.D{constructor(e,t,i,n,r,s,o){super(e,"filter",["kernelMatrix"],null,i,n,r,s,o),this.kernelMatrix=t,this.onApply=e=>{e.setMatrix("kernelMatrix",this.kernelMatrix)}}getClassName(){return"FilterPostProcess"}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new w_(e.name,e.kernelMatrix,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)),e,i,n)}}(0,X.gn)([(0,Y.oQ)()],w_.prototype,"kernelMatrix",void 0),(0,l.H)("BABYLON.FilterPostProcess",w_);dt.v.ShadersStore.fxaaPixelShader="uniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst float fxaaQualitySubpix=1.0;\nconst float fxaaQualityEdgeThreshold=0.166;\nconst float fxaaQualityEdgeThresholdMin=0.0833;\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){\nvec2 posM;\nposM.x=vUV.x;\nposM.y=vUV.y;\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\nfloat lumaM=FxaaLuma(rgbyM);\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\nfloat maxSM=max(lumaS,lumaM);\nfloat minSM=min(lumaS,lumaM);\nfloat maxESM=max(lumaE,maxSM);\nfloat minESM=min(lumaE,minSM);\nfloat maxWN=max(lumaN,lumaW);\nfloat minWN=min(lumaN,lumaW);\nfloat rangeMax=max(maxWN,maxESM);\nfloat rangeMin=min(minWN,minESM);\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\nfloat range=rangeMax-rangeMin;\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range=edgeVert;\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\nif (!horzSpan)\n{\nlumaN=lumaW;\n}\nif (!horzSpan) \n{\nlumaS=lumaE;\n}\nif (horzSpan) \n{\nlengthSign=texelSize.y;\n}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\nfloat gradientN=lumaN-lumaM;\nfloat gradientS=lumaS-lumaM;\nfloat lumaNN=lumaN+lumaM;\nfloat lumaSS=lumaS+lumaM;\nbool pairN=abs(gradientN)>=abs(gradientS);\nfloat gradient=max(abs(gradientN),abs(gradientS));\nif (pairN)\n{\nlengthSign=-lengthSign;\n}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\nvec2 posB;\nposB.x=posM.x;\nposB.y=posM.y;\nvec2 offNP;\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\nif (!horzSpan) \n{\nposB.x+=lengthSign*0.5;\n}\nif (horzSpan)\n{\nposB.y+=lengthSign*0.5;\n}\nvec2 posN;\nposN.x=posB.x-offNP.x*1.5;\nposN.y=posB.y-offNP.y*1.5;\nvec2 posP;\nposP.x=posB.x+offNP.x*1.5;\nposP.y=posB.y+offNP.y*1.5;\nfloat subpixD=((-2.0)*subpixC)+3.0;\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\nfloat subpixE=subpixC*subpixC;\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\nif (!pairN) \n{\nlumaNN=lumaSS;\n}\nfloat gradientScaled=gradient*1.0/4.0;\nfloat lumaMM=lumaM-lumaNN*0.5;\nfloat subpixF=subpixD*subpixE;\nbool lumaMLTZero=lumaMM<0.0;\nlumaEndN-=lumaNN*0.5;\nlumaEndP-=lumaNN*0.5;\nbool doneN=abs(lumaEndN)>=gradientScaled;\nbool doneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) \n{\nposN.x-=offNP.x*3.0;\n}\nif (!doneN) \n{\nposN.y-=offNP.y*3.0;\n}\nbool doneNP=(!doneN) || (!doneP);\nif (!doneP) \n{\nposP.x+=offNP.x*3.0;\n}\nif (!doneP)\n{\nposP.y+=offNP.y*3.0;\n}\nif (doneNP)\n{\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\ndoneN=abs(lumaEndN)>=gradientScaled;\ndoneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) posN.x-=offNP.x*12.0;\nif (!doneN) posN.y-=offNP.y*12.0;\ndoneNP=(!doneN) || (!doneP);\nif (!doneP) posP.x+=offNP.x*12.0;\nif (!doneP) posP.y+=offNP.y*12.0;\n}\nfloat dstN=posM.x-posN.x;\nfloat dstP=posP.x-posM.x;\nif (!horzSpan)\n{\ndstN=posM.y-posN.y;\n}\nif (!horzSpan) \n{\ndstP=posP.y-posM.y;\n}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\nfloat spanLength=(dstP+dstN);\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\nfloat spanLengthRcp=1.0/spanLength;\nbool directionN=dstN{const t=this.texelSize;e.setFloat2("texelSize",t.x,t.y)}))}_getDefines(){const e=this.getEngine();if(!e)return null;const t=e.getGlInfo();return t&&t.renderer&&t.renderer.toLowerCase().indexOf("mali")>-1?"#define MALI 1\n":null}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new F_(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)),e,i,n)}}(0,l.H)("BABYLON.FxaaPostProcess",F_);dt.v.ShadersStore.grainPixelShader="#include\nuniform sampler2D textureSampler; \nuniform float intensity;\nuniform float animatedSeed;\nvarying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec2 seed=vUV*(animatedSeed);\nfloat grain=dither(seed,intensity);\nfloat lum=getLuminance(gl_FragColor.rgb);\nfloat grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;\ngl_FragColor.rgb+=grain*grainAmount;\ngl_FragColor.rgb=max(gl_FragColor.rgb,0.0);\n}";class B_ extends _t.D{constructor(e,t,i,n,r,s,o=0,a=!1){super(e,"grain",["intensity","animatedSeed"],[],t,i,n,r,s,null,o,void 0,null,a),this.intensity=30,this.animated=!1,this.onApplyObservable.add((e=>{e.setFloat("intensity",this.intensity),e.setFloat("animatedSeed",this.animated?Math.random()+1:1)}))}getClassName(){return"GrainPostProcess"}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new B_(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)),e,i,n)}}(0,X.gn)([(0,Y.qC)()],B_.prototype,"intensity",void 0),(0,X.gn)([(0,Y.qC)()],B_.prototype,"animated",void 0),(0,l.H)("BABYLON.GrainPostProcess",B_);dt.v.ShadersStore.highlightsPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nconst vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec4 tex=texture2D(textureSampler,vUV);\nvec3 c=tex.rgb;\nfloat luma=dot(c.rgb,RGBLuminanceCoefficients);\ngl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a); \n}";dt.v.IncludesShadersStore.mrtFragmentDeclaration="#if defined(WEBGL2) || defined(WEBGPU)\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n";dt.v.ShadersStore.geometryPixelShader="#extension GL_EXT_draw_buffers : require\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#ifdef BUMP\nvarying mat4 vWorldView;\nvarying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#ifdef VELOCITY\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#ifdef NEED_UV\nvarying vec2 vUV;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIVITY)\n#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nuniform sampler2D reflectivitySampler;\nvarying vec2 vReflectivityUV;\n#endif\n#ifdef ALBEDOTEXTURE\nvarying vec2 vAlbedoUV;\nuniform sampler2D albedoSampler;\n#endif\n#ifdef REFLECTIVITYCOLOR\nuniform vec3 reflectivityColor;\n#endif\n#ifdef ALBEDOCOLOR\nuniform vec3 albedoColor;\n#endif\n#ifdef METALLIC\nuniform float metallic;\n#endif\n#ifdef ROUGHNESS\nuniform float glossiness;\n#endif\n#endif\n#ifdef ALPHATEST\nuniform sampler2D diffuseSampler;\n#endif\n#include[RENDER_TARGET_COUNT]\n#include\n#include\n#include\nvoid main() {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nvec3 normalOutput;\n#ifdef BUMP\nvec3 normalW=normalize(vNormalW);\n#include\nnormalOutput=normalize(vec3(vWorldView*vec4(normalW,0.0)));\n#else\nnormalOutput=normalize(vNormalV);\n#endif\n#ifdef PREPASS\n#ifdef PREPASS_DEPTH\ngl_FragData[DEPTH_INDEX]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n#endif\n#ifdef PREPASS_NORMAL\ngl_FragData[NORMAL_INDEX]=vec4(normalOutput,1.0);\n#endif\n#else\ngl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\ngl_FragData[1]=vec4(normalOutput,1.0);\n#endif\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef REFLECTIVITY\nvec4 reflectivity=vec4(1.0,1.0,1.0,1.0);\n#ifdef METALLICWORKFLOW\nfloat metal=1.0;\nfloat roughness=1.0;\n#ifdef ORMTEXTURE\nmetal*=texture2D(reflectivitySampler,vReflectivityUV).b;\nroughness*=texture2D(reflectivitySampler,vReflectivityUV).g;\n#endif\n#ifdef METALLIC\nmetal*=metallic;\n#endif\n#ifdef ROUGHNESS\nroughness*=(1.0-glossiness); \n#endif\nreflectivity.a-=roughness;\nvec3 color=vec3(1.0);\n#ifdef ALBEDOTEXTURE\ncolor=texture2D(albedoSampler,vAlbedoUV).rgb;\n#ifdef GAMMAALBEDO\ncolor=toLinearSpace(color);\n#endif\n#endif\n#ifdef ALBEDOCOLOR\ncolor*=albedoColor.xyz;\n#endif\nreflectivity.rgb=mix(vec3(0.04),color,metal);\n#else\n#ifdef SPECULARGLOSSINESSTEXTURE\nreflectivity=texture2D(reflectivitySampler,vReflectivityUV);\n#ifdef GAMMAREFLECTIVITYTEXTURE\nreflectivity.rgb=toLinearSpace(reflectivity.rgb);\n#endif\n#ifdef GLOSSINESSS\nreflectivity.a*=glossiness;\n#endif\n#else \n#ifdef REFLECTIVITYTEXTURE\nreflectivity.rbg=texture2D(reflectivitySampler,vReflectivityUV).rbg;\n#ifdef GAMMAREFLECTIVITYTEXTURE\nreflectivity.rgb=toLinearSpace(reflectivity.rgb);\n#endif\n#else\n#ifdef REFLECTIVITYCOLOR\nreflectivity.rgb=reflectivityColor.xyz;\nreflectivity.a=1.0;\n#endif\n#endif \n#ifdef GLOSSINESSS\nreflectivity.a=glossiness; \n#else\nreflectivity.a=1.0; \n#endif\n#endif\n#endif\nreflectivity.rgb=toGammaSpace(reflectivity.rgb); \ngl_FragData[REFLECTIVITY_INDEX]=reflectivity;\n#endif\n}\n";dt.v.IncludesShadersStore.geometryVertexDeclaration="uniform mat4 viewProjection;\nuniform mat4 view;";dt.v.IncludesShadersStore.geometryUboDeclaration="#include\n",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertex.js");dt.v.ShadersStore.geometryVertexShader="precision highp float;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include<__decl__geometryVertex>\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef NEED_UV\nvarying vec2 vUV;\n#ifdef ALPHATEST\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef BUMP\nuniform mat4 bumpMatrix;\nvarying vec2 vBumpUV;\n#endif\n#ifdef REFLECTIVITY\nuniform mat4 reflectivityMatrix;\nuniform mat4 albedoMatrix;\nvarying vec2 vReflectivityUV;\nvarying vec2 vAlbedoUV;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#ifdef BUMP\nvarying mat4 vWorldView;\n#endif\n#ifdef BUMP\nvarying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#ifdef VELOCITY\nuniform mat4 previousViewProjection;\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 pos=vec4(finalWorld*vec4(positionUpdated,1.0));\n#ifdef BUMP\nvWorldView=view*finalWorld;\nvNormalW=normalUpdated;\n#else\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));\n#endif\nvViewPos=view*pos;\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n#if defined(POSITION) || defined(BUMP)\nvPositionW=pos.xyz/pos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#ifdef NEED_UV\n#ifdef UV1\n#if defined(ALPHATEST) && defined(ALPHATEST_UV1)\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#else\nvUV=uv;\n#endif\n#ifdef BUMP_UV1\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV1\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef ALBEDO_UV1\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#endif\n#ifdef UV2\n#if defined(ALPHATEST) && defined(ALPHATEST_UV2)\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#else\nvUV=uv2;\n#endif\n#ifdef BUMP_UV2\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV2\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n#endif\n#ifdef ALBEDO_UV2\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#endif\n#include\n}\n";class N_{constructor(e,t=1,i=15){this._previousTransformationMatrices={},this._previousBonesTransformationMatrices={},this.excludedSkinnedMeshesFromVelocity=[],this.renderTransparentMeshes=!0,this._resizeObserver=null,this._enablePosition=!1,this._enableVelocity=!1,this._enableReflectivity=!1,this._positionIndex=-1,this._velocityIndex=-1,this._reflectivityIndex=-1,this._depthIndex=-1,this._normalIndex=-1,this._linkedWithPrePass=!1,this._scene=e,this._ratio=t,this._useUbo=e.getEngine().supportsUniformBuffers,this._depthFormat=i,N_._SceneComponentInitialization(this._scene),this._createRenderTargets()}_linkPrePassRenderer(e){this._linkedWithPrePass=!0,this._prePassRenderer=e,this._multiRenderTarget&&(this._multiRenderTarget.onClearObservable.clear(),this._multiRenderTarget.onClearObservable.add((()=>{})))}_unlinkPrePassRenderer(){this._linkedWithPrePass=!1,this._createRenderTargets()}_resetLayout(){this._enablePosition=!1,this._enableReflectivity=!1,this._enableVelocity=!1,this._attachments=[]}_forceTextureType(e,t){e===N_.POSITION_TEXTURE_TYPE?(this._positionIndex=t,this._enablePosition=!0):e===N_.VELOCITY_TEXTURE_TYPE?(this._velocityIndex=t,this._enableVelocity=!0):e===N_.REFLECTIVITY_TEXTURE_TYPE?(this._reflectivityIndex=t,this._enableReflectivity=!0):e===N_.DEPTH_TEXTURE_TYPE?this._depthIndex=t:e===N_.NORMAL_TEXTURE_TYPE&&(this._normalIndex=t)}_setAttachments(e){this._attachments=e}_linkInternalTexture(e){this._multiRenderTarget.setInternalTexture(e,0,!1)}get renderList(){return this._multiRenderTarget.renderList}set renderList(e){this._multiRenderTarget.renderList=e}get isSupported(){return this._multiRenderTarget.isSupported}getTextureIndex(e){switch(e){case N_.POSITION_TEXTURE_TYPE:return this._positionIndex;case N_.VELOCITY_TEXTURE_TYPE:return this._velocityIndex;case N_.REFLECTIVITY_TEXTURE_TYPE:return this._reflectivityIndex;default:return-1}}get enablePosition(){return this._enablePosition}set enablePosition(e){this._enablePosition=e,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())}get enableVelocity(){return this._enableVelocity}set enableVelocity(e){this._enableVelocity=e,e||(this._previousTransformationMatrices={}),this._linkedWithPrePass||(this.dispose(),this._createRenderTargets()),this._scene.needsPreviousWorldMatrices=e}get enableReflectivity(){return this._enableReflectivity}set enableReflectivity(e){this._enableReflectivity=e,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())}get scene(){return this._scene}get ratio(){return this._ratio}isReady(e,t){const i=e.getMaterial();if(i&&i.disableDepthWrite)return!1;const n=[],r=[le.o.PositionKind,le.o.NormalKind],s=e.getMesh();if(i){let e=!1;if(i.needAlphaTesting()&&i.getAlphaTestTexture()&&(n.push("#define ALPHATEST"),n.push(`#define ALPHATEST_UV${i.getAlphaTestTexture().coordinatesIndex+1}`),e=!0),i.bumpTexture&&_o.k.BumpTextureEnabled&&(n.push("#define BUMP"),n.push(`#define BUMP_UV${i.bumpTexture.coordinatesIndex+1}`),e=!0),this._enableReflectivity){let t=!1;"PBRMetallicRoughnessMaterial"===i.getClassName()?(null!==i.metallicRoughnessTexture&&(n.push("#define ORMTEXTURE"),n.push(`#define REFLECTIVITY_UV${i.metallicRoughnessTexture.coordinatesIndex+1}`),n.push("#define METALLICWORKFLOW"),e=!0,t=!0),null!==i.metallic&&(n.push("#define METALLIC"),n.push("#define METALLICWORKFLOW"),t=!0),null!==i.roughness&&(n.push("#define ROUGHNESS"),n.push("#define METALLICWORKFLOW"),t=!0),t&&(null!==i.baseTexture&&(n.push("#define ALBEDOTEXTURE"),n.push(`#define ALBEDO_UV${i.baseTexture.coordinatesIndex+1}`),i.baseTexture.gammaSpace&&n.push("#define GAMMAALBEDO"),e=!0),null!==i.baseColor&&n.push("#define ALBEDOCOLOR"))):"PBRSpecularGlossinessMaterial"===i.getClassName()?(null!==i.specularGlossinessTexture?(n.push("#define SPECULARGLOSSINESSTEXTURE"),n.push(`#define REFLECTIVITY_UV${i.specularGlossinessTexture.coordinatesIndex+1}`),e=!0,i.specularGlossinessTexture.gammaSpace&&n.push("#define GAMMAREFLECTIVITYTEXTURE")):null!==i.specularColor&&n.push("#define REFLECTIVITYCOLOR"),null!==i.glossiness&&n.push("#define GLOSSINESSS")):"PBRMaterial"===i.getClassName()?(null!==i.metallicTexture&&(n.push("#define ORMTEXTURE"),n.push(`#define REFLECTIVITY_UV${i.metallicTexture.coordinatesIndex+1}`),n.push("#define METALLICWORKFLOW"),e=!0,t=!0),null!==i.metallic&&(n.push("#define METALLIC"),n.push("#define METALLICWORKFLOW"),t=!0),null!==i.roughness&&(n.push("#define ROUGHNESS"),n.push("#define METALLICWORKFLOW"),t=!0),t?(null!==i.albedoTexture&&(n.push("#define ALBEDOTEXTURE"),n.push(`#define ALBEDO_UV${i.albedoTexture.coordinatesIndex+1}`),i.albedoTexture.gammaSpace&&n.push("#define GAMMAALBEDO"),e=!0),null!==i.albedoColor&&n.push("#define ALBEDOCOLOR")):(null!==i.reflectivityTexture?(n.push("#define SPECULARGLOSSINESSTEXTURE"),n.push(`#define REFLECTIVITY_UV${i.reflectivityTexture.coordinatesIndex+1}`),i.reflectivityTexture.gammaSpace&&n.push("#define GAMMAREFLECTIVITYTEXTURE"),e=!0):null!==i.reflectivityColor&&n.push("#define REFLECTIVITYCOLOR"),null!==i.microSurface&&n.push("#define GLOSSINESSS"))):"StandardMaterial"===i.getClassName()&&(null!==i.specularTexture&&(n.push("#define REFLECTIVITYTEXTURE"),n.push(`#define REFLECTIVITY_UV${i.specularTexture.coordinatesIndex+1}`),i.specularTexture.gammaSpace&&n.push("#define GAMMAREFLECTIVITYTEXTURE"),e=!0),null!==i.specularColor&&n.push("#define REFLECTIVITYCOLOR"))}e&&(n.push("#define NEED_UV"),s.isVerticesDataPresent(le.o.UVKind)&&(r.push(le.o.UVKind),n.push("#define UV1")),s.isVerticesDataPresent(le.o.UV2Kind)&&(r.push(le.o.UV2Kind),n.push("#define UV2")))}this._linkedWithPrePass&&(n.push("#define PREPASS"),-1!==this._depthIndex&&(n.push("#define DEPTH_INDEX "+this._depthIndex),n.push("#define PREPASS_DEPTH")),-1!==this._normalIndex&&(n.push("#define NORMAL_INDEX "+this._normalIndex),n.push("#define PREPASS_NORMAL"))),this._enablePosition&&(n.push("#define POSITION"),n.push("#define POSITION_INDEX "+this._positionIndex)),this._enableVelocity&&(n.push("#define VELOCITY"),n.push("#define VELOCITY_INDEX "+this._velocityIndex),-1===this.excludedSkinnedMeshesFromVelocity.indexOf(s)&&n.push("#define BONES_VELOCITY_ENABLED")),this._enableReflectivity&&(n.push("#define REFLECTIVITY"),n.push("#define REFLECTIVITY_INDEX "+this._reflectivityIndex)),s.useBones&&s.computeBonesUsingShaders?(r.push(le.o.MatricesIndicesKind),r.push(le.o.MatricesWeightsKind),s.numBoneInfluencers>4&&(r.push(le.o.MatricesIndicesExtraKind),r.push(le.o.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+s.numBoneInfluencers),n.push("#define BonesPerMesh "+(s.skeleton?s.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0");const o=s.morphTargetManager;let a=0;o&&o.numInfluencers>0&&(a=o.numInfluencers,n.push("#define MORPHTARGETS"),n.push("#define NUM_MORPH_INFLUENCERS "+a),o.isUsingTextureForTargets&&n.push("#define MORPHTARGETS_TEXTURE"),lo.G.PrepareAttributesForMorphTargetsInfluencers(r,s,a)),t&&(n.push("#define INSTANCES"),lo.G.PushAttributesForInstances(r,this._enableVelocity),e.getRenderingMesh().hasThinInstances&&n.push("#define THIN_INSTANCES")),this._linkedWithPrePass?n.push("#define RENDER_TARGET_COUNT "+this._attachments.length):n.push("#define RENDER_TARGET_COUNT "+this._multiRenderTarget.textures.length);const l=this._scene.getEngine(),c=e._getDrawWrapper(void 0,!0),h=c.defines,_=n.join("\n");return h!==_&&c.setEffect(l.createEffect("geometry",{attributes:r,uniformsNames:["world","mBones","viewProjection","diffuseMatrix","view","previousWorld","previousViewProjection","mPreviousBones","bumpMatrix","reflectivityMatrix","albedoMatrix","reflectivityColor","albedoColor","metallic","glossiness","vTangentSpaceParams","vBumpInfos","morphTargetInfluences","morphTargetTextureInfo","morphTargetTextureIndices"],samplers:["diffuseSampler","bumpSampler","reflectivitySampler","albedoSampler","morphTargets"],defines:_,onCompiled:null,fallbacks:null,onError:null,uniformBuffersNames:["Scene"],indexParameters:{buffersCount:this._multiRenderTarget.textures.length-1,maxSimultaneousMorphTargets:a}},l),_),c.effect.isReady()}getGBuffer(){return this._multiRenderTarget}get samples(){return this._multiRenderTarget.samples}set samples(e){this._multiRenderTarget.samples=e}dispose(){this._resizeObserver&&(this._scene.getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this.getGBuffer().dispose()}_assignRenderTargetIndices(){const e=[];let t=2;return e.push("gBuffer_Depth","gBuffer_Normal"),this._enablePosition&&(this._positionIndex=t,t++,e.push("gBuffer_Position")),this._enableVelocity&&(this._velocityIndex=t,t++,e.push("gBuffer_Velocity")),this._enableReflectivity&&(this._reflectivityIndex=t,t++,e.push("gBuffer_Reflectivity")),[t,e]}_createRenderTargets(){const e=this._scene.getEngine(),[t,i]=this._assignRenderTargetIndices();let n=0;if(e._caps.textureFloat&&e._caps.textureFloatLinearFiltering?n=1:e._caps.textureHalfFloat&&e._caps.textureHalfFloatLinearFiltering&&(n=2),this._multiRenderTarget=new wl("gBuffer",{width:e.getRenderWidth()*this._ratio,height:e.getRenderHeight()*this._ratio},t,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,defaultType:n,depthTextureFormat:this._depthFormat},i.concat("gBuffer_DepthBuffer")),!this.isSupported)return;this._multiRenderTarget.wrapU=K.x.CLAMP_ADDRESSMODE,this._multiRenderTarget.wrapV=K.x.CLAMP_ADDRESSMODE,this._multiRenderTarget.refreshRate=1,this._multiRenderTarget.renderParticles=!1,this._multiRenderTarget.renderList=null,this._multiRenderTarget.onClearObservable.add((e=>{e.clear(new a.HE(0,0,0,0),!0,!0,!0)})),this._resizeObserver=e.onResizeObservable.add((()=>{this._multiRenderTarget&&this._multiRenderTarget.resize({width:e.getRenderWidth()*this._ratio,height:e.getRenderHeight()*this._ratio})}));const r=e=>{const t=e.getRenderingMesh(),i=e.getEffectiveMesh(),n=this._scene,r=n.getEngine(),s=e.getMaterial();if(!s)return;if(i._internalAbstractMeshDataInfo._isActiveIntermediate=!1,this._enableVelocity&&!this._previousTransformationMatrices[i.uniqueId]&&(this._previousTransformationMatrices[i.uniqueId]={world:o.y3.Identity(),viewProjection:n.getTransformMatrix()},t.skeleton)){const e=t.skeleton.getTransformMatrices(t);this._previousBonesTransformationMatrices[t.uniqueId]=this._copyBonesTransformationMatrices(e,new Float32Array(e.length))}const a=t._getInstancesRenderList(e._id,!!e.getReplacementMesh());if(a.mustReturn)return;const l=r.getCaps().instancedArrays&&(null!==a.visibleInstances[e._id]||t.hasThinInstances),c=i.getWorldMatrix();if(this.isReady(e,l)){const o=e._getDrawWrapper();if(!o)return;const h=o.effect;if(r.enableEffect(o),l||t._bind(e,h,s.fillMode),this._useUbo?(lo.G.BindSceneUniformBuffer(h,this._scene.getSceneUniformBuffer()),this._scene.finalizeSceneUbo()):(h.setMatrix("viewProjection",n.getTransformMatrix()),h.setMatrix("view",n.getViewMatrix())),s){let e;const r=t._instanceDataStorage;if(r.isFrozen||!s.backFaceCulling&&null===t.overrideMaterialSideOrientation)e=r.sideOrientation;else{const n=i._getWorldMatrixDeterminant();e=t.overrideMaterialSideOrientation,null===e&&(e=s.sideOrientation),n<0&&(e=e===on.F.ClockWiseSideOrientation?on.F.CounterClockWiseSideOrientation:on.F.ClockWiseSideOrientation)}if(s._preBind(o,e),s.needAlphaTesting()){const e=s.getAlphaTestTexture();e&&(h.setTexture("diffuseSampler",e),h.setMatrix("diffuseMatrix",e.getTextureMatrix()))}s.bumpTexture&&n.getEngine().getCaps().standardDerivatives&&_o.k.BumpTextureEnabled&&(h.setFloat3("vBumpInfos",s.bumpTexture.coordinatesIndex,1/s.bumpTexture.level,s.parallaxScaleBias),h.setMatrix("bumpMatrix",s.bumpTexture.getTextureMatrix()),h.setTexture("bumpSampler",s.bumpTexture),h.setFloat2("vTangentSpaceParams",s.invertNormalMapX?-1:1,s.invertNormalMapY?-1:1)),this._enableReflectivity&&("PBRMetallicRoughnessMaterial"===s.getClassName()?(null!==s.metallicRoughnessTexture&&(h.setTexture("reflectivitySampler",s.metallicRoughnessTexture),h.setMatrix("reflectivityMatrix",s.metallicRoughnessTexture.getTextureMatrix())),null!==s.metallic&&h.setFloat("metallic",s.metallic),null!==s.roughness&&h.setFloat("glossiness",1-s.roughness),null!==s.baseTexture&&(h.setTexture("albedoSampler",s.baseTexture),h.setMatrix("albedoMatrix",s.baseTexture.getTextureMatrix())),null!==s.baseColor&&h.setColor3("albedoColor",s.baseColor)):"PBRSpecularGlossinessMaterial"===s.getClassName()?(null!==s.specularGlossinessTexture?(h.setTexture("reflectivitySampler",s.specularGlossinessTexture),h.setMatrix("reflectivityMatrix",s.specularGlossinessTexture.getTextureMatrix())):null!==s.specularColor&&h.setColor3("reflectivityColor",s.specularColor),null!==s.glossiness&&h.setFloat("glossiness",s.glossiness)):"PBRMaterial"===s.getClassName()?(null!==s.metallicTexture&&(h.setTexture("reflectivitySampler",s.metallicTexture),h.setMatrix("reflectivityMatrix",s.metallicTexture.getTextureMatrix())),null!==s.metallic&&h.setFloat("metallic",s.metallic),null!==s.roughness&&h.setFloat("glossiness",1-s.roughness),null!==s.roughness||null!==s.metallic||null!==s.metallicTexture?(null!==s.albedoTexture&&(h.setTexture("albedoSampler",s.albedoTexture),h.setMatrix("albedoMatrix",s.albedoTexture.getTextureMatrix())),null!==s.albedoColor&&h.setColor3("albedoColor",s.albedoColor)):(null!==s.reflectivityTexture?(h.setTexture("reflectivitySampler",s.reflectivityTexture),h.setMatrix("reflectivityMatrix",s.reflectivityTexture.getTextureMatrix())):null!==s.reflectivityColor&&h.setColor3("reflectivityColor",s.reflectivityColor),null!==s.microSurface&&h.setFloat("glossiness",s.microSurface))):"StandardMaterial"===s.getClassName()&&(null!==s.specularTexture&&(h.setTexture("reflectivitySampler",s.specularTexture),h.setMatrix("reflectivityMatrix",s.specularTexture.getTextureMatrix())),null!==s.specularColor&&h.setColor3("reflectivityColor",s.specularColor)))}t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&(h.setMatrices("mBones",t.skeleton.getTransformMatrices(t)),this._enableVelocity&&h.setMatrices("mPreviousBones",this._previousBonesTransformationMatrices[t.uniqueId])),lo.G.BindMorphTargetParameters(t,h),t.morphTargetManager&&t.morphTargetManager.isUsingTextureForTargets&&t.morphTargetManager._bind(h),this._enableVelocity&&(h.setMatrix("previousWorld",this._previousTransformationMatrices[i.uniqueId].world),h.setMatrix("previousViewProjection",this._previousTransformationMatrices[i.uniqueId].viewProjection)),l&&t.hasThinInstances&&h.setMatrix("world",c),t._processRendering(i,e,h,s.fillMode,a,l,((e,t)=>{e||h.setMatrix("world",t)}))}this._enableVelocity&&(this._previousTransformationMatrices[i.uniqueId].world=c.clone(),this._previousTransformationMatrices[i.uniqueId].viewProjection=this._scene.getTransformMatrix().clone(),t.skeleton&&this._copyBonesTransformationMatrices(t.skeleton.getTransformMatrices(t),this._previousBonesTransformationMatrices[i.uniqueId]))};this._multiRenderTarget.customIsReadyFunction=(t,i)=>{if(!t.isReady(!1))return!1;if(0===i&&t.subMeshes)for(let i=0;i{let o;if(this._linkedWithPrePass){if(!this._prePassRenderer.enabled)return;this._scene.getEngine().bindAttachments(this._attachments)}if(s.length){for(e.setColorWrite(!1),o=0;o{throw(0,_a.S)("GeometryBufferRendererSceneComponent")};class L_{constructor(){this.enabled=!1,this.name="motionBlur",this.texturesRequired=[2]}}Object.defineProperty(R.x.prototype,"geometryBufferRenderer",{get:function(){return this._geometryBufferRenderer},set:function(e){e&&e.isSupported&&(this._geometryBufferRenderer=e)},enumerable:!0,configurable:!0}),R.x.prototype.enableGeometryBufferRenderer=function(e=1,t=15){return this._geometryBufferRenderer||(this._geometryBufferRenderer=new N_(this,e,t),this._geometryBufferRenderer.isSupported||(this._geometryBufferRenderer=null)),this._geometryBufferRenderer},R.x.prototype.disableGeometryBufferRenderer=function(){this._geometryBufferRenderer&&(this._geometryBufferRenderer.dispose(),this._geometryBufferRenderer=null)};class k_{constructor(e){this.name=z.l.NAME_GEOMETRYBUFFERRENDERER,this.scene=e}register(){this.scene._gatherRenderTargetsStage.registerStep(z.l.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER,this,this._gatherRenderTargets)}rebuild(){}dispose(){}_gatherRenderTargets(e){this.scene._geometryBufferRenderer&&e.push(this.scene._geometryBufferRenderer.getGBuffer())}}N_._SceneComponentInitialization=e=>{let t=e._getComponent(z.l.NAME_GEOMETRYBUFFERRENDERER);t||(t=new k_(e),e._addComponent(t))};dt.v.ShadersStore.motionBlurPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float motionStrength;\nuniform float motionScale;\nuniform vec2 screenSize;\n#ifdef OBJECT_BASED\nuniform sampler2D velocitySampler;\n#else\nuniform sampler2D depthSampler;\nuniform mat4 inverseViewProjection;\nuniform mat4 prevViewProjection;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#ifdef GEOMETRY_SUPPORTED\n#ifdef OBJECT_BASED\nvec2 texelSize=1.0/screenSize;\nvec4 velocityColor=texture2D(velocitySampler,vUV);\nvelocityColor.rg=velocityColor.rg*2.0-vec2(1.0);\nvec2 velocity=vec2(pow(velocityColor.r,3.0),pow(velocityColor.g,3.0))*velocityColor.a;\nvelocity*=motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint samplesCount=int(clamp(speed,1.0,SAMPLES));\nvelocity=normalize(velocity)*texelSize;\nfloat hlim=float(-samplesCount)*0.5+0.5;\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i=samplesCount)\nbreak;\nvec2 offset=vUV+velocity*(hlim+float(i));\nresult+=texture2D(textureSampler,offset);\n}\ngl_FragColor=result/float(samplesCount);\ngl_FragColor.a=1.0;\n#else\nvec2 texelSize=1.0/screenSize;\nfloat depth=texture2D(depthSampler,vUV).r;\nvec4 cpos=vec4(vUV*2.0-1.0,depth,1.0);\ncpos=cpos*inverseViewProjection;\nvec4 ppos=cpos*prevViewProjection;\nppos.xyz/=ppos.w;\nppos.xy=ppos.xy*0.5+0.5;\nvec2 velocity=(ppos.xy-vUV)*motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint nSamples=int(clamp(speed,1.0,SAMPLES));\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i=nSamples)\nbreak;\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\nresult+=texture2D(textureSampler,offset1);\n}\ngl_FragColor=result/float(nSamples);\n#endif\n#else\ngl_FragColor=texture2D(textureSampler,vUV);\n#endif\n}\n";class V_ extends _t.D{constructor(e,t,i,n,r,s,o,a=0,l=!1,c=!1){super(e,"motionBlur",["motionStrength","motionScale","screenSize","inverseViewProjection","prevViewProjection"],["velocitySampler"],i,n,r,s,o,"#define GEOMETRY_SUPPORTED\n#define SAMPLES 64.0\n#define OBJECT_BASED",a,void 0,null,l),this.motionStrength=1,this._motionBlurSamples=32,this._isObjectBased=!0,this._forceGeometryBuffer=!1,this._invViewProjection=null,this._previousViewProjection=null,this._forceGeometryBuffer=c,this._forceGeometryBuffer?(t.enableGeometryBufferRenderer(),this._geometryBufferRenderer&&(this._geometryBufferRenderer.enableVelocity=!0)):(t.enablePrePassRenderer(),this._prePassRenderer&&(this._prePassRenderer.markAsDirty(),this._prePassEffectConfiguration=new L_)),this._applyMode()}get motionBlurSamples(){return this._motionBlurSamples}set motionBlurSamples(e){this._motionBlurSamples=e,this._updateEffect()}get isObjectBased(){return this._isObjectBased}set isObjectBased(e){this._isObjectBased!==e&&(this._isObjectBased=e,this._applyMode())}get _geometryBufferRenderer(){return this._forceGeometryBuffer?this._scene.geometryBufferRenderer:null}get _prePassRenderer(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer}getClassName(){return"MotionBlurPostProcess"}excludeSkinnedMesh(e){if(e.skeleton){let t;if(this._geometryBufferRenderer)t=this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;else{if(!this._prePassRenderer)return;t=this._prePassRenderer.excludedSkinnedMesh}t.push(e)}}removeExcludedSkinnedMesh(e){if(e.skeleton){let t;if(this._geometryBufferRenderer)t=this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;else{if(!this._prePassRenderer)return;t=this._prePassRenderer.excludedSkinnedMesh}const i=t.indexOf(e);-1!==i&&t.splice(i,1)}}dispose(e){this._geometryBufferRenderer&&(this._geometryBufferRenderer._previousTransformationMatrices={},this._geometryBufferRenderer._previousBonesTransformationMatrices={},this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity=[]),super.dispose(e)}_applyMode(){if(!this._geometryBufferRenderer&&!this._prePassRenderer)return u.Y.Warn("Multiple Render Target support needed to compute object based motion blur"),this.updateEffect();this._updateEffect(),this._invViewProjection=null,this._previousViewProjection=null,this.isObjectBased?(this._prePassRenderer&&this._prePassEffectConfiguration&&(this._prePassEffectConfiguration.texturesRequired[0]=2),this.onApply=e=>this._onApplyObjectBased(e)):(this._invViewProjection=o.y3.Identity(),this._previousViewProjection=o.y3.Identity(),this._prePassRenderer&&this._prePassEffectConfiguration&&(this._prePassEffectConfiguration.texturesRequired[0]=5),this.onApply=e=>this._onApplyScreenBased(e))}_onApplyObjectBased(e){if(e.setVector2("screenSize",new o.FM(this.width,this.height)),e.setFloat("motionScale",this._scene.getAnimationRatio()),e.setFloat("motionStrength",this.motionStrength),this._geometryBufferRenderer){const t=this._geometryBufferRenderer.getTextureIndex(N_.VELOCITY_TEXTURE_TYPE);e.setTexture("velocitySampler",this._geometryBufferRenderer.getGBuffer().textures[t])}else if(this._prePassRenderer){const t=this._prePassRenderer.getIndex(2);e.setTexture("velocitySampler",this._prePassRenderer.getRenderTarget().textures[t])}}_onApplyScreenBased(e){const t=this._scene.getProjectionMatrix().multiply(this._scene.getViewMatrix());if(t.invertToRef(this._invViewProjection),e.setMatrix("inverseViewProjection",this._invViewProjection),e.setMatrix("prevViewProjection",this._previousViewProjection),this._previousViewProjection=t,e.setVector2("screenSize",new o.FM(this.width,this.height)),e.setFloat("motionScale",this._scene.getAnimationRatio()),e.setFloat("motionStrength",this.motionStrength),this._geometryBufferRenderer){const t=this._geometryBufferRenderer.getTextureIndex(N_.DEPTH_TEXTURE_TYPE);e.setTexture("depthSampler",this._geometryBufferRenderer.getGBuffer().textures[t])}else if(this._prePassRenderer){const t=this._prePassRenderer.getIndex(5);e.setTexture("depthSampler",this._prePassRenderer.getRenderTarget().textures[t])}}_updateEffect(){if(this._geometryBufferRenderer||this._prePassRenderer){const e=["#define GEOMETRY_SUPPORTED","#define SAMPLES "+this._motionBlurSamples.toFixed(1),this._isObjectBased?"#define OBJECT_BASED":"#define SCREEN_BASED"];this.updateEffect(e.join("\n"))}}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new V_(e.name,i,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable,e.textureType,!1)),e,i,n)}}(0,X.gn)([(0,Y.qC)()],V_.prototype,"motionStrength",void 0),(0,X.gn)([(0,Y.qC)()],V_.prototype,"motionBlurSamples",null),(0,X.gn)([(0,Y.qC)()],V_.prototype,"isObjectBased",null),(0,l.H)("BABYLON.MotionBlurPostProcess",V_);dt.v.ShadersStore.refractionPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D refractionSampler;\nuniform vec3 baseColor;\nuniform float depth;\nuniform float colorLevel;\nvoid main() {\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\nvec2 uv=vUV-vec2(0.5);\nvec2 offset=uv*depth*ref;\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\n}";class U_ extends _t.D{constructor(e,t,i,n,r,s,o,a,l,c){super(e,"refraction",["baseColor","depth","colorLevel"],["refractionSampler"],s,o,a,l,c),this._ownRefractionTexture=!0,this.color=i,this.depth=n,this.colorLevel=r,this.refractionTextureUrl=t,this.onActivateObservable.add((e=>{this._refTexture=this._refTexture||new K.x(t,e.getScene())})),this.onApplyObservable.add((e=>{e.setColor3("baseColor",this.color),e.setFloat("depth",this.depth),e.setFloat("colorLevel",this.colorLevel),e.setTexture("refractionSampler",this._refTexture)}))}get refractionTexture(){return this._refTexture}set refractionTexture(e){this._refTexture&&this._ownRefractionTexture&&this._refTexture.dispose(),this._refTexture=e,this._ownRefractionTexture=!1}getClassName(){return"RefractionPostProcess"}dispose(e){this._refTexture&&this._ownRefractionTexture&&(this._refTexture.dispose(),this._refTexture=null),super.dispose(e)}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new U_(e.name,e.refractionTextureUrl,e.color,e.depth,e.colorLevel,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)),e,i,n)}}(0,X.gn)([(0,Y.qC)()],U_.prototype,"color",void 0),(0,X.gn)([(0,Y.qC)()],U_.prototype,"depth",void 0),(0,X.gn)([(0,Y.qC)()],U_.prototype,"colorLevel",void 0),(0,X.gn)([(0,Y.qC)()],U_.prototype,"refractionTextureUrl",void 0),(0,l.H)("BABYLON.RefractionPostProcess",U_);dt.v.ShadersStore.sharpenPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform vec2 sharpnessAmounts;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 color=texture2D(textureSampler,vUV);\nvec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\ncolor*4.0;\ngl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);\n}";class G_ extends _t.D{constructor(e,t,i,n,r,s,o=0,a=!1){super(e,"sharpen",["sharpnessAmounts","screenSize"],null,t,i,n,r,s,null,o,void 0,null,a),this.colorAmount=1,this.edgeAmount=.3,this.onApply=e=>{e.setFloat2("screenSize",this.width,this.height),e.setFloat2("sharpnessAmounts",this.edgeAmount,this.colorAmount)}}getClassName(){return"SharpenPostProcess"}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new G_(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.textureType,e.reusable)),e,i,n)}}(0,X.gn)([(0,Y.qC)()],G_.prototype,"colorAmount",void 0),(0,X.gn)([(0,Y.qC)()],G_.prototype,"edgeAmount",void 0),(0,l.H)("BABYLON.SharpenPostProcess",G_);class j_{constructor(e,t){this._engine=e,this._name=t,this._renderEffects={},this._renderEffectsForIsolatedPass=new Array,this._cameras=[]}get name(){return this._name}get cameras(){return this._cameras}getClassName(){return"PostProcessRenderPipeline"}get isSupported(){for(const e in this._renderEffects)if(Object.prototype.hasOwnProperty.call(this._renderEffects,e)&&!this._renderEffects[e].isSupported)return!1;return!0}addEffect(e){this._renderEffects[e._name]=e}_rebuild(){}_enableEffect(e,t){const i=this._renderEffects[e];i&&i._enable(V.w1.MakeArray(t||this._cameras))}_disableEffect(e,t){const i=this._renderEffects[e];i&&i._disable(V.w1.MakeArray(t||this._cameras))}_attachCameras(e,t){const i=V.w1.MakeArray(e||this._cameras);if(!i)return;const n=[];let r;for(r=0;r0){const i=this._renderEffects[t[0]].getPostProcesses();i&&(i[0].samples=e)}return!0}setPrePassRenderer(e){return!1}dispose(){}}(0,X.gn)([(0,Y.qC)()],j_.prototype,"_name",void 0);class W_{constructor(){this._renderPipelines={}}get supportedPipelines(){const e=[];for(const t in this._renderPipelines)if(Object.prototype.hasOwnProperty.call(this._renderPipelines,t)){const i=this._renderPipelines[t];i.isSupported&&e.push(i)}return e}addPipeline(e){this._renderPipelines[e._name]=e}attachCamerasToRenderPipeline(e,t,i=!1){const n=this._renderPipelines[e];n&&n._attachCameras(t,i)}detachCamerasFromRenderPipeline(e,t){const i=this._renderPipelines[e];i&&i._detachCameras(t)}enableEffectInPipeline(e,t,i){const n=this._renderPipelines[e];n&&n._enableEffect(t,i)}disableEffectInPipeline(e,t,i){const n=this._renderPipelines[e];n&&n._disableEffect(t,i)}update(){for(const e in this._renderPipelines)if(Object.prototype.hasOwnProperty.call(this._renderPipelines,e)){const t=this._renderPipelines[e];t.isSupported?t._update():(t.dispose(),delete this._renderPipelines[e])}}_rebuild(){for(const e in this._renderPipelines)Object.prototype.hasOwnProperty.call(this._renderPipelines,e)&&this._renderPipelines[e]._rebuild()}dispose(){for(const e in this._renderPipelines)Object.prototype.hasOwnProperty.call(this._renderPipelines,e)&&this._renderPipelines[e].dispose()}}Object.defineProperty(R.x.prototype,"postProcessRenderPipelineManager",{get:function(){if(!this._postProcessRenderPipelineManager){let e=this._getComponent(z.l.NAME_POSTPROCESSRENDERPIPELINEMANAGER);e||(e=new z_(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new W_}return this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});class z_{constructor(e){this.name=z.l.NAME_POSTPROCESSRENDERPIPELINEMANAGER,this.scene=e}register(){this.scene._gatherRenderTargetsStage.registerStep(z.l.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER,this,this._gatherRenderTargets)}rebuild(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager._rebuild()}dispose(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.dispose()}_gatherRenderTargets(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.update()}}class H_ extends j_{constructor(e="",t=!0,i=m.l.LastCreatedScene,n,r=!0){super(i.getEngine(),e),this._camerasToBeAttached=[],this.SharpenPostProcessId="SharpenPostProcessEffect",this.ImageProcessingPostProcessId="ImageProcessingPostProcessEffect",this.FxaaPostProcessId="FxaaPostProcessEffect",this.ChromaticAberrationPostProcessId="ChromaticAberrationPostProcessEffect",this.GrainPostProcessId="GrainPostProcessEffect",this._glowLayer=null,this.animations=[],this._imageProcessingConfigurationObserver=null,this._sharpenEnabled=!1,this._bloomEnabled=!1,this._depthOfFieldEnabled=!1,this._depthOfFieldBlurLevel=M_.Low,this._fxaaEnabled=!1,this._imageProcessingEnabled=!0,this._bloomScale=.5,this._chromaticAberrationEnabled=!1,this._grainEnabled=!1,this._buildAllowed=!0,this.onBuildObservable=new s.y$,this._resizeObserver=null,this._hardwareScaleLevel=1,this._bloomKernel=64,this._bloomWeight=.15,this._bloomThreshold=.9,this._samples=1,this._hasCleared=!1,this._prevPostProcess=null,this._prevPrevPostProcess=null,this._depthOfFieldSceneObserver=null,this._activeCameraChangedObserver=null,this._activeCamerasChangedObserver=null,this._cameras=n||i.cameras,this._cameras=this._cameras.slice(),this._camerasToBeAttached=this._cameras.slice(),this._buildAllowed=r,this._scene=i;const o=this._scene.getEngine().getCaps();this._hdr=t&&(o.textureHalfFloatRender||o.textureFloatRender),this._hdr?o.textureHalfFloatRender?this._defaultPipelineTextureType=2:o.textureFloatRender&&(this._defaultPipelineTextureType=1):this._defaultPipelineTextureType=0,i.postProcessRenderPipelineManager.addPipeline(this);const a=this._scene.getEngine();this.sharpen=new G_("sharpen",1,null,K.x.BILINEAR_SAMPLINGMODE,a,!1,this._defaultPipelineTextureType,!0),this._sharpenEffect=new v_(a,this.SharpenPostProcessId,(()=>this.sharpen),!0),this.depthOfField=new D_(this._scene,null,this._depthOfFieldBlurLevel,this._defaultPipelineTextureType,!0),this.bloom=new S_(this._scene,this._bloomScale,this._bloomWeight,this.bloomKernel,this._defaultPipelineTextureType,!0),this.chromaticAberration=new x_("ChromaticAberration",a.getRenderWidth(),a.getRenderHeight(),1,null,K.x.BILINEAR_SAMPLINGMODE,a,!1,this._defaultPipelineTextureType,!0),this._chromaticAberrationEffect=new v_(a,this.ChromaticAberrationPostProcessId,(()=>this.chromaticAberration),!0),this.grain=new B_("Grain",1,null,K.x.BILINEAR_SAMPLINGMODE,a,!1,this._defaultPipelineTextureType,!0),this._grainEffect=new v_(a,this.GrainPostProcessId,(()=>this.grain),!0),this._resizeObserver=a.onResizeObservable.add((()=>{this._hardwareScaleLevel=a.getHardwareScalingLevel(),this.bloomKernel=this._bloomKernel})),this._imageProcessingConfigurationObserver=this._scene.imageProcessingConfiguration.onUpdateParameters.add((()=>{this.bloom._downscale._exposure=this._scene.imageProcessingConfiguration.exposure,this.imageProcessingEnabled!==this._scene.imageProcessingConfiguration.isEnabled&&(this._imageProcessingEnabled=this._scene.imageProcessingConfiguration.isEnabled,this._buildPipeline())})),this._buildPipeline()}get scene(){return this._scene}set sharpenEnabled(e){this._sharpenEnabled!==e&&(this._sharpenEnabled=e,this._buildPipeline())}get sharpenEnabled(){return this._sharpenEnabled}get bloomKernel(){return this._bloomKernel}set bloomKernel(e){this._bloomKernel=e,this.bloom.kernel=e/this._hardwareScaleLevel}set bloomWeight(e){this._bloomWeight!==e&&(this.bloom.weight=e,this._bloomWeight=e)}get bloomWeight(){return this._bloomWeight}set bloomThreshold(e){this._bloomThreshold!==e&&(this.bloom.threshold=e,this._bloomThreshold=e)}get bloomThreshold(){return this._bloomThreshold}set bloomScale(e){this._bloomScale!==e&&(this._bloomScale=e,this._rebuildBloom(),this._buildPipeline())}get bloomScale(){return this._bloomScale}set bloomEnabled(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())}get bloomEnabled(){return this._bloomEnabled}_rebuildBloom(){const e=this.bloom;this.bloom=new S_(this._scene,this.bloomScale,this._bloomWeight,this.bloomKernel,this._defaultPipelineTextureType,!1),this.bloom.threshold=e.threshold;for(let t=0;t1){for(const e of this._cameras)this._scene.enableDepthRenderer(e).useOnlyInActiveCamera=!0;this._depthOfFieldSceneObserver=this._scene.onAfterRenderTargetsRenderObservable.add((e=>{this._cameras.indexOf(e.activeCamera)>-1&&(this.depthOfField.depthTexture=e.enableDepthRenderer(e.activeCamera).getDepthMap())}))}else{this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);const e=this._scene.enableDepthRenderer(this._cameras[0]);this.depthOfField.depthTexture=e.getDepthMap()}this.depthOfField._isReady()||this.depthOfField._updateEffects(),this.addEffect(this.depthOfField),this._setAutoClearAndTextureSharing(this.depthOfField._effects[0],!0)}else this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);this.bloomEnabled&&(this.bloom._isReady()||this.bloom._updateEffects(),this.addEffect(this.bloom),this._setAutoClearAndTextureSharing(this.bloom._effects[0],!0)),this._imageProcessingEnabled&&(this.imageProcessing=new qt("imageProcessing",1,null,K.x.BILINEAR_SAMPLINGMODE,e,!1,this._defaultPipelineTextureType,this.scene.imageProcessingConfiguration),this._hdr?(this.addEffect(new v_(e,this.ImageProcessingPostProcessId,(()=>this.imageProcessing),!0)),this._setAutoClearAndTextureSharing(this.imageProcessing)):this._scene.imageProcessingConfiguration.applyByPostProcess=!1,this._cameras&&0!==this._cameras.length||(this._scene.imageProcessingConfiguration.applyByPostProcess=!1),this.imageProcessing.getEffect()||this.imageProcessing._updateParameters()),this.sharpenEnabled&&(this.sharpen.isReady()||this.sharpen.updateEffect(),this.addEffect(this._sharpenEffect),this._setAutoClearAndTextureSharing(this.sharpen)),this.grainEnabled&&(this.grain.isReady()||this.grain.updateEffect(),this.addEffect(this._grainEffect),this._setAutoClearAndTextureSharing(this.grain)),this.chromaticAberrationEnabled&&(this.chromaticAberration.isReady()||this.chromaticAberration.updateEffect(),this.addEffect(this._chromaticAberrationEffect),this._setAutoClearAndTextureSharing(this.chromaticAberration)),this.fxaaEnabled&&(this.fxaa=new F_("fxaa",1,null,K.x.BILINEAR_SAMPLINGMODE,e,!1,this._defaultPipelineTextureType),this.addEffect(new v_(e,this.FxaaPostProcessId,(()=>this.fxaa),!0)),this._setAutoClearAndTextureSharing(this.fxaa,!0)),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),(this._scene.activeCameras&&this._scene.activeCameras.length>1||this._scene.activeCamera&&-1===this._cameras.indexOf(this._scene.activeCamera))&&(this._scene.autoClear=!0),this._activeCameraChangedObserver||(this._activeCameraChangedObserver=this._scene.onActiveCameraChanged.add((()=>{this._scene.activeCamera&&-1===this._cameras.indexOf(this._scene.activeCamera)&&(this._scene.autoClear=!0)}))),this._activeCamerasChangedObserver||(this._activeCamerasChangedObserver=this._scene.onActiveCamerasChanged.add((()=>{this._scene.activeCameras&&this._scene.activeCameras.length>1&&(this._scene.autoClear=!0)}))),!this._enableMSAAOnFirstPostProcess(this.samples)&&this.samples>1&&u.Y.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0"),this.onBuildObservable.notifyObservers(this)}_disposePostProcesses(e=!1){for(let t=0;tnew H_(e._name,e._name._hdr,t)),e,t,i)}}(0,X.gn)([(0,Y.qC)()],H_.prototype,"sharpenEnabled",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"bloomKernel",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"_bloomWeight",void 0),(0,X.gn)([(0,Y.qC)()],H_.prototype,"_bloomThreshold",void 0),(0,X.gn)([(0,Y.qC)()],H_.prototype,"_hdr",void 0),(0,X.gn)([(0,Y.qC)()],H_.prototype,"bloomWeight",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"bloomThreshold",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"bloomScale",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"bloomEnabled",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"depthOfFieldEnabled",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"depthOfFieldBlurLevel",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"fxaaEnabled",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"samples",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"imageProcessingEnabled",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"glowLayerEnabled",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"chromaticAberrationEnabled",null),(0,X.gn)([(0,Y.qC)()],H_.prototype,"grainEnabled",null),(0,l.H)("BABYLON.DefaultRenderingPipeline",H_);dt.v.ShadersStore.lensHighlightsPixelShader="uniform sampler2D textureSampler; \nuniform float gain;\nuniform float threshold;\nuniform float screen_width;\nuniform float screen_height;\nvarying vec2 vUV;\nvec4 highlightColor(vec4 color) {\nvec4 highlight=color;\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\nfloat lum_threshold;\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\nhighlight*=luminance*gain;\nhighlight.a=1.0;\nreturn highlight;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 original=texture2D(textureSampler,vUV);\nif (gain==-1.0) {\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nreturn;\n}\nfloat w=2.0/screen_width;\nfloat h=2.0/screen_height;\nfloat weight=1.0;\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;\ngl_FragColor=blurred;\n}";dt.v.ShadersStore.depthOfFieldPixelShader="uniform sampler2D textureSampler;\nuniform sampler2D highlightsSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D grainSampler;\nuniform float grain_amount;\nuniform bool blur_noise;\nuniform float screen_width;\nuniform float screen_height;\nuniform float distortion;\nuniform bool dof_enabled;\nuniform float screen_distance; \nuniform float aperture;\nuniform float darken;\nuniform float edge_blur;\nuniform bool highlights;\nuniform float near;\nuniform float far;\nvarying vec2 vUV;\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1 \nvec2 centered_screen_pos;\nvec2 distorted_coords;\nfloat radius2;\nfloat radius;\nvec2 rand(vec2 co)\n{\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\n}\nvec2 getDistortedCoords(vec2 coords) {\nif (distortion==0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);\nvec2 dist_coords=vec2(0.5,0.5);\ndist_coords.x=0.5+direction.x*radius2*1.0;\ndist_coords.y=0.5+direction.y*radius2*1.0;\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\ndist_coords=mix(coords,dist_coords,dist_amount);\nreturn dist_coords;\n}\nfloat sampleScreen(inout vec4 color,in vec2 offset,in float weight) {\nvec2 coords=distorted_coords;\nfloat angle=rand(coords*100.0).x*TWOPI;\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\ncolor+=texture2D(textureSampler,coords)*weight;\nreturn weight;\n}\nfloat getBlurLevel(float size) {\nreturn min(3.0,ceil(size/1.0));\n}\nvec4 getBlurColor(float size) {\nvec4 col=texture2D(textureSampler,distorted_coords);\nfloat blur_level=getBlurLevel(size);\nfloat w=(size/screen_width);\nfloat h=(size/screen_height);\nfloat total_weight=1.0;\nvec2 sample_coords;\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\nif (blur_level>1.0) {\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\n}\nif (blur_level>2.0) {\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\n}\ncol/=total_weight; \nif (darken>0.0) {\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\n}\nreturn col;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\nradius=sqrt(radius2);\ndistorted_coords=getDistortedCoords(vUV); \nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height); \nfloat depth=texture2D(depthSampler,distorted_coords).r; \nfloat distance=near+(far-near)*depth; \nvec4 color=texture2D(textureSampler,vUV); \nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\nif (dof_enabled==false || coc<0.07) { coc=0.0; }\nfloat edge_blur_amount=0.0;\nif (edge_blur>0.0) {\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\n}\nfloat blur_amount=max(edge_blur_amount,coc);\nif (blur_amount==0.0) {\ngl_FragColor=texture2D(textureSampler,distorted_coords);\n}\nelse {\ngl_FragColor=getBlurColor(blur_amount*1.7);\nif (highlights) {\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\n}\nif (blur_noise) {\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\n}\n}\nif (grain_amount>0.0) {\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\n}\n}\n";class X_{constructor(){this.enabled=!1,this.name="ssao2",this.texturesRequired=[6,5]}}dt.v.ShadersStore.ssao2PixelShader="precision highp float;\nuniform sampler2D textureSampler;\nuniform float near;\nuniform float far;\nuniform float radius;\nfloat scales[16]=float[16](\n0.1,\n0.11406250000000001,\n0.131640625,\n0.15625,\n0.187890625,\n0.2265625,\n0.272265625,\n0.325,\n0.384765625,\n0.4515625,\n0.525390625,\n0.60625,\n0.694140625,\n0.7890625,\n0.891015625,\n1.0\n);\nvarying vec2 vUV;\nfloat perspectiveDepthToViewZ(in float invClipZ,in float near,in float far ) {\nreturn ( near*far )/( ( far-near )*invClipZ-far );\n}\nfloat viewZToPerspectiveDepth( in float viewZ,in float near,in float far ) {\nreturn ( near*far/viewZ+far)/( far-near );\n}\nfloat viewZToOrthographicDepth( in float viewZ,in float near,in float far ) {\nreturn ( viewZ+near )/( near-far );\n}\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D normalSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float base;\nuniform float xViewport;\nuniform float yViewport;\nuniform mat3 depthProjection;\nuniform float maxZ;\nuniform float minZAspect;\nuniform vec2 texelSize;\nuniform mat4 projection;\nvoid main()\n{\nvec3 random=texture2D(randomSampler,vUV*randTextureTiles).rgb;\nfloat depth=texture2D(depthSampler,vUV).r;\nfloat depthSign=depth/abs(depth);\ndepth=depth*depthSign;\nvec3 normal=texture2D(normalSampler,vUV).rgb;\nfloat occlusion=0.0;\nfloat correctedRadius=min(radius,minZAspect*depth/near);\nvec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign);\nvec3 vDepthFactor=depthProjection*vec3(1.0,1.0,depth);\nvec3 origin=vViewRay*vDepthFactor;\nvec3 rvec=random*2.0-1.0;\nrvec.z=0.0;\nfloat dotProduct=dot(rvec,normal);\nrvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);\nvec3 tangent=normalize(rvec-normal*dot(rvec,normal));\nvec3 bitangent=cross(normal,tangent);\nmat3 tbn=mat3(tangent,bitangent,normal);\nfloat difference;\nfor (int i=0; i1.0 || offset.y>1.0) {\ncontinue;\n}\nfloat sampleDepth=abs(texture2D(depthSampler,offset.xy).r);\ndifference=depthSign*samplePosition.z-sampleDepth;\nfloat rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);\nocclusion+=(difference>=0.0 ? 1.0 : 0.0)*rangeCheck;\n}\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor=vec4(vec3(result),1.0);\n}\n#endif\n#ifdef BILATERAL_BLUR\nuniform sampler2D depthSampler;\nuniform float outSize;\nuniform float samplerOffsets[SAMPLES];\nvec4 blur9(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.3846153846)*direction;\nvec2 off2=vec2(3.2307692308)*direction;\ncolor+=texture2D(image,uv)*0.2270270270;\ncolor+=texture2D(image,uv+(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv-(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv+(off2/resolution))*0.0702702703;\ncolor+=texture2D(image,uv-(off2/resolution))*0.0702702703;\nreturn color;\n}\nvec4 blur13(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\ncolor+=texture2D(image,uv)*0.1964825501511404;\ncolor+=texture2D(image,uv+(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv-(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv+(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv-(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv+(off3/resolution))*0.010381362401148057;\ncolor+=texture2D(image,uv-(off3/resolution))*0.010381362401148057;\nreturn color;\n}\nvec4 blur13Bilateral(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\nfloat compareDepth=abs(texture2D(depthSampler,uv).r);\nfloat sampleDepth;\nfloat weight;\nfloat weightSum=30.0;\ncolor+=texture2D(image,uv)*30.0;\nsampleDepth=abs(texture2D(depthSampler,uv+(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+= weight;\ncolor+=texture2D(image,uv+(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+= weight;\ncolor+=texture2D(image,uv-(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv+(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv+(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off3/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off3/resolution))*weight;\nreturn color/weightSum;\n}\nvoid main()\n{\n#if EXPENSIVE\nfloat compareDepth=abs(texture2D(depthSampler,vUV).r);\nfloat texelsize=1.0/outSize;\nfloat result=0.0;\nfloat weightSum=0.0;\nfor (int i=0; ithis._originalColorPostProcess),!0)),this.addEffect(new v_(t.getEngine(),this.SSAORenderEffect,(()=>this._ssaoPostProcess),!0)),this.addEffect(new v_(t.getEngine(),this.SSAOBlurHRenderEffect,(()=>this._blurHPostProcess),!0)),this.addEffect(new v_(t.getEngine(),this.SSAOBlurVRenderEffect,(()=>this._blurVPostProcess),!0)),this.addEffect(new v_(t.getEngine(),this.SSAOCombineRenderEffect,(()=>this._ssaoCombinePostProcess),!0)),t.postProcessRenderPipelineManager.addPipeline(this),n&&t.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,n)}set samples(e){this._samples=e,this._ssaoPostProcess.updateEffect(this._getDefinesForSSAO()),this._sampleSphere=this._generateHemisphere()}get samples(){return this._samples}set textureSamples(e){this._textureSamples=e,this._prePassRenderer?this._prePassRenderer.samples=e:this._originalColorPostProcess.samples=e}get textureSamples(){return this._textureSamples}get _geometryBufferRenderer(){return this._forceGeometryBuffer?this._scene.geometryBufferRenderer:null}get _prePassRenderer(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer}set expensiveBlur(e){this._blurHPostProcess.updateEffect("#define BILATERAL_BLUR\n#define BILATERAL_BLUR_H\n#define SAMPLES 16\n#define EXPENSIVE "+(e?"1":"0")+"\n",null,["textureSampler","depthSampler"]),this._blurVPostProcess.updateEffect("#define BILATERAL_BLUR\n#define SAMPLES 16\n#define EXPENSIVE "+(e?"1":"0")+"\n",null,["textureSampler","depthSampler"]),this._expensiveBlur=e}get expensiveBlur(){return this._expensiveBlur}static get IsSupported(){const e=m.l.LastCreatedEngine;return!!e&&e._features.supportSSAO2}get scene(){return this._scene}getClassName(){return"SSAO2RenderingPipeline"}dispose(e=!1){for(let e=0;e{this._scene.activeCamera&&(e.setFloat("outSize",this._ssaoCombinePostProcess.width>0?this._ssaoCombinePostProcess.width:this._originalColorPostProcess.width),e.setFloat("near",this._scene.activeCamera.minZ),e.setFloat("far",this._scene.activeCamera.maxZ),e.setFloat("radius",this.radius),this._geometryBufferRenderer?e.setTexture("depthSampler",this._geometryBufferRenderer.getGBuffer().textures[0]):this._prePassRenderer&&e.setTexture("depthSampler",this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(5)]),e.setArray("samplerOffsets",this._samplerOffsets))},this._blurVPostProcess=new _t.D("BlurV","ssao2",["outSize","samplerOffsets","near","far","radius"],["depthSampler"],t,null,K.x.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define BILATERAL_BLUR\n#define BILATERAL_BLUR_V\n#define SAMPLES 16\n#define EXPENSIVE "+(n?"1":"0")+"\n",i),this._blurVPostProcess.onApply=e=>{this._scene.activeCamera&&(e.setFloat("outSize",this._ssaoCombinePostProcess.height>0?this._ssaoCombinePostProcess.height:this._originalColorPostProcess.height),e.setFloat("near",this._scene.activeCamera.minZ),e.setFloat("far",this._scene.activeCamera.maxZ),e.setFloat("radius",this.radius),this._geometryBufferRenderer?e.setTexture("depthSampler",this._geometryBufferRenderer.getGBuffer().textures[0]):this._prePassRenderer&&e.setTexture("depthSampler",this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(5)]),e.setArray("samplerOffsets",this._samplerOffsets))},this._blurHPostProcess.samples=this.textureSamples,this._blurVPostProcess.samples=this.textureSamples}_rebuild(){super._rebuild()}_radicalInverse_VdC(e){return this._bits[0]=e,this._bits[0]=(this._bits[0]<<16|this._bits[0]>>16)>>>0,this._bits[0]=(1431655765&this._bits[0])<<1|(2863311530&this._bits[0])>>>1>>>0,this._bits[0]=(858993459&this._bits[0])<<2|(3435973836&this._bits[0])>>>2>>>0,this._bits[0]=(252645135&this._bits[0])<<4|(4042322160&this._bits[0])>>>4>>>0,this._bits[0]=(16711935&this._bits[0])<<8|(4278255360&this._bits[0])>>>8>>>0,2.3283064365386963e-10*this._bits[0]}_hammersley(e,t){return[e/t,this._radicalInverse_VdC(e)]}_hemisphereSample_uniform(e,t){const i=2*t*Math.PI,n=1-.85*e,r=Math.sqrt(1-n*n);return new o.P(Math.cos(i)*r,Math.sin(i)*r,n)}_generateHemisphere(){const e=this.samples,t=[];let i,n=0;for(;n{var t,i,n,r;if(this._scene.activeCamera){if(e.setArray3("sampleSphere",this._sampleSphere),e.setFloat("randTextureTiles",32),e.setFloat("samplesFactor",1/this.samples),e.setFloat("totalStrength",this.totalStrength),e.setFloat2("texelSize",1/this._ssaoPostProcess.width,1/this._ssaoPostProcess.height),e.setFloat("radius",this.radius),e.setFloat("maxZ",this.maxZ),e.setFloat("minZAspect",this.minZAspect),e.setFloat("base",this.base),e.setFloat("near",this._scene.activeCamera.minZ),e.setFloat("far",this._scene.activeCamera.maxZ),this._scene.activeCamera.mode===Le.V.PERSPECTIVE_CAMERA)e.setMatrix3x3("depthProjection",Y_.PERSPECTIVE_DEPTH_PROJECTION),e.setFloat("xViewport",Math.tan(this._scene.activeCamera.fov/2)*this._scene.getEngine().getAspectRatio(this._scene.activeCamera,!0)),e.setFloat("yViewport",Math.tan(this._scene.activeCamera.fov/2));else{const s=this._scene.getEngine().getRenderWidth()/2,o=this._scene.getEngine().getRenderHeight()/2,a=null!==(t=this._scene.activeCamera.orthoLeft)&&void 0!==t?t:-s,l=null!==(i=this._scene.activeCamera.orthoRight)&&void 0!==i?i:s,c=null!==(n=this._scene.activeCamera.orthoBottom)&&void 0!==n?n:-o,h=null!==(r=this._scene.activeCamera.orthoTop)&&void 0!==r?r:o;e.setMatrix3x3("depthProjection",Y_.ORTHO_DEPTH_PROJECTION),e.setFloat("xViewport",.5*(l-a)),e.setFloat("yViewport",.5*(h-c))}e.setMatrix("projection",this._scene.getProjectionMatrix()),this._geometryBufferRenderer?(e.setTexture("depthSampler",this._geometryBufferRenderer.getGBuffer().textures[0]),e.setTexture("normalSampler",this._geometryBufferRenderer.getGBuffer().textures[1])):this._prePassRenderer&&(e.setTexture("depthSampler",this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(5)]),e.setTexture("normalSampler",this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(6)])),e.setTexture("randomSampler",this._randomTexture)}},this._ssaoPostProcess.samples=this.textureSamples,this._forceGeometryBuffer||(this._ssaoPostProcess._prePassEffectConfiguration=new X_)}_createSSAOCombinePostProcess(e,t){this._ssaoCombinePostProcess=new _t.D("ssaoCombine","ssaoCombine",[],["originalColor","viewport"],e,null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,void 0,t),this._ssaoCombinePostProcess.onApply=e=>{const t=this._scene.activeCamera.viewport;e.setVector4("viewport",o.jp.Vector4[0].copyFromFloats(t.x,t.y,t.width,t.height)),e.setTextureFromPostProcessOutput("originalColor",this._originalColorPostProcess)},this._ssaoCombinePostProcess.samples=this.textureSamples}_createRandomTexture(){this._randomTexture=new Qt.c("SSAORandomTexture",128,this._scene,!1,K.x.TRILINEAR_SAMPLINGMODE),this._randomTexture.wrapU=K.x.WRAP_ADDRESSMODE,this._randomTexture.wrapV=K.x.WRAP_ADDRESSMODE;const e=this._randomTexture.getContext(),t=(e,t)=>Math.random()*(t-e)+e,i=o.P.Zero();for(let n=0;n<128;n++)for(let r=0;r<128;r++)i.x=t(0,1),i.y=t(0,1),i.z=0,i.normalize(),i.scaleInPlace(255),i.x=Math.floor(i.x),i.y=Math.floor(i.y),e.fillStyle="rgb("+i.x+", "+i.y+", "+i.z+")",e.fillRect(n,r,1,1);this._randomTexture.update(!1)}serialize(){const e=Y.p4.Serialize(this);return e.customType="SSAO2RenderingPipeline",e}static Parse(e,t,i){return Y.p4.Parse((()=>new Y_(e._name,t,e._ratio)),e,t,i)}}Y_.ORTHO_DEPTH_PROJECTION=[1,0,0,0,1,0,0,0,1],Y_.PERSPECTIVE_DEPTH_PROJECTION=[0,0,0,0,0,0,1,1,1],(0,X.gn)([(0,Y.qC)()],Y_.prototype,"totalStrength",void 0),(0,X.gn)([(0,Y.qC)()],Y_.prototype,"maxZ",void 0),(0,X.gn)([(0,Y.qC)()],Y_.prototype,"minZAspect",void 0),(0,X.gn)([(0,Y.qC)("samples")],Y_.prototype,"_samples",void 0),(0,X.gn)([(0,Y.qC)("textureSamples")],Y_.prototype,"_textureSamples",void 0),(0,X.gn)([(0,Y.qC)()],Y_.prototype,"_ratio",void 0),(0,X.gn)([(0,Y.qC)("expensiveBlur")],Y_.prototype,"_expensiveBlur",void 0),(0,X.gn)([(0,Y.qC)()],Y_.prototype,"radius",void 0),(0,X.gn)([(0,Y.qC)()],Y_.prototype,"base",void 0),(0,l.H)("BABYLON.SSAO2RenderingPipeline",Y_);dt.v.ShadersStore.ssaoPixelShader="uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float radius;\nuniform float area;\nuniform float fallOff;\nuniform float base;\nvec3 normalFromDepth(float depth,vec2 coords)\n{\nvec2 offset1=vec2(0.0,radius);\nvec2 offset2=vec2(radius,0.0);\nfloat depth1=texture2D(textureSampler,coords+offset1).r;\nfloat depth2=texture2D(textureSampler,coords+offset2).r;\nvec3 p1=vec3(offset1,depth1-depth);\nvec3 p2=vec3(offset2,depth2-depth);\nvec3 normal=cross(p1,p2);\nnormal.z=-normal.z;\nreturn normalize(normal);\n}\nvoid main()\n{\nvec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);\nfloat depth=texture2D(textureSampler,vUV).r;\nvec3 position=vec3(vUV,depth);\nvec3 normal=normalFromDepth(depth,vUV);\nfloat radiusDepth=radius/depth;\nfloat occlusion=0.0;\nvec3 ray;\nvec3 hemiRay;\nfloat occlusionDepth;\nfloat difference;\nfor (int i=0; ithis._originalColorPostProcess),!0)),this.addEffect(new v_(t.getEngine(),this.SSAORenderEffect,(()=>this._ssaoPostProcess),!0)),this.addEffect(new v_(t.getEngine(),this.SSAOBlurHRenderEffect,(()=>this._blurHPostProcess),!0)),this.addEffect(new v_(t.getEngine(),this.SSAOBlurVRenderEffect,(()=>this._blurVPostProcess),!0)),this.addEffect(new v_(t.getEngine(),this.SSAOCombineRenderEffect,(()=>this._ssaoCombinePostProcess),!0)),t.postProcessRenderPipelineManager.addPipeline(this),n&&t.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,n)}get scene(){return this._scene}_attachCameras(e,t){super._attachCameras(e,t);for(const e of this._cameras)this._scene.enableDepthRenderer(e).getDepthMap()}getClassName(){return"SSAORenderingPipeline"}dispose(e=!1){for(let e=0;e{const e=this._blurHPostProcess.width/this._scene.getEngine().getRenderWidth();this._blurHPostProcess.kernel=16*e})),this._blurVPostProcess.onActivateObservable.add((()=>{const e=this._blurVPostProcess.height/this._scene.getEngine().getRenderHeight();this._blurVPostProcess.kernel=16*e}))}_rebuild(){this._firstUpdate=!0,super._rebuild()}_createSSAOPostProcess(e){const t=[.5381,.1856,-.4319,.1379,.2486,.443,.3371,.5679,-.0057,-.6999,-.0451,-.0019,.0689,-.1598,-.8547,.056,.0069,-.1843,-.0146,.1402,.0762,.01,-.1924,-.0344,-.3577,-.5301,-.4358,-.3169,.1063,.0158,.0103,-.5869,.0046,-.0897,-.494,.3287,.7119,-.0154,-.0918,-.0533,.0596,-.5411,.0352,-.0631,.546,-.4776,.2847,-.0271];this._ssaoPostProcess=new _t.D("ssao","ssao",["sampleSphere","samplesFactor","randTextureTiles","totalStrength","radius","area","fallOff","base","range","viewport"],["randomSampler"],e,null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define SAMPLES 16\n#define SSAO"),this._ssaoPostProcess.externalTextureSamplerBinding=!0,this._ssaoPostProcess.onApply=e=>{this._firstUpdate&&(e.setArray3("sampleSphere",t),e.setFloat("samplesFactor",.0625),e.setFloat("randTextureTiles",4)),e.setFloat("totalStrength",this.totalStrength),e.setFloat("radius",this.radius),e.setFloat("area",this.area),e.setFloat("fallOff",this.fallOff),e.setFloat("base",this.base),e.setTexture("textureSampler",this._scene.enableDepthRenderer(this._scene.activeCamera).getDepthMap()),e.setTexture("randomSampler",this._randomTexture)}}_createSSAOCombinePostProcess(e){this._ssaoCombinePostProcess=new _t.D("ssaoCombine","ssaoCombine",[],["originalColor","viewport"],e,null,K.x.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._ssaoCombinePostProcess.onApply=e=>{e.setVector4("viewport",o.jp.Vector4[0].copyFromFloats(0,0,1,1)),e.setTextureFromPostProcess("originalColor",this._originalColorPostProcess)}}_createRandomTexture(){this._randomTexture=new Qt.c("SSAORandomTexture",512,this._scene,!1,K.x.TRILINEAR_SAMPLINGMODE),this._randomTexture.wrapU=K.x.WRAP_ADDRESSMODE,this._randomTexture.wrapV=K.x.WRAP_ADDRESSMODE;const e=this._randomTexture.getContext(),t=(e,t)=>Math.random()*(t-e)+e,i=o.P.Zero();for(let n=0;n<512;n++)for(let r=0;r<512;r++)i.x=Math.floor(255*Math.max(0,t(-1,1))),i.y=Math.floor(255*Math.max(0,t(-1,1))),i.z=Math.floor(255*Math.max(0,t(-1,1))),e.fillStyle="rgb("+i.x+", "+i.y+", "+i.z+")",e.fillRect(n,r,1,1);this._randomTexture.update(!1)}}(0,X.gn)([(0,Y.qC)()],Q_.prototype,"totalStrength",void 0),(0,X.gn)([(0,Y.qC)()],Q_.prototype,"radius",void 0),(0,X.gn)([(0,Y.qC)()],Q_.prototype,"area",void 0),(0,X.gn)([(0,Y.qC)()],Q_.prototype,"fallOff",void 0),(0,X.gn)([(0,Y.qC)()],Q_.prototype,"base",void 0);class q_{constructor(){this.enabled=!1,this.name="screenSpaceReflections",this.texturesRequired=[6,3,1]}}dt.v.ShadersStore.screenSpaceReflectionPixelShader="uniform sampler2D textureSampler;\n#ifdef SSR_SUPPORTED\nuniform sampler2D reflectivitySampler;\nuniform sampler2D normalSampler;\nuniform sampler2D positionSampler;\n#endif\nuniform mat4 view;\nuniform mat4 projection;\nuniform float stepSize;\nuniform float strength;\nuniform float threshold;\nuniform float roughnessFactor;\nuniform float reflectionSpecularFalloffExponent;\nvarying vec2 vUV;\n#ifdef SSR_SUPPORTED\nstruct ReflectionInfo {\nvec3 color;\nvec4 coords;\n};\n/**\n* According to specular,see https:\n*/\nvec3 fresnelSchlick(float cosTheta,vec3 F0)\n{\nreturn F0+(1.0-F0)*pow(1.0-cosTheta,5.0);\n}\n/**\n* Once the pixel's coordinates has been found,let's adjust (smooth) a little bit\n* by sampling multiple reflection pixels.\n*/\nReflectionInfo smoothReflectionInfo(vec3 dir,vec3 hitCoord)\n{\nReflectionInfo info;\ninfo.color=vec3(0.0);\nvec4 projectedCoord;\nfloat sampledDepth;\nfor(int i=0; i0.0)\nhitCoord-=dir;\nelse\nhitCoord+=dir;\ninfo.color+=texture2D(textureSampler,projectedCoord.xy).rgb;\n}\nprojectedCoord=projection*vec4(hitCoord,1.0);\nprojectedCoord.xy/=projectedCoord.w;\nprojectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);\ninfo.coords=vec4(projectedCoord.xy,sampledDepth,1.0);\ninfo.color+=texture2D(textureSampler,projectedCoord.xy).rgb;\ninfo.color/=float(SMOOTH_STEPS+1);\nreturn info;\n}\n/**\n* Tests the given world position (hitCoord) according to the given reflection vector (dir)\n* until it finds a collision (means that depth is enough close to say \"it's the pixel to sample!\").\n*/\nReflectionInfo getReflectionInfo(vec3 dir,vec3 hitCoord)\n{\nReflectionInfo info;\nvec4 projectedCoord;\nfloat sampledDepth;\ndir*=stepSize;\nfor(int i=0; i{const i=this._geometryBufferRenderer,n=this._prePassRenderer;if(!n&&!i)return;if(i){const t=i.getTextureIndex(N_.POSITION_TEXTURE_TYPE),n=i.getTextureIndex(N_.REFLECTIVITY_TEXTURE_TYPE);e.setTexture("normalSampler",i.getGBuffer().textures[1]),e.setTexture("positionSampler",i.getGBuffer().textures[t]),e.setTexture("reflectivitySampler",i.getGBuffer().textures[n])}else if(n){const t=n.getIndex(1),i=n.getIndex(3),r=n.getIndex(6);e.setTexture("normalSampler",n.getRenderTarget().textures[r]),e.setTexture("positionSampler",n.getRenderTarget().textures[t]),e.setTexture("reflectivitySampler",n.getRenderTarget().textures[i])}const r=t.activeCamera;if(!r)return;const s=r.getViewMatrix(!0),o=r.getProjectionMatrix(!0);e.setMatrix("projection",o),e.setMatrix("view",s),e.setFloat("threshold",this.threshold),e.setFloat("reflectionSpecularFalloffExponent",this.reflectionSpecularFalloffExponent),e.setFloat("strength",this.strength),e.setFloat("stepSize",this.step),e.setFloat("roughnessFactor",this.roughnessFactor)},this._isSceneRightHanded=t.useRightHandedSystem}get _geometryBufferRenderer(){return this._forceGeometryBuffer?this._scene.geometryBufferRenderer:null}get _prePassRenderer(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer}getClassName(){return"ScreenSpaceReflectionPostProcess"}get enableSmoothReflections(){return this._enableSmoothReflections}set enableSmoothReflections(e){e!==this._enableSmoothReflections&&(this._enableSmoothReflections=e,this._updateEffectDefines())}get reflectionSamples(){return this._reflectionSamples}set reflectionSamples(e){e!==this._reflectionSamples&&(this._reflectionSamples=e,this._updateEffectDefines())}get smoothSteps(){return this._smoothSteps}set smoothSteps(e){e!==this._smoothSteps&&(this._smoothSteps=e,this._updateEffectDefines())}_updateEffectDefines(){const e=[];(this._geometryBufferRenderer||this._prePassRenderer)&&e.push("#define SSR_SUPPORTED"),this._enableSmoothReflections&&e.push("#define ENABLE_SMOOTH_REFLECTIONS"),this._isSceneRightHanded&&e.push("#define RIGHT_HANDED_SCENE"),e.push("#define REFLECTION_SAMPLES "+(this._reflectionSamples>>0)),e.push("#define SMOOTH_STEPS "+(this._smoothSteps>>0)),this.updateEffect(e.join("\n"))}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new K_(e.name,i,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.textureType,e.reusable)),e,i,n)}}(0,X.gn)([(0,Y.qC)()],K_.prototype,"threshold",void 0),(0,X.gn)([(0,Y.qC)()],K_.prototype,"strength",void 0),(0,X.gn)([(0,Y.qC)()],K_.prototype,"reflectionSpecularFalloffExponent",void 0),(0,X.gn)([(0,Y.qC)()],K_.prototype,"step",void 0),(0,X.gn)([(0,Y.qC)()],K_.prototype,"roughnessFactor",void 0),(0,X.gn)([(0,Y.qC)()],K_.prototype,"enableSmoothReflections",null),(0,X.gn)([(0,Y.qC)()],K_.prototype,"reflectionSamples",null),(0,X.gn)([(0,Y.qC)()],K_.prototype,"smoothSteps",null),(0,l.H)("BABYLON.ScreenSpaceReflectionPostProcess",K_);dt.v.ShadersStore.standardPixelShader="uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#if defined(PASS_POST_PROCESS)\nvoid main(void)\n{\nvec4 color=texture2D(textureSampler,vUV);\ngl_FragColor=color;\n}\n#endif\n#if defined(DOWN_SAMPLE_X4)\nuniform vec2 dsOffsets[16];\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+dsOffsets[0]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[1]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[2]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[3]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[4]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[5]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[6]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[7]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[8]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[9]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[10]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[11]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[12]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[13]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[14]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[15]);\naverage/=16.0;\ngl_FragColor=average;\n}\n#endif\n#if defined(BRIGHT_PASS)\nuniform vec2 dsOffsets[4];\nuniform float brightThreshold;\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));\naverage*=0.25;\nfloat luminance=length(average.rgb);\nif (luminanceshadowPixelDepth)\naccumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));\ncurrentPosition+=stepL;\n}\naccumFog/=NB_STEPS;\nvec3 color=accumFog*scatteringPower;\ngl_FragColor=vec4(color*exp(color) ,1.0);\n}\n#endif\n#if defined(VLSMERGE)\nuniform sampler2D originalSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);\n}\n#endif\n#if defined(LUMINANCE)\nuniform vec2 lumOffsets[4];\nvoid main()\n{\nfloat average=0.0;\nvec4 color=vec4(0.0);\nfloat maximum=-1e20;\nvec3 weight=vec3(0.299,0.587,0.114);\nfor (int i=0; i<4; i++)\n{\ncolor=texture2D(textureSampler,vUV+ lumOffsets[i]);\nfloat GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));\n#ifdef WEIGHTED_AVERAGE\nfloat GreyValue=dot(color.rgb,weight);\n#endif\n#ifdef BRIGHTNESS\nfloat GreyValue=max(color.r,max(color.g,color.b));\n#endif\n#ifdef HSL_COMPONENT\nfloat GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));\n#endif\n#ifdef MAGNITUDE\nfloat GreyValue=length(color.rgb);\n#endif\nmaximum=max(maximum,GreyValue);\naverage+=(0.25*log(1e-5+GreyValue));\n}\naverage=exp(average);\ngl_FragColor=vec4(average,maximum,0.0,1.0);\n}\n#endif\n#if defined(LUMINANCE_DOWN_SAMPLE)\nuniform vec2 dsOffsets[9];\nuniform float halfDestPixelSize;\n#ifdef FINAL_DOWN_SAMPLER\n#include\n#endif\nvoid main()\n{\nvec4 color=vec4(0.0);\nfloat average=0.0;\nfor (int i=0; i<9; i++)\n{\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\naverage+=color.r;\n}\naverage/=9.0;\n#ifdef FINAL_DOWN_SAMPLER\ngl_FragColor=pack(average);\n#else\ngl_FragColor=vec4(average,average,0.0,1.0);\n#endif\n}\n#endif\n#if defined(HDR)\nuniform sampler2D textureAdderSampler;\nuniform float averageLuminance;\nvoid main()\n{\nvec4 color=texture2D(textureAdderSampler,vUV);\n#ifndef AUTO_EXPOSURE\nvec4 adjustedColor=color/averageLuminance;\ncolor=adjustedColor;\ncolor.a=1.0;\n#endif\ngl_FragColor=color;\n}\n#endif\n#if defined(LENS_FLARE)\n#define GHOSTS 3\nuniform sampler2D lensColorSampler;\nuniform float strength;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform vec2 resolution;\nuniform float distortionStrength;\nfloat hash(vec2 p)\n{\nfloat h=dot(p,vec2(127.1,311.7));\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\n}\nfloat noise(in vec2 p)\n{\nvec2 i=floor(p);\nvec2 f=fract(p);\nvec2 u=f*f*(3.0-2.0*f);\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\nhash(i+vec2(1.0,0.0)),u.x),\nmix(hash(i+vec2(0.0,1.0)),\nhash(i+vec2(1.0,1.0)),u.x),u.y);\n}\nfloat fbm(vec2 p)\n{\nfloat f=0.0;\nf+=0.5000*noise(p); p*=2.02;\nf+=0.2500*noise(p); p*=2.03;\nf+=0.1250*noise(p); p*=2.01;\nf+=0.0625*noise(p); p*=2.04;\nf/=0.9375;\nreturn f;\n}\nvec3 pattern(vec2 uv)\n{\nvec2 p=-1.0+2.0*uv;\nfloat p2=dot(p,p);\nfloat f=fbm(vec2(15.0*p2))/2.0;\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\nreturn (1.0-f)*vec3(r,g,b);\n}\nfloat luminance(vec3 color)\n{\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\n}\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\n{\nreturn vec4(\ntexture2D(tex,texcoord+direction*distortion.r).r,\ntexture2D(tex,texcoord+direction*distortion.g).g,\ntexture2D(tex,texcoord+direction*distortion.b).b,\n1.0\n);\n}\nvoid main(void)\n{\nvec2 uv=-vUV+vec2(1.0);\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\nvec2 texelSize=1.0/resolution;\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\nvec4 result=vec4(0.0);\nfloat ghostIndice=1.0;\nfor (int i=0; i=nSamples)\nbreak;\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\nresult+=texture2D(textureSampler,offset1);\n}\ngl_FragColor=result/float(nSamples);\n}\n#endif\n";class Z_ extends j_{constructor(e,t,i,n=null,r){super(t.getEngine(),e),this.downSampleX4PostProcess=null,this.brightPassPostProcess=null,this.blurHPostProcesses=[],this.blurVPostProcesses=[],this.textureAdderPostProcess=null,this.volumetricLightPostProcess=null,this.volumetricLightSmoothXPostProcess=null,this.volumetricLightSmoothYPostProcess=null,this.volumetricLightMergePostProces=null,this.volumetricLightFinalPostProcess=null,this.luminancePostProcess=null,this.luminanceDownSamplePostProcesses=[],this.hdrPostProcess=null,this.textureAdderFinalPostProcess=null,this.lensFlareFinalPostProcess=null,this.hdrFinalPostProcess=null,this.lensFlarePostProcess=null,this.lensFlareComposePostProcess=null,this.motionBlurPostProcess=null,this.depthOfFieldPostProcess=null,this.fxaaPostProcess=null,this.screenSpaceReflectionPostProcess=null,this.brightThreshold=1,this.blurWidth=512,this.horizontalBlur=!1,this.lensTexture=null,this.volumetricLightCoefficient=.2,this.volumetricLightPower=4,this.volumetricLightBlurScale=64,this.sourceLight=null,this.hdrMinimumLuminance=1,this.hdrDecreaseRate=.5,this.hdrIncreaseRate=.5,this.lensColorTexture=null,this.lensFlareStrength=20,this.lensFlareGhostDispersal=1.4,this.lensFlareHaloWidth=.7,this.lensFlareDistortionStrength=16,this.lensFlareBlurWidth=512,this.lensStarTexture=null,this.lensFlareDirtTexture=null,this.depthOfFieldDistance=10,this.depthOfFieldBlurWidth=64,this.animations=[],this._currentDepthOfFieldSource=null,this._fixedExposure=1,this._currentExposure=1,this._hdrAutoExposure=!1,this._hdrCurrentLuminance=1,this._motionStrength=1,this._isObjectBasedMotionBlur=!1,this._camerasToBeAttached=[],this._bloomEnabled=!1,this._depthOfFieldEnabled=!1,this._vlsEnabled=!1,this._lensFlareEnabled=!1,this._hdrEnabled=!1,this._motionBlurEnabled=!1,this._fxaaEnabled=!1,this._screenSpaceReflectionsEnabled=!1,this._motionBlurSamples=64,this._volumetricLightStepsCount=50,this._samples=1,this._cameras=r||t.cameras,this._cameras=this._cameras.slice(),this._camerasToBeAttached=this._cameras.slice(),this._scene=t,this._basePostProcess=n,this._ratio=i,this._floatTextureType=t.getEngine().getCaps().textureFloatRender?1:2,t.postProcessRenderPipelineManager.addPipeline(this),this._buildPipeline()}get exposure(){return this._fixedExposure}set exposure(e){this._fixedExposure=e,this._currentExposure=e}get hdrAutoExposure(){return this._hdrAutoExposure}set hdrAutoExposure(e){if(this._hdrAutoExposure=e,this.hdrPostProcess){const t=["#define HDR"];e&&t.push("#define AUTO_EXPOSURE"),this.hdrPostProcess.updateEffect(t.join("\n"))}}get motionStrength(){return this._motionStrength}set motionStrength(e){this._motionStrength=e,this._isObjectBasedMotionBlur&&this.motionBlurPostProcess&&(this.motionBlurPostProcess.motionStrength=e)}get objectBasedMotionBlur(){return this._isObjectBasedMotionBlur}set objectBasedMotionBlur(e){const t=this._isObjectBasedMotionBlur!==e;this._isObjectBasedMotionBlur=e,t&&this._buildPipeline()}get BloomEnabled(){return this._bloomEnabled}set BloomEnabled(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())}get DepthOfFieldEnabled(){return this._depthOfFieldEnabled}set DepthOfFieldEnabled(e){this._depthOfFieldEnabled!==e&&(this._depthOfFieldEnabled=e,this._buildPipeline())}get LensFlareEnabled(){return this._lensFlareEnabled}set LensFlareEnabled(e){this._lensFlareEnabled!==e&&(this._lensFlareEnabled=e,this._buildPipeline())}get HDREnabled(){return this._hdrEnabled}set HDREnabled(e){this._hdrEnabled!==e&&(this._hdrEnabled=e,this._buildPipeline())}get VLSEnabled(){return this._vlsEnabled}set VLSEnabled(e){if(this._vlsEnabled!==e){if(e&&!this._scene.enableGeometryBufferRenderer())return void u.Y.Warn("Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline");this._vlsEnabled=e,this._buildPipeline()}}get MotionBlurEnabled(){return this._motionBlurEnabled}set MotionBlurEnabled(e){this._motionBlurEnabled!==e&&(this._motionBlurEnabled=e,this._buildPipeline())}get fxaaEnabled(){return this._fxaaEnabled}set fxaaEnabled(e){this._fxaaEnabled!==e&&(this._fxaaEnabled=e,this._buildPipeline())}get screenSpaceReflectionsEnabled(){return this._screenSpaceReflectionsEnabled}set screenSpaceReflectionsEnabled(e){this._screenSpaceReflectionsEnabled!==e&&(this._screenSpaceReflectionsEnabled=e,this._buildPipeline())}get volumetricLightStepsCount(){return this._volumetricLightStepsCount}set volumetricLightStepsCount(e){this.volumetricLightPostProcess&&this.volumetricLightPostProcess.updateEffect("#define VLS\n#define NB_STEPS "+e.toFixed(1)),this._volumetricLightStepsCount=e}get motionBlurSamples(){return this._motionBlurSamples}set motionBlurSamples(e){this.motionBlurPostProcess&&(this._isObjectBasedMotionBlur?this.motionBlurPostProcess.motionBlurSamples=e:this.motionBlurPostProcess.updateEffect("#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+e.toFixed(1))),this._motionBlurSamples=e}get samples(){return this._samples}set samples(e){this._samples!==e&&(this._samples=e,this._buildPipeline())}_buildPipeline(){const e=this._ratio,t=this._scene;this._disposePostProcesses(),null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()),this._reset(),this._screenSpaceReflectionsEnabled&&(this.screenSpaceReflectionPostProcess=new K_("HDRPass",t,e,null,K.x.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,this._floatTextureType),this.screenSpaceReflectionPostProcess.onApplyObservable.add((()=>{this._currentDepthOfFieldSource=this.screenSpaceReflectionPostProcess})),this.addEffect(new v_(t.getEngine(),"HDRScreenSpaceReflections",(()=>this.screenSpaceReflectionPostProcess),!0))),this._basePostProcess?this.originalPostProcess=this._basePostProcess:this.originalPostProcess=new _t.D("HDRPass","standard",[],[],e,null,K.x.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,"#define PASS_POST_PROCESS",this._floatTextureType),this.originalPostProcess.autoClear=!this.screenSpaceReflectionPostProcess,this.originalPostProcess.onApplyObservable.add((()=>{this._currentDepthOfFieldSource=this.originalPostProcess})),this.addEffect(new v_(t.getEngine(),"HDRPassPostProcess",(()=>this.originalPostProcess),!0)),this._bloomEnabled&&(this._createDownSampleX4PostProcess(t,e/4),this._createBrightPassPostProcess(t,e/4),this._createBlurPostProcesses(t,e/4,1),this._createTextureAdderPostProcess(t,e),this.textureAdderFinalPostProcess=new _t.D("HDRDepthOfFieldSource","standard",[],[],e,null,K.x.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,"#define PASS_POST_PROCESS",0),this.addEffect(new v_(t.getEngine(),"HDRBaseDepthOfFieldSource",(()=>this.textureAdderFinalPostProcess),!0))),this._vlsEnabled&&(this._createVolumetricLightPostProcess(t,e),this.volumetricLightFinalPostProcess=new _t.D("HDRVLSFinal","standard",[],[],e,null,K.x.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,"#define PASS_POST_PROCESS",0),this.addEffect(new v_(t.getEngine(),"HDRVLSFinal",(()=>this.volumetricLightFinalPostProcess),!0))),this._lensFlareEnabled&&(this._createLensFlarePostProcess(t,e),this.lensFlareFinalPostProcess=new _t.D("HDRPostLensFlareDepthOfFieldSource","standard",[],[],e,null,K.x.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,"#define PASS_POST_PROCESS",0),this.addEffect(new v_(t.getEngine(),"HDRPostLensFlareDepthOfFieldSource",(()=>this.lensFlareFinalPostProcess),!0))),this._hdrEnabled&&(this._createLuminancePostProcesses(t,this._floatTextureType),this._createHdrPostProcess(t,e),this.hdrFinalPostProcess=new _t.D("HDRPostHDReDepthOfFieldSource","standard",[],[],e,null,K.x.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,"#define PASS_POST_PROCESS",0),this.addEffect(new v_(t.getEngine(),"HDRPostHDReDepthOfFieldSource",(()=>this.hdrFinalPostProcess),!0))),this._depthOfFieldEnabled&&(this._createBlurPostProcesses(t,e/2,3,"depthOfFieldBlurWidth"),this._createDepthOfFieldPostProcess(t,e)),this._motionBlurEnabled&&this._createMotionBlurPostProcess(t,e),this._fxaaEnabled&&(this.fxaaPostProcess=new F_("fxaa",1,null,K.x.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,0),this.addEffect(new v_(t.getEngine(),"HDRFxaa",(()=>this.fxaaPostProcess),!0))),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),!this._enableMSAAOnFirstPostProcess(this._samples)&&this._samples>1&&u.Y.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")}_createDownSampleX4PostProcess(e,t){const i=new Array(32);this.downSampleX4PostProcess=new _t.D("HDRDownSampleX4","standard",["dsOffsets"],[],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DOWN_SAMPLE_X4",this._floatTextureType),this.downSampleX4PostProcess.onApply=e=>{let t=0;const n=this.downSampleX4PostProcess.width,r=this.downSampleX4PostProcess.height;for(let e=-2;e<2;e++)for(let s=-2;s<2;s++)i[t]=(e+.5)*(1/n),i[t+1]=(s+.5)*(1/r),t+=2;e.setArray2("dsOffsets",i)},this.addEffect(new v_(e.getEngine(),"HDRDownSampleX4",(()=>this.downSampleX4PostProcess),!0))}_createBrightPassPostProcess(e,t){const i=new Array(8);this.brightPassPostProcess=new _t.D("HDRBrightPass","standard",["dsOffsets","brightThreshold"],[],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define BRIGHT_PASS",this._floatTextureType),this.brightPassPostProcess.onApply=e=>{const t=1/this.brightPassPostProcess.width,n=1/this.brightPassPostProcess.height;i[0]=-.5*t,i[1]=.5*n,i[2]=.5*t,i[3]=.5*n,i[4]=-.5*t,i[5]=-.5*n,i[6]=.5*t,i[7]=-.5*n,e.setArray2("dsOffsets",i),e.setFloat("brightThreshold",this.brightThreshold)},this.addEffect(new v_(e.getEngine(),"HDRBrightPass",(()=>this.brightPassPostProcess),!0))}_createBlurPostProcesses(e,t,i,n="blurWidth"){const r=e.getEngine(),s=new so("HDRBlurH_"+i,new o.FM(1,0),this[n],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType),a=new so("HDRBlurV_"+i,new o.FM(0,1),this[n],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType);s.onActivateObservable.add((()=>{const e=s.width/r.getRenderWidth();s.kernel=this[n]*e})),a.onActivateObservable.add((()=>{const e=a.height/r.getRenderHeight();a.kernel=this.horizontalBlur?64*e:this[n]*e})),this.addEffect(new v_(e.getEngine(),"HDRBlurH"+i,(()=>s),!0)),this.addEffect(new v_(e.getEngine(),"HDRBlurV"+i,(()=>a),!0)),this.blurHPostProcesses.push(s),this.blurVPostProcesses.push(a)}_createTextureAdderPostProcess(e,t){this.textureAdderPostProcess=new _t.D("HDRTextureAdder","standard",["exposure"],["otherSampler","lensSampler"],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define TEXTURE_ADDER",this._floatTextureType),this.textureAdderPostProcess.onApply=e=>{e.setTextureFromPostProcess("otherSampler",this._vlsEnabled?this._currentDepthOfFieldSource:this.originalPostProcess),e.setTexture("lensSampler",this.lensTexture),e.setFloat("exposure",this._currentExposure),this._currentDepthOfFieldSource=this.textureAdderFinalPostProcess},this.addEffect(new v_(e.getEngine(),"HDRTextureAdder",(()=>this.textureAdderPostProcess),!0))}_createVolumetricLightPostProcess(e,t){const i=e.enableGeometryBufferRenderer();i.enablePosition=!0;const n=i.getGBuffer();this.volumetricLightPostProcess=new _t.D("HDRVLS","standard",["shadowViewProjection","cameraPosition","sunDirection","sunColor","scatteringCoefficient","scatteringPower","depthValues"],["shadowMapSampler","positionSampler"],t/8,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLS\n#define NB_STEPS "+this._volumetricLightStepsCount.toFixed(1));const r=o.FM.Zero();this.volumetricLightPostProcess.onApply=e=>{if(this.sourceLight&&this.sourceLight.getShadowGenerator()&&this._scene.activeCamera){const t=this.sourceLight.getShadowGenerator();e.setTexture("shadowMapSampler",t.getShadowMap()),e.setTexture("positionSampler",n.textures[2]),e.setColor3("sunColor",this.sourceLight.diffuse),e.setVector3("sunDirection",this.sourceLight.getShadowDirection()),e.setVector3("cameraPosition",this._scene.activeCamera.globalPosition),e.setMatrix("shadowViewProjection",t.getTransformMatrix()),e.setFloat("scatteringCoefficient",this.volumetricLightCoefficient),e.setFloat("scatteringPower",this.volumetricLightPower),r.x=this.sourceLight.getDepthMinZ(this._scene.activeCamera),r.y=this.sourceLight.getDepthMaxZ(this._scene.activeCamera),e.setVector2("depthValues",r)}},this.addEffect(new v_(e.getEngine(),"HDRVLS",(()=>this.volumetricLightPostProcess),!0)),this._createBlurPostProcesses(e,t/4,0,"volumetricLightBlurScale"),this.volumetricLightMergePostProces=new _t.D("HDRVLSMerge","standard",[],["originalSampler"],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLSMERGE"),this.volumetricLightMergePostProces.onApply=e=>{e.setTextureFromPostProcess("originalSampler",this._bloomEnabled?this.textureAdderFinalPostProcess:this.originalPostProcess),this._currentDepthOfFieldSource=this.volumetricLightFinalPostProcess},this.addEffect(new v_(e.getEngine(),"HDRVLSMerge",(()=>this.volumetricLightMergePostProces),!0))}_createLuminancePostProcesses(e,t){let i=Math.pow(3,Z_.LuminanceSteps);this.luminancePostProcess=new _t.D("HDRLuminance","standard",["lumOffsets"],[],{width:i,height:i},null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LUMINANCE",t);const n=[];this.luminancePostProcess.onApply=e=>{const t=1/this.luminancePostProcess.width,i=1/this.luminancePostProcess.height;n[0]=-.5*t,n[1]=.5*i,n[2]=.5*t,n[3]=.5*i,n[4]=-.5*t,n[5]=-.5*i,n[6]=.5*t,n[7]=-.5*i,e.setArray2("lumOffsets",n)},this.addEffect(new v_(e.getEngine(),"HDRLuminance",(()=>this.luminancePostProcess),!0));for(let n=Z_.LuminanceSteps-1;n>=0;n--){i=Math.pow(3,n);let r="#define LUMINANCE_DOWN_SAMPLE\n";0===n&&(r+="#define FINAL_DOWN_SAMPLER");const s=new _t.D("HDRLuminanceDownSample"+n,"standard",["dsOffsets","halfDestPixelSize"],[],{width:i,height:i},null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,t);this.luminanceDownSamplePostProcesses.push(s)}let r=this.luminancePostProcess;this.luminanceDownSamplePostProcesses.forEach(((t,i)=>{const n=new Array(18);t.onApply=e=>{if(!r)return;let s=0;for(let e=-1;e<2;e++)for(let t=-1;t<2;t++)n[s]=e/r.width,n[s+1]=t/r.height,s+=2;e.setArray2("dsOffsets",n),e.setFloat("halfDestPixelSize",.5/r.width),r=i===this.luminanceDownSamplePostProcesses.length-1?this.luminancePostProcess:t},i===this.luminanceDownSamplePostProcesses.length-1&&(t.onAfterRender=()=>{const t=e.getEngine().readPixels(0,0,1,1),i=new o.Lt(1/16581375,1/65025,1/255,1);t.then((e=>{const t=new Uint8Array(e.buffer);this._hdrCurrentLuminance=(t[0]*i.x+t[1]*i.y+t[2]*i.z+t[3]*i.w)/100}))}),this.addEffect(new v_(e.getEngine(),"HDRLuminanceDownSample"+i,(()=>t),!0))}))}_createHdrPostProcess(e,t){const i=["#define HDR"];this._hdrAutoExposure&&i.push("#define AUTO_EXPOSURE"),this.hdrPostProcess=new _t.D("HDR","standard",["averageLuminance"],["textureAdderSampler"],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,i.join("\n"),0);let n=1,r=0,s=0;this.hdrPostProcess.onApply=t=>{if(t.setTextureFromPostProcess("textureAdderSampler",this._currentDepthOfFieldSource),r+=e.getEngine().getDeltaTime(),n<0)n=this._hdrCurrentLuminance;else{const e=(s-r)/1e3;this._hdrCurrentLuminancen-this.hdrIncreaseRate*e?n-=this.hdrIncreaseRate*e:n=this._hdrCurrentLuminance}this.hdrAutoExposure?this._currentExposure=this._fixedExposure/n:(n=ve.R.Clamp(n,this.hdrMinimumLuminance,1e20),t.setFloat("averageLuminance",n)),s=r,this._currentDepthOfFieldSource=this.hdrFinalPostProcess},this.addEffect(new v_(e.getEngine(),"HDR",(()=>this.hdrPostProcess),!0))}_createLensFlarePostProcess(e,t){this.lensFlarePostProcess=new _t.D("HDRLensFlare","standard",["strength","ghostDispersal","haloWidth","resolution","distortionStrength"],["lensColorSampler"],t/2,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE",0),this.addEffect(new v_(e.getEngine(),"HDRLensFlare",(()=>this.lensFlarePostProcess),!0)),this._createBlurPostProcesses(e,t/4,2,"lensFlareBlurWidth"),this.lensFlareComposePostProcess=new _t.D("HDRLensFlareCompose","standard",["lensStarMatrix"],["otherSampler","lensDirtSampler","lensStarSampler"],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE_COMPOSE",0),this.addEffect(new v_(e.getEngine(),"HDRLensFlareCompose",(()=>this.lensFlareComposePostProcess),!0));const i=new o.FM(0,0);this.lensFlarePostProcess.externalTextureSamplerBinding=!0,this.lensFlarePostProcess.onApply=e=>{e.setTextureFromPostProcess("textureSampler",this._bloomEnabled?this.blurHPostProcesses[0]:this.originalPostProcess),e.setTexture("lensColorSampler",this.lensColorTexture),e.setFloat("strength",this.lensFlareStrength),e.setFloat("ghostDispersal",this.lensFlareGhostDispersal),e.setFloat("haloWidth",this.lensFlareHaloWidth),i.x=this.lensFlarePostProcess.width,i.y=this.lensFlarePostProcess.height,e.setVector2("resolution",i),e.setFloat("distortionStrength",this.lensFlareDistortionStrength)};const n=o.y3.FromValues(2,0,-1,0,0,2,-1,0,0,0,1,0,0,0,0,1),r=o.y3.FromValues(.5,0,.5,0,0,.5,.5,0,0,0,1,0,0,0,0,1);this.lensFlareComposePostProcess.onApply=e=>{if(!this._scene.activeCamera)return;e.setTextureFromPostProcess("otherSampler",this.lensFlarePostProcess),e.setTexture("lensDirtSampler",this.lensFlareDirtTexture),e.setTexture("lensStarSampler",this.lensStarTexture);const t=this._scene.activeCamera.getViewMatrix().getRow(0),i=this._scene.activeCamera.getViewMatrix().getRow(2);let s=o.P.Dot(t.toVector3(),new o.P(1,0,0))+o.P.Dot(i.toVector3(),new o.P(0,0,1));s*=4;const a=o.y3.FromValues(.5*Math.cos(s),-Math.sin(s),0,0,Math.sin(s),.5*Math.cos(s),0,0,0,0,1,0,0,0,0,1),l=r.multiply(a).multiply(n);e.setMatrix("lensStarMatrix",l),this._currentDepthOfFieldSource=this.lensFlareFinalPostProcess}}_createDepthOfFieldPostProcess(e,t){this.depthOfFieldPostProcess=new _t.D("HDRDepthOfField","standard",["distance"],["otherSampler","depthSampler"],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DEPTH_OF_FIELD",0),this.depthOfFieldPostProcess.onApply=e=>{e.setTextureFromPostProcess("otherSampler",this._currentDepthOfFieldSource),e.setTexture("depthSampler",this._getDepthTexture()),e.setFloat("distance",this.depthOfFieldDistance)},this.addEffect(new v_(e.getEngine(),"HDRDepthOfField",(()=>this.depthOfFieldPostProcess),!0))}_createMotionBlurPostProcess(e,t){if(this._isObjectBasedMotionBlur){const i=new V_("HDRMotionBlur",e,t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,0);i.motionStrength=this.motionStrength,i.motionBlurSamples=this.motionBlurSamples,this.motionBlurPostProcess=i}else{this.motionBlurPostProcess=new _t.D("HDRMotionBlur","standard",["inverseViewProjection","prevViewProjection","screenSize","motionScale","motionStrength"],["depthSampler"],t,null,K.x.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+this.motionBlurSamples.toFixed(1),0);let i=0,n=o.y3.Identity();const r=o.y3.Identity();let s=o.y3.Identity();const a=o.FM.Zero();this.motionBlurPostProcess.onApply=t=>{s=e.getProjectionMatrix().multiply(e.getViewMatrix()),s.invertToRef(r),t.setMatrix("inverseViewProjection",r),t.setMatrix("prevViewProjection",n),n=s,a.x=this.motionBlurPostProcess.width,a.y=this.motionBlurPostProcess.height,t.setVector2("screenSize",a),i=e.getEngine().getFps()/60,t.setFloat("motionScale",i),t.setFloat("motionStrength",this.motionStrength),t.setTexture("depthSampler",this._getDepthTexture())}}this.addEffect(new v_(e.getEngine(),"HDRMotionBlur",(()=>this.motionBlurPostProcess),!0))}_getDepthTexture(){return this._scene.getEngine().getCaps().drawBuffersExtension?this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]:this._scene.enableDepthRenderer().getDepthMap()}_disposePostProcesses(){for(let e=0;enew Z_(e._name,t,e._ratio)),e,t,i);return e.sourceLightId&&(n.sourceLight=t.getLightById(e.sourceLightId)),e.screenSpaceReflectionPostProcess&&Y.p4.Parse((()=>n.screenSpaceReflectionPostProcess),e.screenSpaceReflectionPostProcess,t,i),n}}Z_.LuminanceSteps=6,(0,X.gn)([(0,Y.qC)()],Z_.prototype,"brightThreshold",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"blurWidth",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"horizontalBlur",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"exposure",null),(0,X.gn)([(0,Y.oU)("lensTexture")],Z_.prototype,"lensTexture",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"volumetricLightCoefficient",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"volumetricLightPower",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"volumetricLightBlurScale",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"hdrMinimumLuminance",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"hdrDecreaseRate",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"hdrIncreaseRate",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"hdrAutoExposure",null),(0,X.gn)([(0,Y.oU)("lensColorTexture")],Z_.prototype,"lensColorTexture",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"lensFlareStrength",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"lensFlareGhostDispersal",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"lensFlareHaloWidth",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"lensFlareDistortionStrength",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"lensFlareBlurWidth",void 0),(0,X.gn)([(0,Y.oU)("lensStarTexture")],Z_.prototype,"lensStarTexture",void 0),(0,X.gn)([(0,Y.oU)("lensFlareDirtTexture")],Z_.prototype,"lensFlareDirtTexture",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"depthOfFieldDistance",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"depthOfFieldBlurWidth",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"motionStrength",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"objectBasedMotionBlur",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"_ratio",void 0),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"BloomEnabled",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"DepthOfFieldEnabled",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"LensFlareEnabled",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"HDREnabled",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"VLSEnabled",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"MotionBlurEnabled",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"fxaaEnabled",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"screenSpaceReflectionsEnabled",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"volumetricLightStepsCount",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"motionBlurSamples",null),(0,X.gn)([(0,Y.qC)()],Z_.prototype,"samples",null),(0,l.H)("BABYLON.StandardRenderingPipeline",Z_);var $_;dt.v.ShadersStore.tonemapPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float _ExposureAdjustment;\n#if defined(HABLE_TONEMAPPING)\nconst float A=0.15;\nconst float B=0.50;\nconst float C=0.10;\nconst float D=0.20;\nconst float E=0.02;\nconst float F=0.30;\nconst float W=11.2;\n#endif\nfloat Luminance(vec3 c)\n{\nreturn dot(c,vec3(0.22,0.707,0.071));\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nfloat lum=Luminance(colour.rgb); \nfloat lumTm=lum*_ExposureAdjustment;\nfloat scale=lumTm/(1.0+lumTm); \ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nconst float ExposureBias=2.0;\nvec3 x=ExposureBias*colour;\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\nx=vec3(W,W,W);\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\ncolour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour= vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\n#endif\ngl_FragColor=vec4(colour.rgb,1.0);\n}",function(e){e[e.Hable=0]="Hable",e[e.Reinhard=1]="Reinhard",e[e.HejiDawson=2]="HejiDawson",e[e.Photographic=3]="Photographic"}($_||($_={}));dt.v.ShadersStore.volumetricLightScatteringPixelShader="uniform sampler2D textureSampler;\nuniform sampler2D lightScatteringSampler;\nuniform float decay;\nuniform float exposure;\nuniform float weight;\nuniform float density;\nuniform vec2 meshPositionOnScreen;\nvarying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec2 tc=vUV;\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\nfloat illuminationDecay=1.0;\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\nfor(int i=0; i{this.isSupported||this.dispose(e),this.onActivate=null},this.onApplyObservable.add((e=>{this._updateMeshScreenCoordinates(c),e.setTexture("lightScatteringSampler",this._volumetricLightScatteringRTT),e.setFloat("exposure",this.exposure),e.setFloat("decay",this.decay),e.setFloat("weight",this.weight),e.setFloat("density",this.density),e.setVector2("meshPositionOnScreen",this._screenCoordinates)}))}get useDiffuseColor(){return u.Y.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead"),!1}set useDiffuseColor(e){u.Y.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead")}getClassName(){return"VolumetricLightScatteringPostProcess"}_isReady(e,t){var i;const n=e.getMesh();if(n===this.mesh&&n.material)return n.material.isReady(n);const r=null===(i=n._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===i?void 0:i[this._scene.getEngine().currentRenderPassId];if(r)return r.isReadyForSubMesh(n,e,t);const s=[],o=[le.o.PositionKind],a=e.getMaterial();a&&(a.needAlphaTesting()&&s.push("#define ALPHATEST"),n.isVerticesDataPresent(le.o.UVKind)&&(o.push(le.o.UVKind),s.push("#define UV1")),n.isVerticesDataPresent(le.o.UV2Kind)&&(o.push(le.o.UV2Kind),s.push("#define UV2"))),n.useBones&&n.computeBonesUsingShaders?(o.push(le.o.MatricesIndicesKind),o.push(le.o.MatricesWeightsKind),s.push("#define NUM_BONE_INFLUENCERS "+n.numBoneInfluencers),s.push("#define BonesPerMesh "+(n.skeleton?n.skeleton.bones.length+1:0))):s.push("#define NUM_BONE_INFLUENCERS 0"),t&&(s.push("#define INSTANCES"),lo.G.PushAttributesForInstances(o),e.getRenderingMesh().hasThinInstances&&s.push("#define THIN_INSTANCES"));const l=e._getDrawWrapper(void 0,!0),c=l.defines,h=s.join("\n");return c!==h&&l.setEffect(n.getScene().getEngine().createEffect("volumetricLightScatteringPass",o,["world","mBones","viewProjection","diffuseMatrix"],["diffuseSampler"],h,void 0,void 0,void 0,{maxSimultaneousMorphTargets:n.numBoneInfluencers}),h),l.effect.isReady()}setCustomMeshPosition(e){this.customMeshPosition=e}getCustomMeshPosition(){return this.customMeshPosition}dispose(e){const t=e.getScene().customRenderTargets.indexOf(this._volumetricLightScatteringRTT);-1!==t&&e.getScene().customRenderTargets.splice(t,1),this._volumetricLightScatteringRTT.dispose(),super.dispose(e)}getPass(){return this._volumetricLightScatteringRTT}_meshExcluded(e){return this.excludedMeshes.length>0&&-1!==this.excludedMeshes.indexOf(e)}_createPass(e,t){const i=e.getEngine();this._volumetricLightScatteringRTT=new Ot._("volumetricLightScatteringMap",{width:i.getRenderWidth()*t,height:i.getRenderHeight()*t},e,!1,!0,0),this._volumetricLightScatteringRTT.wrapU=K.x.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.wrapV=K.x.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.renderList=null,this._volumetricLightScatteringRTT.renderParticles=!1,this._volumetricLightScatteringRTT.ignoreCameraViewport=!0;const n=this.getCamera();n?n.customRenderTargets.push(this._volumetricLightScatteringRTT):e.customRenderTargets.push(this._volumetricLightScatteringRTT);const r=e=>{var t;const i=e.getRenderingMesh(),n=e.getEffectiveMesh();if(this._meshExcluded(i))return;n._internalAbstractMeshDataInfo._isActiveIntermediate=!1;const r=e.getMaterial();if(!r)return;const s=i.getScene(),o=s.getEngine();o.setState(r.backFaceCulling,void 0,void 0,void 0,r.cullBackFaces);const a=i._getInstancesRenderList(e._id,!!e.getReplacementMesh());if(a.mustReturn)return;const l=o.getCaps().instancedArrays&&(null!==a.visibleInstances[e._id]||i.hasThinInstances);if(this._isReady(e,l)){const c=null===(t=n._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===t?void 0:t[o.currentRenderPassId];let h=e._getDrawWrapper();if(i!==this.mesh||h||(h=r._getDrawWrapper()),!h)return;const _=h.effect;if(o.enableEffect(h),l||i._bind(e,_,r.fillMode),i===this.mesh)r.bind(n.getWorldMatrix(),i);else if(c)c.bindForSubMesh(n.getWorldMatrix(),n,e);else{if(_.setMatrix("viewProjection",s.getTransformMatrix()),r&&r.needAlphaTesting()){const e=r.getAlphaTestTexture();_.setTexture("diffuseSampler",e),e&&_.setMatrix("diffuseMatrix",e.getTextureMatrix())}i.useBones&&i.computeBonesUsingShaders&&i.skeleton&&_.setMatrices("mBones",i.skeleton.getTransformMatrices(i))}l&&i.hasThinInstances&&_.setMatrix("world",n.getWorldMatrix()),i._processRendering(n,e,_,on.F.TriangleFillMode,a,l,((e,t)=>{e||_.setMatrix("world",t)}))}};let s;const o=new a.HE(0,0,0,1);this._volumetricLightScatteringRTT.onBeforeRenderObservable.add((()=>{s=e.clearColor,e.clearColor=o})),this._volumetricLightScatteringRTT.onAfterRenderObservable.add((()=>{e.clearColor=s})),this._volumetricLightScatteringRTT.customIsReadyFunction=(e,t)=>{if(!e.isReady(!1))return!1;if(0===t&&e.subMeshes)for(let t=0;t{const o=e.getEngine();let a;if(s.length){for(o.setColorWrite(!1),a=0;ae._alphaIndex>t._alphaIndex?1:e._alphaIndext._distanceToCamera?-1:0)),o.setAlphaMode(2),a=0;a{e.setFloat("curvature_ridge",.5/Math.max(this.ridge*this.ridge,1e-4)),e.setFloat("curvature_valley",.7/Math.max(this.valley*this.valley,1e-4));const t=this._geometryBufferRenderer.getGBuffer().textures[1];e.setTexture("normalSampler",t)}:u.Y.Error("Multiple Render Target support needed for screen space curvature post process. Please use IsSupported test first.")}getClassName(){return"ScreenSpaceCurvaturePostProcess"}static get IsSupported(){const e=m.l.LastCreatedEngine;return!!e&&e.getCaps().drawBuffersExtension}static _Parse(e,t,i,n){return Y.p4.Parse((()=>new ed(e.name,i,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.textureType,e.reusable)),e,i,n)}}(0,X.gn)([(0,Y.qC)()],ed.prototype,"ridge",void 0),(0,X.gn)([(0,Y.qC)()],ed.prototype,"valley",void 0),(0,l.H)("BABYLON.ScreenSpaceCurvaturePostProcess",ed);dt.v.IncludesShadersStore.boundingBoxRendererFragmentDeclaration="uniform vec4 color;\n";dt.v.IncludesShadersStore.boundingBoxRendererUboDeclaration="#ifdef WEBGL2\nuniform vec4 color;\nuniform mat4 world;\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n#else\nlayout(std140,column_major) uniform;\nuniform BoundingBoxRenderer {\nvec4 color;\nmat4 world;\nmat4 viewProjection;\nmat4 viewProjectionR;\n};\n#endif\n";dt.v.ShadersStore.boundingBoxRendererPixelShader="#include<__decl__boundingBoxRendererFragment>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";dt.v.IncludesShadersStore.boundingBoxRendererVertexDeclaration="uniform mat4 world;\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n";dt.v.ShadersStore.boundingBoxRendererVertexShader="attribute vec3 position;\n#include<__decl__boundingBoxRendererVertex>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec4 worldPos=world*vec4(position,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",Object.defineProperty(R.x.prototype,"forceShowBoundingBoxes",{get:function(){return this._forceShowBoundingBoxes||!1},set:function(e){this._forceShowBoundingBoxes=e,e&&this.getBoundingBoxRenderer()},enumerable:!0,configurable:!0}),R.x.prototype.getBoundingBoxRenderer=function(){return this._boundingBoxRenderer||(this._boundingBoxRenderer=new td(this)),this._boundingBoxRenderer},Object.defineProperty(zi.x.prototype,"showBoundingBox",{get:function(){return this._showBoundingBox||!1},set:function(e){this._showBoundingBox=e,e&&this.getScene().getBoundingBoxRenderer()},enumerable:!0,configurable:!0});class td{constructor(e){this.name=z.l.NAME_BOUNDINGBOXRENDERER,this.frontColor=new a.Wo(1,1,1),this.backColor=new a.Wo(.1,.1,.1),this.showBackLines=!0,this.onBeforeBoxRenderingObservable=new s.y$,this.onAfterBoxRenderingObservable=new s.y$,this.onResourcesReadyObservable=new s.y$,this.enabled=!0,this.renderList=new Gi.t(32),this._vertexBuffers={},this._fillIndexBuffer=null,this._fillIndexData=null,this.scene=e,e._addComponent(this),this._uniformBufferFront=new Dt.M(this.scene.getEngine(),void 0,void 0,"BoundingBoxRendererFront",!this.scene.getEngine().isWebGPU),this._buildUniformLayout(this._uniformBufferFront),this._uniformBufferBack=new Dt.M(this.scene.getEngine(),void 0,void 0,"BoundingBoxRendererBack",!this.scene.getEngine().isWebGPU),this._buildUniformLayout(this._uniformBufferBack)}_buildUniformLayout(e){e.addUniform("color",4),e.addUniform("world",16),e.addUniform("viewProjection",16),e.addUniform("viewProjectionR",16),e.create()}register(){this.scene._beforeEvaluateActiveMeshStage.registerStep(z.l.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER,this,this.reset),this.scene._preActiveMeshStage.registerStep(z.l.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER,this,this._preActiveMesh),this.scene._evaluateSubMeshStage.registerStep(z.l.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER,this,this._evaluateSubMesh),this.scene._afterRenderingGroupDrawStage.registerStep(z.l.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER,this,this.render)}_evaluateSubMesh(e,t){if(e.showSubMeshesBoundingBox){const i=t.getBoundingInfo();null!=i&&(i.boundingBox._tag=e.renderingGroupId,this.renderList.push(i.boundingBox))}}_preActiveMesh(e){if(e.showBoundingBox||this.scene.forceShowBoundingBoxes){const t=e.getBoundingInfo();t.boundingBox._tag=e.renderingGroupId,this.renderList.push(t.boundingBox)}}_prepareResources(){if(this._colorShader)return;this._colorShader=new an.j("colorShader",this.scene,"boundingBoxRenderer",{attributes:[le.o.PositionKind],uniforms:["world","viewProjection","viewProjectionR","color"],uniformBuffers:["BoundingBoxRenderer"]},!1),this._colorShader.reservedDataStore={hidden:!0},this._colorShaderForOcclusionQuery=new an.j("colorShaderOccQuery",this.scene,"boundingBoxRenderer",{attributes:[le.o.PositionKind],uniforms:["world","viewProjection","viewProjectionR","color"],uniformBuffers:["BoundingBoxRenderer"]},!0),this._colorShaderForOcclusionQuery.reservedDataStore={hidden:!0};const e=this.scene.getEngine(),t=(0,$i.aR)({size:1});this._vertexBuffers[le.o.PositionKind]=new le.o(e,t.positions,le.o.PositionKind,!1),this._createIndexBuffer(),this._fillIndexData=t.indices,this.onResourcesReadyObservable.notifyObservers(this)}_createIndexBuffer(){const e=this.scene.getEngine();this._indexBuffer=e.createIndexBuffer([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,7,1,6,2,5,3,4])}rebuild(){const e=this._vertexBuffers[le.o.PositionKind];e&&e._rebuild(),this._createIndexBuffer()}reset(){this.renderList.reset()}render(e){var t,i;if(0===this.renderList.length||!this.enabled)return;if(this._prepareResources(),!this._colorShader.isReady())return;const n=this.scene.getEngine();n.setDepthWrite(!1);const r=this.frontColor.toColor4(),s=this.backColor.toColor4(),a=this.scene.getTransformMatrix();for(let l=0;l{let t=e._getComponent(z.l.NAME_DEPTHRENDERER);t||(t=new id(e),e._addComponent(t))};dt.v.ShadersStore.oitFinalPixelShader="precision highp float;\nuniform sampler2D uFrontColor;\nuniform sampler2D uBackColor;\nvoid main() {\nivec2 fragCoord=ivec2(gl_FragCoord.xy);\nvec4 frontColor=texelFetch(uFrontColor,fragCoord,0);\nvec4 backColor=texelFetch(uBackColor,fragCoord,0);\nfloat alphaMultiplier=1.0-frontColor.a;\nglFragColor=vec4(\nfrontColor.rgb+alphaMultiplier*backColor.rgb,\nfrontColor.a+backColor.a\n);\n}";dt.v.ShadersStore.oitBackBlendPixelShader="precision highp float;\nuniform sampler2D uBackColor;\nvoid main() {\nglFragColor=texelFetch(uBackColor,ivec2(gl_FragCoord.xy),0);\nif (glFragColor.a==0.0) { \ndiscard;\n}\n}";class nd{constructor(){this.enabled=!0,this.name="depthPeeling",this.texturesRequired=[4]}}class rd{constructor(e,t=5){if(this._thinTextures=[],this._currentPingPongState=0,this._layoutCacheFormat=[[!0],[!0,!0],[!0,!0,!0]],this._layoutCache=[],this._candidateSubMeshes=new Gi.t(10),this._excludedSubMeshes=new Gi.t(10),this._excludedMeshes=[],this._colorCache=[new a.HE(rd._DEPTH_CLEAR_VALUE,rd._DEPTH_CLEAR_VALUE,0,0),new a.HE(-rd._MIN_DEPTH,rd._MAX_DEPTH,0,0),new a.HE(0,0,0,0)],this._scene=e,this._engine=e.getEngine(),this._passCount=t,e.enablePrePassRenderer()){for(let e=0;e\nuniform vec4 color;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";dt.v.ShadersStore.lineVertexShader="#include\n#include\nattribute vec3 position;\nattribute vec4 normal;\nuniform mat4 viewProjection;\nuniform float width;\nuniform float aspectRatio;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include\nmat4 worldViewProjection=viewProjection*finalWorld;\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}",zi.x.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},zi.x.prototype.enableEdgesRendering=function(e=.95,t=!1,i){return this.disableEdgesRendering(),this._edgesRenderer=new ad(this,e,t,!0,i),this},Object.defineProperty(zi.x.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),ln.prototype.enableEdgesRendering=function(e=.95,t=!1){return this.disableEdgesRendering(),this._edgesRenderer=new ld(this,e,t),this},cn.prototype.enableEdgesRendering=function(e=.95,t=!1){return ln.prototype.enableEdgesRendering.apply(this,arguments),this};class od{constructor(){this.edges=new Array,this.edgesConnectedCount=0}}class ad{constructor(e,t=.95,i=!1,n=!0,r){var s;this.edgesWidthScalerForOrthographic=1e3,this.edgesWidthScalerForPerspective=50,this._linesPositions=new Array,this._linesNormals=new Array,this._linesIndices=new Array,this._buffers={},this._buffersForInstances={},this._checkVerticesInsteadOfIndices=!1,this.isEnabled=!0,this.customInstances=new Gi.t(32),this._source=e,this._checkVerticesInsteadOfIndices=i,this._options=null!=r?r:null,this._epsilon=t,this._source.getScene().getEngine().isWebGPU&&(this._drawWrapper=new Tn.q(e.getEngine())),this._prepareRessources(),n&&(null===(s=null==r?void 0:r.useAlternateEdgeFinder)||void 0===s||s?this._generateEdgesLinesAlternate():this._generateEdgesLines()),this._meshRebuildObserver=this._source.onRebuildObservable.add((()=>{this._rebuild()})),this._meshDisposeObserver=this._source.onDisposeObservable.add((()=>{this.dispose()}))}get linesPositions(){return this._linesPositions}get linesNormals(){return this._linesNormals}get linesIndices(){return this._linesIndices}get lineShader(){return this._lineShader}set lineShader(e){this._lineShader=e}static _GetShader(e){if(!e._edgeRenderLineShader){const t=new an.j("lineShader",e,"line",{attributes:["position","normal"],uniforms:["world","viewProjection","color","width","aspectRatio"]},!1);t.disableDepthWrite=!0,t.backFaceCulling=!1,t.checkReadyOnEveryCall=e.getEngine().isWebGPU,e._edgeRenderLineShader=t}return e._edgeRenderLineShader}_prepareRessources(){this._lineShader||(this._lineShader=ad._GetShader(this._source.getScene()))}_rebuild(){let e=this._buffers[le.o.PositionKind];e&&e._rebuild(),e=this._buffers[le.o.NormalKind],e&&e._rebuild();const t=this._source.getScene().getEngine();this._ib=t.createIndexBuffer(this._linesIndices)}dispose(){var e;this._source.onRebuildObservable.remove(this._meshRebuildObserver),this._source.onDisposeObservable.remove(this._meshDisposeObserver);let t=this._buffers[le.o.PositionKind];t&&(t.dispose(),this._buffers[le.o.PositionKind]=null),t=this._buffers[le.o.NormalKind],t&&(t.dispose(),this._buffers[le.o.NormalKind]=null),this._ib&&this._source.getScene().getEngine()._releaseBuffer(this._ib),this._lineShader.dispose(),null===(e=this._drawWrapper)||void 0===e||e.dispose()}_processEdgeForAdjacencies(e,t,i,n,r){return e===i&&t===n||e===n&&t===i?0:e===n&&t===r||e===r&&t===n?1:e===r&&t===i||e===i&&t===r?2:-1}_processEdgeForAdjacenciesWithVertices(e,t,i,n,r){const s=1e-10;return e.equalsWithEpsilon(i,s)&&t.equalsWithEpsilon(n,s)||e.equalsWithEpsilon(n,s)&&t.equalsWithEpsilon(i,s)?0:e.equalsWithEpsilon(n,s)&&t.equalsWithEpsilon(r,s)||e.equalsWithEpsilon(r,s)&&t.equalsWithEpsilon(n,s)?1:e.equalsWithEpsilon(r,s)&&t.equalsWithEpsilon(i,s)||e.equalsWithEpsilon(i,s)&&t.equalsWithEpsilon(r,s)?2:-1}_checkEdge(e,t,i,n,r){let s;s=void 0===t||o.P.Dot(i[e],i[t]){i>=0&&t.push(i);for(let i=0;i=e[0].length&&e[1].length>=e[2].length?s=1:e[2].length>=e[0].length&&e[2].length>=e[1].length&&(s=2);for(let t=0;t<3;++t)t===s?e[t].sort(((e,t)=>e[1]t[1]?1:0)):e[t].sort(((e,t)=>e[1]>t[1]?-1:e[1]=s+1;--o)r(e[o%3],a,o!==s+2?n[i[t+(o+1)%3]]:-1);const c=a.length;i.push(n[i[t+s]],o[0],a[0]),i.push(n[i[t+(s+1)%3]],a[c-1],o[l-1]);const h=l<=c,_=h?l:c,d=h?c:l,u=h?l-1:c-1,p=h?0:1;let f=l+c-2,m=0,g=0;const b=h?o:a,y=h?a:o;let v=0;for(;f-- >0;){let e;p?i.push(b[m],y[g]):i.push(y[g],b[m]),v+=_,v>=d&&mr){const e=n;n=r,r=e}const a=n+"_"+r,l=g[a];l?l.done||(o.P.Dot(t,l.normal)0||this._source.hasThinInstances)}render(){const e=this._source.getScene(),t=this._lineShader._getDrawWrapper();if(this._drawWrapper&&this._lineShader._setDrawWrapper(this._drawWrapper),!this.isReady()||!e.activeCamera)return void this._lineShader._setDrawWrapper(t);const i=this._source.hasInstances&&this.customInstances.length>0,n=i||this._source.hasThinInstances;let r=0;if(n)if(this._buffersForInstances.world0=this._source.getVertexBuffer("world0"),this._buffersForInstances.world1=this._source.getVertexBuffer("world1"),this._buffersForInstances.world2=this._source.getVertexBuffer("world2"),this._buffersForInstances.world3=this._source.getVertexBuffer("world3"),i){const e=this._source._instanceDataStorage;if(r=this.customInstances.length,!e.instancesData)return void(this._source.getScene()._activeMeshesFrozen||this.customInstances.reset());if(!e.isFrozen){let t=0;for(let i=0;i0&&(t.push(!0),i.push(!1));this._multiRenderAttachments=this._engine.buildTextureLayout(e),this._clearAttachments=this._engine.buildTextureLayout(t),this._defaultAttachments=this._engine.buildTextureLayout(i)}_resetLayout(){for(let e=0;enull!=e)),this._scene.autoClear=!0;const n=this._hasImageProcessing(this._postProcessesSourceForThisPass);this._needsCompositionForThisPass=!n&&!this.disableGammaTransform&&this._needsImageProcessing()&&!i;const r=this._getFirstPostProcess(this._postProcessesSourceForThisPass),s=e._beforeCompositionPostProcesses&&e._beforeCompositionPostProcesses[0];let o=null;this._scene.imageProcessingConfiguration.applyByPostProcess=this._needsCompositionForThisPass||n,this._needsCompositionForThisPass&&!e.imageProcessingPostProcess&&e._createCompositionEffect(),s?o=s:this._needsCompositionForThisPass?o=e.imageProcessingPostProcess:r&&(o=r),this._bindFrameBuffer(e),this._linkInternalTexture(e,o)}_linkInternalTexture(e,t){t&&(t.autoClear=!1,t.inputTexture=e.renderTarget),e._outputPostProcess!==t&&(e._outputPostProcess&&this._unlinkInternalTexture(e),e._outputPostProcess=t),e._internalTextureDirty&&(this._updateGeometryBufferLayout(),e._internalTextureDirty=!1)}_unlinkInternalTexture(e){e._outputPostProcess&&(e._outputPostProcess.autoClear=!0,e._outputPostProcess.restoreDefaultInputTexture(),e._outputPostProcess=null)}_needsImageProcessing(){for(let e=0;enull!=e)),e)){for(let n=0;n=0;e--)this.renderTargets[e].dispose();for(let e=0;e{throw(0,_a.S)("PrePassRendererSceneComponent")},hd._TextureFormats=[{type:0,format:2,name:"prePass_Irradiance"},{type:1,format:2,name:"prePass_Position"},{type:2,format:0,name:"prePass_Velocity"},{type:3,format:0,name:"prePass_Reflectivity"},{type:4,format:2,name:"prePass_Color"},{type:5,format:2,name:"prePass_Depth"},{type:6,format:2,name:"prePass_Normal"},{type:7,format:0,name:"prePass_Albedo"}],Object.defineProperty(R.x.prototype,"prePassRenderer",{get:function(){return this._prePassRenderer},set:function(e){e&&e.isSupported&&(this._prePassRenderer=e)},enumerable:!0,configurable:!0}),R.x.prototype.enablePrePassRenderer=function(){return this._prePassRenderer||(this._prePassRenderer=new hd(this),this._prePassRenderer.isSupported||(this._prePassRenderer=null,u.Y.Error("PrePassRenderer needs WebGL 2 support.\nMaybe you tried to use the following features that need the PrePassRenderer :\n + Subsurface Scattering"))),this._prePassRenderer},R.x.prototype.disablePrePassRenderer=function(){this._prePassRenderer&&(this._prePassRenderer.dispose(),this._prePassRenderer=null)};class _d{constructor(e){this.name=z.l.NAME_PREPASSRENDERER,this.scene=e}register(){this.scene._beforeCameraDrawStage.registerStep(z.l.STEP_BEFORECAMERADRAW_PREPASS,this,this._beforeCameraDraw),this.scene._afterCameraDrawStage.registerStep(z.l.STEP_AFTERCAMERADRAW_PREPASS,this,this._afterCameraDraw),this.scene._beforeRenderTargetDrawStage.registerStep(z.l.STEP_BEFORERENDERTARGETDRAW_PREPASS,this,this._beforeRenderTargetDraw),this.scene._afterRenderTargetDrawStage.registerStep(z.l.STEP_AFTERCAMERADRAW_PREPASS,this,this._afterRenderTargetDraw),this.scene._beforeClearStage.registerStep(z.l.STEP_BEFORECLEAR_PREPASS,this,this._beforeClearStage),this.scene._beforeRenderTargetClearStage.registerStep(z.l.STEP_BEFORERENDERTARGETCLEAR_PREPASS,this,this._beforeRenderTargetClearStage),this.scene._beforeRenderingMeshStage.registerStep(z.l.STEP_BEFORERENDERINGMESH_PREPASS,this,this._beforeRenderingMeshStage),this.scene._afterRenderingMeshStage.registerStep(z.l.STEP_AFTERRENDERINGMESH_PREPASS,this,this._afterRenderingMeshStage)}_beforeRenderTargetDraw(e,t,i){this.scene.prePassRenderer&&(this.scene.prePassRenderer._setRenderTarget(e._prePassRenderTarget),this.scene.prePassRenderer._beforeDraw(void 0,t,i))}_afterRenderTargetDraw(e,t,i){this.scene.prePassRenderer&&this.scene.prePassRenderer._afterDraw(t,i)}_beforeRenderTargetClearStage(e){this.scene.prePassRenderer&&(e._prePassRenderTarget||(e._prePassRenderTarget=this.scene.prePassRenderer._createRenderTarget(e.name+"_prePassRTT",e)),this.scene.prePassRenderer._setRenderTarget(e._prePassRenderTarget),this.scene.prePassRenderer._clear())}_beforeCameraDraw(e){this.scene.prePassRenderer&&(this.scene.prePassRenderer._setRenderTarget(null),this.scene.prePassRenderer._beforeDraw(e))}_afterCameraDraw(){this.scene.prePassRenderer&&this.scene.prePassRenderer._afterDraw()}_beforeClearStage(){this.scene.prePassRenderer&&(this.scene.prePassRenderer._setRenderTarget(null),this.scene.prePassRenderer._clear())}_beforeRenderingMeshStage(e,t,i,n){if(!n)return;const r=e.getScene();r.prePassRenderer&&r.prePassRenderer.bindAttachmentsForEffect(n,t)}_afterRenderingMeshStage(e){const t=e.getScene();t.prePassRenderer&&t.prePassRenderer.restoreAttachments()}rebuild(){this.scene.disablePrePassRenderer(),this.scene.enablePrePassRenderer()}dispose(){this.scene.disablePrePassRenderer()}}hd._SceneComponentInitialization=e=>{let t=e._getComponent(z.l.NAME_PREPASSRENDERER);t||(t=new _d(e),e._addComponent(t))};dt.v.IncludesShadersStore.fibonacci="#define rcp(x) 1./x\n#define GOLDEN_RATIO 1.618033988749895\n#define TWO_PI 6.2831855\nvec2 Golden2dSeq(int i,float n)\n{\nreturn vec2(float(i)/n+(0.5/n),fract(float(i)*rcp(GOLDEN_RATIO)));\n}\nvec2 SampleDiskGolden(int i,int sampleCount)\n{\nvec2 f=Golden2dSeq(i,float(sampleCount));\nreturn vec2(sqrt(f.x),TWO_PI*f.y);\n}",i("../../../node_modules/@babylonjs/core/Shaders/ShadersInclude/subSurfaceScatteringFunctions.js");dt.v.IncludesShadersStore.diffusionProfile="uniform vec3 diffusionS[5];\nuniform float diffusionD[5];\nuniform float filterRadii[5];";dt.v.ShadersStore.subSurfaceScatteringPixelShader="#include\n#include\n#include\n#include\nvarying vec2 vUV;\nuniform vec2 texelSize;\nuniform sampler2D textureSampler;\nuniform sampler2D irradianceSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D albedoSampler;\nuniform vec2 viewportSize;\nuniform float metersPerUnit;\nconst float LOG2_E=1.4426950408889634;\nconst float SSS_PIXELS_PER_SAMPLE=4.;\nconst int _SssSampleBudget=40;\n#define rcp(x) 1./x\n#define Sq(x) x*x\n#define SSS_BILATERAL_FILTER true\nvec3 EvalBurleyDiffusionProfile(float r,vec3 S)\n{\nvec3 exp_13=exp2(((LOG2_E*(-1.0/3.0))*r)*S); \nvec3 expSum=exp_13*(1.+exp_13*exp_13); \nreturn (S*rcp(8.*PI))*expSum; \n}\nvec2 SampleBurleyDiffusionProfile(float u,float rcpS)\n{\nu=1.-u; \nfloat g=1.+(4.*u)*(2.*u+sqrt(1.+(4.*u)*u));\nfloat n=exp2(log2(g)*(-1.0/3.0)); \nfloat p=(g*n)*n; \nfloat c=1.+p+n; \nfloat d=(3./LOG2_E*2.)+(3./LOG2_E)*log2(u); \nfloat x=(3./LOG2_E)*log2(c)-d; \nfloat rcpExp=((c*c)*c)*rcp((4.*u)*((c*c)+(4.*u)*(4.*u)));\nfloat r=x*rcpS;\nfloat rcpPdf=(8.*PI*rcpS)*rcpExp; \nreturn vec2(r,rcpPdf);\n}\nvec3 ComputeBilateralWeight(float xy2,float z,float mmPerUnit,vec3 S,float rcpPdf)\n{\n#ifndef SSS_BILATERAL_FILTER\nz=0.;\n#endif\nfloat r=sqrt(xy2+(z*mmPerUnit)*(z*mmPerUnit));\nfloat area=rcpPdf;\n#if SSS_CLAMP_ARTIFACT\nreturn clamp(EvalBurleyDiffusionProfile(r,S)*area,0.0,1.0);\n#else\nreturn EvalBurleyDiffusionProfile(r,S)*area;\n#endif\n}\nvoid EvaluateSample(int i,int n,vec3 S,float d,vec3 centerPosVS,float mmPerUnit,float pixelsPerMm,\nfloat phase,inout vec3 totalIrradiance,inout vec3 totalWeight)\n{\nfloat scale =rcp(float(n));\nfloat offset=rcp(float(n))*0.5;\nfloat sinPhase,cosPhase;\nsinPhase=sin(phase);\ncosPhase=cos(phase);\nvec2 bdp=SampleBurleyDiffusionProfile(float(i)*scale+offset,d);\nfloat r=bdp.x;\nfloat rcpPdf=bdp.y;\nfloat phi=SampleDiskGolden(i,n).y;\nfloat sinPhi,cosPhi;\nsinPhi=sin(phi);\ncosPhi=cos(phi);\nfloat sinPsi=cosPhase*sinPhi+sinPhase*cosPhi; \nfloat cosPsi=cosPhase*cosPhi-sinPhase*sinPhi; \nvec2 vec=r*vec2(cosPsi,sinPsi);\nvec2 position; \nfloat xy2;\nposition=vUV+round((pixelsPerMm*r)*vec2(cosPsi,sinPsi))*texelSize;\nxy2 =r*r;\nvec4 textureSample=texture2D(irradianceSampler,position);\nfloat viewZ=texture2D(depthSampler,position).r;\nvec3 irradiance =textureSample.rgb;\nif (testLightingForSSS(textureSample.a))\n{\nfloat relZ=viewZ-centerPosVS.z;\nvec3 weight=ComputeBilateralWeight(xy2,relZ,mmPerUnit,S,rcpPdf);\ntotalIrradiance+=weight*irradiance;\ntotalWeight +=weight;\n}\nelse\n{\n}\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec4 irradianceAndDiffusionProfile =texture2D(irradianceSampler,vUV);\nvec3 centerIrradiance=irradianceAndDiffusionProfile.rgb;\nint diffusionProfileIndex=int(round(irradianceAndDiffusionProfile.a*255.));\nfloat centerDepth =0.;\nvec4 inputColor=texture2D(textureSampler,vUV);\nbool passedStencilTest=testLightingForSSS(irradianceAndDiffusionProfile.a);\nif (passedStencilTest)\n{\ncenterDepth=texture2D(depthSampler,vUV).r;\n}\nif (!passedStencilTest) { \ngl_FragColor=inputColor;\nreturn;\n}\nfloat distScale =1.;\nvec3 S =diffusionS[diffusionProfileIndex];\nfloat d =diffusionD[diffusionProfileIndex];\nfloat filterRadius=filterRadii[diffusionProfileIndex];\nvec2 centerPosNDC=vUV;\nvec2 cornerPosNDC=vUV+0.5*texelSize;\nvec3 centerPosVS =vec3(centerPosNDC*viewportSize,1.0)*centerDepth; \nvec3 cornerPosVS =vec3(cornerPosNDC*viewportSize,1.0)*centerDepth; \nfloat mmPerUnit =1000.*(metersPerUnit*rcp(distScale));\nfloat unitsPerMm=rcp(mmPerUnit);\nfloat unitsPerPixel=2.*abs(cornerPosVS.x-centerPosVS.x);\nfloat pixelsPerMm =rcp(unitsPerPixel)*unitsPerMm;\nfloat filterArea =PI*Sq(filterRadius*pixelsPerMm);\nint sampleCount =int(filterArea*rcp(SSS_PIXELS_PER_SAMPLE));\nint sampleBudget=_SssSampleBudget;\nint texturingMode=0;\nvec3 albedo =texture2D(albedoSampler,vUV).rgb;\nif (distScale==0. || sampleCount<1)\n{\n#ifdef DEBUG_SSS_SAMPLES\nvec3 green=vec3(0.,1.,0.);\ngl_FragColor=vec4(green,1.0);\nreturn;\n#endif\ngl_FragColor=vec4(inputColor.rgb+albedo*centerIrradiance,1.0);\nreturn;\n}\n#ifdef DEBUG_SSS_SAMPLES\nvec3 red =vec3(1.,0.,0.);\nvec3 blue=vec3(0.,0.,1.);\ngl_FragColor=vec4(mix(blue,red,clamp(float(sampleCount)/float(sampleBudget),0.0,1.0)),1.0);\nreturn;\n#endif\nfloat phase=0.;\nint n=min(sampleCount,sampleBudget);\nvec3 centerWeight =vec3(0.); \nvec3 totalIrradiance=vec3(0.);\nvec3 totalWeight =vec3(0.);\nfor (int i=0; i{if(!t.prePassRenderer||!t.subSurfaceConfiguration)return void u.Y.Error("PrePass and subsurface configuration needs to be enabled for subsurface scattering.");const i=this.texelSize;e.setFloat("metersPerUnit",t.subSurfaceConfiguration.metersPerUnit),e.setFloat2("texelSize",i.x,i.y),e.setTexture("irradianceSampler",t.prePassRenderer.getRenderTarget().textures[t.prePassRenderer.getIndex(0)]),e.setTexture("depthSampler",t.prePassRenderer.getRenderTarget().textures[t.prePassRenderer.getIndex(5)]),e.setTexture("albedoSampler",t.prePassRenderer.getRenderTarget().textures[t.prePassRenderer.getIndex(7)]),e.setFloat2("viewportSize",Math.tan(t.activeCamera.fov/2)*t.getEngine().getAspectRatio(t.activeCamera,!0),Math.tan(t.activeCamera.fov/2)),e.setArray3("diffusionS",t.subSurfaceConfiguration.ssDiffusionS),e.setArray("diffusionD",t.subSurfaceConfiguration.ssDiffusionD),e.setArray("filterRadii",t.subSurfaceConfiguration.ssFilterRadii)}))}}class ud{constructor(e){this._ssDiffusionS=[],this._ssFilterRadii=[],this._ssDiffusionD=[],this.enabled=!1,this.needsImageProcessing=!0,this.name=z.l.NAME_SUBSURFACE,this.ssDiffusionProfileColors=[],this.metersPerUnit=1,this.texturesRequired=[5,7,4,0],this.addDiffusionProfile(new a.Wo(1,1,1)),this._scene=e,ud._SceneComponentInitialization(this._scene)}get ssDiffusionS(){return this._ssDiffusionS}get ssDiffusionD(){return this._ssDiffusionD}get ssFilterRadii(){return this._ssFilterRadii}addDiffusionProfile(e){if(this.ssDiffusionD.length>=5)return u.Y.Error("You already reached the maximum number of diffusion profiles."),0;for(let t=0;t{throw(0,_a.S)("SubSurfaceSceneComponent")},n.p.AddParser(z.l.NAME_SUBSURFACE,((e,t)=>{if(void 0!==e.ssDiffusionProfileColors&&null!==e.ssDiffusionProfileColors&&(t.enableSubSurfaceForPrePass(),t.subSurfaceConfiguration))for(let i=0,n=e.ssDiffusionProfileColors.length;i{let t=e._getComponent(z.l.NAME_SUBSURFACE);t||(t=new pd(e),e._addComponent(t))};dt.v.ShadersStore.outlinePixelShader="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform vec4 color;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#include\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}";dt.v.ShadersStore.outlineVertexShader="attribute vec3 position;\nattribute vec3 normal;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\nuniform float offset;\n#include\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\nvec3 offsetPosition=positionUpdated+(normalUpdated*offset);\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(offsetPosition,1.0);\ngl_Position=viewProjection*worldPos;\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include\n#include\n}\n",R.x.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new fd(this)),this._outlineRenderer},Object.defineProperty(je.Kj.prototype,"renderOutline",{get:function(){return this._renderOutline},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOutline=e},enumerable:!0,configurable:!0}),Object.defineProperty(je.Kj.prototype,"renderOverlay",{get:function(){return this._renderOverlay},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOverlay=e},enumerable:!0,configurable:!0});class fd{constructor(e){this.name=z.l.NAME_OUTLINERENDERER,this.zOffset=1,this.zOffsetUnits=4,this.scene=e,this._engine=e.getEngine(),this.scene._addComponent(this),this._passIdForDrawWrapper=[];for(let e=0;e<4;++e)this._passIdForDrawWrapper[e]=this._engine.createRenderPassId(`Outline Renderer (${e})`)}register(){this.scene._beforeRenderingMeshStage.registerStep(z.l.STEP_BEFORERENDERINGMESH_OUTLINE,this,this._beforeRenderingMesh),this.scene._afterRenderingMeshStage.registerStep(z.l.STEP_AFTERRENDERINGMESH_OUTLINE,this,this._afterRenderingMesh)}rebuild(){}dispose(){for(let e=0;e{u.setMatrix("world",t)})),s.setZOffset(0),s.setZOffsetUnits(0)}isReady(e,t,i){i=null!=i?i:this._passIdForDrawWrapper[0];const n=[],r=[le.o.PositionKind,le.o.NormalKind],s=e.getMesh(),o=e.getMaterial(),a=s.getScene();o&&(o.needAlphaTesting()&&(n.push("#define ALPHATEST"),s.isVerticesDataPresent(le.o.UVKind)&&(r.push(le.o.UVKind),n.push("#define UV1")),s.isVerticesDataPresent(le.o.UV2Kind)&&(r.push(le.o.UV2Kind),n.push("#define UV2"))),o.useLogarithmicDepth&&n.push("#define LOGARITHMICDEPTH")),s.useBones&&s.computeBonesUsingShaders?(r.push(le.o.MatricesIndicesKind),r.push(le.o.MatricesWeightsKind),s.numBoneInfluencers>4&&(r.push(le.o.MatricesIndicesExtraKind),r.push(le.o.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+s.numBoneInfluencers),n.push("#define BonesPerMesh "+(s.skeleton?s.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0");const l=s.morphTargetManager;let c=0;l&&l.numInfluencers>0&&(c=l.numInfluencers,n.push("#define MORPHTARGETS"),n.push("#define NUM_MORPH_INFLUENCERS "+c),l.isUsingTextureForTargets&&n.push("#define MORPHTARGETS_TEXTURE"),lo.G.PrepareAttributesForMorphTargetsInfluencers(r,s,c)),t&&(n.push("#define INSTANCES"),lo.G.PushAttributesForInstances(r),e.getRenderingMesh().hasThinInstances&&n.push("#define THIN_INSTANCES")),a.clipPlane&&n.push("#define CLIPPLANE"),a.clipPlane2&&n.push("#define CLIPPLANE2"),a.clipPlane3&&n.push("#define CLIPPLANE3"),a.clipPlane4&&n.push("#define CLIPPLANE4"),a.clipPlane5&&n.push("#define CLIPPLANE5"),a.clipPlane6&&n.push("#define CLIPPLANE6");const h=e._getDrawWrapper(i,!0),_=h.defines,d=n.join("\n");return _!==d&&h.setEffect(this.scene.getEngine().createEffect("outline",r,["world","mBones","viewProjection","diffuseMatrix","offset","color","logarithmicDepthConstant","morphTargetInfluences","morphTargetTextureInfo","morphTargetTextureIndices","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6"],["diffuseSampler","morphTargets"],d,void 0,void 0,void 0,{maxSimultaneousMorphTargets:c}),d),h.effect.isReady()}_beforeRenderingMesh(e,t,i){if(this._savedDepthWrite=this._engine.getDepthWrite(),e.renderOutline){const n=t.getMaterial();n&&n.needAlphaBlendingForMesh(e)&&(this._engine.cacheStencilState(),this._engine.setDepthWrite(!1),this._engine.setColorWrite(!1),this._engine.setStencilBuffer(!0),this._engine.setStencilOperationPass(7681),this._engine.setStencilFunction(519),this._engine.setStencilMask(fd._StencilReference),this._engine.setStencilFunctionReference(fd._StencilReference),this._engine.stencilStateComposer.useStencilGlobalOnly=!0,this.render(t,i,!0,this._passIdForDrawWrapper[1]),this._engine.setColorWrite(!0),this._engine.setStencilFunction(517)),this._engine.setDepthWrite(!1),this.render(t,i,!1,this._passIdForDrawWrapper[0]),this._engine.setDepthWrite(this._savedDepthWrite),n&&n.needAlphaBlendingForMesh(e)&&(this._engine.stencilStateComposer.useStencilGlobalOnly=!1,this._engine.restoreStencilState())}}_afterRenderingMesh(e,t,i){if(e.renderOverlay){const e=this._engine.getAlphaMode(),n=this._engine.alphaState.alphaBlend;this._engine.setAlphaMode(2),this.render(t,i,!0,this._passIdForDrawWrapper[3]),this._engine.setAlphaMode(e),this._engine.setDepthWrite(this._savedDepthWrite),this._engine.alphaState.alphaBlend=n}e.renderOutline&&this._savedDepthWrite&&(this._engine.setDepthWrite(!0),this._engine.setColorWrite(!1),this.render(t,i,!1,this._passIdForDrawWrapper[2]),this._engine.setColorWrite(!0))}}fd._StencilReference=4,i("../../../node_modules/@babylonjs/core/Rendering/renderingGroup.js");class md{constructor(){this.width=1,this.height=1,this.angle=0,this.invertU=!1,this.invertV=!1,this.isVisible=!0,this._animationStarted=!1,this._loopAnimation=!1,this._fromIndex=0,this._toIndex=0,this._delay=0,this._direction=1,this._time=0,this._onBaseAnimationEnd=null,this.position={x:1,y:1,z:1},this.color={r:1,g:1,b:1,a:1}}get animationStarted(){return this._animationStarted}get fromIndex(){return this._fromIndex}get toIndex(){return this._toIndex}get loopAnimation(){return this._loopAnimation}get delay(){return Math.max(this._delay,1)}playAnimation(e,t,i,n,r){this._fromIndex=e,this._toIndex=t,this._loopAnimation=i,this._delay=n||1,this._animationStarted=!0,this._onBaseAnimationEnd=r,ethis._delay&&(this._time=this._time%this._delay,this.cellIndex+=this._direction,(this._direction>0&&this.cellIndex>this._toIndex||this._direction<0&&this.cellIndex0?this._fromIndex:this._toIndex:(this.cellIndex=this._toIndex,this._animationStarted=!1,this._onBaseAnimationEnd&&this._onBaseAnimationEnd()))))}}class gd extends md{constructor(e,t){super(),this.name=e,this.animations=new Array,this.isPickable=!1,this.useAlphaForPicking=!1,this.onDisposeObservable=new s.y$,this._onAnimationEnd=null,this._endAnimation=()=>{this._onAnimationEnd&&this._onAnimationEnd(),this.disposeWhenFinishedAnimating&&this.dispose()},this.color=new a.HE(1,1,1,1),this.position=o.P.Zero(),this._manager=t,this._manager.sprites.push(this),this.uniqueId=this._manager.scene.getUniqueId()}get size(){return this.width}set size(e){this.width=e,this.height=e}get manager(){return this._manager}getClassName(){return"Sprite"}get fromIndex(){return this._fromIndex}set fromIndex(e){this.playAnimation(e,this._toIndex,this._loopAnimation,this._delay,this._onAnimationEnd)}get toIndex(){return this._toIndex}set toIndex(e){this.playAnimation(this._fromIndex,e,this._loopAnimation,this._delay,this._onAnimationEnd)}get loopAnimation(){return this._loopAnimation}set loopAnimation(e){this.playAnimation(this._fromIndex,this._toIndex,e,this._delay,this._onAnimationEnd)}get delay(){return Math.max(this._delay,1)}set delay(e){this.playAnimation(this._fromIndex,this._toIndex,this._loopAnimation,e,this._onAnimationEnd)}playAnimation(e,t,i,n,r=null){this._onAnimationEnd=r,super.playAnimation(e,t,i,n,this._endAnimation)}dispose(){for(let e=0;e0)for(let s=0;s=r.distance))&&(r=a,i))break}return r||new Ii.p},R.x.prototype._internalMultiPickSprites=function(e,t,i){if(!Ii.p)return null;let n=new Array;if(!i){if(!this.activeCamera)return null;i=this.activeCamera}if(this.spriteManagers.length>0)for(let r=0;r!!e.actionManager&&e.isPickable&&e.actionManager.hasPointerTriggers}register(){this.scene._pointerMoveStage.registerStep(z.l.STEP_POINTERMOVE_SPRITE,this,this._pointerMove),this.scene._pointerDownStage.registerStep(z.l.STEP_POINTERDOWN_SPRITE,this,this._pointerDown),this.scene._pointerUpStage.registerStep(z.l.STEP_POINTERUP_SPRITE,this,this._pointerUp)}rebuild(){}dispose(){this.scene.onBeforeSpritesRenderingObservable.clear(),this.scene.onAfterSpritesRenderingObservable.clear();const e=this.scene.spriteManagers;for(;e.length;)e[0].dispose()}_pickSpriteButKeepRay(e,t,i,n,r){const s=this.scene.pickSprite(t,i,this._spritePredicate,n,r);return s&&(s.ray=e?e.ray:null),s}_pointerMove(e,t,i,n,r){const s=this.scene;return n?s.setPointerOverSprite(null):(i=this._pickSpriteButKeepRay(i,e,t,!1,s.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite?(s.setPointerOverSprite(i.pickedSprite),!s.doNotHandleCursors&&r&&(s._pointerOverSprite&&s._pointerOverSprite.actionManager&&s._pointerOverSprite.actionManager.hoverCursor?r.style.cursor=s._pointerOverSprite.actionManager.hoverCursor:r.style.cursor=s.hoverCursor)):s.setPointerOverSprite(null),i}_pointerDown(e,t,i,n){const r=this.scene;if(r._pickedDownSprite=null,r.spriteManagers.length>0&&(i=r.pickSprite(e,t,this._spritePredicate,!1,r.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite&&i.pickedSprite.actionManager){switch(r._pickedDownSprite=i.pickedSprite,n.button){case 0:i.pickedSprite.actionManager.processTrigger(2,h.V.CreateNewFromSprite(i.pickedSprite,r,n));break;case 1:i.pickedSprite.actionManager.processTrigger(4,h.V.CreateNewFromSprite(i.pickedSprite,r,n));break;case 2:i.pickedSprite.actionManager.processTrigger(3,h.V.CreateNewFromSprite(i.pickedSprite,r,n))}i.pickedSprite.actionManager&&i.pickedSprite.actionManager.processTrigger(5,h.V.CreateNewFromSprite(i.pickedSprite,r,n))}return i}_pointerUp(e,t,i,n,r){const s=this.scene;if(s.spriteManagers.length>0){const i=s.pickSprite(e,t,this._spritePredicate,!1,s.cameraToUseForPointers||void 0);i&&(i.hit&&i.pickedSprite&&i.pickedSprite.actionManager&&(i.pickedSprite.actionManager.processTrigger(7,h.V.CreateNewFromSprite(i.pickedSprite,s,n)),i.pickedSprite.actionManager&&(this.scene._inputManager._isPointerSwiping()||i.pickedSprite.actionManager.processTrigger(1,h.V.CreateNewFromSprite(i.pickedSprite,s,n)),r&&i.pickedSprite.actionManager.processTrigger(6,h.V.CreateNewFromSprite(i.pickedSprite,s,n)))),s._pickedDownSprite&&s._pickedDownSprite.actionManager&&s._pickedDownSprite!==i.pickedSprite&&s._pickedDownSprite.actionManager.processTrigger(16,h.V.CreateNewFromSprite(s._pickedDownSprite,s,n)))}return i}}dt.v.IncludesShadersStore.imageProcessingCompatibility="#ifdef IMAGEPROCESSINGPOSTPROCESS\ngl_FragColor.rgb=pow(gl_FragColor.rgb,vec3(2.2));\n#endif\n";dt.v.ShadersStore.spritesPixelShader="uniform bool alphaTest;\nvarying vec4 vColor;\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 color=texture2D(diffuseSampler,vUV);\nif (float(alphaTest) != 0.)\n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include\ngl_FragColor=color;\n#include\n#define CUSTOM_FRAGMENT_MAIN_END\n}";dt.v.ShadersStore.spritesVertexShader="attribute vec4 position;\nattribute vec2 options;\nattribute vec2 offsets;\nattribute vec2 inverts;\nattribute vec4 cellInfo;\nattribute vec4 color;\nuniform mat4 view;\nuniform mat4 projection;\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz; \nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=offsets.xy;\ncornerPos=vec2(offset.x-0.5,offset.y -0.5)*size;\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0); \nvColor=color;\nvec2 uvOffset=vec2(abs(offset.x-inverts.x),abs(1.0-offset.y-inverts.y));\nvec2 uvPlace=cellInfo.xy;\nvec2 uvSize=cellInfo.zw;\nvUV.x=uvPlace.x+uvSize.x*uvOffset.x;\nvUV.y=uvPlace.y+uvSize.y*uvOffset.y;\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}";class yd{constructor(e,t,i=.01,n=null){this.blendMode=2,this.autoResetAlpha=!0,this.disableDepthWrite=!1,this.fogEnabled=!0,this._useVAO=!1,this._useInstancing=!1,this._vertexBuffers={},this._capacity=t,this._epsilon=i,this._engine=e,this._useInstancing=e.getCaps().instancedArrays&&e._features.supportSpriteInstancing,this._useVAO=e.getCaps().vertexArrayObject&&!e.disableVertexArrayObjects,this._scene=n,this._drawWrapperBase=new Tn.q(e),this._drawWrapperFog=new Tn.q(e),this._drawWrapperDepth=new Tn.q(e,!1),this._drawWrapperFogDepth=new Tn.q(e,!1),this._useInstancing||this._buildIndexBuffer(),this._drawWrapperBase.drawContext&&(this._drawWrapperBase.drawContext.useInstancing=this._useInstancing),this._drawWrapperFog.drawContext&&(this._drawWrapperFog.drawContext.useInstancing=this._useInstancing),this._drawWrapperDepth.drawContext&&(this._drawWrapperDepth.drawContext.useInstancing=this._useInstancing),this._drawWrapperFogDepth.drawContext&&(this._drawWrapperFogDepth.drawContext.useInstancing=this._useInstancing),this._vertexBufferSize=this._useInstancing?16:18,this._vertexData=new Float32Array(t*this._vertexBufferSize*(this._useInstancing?1:4)),this._buffer=new le.l(e,this._vertexData,!0,this._vertexBufferSize);const r=this._buffer.createVertexBuffer(le.o.PositionKind,0,4,this._vertexBufferSize,this._useInstancing),s=this._buffer.createVertexBuffer("options",4,2,this._vertexBufferSize,this._useInstancing);let o,a=6;if(this._useInstancing){const t=new Float32Array([0,0,1,0,0,1,1,1]);this._spriteBuffer=new le.l(e,t,!1,2),o=this._spriteBuffer.createVertexBuffer("offsets",0,2)}else o=this._buffer.createVertexBuffer("offsets",a,2,this._vertexBufferSize,this._useInstancing),a+=2;const l=this._buffer.createVertexBuffer("inverts",a,2,this._vertexBufferSize,this._useInstancing),c=this._buffer.createVertexBuffer("cellInfo",a+2,4,this._vertexBufferSize,this._useInstancing),h=this._buffer.createVertexBuffer(le.o.ColorKind,a+6,4,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[le.o.PositionKind]=r,this._vertexBuffers.options=s,this._vertexBuffers.offsets=o,this._vertexBuffers.inverts=l,this._vertexBuffers.cellInfo=c,this._vertexBuffers[le.o.ColorKind]=h,this._drawWrapperBase.effect=this._engine.createEffect("sprites",[le.o.PositionKind,"options","offsets","inverts","cellInfo",le.o.ColorKind],["view","projection","textureInfos","alphaTest"],["diffuseSampler"],""),this._drawWrapperDepth.effect=this._drawWrapperBase.effect,this._drawWrapperDepth.materialContext=this._drawWrapperBase.materialContext,this._scene&&(this._drawWrapperFog.effect=this._scene.getEngine().createEffect("sprites",[le.o.PositionKind,"options","offsets","inverts","cellInfo",le.o.ColorKind],["view","projection","textureInfos","alphaTest","vFogInfos","vFogColor"],["diffuseSampler"],"#define FOG"),this._drawWrapperFogDepth.effect=this._drawWrapperFog.effect,this._drawWrapperFogDepth.materialContext=this._drawWrapperFog.materialContext)}get capacity(){return this._capacity}render(e,t,i,n,r=null){if(!this.texture||!this.texture.isReady()||!e.length)return;let s=this._drawWrapperBase,o=this._drawWrapperDepth,a=!1;this.fogEnabled&&this._scene&&this._scene.fogEnabled&&0!==this._scene.fogMode&&(s=this._drawWrapperFog,o=this._drawWrapperFogDepth,a=!0);const l=s.effect;if(!l.isReady())return;const c=this._engine,h=!(!this._scene||!this._scene.useRightHandedSystem),_=this.texture.getBaseSize(),d=Math.min(this._capacity,e.length);let u=0,p=!0;for(let i=0;i>0;t._xOffset=(t.cellIndex-i*e)*this.cellWidth/r.width,t._yOffset=i*this.cellHeight/r.height,t._xSize=this.cellWidth,t._ySize=this.cellHeight}this._vertexData[a]=t.position.x,this._vertexData[a+1]=t.position.y,this._vertexData[a+2]=t.position.z,this._vertexData[a+3]=t.angle,this._vertexData[a+4]=t.width,this._vertexData[a+5]=t.height,this._useInstancing?a-=2:(this._vertexData[a+6]=i,this._vertexData[a+7]=n),this._vertexData[a+8]=s?t.invertU?0:1:t.invertU?1:0,this._vertexData[a+9]=t.invertV?1:0,this._vertexData[a+10]=t._xOffset,this._vertexData[a+11]=t._yOffset,this._vertexData[a+12]=t._xSize/r.width,this._vertexData[a+13]=t._ySize/r.height,this._vertexData[a+14]=t.color.r,this._vertexData[a+15]=t.color.g,this._vertexData[a+16]=t.color.b,this._vertexData[a+17]=t.color.a}_buildIndexBuffer(){const e=[];let t=0;for(let i=0;i{e.cellRef||(e.cellIndex=0);const i=e.cellIndex;"number"==typeof i&&isFinite(i)&&Math.floor(i)===i&&(e.cellRef=this._spriteMap[e.cellIndex]),e._xOffset=this._cellData[e.cellRef].frame.x/t.width,e._yOffset=this._cellData[e.cellRef].frame.y/t.height,e._xSize=this._cellData[e.cellRef].frame.w,e._ySize=this._cellData[e.cellRef].frame.h},r||(r=m.l.LastCreatedScene),r._getComponent(z.l.NAME_SPRITE)||r._addComponent(new bd(r)),this._fromPacked=l,this._scene=r;const h=this._scene.getEngine();if(this._spriteRenderer=new yd(h,i,o,r),n.width&&n.height)this.cellWidth=n.width,this.cellHeight=n.height;else{if(void 0===n)return void(this._spriteRenderer=null);this.cellWidth=n,this.cellHeight=n}this._scene.spriteManagers.push(this),this.uniqueId=this.scene.getUniqueId(),t&&(this.texture=new K.x(t,r,!0,!1,a)),this._fromPacked&&this._makePacked(t,c)}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get children(){return this.sprites}get scene(){return this._scene}get capacity(){return this._spriteRenderer.capacity}get texture(){return this._spriteRenderer.texture}set texture(e){e.wrapU=K.x.CLAMP_ADDRESSMODE,e.wrapV=K.x.CLAMP_ADDRESSMODE,this._spriteRenderer.texture=e,this._textureContent=null}get cellWidth(){return this._spriteRenderer.cellWidth}set cellWidth(e){this._spriteRenderer.cellWidth=e}get cellHeight(){return this._spriteRenderer.cellHeight}set cellHeight(e){this._spriteRenderer.cellHeight=e}get fogEnabled(){return this._spriteRenderer.fogEnabled}set fogEnabled(e){this._spriteRenderer.fogEnabled=e}get blendMode(){return this._spriteRenderer.blendMode}set blendMode(e){this._spriteRenderer.blendMode=e}get disableDepthWrite(){return this._disableDepthWrite}set disableDepthWrite(e){this._disableDepthWrite=e,this._spriteRenderer.disableDepthWrite=e}getClassName(){return"SpriteManager"}_makePacked(e,t){if(null!==t)try{let e;if(e="string"==typeof t?JSON.parse(t):t,e.frames.length){const t={};for(let i=0;i0);const n=e.substring(0,i-1)+".json",r=()=>{u.Y.Error("JSON ERROR: Unable to load JSON file."),this._fromPacked=!1,this._packedAndReady=!1},s=e=>{try{const t=JSON.parse(e),i=Reflect.ownKeys(t.frames);this._spriteMap=i,this._packedAndReady=!0,this._cellData=t.frames}catch(e){throw this._fromPacked=!1,this._packedAndReady=!1,new Error("Invalid JSON format. Please check documentation for format specifications.")}};V.w1.LoadFile(n,s,void 0,void 0,!1,r)}}_checkTextureAlpha(e,t,i,n,r){if(!e.useAlphaForPicking||!this.texture)return!0;const s=this.texture.getSize();this._textureContent||(this._textureContent=new Uint8Array(s.width*s.height*4),this.texture.readPixels(0,0,this._textureContent));const a=o.jp.Vector3[0];a.copyFrom(t.direction),a.normalize(),a.scaleInPlace(i),a.addInPlace(t.origin);const l=(a.x-n.x)/(r.x-n.x)-.5,c=1-(a.y-n.y)/(r.y-n.y)-.5,h=e.angle,_=l*Math.cos(h)-c*Math.sin(h)+.5,d=l*Math.sin(h)+c*Math.cos(h)+.5,u=e._xOffset*s.width+_*e._xSize|0,p=e._yOffset*s.height+d*e._ySize|0;return this._textureContent[4*(u+p*s.width)+3]>.5}intersects(e,t,i,n){const r=Math.min(this.capacity,this.sprites.length),s=o.P.Zero(),a=o.P.Zero();let l=Number.MAX_VALUE,c=null;const h=o.jp.Vector3[0],_=o.jp.Vector3[1],d=t.getViewMatrix();let u=e,p=e;for(let t=0;te){if(!this._checkTextureAlpha(r,u,e,s,a))continue;if(p=u,l=e,c=r,n)break}}}}if(c){const e=new Ii.p;d.invertToRef(o.jp.Matrix[0]),e.hit=!0,e.pickedSprite=c,e.distance=l;const t=o.jp.Vector3[2];return t.copyFrom(p.direction),t.normalize(),t.scaleInPlace(l),p.origin.addToRef(t,h),e.pickedPoint=o.P.TransformCoordinates(h,o.jp.Matrix[0]),e}return null}multiIntersects(e,t,i){const n=Math.min(this.capacity,this.sprites.length),r=o.P.Zero(),s=o.P.Zero();let a;const l=[],c=o.jp.Vector3[0].copyFromFloats(0,0,0),h=o.jp.Vector3[1].copyFromFloats(0,0,0),_=t.getViewMatrix();for(let t=0;t{const o=new Ll.g;o.addEventListener("readystatechange",(()=>{if(4==o.readyState)if(200==o.status){const t=JSON.parse(o.responseText),s=vd.Parse(t,i||m.l.LastCreatedScene,n);e&&(s.name=e),r(s)}else s("Unable to load the sprite manager")})),o.open("GET",t),o.send()}))}static ParseFromSnippetAsync(e,t,i=""){return"_BLANK"===e?Promise.resolve(new vd("Default sprite manager","//playground.babylonjs.com/textures/player.png",500,64,t)):new Promise(((n,r)=>{const s=new Ll.g;s.addEventListener("readystatechange",(()=>{if(4==s.readyState)if(200==s.status){const r=JSON.parse(JSON.parse(s.responseText).jsonPayload),o=JSON.parse(r.spriteManager),a=vd.Parse(o,t||m.l.LastCreatedScene,i);a.snippetId=e,n(a)}else r("Unable to load the snippet "+e)})),s.open("GET",this.SnippetUrl+"/"+e.replace(/#/g,"/")),s.send()}))}}vd.SnippetUrl="https://snippet.babylonjs.com",vd.CreateFromSnippetAsync=vd.ParseFromSnippetAsync;dt.v.ShadersStore.spriteMapPixelShader="precision highp float;\nvarying vec3 vPosition;\nvarying vec2 vUV;\nvarying vec2 tUV;\nuniform float time;\nuniform float spriteCount;\nuniform sampler2D spriteSheet;\nuniform vec2 spriteMapSize;\nuniform vec2 outputSize;\nuniform vec2 stageSize;\nuniform sampler2D frameMap;\nuniform sampler2D tileMaps[LAYERS];\nuniform sampler2D animationMap;\nuniform vec3 colorMul;\nfloat mt;\nconst float fdStep=1./4.;\nconst float aFrameSteps=1./MAX_ANIMATION_FRAMES;\nmat4 getFrameData(float frameID){\nfloat fX=frameID/spriteCount;\nreturn mat4(\ntexture2D(frameMap,vec2(fX,0.),0.),\ntexture2D(frameMap,vec2(fX,fdStep*1.),0.),\ntexture2D(frameMap,vec2(fX,fdStep*2.),0.),\nvec4(0.)\n);\n}\nvoid main(){\nvec4 color=vec4(0.);\nvec2 tileUV=fract(tUV);\n#ifdef FLIPU\ntileUV.y=1.0-tileUV.y;\n#endif\nvec2 tileID=floor(tUV);\nvec2 sheetUnits=1./spriteMapSize;\nfloat spriteUnits=1./spriteCount;\nvec2 stageUnits=1./stageSize;\nfor(int i=0; i0.) {\nmt=mod(time*animationData.z,1.0);\nfor(float f=0.; fmt){\nframeID=animationData.x;\nbreak;\n}\nanimationData=texture2D(animationMap,vec2((frameID+0.5)/spriteCount,aFrameSteps*f),0.);\n}\n}\nmat4 frameData=getFrameData(frameID+0.5);\nvec2 frameSize=(frameData[0].zw)/spriteMapSize;\nvec2 offset=frameData[0].xy*sheetUnits;\nvec2 ratio=frameData[2].xy/frameData[0].zw;\nif (frameData[2].z==1.){\ntileUV.xy=tileUV.yx;\n}\nif (i==0){\ncolor=texture2D(spriteSheet,tileUV*frameSize+offset);\n} else {\nvec4 nc=texture2D(spriteSheet,tileUV*frameSize+offset);\nfloat alpha=min(color.a+nc.a,1.0);\nvec3 mixed=mix(color.xyz,nc.xyz,nc.a);\ncolor=vec4(mixed,alpha);\n}\n}\ncolor.xyz*=colorMul;\ngl_FragColor=color;\n}";var Ad;dt.v.ShadersStore.spriteMapVertexShader="precision highp float;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nvarying vec3 vPosition;\nvarying vec2 vUV;\nvarying vec2 tUV;\nvarying vec2 stageUnits;\nvarying vec2 levelUnits;\nvarying vec2 tileID;\nuniform float time;\nuniform mat4 worldViewProjection;\nuniform vec2 outputSize;\nuniform vec2 stageSize;\nuniform vec2 spriteMapSize;\nuniform float stageScale;\nvoid main() {\nvec4 p=vec4( position,1. );\nvPosition=p.xyz;\nvUV=uv;\ntUV=uv*stageSize; \ngl_Position=worldViewProjection*p;\n}",i("../../../node_modules/@babylonjs/core/States/alphaCullingState.js"),i("../../../node_modules/@babylonjs/core/States/stencilState.js"),i("../../../node_modules/@babylonjs/core/Misc/andOrNotEvaluator.js"),function(e){e[e.INIT=0]="INIT",e[e.RUNNING=1]="RUNNING",e[e.DONE=2]="DONE",e[e.ERROR=3]="ERROR"}(Ad||(Ad={}));class Cd{constructor(e){this.name=e,this._isCompleted=!1,this._taskState=Ad.INIT}get isCompleted(){return this._isCompleted}get taskState(){return this._taskState}get errorObject(){return this._errorObject}_setErrorObject(e,t){this._errorObject||(this._errorObject={message:e,exception:t})}run(e,t,i){this._taskState=Ad.RUNNING,this.runTask(e,(()=>{this._onDoneCallback(t,i)}),((e,t)=>{this._onErrorCallback(i,e,t)}))}runTask(e,t,i){throw new Error("runTask is not implemented")}reset(){this._taskState=Ad.INIT}_onErrorCallback(e,t,i){this._taskState=Ad.ERROR,this._errorObject={message:t,exception:i},this.onError&&this.onError(this,t,i),e()}_onDoneCallback(e,t){try{this._taskState=Ad.DONE,this._isCompleted=!0,this.onSuccess&&this.onSuccess(this),e()}catch(e){this._onErrorCallback(t,"Task is done, error executing success callback(s)",e)}}}class Sd{constructor(e,t,i){this.remainingCount=e,this.totalCount=t,this.task=i}}class xd extends Cd{constructor(e,t,i,n,r){super(e),this.name=e,this.meshesNames=t,this.rootUrl=i,this.sceneFilename=n,this.extension=r}runTask(e,t,i){Vs.n.LoadAssetContainer(this.rootUrl,this.sceneFilename,e,(e=>{this.loadedContainer=e,this.loadedMeshes=e.meshes,this.loadedTransformNodes=e.transformNodes,this.loadedParticleSystems=e.particleSystems,this.loadedSkeletons=e.skeletons,this.loadedAnimationGroups=e.animationGroups,t()}),null,((e,t,n)=>{i(t,n)}),this.extension)}}class Td extends Cd{constructor(e,t,i,n,r){super(e),this.name=e,this.meshesNames=t,this.rootUrl=i,this.sceneFilename=n,this.extension=r}runTask(e,t,i){Vs.n.ImportMesh(this.meshesNames,this.rootUrl,this.sceneFilename,e,((e,i,n,r,s)=>{this.loadedMeshes=e,this.loadedTransformNodes=s,this.loadedParticleSystems=i,this.loadedSkeletons=n,this.loadedAnimationGroups=r,t()}),null,((e,t,n)=>{i(t,n)}),this.extension)}}class Ed extends Cd{constructor(e,t){super(e),this.name=e,this.url=t}runTask(e,t,i){e._loadFile(this.url,(e=>{this.text=e,t()}),void 0,!1,!1,((e,t)=>{e&&i(e.status+" "+e.statusText,t)}))}}class Rd extends Cd{constructor(e,t){super(e),this.name=e,this.url=t}runTask(e,t,i){e._loadFile(this.url,(e=>{this.data=e,t()}),void 0,!0,!0,((e,t)=>{e&&i(e.status+" "+e.statusText,t)}))}}class Pd extends Cd{constructor(e,t){super(e),this.name=e,this.url=t}runTask(e,t,i){const n=new Image;V.w1.SetCorsBehavior(this.url,n),n.onload=()=>{this.image=n,t()},n.onerror=e=>{i("Error loading image",e)},n.src=this.url}}class Id extends Cd{constructor(e,t,i,n=!0,r=K.x.TRILINEAR_SAMPLINGMODE){super(e),this.name=e,this.url=t,this.noMipmap=i,this.invertY=n,this.samplingMode=r}runTask(e,t,i){this.texture=new K.x(this.url,e,this.noMipmap,this.invertY,this.samplingMode,(()=>{t()}),((e,t)=>{i(e,t)}))}}class Md extends Cd{constructor(e,t,i,n,r,s){super(e),this.name=e,this.url=t,this.extensions=i,this.noMipmap=n,this.files=r,this.prefiltered=s}runTask(e,t,i){this.texture=new ao.B(this.url,e,this.extensions,this.noMipmap,this.files,(()=>{t()}),((e,t)=>{i(e,t)}),void 0,this.prefiltered)}}class Dd extends Cd{constructor(e,t,i,n=!1,r=!0,s=!1,o=!1){super(e),this.name=e,this.url=t,this.size=i,this.noMipmap=n,this.generateHarmonics=r,this.gammaSpace=s,this.reserved=o}runTask(e,t,i){this.texture=new Wa(this.url,e,this.size,this.noMipmap,this.generateHarmonics,this.gammaSpace,this.reserved,(()=>{t()}),((e,t)=>{i(e,t)}))}}class Od extends Cd{constructor(e,t,i,n=!1,r=!0){super(e),this.name=e,this.url=t,this.size=i,this.noMipmap=n,this.gammaSpace=r}runTask(e,t,i){this.texture=new bl(this.url,e,this.size,this.noMipmap,this.gammaSpace,(()=>{t()}),((e,t)=>{i(e,t)}))}}class wd{constructor(e){this._isLoading=!1,this._tasks=new Array,this._waitingTasksCount=0,this._totalTasksCount=0,this.onTaskSuccessObservable=new s.y$,this.onTaskErrorObservable=new s.y$,this.onTasksDoneObservable=new s.y$,this.onProgressObservable=new s.y$,this.useDefaultLoadingScreen=!0,this.autoHideLoadingUI=!0,this._scene=e||m.l.LastCreatedScene}addContainerTask(e,t,i,n,r){const s=new xd(e,t,i,n,r);return this._tasks.push(s),s}addMeshTask(e,t,i,n,r){const s=new Td(e,t,i,n,r);return this._tasks.push(s),s}addTextFileTask(e,t){const i=new Ed(e,t);return this._tasks.push(i),i}addBinaryFileTask(e,t){const i=new Rd(e,t);return this._tasks.push(i),i}addImageTask(e,t){const i=new Pd(e,t);return this._tasks.push(i),i}addTextureTask(e,t,i,n,r=K.x.TRILINEAR_SAMPLINGMODE){const s=new Id(e,t,i,n,r);return this._tasks.push(s),s}addCubeTextureTask(e,t,i,n,r,s){const o=new Md(e,t,i,n,r,s);return this._tasks.push(o),o}addHDRCubeTextureTask(e,t,i,n=!1,r=!0,s=!1,o=!1){const a=new Dd(e,t,i,n,r,s,o);return this._tasks.push(a),a}addEquiRectangularCubeTextureAssetTask(e,t,i,n=!1,r=!0){const s=new Od(e,t,i,n,r);return this._tasks.push(s),s}removeTask(e){const t=this._tasks.indexOf(e);t>-1&&this._tasks.splice(t,1)}_decreaseWaitingTasksCount(e){this._waitingTasksCount--;try{this.onProgress&&this.onProgress(this._waitingTasksCount,this._totalTasksCount,e),this.onProgressObservable.notifyObservers(new Sd(this._waitingTasksCount,this._totalTasksCount,e))}catch(e){u.Y.Error("Error running progress callbacks."),console.log(e)}if(0===this._waitingTasksCount){try{const e=this._tasks.slice();this.onFinish&&this.onFinish(e);for(const t of e)if(t.taskState===Ad.DONE){const e=this._tasks.indexOf(t);e>-1&&this._tasks.splice(e,1)}this.onTasksDoneObservable.notifyObservers(this._tasks)}catch(e){u.Y.Error("Error running tasks-done callbacks."),console.log(e)}this._isLoading=!1,this.autoHideLoadingUI&&this._scene.getEngine().hideLoadingUI()}}_runTask(e){const t=(t,i)=>{e._setErrorObject(t,i),this.onTaskError?this.onTaskError(e):e.onError||u.Y.Error(this._formatTaskErrorMessage(e)),this.onTaskErrorObservable.notifyObservers(e),this._decreaseWaitingTasksCount(e)};e.run(this._scene,(()=>{try{this.onTaskSuccess&&this.onTaskSuccess(e),this.onTaskSuccessObservable.notifyObservers(e),this._decreaseWaitingTasksCount(e)}catch(e){t("Error executing task success callbacks",e)}}),t)}_formatTaskErrorMessage(e){let t="Unable to complete task "+e.name;return e.errorObject.message&&(t+=`: ${e.errorObject.message}`),e.errorObject.exception&&(t+=`: ${e.errorObject.exception}`),t}reset(){return this._isLoading=!1,this._tasks=new Array,this}load(){if(this._isLoading)return this;if(this._isLoading=!0,this._waitingTasksCount=this._tasks.length,this._totalTasksCount=this._tasks.length,0===this._waitingTasksCount)return this._isLoading=!1,this.onFinish&&this.onFinish(this._tasks),this.onTasksDoneObservable.notifyObservers(this._tasks),this;this.useDefaultLoadingScreen&&this._scene.getEngine().displayLoadingUI();for(let e=0;e{this._isLoading?e():(this.onTasksDoneObservable.addOnce((i=>{i&&i.length?t(i):e()})),this.load())}))}}i("../../../node_modules/@babylonjs/core/Misc/deferred.js"),i("../../../node_modules/@babylonjs/core/Misc/filesInputStore.js"),s.y$.prototype.notifyObserversWithPromise=async function(e,t=-1,i,n,r){let s=Promise.resolve(e);if(!this.observers.length)return s;const o=this._eventState;return o.mask=t,o.target=i,o.currentTarget=n,o.skipNextObservers=!1,o.userInfo=r,this.observers.forEach((i=>{o.skipNextObservers||i._willBeUnregistered||i.mask&t&&(s=i.scope?s.then((t=>(o.lastReturnValue=t,i.callback.apply(i.scope,[e,o])))):s.then((t=>(o.lastReturnValue=t,i.callback(e,o)))),i.unregisterOnNextCall&&this._deferUnregister(i))})),await s,e},i("../../../node_modules/@babylonjs/core/Misc/performanceMonitor.js");class Fd{constructor(e=0){this.priority=e}getDescription(){return""}apply(e,t){return!0}}class Bd extends Fd{constructor(){super(...arguments),this._canBeMerged=e=>{if(!(e instanceof je.Kj))return!1;const t=e;return!(t.isDisposed()||!t.isVisible||!t.isEnabled()||t.instances.length>0||t.skeleton||t.hasLODLevels)}}static get UpdateSelectionTree(){return Bd._UpdateSelectionTree}static set UpdateSelectionTree(e){Bd._UpdateSelectionTree=e}getDescription(){return"Merging similar meshes together"}apply(e,t,i){const n=e.meshes.slice(0);let r=n.length;for(let e=0;e{e.doNotSerialize||(t.vertexData.push(e.serializeVerticeData()),Nd[e.id]=!0)},kd=(e,t)=>{const i={},n=e._geometry;return n&&(e.getScene().getGeometryById(n.id)||Ld(n,t.geometries)),e.serialize&&e.serialize(i),i};class Vd{static ClearCache(){Nd=[]}static Serialize(e){return Vd._Serialize(e)}static _Serialize(e,t=!0){const i={};if(t&&!e.getEngine()._features.supportSyncTextureRead&&K.x.ForceSerializeBuffers&&console.warn("The serialization object may not contain the proper base64 encoded texture data! You should use the SerializeAsync method instead."),Vd.ClearCache(),i.useDelayedTextureLoading=e.useDelayedTextureLoading,i.autoClear=e.autoClear,i.clearColor=e.clearColor.asArray(),i.ambientColor=e.ambientColor.asArray(),i.gravity=e.gravity.asArray(),i.collisionsEnabled=e.collisionsEnabled,i.useRightHandedSystem=e.useRightHandedSystem,e.fogMode&&0!==e.fogMode&&(i.fogMode=e.fogMode,i.fogColor=e.fogColor.asArray(),i.fogStart=e.fogStart,i.fogEnd=e.fogEnd,i.fogDensity=e.fogDensity),e.isPhysicsEnabled()){const t=e.getPhysicsEngine();t&&(i.physicsEnabled=!0,i.physicsGravity=t.gravity.asArray(),i.physicsEngine=t.getPhysicsPluginName())}e.metadata&&(i.metadata=e.metadata),i.morphTargetManagers=[];for(const t of e.meshes){const e=t.morphTargetManager;e&&i.morphTargetManagers.push(e.serialize())}let n,r,s;for(i.lights=[],n=0;n0){i.animationGroups=[];for(let t=0;t0)for(i.reflectionProbes=[],n=0;nt))}static _CollectPromises(e,t){if(Array.isArray(e))for(let i=0;ie[i]=t))):(n instanceof Object||Array.isArray(n))&&this._CollectPromises(n,t)}else if(e instanceof Object)for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n instanceof Promise?t.push(n.then((t=>e[i]=t))):(n instanceof Object||Array.isArray(n))&&this._CollectPromises(n,t)}}static SerializeMesh(e,t=!1,i=!1){const n={};if(Vd.ClearCache(),e=e instanceof Array?e:[e],t||i)for(let n=0;n{t instanceof je.Kj&&e.indexOf(t)<0&&!t.doNotSerialize&&e.push(t)})),t&&e[n].parent&&e.indexOf(e[n].parent)<0&&!e[n].parent.doNotSerialize&&e.push(e[n].parent);return e.forEach((e=>{((e,t)=>{if(1===e.delayLoadState||0===e.delayLoadState){const i=i=>{t.materials=t.materials||[],e.material&&!t.materials.some((t=>t.id===e.material.id))&&t.materials.push(i.serialize())};if(e.material&&!e.material.doNotSerialize)if(e.material instanceof La.G){if(t.multiMaterials=t.multiMaterials||[],!t.multiMaterials.some((t=>t.id===e.material.id))){t.multiMaterials.push(e.material.serialize());for(const t of e.material.subMaterials)t&&i(t)}}else i(e.material);else e.material||i(e.getScene().defaultMaterial);const n=e._geometry;n&&(t.geometries||(t.geometries={},t.geometries.boxes=[],t.geometries.spheres=[],t.geometries.cylinders=[],t.geometries.toruses=[],t.geometries.grounds=[],t.geometries.planes=[],t.geometries.torusKnots=[],t.geometries.vertexData=[]),Ld(n,t.geometries)),e.skeleton&&!e.skeleton.doNotSerialize&&(t.skeletons=t.skeletons||[],t.skeletons.push(e.skeleton.serialize())),t.meshes=t.meshes||[],t.meshes.push(kd(e,t))}})(e,n)})),n}}i("../../../node_modules/@babylonjs/core/Misc/tags.js");class Ud{constructor(e,t={}){if(!Ud.IsSupported(e))throw"Your browser does not support recording so far.";const i=e.getRenderingCanvas();if(!i)throw"The babylon engine must have a canvas to be recorded";this._canvas=i,this._canvas.isRecording=!1,this._options={...Ud._DefaultOptions,...t};const n=this._canvas.captureStream(this._options.fps);if(this._options.audioTracks)for(const e of this._options.audioTracks)n.addTrack(e);this._mediaRecorder=new MediaRecorder(n,{mimeType:this._options.mimeType}),this._mediaRecorder.ondataavailable=this._handleDataAvailable.bind(this),this._mediaRecorder.onerror=this._handleError.bind(this),this._mediaRecorder.onstop=this._handleStop.bind(this)}static IsSupported(e){const t=e.getRenderingCanvas();return!!t&&"function"==typeof t.captureStream}get isRecording(){return!!this._canvas&&this._canvas.isRecording}stopRecording(){this._canvas&&this._mediaRecorder&&this.isRecording&&(this._canvas.isRecording=!1,this._mediaRecorder.stop())}startRecording(e="babylonjs.webm",t=7){if(!this._canvas||!this._mediaRecorder)throw"Recorder has already been disposed";if(this.isRecording)throw"Recording already in progress";return t>0&&setTimeout((()=>{this.stopRecording()}),1e3*t),this._fileName=e,this._recordedChunks=[],this._resolve=null,this._reject=null,this._canvas.isRecording=!0,this._mediaRecorder.start(this._options.recordChunckSize),new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}dispose(){this._canvas=null,this._mediaRecorder=null,this._recordedChunks=[],this._fileName=null,this._resolve=null,this._reject=null}_handleDataAvailable(e){e.data.size>0&&this._recordedChunks.push(e.data)}_handleError(e){if(this.stopRecording(),!this._reject)throw new e.error;this._reject(e.error)}_handleStop(){this.stopRecording();const e=new Blob(this._recordedChunks);this._resolve&&this._resolve(e),window.URL.createObjectURL(e),this._fileName&&V.w1.Download(e,this._fileName)}}function Gd(e,t,i,n,r="image/png",s=!1){const{height:o,width:a}=Wd(e,t,i);if(!o||!a)return void u.Y.Error("Invalid 'size' parameter !");V.w1._ScreenshotCanvas||(V.w1._ScreenshotCanvas=document.createElement("canvas")),V.w1._ScreenshotCanvas.width=a,V.w1._ScreenshotCanvas.height=o;const l=V.w1._ScreenshotCanvas.getContext("2d"),c=e.getRenderWidth()/e.getRenderHeight();let h=a,_=h/c;_>o&&(_=o,h=_*c);const d=Math.max(0,a-h)/2,p=Math.max(0,o-_)/2;t.getScene().activeCamera!==t?jd(e,t,i,(e=>{if(s){const t=new Blob([e]);V.w1.DownloadBlob(t),n&&n("")}else n&&n(e)}),r,1,e.getCreationOptions().antialias):e.onEndFrameObservable.addOnce((()=>{const t=e.getRenderingCanvas();l&&t&&l.drawImage(t,d,p,h,_),s?(V.w1.EncodeScreenshotCanvasData(void 0,r),n&&n("")):V.w1.EncodeScreenshotCanvasData(n,r)}))}function jd(e,t,i,n,r="image/png",s=1,o=!1,a,l=!1,c=!1){const{height:h,width:_}=Wd(e,t,i),d={width:_,height:h};if(!h||!_)return void u.Y.Error("Invalid 'size' parameter !");const p={width:e.getRenderWidth(),height:e.getRenderHeight()};e.setSize(_,h);const f=t.getScene();f.render();const m=new Ot._("screenShot",d,f,!1,!1,0,!1,K.x.NEAREST_SAMPLINGMODE,void 0,c,void 0,void 0,void 0,s);m.renderList=f.meshes.slice(),m.samples=s,m.renderSprites=l,m.activeCamera=t;const g=()=>{e.onEndFrameObservable.addOnce((()=>{m.readPixels(void 0,void 0,void 0,!1).then((e=>{V.w1.DumpData(_,h,e,n,r,a,!0),m.dispose()}))})),f.incrementRenderId(),f.resetCachedMaterial(),m.render(!0),f.incrementRenderId(),f.resetCachedMaterial(),e.setSize(p.width,p.height),t.getProjectionMatrix(!0),f.render()};if(o){const e=new F_("antialiasing",1,f.activeCamera);m.addPostProcess(e),e.getEffect().isReady()?g():e.getEffect().onCompiled=()=>{g()}}else g()}function Wd(e,t,i){let n=0,r=0;if("object"==typeof i){const s=i.precision?Math.abs(i.precision):1;i.width&&i.height?(n=i.height*s,r=i.width*s):i.width&&!i.height?(r=i.width*s,n=Math.round(r/e.getAspectRatio(t))):i.height&&!i.width?(n=i.height*s,r=Math.round(n*e.getAspectRatio(t))):(r=Math.round(e.getRenderWidth()*s),n=Math.round(r/e.getAspectRatio(t)))}else isNaN(i)||(n=i,r=i);return r&&(r=Math.floor(r)),n&&(n=Math.floor(n)),{height:0|n,width:0|r}}var zd,Hd;Ud._DefaultOptions={mimeType:"video/webm",fps:25,recordChunckSize:3e3},V.w1.CreateScreenshot=Gd,V.w1.CreateScreenshotAsync=function(e,t,i,n="image/png"){return new Promise(((r,s)=>{Gd(e,t,i,(e=>{void 0!==e?r(e):s(new Error("Data is undefined"))}),n)}))},V.w1.CreateScreenshotUsingRenderTarget=jd,V.w1.CreateScreenshotUsingRenderTargetAsync=function(e,t,i,n="image/png",r=1,s=!1,o,a=!1){return new Promise(((l,c)=>{jd(e,t,i,(e=>{void 0!==e?l(e):c(new Error("Data is undefined"))}),n,r,s,o,a)}))},function(e){e[e.Checkbox=0]="Checkbox",e[e.Slider=1]="Slider",e[e.Vector3=2]="Vector3",e[e.Quaternion=3]="Quaternion",e[e.Color3=4]="Color3",e[e.String=5]="String",e[e.Button=6]="Button",e[e.Options=7]="Options",e[e.Tab=8]="Tab",e[e.FileButton=9]="FileButton"}(zd||(zd={})),i("../../../node_modules/@babylonjs/core/Misc/rgbdTextureTools.js"),i("../../../node_modules/@babylonjs/core/Misc/retryStrategy.js"),i("../../../node_modules/@babylonjs/core/Misc/dataReader.js");class Xd{static _GetStorage(){try{return localStorage.setItem("test",""),localStorage.removeItem("test"),localStorage}catch(e){const t={};return{getItem:e=>{const i=t[e];return void 0===i?null:i},setItem:(e,i)=>{t[e]=i}}}}static ReadString(e,t){const i=this._Storage.getItem(e);return null!==i?i:t}static WriteString(e,t){this._Storage.setItem(e,t)}static ReadBoolean(e,t){const i=this._Storage.getItem(e);return null!==i?"true"===i:t}static WriteBoolean(e,t){this._Storage.setItem(e,t?"true":"false")}static ReadNumber(e,t){const i=this._Storage.getItem(e);return null!==i?parseFloat(i):t}static WriteNumber(e,t){this._Storage.setItem(e,t.toString())}}Xd._Storage=Xd._GetStorage(),function(e){class t{constructor(e,t=null,i=null,n=null){let r;t=null!=t?t:()=>1,i=null!=i?i:()=>1,n=null!=n?n:(e,t)=>e===t?0:1,this._characterToIdx=new Map,this._insertionCosts=new Array(e.length),this._deletionCosts=new Array(e.length),this._substitutionCosts=new Array(e.length);for(let s=0;s{t[e]=i})),e.characters=t,e.insertionCosts=this._insertionCosts,e.deletionCosts=this._deletionCosts,e.substitutionCosts=this._substitutionCosts,JSON.stringify(e)}static Deserialize(e){const i=JSON.parse(e),n=new t(i.characters);return n._insertionCosts=i.insertionCosts,n._deletionCosts=i.deletionCosts,n._substitutionCosts=i.substitutionCosts,n}getCharacterIdx(e){return this._characterToIdx.get(e)}getInsertionCost(e){return this._insertionCosts[e]}getDeletionCost(e){return this._deletionCosts[e]}getSubstitutionCost(e,t){const i=Math.min(e,t),n=Math.max(e,t);return this._substitutionCosts[i][n]}}e.Alphabet=t;class i{constructor(e,t){if(e.length>i._MAX_SEQUENCE_LENGTH)throw new Error("Sequences longer than "+i._MAX_SEQUENCE_LENGTH+" not supported.");this._alphabet=t,this._characters=e.map((e=>this._alphabet.getCharacterIdx(e)))}serialize(){return JSON.stringify(this._characters)}static Deserialize(e,t){const n=new i([],t);return n._characters=JSON.parse(e),n}distance(e){return i._Distance(this,e)}static _Distance(e,t){const n=e._alphabet;if(n!==t._alphabet)throw new Error("Cannot Levenshtein compare Sequences built from different alphabets.");const r=e._characters,s=t._characters,o=r.length,a=s.length,l=i._CostMatrix;l[0][0]=0;for(let e=0;enew Array(i._MAX_SEQUENCE_LENGTH+1))),e.Sequence=i}(Hd||(Hd={}));class Yd{constructor(e=.01){this._points=[],this._segmentLength=e}serialize(){return JSON.stringify(this)}static Deserialize(e){const t=JSON.parse(e),i=new Yd(t._segmentLength);return i._points=t._points.map((e=>new o.P(e._x,e._y,e._z))),i}getLength(){return this._points.length*this._segmentLength}add(e){let t=this._points.length;if(0===t)this._points.push(e.clone());else{const i=()=>this._segmentLength/o.P.Distance(this._points[t-1],e);for(let n=i();n<=1;n=i()){const i=this._points[t-1].scale(1-n);e.scaleAndAddToRef(n,i),this._points.push(i),++t}}}resampleAtTargetResolution(e){const t=new Yd(this.getLength()/e);return this._points.forEach((e=>{t.add(e)})),t}tokenize(e){const t=[],i=new o.P;for(let n=2;n.98||(o.P.CrossToRef(Yd._ForwardDir,Yd._InverseFromVec,Yd._UpDir),Yd._UpDir.normalize(),o.y3.LookAtLHToRef(e,t,Yd._UpDir,Yd._LookMatrix),i.subtractToRef(t,Yd._FromToVec),Yd._FromToVec.normalize(),o.P.TransformNormalToRef(Yd._FromToVec,Yd._LookMatrix,n),0))}static _TokenizeSegment(e,t){Yd._BestMatch=0,Yd._Score=o.P.Dot(e,t[0]),Yd._BestScore=Yd._Score;for(let i=1;iYd._BestScore&&(Yd._BestMatch=i,Yd._BestScore=Yd._Score);return Yd._BestMatch}}Yd._ForwardDir=new o.P,Yd._InverseFromVec=new o.P,Yd._UpDir=new o.P,Yd._FromToVec=new o.P,Yd._LookMatrix=new o.y3;class Qd{constructor(){this._sequences=[]}serialize(){return JSON.stringify(this._sequences.map((e=>e.serialize())))}static Deserialize(e,t){const i=new Qd;return i._sequences=JSON.parse(e).map((e=>Hd.Sequence.Deserialize(e,t))),i}static CreateFromTrajectory(e,t,i){return Qd.CreateFromTokenizationPyramid(Qd._GetTokenizationPyramid(e,t),i)}static CreateFromTokenizationPyramid(e,t){const i=new Qd;return i._sequences=e.map((e=>new Hd.Sequence(e,t))),i}static _GetTokenizationPyramid(e,t,i=Qd._FINEST_DESCRIPTOR_RESOLUTION){const n=[];for(let r=i;r>4;r=Math.floor(r/2))n.push(e.resampleAtTargetResolution(r).tokenize(t.chars));return n}distance(e){let t,i=0;for(let n=0;ne.serialize())),e.centroidIdx=this._centroidIdx,e.averageDistance=this._averageDistance,JSON.stringify(e)}static Deserialize(e,t){const i=JSON.parse(e),n=new qd;return n._descriptors=i.descriptors.map((e=>Qd.Deserialize(e,t))),n._centroidIdx=i.centroidIdx,n._averageDistance=i.averageDistance,n}add(e){this._descriptors.push(e),this._refreshDescription()}getMatchCost(e){return e.distance(this._descriptors[this._centroidIdx])/this._averageDistance}getMatchMinimumDistance(e){return Math.min(...this._descriptors.map((t=>t.distance(e))))}_refreshDescription(){let e;this._centroidIdx=-1;const t=this._descriptors.map((t=>(e=0,this._descriptors.forEach((i=>{e+=t.distance(i)})),e)));for(let e=0;e{this._averageDistance+=e.distance(this._descriptors[this._centroidIdx])})),this._descriptors.length>0&&(this._averageDistance=Math.max(this._averageDistance/this._descriptors.length,qd._MIN_AVERAGE_DISTANCE))}}qd._MIN_AVERAGE_DISTANCE=1,i("../../../node_modules/@babylonjs/core/Misc/copyTools.js");class Kd{constructor(e,t,i){this._scene=e,u.Y.Log(`[Reflector] Connecting to ws://${t}:${i}`),this._webSocket=new WebSocket(`ws://${t}:${i}`),this._webSocket.onmessage=e=>{const t=e.data;if(t.startsWith(Kd._SERVER_PREFIX)){const e=t.substr(Kd._SERVER_PREFIX.length);return u.Y.Log(`[Reflector] Received server message: ${e.substr(0,64)}`),void this._handleServerMessage(e)}u.Y.Log(`[Reflector] Received client message: ${t.substr(0,64)}`),this._handleClientMessage()},this._webSocket.onclose=e=>{u.Y.Log(`[Reflector] Disconnected ${e.code} ${e.reason}`)}}close(){this._webSocket.close()}_handleServerMessage(e){"connected"===e&&Vd.SerializeAsync(this._scene).then((e=>{this._webSocket.send(`load|${JSON.stringify(e)}`)}))}_handleClientMessage(){}}Kd._SERVER_PREFIX="$$",i("../../../node_modules/@babylonjs/core/Misc/computePressure.js");class Zd{constructor(e){this._view=new Float32Array(e),this._itemLength=0}get itemLength(){return this._itemLength}at(e){return e<0||e>=this._itemLength?NaN:this._view[e]}subarray(e,t){return e>=t||e<0?new Float32Array(0):(t>this._itemLength&&(t=this._itemLength),this._view.subarray(e,t))}push(e){this._view[this._itemLength]=e,this._itemLength++,this._itemLength>=this._view.length&&this._growArray()}_growArray(){const e=Math.floor(1.5*this._view.length),t=new Float32Array(e);t.set(this._view),this._view=t}}const $d=1800,Jd=/\r/g;class eu{constructor(e,t){this._scene=e,this._collectDataAtFrame=()=>{const e=P.F.Now-this._startingTimestamp,t=this.datasets.ids.length,i=this.datasets.startingIndices.itemLength;let n=0;if(i>0){const e=this.datasets.startingIndices.at(i-1);n=e+this.datasets.data.at(e+eu.NumberOfPointsOffset)+eu.SliceDataOffset}if(this.datasets.startingIndices.push(n),this.datasets.data.push(e),this.datasets.data.push(t),this.datasets.ids.forEach((e=>{const t=this._strategies.get(e);t&&this.datasets.data.push(t.getData())})),this.datasetObservable.hasObservers()){const i=[e,t];for(let e=0;ee.callback(this._datasetMeta,new s.he(0)))),t&&this.addCollectionStrategies(...t)}static get SliceDataOffset(){return 2}static get NumberOfPointsOffset(){return 1}registerEvent(e,t,i){var n;if(this._strategies.has(e)&&!t)return;this._strategies.has(e)&&t&&(null===(n=this._strategies.get(e))||void 0===n||n.dispose(),this._strategies.delete(e));const r={name:e};return this._eventRestoreSet.add(e),this.addCollectionStrategies({strategyCallback:t=>{let i=0,n=0;const r=t.onAfterRenderObservable.add((()=>{n=i,i=0})),s=this._customEventObservable.add((t=>{e===t.name&&(void 0!==t.value?i=t.value:i++)}));return{id:e,getData:()=>n,dispose:()=>{t.onAfterRenderObservable.remove(r),this._customEventObservable.remove(s)}}},category:i}),r}sendEvent(e){this._customEventObservable.notifyObservers(e)}_restoreStringEvents(){this._eventRestoreSet.size!==this._customEventObservable.observers.length&&this._eventRestoreSet.forEach((e=>{this.registerEvent(e,!0)}))}addCollectionStrategies(...e){for(let{strategyCallback:t,category:i,hidden:n}of e){const e=t(this._scene);this._strategies.has(e.id)?e.dispose():(this.datasets.ids.push(e.id),i&&(i=i.replace(new RegExp("@","g"),"")),this._datasetMeta.set(e.id,{color:this._getHexColorFromId(e.id),category:i,hidden:n}),this._strategies.set(e.id,e))}this.metadataObservable.notifyObservers(this._datasetMeta)}_getHexColorFromId(e){let t=0;for(let i=0;i>e&255).toString(16)).substr(-2);return i}getCurrentSlice(){const e=[P.F.Now-this._startingTimestamp,this.datasets.ids.length];this.datasets.ids.forEach((t=>{const i=this._strategies.get(t);i&&this.datasetObservable.hasObservers()&&e.push(i.getData())})),this.datasetObservable.hasObservers()&&this.datasetObservable.notifyObservers(e)}updateMetadata(e,t,i){const n=this._datasetMeta.get(e);n&&(n[t]=i,this.metadataObservable.notifyObservers(this._datasetMeta))}clear(e){this.datasets.data=new Zd($d),this.datasets.ids.length=0,this.datasets.startingIndices=new Zd($d),this._datasetMeta.clear(),this._strategies.forEach((e=>e.dispose())),this._strategies.clear(),e||this._eventRestoreSet.clear(),this._hasLoadedData=!1}get hasLoadedData(){return this._hasLoadedData}loadFromFileData(e,t){const i=e.replace(Jd,"").split("\n").map((e=>e.split(",").filter((e=>e.length>0)))).filter((e=>e.length>0)),n=eu.NumberOfPointsOffset;if(i.length<2)return!1;const r={ids:[],data:new Zd($d),startingIndices:new Zd($d)},[s,...o]=i;if(s.length<2||"timestamp"!==s[0]||"numPoints"!==s[n])return!1;const a=new Map;for(let e=eu.SliceDataOffset;ee.dispose())),this._strategies.clear(),!t)for(const e of this.datasets.ids){const t=a.get(e);this._datasetMeta.set(e,{category:t,color:this._getHexColorFromId(e)})}return this.metadataObservable.notifyObservers(this._datasetMeta),this._hasLoadedData=!0,!0}exportDataToCsv(){let e="";e+="timestamp,numPoints";for(let t=0;t{e.dispose()})),this.datasetObservable.clear(),this.metadataObservable.clear(),this._isStarted=!1,this.datasets=null}}R.x.prototype.getPerfCollector=function(){return this._perfCollector||(this._perfCollector=new eu(this)),this._perfCollector};var tu=i("../../../node_modules/@babylonjs/core/Misc/coroutine.js");s.y$.prototype.runCoroutineAsync=function(e){if(!this._coroutineScheduler){const e=function(e){const t=new Array,i=new Array,n=new Array,r=e.add((()=>{const e=t.length;for(let r=0;r{t.push(e),i.push(r),n.push(s)},dispose:()=>{e.remove(r)}}}(this);this._coroutineScheduler=e.scheduler,this._coroutineSchedulerDispose=e.dispose}return(0,tu.sM)(e,this._coroutineScheduler)},s.y$.prototype.cancelAllCoroutines=function(){this._coroutineSchedulerDispose&&this._coroutineSchedulerDispose(),this._coroutineScheduler=void 0,this._coroutineSchedulerDispose=void 0};class iu extends Yo.F{constructor(e,t={}){super(e),this.options=t,this._direction=new o.P(0,0,-1),this._mat=new o.y3,this._onSelectEnabled=!1,this._origin=new o.P(0,0,0),this.lastNativeXRHitResults=[],this.onHitTestResultObservable=new s.y$,this._onHitTestResults=e=>{const t=e.map((e=>{const t=o.y3.FromArray(e.hitMatrix);return this._xrSessionManager.scene.useRightHandedSystem||t.toggleModelMatrixHandInPlace(),this.options.worldParentNode&&t.multiplyToRef(this.options.worldParentNode.getWorldMatrix(),t),{xrHitResult:e,transformationMatrix:t}}));this.lastNativeXRHitResults=e,this.onHitTestResultObservable.notifyObservers(t)},this._onSelect=e=>{this._onSelectEnabled&&iu.XRHitTestWithSelectEvent(e,this._xrSessionManager.referenceSpace)},this.xrNativeFeatureName="hit-test",V.w1.Warn("A newer version of this plugin is available")}static XRHitTestWithRay(e,t,i,n){return e.requestHitTest(t,i).then((e=>{const t=n||(e=>!!e.hitMatrix);return e.filter(t)}))}static XRHitTestWithSelectEvent(e,t){const i=e.frame.getPose(e.inputSource.targetRaySpace,t);if(!i)return Promise.resolve([]);const n=new XRRay(i.transform);return this.XRHitTestWithRay(e.frame.session,n,t)}attach(){return!!super.attach()&&(this.options.testOnPointerDownOnly&&this._xrSessionManager.session.addEventListener("select",this._onSelect,!1),!0)}detach(){return!!super.detach()&&(this._onSelectEnabled=!1,this._xrSessionManager.session.removeEventListener("select",this._onSelect),!0)}dispose(){super.dispose(),this.onHitTestResultObservable.clear()}_onXRFrame(e){if(!this.attached||this.options.testOnPointerDownOnly)return;const t=e.getViewerPose(this._xrSessionManager.referenceSpace);if(!t)return;o.y3.FromArrayToRef(t.transform.matrix,0,this._mat),o.P.TransformCoordinatesFromFloatsToRef(0,0,0,this._mat,this._origin),o.P.TransformCoordinatesFromFloatsToRef(0,0,-1,this._mat,this._direction),this._direction.subtractInPlace(this._origin),this._direction.normalize();const i=new XRRay({x:this._origin.x,y:this._origin.y,z:this._origin.z,w:0},{x:this._direction.x,y:this._direction.y,z:this._direction.z,w:0});iu.XRHitTestWithRay(this._xrSessionManager.session,i,this._xrSessionManager.referenceSpace).then(this._onHitTestResults)}}iu.Name=Bo.b.HIT_TEST,iu.Version=1,Bo.d.AddWebXRFeature(iu.Name,((e,t)=>()=>new iu(e,t)),iu.Version,!1);let nu=0;class ru extends Yo.F{constructor(e,t={}){super(e),this._options=t,this._lastFrameDetected=new Set,this._trackedAnchors=[],this._futureAnchors=[],this.onAnchorAddedObservable=new s.y$,this.onAnchorRemovedObservable=new s.y$,this.onAnchorUpdatedObservable=new s.y$,this._tmpVector=new o.P,this._tmpQuaternion=new o._f,this.xrNativeFeatureName="anchors"}set referenceSpaceForFrameAnchors(e){this._referenceSpaceForFrameAnchors=e}_populateTmpTransformation(e,t){return this._tmpVector.copyFrom(e),this._tmpQuaternion.copyFrom(t),this._xrSessionManager.scene.useRightHandedSystem||(this._tmpVector.z*=-1,this._tmpQuaternion.z*=-1,this._tmpQuaternion.w*=-1),{position:this._tmpVector,rotationQuaternion:this._tmpQuaternion}}async addAnchorPointUsingHitTestResultAsync(e,t=new o.P,i=new o._f){this._populateTmpTransformation(t,i);const n=new XRRigidTransform({x:this._tmpVector.x,y:this._tmpVector.y,z:this._tmpVector.z},{x:this._tmpQuaternion.x,y:this._tmpQuaternion.y,z:this._tmpQuaternion.z,w:this._tmpQuaternion.w});if(!e.xrHitResult.createAnchor)throw this.detach(),new Error("Anchors not enabled in this environment/browser");try{const t=await e.xrHitResult.createAnchor(n);return new Promise(((e,i)=>{this._futureAnchors.push({nativeAnchor:t,resolved:!1,submitted:!0,xrTransformation:n,resolve:e,reject:i})}))}catch(e){throw new Error(e)}}async addAnchorAtPositionAndRotationAsync(e,t=new o._f,i=!1){this._populateTmpTransformation(e,t);const n=new XRRigidTransform({x:this._tmpVector.x,y:this._tmpVector.y,z:this._tmpVector.z},{x:this._tmpQuaternion.x,y:this._tmpQuaternion.y,z:this._tmpQuaternion.z,w:this._tmpQuaternion.w}),r=i&&this.attached&&this._xrSessionManager.currentFrame?await this._createAnchorAtTransformation(n,this._xrSessionManager.currentFrame):void 0;return new Promise(((e,t)=>{this._futureAnchors.push({nativeAnchor:r,resolved:!1,submitted:!1,xrTransformation:n,resolve:e,reject:t})}))}get anchors(){return this._trackedAnchors}detach(){if(!super.detach())return!1;if(!this._options.doNotRemoveAnchorsOnSessionEnded)for(;this._trackedAnchors.length;){const e=this._trackedAnchors.pop();if(e){try{e.remove()}catch(e){}this.onAnchorRemovedObservable.notifyObservers(e)}}return!0}dispose(){this._futureAnchors.length=0,super.dispose(),this.onAnchorAddedObservable.clear(),this.onAnchorRemovedObservable.clear(),this.onAnchorUpdatedObservable.clear()}_onXRFrame(e){if(!this.attached||!e)return;const t=e.trackedAnchors;if(t){const i=this._trackedAnchors.filter((e=>!t.has(e.xrAnchor))).map((e=>this._trackedAnchors.indexOf(e)));let n=0;i.forEach((e=>{const t=this._trackedAnchors.splice(e-n,1)[0];this.onAnchorRemovedObservable.notifyObservers(t),n++})),t.forEach((t=>{if(this._lastFrameDetected.has(t)){const i=this._findIndexInAnchorArray(t),n=this._trackedAnchors[i];try{this._updateAnchorWithXRFrame(t,n,e),n.attachedNode&&(n.attachedNode.rotationQuaternion=n.attachedNode.rotationQuaternion||new o._f,n.transformationMatrix.decompose(n.attachedNode.scaling,n.attachedNode.rotationQuaternion,n.attachedNode.position)),this.onAnchorUpdatedObservable.notifyObservers(n)}catch(e){V.w1.Warn("Anchor could not be updated")}}else{const i={id:nu++,xrAnchor:t,remove:()=>t.delete()},n=this._updateAnchorWithXRFrame(t,i,e);this._trackedAnchors.push(n),this.onAnchorAddedObservable.notifyObservers(n);const r=this._futureAnchors.filter((e=>e.nativeAnchor===t))[0];r&&(r.resolve(n),r.resolved=!0)}})),this._lastFrameDetected=t}this._futureAnchors.forEach((t=>{t.resolved||t.submitted||(this._createAnchorAtTransformation(t.xrTransformation,e).then((e=>{t.nativeAnchor=e}),(e=>{t.resolved=!0,t.reject(e)})),t.submitted=!0)}))}_findIndexInAnchorArray(e){for(let t=0;t()=>new ru(e,t)),ru.Version);let su=0;class ou extends Yo.F{constructor(e,t={}){super(e),this._options=t,this._detectedPlanes=[],this._enabled=!1,this._lastFrameDetected=new Set,this.onPlaneAddedObservable=new s.y$,this.onPlaneRemovedObservable=new s.y$,this.onPlaneUpdatedObservable=new s.y$,this.xrNativeFeatureName="plane-detection",this._xrSessionManager.session?this._init():this._xrSessionManager.onXRSessionInit.addOnce((()=>{this._init()}))}detach(){if(!super.detach())return!1;if(!this._options.doNotRemovePlanesOnSessionEnded)for(;this._detectedPlanes.length;){const e=this._detectedPlanes.pop();e&&this.onPlaneRemovedObservable.notifyObservers(e)}return!0}dispose(){super.dispose(),this.onPlaneAddedObservable.clear(),this.onPlaneRemovedObservable.clear(),this.onPlaneUpdatedObservable.clear()}isCompatible(){return"undefined"!=typeof XRPlane}_onXRFrame(e){var t;if(!this.attached||!this._enabled||!e)return;const i=e.detectedPlanes||(null===(t=e.worldInformation)||void 0===t?void 0:t.detectedPlanes);if(i){for(let e=0;e{if(this._lastFrameDetected.has(t)){if(t.lastChangedTime===this._xrSessionManager.currentTimestamp){const i=this._findIndexInPlaneArray(t),n=this._detectedPlanes[i];this._updatePlaneWithXRPlane(t,n,e),this.onPlaneUpdatedObservable.notifyObservers(n)}}else{const i={id:su++,xrPlane:t,polygonDefinition:[]},n=this._updatePlaneWithXRPlane(t,i,e);this._detectedPlanes.push(n),this.onPlaneAddedObservable.notifyObservers(n)}})),this._lastFrameDetected=i}}_init(){const e=()=>{this._enabled=!0,this._detectedPlanes.length&&(this._detectedPlanes.length=0)};this._xrSessionManager.isNative&&this._options.preferredDetectorOptions&&this._xrSessionManager.session.trySetPreferredPlaneDetectorOptions&&this._xrSessionManager.session.trySetPreferredPlaneDetectorOptions(this._options.preferredDetectorOptions),this._xrSessionManager.session.updateWorldTrackingState?(this._xrSessionManager.session.updateWorldTrackingState({planeDetectionState:{enabled:!0}}),e()):e()}_updatePlaneWithXRPlane(e,t,i){t.polygonDefinition=e.polygon.map((e=>{const t=this._xrSessionManager.scene.useRightHandedSystem?1:-1;return new o.P(e.x,e.y,e.z*t)}));const n=i.getPose(e.planeSpace,this._xrSessionManager.referenceSpace);if(n){const e=t.transformationMatrix||new o.y3;o.y3.FromArrayToRef(n.transform.matrix,0,e),this._xrSessionManager.scene.useRightHandedSystem||e.toggleModelMatrixHandInPlace(),t.transformationMatrix=e,this._options.worldParentNode&&e.multiplyToRef(this._options.worldParentNode.getWorldMatrix(),e)}return t}_findIndexInPlaneArray(e){for(let t=0;t()=>new ou(e,t)),ou.Version);class au extends Yo.F{constructor(e,t={}){super(e),this.options=t,this.onBackgroundStateChangedObservable=new s.y$}attach(){return this._setBackgroundState(!1),super.attach()}detach(){return this._setBackgroundState(!0),super.detach()}dispose(){super.dispose(),this.onBackgroundStateChangedObservable.clear()}_onXRFrame(e){}_setBackgroundState(e){const t=this._xrSessionManager.scene;if(!this.options.ignoreEnvironmentHelper)if(this.options.environmentHelperRemovalFlags){if(this.options.environmentHelperRemovalFlags.skyBox){const i=t.getMeshByName("BackgroundSkybox");i&&i.setEnabled(e)}if(this.options.environmentHelperRemovalFlags.ground){const i=t.getMeshByName("BackgroundPlane");i&&i.setEnabled(e)}}else{const i=t.getMeshByName("BackgroundHelper");i&&i.setEnabled(e)}this.options.backgroundMeshes&&this.options.backgroundMeshes.forEach((t=>t.setEnabled(e))),this.onBackgroundStateChangedObservable.notifyObservers(e)}}au.Name=Bo.b.BACKGROUND_REMOVER,au.Version=1,Bo.d.AddWebXRFeature(au.Name,((e,t)=>()=>new au(e,t)),au.Version,!0);class lu extends Yo.F{constructor(e,t){super(e),this._options=t,this._attachController=e=>{this._controllers[e.uniqueId]||(this._xrSessionManager.scene.isPhysicsEnabled()||u.Y.Warn("physics engine not enabled, skipped. Please add this controller manually."),this._options.physicsProperties.useControllerMesh&&e.inputSource.gamepad?e.onMotionControllerInitObservable.addOnce((t=>{t._doNotLoadControllerMesh?this._createPhysicsImpostor(e):t.onModelLoadedObservable.addOnce((()=>{const i=new tn.Q(t.rootMesh,tn.Q.MeshImpostor,{mass:0,...this._options.physicsProperties}),n=e.grip||e.pointer;this._controllers[e.uniqueId]={xrController:e,impostor:i,oldPos:n.position.clone(),oldRotation:n.rotationQuaternion.clone()}}))})):this._createPhysicsImpostor(e))},this._controllers={},this._debugMode=!1,this._delta=0,this._lastTimestamp=0,this._tmpQuaternion=new o._f,this._tmpVector=new o.P,this._options.physicsProperties||(this._options.physicsProperties={})}_createPhysicsImpostor(e){const t=this._options.physicsProperties.impostorType||tn.Q.SphereImpostor,i=this._options.physicsProperties.impostorSize||.1,n=en("impostor-mesh-"+e.uniqueId,{diameterX:"number"==typeof i?i:i.width,diameterY:"number"==typeof i?i:i.height,diameterZ:"number"==typeof i?i:i.depth});n.isVisible=this._debugMode,n.isPickable=!1,n.rotationQuaternion=new o._f;const r=e.grip||e.pointer;n.position.copyFrom(r.position),n.rotationQuaternion.copyFrom(r.rotationQuaternion);const s=new tn.Q(n,t,{mass:0,...this._options.physicsProperties});this._controllers[e.uniqueId]={xrController:e,impostor:s,impostorMesh:n}}_enablePhysicsDebug(){this._debugMode=!0,Object.keys(this._controllers).forEach((e=>{const t=this._controllers[e];t.impostorMesh&&(t.impostorMesh.isVisible=!0)}))}addController(e){this._attachController(e)}attach(){if(!super.attach())return!1;if(!this._options.xrInput)return!0;if(this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,(e=>{this._detachController(e.uniqueId)})),this._options.enableHeadsetImpostor){const e=this._options.headsetImpostorParams||{impostorType:tn.Q.SphereImpostor,restitution:.8,impostorSize:.3},t=e.impostorSize||.3;this._headsetMesh=en("headset-mesh",{diameterX:"number"==typeof t?t:t.width,diameterY:"number"==typeof t?t:t.height,diameterZ:"number"==typeof t?t:t.depth}),this._headsetMesh.rotationQuaternion=new o._f,this._headsetMesh.isVisible=!1,this._headsetImpostor=new tn.Q(this._headsetMesh,e.impostorType,{mass:0,...e})}return!0}detach(){return!!super.detach()&&(Object.keys(this._controllers).forEach((e=>{this._detachController(e)})),this._headsetMesh&&this._headsetMesh.dispose(),!0)}getHeadsetImpostor(){return this._headsetImpostor}getImpostorForController(e){const t="string"==typeof e?e:e.uniqueId;return this._controllers[t]?this._controllers[t].impostor:null}setPhysicsProperties(e){this._options.physicsProperties={...this._options.physicsProperties,...e}}_onXRFrame(e){var t,i;if(this._delta=this._xrSessionManager.currentTimestamp-this._lastTimestamp,this._lastTimestamp=this._xrSessionManager.currentTimestamp,this._headsetMesh&&this._headsetImpostor){if(this._headsetMesh.position.copyFrom(this._options.xrInput.xrCamera.globalPosition),this._headsetMesh.rotationQuaternion.copyFrom(this._options.xrInput.xrCamera.absoluteRotation),null===(t=this._options.xrInput.xrCamera._lastXRViewerPose)||void 0===t?void 0:t.linearVelocity){const e=this._options.xrInput.xrCamera._lastXRViewerPose.linearVelocity;this._tmpVector.set(e.x,e.y,e.z),this._headsetImpostor.setLinearVelocity(this._tmpVector)}if(null===(i=this._options.xrInput.xrCamera._lastXRViewerPose)||void 0===i?void 0:i.angularVelocity){const e=this._options.xrInput.xrCamera._lastXRViewerPose.angularVelocity;this._tmpVector.set(e.x,e.y,e.z),this._headsetImpostor.setAngularVelocity(this._tmpVector)}}Object.keys(this._controllers).forEach((e=>{var t,i;const n=this._controllers[e],r=n.xrController.grip||n.xrController.pointer,s=n.oldPos||n.impostorMesh.position;if(null===(t=n.xrController._lastXRPose)||void 0===t?void 0:t.linearVelocity){const e=n.xrController._lastXRPose.linearVelocity;this._tmpVector.set(e.x,e.y,e.z),n.impostor.setLinearVelocity(this._tmpVector)}else r.position.subtractToRef(s,this._tmpVector),this._tmpVector.scaleInPlace(1e3/this._delta),n.impostor.setLinearVelocity(this._tmpVector);s.copyFrom(r.position),this._debugMode&&console.log(this._tmpVector,"linear");const o=n.oldRotation||n.impostorMesh.rotationQuaternion;if(null===(i=n.xrController._lastXRPose)||void 0===i?void 0:i.angularVelocity){const e=n.xrController._lastXRPose.angularVelocity;this._tmpVector.set(e.x,e.y,e.z),n.impostor.setAngularVelocity(this._tmpVector)}else if(!o.equalsWithEpsilon(r.rotationQuaternion)){o.conjugateInPlace().multiplyToRef(r.rotationQuaternion,this._tmpQuaternion);const e=Math.sqrt(this._tmpQuaternion.x*this._tmpQuaternion.x+this._tmpQuaternion.y*this._tmpQuaternion.y+this._tmpQuaternion.z*this._tmpQuaternion.z);if(this._tmpVector.set(this._tmpQuaternion.x,this._tmpQuaternion.y,this._tmpQuaternion.z),e<.001)this._tmpVector.scaleInPlace(2);else{const t=2*Math.atan2(e,this._tmpQuaternion.w);this._tmpVector.scaleInPlace(t/(e*(this._delta/1e3)))}n.impostor.setAngularVelocity(this._tmpVector)}o.copyFrom(r.rotationQuaternion),this._debugMode&&console.log(this._tmpVector,this._tmpQuaternion,"angular")}))}_detachController(e){const t=this._controllers[e];t&&(t.impostorMesh&&t.impostorMesh.dispose(),delete this._controllers[e])}}lu.Name=Bo.b.PHYSICS_CONTROLLERS,lu.Version=1,Bo.d.AddWebXRFeature(lu.Name,((e,t)=>()=>new lu(e,t)),lu.Version,!0);class cu extends Yo.F{constructor(e,t={}){super(e),this.options=t,this._tmpMat=new o.y3,this._tmpPos=new o.P,this._tmpQuat=new o._f,this._initHitTestSource=e=>{if(!e)return;const t=new XRRay(this.options.offsetRay||{}),i={space:this.options.useReferenceSpace?e:this._xrSessionManager.viewerReferenceSpace,offsetRay:t};this.options.entityTypes&&(i.entityTypes=this.options.entityTypes),i.space?this._xrSessionManager.session.requestHitTestSource(i).then((e=>{this._xrHitTestSource&&this._xrHitTestSource.cancel(),this._xrHitTestSource=e})):V.w1.Warn("waiting for viewer reference space to initialize")},this.autoCloneTransformation=!1,this.onHitTestResultObservable=new s.y$,this.paused=!1,this.xrNativeFeatureName="hit-test",V.w1.Warn("Hit test is an experimental and unstable feature.")}attach(){if(!super.attach())return!1;if(!this._xrSessionManager.session.requestHitTestSource)return!1;if(this.options.disablePermanentHitTest||(this._xrSessionManager.referenceSpace&&this._initHitTestSource(this._xrSessionManager.referenceSpace),this._xrSessionManager.onXRReferenceSpaceChanged.add(this._initHitTestSource)),this.options.enableTransientHitTest){const e=new XRRay(this.options.transientOffsetRay||{});this._xrSessionManager.session.requestHitTestSourceForTransientInput({profile:this.options.transientHitTestProfile||"generic-touchscreen",offsetRay:e,entityTypes:this.options.entityTypes}).then((e=>{this._transientXrHitTestSource=e}))}return!0}detach(){return!!super.detach()&&(this._xrHitTestSource&&(this._xrHitTestSource.cancel(),this._xrHitTestSource=null),this._xrSessionManager.onXRReferenceSpaceChanged.removeCallback(this._initHitTestSource),this._transientXrHitTestSource&&(this._transientXrHitTestSource.cancel(),this._transientXrHitTestSource=null),!0)}dispose(){super.dispose(),this.onHitTestResultObservable.clear()}_onXRFrame(e){if(this.attached&&!this.paused){if(this._xrHitTestSource){const t=e.getHitTestResults(this._xrHitTestSource);this._processWebXRHitTestResult(t)}this._transientXrHitTestSource&&e.getHitTestResultsForTransientInput(this._transientXrHitTestSource).forEach((e=>{this._processWebXRHitTestResult(e.results,e.inputSource)}))}}_processWebXRHitTestResult(e,t){const i=[];e.forEach((e=>{const n=e.getPose(this._xrSessionManager.referenceSpace);if(!n)return;const r=n.transform.position,s=n.transform.orientation;this._tmpPos.set(r.x,r.y,r.z),this._tmpQuat.set(s.x,s.y,s.z,s.w),o.y3.FromFloat32ArrayToRefScaled(n.transform.matrix,0,1,this._tmpMat),this._xrSessionManager.scene.useRightHandedSystem||(this._tmpPos.z*=-1,this._tmpQuat.z*=-1,this._tmpQuat.w*=-1,this._tmpMat.toggleModelMatrixHandInPlace());const a={position:this.autoCloneTransformation?this._tmpPos.clone():this._tmpPos,rotationQuaternion:this.autoCloneTransformation?this._tmpQuat.clone():this._tmpQuat,transformationMatrix:this.autoCloneTransformation?this._tmpMat.clone():this._tmpMat,inputSource:t,isTransient:!!t,xrHitResult:e};i.push(a)})),this.onHitTestResultObservable.notifyObservers(i)}}cu.Name=Bo.b.HIT_TEST,cu.Version=2,Bo.d.AddWebXRFeature(cu.Name,((e,t)=>()=>new cu(e,t)),cu.Version,!1);class hu extends Yo.F{constructor(e){super(e),this._enabled=!1,this._featurePointCloud=[],this.onFeaturePointsAddedObservable=new s.y$,this.onFeaturePointsUpdatedObservable=new s.y$,this.xrNativeFeatureName="bjsfeature-points",this._xrSessionManager.session?this._init():this._xrSessionManager.onXRSessionInit.addOnce((()=>{this._init()}))}get featurePointCloud(){return this._featurePointCloud}detach(){return!!super.detach()&&(this.featurePointCloud.length=0,!0)}dispose(){super.dispose(),this._featurePointCloud.length=0,this.onFeaturePointsUpdatedObservable.clear(),this.onFeaturePointsAddedObservable.clear()}_onXRFrame(e){if(!this.attached||!this._enabled||!e)return;const t=e.featurePointCloud;if(t&&0!==t.length){if(t.length%5!=0)throw new Error("Received malformed feature point cloud of length: "+t.length);const e=t.length/5,i=new Array,n=new Array;for(let r=0;r0&&this.onFeaturePointsAddedObservable.notifyObservers(n),i.length>0&&this.onFeaturePointsUpdatedObservable.notifyObservers(i)}}_init(){this._xrSessionManager.session.trySetFeaturePointCloudEnabled&&this._xrSessionManager.session.trySetFeaturePointCloudEnabled(!0)&&(this._enabled=!0)}}hu.Name=Bo.b.FEATURE_POINTS,hu.Version=1,Bo.d.AddWebXRFeature(hu.Name,(e=>()=>new hu(e)),hu.Version),i("../../../node_modules/@babylonjs/core/XR/features/WebXRHandTracking.js");let _u=0;class du extends Yo.F{constructor(e,t={}){super(e),this._options=t,this._detectedMeshes=new Map,this.onMeshAddedObservable=new s.y$,this.onMeshRemovedObservable=new s.y$,this.onMeshUpdatedObservable=new s.y$,this.xrNativeFeatureName="mesh-detection",this._xrSessionManager.session?this._init():this._xrSessionManager.onXRSessionInit.addOnce((()=>{this._init()}))}detach(){return!!super.detach()&&(this._xrSessionManager.isNative&&this._xrSessionManager.session.trySetMeshDetectorEnabled&&this._xrSessionManager.session.trySetMeshDetectorEnabled(!1),this._options.doNotRemoveMeshesOnSessionEnded||(this._detectedMeshes.forEach((e=>{this.onMeshRemovedObservable.notifyObservers(e)})),this._detectedMeshes.clear()),!0)}dispose(){super.dispose(),this.onMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onMeshUpdatedObservable.clear()}_onXRFrame(e){var t;try{if(!this.attached||!e)return;const i=null===(t=e.worldInformation)||void 0===t?void 0:t.detectedMeshes;if(i){const t=new Set;this._detectedMeshes.forEach(((e,n)=>{i.has(n)||t.add(n)})),t.forEach((e=>{const t=this._detectedMeshes.get(e);t&&(this.onMeshRemovedObservable.notifyObservers(t),this._detectedMeshes.delete(e))})),i.forEach((t=>{if(this._detectedMeshes.has(t)){if(t.lastChangedTime===this._xrSessionManager.currentTimestamp){const i=this._detectedMeshes.get(t);i&&(this._updateVertexDataWithXRMesh(t,i,e),this.onMeshUpdatedObservable.notifyObservers(i))}}else{const i={id:_u++,xrMesh:t},n=this._updateVertexDataWithXRMesh(t,i,e);this._detectedMeshes.set(t,n),this.onMeshAddedObservable.notifyObservers(n)}}))}}catch(e){console.log(e.stack)}}_init(){this._xrSessionManager.isNative&&(this._xrSessionManager.session.trySetMeshDetectorEnabled&&this._xrSessionManager.session.trySetMeshDetectorEnabled(!0),this._options.preferredDetectorOptions&&this._xrSessionManager.session.trySetPreferredMeshDetectorOptions&&this._xrSessionManager.session.trySetPreferredMeshDetectorOptions(this._options.preferredDetectorOptions))}_updateVertexDataWithXRMesh(e,t,i){if(t.xrMesh=e,t.worldParentNode=this._options.worldParentNode,this._options.convertCoordinateSystems){if(this._xrSessionManager.scene.useRightHandedSystem)t.positions=e.positions,t.normals=e.normals;else{t.positions=new Float32Array(e.positions.length);for(let i=0;i()=>new du(e,t)),du.Version,!1),function(e){e[e.NotReceived=0]="NotReceived",e[e.Waiting=1]="Waiting",e[e.Received=2]="Received"}(uu||(uu={}));class pu extends Yo.F{constructor(e,t){super(e),this.options=t,this.onUntrackableImageFoundObservable=new s.y$,this.onTrackableImageFoundObservable=new s.y$,this.onTrackedImageUpdatedObservable=new s.y$,this._trackableScoreStatus=uu.NotReceived,this._trackedImages=[],this.xrNativeFeatureName="image-tracking"}attach(){return super.attach()}detach(){return super.detach()}getTrackedImageById(e){return this._trackedImages[e]||null}dispose(){super.dispose(),this._trackedImages.forEach((e=>{e.originalBitmap.close()})),this._trackedImages.length=0,this.onTrackableImageFoundObservable.clear(),this.onUntrackableImageFoundObservable.clear(),this.onTrackedImageUpdatedObservable.clear()}async getXRSessionInitExtension(){if(!this.options.images||!this.options.images.length)return{};const e=this.options.images.map((e=>"string"==typeof e.src?this._xrSessionManager.scene.getEngine()._createImageBitmapFromSource(e.src):Promise.resolve(e.src)));try{const t=await Promise.all(e);return this._originalTrackingRequest=t.map(((e,t)=>({image:e,widthInMeters:this.options.images[t].estimatedRealWorldWidth}))),{trackedImages:this._originalTrackingRequest}}catch(e){return V.w1.Error("Error loading images for tracking, WebXRImageTracking disabled for this session."),{}}}_onXRFrame(e){if(!e.getImageTrackingResults||this._trackableScoreStatus===uu.Waiting)return;if(this._trackableScoreStatus===uu.NotReceived)return void this._checkScoresAsync();const t=e.getImageTrackingResults();for(const i of t){let t=!1;const n=i.index,r=this._trackedImages[n];if(!r)continue;r.xrTrackingResult=i,r.realWorldWidth!==i.measuredWidthInMeters&&(r.realWorldWidth=i.measuredWidthInMeters,t=!0);const s=e.getPose(i.imageSpace,this._xrSessionManager.referenceSpace);if(s){const e=r.transformationMatrix;o.y3.FromArrayToRef(s.transform.matrix,0,e),this._xrSessionManager.scene.useRightHandedSystem||e.toggleModelMatrixHandInPlace(),t=!0}const a="emulated"===i.trackingState;r.emulated!==a&&(r.emulated=a,t=!0),t&&this.onTrackedImageUpdatedObservable.notifyObservers(r)}}async _checkScoresAsync(){if(!this._xrSessionManager.session.getTrackedImageScores||this._trackableScoreStatus!==uu.NotReceived)return;this._trackableScoreStatus=uu.Waiting;const e=await this._xrSessionManager.session.getTrackedImageScores();if(e&&0!==e.length){for(let t=0;t0?uu.Received:uu.NotReceived}else this._trackableScoreStatus=uu.NotReceived}}pu.Name=Bo.b.IMAGE_TRACKING,pu.Version=1,Bo.d.AddWebXRFeature(pu.Name,((e,t)=>()=>new pu(e,t)),pu.Version,!1);class fu extends Yo.F{constructor(e,t){super(e),this.options=t,this._domOverlayType=null,this._beforeXRSelectListener=null,this._element=null,this.xrNativeFeatureName="dom-overlay",V.w1.Warn("dom-overlay is an experimental and unstable feature.")}attach(){return!(!super.attach()||!this._xrSessionManager.session.domOverlayState||null===this._xrSessionManager.session.domOverlayState.type||(this._domOverlayType=this._xrSessionManager.session.domOverlayState.type,null!==this._element&&!0===this.options.supressXRSelectEvents&&(this._beforeXRSelectListener=e=>{e.preventDefault()},this._element.addEventListener("beforexrselect",this._beforeXRSelectListener)),0))}get domOverlayType(){return this._domOverlayType}dispose(){super.dispose(),null!==this._element&&this._beforeXRSelectListener&&this._element.removeEventListener("beforexrselect",this._beforeXRSelectListener)}_onXRFrame(e){}async getXRSessionInitExtension(){if(void 0===this.options.element)return V.w1.Warn('"element" option must be provided to attach xr-dom-overlay feature.'),{};if("string"==typeof this.options.element){const e=document.querySelector(this.options.element);if(null===e)return V.w1.Warn(`element not found '${this.options.element}' (not requesting xr-dom-overlay)`),{};this._element=e}else this._element=this.options.element;return{domOverlay:{root:this._element}}}}fu.Name=Bo.b.DOM_OVERLAY,fu.Version=1,Bo.d.AddWebXRFeature(fu.Name,((e,t)=>()=>new fu(e,t)),fu.Version,!1);class mu extends Yo.F{constructor(e,t){var i,n,r,s,a,l;super(e),this._controllers={},this._currentRegistrationConfigurations=[],this._movementDirection=null,this._tmpRotationMatrix=o.y3.Identity(),this._tmpTranslationDirection=new o.P,this._tmpMovementTranslation=new o.P,this._attachController=e=>{if(this._controllers[e.uniqueId])return;this._controllers[e.uniqueId]={xrController:e,registeredComponents:[]};const t=this._controllers[e.uniqueId];if("tracked-pointer"===t.xrController.inputSource.targetRayMode&&t.xrController.inputSource.gamepad){const i=()=>{if(e.motionController)for(const i of this._currentRegistrationConfigurations){let n=null;if(i.allowedComponentTypes)for(const t of i.allowedComponentTypes){const i=e.motionController.getComponentOfType(t);if(null!==i){n=i;break}}if(i.mainComponentOnly){const t=e.motionController.getMainComponent();if(null===t)continue;n=t}if("function"==typeof i.componentSelectionPredicate&&(n=i.componentSelectionPredicate(e)),n&&i.forceHandedness&&e.inputSource.handedness!==i.forceHandedness)continue;if(null===n)continue;const r={registrationConfiguration:i,component:n};t.registeredComponents.push(r),"axisChangedHandler"in i&&(r.onAxisChangedObserver=n.onAxisValueChangedObservable.add((e=>{i.axisChangedHandler(e,this._movementState,this._featureContext,this._xrInput)}))),"buttonChangedhandler"in i&&(r.onButtonChangedObserver=n.onButtonStateChangedObservable.add((()=>{n.changes.pressed&&i.buttonChangedhandler(n.changes.pressed,this._movementState,this._featureContext,this._xrInput)})))}};e.motionController?i():e.onMotionControllerInitObservable.addOnce((()=>{i()}))}},t&&void 0!==t.xrInput?(Array.isArray(t.customRegistrationConfigurations)?this._currentRegistrationConfigurations=t.customRegistrationConfigurations:this._currentRegistrationConfigurations=mu.REGISTRATIONS.default,this._featureContext={movementEnabled:t.movementEnabled||!0,movementOrientationFollowsViewerPose:null===(i=t.movementOrientationFollowsViewerPose)||void 0===i||i,movementSpeed:null!==(n=t.movementSpeed)&&void 0!==n?n:1,movementThreshold:null!==(r=t.movementThreshold)&&void 0!==r?r:.25,rotationEnabled:null===(s=t.rotationEnabled)||void 0===s||s,rotationSpeed:null!==(a=t.rotationSpeed)&&void 0!==a?a:1,rotationThreshold:null!==(l=t.rotationThreshold)&&void 0!==l?l:.25},this._movementState={moveX:0,moveY:0,rotateX:0,rotateY:0},this._xrInput=t.xrInput):V.w1.Error('WebXRControllerMovement feature requires "xrInput" option.')}get movementDirection(){return this._movementDirection}get movementEnabled(){return this._featureContext.movementEnabled}set movementEnabled(e){this._featureContext.movementEnabled=e}get movementOrientationFollowsViewerPose(){return this._featureContext.movementOrientationFollowsViewerPose}set movementOrientationFollowsViewerPose(e){this._featureContext.movementOrientationFollowsViewerPose=e}get movementSpeed(){return this._featureContext.movementSpeed}set movementSpeed(e){this._featureContext.movementSpeed=e}get movementThreshold(){return this._featureContext.movementThreshold}set movementThreshold(e){this._featureContext.movementThreshold=e}get rotationEnabled(){return this._featureContext.rotationEnabled}set rotationEnabled(e){this._featureContext.rotationEnabled=e}get rotationSpeed(){return this._featureContext.rotationSpeed}set rotationSpeed(e){this._featureContext.rotationSpeed=e}get rotationThreshold(){return this._featureContext.rotationThreshold}set rotationThreshold(e){this._featureContext.rotationThreshold=e}attach(){return!!super.attach()&&(this._xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._xrInput.onControllerRemovedObservable,(e=>{this._detachController(e.uniqueId)})),!0)}detach(){return!!super.detach()&&(Object.keys(this._controllers).forEach((e=>{this._detachController(e)})),this._controllers={},!0)}_onXRFrame(e){if(this.attach){if(null===this._movementDirection&&(this._movementDirection=this._xrInput.xrCamera.rotationQuaternion.clone()),0!==this._movementState.rotateX&&this._featureContext.rotationEnabled){const e=.001*this._xrSessionManager.scene.getEngine().getDeltaTime()*this._featureContext.rotationSpeed*this._movementState.rotateX*(this._xrSessionManager.scene.useRightHandedSystem?-1:1);!0===this._featureContext.movementOrientationFollowsViewerPose?(this._xrInput.xrCamera.cameraRotation.y+=e,this._movementDirection=this._xrInput.xrCamera.rotationQuaternion.multiply(o._f.RotationYawPitchRoll(e,0,0))):this._movementDirection.multiplyInPlace(o._f.RotationYawPitchRoll(3*e,0,0))}else!0===this._featureContext.movementOrientationFollowsViewerPose&&this._movementDirection.copyFrom(this._xrInput.xrCamera.rotationQuaternion);0===this._movementState.moveX&&0===this._movementState.moveY||!this._featureContext.movementEnabled||(o.y3.FromQuaternionToRef(this._movementDirection,this._tmpRotationMatrix),this._tmpTranslationDirection.set(this._movementState.moveX,0,this._movementState.moveY*(this._xrSessionManager.scene.useRightHandedSystem?1:-1)),o.P.TransformCoordinatesToRef(this._tmpTranslationDirection,this._tmpRotationMatrix,this._tmpMovementTranslation),this._tmpMovementTranslation.scaleInPlace(this._xrInput.xrCamera._computeLocalCameraSpeed()*this._featureContext.movementSpeed),this._xrInput.xrCamera.cameraDirection.addInPlace(this._tmpMovementTranslation))}}_detachController(e){const t=this._controllers[e];if(t){for(const e of t.registeredComponents)e.onAxisChangedObserver&&e.component.onAxisValueChangedObservable.remove(e.onAxisChangedObserver),e.onButtonChangedObserver&&e.component.onButtonStateChangedObservable.remove(e.onButtonChangedObserver);delete this._controllers[e]}}}mu.Name=Bo.b.MOVEMENT,mu.REGISTRATIONS={default:[{allowedComponentTypes:[Lo.THUMBSTICK_TYPE,Lo.TOUCHPAD_TYPE],forceHandedness:"left",axisChangedHandler:(e,t,i)=>{t.rotateX=Math.abs(e.x)>i.rotationThreshold?e.x:0,t.rotateY=Math.abs(e.y)>i.rotationThreshold?e.y:0}},{allowedComponentTypes:[Lo.THUMBSTICK_TYPE,Lo.TOUCHPAD_TYPE],forceHandedness:"right",axisChangedHandler:(e,t,i)=>{t.moveX=Math.abs(e.x)>i.movementThreshold?e.x:0,t.moveY=Math.abs(e.y)>i.movementThreshold?e.y:0}}]},mu.Version=1,Bo.d.AddWebXRFeature(mu.Name,((e,t)=>()=>new mu(e,t)),mu.Version,!0);var gu=i("../../../node_modules/@babylonjs/core/Lights/lightConstants.js");class bu extends Yo.F{constructor(e,t){super(e),this.options=t,this._canvasContext=null,this._reflectionCubeMap=null,this._xrLightEstimate=null,this._xrLightProbe=null,this._xrWebGLBinding=null,this._lightDirection=o.P.Up().negateInPlace(),this._lightColor=a.Wo.White(),this._intensity=1,this._sphericalHarmonics=new vo._,this._cubeMapPollTime=Date.now(),this._lightEstimationPollTime=Date.now(),this._reflectionCubeMapTextureSize=16,this.directionalLight=null,this.onReflectionCubeMapUpdatedObservable=new s.y$,this._updateReflectionCubeMap=()=>{var e;if(!this._xrLightProbe)return;if(this.options.cubeMapPollInterval){const e=Date.now();if(e-this._cubeMapPollTime{this._xrLightProbe=e,this.options.disableCubeMapReflection||(this._reflectionCubeMap||(this._reflectionCubeMap=new ro.V(this._xrSessionManager.scene),this._reflectionCubeMap._isCube=!0,this._reflectionCubeMap.coordinatesMode=3,this.options.setSceneEnvironmentTexture&&(this._xrSessionManager.scene.environmentTexture=this._reflectionCubeMap)),this._xrLightProbe.addEventListener("reflectionchange",this._updateReflectionCubeMap))})),!0}detach(){const e=super.detach();return null===this._xrLightProbe||this.options.disableCubeMapReflection||(this._xrLightProbe.removeEventListener("reflectionchange",this._updateReflectionCubeMap),this._xrLightProbe=null),this._canvasContext=null,this._xrLightEstimate=null,this._xrWebGLBinding=null,e}dispose(){super.dispose(),this.onReflectionCubeMapUpdatedObservable.clear(),this.directionalLight&&(this.directionalLight.dispose(),this.directionalLight=null),null!==this._reflectionCubeMap&&(this._reflectionCubeMap._texture&&this._reflectionCubeMap._texture.dispose(),this._reflectionCubeMap.dispose(),this._reflectionCubeMap=null)}_onXRFrame(e){var t;if(null!==this._xrLightProbe){if(this.options.lightEstimationPollInterval){const e=Date.now();if(e-this._lightEstimationPollTime()=>new bu(e,t)),bu.Version,!1);class yu extends Yo.F{constructor(e){super(e),this.onEyeTrackingStartedObservable=new s.y$,this.onEyeTrackingEndedObservable=new s.y$,this.onEyeTrackingFrameUpdateObservable=new s.y$,this._eyeTrackingStartListener=e=>{this._latestEyeSpace=e.gazeSpace,this._gazeRay=new tt.z(o.P.Zero(),o.P.Forward()),this.onEyeTrackingStartedObservable.notifyObservers(this._gazeRay)},this._eyeTrackingEndListener=()=>{this._latestEyeSpace=null,this._gazeRay=null,this.onEyeTrackingEndedObservable.notifyObservers()},this.xrNativeFeatureName="eye-tracking",this._xrSessionManager.session?this._init():this._xrSessionManager.onXRSessionInit.addOnce((()=>{this._init()}))}dispose(){super.dispose(),this._xrSessionManager.session.removeEventListener("eyetrackingstart",this._eyeTrackingStartListener),this._xrSessionManager.session.removeEventListener("eyetrackingend",this._eyeTrackingEndListener),this.onEyeTrackingStartedObservable.clear(),this.onEyeTrackingEndedObservable.clear(),this.onEyeTrackingFrameUpdateObservable.clear()}get isEyeGazeValid(){return!!this._gazeRay}getEyeGaze(){return this._gazeRay}_onXRFrame(e){if(this.attached&&e&&this._latestEyeSpace&&this._gazeRay){const t=e.getPose(this._latestEyeSpace,this._xrSessionManager.referenceSpace);if(t){this._gazeRay.origin.set(t.transform.position.x,t.transform.position.y,t.transform.position.z);const e=t.transform.orientation;o.jp.Quaternion[0].set(e.x,e.y,e.z,e.w),this._xrSessionManager.scene.useRightHandedSystem?o.P.RightHandedForwardReadOnly.rotateByQuaternionToRef(o.jp.Quaternion[0],this._gazeRay.direction):(this._gazeRay.origin.z*=-1,o.jp.Quaternion[0].z*=-1,o.jp.Quaternion[0].w*=-1,o.P.LeftHandedForwardReadOnly.rotateByQuaternionToRef(o.jp.Quaternion[0],this._gazeRay.direction)),this.onEyeTrackingFrameUpdateObservable.notifyObservers(this._gazeRay)}}}_init(){this._xrSessionManager.isNative&&(this._xrSessionManager.session.addEventListener("eyetrackingstart",this._eyeTrackingStartListener),this._xrSessionManager.session.addEventListener("eyetrackingend",this._eyeTrackingEndListener))}}yu.Name=Bo.b.EYE_TRACKING,yu.Version=1,Bo.d.AddWebXRFeature(yu.Name,(e=>()=>new yu(e)),yu.Version,!1);class vu{constructor(e,t){this._samples=[],this._idx=0;for(let i=0;i=this._samples.length)throw new Error("Index out of bounds");return this._samples[(this._idx+e)%this._samples.length]}}class Au{constructor(){this._samples=new vu(20),this._entropy=0,this.onFirstStepDetected=new s.y$}update(e,t,i,n){this._samples.push(e,t);const r=this._samples.at(0);if(this._entropy*=this._entropyDecayFactor,this._entropy+=o.FM.Distance(r,this._samples.at(1)),this._entropy>this._entropyThreshold)return;let s;for(s=this._samePointCheckStartIdx;sa&&(l=t,a=e);if(as*this._squaredProjectionDistanceThreshold)return;const f=o.jp.Vector3[0];f.set(i,n,0);const m=o.jp.Vector3[1];m.set(h.x,h.y,0);const g=o.P.Cross(f,m).z>0,b=r.clone(),y=r.clone();c.subtractToRef(r,h),g?(h.scaleAndAddToRef(this._axisToApexShrinkFactor,b),h.scaleAndAddToRef(this._axisToApexExtendFactor,y)):(h.scaleAndAddToRef(this._axisToApexExtendFactor,b),h.scaleAndAddToRef(this._axisToApexShrinkFactor,y)),this.onFirstStepDetected.notifyObservers({leftApex:b,rightApex:y,currentPosition:r,currentStepDirection:g?"right":"left"})}reset(){for(let e=0;ethis._maxT&&(this._maxT=this._t,this._maxTPosition.copyFromFloats(e,t)),!(this._vitalityi&&(this.onMovement.notifyObservers({deltaT:this._t-i}),i<.5&&this._t>=.5&&this.onFootfall.notifyObservers({foot:this._steppingLeft?"left":"right"})),this._t<.95*this._maxT&&(this._currentPosition.copyFromFloats(e,t),this._steppingLeft?this._leftApex.copyFrom(this._maxTPosition):this._rightApex.copyFrom(this._maxTPosition),this._reset(this._leftApex,this._rightApex,this._currentPosition,!this._steppingLeft)),this._axisLength<.03))}get _vitalityThreshold(){return.1}get forward(){return this._forward}}class Su{constructor(e){this._detector=new Au,this._walker=null,this._movement=new o.FM,this._millisecondsSinceLastUpdate=Su._MillisecondsPerUpdate,this.movementThisFrame=o.P.Zero(),this._engine=e,this._detector.onFirstStepDetected.add((e=>{this._walker||(this._walker=new Cu(e.leftApex,e.rightApex,e.currentPosition,e.currentStepDirection),this._walker.onFootfall.add((()=>{console.log("Footfall!")})),this._walker.onMovement.add((e=>{this._walker.forward.scaleAndAddToRef(.024*e.deltaT,this._movement)})))}))}static get _MillisecondsPerUpdate(){return 1e3/15}update(e,t){t.y=0,t.normalize(),this._millisecondsSinceLastUpdate+=this._engine.getDeltaTime(),this._millisecondsSinceLastUpdate>=Su._MillisecondsPerUpdate&&(this._millisecondsSinceLastUpdate-=Su._MillisecondsPerUpdate,this._detector.update(e.x,e.z,t.x,t.z),this._walker&&(this._walker.update(e.x,e.z)||(this._walker=null)),this._movement.scaleInPlace(.85)),this.movementThisFrame.set(this._movement.x,0,this._movement.y)}}class xu extends Yo.F{constructor(e,t){super(e),this._up=new o.P,this._forward=new o.P,this._position=new o.P,this._movement=new o.P,this._sessionManager=e,this.locomotionTarget=t.locomotionTarget,this._isLocomotionTargetWebXRCamera&&u.Y.Warn("Using walking locomotion directly on a WebXRCamera may have unintended interactions with other XR techniques. Using an XR space parent is highly recommended")}static get Name(){return Bo.b.WALKING_LOCOMOTION}static get Version(){return 1}get locomotionTarget(){return this._locomotionTarget}set locomotionTarget(e){this._locomotionTarget=e,this._isLocomotionTargetWebXRCamera="WebXRCamera"===this._locomotionTarget.getClassName()}isCompatible(){return void 0===this._sessionManager.sessionMode||"immersive-vr"===this._sessionManager.sessionMode}attach(){return!(!this.isCompatible||!super.attach()||(this._walker=new Su(this._sessionManager.scene.getEngine()),0))}detach(){return!!super.detach()&&(this._walker=null,!0)}_onXRFrame(e){const t=e.getViewerPose(this._sessionManager.baseReferenceSpace);if(!t)return;const i=this.locomotionTarget.getScene().useRightHandedSystem?1:-1,n=t.transform.matrix;this._up.copyFromFloats(n[4],n[5],i*n[6]),this._forward.copyFromFloats(n[8],n[9],i*n[10]),this._position.copyFromFloats(n[12],n[13],i*n[14]),this._forward.scaleAndAddToRef(.05,this._position),this._up.scaleAndAddToRef(-.05,this._position),this._walker.update(this._position,this._forward),this._movement.copyFrom(this._walker.movementThisFrame),this._isLocomotionTargetWebXRCamera||o.P.TransformNormalToRef(this._movement,this.locomotionTarget.getWorldMatrix(),this._movement),this.locomotionTarget.position.addInPlace(this._movement)}}Bo.d.AddWebXRFeature(xu.Name,((e,t)=>()=>new xu(e,t)),xu.Version,!1);class Tu extends Kt{constructor(e,t,i,n,r,s){super(e,t,i,n,s),this.getWidth=e,this.getHeight=t,this.layer=i,this.layerType=n,this.isMultiview=r,this.createRTTProvider=s}}class Eu extends ei{constructor(e,t,i){super(e.scene,i),this._xrSessionManager=e,this._xrWebGLBinding=t,this.layerWrapper=i,this._lastSubImages=new Map,this._compositionLayer=i.layer}_getRenderTargetForSubImage(e,t){const i=this._lastSubImages.get(t),n="left"==t?0:1;return this._renderTargetTextures[n]&&(null==i?void 0:i.textureWidth)===e.textureWidth&&(null==i?void 0:i.textureHeight)==e.textureHeight||(this._renderTargetTextures[n]=this._createRenderTargetTexture(e.textureWidth,e.textureHeight,null,e.colorTexture,e.depthStencilTexture,this.layerWrapper.isMultiview),this._framebufferDimensions={framebufferWidth:e.textureWidth,framebufferHeight:e.textureHeight}),this._lastSubImages.set(t,e),this._renderTargetTextures[n]}_getSubImageForEye(e){const t=this._xrSessionManager.currentFrame;return t?this._xrWebGLBinding.getSubImage(this._compositionLayer,t,e):null}getRenderTargetTextureForEye(e){const t=this._getSubImageForEye(e);return t?this._getRenderTargetForSubImage(t,e):null}getRenderTargetTextureForView(e){return this.getRenderTargetTextureForEye(e.eye)}_setViewportForSubImage(e,t){const i=t.textureWidth,n=t.textureHeight,r=t.viewport;e.x=r.x/i,e.y=r.y/n,e.width=r.width/i,e.height=r.height/n}trySetViewportForView(e,t){const i=this._lastSubImages.get(t.eye)||this._getSubImageForEye(t.eye);return!!i&&(this._setViewportForSubImage(e,i),!0)}}class Ru extends Tu{constructor(e,t,i){super((()=>e.textureWidth),(()=>e.textureHeight),e,"XRProjectionLayer",t,(e=>new Pu(e,i,this))),this.layer=e}}class Pu extends Eu{constructor(e,t,i){super(e,t,i),this.layerWrapper=i,this._projectionLayer=i.layer}_getSubImageForView(e){return this._xrWebGLBinding.getViewSubImage(this._projectionLayer,e)}getRenderTargetTextureForView(e){return this._getRenderTargetForSubImage(this._getSubImageForView(e),e.eye)}getRenderTargetTextureForEye(e){const t=this._lastSubImages.get(e);return t?this._getRenderTargetForSubImage(t,e):null}trySetViewportForView(e,t){const i=this._lastSubImages.get(t.eye)||this._getSubImageForView(t);return!!i&&(this._setViewportForSubImage(e,i),!0)}}const Iu={},Mu={textureType:"texture",colorFormat:6408,depthFormat:35056,scaleFactor:1};class Du extends Yo.F{constructor(e,t={}){super(e),this._options=t,this._existingLayers=[],this.xrNativeFeatureName="layers"}attach(){if(!super.attach())return!1;const e=this._xrSessionManager.scene.getEngine();this._glContext=e._gl,this._xrWebGLBinding=new XRWebGLBinding(this._xrSessionManager.session,this._glContext),this._existingLayers.length=0;const t={...Mu},i=this._options.preferMultiviewOnInit&&e.getCaps().multiview;return i&&(t.textureType="texture-array"),this.addXRSessionLayer(this.createProjectionLayer(t,i)),!0}detach(){return!!super.detach()&&(this._existingLayers.length=0,!0)}createXRWebGLLayer(e=Iu){const t=new XRWebGLLayer(this._xrSessionManager.session,this._glContext,e);return new ti(t)}createProjectionLayer(e=Mu,t=!1){if(t&&"texture-array"!==e.textureType)throw new Error("Projection layers can only be made multiview if they use texture arrays. Set the textureType parameter to 'texture-array'.");if(!t&&"texture-array"===e.textureType)throw new Error("We currently only support multiview rendering when the textureType parameter is set to 'texture-array'.");const i=this._xrWebGLBinding.createProjectionLayer(e);return new Ru(i,t,this._xrWebGLBinding)}addXRSessionLayer(e){this.setXRSessionLayers([...this._existingLayers,e])}setXRSessionLayers(e){this._existingLayers=e;const t={...this._xrSessionManager.session.renderState};t.baseLayer=void 0,t.layers=e.map((e=>e.layer)),this._xrSessionManager.updateRenderState(t),this._xrSessionManager._setBaseLayerWrapper(e.length>0?e[0]:null)}isCompatible(){return!this._xrSessionManager.isNative&&"undefined"!=typeof XRWebGLBinding&&!!XRWebGLBinding.prototype.createProjectionLayer}dispose(){super.dispose()}_onXRFrame(e){}}Du.Name=Bo.b.LAYERS,Du.Version=1,Bo.d.AddWebXRFeature(Du.Name,((e,t)=>()=>new Du(e,t)),Du.Version,!1);class Ou extends ko{constructor(e,t,i){super(e,wu[i],t,i,!0),this.profileId="generic-hand-select-grasp"}_getFilenameAndPath(){return{filename:"generic.babylon",path:"https://controllers.babylonjs.com/generic/"}}_getModelLoadingConstraints(){return!0}_processLoadedModel(e){}_setRootMesh(e){}_updateModel(){}}Wo.RegisterController("generic-hand-select-grasp",((e,t)=>new Ou(t,e.gamepad,e.handedness)));const wu={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr-standard-trigger",visualResponses:{}},grasp:{type:"trigger",gamepadIndices:{button:4},rootNodeName:"grasp",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-hand-select-grasp-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr-standard-trigger",visualResponses:{}},grasp:{type:"trigger",gamepadIndices:{button:4},rootNodeName:"grasp",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-hand-select-grasp-right",assetPath:"right.glb"},none:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr-standard-trigger",visualResponses:{}},grasp:{type:"trigger",gamepadIndices:{button:4},rootNodeName:"grasp",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-hand-select-grasp-none",assetPath:"none.glb"}};class Fu extends ko{constructor(e,t,i){super(e,Bu["left-right"],t,i),this._mapping={defaultButton:{valueNodeName:"VALUE",unpressedNodeName:"UNPRESSED",pressedNodeName:"PRESSED"},defaultAxis:{valueNodeName:"VALUE",minNodeName:"MIN",maxNodeName:"MAX"},buttons:{"xr-standard-trigger":{rootNodeName:"SELECT",componentProperty:"button",states:["default","touched","pressed"]},"xr-standard-squeeze":{rootNodeName:"GRASP",componentProperty:"state",states:["pressed"]},"xr-standard-touchpad":{rootNodeName:"TOUCHPAD_PRESS",labelAnchorNodeName:"squeeze-label",touchPointNodeName:"TOUCH"},"xr-standard-thumbstick":{rootNodeName:"THUMBSTICK_PRESS",componentProperty:"state",states:["pressed"]}},axes:{"xr-standard-touchpad":{"x-axis":{rootNodeName:"TOUCHPAD_TOUCH_X"},"y-axis":{rootNodeName:"TOUCHPAD_TOUCH_Y"}},"xr-standard-thumbstick":{"x-axis":{rootNodeName:"THUMBSTICK_X"},"y-axis":{rootNodeName:"THUMBSTICK_Y"}}}},this.profileId="microsoft-mixed-reality"}_getFilenameAndPath(){let e="";return e="left"===this.handedness?Fu.MODEL_LEFT_FILENAME:Fu.MODEL_RIGHT_FILENAME,{filename:e,path:Fu.MODEL_BASE_URL+"default/"}}_getModelLoadingConstraints(){const e=Vs.n.IsPluginForExtensionAvailable(".glb");return e||u.Y.Warn("glTF / glb loaded was not registered, using generic controller instead"),e}_processLoadedModel(e){this.rootMesh&&(this.getComponentIds().forEach(((e,t)=>{if(!this.disableAnimation&&e&&this.rootMesh){const i=this._mapping.buttons[e],n=i.rootNodeName;if(!n)return void u.Y.Log("Skipping unknown button at index: "+t+" with mapped name: "+e);const r=this._getChildByName(this.rootMesh,n);if(!r)return void u.Y.Warn("Missing button mesh with name: "+n);if(i.valueMesh=this._getImmediateChildByName(r,this._mapping.defaultButton.valueNodeName),i.pressedMesh=this._getImmediateChildByName(r,this._mapping.defaultButton.pressedNodeName),i.unpressedMesh=this._getImmediateChildByName(r,this._mapping.defaultButton.unpressedNodeName),i.valueMesh&&i.pressedMesh&&i.unpressedMesh){const t=this.getComponent(e);t&&t.onButtonStateChangedObservable.add((e=>{this._lerpTransform(i,e.value)}),void 0,!0)}else u.Y.Warn("Missing button submesh under mesh with name: "+n)}})),this.getComponentIds().forEach((e=>{const t=this.getComponent(e);t.isAxes()&&["x-axis","y-axis"].forEach((i=>{if(!this.rootMesh)return;const n=this._mapping.axes[e][i],r=this._getChildByName(this.rootMesh,n.rootNodeName);r?(n.valueMesh=this._getImmediateChildByName(r,this._mapping.defaultAxis.valueNodeName),n.minMesh=this._getImmediateChildByName(r,this._mapping.defaultAxis.minNodeName),n.maxMesh=this._getImmediateChildByName(r,this._mapping.defaultAxis.maxNodeName),n.valueMesh&&n.minMesh&&n.maxMesh?t&&t.onAxisValueChangedObservable.add((e=>{const t="x-axis"===i?e.x:e.y;this._lerpTransform(n,t,!0)}),void 0,!0):u.Y.Warn("Missing axis submesh under mesh with name: "+n.rootNodeName)):u.Y.Warn("Missing axis mesh with name: "+n.rootNodeName)}))})))}_setRootMesh(e){let t;this.rootMesh=new je.Kj(this.profileId+" "+this.handedness,this.scene),this.rootMesh.isPickable=!1;for(let i=0;inew Fu(t,e.gamepad,e.handedness)));const Bu={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{xr_standard_trigger_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_trigger_pressed_value",minNodeName:"xr_standard_trigger_pressed_min",maxNodeName:"xr_standard_trigger_pressed_max"}}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{xr_standard_squeeze_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_squeeze_pressed_value",minNodeName:"xr_standard_squeeze_pressed_min",maxNodeName:"xr_standard_squeeze_pressed_max"}}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{xr_standard_touchpad_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_pressed_value",minNodeName:"xr_standard_touchpad_pressed_min",maxNodeName:"xr_standard_touchpad_pressed_max"},xr_standard_touchpad_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_pressed_value",minNodeName:"xr_standard_touchpad_xaxis_pressed_min",maxNodeName:"xr_standard_touchpad_xaxis_pressed_max"},xr_standard_touchpad_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_pressed_value",minNodeName:"xr_standard_touchpad_yaxis_pressed_min",maxNodeName:"xr_standard_touchpad_yaxis_pressed_max"},xr_standard_touchpad_xaxis_touched:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_touched_value",minNodeName:"xr_standard_touchpad_xaxis_touched_min",maxNodeName:"xr_standard_touchpad_xaxis_touched_max"},xr_standard_touchpad_yaxis_touched:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_touched_value",minNodeName:"xr_standard_touchpad_yaxis_touched_min",maxNodeName:"xr_standard_touchpad_yaxis_touched_max"},xr_standard_touchpad_axes_touched:{componentProperty:"state",states:["touched","pressed"],valueNodeProperty:"visibility",valueNodeName:"xr_standard_touchpad_axes_touched_value"}},touchPointNodeName:"xr_standard_touchpad_axes_touched_value"},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{xr_standard_thumbstick_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_pressed_value",minNodeName:"xr_standard_thumbstick_pressed_min",maxNodeName:"xr_standard_thumbstick_pressed_max"},xr_standard_thumbstick_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_xaxis_pressed_value",minNodeName:"xr_standard_thumbstick_xaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_xaxis_pressed_max"},xr_standard_thumbstick_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_yaxis_pressed_value",minNodeName:"xr_standard_thumbstick_yaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_yaxis_pressed_max"}}}},gamepadMapping:"xr-standard",rootNodeName:"microsoft-mixed-reality-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{xr_standard_trigger_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_trigger_pressed_value",minNodeName:"xr_standard_trigger_pressed_min",maxNodeName:"xr_standard_trigger_pressed_max"}}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{xr_standard_squeeze_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_squeeze_pressed_value",minNodeName:"xr_standard_squeeze_pressed_min",maxNodeName:"xr_standard_squeeze_pressed_max"}}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{xr_standard_touchpad_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_pressed_value",minNodeName:"xr_standard_touchpad_pressed_min",maxNodeName:"xr_standard_touchpad_pressed_max"},xr_standard_touchpad_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_pressed_value",minNodeName:"xr_standard_touchpad_xaxis_pressed_min",maxNodeName:"xr_standard_touchpad_xaxis_pressed_max"},xr_standard_touchpad_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_pressed_value",minNodeName:"xr_standard_touchpad_yaxis_pressed_min",maxNodeName:"xr_standard_touchpad_yaxis_pressed_max"},xr_standard_touchpad_xaxis_touched:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_touched_value",minNodeName:"xr_standard_touchpad_xaxis_touched_min",maxNodeName:"xr_standard_touchpad_xaxis_touched_max"},xr_standard_touchpad_yaxis_touched:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_touched_value",minNodeName:"xr_standard_touchpad_yaxis_touched_min",maxNodeName:"xr_standard_touchpad_yaxis_touched_max"},xr_standard_touchpad_axes_touched:{componentProperty:"state",states:["touched","pressed"],valueNodeProperty:"visibility",valueNodeName:"xr_standard_touchpad_axes_touched_value"}},touchPointNodeName:"xr_standard_touchpad_axes_touched_value"},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{xr_standard_thumbstick_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_pressed_value",minNodeName:"xr_standard_thumbstick_pressed_min",maxNodeName:"xr_standard_thumbstick_pressed_max"},xr_standard_thumbstick_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_xaxis_pressed_value",minNodeName:"xr_standard_thumbstick_xaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_xaxis_pressed_max"},xr_standard_thumbstick_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_yaxis_pressed_value",minNodeName:"xr_standard_thumbstick_yaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_yaxis_pressed_max"}}}},gamepadMapping:"xr-standard",rootNodeName:"microsoft-mixed-reality-right",assetPath:"right.glb"}};class Nu extends ko{constructor(e,t,i,n=!1,r=!1){super(e,Lu[i],t,i),this._forceLegacyControllers=r,this.profileId="oculus-touch"}_getFilenameAndPath(){let e="";return e="left"===this.handedness?Nu.MODEL_LEFT_FILENAME:Nu.MODEL_RIGHT_FILENAME,{filename:e,path:this._isQuest()?Nu.QUEST_MODEL_BASE_URL:Nu.MODEL_BASE_URL}}_getModelLoadingConstraints(){return!0}_processLoadedModel(e){const t=this._isQuest(),i="right"===this.handedness?-1:1;this.getComponentIds().forEach((e=>{const n=e&&this.getComponent(e);n&&n.onButtonStateChangedObservable.add((n=>{if(this.rootMesh&&!this.disableAnimation)switch(e){case"xr-standard-trigger":return void(t||(this._modelRootNode.getChildren()[3].rotation.x=.2*-n.value,this._modelRootNode.getChildren()[3].position.y=.005*-n.value,this._modelRootNode.getChildren()[3].position.z=.005*-n.value));case"xr-standard-squeeze":return void(t||(this._modelRootNode.getChildren()[4].position.x=i*n.value*.0035));case"xr-standard-thumbstick":return;case"a-button":case"x-button":return void(t||(n.pressed?this._modelRootNode.getChildren()[1].position.y=-.001:this._modelRootNode.getChildren()[1].position.y=0));case"b-button":case"y-button":return void(t||(n.pressed?this._modelRootNode.getChildren()[2].position.y=-.001:this._modelRootNode.getChildren()[2].position.y=0))}}),void 0,!0)}))}_setRootMesh(e){this.rootMesh=new je.Kj(this.profileId+" "+this.handedness,this.scene),this.scene.useRightHandedSystem||(this.rootMesh.rotationQuaternion=o._f.FromEulerAngles(0,Math.PI,0)),e.forEach((e=>{e.isPickable=!1})),this._isQuest()?this._modelRootNode=e[0]:(this._modelRootNode=e[1],this.rootMesh.position.y=.034,this.rootMesh.position.z=.052),this._modelRootNode.parent=this.rootMesh}_updateModel(){}_isQuest(){return!!navigator.userAgent.match(/Quest/gi)&&!this._forceLegacyControllers}}Nu.MODEL_BASE_URL="https://controllers.babylonjs.com/oculus/",Nu.MODEL_LEFT_FILENAME="left.babylon",Nu.MODEL_RIGHT_FILENAME="right.babylon",Nu.QUEST_MODEL_BASE_URL="https://controllers.babylonjs.com/oculusQuest/",Wo.RegisterController("oculus-touch",((e,t)=>new Nu(t,e.gamepad,e.handedness))),Wo.RegisterController("oculus-touch-legacy",((e,t)=>new Nu(t,e.gamepad,e.handedness,!0)));const Lu={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{}},"x-button":{type:"button",gamepadIndices:{button:4},rootNodeName:"x_button",visualResponses:{}},"y-button":{type:"button",gamepadIndices:{button:5},rootNodeName:"y_button",visualResponses:{}},thumbrest:{type:"button",gamepadIndices:{button:6},rootNodeName:"thumbrest",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"oculus-touch-v2-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{}},"a-button":{type:"button",gamepadIndices:{button:4},rootNodeName:"a_button",visualResponses:{}},"b-button":{type:"button",gamepadIndices:{button:5},rootNodeName:"b_button",visualResponses:{}},thumbrest:{type:"button",gamepadIndices:{button:6},rootNodeName:"thumbrest",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"oculus-touch-v2-right",assetPath:"right.glb"}};class ku extends ko{constructor(e,t,i){super(e,Vu[i],t,i),this.profileId="htc-vive"}_getFilenameAndPath(){return{filename:ku.MODEL_FILENAME,path:ku.MODEL_BASE_URL}}_getModelLoadingConstraints(){return!0}_processLoadedModel(e){this.getComponentIds().forEach((e=>{const t=e&&this.getComponent(e);t&&t.onButtonStateChangedObservable.add((t=>{if(this.rootMesh&&!this.disableAnimation)switch(e){case"xr-standard-trigger":return void(this._modelRootNode.getChildren()[6].rotation.x=.15*-t.value);case"xr-standard-touchpad":case"xr-standard-squeeze":return}}),void 0,!0)}))}_setRootMesh(e){this.rootMesh=new je.Kj(this.profileId+" "+this.handedness,this.scene),e.forEach((e=>{e.isPickable=!1})),this._modelRootNode=e[1],this._modelRootNode.parent=this.rootMesh,this.scene.useRightHandedSystem||(this.rootMesh.rotationQuaternion=o._f.FromEulerAngles(0,Math.PI,0))}_updateModel(){}}ku.MODEL_BASE_URL="https://controllers.babylonjs.com/vive/",ku.MODEL_FILENAME="wand.babylon",Wo.RegisterController("htc-vive",((e,t)=>new ku(t,e.gamepad,e.handedness)));const Vu={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{}},menu:{type:"button",gamepadIndices:{button:4},rootNodeName:"menu",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"htc_vive_none",assetPath:"none.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{}},menu:{type:"button",gamepadIndices:{button:4},rootNodeName:"menu",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"htc_vive_none",assetPath:"none.glb"},none:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{}},menu:{type:"button",gamepadIndices:{button:4},rootNodeName:"menu",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"htc-vive-none",assetPath:"none.glb"}};!async function(e,t){(await new Promise((e=>{"undefined"==typeof _native?zn.addOnce((t=>e(t))):e(_native)}))).NativeXRFrame=class{constructor(e){this._nativeImpl=e,this._xrTransform=new XRRigidTransform,this._xrPose={transform:this._xrTransform,emulatedPosition:!1},this._xrPoseVectorData=new Float32Array(8),this.fillPoses=this._nativeImpl.fillPoses.bind(this._nativeImpl),this.getViewerPose=this._nativeImpl.getViewerPose.bind(this._nativeImpl),this.getHitTestResults=this._nativeImpl.getHitTestResults.bind(this._nativeImpl),this.getHitTestResultsForTransientInput=()=>{throw new Error("XRFrame.getHitTestResultsForTransientInput not supported on native.")},this.createAnchor=this._nativeImpl.createAnchor.bind(this._nativeImpl),this.getJointPose=this._nativeImpl.getJointPose.bind(this._nativeImpl),this.fillJointRadii=this._nativeImpl.fillJointRadii.bind(this._nativeImpl),this.getLightEstimate=()=>{throw new Error("XRFrame.getLightEstimate not supported on native.")},this.getImageTrackingResults=()=>{var e;return null!==(e=this._nativeImpl._imageTrackingResults)&&void 0!==e?e:[]}}get session(){return this._nativeImpl.session}getPose(e,t){if(!this._nativeImpl.getPoseData(e,t,this._xrPoseVectorData.buffer,this._xrTransform.matrix.buffer))return;const i=this._xrTransform.position;i.x=this._xrPoseVectorData[0],i.y=this._xrPoseVectorData[1],i.z=this._xrPoseVectorData[2],i.w=this._xrPoseVectorData[3];const n=this._xrTransform.orientation;return n.x=this._xrPoseVectorData[4],n.y=this._xrPoseVectorData[5],n.z=this._xrPoseVectorData[6],n.w=this._xrPoseVectorData[7],this._xrPose}get trackedAnchors(){return this._nativeImpl.trackedAnchors}get worldInformation(){return this._nativeImpl.worldInformation}get detectedPlanes(){return this._nativeImpl.detectedPlanes}get featurePointCloud(){return this._nativeImpl.featurePointCloud}}}()},"../../../node_modules/@babylonjs/core/node.js":function(e,t,i){"use strict";i.d(t,{N:function(){return h}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),o=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),a=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),l=i("../../../node_modules/@babylonjs/core/Misc/devTools.js");class c{constructor(){this._doNotSerialize=!1,this._isDisposed=!1,this._sceneRootNodesIndex=-1,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._onEnabledStateChangedObservable=new o.y$,this._onClonedObservable=new o.y$}}class h{constructor(e,t=null){this._isDirty=!1,this._nodeDataStorage=new c,this.state="",this.metadata=null,this.reservedDataStore=null,this._parentContainer=null,this.animations=new Array,this._ranges={},this.onReady=null,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._waitingParentInstanceIndex=null,this._waitingParsedUniqueId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=r.y3.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new o.y$,this._onDisposeObserver=null,this._behaviors=new Array,this.name=e,this.id=e,this._scene=t||a.l.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache()}static AddNodeConstructor(e,t){this._NodeConstructors[e]=t}static Construct(e,t,i,n){const r=this._NodeConstructors[e];return r?r(t,i,n):null}get doNotSerialize(){return!!this._nodeDataStorage._doNotSerialize||!!this._parentNode&&this._parentNode.doNotSerialize}set doNotSerialize(e){this._nodeDataStorage._doNotSerialize=e}isDisposed(){return this._nodeDataStorage._isDisposed}set parent(e){if(this._parentNode===e)return;const t=this._parentNode;if(this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children){const t=this._parentNode._children.indexOf(this);-1!==t&&this._parentNode._children.splice(t,1),e||this._nodeDataStorage._isDisposed||this._addToSceneRootNodes()}this._parentNode=e,this._parentNode&&(void 0!==this._parentNode._children&&null!==this._parentNode._children||(this._parentNode._children=new Array),this._parentNode._children.push(this),t||this._removeFromSceneRootNodes()),this._syncParentEnabledState()}get parent(){return this._parentNode}_serializeAsParent(e){e.parentId=this.uniqueId}_addToSceneRootNodes(){-1===this._nodeDataStorage._sceneRootNodesIndex&&(this._nodeDataStorage._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))}_removeFromSceneRootNodes(){if(-1!==this._nodeDataStorage._sceneRootNodesIndex){const e=this._scene.rootNodes,t=e.length-1;e[this._nodeDataStorage._sceneRootNodesIndex]=e[t],e[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex=this._nodeDataStorage._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._nodeDataStorage._sceneRootNodesIndex=-1}}get animationPropertiesOverride(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}getClassName(){return"Node"}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}get onEnabledStateChangedObservable(){return this._nodeDataStorage._onEnabledStateChangedObservable}get onClonedObservable(){return this._nodeDataStorage._onClonedObservable}getScene(){return this._scene}getEngine(){return this._scene.getEngine()}addBehavior(e,t=!1){return-1!==this._behaviors.indexOf(e)||(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce((()=>{e.attach(this)})):e.attach(this),this._behaviors.push(e)),this}removeBehavior(e){const t=this._behaviors.indexOf(e);return-1===t||(this._behaviors[t].detach(),this._behaviors.splice(t,1)),this}get behaviors(){return this._behaviors}getBehaviorByName(e){for(const t of this._behaviors)if(t.name===e)return t;return null}getWorldMatrix(){return this._currentRenderId!==this._scene.getRenderId()&&this.computeWorldMatrix(),this._worldMatrix}_getWorldMatrixDeterminant(){return this._worldMatrixDeterminantIsDirty&&(this._worldMatrixDeterminantIsDirty=!1,this._worldMatrixDeterminant=this._worldMatrix.determinant()),this._worldMatrixDeterminant}get worldMatrixFromCache(){return this._worldMatrix}_initCache(){this._cache={},this._cache.parent=void 0}updateCache(e){!e&&this.isSynchronized()||(this._cache.parent=this.parent,this._updateCache())}_getActionManagerForTrigger(e,t=!0){return this.parent?this.parent._getActionManagerForTrigger(e,!1):null}_updateCache(e){}_isSynchronized(){return!0}_markSyncedWithParent(){this._parentNode&&(this._parentUpdateId=this._parentNode._childUpdateId)}isSynchronizedWithParent(){return!this._parentNode||!this._parentNode._isDirty&&this._parentUpdateId===this._parentNode._childUpdateId&&this._parentNode.isSynchronized()}isSynchronized(){return this._cache.parent!==this._parentNode?(this._cache.parent=this._parentNode,!1):!(this._parentNode&&!this.isSynchronizedWithParent())&&this._isSynchronized()}isReady(e=!1){return this._nodeDataStorage._isReady}markAsDirty(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this}isEnabled(e=!0){return!1===e?this._nodeDataStorage._isEnabled:!!this._nodeDataStorage._isEnabled&&this._nodeDataStorage._isParentEnabled}_syncParentEnabledState(){this._nodeDataStorage._isParentEnabled=!this._parentNode||this._parentNode.isEnabled(),this._children&&this._children.forEach((e=>{e._syncParentEnabledState()}))}setEnabled(e){this._nodeDataStorage._isEnabled!==e&&(this._nodeDataStorage._isEnabled=e,this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(e),this._syncParentEnabledState())}isDescendantOf(e){return!!this.parent&&(this.parent===e||this.parent.isDescendantOf(e))}_getDescendants(e,t=!1,i){if(this._children)for(let n=0;n(!t||t(e))&&void 0!==e.cullingStrategy)),i}getChildren(e,t=!0){return this.getDescendants(t,e)}_setReady(e){e!==this._nodeDataStorage._isReady&&(e?(this.onReady&&this.onReady(this),this._nodeDataStorage._isReady=!0):this._nodeDataStorage._isReady=!1)}getAnimationByName(e){for(let t=0;t{throw(0,l.S)("AnimationRange")},h._NodeConstructors={},(0,n.gn)([(0,s.qC)()],h.prototype,"name",void 0),(0,n.gn)([(0,s.qC)()],h.prototype,"id",void 0),(0,n.gn)([(0,s.qC)()],h.prototype,"uniqueId",void 0),(0,n.gn)([(0,s.qC)()],h.prototype,"state",void 0),(0,n.gn)([(0,s.qC)()],h.prototype,"metadata",void 0)},"../../../node_modules/@babylonjs/core/scene.js":function(e,t,i){"use strict";i.d(t,{x:function(){return L},a:function(){return P}});var n=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),r=i("../../../node_modules/@babylonjs/core/Misc/precisionDate.js"),s=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),o=i("../../../node_modules/@babylonjs/core/Misc/smartArray.js"),a=i("../../../node_modules/@babylonjs/core/Misc/stringDictionary.js"),l=i("../../../node_modules/@babylonjs/core/Misc/tags.js"),c=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),h=i("../../../node_modules/@babylonjs/core/abstractScene.js"),_=i("../../../node_modules/@babylonjs/core/Materials/imageProcessingConfiguration.js"),d=i("../../../node_modules/@babylonjs/core/Materials/uniformBuffer.js"),u=i("../../../node_modules/@babylonjs/core/Collisions/pickingInfo.js"),p=i("../../../node_modules/@babylonjs/core/Actions/actionEvent.js"),f=i("../../../node_modules/@babylonjs/core/PostProcesses/postProcessManager.js"),m=i("../../../node_modules/@babylonjs/core/Rendering/renderingManager.js"),g=i("../../../node_modules/@babylonjs/core/sceneComponent.js"),b=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js"),y=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js"),v=i("../../../node_modules/@babylonjs/core/Misc/devTools.js"),A=i("../../../node_modules/@babylonjs/core/Events/pointerEvents.js"),C=i("../../../node_modules/@babylonjs/core/Actions/abstractActionManager.js"),S=i("../../../node_modules/@babylonjs/core/Events/keyboardEvents.js"),x=i("../../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceEnums.js"),T=i("../../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceSourceManager.js");class E{constructor(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}get singleClick(){return this._singleClick}get doubleClick(){return this._doubleClick}get hasSwiped(){return this._hasSwiped}get ignore(){return this._ignore}set singleClick(e){this._singleClick=e}set doubleClick(e){this._doubleClick=e}set hasSwiped(e){this._hasSwiped=e}set ignore(e){this._ignore=e}}class R{constructor(e){this._alreadyAttached=!1,this._meshPickProceed=!1,this._currentPickResult=null,this._previousPickResult=null,this._totalPointersPressed=0,this._doubleClickOccured=!1,this._pointerX=0,this._pointerY=0,this._startingPointerPosition=new c.FM(0,0),this._previousStartingPointerPosition=new c.FM(0,0),this._startingPointerTime=0,this._previousStartingPointerTime=0,this._pointerCaptures={},this._meshUnderPointerId={},this._deviceSourceManager=null,this._scene=e||y.l.LastCreatedScene,this._scene}get meshUnderPointer(){return this._pointerOverMesh}getMeshUnderPointerByPointerId(e){return this._meshUnderPointerId[e]||null}get unTranslatedPointer(){return new c.FM(this._unTranslatedPointerX,this._unTranslatedPointerY)}get pointerX(){return this._pointerX}set pointerX(e){this._pointerX=e}get pointerY(){return this._pointerY}set pointerY(e){this._pointerY=e}_updatePointerPosition(e){const t=this._scene.getEngine().getInputElementClientRect();t&&(this._pointerX=e.clientX-t.left,this._pointerY=e.clientY-t.top,this._unTranslatedPointerX=this._pointerX,this._unTranslatedPointerY=this._pointerY)}_processPointerMove(e,t){const i=this._scene,n=i.getEngine(),r=n.getInputElement();r&&(r.tabIndex=n.canvasTabIndex,i.doNotHandleCursors||(r.style.cursor=i.defaultCursor));const s=!!(e&&e.hit&&e.pickedMesh);if(s){if(i.setPointerOverMesh(e.pickedMesh,t.pointerId,e),!i.doNotHandleCursors&&r&&this._pointerOverMesh){const e=this._pointerOverMesh._getActionManagerForTrigger();e&&e.hasPointerTriggers&&(r.style.cursor=e.hoverCursor||i.hoverCursor)}}else i.setPointerOverMesh(null,t.pointerId,e);for(const t of i._pointerMoveStage)e=t.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,s,r);if(e){const n=t.inputIndex>=x.Fz.MouseWheelX&&t.inputIndex<=x.Fz.MouseWheelZ?A.kD.POINTERWHEEL:A.kD.POINTERMOVE;if(i.onPointerMove&&i.onPointerMove(t,e,n),i.onPointerObservable.hasObservers()){const r=new A.R5(n,t,e);this._setRayOnPointerInfo(r),i.onPointerObservable.notifyObservers(r,n)}}}_setRayOnPointerInfo(e){const t=this._scene;e.pickInfo&&!e.pickInfo._pickingUnavailable&&(e.pickInfo.ray||(e.pickInfo.ray=t.createPickingRay(e.event.offsetX,e.event.offsetY,c.y3.Identity(),t.activeCamera)))}_checkPrePointerObservable(e,t,i){const n=this._scene,r=new A.FV(i,t,this._unTranslatedPointerX,this._unTranslatedPointerY);return e&&(r.originalPickingInfo=e,r.ray=e.ray,e.originMesh&&(r.nearInteractionPickingInfo=e)),n.onPrePointerObservable.notifyObservers(r,i),!!r.skipOnPointerObservable}simulatePointerMove(e,t){const i=new PointerEvent("pointermove",t);i.inputIndex=x.Fz.Move,this._checkPrePointerObservable(e,i,A.kD.POINTERMOVE)||this._processPointerMove(e,i)}simulatePointerDown(e,t){const i=new PointerEvent("pointerdown",t);i.inputIndex=i.button+2,this._checkPrePointerObservable(e,i,A.kD.POINTERDOWN)||this._processPointerDown(e,i)}_processPointerDown(e,t){const i=this._scene;if(e&&e.hit&&e.pickedMesh){this._pickedDownMesh=e.pickedMesh;const n=e.pickedMesh._getActionManagerForTrigger();if(n){if(n.hasPickTriggers)switch(n.processTrigger(5,p.V.CreateNew(e.pickedMesh,t)),t.button){case 0:n.processTrigger(2,p.V.CreateNew(e.pickedMesh,t));break;case 1:n.processTrigger(4,p.V.CreateNew(e.pickedMesh,t));break;case 2:n.processTrigger(3,p.V.CreateNew(e.pickedMesh,t))}n.hasSpecificTrigger(8)&&window.setTimeout((()=>{const e=i.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,(e=>e.isPickable&&e.isVisible&&e.isReady()&&e.actionManager&&e.actionManager.hasSpecificTrigger(8)&&e===this._pickedDownMesh),!1,i.cameraToUseForPointers);e&&e.hit&&e.pickedMesh&&n&&0!==this._totalPointersPressed&&Date.now()-this._startingPointerTime>R.LongPressDelay&&!this._isPointerSwiping()&&(this._startingPointerTime=0,n.processTrigger(8,p.V.CreateNew(e.pickedMesh,t)))}),R.LongPressDelay)}}else for(const n of i._pointerDownStage)e=n.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,!1);if(e){const n=A.kD.POINTERDOWN;if(i.onPointerDown&&i.onPointerDown(t,e,n),i.onPointerObservable.hasObservers()){const r=new A.R5(n,t,e);this._setRayOnPointerInfo(r),i.onPointerObservable.notifyObservers(r,n)}}}_isPointerSwiping(){return Math.abs(this._startingPointerPosition.x-this._pointerX)>R.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>R.DragMovementThreshold}simulatePointerUp(e,t,i){const n=new PointerEvent("pointerup",t);n.inputIndex=x.Fz.Move;const r=new E;i?r.doubleClick=!0:r.singleClick=!0,this._checkPrePointerObservable(e,n,A.kD.POINTERUP)||this._processPointerUp(e,n,r)}_processPointerUp(e,t,i){const n=this._scene;if(e&&e.hit&&e.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(n.onPointerPick&&n.onPointerPick(t,e),i.singleClick&&!i.ignore&&n.onPointerObservable.hasObservers())){const i=A.kD.POINTERPICK,r=new A.R5(i,t,e);this._setRayOnPointerInfo(r),n.onPointerObservable.notifyObservers(r,i)}const r=e.pickedMesh._getActionManagerForTrigger();if(r&&!i.ignore){r.processTrigger(7,p.V.CreateNew(e.pickedMesh,t,e)),!i.hasSwiped&&i.singleClick&&r.processTrigger(1,p.V.CreateNew(e.pickedMesh,t,e));const n=e.pickedMesh._getActionManagerForTrigger(6);i.doubleClick&&n&&n.processTrigger(6,p.V.CreateNew(e.pickedMesh,t,e))}}else if(!i.ignore)for(const r of n._pointerUpStage)e=r.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,i.doubleClick);if(this._pickedDownMesh&&this._pickedDownMesh!==this._pickedUpMesh){const e=this._pickedDownMesh._getActionManagerForTrigger(16);e&&e.processTrigger(16,p.V.CreateNew(this._pickedDownMesh,t))}let r=0;if(n.onPointerObservable.hasObservers()){if(!i.ignore&&!i.hasSwiped&&(i.singleClick&&n.onPointerObservable.hasSpecificMask(A.kD.POINTERTAP)?r=A.kD.POINTERTAP:i.doubleClick&&n.onPointerObservable.hasSpecificMask(A.kD.POINTERDOUBLETAP)&&(r=A.kD.POINTERDOUBLETAP),r)){const i=new A.R5(r,t,e);this._setRayOnPointerInfo(i),n.onPointerObservable.notifyObservers(i,r)}if(!i.ignore){r=A.kD.POINTERUP;const i=new A.R5(r,t,e);this._setRayOnPointerInfo(i),n.onPointerObservable.notifyObservers(i,r)}}n.onPointerUp&&!i.ignore&&n.onPointerUp(t,e,r)}isPointerCaptured(e=0){return this._pointerCaptures[e]}attachControl(e=!0,t=!0,i=!0,n=null){const r=this._scene,s=r.getEngine();n||(n=s.getInputElement()),this._alreadyAttached&&this.detachControl(),n&&(this._alreadyAttachedTo=n),this._deviceSourceManager=new T.U(s),this._initActionManager=e=>{if(!this._meshPickProceed){const t=r.skipPointerUpPicking?null:r.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,r.pointerUpPredicate,!1,r.cameraToUseForPointers);this._currentPickResult=t,t&&(e=t.hit&&t.pickedMesh?t.pickedMesh._getActionManagerForTrigger():null),this._meshPickProceed=!0}return e},this._delayedSimpleClick=(e,t,i)=>{(Date.now()-this._previousStartingPointerTime>R.DoubleClickDelay&&!this._doubleClickOccured||e!==this._previousButtonPressed)&&(this._doubleClickOccured=!1,t.singleClick=!0,t.ignore=!1,i(t,this._currentPickResult))},this._initClickEvent=(e,t,i,n)=>{const r=new E;this._currentPickResult=null;let s=null,o=e.hasSpecificMask(A.kD.POINTERPICK)||t.hasSpecificMask(A.kD.POINTERPICK)||e.hasSpecificMask(A.kD.POINTERTAP)||t.hasSpecificMask(A.kD.POINTERTAP)||e.hasSpecificMask(A.kD.POINTERDOUBLETAP)||t.hasSpecificMask(A.kD.POINTERDOUBLETAP);!o&&C.O&&(s=this._initActionManager(s,r),s&&(o=s.hasPickTriggers));let a=!1;if(o){const o=i.button;if(r.hasSwiped=this._isPointerSwiping(),!r.hasSwiped){let i=!R.ExclusiveDoubleClickMode;i||(i=!e.hasSpecificMask(A.kD.POINTERDOUBLETAP)&&!t.hasSpecificMask(A.kD.POINTERDOUBLETAP),i&&!C.O.HasSpecificTrigger(6)&&(s=this._initActionManager(s,r),s&&(i=!s.hasSpecificTrigger(6)))),i?(Date.now()-this._previousStartingPointerTime>R.DoubleClickDelay||o!==this._previousButtonPressed)&&(r.singleClick=!0,n(r,this._currentPickResult),a=!0):(this._previousDelayedSimpleClickTimeout=this._delayedSimpleClickTimeout,this._delayedSimpleClickTimeout=window.setTimeout(this._delayedSimpleClick.bind(this,o,r,n),R.DoubleClickDelay));let l=e.hasSpecificMask(A.kD.POINTERDOUBLETAP)||t.hasSpecificMask(A.kD.POINTERDOUBLETAP);!l&&C.O.HasSpecificTrigger(6)&&(s=this._initActionManager(s,r),s&&(l=s.hasSpecificTrigger(6))),l&&(o===this._previousButtonPressed&&Date.now()-this._previousStartingPointerTime{if(void 0===e.pointerId&&(e.pointerId=0),this._updatePointerPosition(e),this._checkPrePointerObservable(null,e,e.inputIndex>=x.Fz.MouseWheelX&&e.inputIndex<=x.Fz.MouseWheelZ?A.kD.POINTERWHEEL:A.kD.POINTERMOVE))return;if(!r.cameraToUseForPointers&&!r.activeCamera)return;if(r.skipPointerMovePicking)return void this._processPointerMove(new u.p,e);r.pointerMovePredicate||(r.pointerMovePredicate=e=>e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(e.enablePointerMoveEvents||r.constantlyUpdateMeshUnderPointer||null!==e._getActionManagerForTrigger())&&(!r.cameraToUseForPointers||0!=(r.cameraToUseForPointers.layerMask&e.layerMask)));const t=r.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,r.pointerMovePredicate,!1,r.cameraToUseForPointers,r.pointerMoveTrianglePredicate);this._processPointerMove(t,e)},this._onPointerDown=e=>{if(this._totalPointersPressed++,this._pickedDownMesh=null,this._meshPickProceed=!1,void 0===e.pointerId&&(e.pointerId=0),this._updatePointerPosition(e),r.preventDefaultOnPointerDown&&n&&(e.preventDefault(),n.focus()),this._startingPointerPosition.x=this._pointerX,this._startingPointerPosition.y=this._pointerY,this._startingPointerTime=Date.now(),this._checkPrePointerObservable(null,e,A.kD.POINTERDOWN))return;if(!r.cameraToUseForPointers&&!r.activeCamera)return;let t;this._pointerCaptures[e.pointerId]=!0,r.pointerDownPredicate||(r.pointerDownPredicate=e=>e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!r.cameraToUseForPointers||0!=(r.cameraToUseForPointers.layerMask&e.layerMask))),this._pickedDownMesh=null,t=r.skipPointerDownPicking?new u.p:r.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,r.pointerDownPredicate,!1,r.cameraToUseForPointers),this._processPointerDown(t,e)},this._onPointerUp=e=>{0!==this._totalPointersPressed&&(this._totalPointersPressed--,this._pickedUpMesh=null,this._meshPickProceed=!1,void 0===e.pointerId&&(e.pointerId=0),this._updatePointerPosition(e),r.preventDefaultOnPointerUp&&n&&(e.preventDefault(),n.focus()),this._initClickEvent(r.onPrePointerObservable,r.onPointerObservable,e,((t,i)=>{if(r.onPrePointerObservable.hasObservers()&&!t.ignore){if(!t.hasSwiped){if(t.singleClick&&r.onPrePointerObservable.hasSpecificMask(A.kD.POINTERTAP)&&this._checkPrePointerObservable(null,e,A.kD.POINTERTAP))return;if(t.doubleClick&&r.onPrePointerObservable.hasSpecificMask(A.kD.POINTERDOUBLETAP)&&this._checkPrePointerObservable(null,e,A.kD.POINTERDOUBLETAP))return}if(this._checkPrePointerObservable(null,e,A.kD.POINTERUP))return}this._pointerCaptures[e.pointerId]=!1,(r.cameraToUseForPointers||r.activeCamera)&&(r.pointerUpPredicate||(r.pointerUpPredicate=e=>e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!r.cameraToUseForPointers||0!=(r.cameraToUseForPointers.layerMask&e.layerMask))),!this._meshPickProceed&&(C.O&&C.O.HasTriggers||r.onPointerObservable.hasObservers())&&this._initActionManager(null,t),i||(i=this._currentPickResult),this._processPointerUp(i,e,t),this._previousPickResult=this._currentPickResult)})))},this._onKeyDown=e=>{const t=S.OG.KEYDOWN;if(r.onPreKeyboardObservable.hasObservers()){const i=new S.WZ(t,e);if(r.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnKeyboardObservable)return}if(r.onKeyboardObservable.hasObservers()){const i=new S.NG(t,e);r.onKeyboardObservable.notifyObservers(i,t)}r.actionManager&&r.actionManager.processTrigger(14,p.V.CreateNewFromScene(r,e))},this._onKeyUp=e=>{const t=S.OG.KEYUP;if(r.onPreKeyboardObservable.hasObservers()){const i=new S.WZ(t,e);if(r.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnKeyboardObservable)return}if(r.onKeyboardObservable.hasObservers()){const i=new S.NG(t,e);r.onKeyboardObservable.notifyObservers(i,t)}r.actionManager&&r.actionManager.processTrigger(15,p.V.CreateNewFromScene(r,e))},this._deviceSourceManager.onDeviceConnectedObservable.add((n=>{n.deviceType===x.Yi.Mouse?n.onInputChangedObservable.add((r=>{r.inputIndex===x.Fz.LeftClick||r.inputIndex===x.Fz.MiddleClick||r.inputIndex===x.Fz.RightClick||r.inputIndex===x.Fz.BrowserBack||r.inputIndex===x.Fz.BrowserForward?t&&1===n.getInput(r.inputIndex)?this._onPointerDown(r):e&&0===n.getInput(r.inputIndex)&&this._onPointerUp(r):i&&(r.inputIndex===x.Fz.Move?this._onPointerMove(r):r.inputIndex!==x.Fz.MouseWheelX&&r.inputIndex!==x.Fz.MouseWheelY&&r.inputIndex!==x.Fz.MouseWheelZ||this._onPointerMove(r))})):n.deviceType===x.Yi.Touch?n.onInputChangedObservable.add((r=>{r.inputIndex===x.Fz.LeftClick&&(t&&1===n.getInput(r.inputIndex)?this._onPointerDown(r):e&&0===n.getInput(r.inputIndex)&&this._onPointerUp(r)),i&&r.inputIndex===x.Fz.Move&&this._onPointerMove(r)})):n.deviceType===x.Yi.Keyboard&&n.onInputChangedObservable.add((e=>{"keydown"===e.type?this._onKeyDown(e):"keyup"===e.type&&this._onKeyUp(e)}))})),this._alreadyAttached=!0}detachControl(){this._alreadyAttached&&(this._deviceSourceManager.dispose(),this._deviceSourceManager=null,this._alreadyAttachedTo&&!this._scene.doNotHandleCursors&&(this._alreadyAttachedTo.style.cursor=this._scene.defaultCursor),this._alreadyAttached=!1,this._alreadyAttachedTo=null)}setPointerOverMesh(e,t=0,i){if(!(this._meshUnderPointerId[t]!==e||e&&e._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting))return;const n=this._meshUnderPointerId[t];let r;n&&(r=n._getActionManagerForTrigger(10),r&&r.processTrigger(10,p.V.CreateNew(n,void 0,{pointerId:t}))),e?(this._meshUnderPointerId[t]=e,this._pointerOverMesh=e,r=e._getActionManagerForTrigger(9),r&&r.processTrigger(9,p.V.CreateNew(e,void 0,{pointerId:t,pickResult:i}))):(delete this._meshUnderPointerId[t],this._pointerOverMesh=null)}getPointerOverMesh(){return this._pointerOverMesh}_invalidateMesh(e){this._pointerOverMesh===e&&(this._pointerOverMesh=null),this._pickedDownMesh===e&&(this._pickedDownMesh=null),this._pickedUpMesh===e&&(this._pickedUpMesh=null);for(const t in this._meshUnderPointerId)this._meshUnderPointerId[t]===e&&delete this._meshUnderPointerId[t]}}R.DragMovementThreshold=10,R.LongPressDelay=500,R.DoubleClickDelay=300,R.ExclusiveDoubleClickMode=!1;var P,I=i("../../../node_modules/@babylonjs/core/Misc/perfCounter.js"),M=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),D=i("../../../node_modules/@babylonjs/core/Maths/math.frustum.js"),O=i("../../../node_modules/@babylonjs/core/Misc/uniqueIdGenerator.js"),w=i("../../../node_modules/@babylonjs/core/Misc/fileTools.js"),F=i("../../../node_modules/@babylonjs/core/Lights/lightConstants.js"),B=i("../../../node_modules/@babylonjs/core/Misc/computePressure.js"),N=i("../../../node_modules/@babylonjs/core/Misc/arrayTools.js");!function(e){e[e.BackwardCompatible=0]="BackwardCompatible",e[e.Intermediate=1]="Intermediate",e[e.Aggressive=2]="Aggressive"}(P||(P={}));class L extends h.p{constructor(e,t){super(),this._inputManager=new R(this),this.cameraToUseForPointers=null,this._isScene=!0,this._blockEntityCollection=!1,this.autoClear=!0,this.autoClearDepthAndStencil=!0,this.clearColor=new M.HE(.2,.2,.3,1),this.ambientColor=new M.Wo(0,0,0),this.environmentIntensity=1,this._performancePriority=P.BackwardCompatible,this._forceWireframe=!1,this._skipFrustumClipping=!1,this._forcePointsCloud=!1,this.animationsEnabled=!0,this._animationPropertiesOverride=null,this.useConstantAnimationDeltaTime=!1,this.constantlyUpdateMeshUnderPointer=!1,this.hoverCursor="pointer",this.defaultCursor="",this.doNotHandleCursors=!1,this.preventDefaultOnPointerDown=!0,this.preventDefaultOnPointerUp=!0,this.metadata=null,this.reservedDataStore=null,this.disableOfflineSupportExceptionRules=new Array,this.onDisposeObservable=new s.y$,this._onDisposeObserver=null,this.onBeforeRenderObservable=new s.y$,this._onBeforeRenderObserver=null,this.onAfterRenderObservable=new s.y$,this.onAfterRenderCameraObservable=new s.y$,this._onAfterRenderObserver=null,this.onBeforeAnimationsObservable=new s.y$,this.onAfterAnimationsObservable=new s.y$,this.onBeforeDrawPhaseObservable=new s.y$,this.onAfterDrawPhaseObservable=new s.y$,this.onReadyObservable=new s.y$,this.onBeforeCameraRenderObservable=new s.y$,this._onBeforeCameraRenderObserver=null,this.onAfterCameraRenderObservable=new s.y$,this._onAfterCameraRenderObserver=null,this.onBeforeActiveMeshesEvaluationObservable=new s.y$,this.onAfterActiveMeshesEvaluationObservable=new s.y$,this.onBeforeParticlesRenderingObservable=new s.y$,this.onAfterParticlesRenderingObservable=new s.y$,this.onDataLoadedObservable=new s.y$,this.onNewCameraAddedObservable=new s.y$,this.onCameraRemovedObservable=new s.y$,this.onNewLightAddedObservable=new s.y$,this.onLightRemovedObservable=new s.y$,this.onNewGeometryAddedObservable=new s.y$,this.onGeometryRemovedObservable=new s.y$,this.onNewTransformNodeAddedObservable=new s.y$,this.onTransformNodeRemovedObservable=new s.y$,this.onNewMeshAddedObservable=new s.y$,this.onMeshRemovedObservable=new s.y$,this.onNewSkeletonAddedObservable=new s.y$,this.onSkeletonRemovedObservable=new s.y$,this.onNewMaterialAddedObservable=new s.y$,this.onNewMultiMaterialAddedObservable=new s.y$,this.onMaterialRemovedObservable=new s.y$,this.onMultiMaterialRemovedObservable=new s.y$,this.onNewTextureAddedObservable=new s.y$,this.onTextureRemovedObservable=new s.y$,this.onBeforeRenderTargetsRenderObservable=new s.y$,this.onAfterRenderTargetsRenderObservable=new s.y$,this.onBeforeStepObservable=new s.y$,this.onAfterStepObservable=new s.y$,this.onActiveCameraChanged=new s.y$,this.onActiveCamerasChanged=new s.y$,this.onBeforeRenderingGroupObservable=new s.y$,this.onAfterRenderingGroupObservable=new s.y$,this.onMeshImportedObservable=new s.y$,this.onAnimationFileImportedObservable=new s.y$,this._registeredForLateAnimationBindings=new o.f(256),this.skipPointerMovePicking=!1,this.skipPointerDownPicking=!1,this.skipPointerUpPicking=!1,this.onPrePointerObservable=new s.y$,this.onPointerObservable=new s.y$,this.onPreKeyboardObservable=new s.y$,this.onKeyboardObservable=new s.y$,this._useRightHandedSystem=!1,this._timeAccumulator=0,this._currentStepId=0,this._currentInternalStep=0,this._fogEnabled=!0,this._fogMode=L.FOGMODE_NONE,this.fogColor=new M.Wo(.2,.2,.3),this.fogDensity=.1,this.fogStart=0,this.fogEnd=1e3,this.needsPreviousWorldMatrices=!1,this._shadowsEnabled=!0,this._lightsEnabled=!0,this._unObserveActiveCameras=null,this._texturesEnabled=!0,this.physicsEnabled=!0,this.particlesEnabled=!0,this.spritesEnabled=!0,this._skeletonsEnabled=!0,this.lensFlaresEnabled=!0,this.collisionsEnabled=!0,this.gravity=new c.P(0,-9.807,0),this.postProcessesEnabled=!0,this.renderTargetsEnabled=!0,this.dumpNextRenderTargets=!1,this.customRenderTargets=new Array,this.importedMeshesFiles=new Array,this.probesEnabled=!0,this._meshesForIntersections=new o.f(256),this.proceduralTexturesEnabled=!0,this._totalVertices=new I.z,this._activeIndices=new I.z,this._activeParticles=new I.z,this._activeBones=new I.z,this._animationTime=0,this.animationTimeScale=1,this._renderId=0,this._frameId=0,this._executeWhenReadyTimeoutId=null,this._intermediateRendering=!1,this._defaultFrameBufferCleared=!1,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1,this._toBeDisposed=new Array(256),this._activeRequests=new Array,this._pendingData=new Array,this._isDisposed=!1,this.dispatchAllSubMeshesOfActiveMeshes=!1,this._activeMeshes=new o.t(256),this._processedMaterials=new o.t(256),this._renderTargets=new o.f(256),this._materialsRenderTargets=new o.f(256),this._activeParticleSystems=new o.t(256),this._activeSkeletons=new o.f(32),this._softwareSkinnedMeshes=new o.f(32),this._activeAnimatables=new Array,this._transformMatrix=c.y3.Zero(),this.requireLightSorting=!1,this._components=[],this._serializableComponents=[],this._transientComponents=[],this._beforeCameraUpdateStage=g.H.Create(),this._beforeClearStage=g.H.Create(),this._beforeRenderTargetClearStage=g.H.Create(),this._gatherRenderTargetsStage=g.H.Create(),this._gatherActiveCameraRenderTargetsStage=g.H.Create(),this._isReadyForMeshStage=g.H.Create(),this._beforeEvaluateActiveMeshStage=g.H.Create(),this._evaluateSubMeshStage=g.H.Create(),this._preActiveMeshStage=g.H.Create(),this._cameraDrawRenderTargetStage=g.H.Create(),this._beforeCameraDrawStage=g.H.Create(),this._beforeRenderTargetDrawStage=g.H.Create(),this._beforeRenderingGroupDrawStage=g.H.Create(),this._beforeRenderingMeshStage=g.H.Create(),this._afterRenderingMeshStage=g.H.Create(),this._afterRenderingGroupDrawStage=g.H.Create(),this._afterCameraDrawStage=g.H.Create(),this._afterCameraPostProcessStage=g.H.Create(),this._afterRenderTargetDrawStage=g.H.Create(),this._afterRenderTargetPostProcessStage=g.H.Create(),this._afterRenderStage=g.H.Create(),this._pointerMoveStage=g.H.Create(),this._pointerDownStage=g.H.Create(),this._pointerUpStage=g.H.Create(),this._geometriesByUniqueId=null,this._defaultMeshCandidates={data:[],length:0},this._defaultSubMeshCandidates={data:[],length:0},this._preventFreeActiveMeshesAndRenderingGroups=!1,this._activeMeshesFrozen=!1,this._activeMeshesFrozenButKeepClipping=!1,this._skipEvaluateActiveMeshesCompletely=!1,this._allowPostProcessClearColor=!0,this.getDeterministicFrameTime=()=>this._engine.getTimeStep(),this._blockMaterialDirtyMechanism=!1,this._perfCollector=null,this.onComputePressureChanged=new s.y$,this.activeCameras=new Array;const i={useGeometryUniqueIdsMap:!0,useMaterialMeshMap:!0,useClonedMeshMap:!0,virtual:!1,...t};this._engine=e||y.l.LastCreatedEngine,i.virtual?this._engine._virtualScenes.push(this):(y.l._LastCreatedScene=this,this._engine.scenes.push(this)),this._uid=null,this._renderingManager=new m.$(this),f.O&&(this.postProcessManager=new f.O(this)),(0,b.CG)()&&this.attachControl(),this._createUbo(),_.$&&(this._imageProcessingConfiguration=new _.$),this.setDefaultCandidateProviders(),i.useGeometryUniqueIdsMap&&(this._geometriesByUniqueId={}),this.useMaterialMeshMap=i.useMaterialMeshMap,this.useClonedMeshMap=i.useClonedMeshMap,t&&t.virtual||this._engine.onNewSceneAddedObservable.notifyObservers(this),B.D.IsAvailable&&(this._computePressureObserver=new B.D((e=>{this.onComputePressureChanged.notifyObservers(e)}),{cpuUtilizationThresholds:[.25,.5,.75,.9],cpuSpeedThresholds:[.5]}),this._computePressureObserver.observe("cpu"))}static DefaultMaterialFactory(e){throw(0,v.S)("StandardMaterial")}static CollisionCoordinatorFactory(){throw(0,v.S)("DefaultCollisionCoordinator")}get environmentTexture(){return this._environmentTexture}set environmentTexture(e){this._environmentTexture!==e&&(this._environmentTexture=e,this.markAllMaterialsAsDirty(1))}get imageProcessingConfiguration(){return this._imageProcessingConfiguration}get performancePriority(){return this._performancePriority}set performancePriority(e){if(e!==this._performancePriority)switch(this._performancePriority=e,e){case P.BackwardCompatible:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!1,this.autoClear=!0;break;case P.Intermediate:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!0,this.autoClear=!1;break;case P.Aggressive:this.skipFrustumClipping=!0,this._renderingManager.maintainStateBetweenFrames=!0,this.skipPointerMovePicking=!0,this.autoClear=!1}}set forceWireframe(e){this._forceWireframe!==e&&(this._forceWireframe=e,this.markAllMaterialsAsDirty(16))}get forceWireframe(){return this._forceWireframe}set skipFrustumClipping(e){this._skipFrustumClipping!==e&&(this._skipFrustumClipping=e)}get skipFrustumClipping(){return this._skipFrustumClipping}set forcePointsCloud(e){this._forcePointsCloud!==e&&(this._forcePointsCloud=e,this.markAllMaterialsAsDirty(16))}get forcePointsCloud(){return this._forcePointsCloud}get animationPropertiesOverride(){return this._animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}set beforeRender(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),e&&(this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e))}set afterRender(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),e&&(this._onAfterRenderObserver=this.onAfterRenderObservable.add(e))}set beforeCameraRender(e){this._onBeforeCameraRenderObserver&&this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=this.onBeforeCameraRenderObservable.add(e)}set afterCameraRender(e){this._onAfterCameraRenderObserver&&this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=this.onAfterCameraRenderObservable.add(e)}get unTranslatedPointer(){return this._inputManager.unTranslatedPointer}static get DragMovementThreshold(){return R.DragMovementThreshold}static set DragMovementThreshold(e){R.DragMovementThreshold=e}static get LongPressDelay(){return R.LongPressDelay}static set LongPressDelay(e){R.LongPressDelay=e}static get DoubleClickDelay(){return R.DoubleClickDelay}static set DoubleClickDelay(e){R.DoubleClickDelay=e}static get ExclusiveDoubleClickMode(){return R.ExclusiveDoubleClickMode}static set ExclusiveDoubleClickMode(e){R.ExclusiveDoubleClickMode=e}bindEyePosition(e,t="vEyePosition",i=!1){var n;const r=this._forcedViewPosition?this._forcedViewPosition:this._mirroredCameraPosition?this._mirroredCameraPosition:null!==(n=this.activeCamera.globalPosition)&&void 0!==n?n:this.activeCamera.devicePosition,s=this.useRightHandedSystem===(null!=this._mirroredCameraPosition);return c.jp.Vector4[0].set(r.x,r.y,r.z,s?-1:1),e&&(i?e.setFloat3(t,c.jp.Vector4[0].x,c.jp.Vector4[0].y,c.jp.Vector4[0].z):e.setVector4(t,c.jp.Vector4[0])),c.jp.Vector4[0]}finalizeSceneUbo(){const e=this.getSceneUniformBuffer(),t=this.bindEyePosition(null);return e.updateFloat4("vEyePosition",t.x,t.y,t.z,t.w),e.update(),e}set useRightHandedSystem(e){this._useRightHandedSystem!==e&&(this._useRightHandedSystem=e,this.markAllMaterialsAsDirty(16))}get useRightHandedSystem(){return this._useRightHandedSystem}setStepId(e){this._currentStepId=e}getStepId(){return this._currentStepId}getInternalStep(){return this._currentInternalStep}set fogEnabled(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAllMaterialsAsDirty(16))}get fogEnabled(){return this._fogEnabled}set fogMode(e){this._fogMode!==e&&(this._fogMode=e,this.markAllMaterialsAsDirty(16))}get fogMode(){return this._fogMode}get prePass(){return!!this.prePassRenderer&&this.prePassRenderer.defaultRT.enabled}set shadowsEnabled(e){this._shadowsEnabled!==e&&(this._shadowsEnabled=e,this.markAllMaterialsAsDirty(2))}get shadowsEnabled(){return this._shadowsEnabled}set lightsEnabled(e){this._lightsEnabled!==e&&(this._lightsEnabled=e,this.markAllMaterialsAsDirty(2))}get lightsEnabled(){return this._lightsEnabled}get activeCameras(){return this._activeCameras}set activeCameras(e){this._unObserveActiveCameras&&(this._unObserveActiveCameras(),this._unObserveActiveCameras=null),e&&(this._unObserveActiveCameras=(0,N.M)(e,(()=>{this.onActiveCamerasChanged.notifyObservers(this)}))),this._activeCameras=e}get activeCamera(){return this._activeCamera}set activeCamera(e){e!==this._activeCamera&&(this._activeCamera=e,this.onActiveCameraChanged.notifyObservers(this))}get defaultMaterial(){return this._defaultMaterial||(this._defaultMaterial=L.DefaultMaterialFactory(this)),this._defaultMaterial}set defaultMaterial(e){this._defaultMaterial=e}set texturesEnabled(e){this._texturesEnabled!==e&&(this._texturesEnabled=e,this.markAllMaterialsAsDirty(1))}get texturesEnabled(){return this._texturesEnabled}set skeletonsEnabled(e){this._skeletonsEnabled!==e&&(this._skeletonsEnabled=e,this.markAllMaterialsAsDirty(8))}get skeletonsEnabled(){return this._skeletonsEnabled}get collisionCoordinator(){return this._collisionCoordinator||(this._collisionCoordinator=L.CollisionCoordinatorFactory(),this._collisionCoordinator.init(this)),this._collisionCoordinator}get renderingManager(){return this._renderingManager}get frustumPlanes(){return this._frustumPlanes}_registerTransientComponents(){if(this._transientComponents.length>0){for(const e of this._transientComponents)e.register();this._transientComponents.length=0}}_addComponent(e){this._components.push(e),this._transientComponents.push(e);const t=e;t.addFromContainer&&t.serialize&&this._serializableComponents.push(t)}_getComponent(e){for(const t of this._components)if(t.name===e)return t;return null}getClassName(){return"Scene"}_getDefaultMeshCandidates(){return this._defaultMeshCandidates.data=this.meshes,this._defaultMeshCandidates.length=this.meshes.length,this._defaultMeshCandidates}_getDefaultSubMeshCandidates(e){return this._defaultSubMeshCandidates.data=e.subMeshes,this._defaultSubMeshCandidates.length=e.subMeshes.length,this._defaultSubMeshCandidates}setDefaultCandidateProviders(){this.getActiveMeshCandidates=this._getDefaultMeshCandidates.bind(this),this.getActiveSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this),this.getIntersectingSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this),this.getCollidingSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this)}get meshUnderPointer(){return this._inputManager.meshUnderPointer}get pointerX(){return this._inputManager.pointerX}set pointerX(e){this._inputManager.pointerX=e}get pointerY(){return this._inputManager.pointerY}set pointerY(e){this._inputManager.pointerY=e}getCachedMaterial(){return this._cachedMaterial}getCachedEffect(){return this._cachedEffect}getCachedVisibility(){return this._cachedVisibility}isCachedMaterialInvalid(e,t,i=1){return this._cachedEffect!==t||this._cachedMaterial!==e||this._cachedVisibility!==i}getEngine(){return this._engine}getTotalVertices(){return this._totalVertices.current}get totalVerticesPerfCounter(){return this._totalVertices}getActiveIndices(){return this._activeIndices.current}get totalActiveIndicesPerfCounter(){return this._activeIndices}getActiveParticles(){return this._activeParticles.current}get activeParticlesPerfCounter(){return this._activeParticles}getActiveBones(){return this._activeBones.current}get activeBonesPerfCounter(){return this._activeBones}getActiveMeshes(){return this._activeMeshes}getAnimationRatio(){return void 0!==this._animationRatio?this._animationRatio:1}getRenderId(){return this._renderId}getFrameId(){return this._frameId}incrementRenderId(){this._renderId++}_createUbo(){this.setSceneUniformBuffer(this.createSceneUniformBuffer())}simulatePointerMove(e,t){return this._inputManager.simulatePointerMove(e,t),this}simulatePointerDown(e,t){return this._inputManager.simulatePointerDown(e,t),this}simulatePointerUp(e,t,i){return this._inputManager.simulatePointerUp(e,t,i),this}isPointerCaptured(e=0){return this._inputManager.isPointerCaptured(e)}attachControl(e=!0,t=!0,i=!0){this._inputManager.attachControl(e,t,i)}detachControl(){this._inputManager.detachControl()}isReady(e=!0){if(this._isDisposed)return!1;let t;const i=this.getEngine();let n=!0;for(this._pendingData.length>0&&(n=!1),e&&(this._processedMaterials.reset(),this._materialsRenderTargets.reset()),t=0;t0;for(const e of this._isReadyForMeshStage)e.action(r,s)||(n=!1);if(!e)continue;const o=r.material||this.defaultMaterial;if(o)if(o._storeEffectOnSubMeshes)for(const e of r.subMeshes){const t=e.getMaterial();t&&t.hasRenderTargetTextures&&null!=t.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(t)&&(this._processedMaterials.push(t),this._materialsRenderTargets.concatWithNoDuplicate(t.getRenderTargetTextures()))}else o.hasRenderTargetTextures&&null!=o.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(o)&&(this._processedMaterials.push(o),this._materialsRenderTargets.concatWithNoDuplicate(o.getRenderTargetTextures()))}if(!n)return!1;if(!i.areAllEffectsReady())return!1;if(e)for(t=0;t0){for(const e of this.activeCameras)if(!e.isReady(!0))return!1}else if(this.activeCamera&&!this.activeCamera.isReady(!0))return!1;for(const e of this.particleSystems)if(!e.isReady())return!1;return!0}resetCachedMaterial(){this._cachedMaterial=null,this._cachedEffect=null,this._cachedVisibility=null}registerBeforeRender(e){this.onBeforeRenderObservable.add(e)}unregisterBeforeRender(e){this.onBeforeRenderObservable.removeCallback(e)}registerAfterRender(e){this.onAfterRenderObservable.add(e)}unregisterAfterRender(e){this.onAfterRenderObservable.removeCallback(e)}_executeOnceBeforeRender(e){const t=()=>{e(),setTimeout((()=>{this.unregisterBeforeRender(t)}))};this.registerBeforeRender(t)}executeOnceBeforeRender(e,t){void 0!==t?setTimeout((()=>{this._executeOnceBeforeRender(e)}),t):this._executeOnceBeforeRender(e)}addPendingData(e){this._pendingData.push(e)}removePendingData(e){const t=this.isLoading,i=this._pendingData.indexOf(e);-1!==i&&this._pendingData.splice(i,1),t&&!this.isLoading&&this.onDataLoadedObservable.notifyObservers(this)}getWaitingItemsCount(){return this._pendingData.length}get isLoading(){return this._pendingData.length>0}executeWhenReady(e,t=!1){this.onReadyObservable.add(e),null===this._executeWhenReadyTimeoutId&&this._checkIsReady(t)}whenReadyAsync(e=!1){return new Promise((t=>{this.executeWhenReady((()=>{t()}),e)}))}_checkIsReady(e=!1){return this._registerTransientComponents(),this.isReady(e)?(this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=null)):this._isDisposed?(this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=null)):void(this._executeWhenReadyTimeoutId=setTimeout((()=>{this.incrementRenderId(),this._checkIsReady(e)}),100))}get animatables(){return this._activeAnimatables}resetLastAnimationTimeFrame(){this._animationTimeLast=r.F.Now}getViewMatrix(){return this._viewMatrix}getProjectionMatrix(){return this._projectionMatrix}getTransformMatrix(){return this._transformMatrix}setTransformMatrix(e,t,i,n){i||n||!this._multiviewSceneUbo||(this._multiviewSceneUbo.dispose(),this._multiviewSceneUbo=null),this._viewUpdateFlag===e.updateFlag&&this._projectionUpdateFlag===t.updateFlag||(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?D.i.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=D.i.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,n):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.updateMatrix("projection",this._projectionMatrix)))}getSceneUniformBuffer(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo}createSceneUniformBuffer(e){const t=new d.M(this._engine,void 0,!1,null!=e?e:"scene");return t.addUniform("viewProjection",16),t.addUniform("view",16),t.addUniform("projection",16),t.addUniform("vEyePosition",4),t}setSceneUniformBuffer(e){this._sceneUbo=e,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1}getUniqueId(){return O.K.UniqueId}addMesh(e,t=!1){this._blockEntityCollection||(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((e=>{this.addMesh(e)})))}removeMesh(e,t=!1){const i=this.meshes.indexOf(e);return-1!==i&&(this.meshes[i]=this.meshes[this.meshes.length-1],this.meshes.pop(),e.parent||e._removeFromSceneRootNodes()),this._inputManager._invalidateMesh(e),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((e=>{this.removeMesh(e)})),i}addTransformNode(e){this._blockEntityCollection||e.getScene()===this&&-1!==e._indexInSceneTransformNodesArray||(e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),e.parent||e._addToSceneRootNodes(),this.onNewTransformNodeAddedObservable.notifyObservers(e))}removeTransformNode(e){const t=e._indexInSceneTransformNodesArray;if(-1!==t){if(t!==this.transformNodes.length-1){const e=this.transformNodes[this.transformNodes.length-1];this.transformNodes[t]=e,e._indexInSceneTransformNodesArray=t}e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop(),e.parent||e._removeFromSceneRootNodes()}return this.onTransformNodeRemovedObservable.notifyObservers(e),t}removeSkeleton(e){const t=this.skeletons.indexOf(e);return-1!==t&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e),this._executeActiveContainerCleanup(this._activeSkeletons)),t}removeMorphTargetManager(e){const t=this.morphTargetManagers.indexOf(e);return-1!==t&&this.morphTargetManagers.splice(t,1),t}removeLight(e){const t=this.lights.indexOf(e);if(-1!==t){for(const t of this.meshes)t._removeLightSource(e,!1);this.lights.splice(t,1),this.sortLightsByPriority(),e.parent||e._removeFromSceneRootNodes()}return this.onLightRemovedObservable.notifyObservers(e),t}removeCamera(e){const t=this.cameras.indexOf(e);if(-1!==t&&(this.cameras.splice(t,1),e.parent||e._removeFromSceneRootNodes()),this.activeCameras){const t=this.activeCameras.indexOf(e);-1!==t&&this.activeCameras.splice(t,1)}return this.activeCamera===e&&(this.cameras.length>0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t}removeParticleSystem(e){const t=this.particleSystems.indexOf(e);return-1!==t&&(this.particleSystems.splice(t,1),this._executeActiveContainerCleanup(this._activeParticleSystems)),t}removeAnimation(e){const t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t}stopAnimation(e,t,i){}removeAnimationGroup(e){const t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),t}removeMultiMaterial(e){const t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),this.onMultiMaterialRemovedObservable.notifyObservers(e),t}removeMaterial(e){const t=e._indexInSceneMaterialArray;if(-1!==t&&t=0;t--)if(this.materials[t].id===e)return this.materials[t];if(t)for(let t=this.multiMaterials.length-1;t>=0;t--)if(this.multiMaterials[t].id===e)return this.multiMaterials[t];return null}getMaterialByName(e){for(let t=0;t=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null}getLastEntryById(e){let t;for(t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;t>=0;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;t>=0;t--)if(this.lights[t].id===e)return this.lights[t];return null}getNodeById(e){const t=this.getMeshById(e);if(t)return t;const i=this.getTransformNodeById(e);if(i)return i;const n=this.getLightById(e);if(n)return n;const r=this.getCameraById(e);if(r)return r;return this.getBoneById(e)||null}getNodeByName(e){const t=this.getMeshByName(e);if(t)return t;const i=this.getTransformNodeByName(e);if(i)return i;const n=this.getLightByName(e);if(n)return n;const r=this.getCameraByName(e);if(r)return r;return this.getBoneByName(e)||null}getMeshByName(e){for(let t=0;t=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null}getSkeletonByUniqueId(e){for(let t=0;t{if(this.activeCamera){if(this._frustumPlanes||this.updateTransformMatrix(),this._evaluateActiveMeshes(),this._activeMeshesFrozen=!0,this._activeMeshesFrozenButKeepClipping=r,this._skipEvaluateActiveMeshesCompletely=e,n)for(let e=0;ee.dispose()))}_evaluateActiveMeshes(){var e;if(this._engine.snapshotRendering&&1===this._engine.snapshotRenderingMode)return void(this._activeMeshes.length>0&&(null===(e=this.activeCamera)||void 0===e||e._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset()));if(this._activeMeshesFrozen&&this._activeMeshes.length){if(!this._skipEvaluateActiveMeshesCompletely){const e=this._activeMeshes.length;for(let t=0;t0&&0!=(i.layerMask&this.activeCamera.layerMask)&&(this._skipFrustumClipping||i.alwaysSelectAsActiveMesh||i.isInFrustum(this._frustumPlanes)))){this._activeMeshes.push(i),this.activeCamera._activeMeshes.push(i),n!==i&&n._activate(this._renderId,!1);for(const e of this._preActiveMeshStage)e.action(i);i._activate(this._renderId,!1)&&(i.isAnInstance?i._internalAbstractMeshDataInfo._actAsRegularMesh&&(n=i):n._internalAbstractMeshDataInfo._onlyForInstances=!1,n._internalAbstractMeshDataInfo._isActive=!0,this._activeMesh(i,n)),i._postActivate()}}if(this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(let e=0;e0){const n=this.getActiveSubMeshCandidates(t),r=n.length;i=i||1===r;for(let s=0;s0&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets),this.environmentTexture&&this.environmentTexture.isRenderTarget&&this._renderTargets.pushNoDuplicate(this.environmentTexture);for(const e of this._gatherActiveCameraRenderTargetsStage)e.action(this._renderTargets);let l=!1;if(this.renderTargetsEnabled){if(this._intermediateRendering=!0,this._renderTargets.length>0){n.w1.StartPerformanceCounter("Render targets",this._renderTargets.length>0);for(let e=0;e0),this._renderId++}for(const e of this._cameraDrawRenderTargetStage)l=e.action(this.activeCamera)||l;this._intermediateRendering=!1}this._engine.currentRenderPassId=null!==(o=null!==(s=null===(r=e.outputRenderTarget)||void 0===r?void 0:r.renderPassId)&&void 0!==s?s:e.renderPassId)&&void 0!==o?o:0,l&&!this.prePass&&this._bindFrameBuffer(this._activeCamera,!1),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),!this.postProcessManager||e._multiviewTexture||this.prePass||this.postProcessManager._prepareFrame();for(const e of this._beforeCameraDrawStage)e.action(this.activeCamera);this.onBeforeDrawPhaseObservable.notifyObservers(this),a.snapshotRendering&&1===a.snapshotRenderingMode&&this.finalizeSceneUbo(),this._renderingManager.render(null,null,!0,!0),this.onAfterDrawPhaseObservable.notifyObservers(this);for(const e of this._afterCameraDrawStage)e.action(this.activeCamera);if(this.postProcessManager&&!e._multiviewTexture){const t=e.outputRenderTarget?e.outputRenderTarget.renderTarget:void 0;this.postProcessManager._finalizeFrame(e.isIntermediate,t)}for(const e of this._afterCameraPostProcessStage)e.action(this.activeCamera);this._renderTargets.reset(),this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera)}_processSubCameras(e,t=!0){if(0===e.cameraRigMode||e._renderingMultiview)return e._renderingMultiview&&!this._multiviewSceneUbo&&this._createMultiviewUbo(),this._renderForCamera(e,void 0,t),void this.onAfterRenderCameraObservable.notifyObservers(e);if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else{this.onBeforeCameraRenderObservable.notifyObservers(e);for(let t=0;t-1&&(13===i.trigger&&i._executeCurrent(p.V.CreateNew(t,void 0,n)),t.actionManager.hasSpecificTrigger(13,(e=>{const t=e.mesh?e.mesh:e;return n===t}))&&13!==i.trigger||t._intersectionsInProgress.splice(s,1))}}}}_advancePhysicsEngineStep(e){}_animate(){}animate(){if(this._engine.isDeterministicLockStep()){let e=Math.max(L.MinDeltaTime,Math.min(this._engine.getDeltaTime(),L.MaxDeltaTime))+this._timeAccumulator;const t=this._engine.getTimeStep(),i=1e3/t/1e3;let n=0;const r=this._engine.getLockstepMaxSteps();let s=Math.floor(e/t);for(s=Math.min(s,r);e>0&&n0)for(let e=0;e0),this._intermediateRendering=!0;for(let e=0;e0),this._intermediateRendering=!1,this._renderId++}this._engine.currentRenderPassId=null!==(s=null==a?void 0:a.renderPassId)&&void 0!==s?s:0,this.activeCamera=a,this._activeCamera&&22!==this._activeCamera.cameraRigMode&&!this.prePass&&this._bindFrameBuffer(this._activeCamera,!1),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(const e of this._beforeClearStage)e.action();this._clearFrameBuffer(this.activeCamera);for(const e of this._gatherRenderTargetsStage)e.action(this._renderTargets);const l=this._activeCamera;if(this.activeCameras&&this.activeCameras.length>0)for(let e=0;e0);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera,!!this.activeCamera.outputRenderTarget)}this._activeCamera=l,this._checkIntersections();for(const e of this._afterRenderStage)e.action();if(this.afterRender&&this.afterRender(),this.onAfterRenderObservable.notifyObservers(this),this._toBeDisposed.length){for(let e=0;ee.dispose(!0))),this._disposeList(this.transformNodes,(e=>e.dispose(!0)));const i=this.cameras;this._disposeList(i),this._defaultMaterial&&this._defaultMaterial.dispose(),this._disposeList(this.multiMaterials),this._disposeList(this.materials),this._disposeList(this.particleSystems),this._disposeList(this.postProcesses),this._disposeList(this.textures),this._disposeList(this.morphTargetManagers),this._sceneUbo.dispose(),this._multiviewSceneUbo&&this._multiviewSceneUbo.dispose(),this.postProcessManager.dispose(),this._disposeList(this._components);let n=this._engine.scenes.indexOf(this);n>-1&&this._engine.scenes.splice(n,1),y.l._LastCreatedScene===this&&(this._engine.scenes.length>0?y.l._LastCreatedScene=this._engine.scenes[this._engine.scenes.length-1]:y.l._LastCreatedScene=null),n=this._engine._virtualScenes.indexOf(this),n>-1&&this._engine._virtualScenes.splice(n,1),this._engine.wipeCaches(!0),this._isDisposed=!0}_disposeList(e,t){const i=e.slice(0);t=null!=t?t:e=>e.dispose();for(const e of i)t(e);e.length=0}get isDisposed(){return this._isDisposed}clearCachedVertexData(){for(let e=0;e!0),this.meshes.filter(e).forEach((e=>{if(e.computeWorldMatrix(!0),!e.subMeshes||0===e.subMeshes.length||e.infiniteDistance)return;const n=e.getBoundingInfo(),r=n.boundingBox.minimumWorld,s=n.boundingBox.maximumWorld;c.P.CheckExtends(r,t,i),c.P.CheckExtends(s,t,i)})),{min:t,max:i}}createPickingRay(e,t,i,n,r=!1){throw(0,v.S)("Ray")}createPickingRayToRef(e,t,i,n,r,s=!1,o=!1){throw(0,v.S)("Ray")}createPickingRayInCameraSpace(e,t,i){throw(0,v.S)("Ray")}createPickingRayInCameraSpaceToRef(e,t,i,n){throw(0,v.S)("Ray")}pick(e,t,i,n,r,s){const o=new u.p;return o._pickingUnavailable=!0,o}pickWithBoundingInfo(e,t,i,n,r){const s=new u.p;return s._pickingUnavailable=!0,s}pickWithRay(e,t,i,n){throw(0,v.S)("Ray")}multiPick(e,t,i,n,r){throw(0,v.S)("Ray")}multiPickWithRay(e,t,i){throw(0,v.S)("Ray")}setPointerOverMesh(e,t,i){this._inputManager.setPointerOverMesh(e,t,i)}getPointerOverMesh(){return this._inputManager.getPointerOverMesh()}_rebuildGeometries(){for(const e of this.geometries)e._rebuild();for(const e of this.meshes)e._rebuild();this.postProcessManager&&this.postProcessManager._rebuild();for(const e of this._components)e.rebuild();for(const e of this.particleSystems)e.rebuild();if(this.spriteManagers)for(const e of this.spriteManagers)e.rebuild()}_rebuildTextures(){for(const e of this.textures)e._rebuild();this.markAllMaterialsAsDirty(1)}_getByTags(e,t,i){if(void 0===t)return e;const n=[];i=i||(e=>{});for(const r in e){const s=e[r];l.$&&l.$.MatchesQuery(s,t)&&(n.push(s),i(s))}return n}getMeshesByTags(e,t){return this._getByTags(this.meshes,e,t)}getCamerasByTags(e,t){return this._getByTags(this.cameras,e,t)}getLightsByTags(e,t){return this._getByTags(this.lights,e,t)}getMaterialByTags(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))}getTransformNodesByTags(e,t){return this._getByTags(this.transformNodes,e,t)}setRenderingOrder(e,t=null,i=null,n=null){this._renderingManager.setRenderingOrder(e,t,i,n)}setRenderingAutoClearDepthStencil(e,t,i=!0,n=!0){this._renderingManager.setRenderingAutoClearDepthStencil(e,t,i,n)}getAutoClearDepthStencilSetup(e){return this._renderingManager.getAutoClearDepthStencilSetup(e)}get blockMaterialDirtyMechanism(){return this._blockMaterialDirtyMechanism}set blockMaterialDirtyMechanism(e){this._blockMaterialDirtyMechanism!==e&&(this._blockMaterialDirtyMechanism=e,e||this.markAllMaterialsAsDirty(63))}markAllMaterialsAsDirty(e,t){if(!this._blockMaterialDirtyMechanism)for(const i of this.materials)t&&!t(i)||i.markAsDirty(e)}_loadFile(e,t,i,n,r,s,o){const a=(0,w.vP)(e,t,i,n?this.offlineProvider:void 0,r,s,o);return this._activeRequests.push(a),a.onCompleteObservable.add((e=>{this._activeRequests.splice(this._activeRequests.indexOf(e),1)})),a}_loadFileAsync(e,t,i,n,r){return new Promise(((s,o)=>{this._loadFile(e,(e=>{s(e)}),t,i,n,((e,t)=>{o(t)}),r)}))}_requestFile(e,t,i,n,r,s,o){const a=(0,w.FV)(e,t,i,n?this.offlineProvider:void 0,r,s,o);return this._activeRequests.push(a),a.onCompleteObservable.add((e=>{this._activeRequests.splice(this._activeRequests.indexOf(e),1)})),a}_requestFileAsync(e,t,i,n,r){return new Promise(((s,o)=>{this._requestFile(e,(e=>{s(e)}),t,i,n,(e=>{o(e)}),r)}))}_readFile(e,t,i,n,r){const s=(0,w.Ip)(e,t,i,n,r);return this._activeRequests.push(s),s.onCompleteObservable.add((e=>{this._activeRequests.splice(this._activeRequests.indexOf(e),1)})),s}_readFileAsync(e,t,i){return new Promise(((n,r)=>{this._readFile(e,(e=>{n(e)}),t,i,(e=>{r(e)}))}))}getPerfCollector(){throw(0,v.S)("performanceViewerSceneExtension")}}L.FOGMODE_NONE=0,L.FOGMODE_EXP=1,L.FOGMODE_EXP2=2,L.FOGMODE_LINEAR=3,L.MinDeltaTime=1,L.MaxDeltaTime=1e3,L.prototype.setActiveCameraByID=function(e){return this.setActiveCameraById(e)},L.prototype.getLastMaterialByID=function(e){return this.getLastMaterialById(e)},L.prototype.getMaterialByID=function(e){return this.getMaterialById(e)},L.prototype.getTextureByUniqueID=function(e){return this.getTextureByUniqueId(e)},L.prototype.getCameraByID=function(e){return this.getCameraById(e)},L.prototype.getCameraByUniqueID=function(e){return this.getCameraByUniqueId(e)},L.prototype.getBoneByID=function(e){return this.getBoneById(e)},L.prototype.getLightByID=function(e){return this.getLightById(e)},L.prototype.getLightByUniqueID=function(e){return this.getLightByUniqueId(e)},L.prototype.getParticleSystemByID=function(e){return this.getParticleSystemById(e)},L.prototype.getGeometryByID=function(e){return this.getGeometryById(e)},L.prototype.getMeshByID=function(e){return this.getMeshById(e)},L.prototype.getMeshesByID=function(e){return this.getMeshesById(e)},L.prototype.getTransformNodeByID=function(e){return this.getTransformNodeById(e)},L.prototype.getTransformNodeByUniqueID=function(e){return this.getTransformNodeByUniqueId(e)},L.prototype.getTransformNodesByID=function(e){return this.getTransformNodesById(e)},L.prototype.getMeshByUniqueID=function(e){return this.getMeshByUniqueId(e)},L.prototype.getLastMeshByID=function(e){return this.getLastMeshById(e)},L.prototype.getLastEntryByID=function(e){return this.getLastEntryById(e)},L.prototype.getNodeByID=function(e){return this.getNodeById(e)},L.prototype.getLastSkeletonByID=function(e){return this.getLastSkeletonById(e)}},"../../../node_modules/@babylonjs/core/sceneComponent.js":function(e,t,i){"use strict";i.d(t,{H:function(){return r},l:function(){return n}});class n{}n.NAME_EFFECTLAYER="EffectLayer",n.NAME_LAYER="Layer",n.NAME_LENSFLARESYSTEM="LensFlareSystem",n.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer",n.NAME_PARTICLESYSTEM="ParticleSystem",n.NAME_GAMEPAD="Gamepad",n.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue",n.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer",n.NAME_PREPASSRENDERER="PrePassRenderer",n.NAME_DEPTHRENDERER="DepthRenderer",n.NAME_DEPTHPEELINGRENDERER="DepthPeelingRenderer",n.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager",n.NAME_SPRITE="Sprite",n.NAME_SUBSURFACE="SubSurface",n.NAME_OUTLINERENDERER="Outline",n.NAME_PROCEDURALTEXTURE="ProceduralTexture",n.NAME_SHADOWGENERATOR="ShadowGenerator",n.NAME_OCTREE="Octree",n.NAME_PHYSICSENGINE="PhysicsEngine",n.NAME_AUDIO="Audio",n.STEP_ISREADYFORMESH_EFFECTLAYER=0,n.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0,n.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0,n.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER=0,n.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1,n.STEP_BEFORECAMERADRAW_PREPASS=0,n.STEP_BEFORECAMERADRAW_EFFECTLAYER=1,n.STEP_BEFORECAMERADRAW_LAYER=2,n.STEP_BEFORERENDERTARGETDRAW_PREPASS=0,n.STEP_BEFORERENDERTARGETDRAW_LAYER=1,n.STEP_BEFORERENDERINGMESH_PREPASS=0,n.STEP_BEFORERENDERINGMESH_OUTLINE=1,n.STEP_AFTERRENDERINGMESH_PREPASS=0,n.STEP_AFTERRENDERINGMESH_OUTLINE=1,n.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0,n.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1,n.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0,n.STEP_BEFORECAMERAUPDATE_GAMEPAD=1,n.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0,n.STEP_BEFORECLEAR_PREPASS=1,n.STEP_BEFORERENDERTARGETCLEAR_PREPASS=0,n.STEP_AFTERRENDERTARGETDRAW_PREPASS=0,n.STEP_AFTERRENDERTARGETDRAW_LAYER=1,n.STEP_AFTERCAMERADRAW_PREPASS=0,n.STEP_AFTERCAMERADRAW_EFFECTLAYER=1,n.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=2,n.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=3,n.STEP_AFTERCAMERADRAW_LAYER=4,n.STEP_AFTERCAMERAPOSTPROCESS_LAYER=0,n.STEP_AFTERRENDERTARGETPOSTPROCESS_LAYER=0,n.STEP_AFTERRENDER_AUDIO=0,n.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=0,n.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1,n.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=2,n.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3,n.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0,n.STEP_POINTERMOVE_SPRITE=0,n.STEP_POINTERDOWN_SPRITE=0,n.STEP_POINTERUP_SPRITE=0;class r extends Array{constructor(e){super(...e)}static Create(){return Object.create(r.prototype)}registerStep(e,t,i){let n=0,r=Number.MAX_VALUE;for(;n=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o}i.d(t,{gn:function(){return n}}),Object.create,Object.create},"../../../node_modules/@babylonjs/gui/2D/advancedDynamicTexture.js":function(e,t,i){"use strict";i.d(t,{i:function(){return C}});var n=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),s=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),o=i("../../../node_modules/@babylonjs/core/Events/pointerEvents.js"),a=i("../../../node_modules/@babylonjs/core/Events/clipboardEvents.js"),l=i("../../../node_modules/@babylonjs/core/Events/keyboardEvents.js"),c=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),h=i("../../../node_modules/@babylonjs/core/Materials/Textures/dynamicTexture.js"),_=i("../../../node_modules/@babylonjs/core/Layers/layer.js"),d=i("../../../node_modules/@babylonjs/gui/2D/controls/container.js"),u=i("../../../node_modules/@babylonjs/gui/2D/controls/control.js"),p=i("../../../node_modules/@babylonjs/gui/2D/style.js"),f=i("../../../node_modules/@babylonjs/gui/2D/measure.js"),m=i("../../../node_modules/@babylonjs/core/Engines/constants.js"),g=i("../../../node_modules/@babylonjs/core/Maths/math.viewport.js"),b=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),y=i("../../../node_modules/@babylonjs/core/Misc/webRequest.js"),v=i("../../../node_modules/@babylonjs/core/Misc/guid.js"),A=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class C extends h.c{constructor(e,t=0,i=0,r,s=!1,o=c.x.NEAREST_SAMPLINGMODE,h=!0){super(e,{width:t,height:i},r,s,o,m.g.TEXTUREFORMAT_RGBA,h),this._isDirty=!1,this._rootContainer=new d.W("root"),this._lastControlOver={},this._lastControlDown={},this._capturingControl={},this._linkedControls=new Array,this._isFullscreen=!1,this._fullscreenViewport=new g.l(0,0,1,1),this._idealWidth=0,this._idealHeight=0,this._useSmallestIdeal=!1,this._renderAtIdealSize=!1,this._blockNextFocusCheck=!1,this._renderScale=1,this._cursorChanged=!1,this._defaultMousePointerId=0,this._capturedPointerIds=new Set,this._numLayoutCalls=0,this._numRenderCalls=0,this._clipboardData="",this.onClipboardObservable=new n.y$,this.onControlPickedObservable=new n.y$,this.onBeginLayoutObservable=new n.y$,this.onEndLayoutObservable=new n.y$,this.onBeginRenderObservable=new n.y$,this.onEndRenderObservable=new n.y$,this.premulAlpha=!1,this.applyYInversionOnUpdate=!0,this.checkPointerEveryFrame=!1,this._useInvalidateRectOptimization=!0,this._invalidatedRectangle=null,this._clearMeasure=new f.U(0,0,0,0),this._onClipboardCopy=e=>{const t=e,i=new a.o(a.p.COPY,t);this.onClipboardObservable.notifyObservers(i),t.preventDefault()},this._onClipboardCut=e=>{const t=e,i=new a.o(a.p.CUT,t);this.onClipboardObservable.notifyObservers(i),t.preventDefault()},this._onClipboardPaste=e=>{const t=e,i=new a.o(a.p.PASTE,t);this.onClipboardObservable.notifyObservers(i),t.preventDefault()},this.parseContent=this.parseSerializedObject,(r=this.getScene())&&this._texture&&(this.applyYInversionOnUpdate=h,this._rootElement=r.getEngine().getInputElement(),this._renderObserver=r.onBeforeCameraRenderObservable.add((e=>this._checkUpdate(e))),this._preKeyboardObserver=r.onPreKeyboardObservable.add((e=>{this._focusedControl&&(e.type===l.OG.KEYDOWN&&this._focusedControl.processKeyboard(e.event),e.skipOnPointerObservable=!0)})),this._rootContainer._link(this),this.hasAlpha=!0,t&&i||(this._resizeObserver=r.getEngine().onResizeObservable.add((()=>this._onResize())),this._onResize()),this._texture.isReady=!0)}get numLayoutCalls(){return this._numLayoutCalls}get numRenderCalls(){return this._numRenderCalls}get renderScale(){return this._renderScale}set renderScale(e){e!==this._renderScale&&(this._renderScale=e,this._onResize())}get background(){return this._background}set background(e){this._background!==e&&(this._background=e,this.markAsDirty())}get idealWidth(){return this._idealWidth}set idealWidth(e){this._idealWidth!==e&&(this._idealWidth=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())}get idealHeight(){return this._idealHeight}set idealHeight(e){this._idealHeight!==e&&(this._idealHeight=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())}get useSmallestIdeal(){return this._useSmallestIdeal}set useSmallestIdeal(e){this._useSmallestIdeal!==e&&(this._useSmallestIdeal=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())}get renderAtIdealSize(){return this._renderAtIdealSize}set renderAtIdealSize(e){this._renderAtIdealSize!==e&&(this._renderAtIdealSize=e,this._onResize())}get idealRatio(){let e=0,t=0;return this._idealWidth&&(e=this.getSize().width/this._idealWidth),this._idealHeight&&(t=this.getSize().height/this._idealHeight),this._useSmallestIdeal&&this._idealWidth&&this._idealHeight?window.innerWidtht.typeName===e))}getControlByName(e){return this._getControlByKey("name",e)}_getControlByKey(e,t){return this._rootContainer.getDescendants().find((i=>i[e]===t))||null}get focusedControl(){return this._focusedControl}set focusedControl(e){this._focusedControl!=e&&(this._focusedControl&&this._focusedControl.onBlur(),e&&e.onFocus(),this._focusedControl=e)}get isForeground(){return!this.layer||!this.layer.isBackground}set isForeground(e){this.layer&&this.layer.isBackground!==!e&&(this.layer.isBackground=!e)}get clipboardData(){return this._clipboardData}set clipboardData(e){this._clipboardData=e}getClassName(){return"AdvancedDynamicTexture"}executeOnAllControls(e,t){t||(t=this._rootContainer),e(t);for(const i of t.children)i.children?this.executeOnAllControls(e,i):e(i)}get useInvalidateRectOptimization(){return this._useInvalidateRectOptimization}set useInvalidateRectOptimization(e){this._useInvalidateRectOptimization=e}invalidateRect(e,t,i,n){if(this._useInvalidateRectOptimization)if(this._invalidatedRectangle){const r=Math.ceil(Math.max(this._invalidatedRectangle.left+this._invalidatedRectangle.width-1,i)),s=Math.ceil(Math.max(this._invalidatedRectangle.top+this._invalidatedRectangle.height-1,n));this._invalidatedRectangle.left=Math.floor(Math.min(this._invalidatedRectangle.left,e)),this._invalidatedRectangle.top=Math.floor(Math.min(this._invalidatedRectangle.top,t)),this._invalidatedRectangle.width=r-this._invalidatedRectangle.left+1,this._invalidatedRectangle.height=s-this._invalidatedRectangle.top+1}else this._invalidatedRectangle=new f.U(e,t,i-e+1,n-t+1)}markAsDirty(){this._isDirty=!0}createStyle(){return new p.b(this)}addControl(e){return this._rootContainer.addControl(e),this}removeControl(e){return this._rootContainer.removeControl(e),this}moveToNonOverlappedPosition(e,t=1,i=1){let n;if(Array.isArray(e))n=e;else{const t=this.getDescendants(!0);n=void 0===e?t.filter((e=>void 0!==e.overlapGroup)):t.filter((t=>t.overlapGroup===e))}n.forEach((e=>{var s;let o=r.FM.Zero();const a=new r.FM(e.centerX,e.centerY);n.forEach((t=>{if(e!==t&&C._Overlaps(e,t)){const e=a.subtract(new r.FM(t.centerX,t.centerY)),n=e.length();n>0&&(o=o.add(e.normalize().scale(i/n)))}})),o.length()>0&&(o=o.normalize().scale(t*(null!==(s=e.overlapDeltaMultiplier)&&void 0!==s?s:1)),e.linkOffsetXInPixels+=o.x,e.linkOffsetYInPixels+=o.y)}))}dispose(){const e=this.getScene();e&&(this._rootElement=null,e.onBeforeCameraRenderObservable.remove(this._renderObserver),this._resizeObserver&&e.getEngine().onResizeObservable.remove(this._resizeObserver),this._prePointerObserver&&e.onPrePointerObservable.remove(this._prePointerObserver),this._sceneRenderObserver&&e.onBeforeRenderObservable.remove(this._sceneRenderObserver),this._pointerObserver&&e.onPointerObservable.remove(this._pointerObserver),this._preKeyboardObserver&&e.onPreKeyboardObservable.remove(this._preKeyboardObserver),this._canvasPointerOutObserver&&e.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver),this._canvasBlurObserver&&e.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver),this._layerToDispose&&(this._layerToDispose.texture=null,this._layerToDispose.dispose(),this._layerToDispose=null),this._rootContainer.dispose(),this.onClipboardObservable.clear(),this.onControlPickedObservable.clear(),this.onBeginRenderObservable.clear(),this.onEndRenderObservable.clear(),this.onBeginLayoutObservable.clear(),this.onEndLayoutObservable.clear(),super.dispose())}_onResize(){const e=this.getScene();if(!e)return;const t=e.getEngine(),i=this.getSize();let n=t.getRenderWidth()*this._renderScale,r=t.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(r=r*this._idealWidth/n,n=this._idealWidth):this._idealHeight&&(n=n*this._idealHeight/r,r=this._idealHeight)),i.width===n&&i.height===r||(this.scaleTo(n,r),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty()),this.invalidateRect(0,0,i.width-1,i.height-1)}_getGlobalViewport(){const e=this.getSize(),t=this._fullscreenViewport.toGlobal(e.width,e.height),i=Math.round(t.width*(1/this.rootContainer.scaleX)),n=Math.round(t.height*(1/this.rootContainer.scaleY));return t.x+=(t.width-i)/2,t.y+=(t.height-n)/2,t.width=i,t.height=n,t}getProjectedPosition(e,t){const i=this.getProjectedPositionWithZ(e,t);return new r.FM(i.x,i.y)}getProjectedPositionWithZ(e,t){const i=this.getScene();if(!i)return r.P.Zero();const n=this._getGlobalViewport(),s=r.P.Project(e,t,i.getTransformMatrix(),n);return new r.P(s.x,s.y,s.z)}_checkUpdate(e){if(!this._layerToDispose||0!=(e.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length){const e=this.getScene();if(!e)return;const t=this._getGlobalViewport();for(const i of this._linkedControls){if(!i.isVisible)continue;const n=i._linkedMesh;if(!n||n.isDisposed()){s.w1.SetImmediate((()=>{i.linkWithMesh(null)}));continue}const o=n.getBoundingInfo?n.getBoundingInfo().boundingSphere.center:r.P.ZeroReadOnly,a=r.P.Project(o,n.getWorldMatrix(),e.getTransformMatrix(),t);a.z<0||a.z>1?i.notRenderable=!0:(i.notRenderable=!1,i._moveToProjectedPosition(a))}}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(),this.update(this.applyYInversionOnUpdate,this.premulAlpha,C.AllowGPUOptimizations))}}_render(){const e=this.getSize(),t=e.width,i=e.height,n=this.getContext();n.font="18px Arial",n.strokeStyle="white",this.onBeginLayoutObservable.notifyObservers(this);const r=new f.U(0,0,t,i);this._numLayoutCalls=0,this._rootContainer._layout(r,n),this.onEndLayoutObservable.notifyObservers(this),this._isDirty=!1,this._invalidatedRectangle?this._clearMeasure.copyFrom(this._invalidatedRectangle):this._clearMeasure.copyFromFloats(0,0,t,i),n.clearRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),this._background&&(n.save(),n.fillStyle=this._background,n.fillRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),n.restore()),this.onBeginRenderObservable.notifyObservers(this),this._numRenderCalls=0,this._rootContainer._render(n,this._invalidatedRectangle),this.onEndRenderObservable.notifyObservers(this),this._invalidatedRectangle=null}_changeCursor(e){this._rootElement&&(this._rootElement.style.cursor=e,this._cursorChanged=!0)}_registerLastControlDown(e,t){this._lastControlDown[t]=e,this.onControlPickedObservable.notifyObservers(e)}_doPicking(e,t,i,n,r,s,a,l){const c=this.getScene();if(!c)return;const h=c.getEngine(),_=this.getSize();if(this._isFullscreen){const i=c.cameraToUseForPointers||c.activeCamera;if(!i)return;const n=i.viewport;e*=_.width/(h.getRenderWidth()*n.width),t*=_.height/(h.getRenderHeight()*n.height)}if(this._capturingControl[r])return this._capturingControl[r].isPointerBlocker&&(this._shouldBlockPointer=!0),void this._capturingControl[r]._processObservables(n,e,t,i,r,s);this._cursorChanged=!1,this._rootContainer._processPicking(e,t,i,n,r,s,a,l)||(c.doNotHandleCursors||this._changeCursor(""),n===o.kD.POINTERMOVE&&this._lastControlOver[r]&&(this._lastControlOver[r]._onPointerOut(this._lastControlOver[r],i),delete this._lastControlOver[r])),this._cursorChanged||c.doNotHandleCursors||this._changeCursor(""),this._manageFocus()}_cleanControlAfterRemovalFromList(e,t){for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&e[i]===t&&delete e[i]}_cleanControlAfterRemoval(e){this._cleanControlAfterRemovalFromList(this._lastControlDown,e),this._cleanControlAfterRemovalFromList(this._lastControlOver,e)}pick(e,t,i=null){this._isFullscreen&&this._scene&&this._translateToPicking(this._scene,new g.l(0,0,0,0),i,e,t)}_translateToPicking(e,t,i,n=e.pointerX,r=e.pointerY){const s=e.cameraToUseForPointers||e.activeCamera,a=e.getEngine(),l=e.cameraToUseForPointers;if(s)if(s.rigCameras.length){const i=new g.l(0,0,1,1);s.rigCameras.forEach((s=>{s.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),i);const o=n/a.getHardwareScalingLevel()-i.x,l=r/a.getHardwareScalingLevel()-(a.getRenderHeight()-i.y-i.height);o<0||l<0||n>i.width||r>i.height||(e.cameraToUseForPointers=s,t.x=i.x,t.y=i.y,t.width=i.width,t.height=i.height)}))}else s.viewport.toGlobalToRef(a.getRenderWidth(),a.getRenderHeight(),t);else t.x=0,t.y=0,t.width=a.getRenderWidth(),t.height=a.getRenderHeight();const c=n/a.getHardwareScalingLevel()-t.x,h=r/a.getHardwareScalingLevel()-(a.getRenderHeight()-t.y-t.height);if(this._shouldBlockPointer=!1,i){const e=i.event.pointerId||this._defaultMousePointerId;this._doPicking(c,h,i,i.type,e,i.event.button,i.event.deltaX,i.event.deltaY),(this._shouldBlockPointer||this._capturingControl[e])&&(i.skipOnPointerObservable=!0)}else this._doPicking(c,h,null,o.kD.POINTERMOVE,this._defaultMousePointerId,0);e.cameraToUseForPointers=l}attach(){const e=this.getScene();if(!e)return;const t=new g.l(0,0,0,0);this._prePointerObserver=e.onPrePointerObservable.add((i=>{if((!e.isPointerCaptured(i.event.pointerId)||i.type!==o.kD.POINTERUP||this._capturedPointerIds.has(i.event.pointerId))&&(i.type===o.kD.POINTERMOVE||i.type===o.kD.POINTERUP||i.type===o.kD.POINTERDOWN||i.type===o.kD.POINTERWHEEL)){if(i.type===o.kD.POINTERMOVE){if(e.isPointerCaptured(i.event.pointerId))return;i.event.pointerId&&(this._defaultMousePointerId=i.event.pointerId)}this._translateToPicking(e,t,i)}})),this._attachPickingToSceneRender(e,(()=>this._translateToPicking(e,t,null)),!1),this._attachToOnPointerOut(e),this._attachToOnBlur(e)}registerClipboardEvents(){self.addEventListener("copy",this._onClipboardCopy,!1),self.addEventListener("cut",this._onClipboardCut,!1),self.addEventListener("paste",this._onClipboardPaste,!1)}unRegisterClipboardEvents(){self.removeEventListener("copy",this._onClipboardCopy),self.removeEventListener("cut",this._onClipboardCut),self.removeEventListener("paste",this._onClipboardPaste)}_transformUvs(e){const t=this.getTextureMatrix();let i;if(t.isIdentityAs3x2())i=e;else{const n=r.jp.Matrix[0];t.getRowToRef(0,r.jp.Vector4[0]),t.getRowToRef(1,r.jp.Vector4[1]),t.getRowToRef(2,r.jp.Vector4[2]);const s=r.jp.Vector4[0],o=r.jp.Vector4[1],a=r.jp.Vector4[2];n.setRowFromFloats(0,s.x,s.y,0,0),n.setRowFromFloats(1,o.x,o.y,0,0),n.setRowFromFloats(2,0,0,1,0),n.setRowFromFloats(3,a.x,a.y,0,1),i=r.jp.Vector2[0],r.FM.TransformToRef(e,n,i)}if((this.wrapU===c.x.WRAP_ADDRESSMODE||this.wrapU===c.x.MIRROR_ADDRESSMODE)&&i.x>1){let e=i.x-Math.trunc(i.x);this.wrapU===c.x.MIRROR_ADDRESSMODE&&Math.trunc(i.x)%2==1&&(e=1-e),i.x=e}if((this.wrapV===c.x.WRAP_ADDRESSMODE||this.wrapV===c.x.MIRROR_ADDRESSMODE)&&i.y>1){let e=i.y-Math.trunc(i.y);this.wrapV===c.x.MIRROR_ADDRESSMODE&&Math.trunc(i.x)%2==1&&(e=1-e),i.y=e}return i}attachToMesh(e,t=!0){const i=this.getScene();i&&(this._pointerObserver=i.onPointerObservable.add((t=>{if(t.type!==o.kD.POINTERMOVE&&t.type!==o.kD.POINTERUP&&t.type!==o.kD.POINTERDOWN&&t.type!==o.kD.POINTERWHEEL)return;t.type===o.kD.POINTERMOVE&&t.event.pointerId&&(this._defaultMousePointerId=t.event.pointerId);const i=t.event.pointerId||this._defaultMousePointerId;if(t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh===e){let e=t.pickInfo.getTextureCoordinates();if(e){e=this._transformUvs(e);const n=this.getSize();this._doPicking(e.x*n.width,(this.applyYInversionOnUpdate?1-e.y:e.y)*n.height,t,t.type,i,t.event.button,t.event.deltaX,t.event.deltaY)}}else if(t.type===o.kD.POINTERUP){if(this._lastControlDown[i]&&this._lastControlDown[i]._forcePointerUp(i),delete this._lastControlDown[i],this.focusedControl){const e=this.focusedControl.keepsFocusWith();let t=!0;if(e)for(const n of e){if(this===n._host)continue;const e=n._host;if(e._lastControlOver[i]&&e._lastControlOver[i].isAscendant(n)){t=!1;break}}t&&(this.focusedControl=null)}}else t.type===o.kD.POINTERMOVE&&(this._lastControlOver[i]&&this._lastControlOver[i]._onPointerOut(this._lastControlOver[i],t,!0),delete this._lastControlOver[i])})),e.enablePointerMoveEvents=t,this._attachPickingToSceneRender(i,(()=>{const t=this._defaultMousePointerId,n=null==i?void 0:i.pick(i.pointerX,i.pointerY);if(n&&n.hit&&n.pickedMesh===e){let e=n.getTextureCoordinates();if(e){e=this._transformUvs(e);const i=this.getSize();this._doPicking(e.x*i.width,(this.applyYInversionOnUpdate?1-e.y:e.y)*i.height,null,o.kD.POINTERMOVE,t,0)}}else this._lastControlOver[t]&&this._lastControlOver[t]._onPointerOut(this._lastControlOver[t],null,!0),delete this._lastControlOver[t]}),!0),this._attachToOnPointerOut(i),this._attachToOnBlur(i))}moveFocusToControl(e){this.focusedControl=e,this._lastPickedControl=e,this._blockNextFocusCheck=!0}_manageFocus(){if(this._blockNextFocusCheck)return this._blockNextFocusCheck=!1,void(this._lastPickedControl=this._focusedControl);if(this._focusedControl&&this._focusedControl!==this._lastPickedControl){if(this._lastPickedControl.isFocusInvisible)return;this.focusedControl=null}}_attachPickingToSceneRender(e,t,i){this._sceneRenderObserver=e.onBeforeRenderObservable.add((()=>{this.checkPointerEveryFrame&&(this._linkedControls.length>0||i)&&t()}))}_attachToOnPointerOut(e){this._canvasPointerOutObserver=e.getEngine().onCanvasPointerOutObservable.add((e=>{this._lastControlOver[e.pointerId]&&this._lastControlOver[e.pointerId]._onPointerOut(this._lastControlOver[e.pointerId],null),delete this._lastControlOver[e.pointerId],this._lastControlDown[e.pointerId]&&this._lastControlDown[e.pointerId]!==this._capturingControl[e.pointerId]&&(this._lastControlDown[e.pointerId]._forcePointerUp(e.pointerId),delete this._lastControlDown[e.pointerId])}))}_attachToOnBlur(e){this._canvasBlurObserver=e.getEngine().onCanvasBlurObservable.add((()=>{Object.entries(this._lastControlDown).forEach((([,e])=>{e._onCanvasBlur()})),this.focusedControl=null,this._lastControlDown={}}))}serializeContent(){const e=this.getSize(),t={root:{},width:e.width,height:e.height};return this._rootContainer.serialize(t.root),t}parseSerializedObject(e,t){if(this._rootContainer=u.o.Parse(e.root,this),t){const t=e.width,i=e.height;"number"==typeof t&&"number"==typeof i&&t>=0&&i>=0?this.scaleTo(t,i):this.scaleTo(1920,1080)}}clone(e){const t=this.getScene();if(!t)return this;const i=this.serializeContent(),n=C.CreateFullscreenUI(e||"Clone of "+this.name,this.isForeground,t,this.samplingMode);return n.parseSerializedObject(i),n}static async ParseFromSnippetAsync(e,t,i){const n=null!=i?i:C.CreateFullscreenUI("ADT from snippet");if("_BLANK"===e)return n;const r=await C._LoadURLContentAsync(C.SnippetUrl+"/"+e.replace(/#/g,"/"),!0);return n.parseSerializedObject(r,t),n}parseFromSnippetAsync(e,t){return C.ParseFromSnippetAsync(e,t,this)}static async ParseFromFileAsync(e,t,i){const n=null!=i?i:C.CreateFullscreenUI("ADT from URL"),r=await C._LoadURLContentAsync(e);return n.parseSerializedObject(r,t),n}parseFromURLAsync(e,t){return C.ParseFromFileAsync(e,t,this)}static _LoadURLContentAsync(e,t=!1){return""===e?Promise.reject("No URL provided"):new Promise(((i,n)=>{const r=new y.g;r.addEventListener("readystatechange",(()=>{if(4==r.readyState)if(200==r.status){const e=t?JSON.parse(JSON.parse(r.responseText).jsonPayload).gui:r.responseText,n=JSON.parse(e);i(n)}else n("Unable to load")})),r.open("GET",e),r.send()}))}static _Overlaps(e,t){return!(e.centerX>t.centerX+t.widthInPixels||e.centerX+e.widthInPixelst.centerY+t.heightInPixels)}static CreateForMesh(e,t=1024,i=1024,n=!0,r=!1,s,o=this._CreateMaterial){const a=(0,v.f)(),l=new C(`AdvancedDynamicTexture for ${e.name} [${a}]`,t,i,e.getScene(),!0,c.x.TRILINEAR_SAMPLINGMODE,s);return o(e,a,l,r),l.attachToMesh(e,n),l}static _CreateMaterial(e,t,i,n){const r=(0,A.q)("BABYLON.StandardMaterial");if(!r)throw"StandardMaterial needs to be imported before as it contains a side-effect required by your code.";const s=new r(`AdvancedDynamicTextureMaterial for ${e.name} [${t}]`,e.getScene());s.backFaceCulling=!1,s.diffuseColor=b.Wo.Black(),s.specularColor=b.Wo.Black(),n?(s.diffuseTexture=i,s.emissiveTexture=i,i.hasAlpha=!0):(s.emissiveTexture=i,s.opacityTexture=i),e.material=s}static CreateForMeshTexture(e,t=1024,i=1024,n=!0,r){const s=new C(e.name+" AdvancedDynamicTexture",t,i,e.getScene(),!0,c.x.TRILINEAR_SAMPLINGMODE,r);return s.attachToMesh(e,n),s}static CreateFullscreenUI(e,t=!0,i=null,n=c.x.BILINEAR_SAMPLINGMODE,r=!1){const s=new C(e,0,0,i,!1,n),o=s.getScene(),a=new _.m(e+"_layer",null,o,!t);if(a.texture=s,s._layerToDispose=a,s._isFullscreen=!0,r&&o){const e=1/o.getEngine().getHardwareScalingLevel();s._rootContainer.scaleX=e,s._rootContainer.scaleY=e}return s.attach(),s}scale(e){super.scale(e),this.markAsDirty()}scaleTo(e,t){super.scaleTo(e,t),this.markAsDirty()}}C.SnippetUrl=m.g.SnippetUrl,C.AllowGPUOptimizations=!0},"../../../node_modules/@babylonjs/gui/2D/controls/container.js":function(e,t,i){"use strict";i.d(t,{W:function(){return d}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),s=i("../../../node_modules/@babylonjs/gui/2D/controls/control.js"),o=i("../../../node_modules/@babylonjs/gui/2D/measure.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),l=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),c=i("../../../node_modules/@babylonjs/core/Materials/Textures/dynamicTexture.js"),h=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),_=i("../../../node_modules/@babylonjs/core/Engines/constants.js");class d extends s.o{constructor(e){super(e),this.name=e,this._children=new Array,this._measureForChildren=o.U.Empty(),this._background="",this._adaptWidthToChildren=!1,this._adaptHeightToChildren=!1,this._renderToIntermediateTexture=!1,this._intermediateTexture=null,this.logLayoutCycleErrors=!1,this.maxLayoutCycle=3}get renderToIntermediateTexture(){return this._renderToIntermediateTexture}set renderToIntermediateTexture(e){this._renderToIntermediateTexture!==e&&(this._renderToIntermediateTexture=e,this._markAsDirty())}get adaptHeightToChildren(){return this._adaptHeightToChildren}set adaptHeightToChildren(e){this._adaptHeightToChildren!==e&&(this._adaptHeightToChildren=e,e&&(this.height="100%"),this._markAsDirty())}get adaptWidthToChildren(){return this._adaptWidthToChildren}set adaptWidthToChildren(e){this._adaptWidthToChildren!==e&&(this._adaptWidthToChildren=e,e&&(this.width="100%"),this._markAsDirty())}get background(){return this._background}set background(e){this._background!==e&&(this._background=e,this._markAsDirty())}get children(){return this._children}get isReadOnly(){return this._isReadOnly}set isReadOnly(e){this._isReadOnly=e;for(const t of this._children)t.isReadOnly=e}_getTypeName(){return"Container"}_flagDescendantsAsMatrixDirty(){for(const e of this.children)e._isClipped=!1,e._markMatrixAsDirty()}getChildByName(e){for(const t of this.children)if(t.name===e)return t;return null}getChildByType(e,t){for(const e of this.children)if(e.typeName===t)return e;return null}containsControl(e){return-1!==this.children.indexOf(e)}addControl(e){return e?(-1!==this._children.indexOf(e)||(e._link(this._host),e._markAllAsDirty(),this._reOrderControl(e),this._markAsDirty()),this):this}clearControls(){const e=this.children.slice();for(const t of e)this.removeControl(t);return this}removeControl(e){const t=this._children.indexOf(e);return-1!==t&&(this._children.splice(t,1),e.parent=null),e.linkWithMesh(null),this._host&&this._host._cleanControlAfterRemoval(e),this._markAsDirty(),this}_reOrderControl(e){const t=e.linkedMesh;this.removeControl(e);let i=!1;for(let t=0;te.zIndex){this._children.splice(t,0,e),i=!0;break}i||this._children.push(e),e.parent=this,t&&e.linkWithMesh(t),this._markAsDirty()}_offsetLeft(e){super._offsetLeft(e);for(const t of this._children)t._offsetLeft(e)}_offsetTop(e){super._offsetTop(e);for(const t of this._children)t._offsetTop(e)}_markAllAsDirty(){super._markAllAsDirty();for(let e=0;e=0&&(r+=this.paddingLeftInPixels+this.paddingRightInPixels,this.width!==r+"px"&&(null===(i=this.parent)||void 0===i||i._markAsDirty(),this.width=r+"px",this._width.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this.adaptHeightToChildren&&o>=0&&(o+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==o+"px"&&(null===(n=this.parent)||void 0===n||n._markAsDirty(),this.height=o+"px",this._height.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this._postMeasure()}s++}while(this._rebuildLayout&&s=3&&this.logLayoutCycleErrors&&r.Y.Error(`Layout cycle detected in GUI (Container name=${this.name}, uniqueId=${this.uniqueId})`),t.restore(),this._isDirty&&(this.invalidateRect(),this._isDirty=!1),!0}_postMeasure(){}_draw(e,t){const i=this._renderToIntermediateTexture&&this._intermediateTexture,n=i?this._intermediateTexture.getContext():e;i&&(n.save(),n.translate(-this._currentMeasure.left,-this._currentMeasure.top),t?n.clearRect(t.left,t.top,t.width,t.height):n.clearRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._localDraw(n),e.save(),this.clipChildren&&this._clipForChildren(n);for(const e of this._children)t&&!e._intersectsRect(t)||e._render(n,t);i&&(n.restore(),e.save(),e.globalAlpha=this.alpha,e.drawImage(n.canvas,this._currentMeasure.left,this._currentMeasure.top),e.restore()),e.restore()}getDescendantsToRef(e,t=!1,i){if(this.children)for(let n=0;n=0;l--){const c=this._children[l];if(c._processPicking(e,t,i,n,r,s,o,a))return c.hoverCursor&&this._host._changeCursor(c.hoverCursor),!0}return!!l&&!!this.isHitTestVisible&&this._processObservables(n,e,t,i,r,s,o,a)}_additionalProcessing(e,t){super._additionalProcessing(e,t),this._measureForChildren.copyFrom(this._currentMeasure)}serialize(e){if(super.serialize(e),this.children.length){e.children=[];for(const t of this.children){const i={};t.serialize(i),e.children.push(i)}}}dispose(){var e;super.dispose();for(let e=this.children.length-1;e>=0;e--)this.children[e].dispose();null===(e=this._intermediateTexture)||void 0===e||e.dispose()}_parseFromContent(e,t){if(super._parseFromContent(e,t),this._link(t),e.children)for(const i of e.children)this.addControl(s.o.Parse(i,t))}}(0,n.gn)([(0,l.qC)()],d.prototype,"renderToIntermediateTexture",null),(0,n.gn)([(0,l.qC)()],d.prototype,"maxLayoutCycle",void 0),(0,n.gn)([(0,l.qC)()],d.prototype,"adaptHeightToChildren",null),(0,n.gn)([(0,l.qC)()],d.prototype,"adaptWidthToChildren",null),(0,n.gn)([(0,l.qC)()],d.prototype,"background",null),(0,a.H)("BABYLON.GUI.Container",d)},"../../../node_modules/@babylonjs/gui/2D/controls/control.js":function(e,t,i){"use strict";i.d(t,{o:function(){return f}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),s=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),o=i("../../../node_modules/@babylonjs/core/Events/pointerEvents.js"),a=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),l=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),c=i("../../../node_modules/@babylonjs/gui/2D/valueAndUnit.js"),h=i("../../../node_modules/@babylonjs/gui/2D/measure.js"),_=i("../../../node_modules/@babylonjs/gui/2D/math2D.js"),d=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),u=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),p=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js");class f{constructor(e){this.name=e,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=h.U.Empty(),this._tempPaddingMeasure=h.U.Empty(),this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new c.s(18,c.s.UNITMODE_PIXEL,!1),this._width=new c.s(1,c.s.UNITMODE_PERCENTAGE,!1),this._height=new c.s(1,c.s.UNITMODE_PERCENTAGE,!1),this._color="",this._style=null,this._horizontalAlignment=f.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=f.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._wasDirty=!1,this._tempParentMeasure=h.U.Empty(),this._prevCurrentMeasureTransformedIntoGlobalSpace=h.U.Empty(),this._cachedParentMeasure=h.U.Empty(),this._descendantsOnlyPadding=!1,this._paddingLeft=new c.s(0),this._paddingRight=new c.s(0),this._paddingTop=new c.s(0),this._paddingBottom=new c.s(0),this._left=new c.s(0),this._top=new c.s(0),this._scaleX=1,this._scaleY=1,this._rotation=0,this._transformCenterX=.5,this._transformCenterY=.5,this._transformMatrix=_.G.Identity(),this._invertTransformMatrix=_.G.Identity(),this._transformedPosition=s.FM.Zero(),this._isMatrixDirty=!0,this._isVisible=!0,this._isHighlighted=!1,this._highlightColor="#4affff",this._highlightLineWidth=2,this._fontSet=!1,this._dummyVector2=s.FM.Zero(),this._downCount=0,this._enterCount=-1,this._doNotRender=!1,this._downPointerIds={},this._evaluatedMeasure=new h.U(0,0,0,0),this._evaluatedParentMeasure=new h.U(0,0,0,0),this._isEnabled=!0,this._disabledColor="#9a9a9a",this._disabledColorItem="#6a6a6a",this._isReadOnly=!1,this._rebuildLayout=!1,this._customData={},this._isClipped=!1,this._automaticSize=!1,this.metadata=null,this.isHitTestVisible=!0,this.isPointerBlocker=!1,this.isFocusInvisible=!1,this.clipChildren=!0,this.clipContent=!0,this.useBitmapCache=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowBlur=0,this._previousShadowBlur=0,this._shadowColor="black",this.hoverCursor="",this._linkOffsetX=new c.s(0),this._linkOffsetY=new c.s(0),this.onWheelObservable=new r.y$,this.onPointerMoveObservable=new r.y$,this.onPointerOutObservable=new r.y$,this.onPointerDownObservable=new r.y$,this.onPointerUpObservable=new r.y$,this.onPointerClickObservable=new r.y$,this.onPointerEnterObservable=new r.y$,this.onDirtyObservable=new r.y$,this.onBeforeDrawObservable=new r.y$,this.onAfterDrawObservable=new r.y$,this.onDisposeObservable=new r.y$,this.fixedRatio=0,this._fixedRatioMasterIsWidth=!0,this.animations=null,this._tmpMeasureA=new h.U(0,0,0,0)}get isReadOnly(){return this._isReadOnly}set isReadOnly(e){this._isReadOnly=e}get transformedMeasure(){return this._evaluatedMeasure}get shadowOffsetX(){return this._shadowOffsetX}set shadowOffsetX(e){this._shadowOffsetX!==e&&(this._shadowOffsetX=e,this._markAsDirty())}get shadowOffsetY(){return this._shadowOffsetY}set shadowOffsetY(e){this._shadowOffsetY!==e&&(this._shadowOffsetY=e,this._markAsDirty())}get shadowBlur(){return this._shadowBlur}set shadowBlur(e){this._shadowBlur!==e&&(this._previousShadowBlur=this._shadowBlur,this._shadowBlur=e,this._markAsDirty())}get shadowColor(){return this._shadowColor}set shadowColor(e){this._shadowColor!==e&&(this._shadowColor=e,this._markAsDirty())}get typeName(){return this._getTypeName()}getClassName(){return this._getTypeName()}get host(){return this._host}get fontOffset(){return this._fontOffset}set fontOffset(e){this._fontOffset=e}get alpha(){return this._alpha}set alpha(e){this._alpha!==e&&(this._alphaSet=!0,this._alpha=e,this._markAsDirty())}get highlightLineWidth(){return this._highlightLineWidth}set highlightLineWidth(e){this._highlightLineWidth!==e&&(this._highlightLineWidth=e,this._markAsDirty())}get isHighlighted(){return this._isHighlighted}set isHighlighted(e){this._isHighlighted!==e&&(this._isHighlighted=e,this._markAsDirty())}get highlightColor(){return this._highlightColor}set highlightColor(e){this._highlightColor!==e&&(this._highlightColor=e,this._markAsDirty())}get scaleX(){return this._scaleX}set scaleX(e){this._scaleX!==e&&(this._scaleX=e,this._markAsDirty(),this._markMatrixAsDirty())}get scaleY(){return this._scaleY}set scaleY(e){this._scaleY!==e&&(this._scaleY=e,this._markAsDirty(),this._markMatrixAsDirty())}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._markAsDirty(),this._markMatrixAsDirty())}get transformCenterY(){return this._transformCenterY}set transformCenterY(e){this._transformCenterY!==e&&(this._transformCenterY=e,this._markAsDirty(),this._markMatrixAsDirty())}get transformCenterX(){return this._transformCenterX}set transformCenterX(e){this._transformCenterX!==e&&(this._transformCenterX=e,this._markAsDirty(),this._markMatrixAsDirty())}get horizontalAlignment(){return this._horizontalAlignment}set horizontalAlignment(e){this._horizontalAlignment!==e&&(this._horizontalAlignment=e,this._markAsDirty())}get verticalAlignment(){return this._verticalAlignment}set verticalAlignment(e){this._verticalAlignment!==e&&(this._verticalAlignment=e,this._markAsDirty())}get width(){return this._width.toString(this._host)}set width(e){this._fixedRatioMasterIsWidth=!0,this._width.toString(this._host)!==e&&this._width.fromString(e)&&this._markAsDirty()}get widthInPixels(){return this._width.getValueInPixel(this._host,this._cachedParentMeasure.width)}set widthInPixels(e){isNaN(e)||(this._fixedRatioMasterIsWidth=!0,this.width=e+"px")}get height(){return this._height.toString(this._host)}set height(e){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==e&&this._height.fromString(e)&&this._markAsDirty()}get heightInPixels(){return this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)}set heightInPixels(e){isNaN(e)||(this._fixedRatioMasterIsWidth=!1,this.height=e+"px")}get fontFamily(){return this._fontFamily}set fontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this._resetFontCache())}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this._resetFontCache())}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this._resetFontCache())}get style(){return this._style}set style(e){this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._style=e,this._style&&(this._styleObserver=this._style.onChangedObservable.add((()=>{this._markAsDirty(),this._resetFontCache()}))),this._markAsDirty(),this._resetFontCache()}get _isFontSizeInPercentage(){return this._fontSize.isPercentage}get fontSizeInPixels(){const e=this._style?this._style._fontSize:this._fontSize;return e.isPixel?e.getValue(this._host):e.getValueInPixel(this._host,this._tempParentMeasure.height||this._cachedParentMeasure.height)}set fontSizeInPixels(e){isNaN(e)||(this.fontSize=e+"px")}get fontSize(){return this._fontSize.toString(this._host)}set fontSize(e){this._fontSize.toString(this._host)!==e&&this._fontSize.fromString(e)&&(this._markAsDirty(),this._resetFontCache())}get color(){return this._color}set color(e){this._color!==e&&(this._color=e,this._markAsDirty())}get zIndex(){return this._zIndex}set zIndex(e){this.zIndex!==e&&(this._zIndex=e,this.parent&&this.parent._reOrderControl(this))}get notRenderable(){return this._doNotRender}set notRenderable(e){this._doNotRender!==e&&(this._doNotRender=e,this._markAsDirty())}get isVisible(){return this._isVisible}set isVisible(e){this._isVisible!==e&&(this._isVisible=e,this._markAsDirty(!0))}get isDirty(){return this._isDirty}get linkedMesh(){return this._linkedMesh}get descendantsOnlyPadding(){return this._descendantsOnlyPadding}set descendantsOnlyPadding(e){this._descendantsOnlyPadding!==e&&(this._descendantsOnlyPadding=e,this._markAsDirty())}get paddingLeft(){return this._paddingLeft.toString(this._host)}set paddingLeft(e){this._paddingLeft.fromString(e)&&this._markAsDirty()}get paddingLeftInPixels(){return this._paddingLeft.getValueInPixel(this._host,this._cachedParentMeasure.width)}set paddingLeftInPixels(e){isNaN(e)||(this.paddingLeft=e+"px")}get _paddingLeftInPixels(){return this._descendantsOnlyPadding?0:this.paddingLeftInPixels}get paddingRight(){return this._paddingRight.toString(this._host)}set paddingRight(e){this._paddingRight.fromString(e)&&this._markAsDirty()}get paddingRightInPixels(){return this._paddingRight.getValueInPixel(this._host,this._cachedParentMeasure.width)}set paddingRightInPixels(e){isNaN(e)||(this.paddingRight=e+"px")}get _paddingRightInPixels(){return this._descendantsOnlyPadding?0:this.paddingRightInPixels}get paddingTop(){return this._paddingTop.toString(this._host)}set paddingTop(e){this._paddingTop.fromString(e)&&this._markAsDirty()}get paddingTopInPixels(){return this._paddingTop.getValueInPixel(this._host,this._cachedParentMeasure.height)}set paddingTopInPixels(e){isNaN(e)||(this.paddingTop=e+"px")}get _paddingTopInPixels(){return this._descendantsOnlyPadding?0:this.paddingTopInPixels}get paddingBottom(){return this._paddingBottom.toString(this._host)}set paddingBottom(e){this._paddingBottom.fromString(e)&&this._markAsDirty()}get paddingBottomInPixels(){return this._paddingBottom.getValueInPixel(this._host,this._cachedParentMeasure.height)}set paddingBottomInPixels(e){isNaN(e)||(this.paddingBottom=e+"px")}get _paddingBottomInPixels(){return this._descendantsOnlyPadding?0:this.paddingBottomInPixels}get left(){return this._left.toString(this._host)}set left(e){this._left.fromString(e)&&this._markAsDirty()}get leftInPixels(){return this._left.getValueInPixel(this._host,this._cachedParentMeasure.width)}set leftInPixels(e){isNaN(e)||(this.left=e+"px")}get top(){return this._top.toString(this._host)}set top(e){this._top.fromString(e)&&this._markAsDirty()}get topInPixels(){return this._top.getValueInPixel(this._host,this._cachedParentMeasure.height)}set topInPixels(e){isNaN(e)||(this.top=e+"px")}get linkOffsetX(){return this._linkOffsetX.toString(this._host)}set linkOffsetX(e){this._linkOffsetX.fromString(e)&&this._markAsDirty()}get linkOffsetXInPixels(){return this._linkOffsetX.getValueInPixel(this._host,this._cachedParentMeasure.width)}set linkOffsetXInPixels(e){isNaN(e)||(this.linkOffsetX=e+"px")}get linkOffsetY(){return this._linkOffsetY.toString(this._host)}set linkOffsetY(e){this._linkOffsetY.fromString(e)&&this._markAsDirty()}get linkOffsetYInPixels(){return this._linkOffsetY.getValueInPixel(this._host,this._cachedParentMeasure.height)}set linkOffsetYInPixels(e){isNaN(e)||(this.linkOffsetY=e+"px")}get centerX(){return this._currentMeasure.left+this._currentMeasure.width/2}get centerY(){return this._currentMeasure.top+this._currentMeasure.height/2}get isEnabled(){return this._isEnabled}set isEnabled(e){if(this._isEnabled===e)return;this._isEnabled=e,this._markAsDirty();const t=e=>{if(e.host){for(const t in e.host._lastControlOver)e===this.host._lastControlOver[t]&&(e._onPointerOut(e,null,!0),delete e.host._lastControlOver[t]);void 0!==e.children&&e.children.forEach(t)}};t(this)}get disabledColor(){return this._disabledColor}set disabledColor(e){this._disabledColor!==e&&(this._disabledColor=e,this._markAsDirty())}get disabledColorItem(){return this._disabledColorItem}set disabledColorItem(e){this._disabledColorItem!==e&&(this._disabledColorItem=e,this._markAsDirty())}_getTypeName(){return"Control"}getAscendantOfClass(e){return this.parent?this.parent.getClassName()===e?this.parent:this.parent.getAscendantOfClass(e):null}markAsDirty(e=!1){this._markAsDirty(e)}markAllAsDirty(){this._markAllAsDirty()}_resetFontCache(){this._fontSet=!0,this._markAsDirty()}isAscendant(e){return!!this.parent&&(this.parent===e||this.parent.isAscendant(e))}getLocalCoordinates(e){const t=s.FM.Zero();return this.getLocalCoordinatesToRef(e,t),t}getLocalCoordinatesToRef(e,t){return t.x=e.x-this._currentMeasure.left,t.y=e.y-this._currentMeasure.top,this}getParentLocalCoordinates(e){const t=s.FM.Zero();return t.x=e.x-this._cachedParentMeasure.left,t.y=e.y-this._cachedParentMeasure.top,t}moveToVector3(e,t){if(!this._host||this.parent!==this._host._rootContainer)return void l.w1.Error("Cannot move a control to a vector3 if the control is not at root level");this.horizontalAlignment=f.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=f.VERTICAL_ALIGNMENT_TOP;const i=this._host._getGlobalViewport(),n=s.P.Project(e,s.y3.Identity(),t.getTransformMatrix(),i);this._moveToProjectedPosition(n),n.z<0||n.z>1?this.notRenderable=!0:this.notRenderable=!1}getDescendantsToRef(e,t=!1,i){}getDescendants(e,t){const i=new Array;return this.getDescendantsToRef(i,e,t),i}linkWithMesh(e){if(!this._host||this.parent&&this.parent!==this._host._rootContainer)return void(e&&l.w1.Error("Cannot link a control to a mesh if the control is not at root level"));const t=this._host._linkedControls.indexOf(this);if(-1!==t)return this._linkedMesh=e,void(e||this._host._linkedControls.splice(t,1));e&&(this.horizontalAlignment=f.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=f.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._host._linkedControls.push(this))}setPadding(e,t,i,n){const r=e,s=null!=t?t:r,o=null!=i?i:r,a=null!=n?n:s;this.paddingTop=r,this.paddingRight=s,this.paddingBottom=o,this.paddingLeft=a}setPaddingInPixels(e,t,i,n){const r=e,s=null!=t?t:r,o=null!=i?i:r,a=null!=n?n:s;this.paddingTopInPixels=r,this.paddingRightInPixels=s,this.paddingBottomInPixels=o,this.paddingLeftInPixels=a}_moveToProjectedPosition(e){var t;const i=this._left.getValue(this._host),n=this._top.getValue(this._host),r=null===(t=this.parent)||void 0===t?void 0:t._currentMeasure;r&&this._processMeasures(r,this._host.getContext());let s=e.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,o=e.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2;this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling&&(Math.abs(s-i)<.5&&(s=i),Math.abs(o-n)<.5&&(o=n)),this.left=s+"px",this.top=o+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0,this._markAsDirty()}_offsetLeft(e){this._isDirty=!0,this._currentMeasure.left+=e}_offsetTop(e){this._isDirty=!0,this._currentMeasure.top+=e}_markMatrixAsDirty(){this._isMatrixDirty=!0,this._flagDescendantsAsMatrixDirty()}_flagDescendantsAsMatrixDirty(){}_intersectsRect(e,t){return this._transform(t),!(this._evaluatedMeasure.left>=e.left+e.width||this._evaluatedMeasure.top>=e.top+e.height||this._evaluatedMeasure.left+this._evaluatedMeasure.width<=e.left||this._evaluatedMeasure.top+this._evaluatedMeasure.height<=e.top)}_computeAdditionnalOffsetX(){return 0}_computeAdditionnalOffsetY(){return 0}invalidateRect(){if(this._transform(),this.host&&this.host.useInvalidateRectOptimization){this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),h.U.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA);const e=this.shadowOffsetX,t=this.shadowOffsetY,i=Math.max(this._previousShadowBlur,this.shadowBlur),n=Math.min(Math.min(e,0)-2*i,0),r=Math.max(Math.max(e,0)+2*i,0),s=Math.min(Math.min(t,0)-2*i,0),o=Math.max(Math.max(t,0)+2*i,0),a=this._computeAdditionnalOffsetX(),l=this._computeAdditionnalOffsetY();this.host.invalidateRect(Math.floor(this._tmpMeasureA.left+n-a),Math.floor(this._tmpMeasureA.top+s-l),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+r+a),Math.ceil(this._tmpMeasureA.top+this._tmpMeasureA.height+o+l))}}_markAsDirty(e=!1){(this._isVisible||e)&&(this._isDirty=!0,this._markMatrixAsDirty(),this._host&&this._host.markAsDirty())}_markAllAsDirty(){this._markAsDirty(),this._font&&this._prepareFont()}_link(e){this._host=e,this._host&&(this.uniqueId=this._host.getScene().getUniqueId())}_transform(e){if(!this._isMatrixDirty&&1===this._scaleX&&1===this._scaleY&&0===this._rotation)return;const t=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,i=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top;e&&(e.translate(t,i),e.rotate(this._rotation),e.scale(this._scaleX,this._scaleY),e.translate(-t,-i)),(this._isMatrixDirty||this._cachedOffsetX!==t||this._cachedOffsetY!==i)&&(this._cachedOffsetX=t,this._cachedOffsetY=i,this._isMatrixDirty=!1,this._flagDescendantsAsMatrixDirty(),_.G.ComposeToRef(-t,-i,this._rotation,this._scaleX,this._scaleY,this.parent?this.parent._transformMatrix:null,this._transformMatrix),this._transformMatrix.invertToRef(this._invertTransformMatrix),this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure))}_renderHighlight(e){this.isHighlighted&&(e.save(),e.strokeStyle=this._highlightColor,e.lineWidth=this._highlightLineWidth,this._renderHighlightSpecific(e),e.restore())}_renderHighlightSpecific(e){e.strokeRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)}_applyStates(e){this._isFontSizeInPercentage&&(this._fontSet=!0),this._host&&this._host.useSmallestIdeal&&!this._font&&(this._fontSet=!0),this._fontSet&&(this._prepareFont(),this._fontSet=!1),this._font&&(e.font=this._font),this._color&&(e.fillStyle=this._color),f.AllowAlphaInheritance?e.globalAlpha*=this._alpha:this._alphaSet&&(e.globalAlpha=this.parent&&!this.parent.renderToIntermediateTexture?this.parent.alpha*this._alpha:this._alpha)}_layout(e,t){if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;if(this._isDirty||!this._cachedParentMeasure.isEqualsTo(e)){this.host._numLayoutCalls++,this._currentMeasure.addAndTransformToRef(this._transformMatrix,0|-this._paddingLeftInPixels,0|-this._paddingTopInPixels,0|this._paddingRightInPixels,0|this._paddingBottomInPixels,this._prevCurrentMeasureTransformedIntoGlobalSpace),t.save(),this._applyStates(t);let i=0;do{this._rebuildLayout=!1,this._processMeasures(e,t),i++}while(this._rebuildLayout&&i<3);i>=3&&a.Y.Error(`Layout cycle detected in GUI (Control name=${this.name}, uniqueId=${this.uniqueId})`),t.restore(),this.invalidateRect(),this._evaluateClippingState(e)}return this._wasDirty=this._isDirty,this._isDirty=!1,!0}_processMeasures(e,t){this._tempPaddingMeasure.copyFrom(e),this.parent&&this.parent.descendantsOnlyPadding&&(this._tempPaddingMeasure.left+=this.parent.paddingLeftInPixels,this._tempPaddingMeasure.top+=this.parent.paddingTopInPixels,this._tempPaddingMeasure.width-=this.parent.paddingLeftInPixels+this.parent.paddingRightInPixels,this._tempPaddingMeasure.height-=this.parent.paddingTopInPixels+this.parent.paddingBottomInPixels),this._currentMeasure.copyFrom(this._tempPaddingMeasure),this._preMeasure(this._tempPaddingMeasure,t),this._measure(),this._computeAlignment(this._tempPaddingMeasure,t),this._currentMeasure.left=0|this._currentMeasure.left,this._currentMeasure.top=0|this._currentMeasure.top,this._currentMeasure.width=0|this._currentMeasure.width,this._currentMeasure.height=0|this._currentMeasure.height,this._additionalProcessing(this._tempPaddingMeasure,t),this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure),this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)}_evaluateClippingState(e){if(this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.parent&&this.parent.clipChildren){if(e.transformToRef(this.parent._transformMatrix,this._evaluatedParentMeasure),this._evaluatedMeasure.left>this._evaluatedParentMeasure.left+this._evaluatedParentMeasure.width)return void(this._isClipped=!0);if(this._evaluatedMeasure.left+this._evaluatedMeasure.widththis._evaluatedParentMeasure.top+this._evaluatedParentMeasure.height)return void(this._isClipped=!0);if(this._evaluatedMeasure.top+this._evaluatedMeasure.heightthis._currentMeasure.left+this._currentMeasure.width||tthis._currentMeasure.top+this._currentMeasure.height||(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),0))}_processPicking(e,t,i,n,r,s,o,a){return!(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this._doNotRender||!this.contains(e,t)||(this._processObservables(n,e,t,i,r,s,o,a),0))}_onPointerMove(e,t,i,n){this.onPointerMoveObservable.notifyObservers(t,-1,e,this,n)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerMove(e,t,i,n)}_onPointerEnter(e,t){return!!this._isEnabled&&(!(this._enterCount>0)&&(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,e,this,t)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerEnter(e,t),!0))}_onPointerOut(e,t,i=!1){if(!(i||this._isEnabled&&e!==this))return;this._enterCount=0;let n=!0;e.isAscendant(this)||(n=this.onPointerOutObservable.notifyObservers(this,-1,e,this,t)),n&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerOut(e,t,i)}_onPointerDown(e,t,i,n,r){return this._onPointerEnter(this,r),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new _.N(t,n),-1,e,this,r)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerDown(e,t,i,n,r),r&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.add(r.event.pointerId),!0)}_onPointerUp(e,t,i,n,r,s){if(!this._isEnabled)return;this._downCount=0,delete this._downPointerIds[i];let o=r;r&&(this._enterCount>0||-1===this._enterCount)&&(o=this.onPointerClickObservable.notifyObservers(new _.N(t,n),-1,e,this,s)),this.onPointerUpObservable.notifyObservers(new _.N(t,n),-1,e,this,s)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerUp(e,t,i,n,o,s),s&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.delete(s.event.pointerId)}_forcePointerUp(e=null){if(null!==e)this._onPointerUp(this,s.FM.Zero(),e,0,!0);else for(const e in this._downPointerIds)this._onPointerUp(this,s.FM.Zero(),+e,0,!0)}_onWheelScroll(e,t){this._isEnabled&&this.onWheelObservable.notifyObservers(new s.FM(e,t))&&null!=this.parent&&this.parent._onWheelScroll(e,t)}_onCanvasBlur(){}_processObservables(e,t,i,n,r,s,a,l){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(t,i),e===o.kD.POINTERMOVE){this._onPointerMove(this,this._dummyVector2,r,n);const e=this._host._lastControlOver[r];return e&&e!==this&&e._onPointerOut(this,n),e!==this&&this._onPointerEnter(this,n),this._host._lastControlOver[r]=this,!0}return e===o.kD.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,r,s,n),this._host._registerLastControlDown(this,r),this._host._lastPickedControl=this,!0):e===o.kD.POINTERUP?(this._host._lastControlDown[r]&&this._host._lastControlDown[r]._onPointerUp(this,this._dummyVector2,r,s,!0,n),delete this._host._lastControlDown[r],!0):!(e!==o.kD.POINTERWHEEL||!this._host._lastControlOver[r]||(this._host._lastControlOver[r]._onWheelScroll(a,l),0))}_prepareFont(){(this._font||this._fontSet)&&(this._style?this._font=this._style.fontStyle+" "+this._style.fontWeight+" "+this.fontSizeInPixels+"px "+this._style.fontFamily:this._font=this._fontStyle+" "+this._fontWeight+" "+this.fontSizeInPixels+"px "+this._fontFamily,this._fontOffset=f._GetFontOffset(this._font),this.getDescendants().forEach((e=>e._markAllAsDirty())))}serialize(e){u.p4.Serialize(this,e),e.name=this.name,e.className=this.getClassName(),this._font&&(e.fontFamily=this._fontFamily,e.fontSize=this.fontSize,e.fontWeight=this.fontWeight,e.fontStyle=this.fontStyle),u.p4.AppendSerializedAnimations(this,e)}_parseFromContent(e,t){if(e.fontFamily&&(this.fontFamily=e.fontFamily),e.fontSize&&(this.fontSize=e.fontSize),e.fontWeight&&(this.fontWeight=e.fontWeight),e.fontStyle&&(this.fontStyle=e.fontStyle),e.animations){this.animations=[];for(let t=0;t-1&&this.linkWithMesh(null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()}static get HORIZONTAL_ALIGNMENT_LEFT(){return f._HORIZONTAL_ALIGNMENT_LEFT}static get HORIZONTAL_ALIGNMENT_RIGHT(){return f._HORIZONTAL_ALIGNMENT_RIGHT}static get HORIZONTAL_ALIGNMENT_CENTER(){return f._HORIZONTAL_ALIGNMENT_CENTER}static get VERTICAL_ALIGNMENT_TOP(){return f._VERTICAL_ALIGNMENT_TOP}static get VERTICAL_ALIGNMENT_BOTTOM(){return f._VERTICAL_ALIGNMENT_BOTTOM}static get VERTICAL_ALIGNMENT_CENTER(){return f._VERTICAL_ALIGNMENT_CENTER}static _GetFontOffset(e){if(f._FontHeightSizes[e])return f._FontHeightSizes[e];const t=p.l.LastCreatedEngine;if(!t)throw new Error("Invalid engine. Unable to create a canvas.");const i=t.getFontOffset(e);return f._FontHeightSizes[e]=i,i}static Parse(e,t){const i=l.w1.Instantiate("BABYLON.GUI."+e.className),n=u.p4.Parse((()=>new i),e,null);return n.name=e.name,n._parseFromContent(e,t),n}static drawEllipse(e,t,i,n,r){r.translate(e,t),r.scale(i,n),r.beginPath(),r.arc(0,0,1,0,2*Math.PI),r.closePath(),r.scale(1/i,1/n),r.translate(-e,-t)}}f.AllowAlphaInheritance=!1,f._ClipMeasure=new h.U(0,0,0,0),f._HORIZONTAL_ALIGNMENT_LEFT=0,f._HORIZONTAL_ALIGNMENT_RIGHT=1,f._HORIZONTAL_ALIGNMENT_CENTER=2,f._VERTICAL_ALIGNMENT_TOP=0,f._VERTICAL_ALIGNMENT_BOTTOM=1,f._VERTICAL_ALIGNMENT_CENTER=2,f._FontHeightSizes={},f.AddHeader=()=>{},(0,n.gn)([(0,u.qC)()],f.prototype,"metadata",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"isHitTestVisible",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"isPointerBlocker",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"isFocusInvisible",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"clipChildren",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"clipContent",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"useBitmapCache",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"shadowOffsetX",null),(0,n.gn)([(0,u.qC)()],f.prototype,"shadowOffsetY",null),(0,n.gn)([(0,u.qC)()],f.prototype,"shadowBlur",null),(0,n.gn)([(0,u.qC)()],f.prototype,"shadowColor",null),(0,n.gn)([(0,u.qC)()],f.prototype,"hoverCursor",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"fontOffset",null),(0,n.gn)([(0,u.qC)()],f.prototype,"alpha",null),(0,n.gn)([(0,u.qC)()],f.prototype,"scaleX",null),(0,n.gn)([(0,u.qC)()],f.prototype,"scaleY",null),(0,n.gn)([(0,u.qC)()],f.prototype,"rotation",null),(0,n.gn)([(0,u.qC)()],f.prototype,"transformCenterY",null),(0,n.gn)([(0,u.qC)()],f.prototype,"transformCenterX",null),(0,n.gn)([(0,u.qC)()],f.prototype,"horizontalAlignment",null),(0,n.gn)([(0,u.qC)()],f.prototype,"verticalAlignment",null),(0,n.gn)([(0,u.qC)()],f.prototype,"fixedRatio",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"width",null),(0,n.gn)([(0,u.qC)()],f.prototype,"height",null),(0,n.gn)([(0,u.qC)()],f.prototype,"style",null),(0,n.gn)([(0,u.qC)()],f.prototype,"color",null),(0,n.gn)([(0,u.qC)()],f.prototype,"zIndex",null),(0,n.gn)([(0,u.qC)()],f.prototype,"notRenderable",null),(0,n.gn)([(0,u.qC)()],f.prototype,"isVisible",null),(0,n.gn)([(0,u.qC)()],f.prototype,"descendantsOnlyPadding",null),(0,n.gn)([(0,u.qC)()],f.prototype,"paddingLeft",null),(0,n.gn)([(0,u.qC)()],f.prototype,"paddingRight",null),(0,n.gn)([(0,u.qC)()],f.prototype,"paddingTop",null),(0,n.gn)([(0,u.qC)()],f.prototype,"paddingBottom",null),(0,n.gn)([(0,u.qC)()],f.prototype,"left",null),(0,n.gn)([(0,u.qC)()],f.prototype,"top",null),(0,n.gn)([(0,u.qC)()],f.prototype,"linkOffsetX",null),(0,n.gn)([(0,u.qC)()],f.prototype,"linkOffsetY",null),(0,n.gn)([(0,u.qC)()],f.prototype,"isEnabled",null),(0,n.gn)([(0,u.qC)()],f.prototype,"disabledColor",null),(0,n.gn)([(0,u.qC)()],f.prototype,"disabledColorItem",null),(0,n.gn)([(0,u.qC)()],f.prototype,"overlapGroup",void 0),(0,n.gn)([(0,u.qC)()],f.prototype,"overlapDeltaMultiplier",void 0),(0,d.H)("BABYLON.GUI.Control",f)},"../../../node_modules/@babylonjs/gui/2D/controls/grid.js":function(e,t,i){"use strict";i.d(t,{r:function(){return l}});var n=i("../../../node_modules/@babylonjs/gui/2D/controls/container.js"),r=i("../../../node_modules/@babylonjs/gui/2D/valueAndUnit.js"),s=i("../../../node_modules/@babylonjs/gui/2D/controls/control.js"),o=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class l extends n.W{constructor(e){super(e),this.name=e,this._rowDefinitions=new Array,this._rowDefinitionObservers=[],this._columnDefinitions=new Array,this._columnDefinitionObservers=[],this._cells={},this._childControls=new Array}get columnCount(){return this._columnDefinitions.length}get rowCount(){return this._rowDefinitions.length}get children(){return this._childControls}get cells(){return this._cells}getRowDefinition(e){return e<0||e>=this._rowDefinitions.length?null:this._rowDefinitions[e]}getColumnDefinition(e){return e<0||e>=this._columnDefinitions.length?null:this._columnDefinitions[e]}addRowDefinition(e,t=!1){return this._rowDefinitions.push(new r.s(e,t?r.s.UNITMODE_PIXEL:r.s.UNITMODE_PERCENTAGE)),this._rowDefinitionObservers.push(this._rowDefinitions[this.rowCount-1].onChangedObservable.add((()=>this._markAsDirty()))),this._markAsDirty(),this}addColumnDefinition(e,t=!1){return this._columnDefinitions.push(new r.s(e,t?r.s.UNITMODE_PIXEL:r.s.UNITMODE_PERCENTAGE)),this._columnDefinitionObservers.push(this._columnDefinitions[this.columnCount-1].onChangedObservable.add((()=>this._markAsDirty()))),this._markAsDirty(),this}setRowDefinition(e,t,i=!1){if(e<0||e>=this._rowDefinitions.length)return this;const n=this._rowDefinitions[e];return n&&n.isPixel===i&&n.value===t||(this._rowDefinitions[e].onChangedObservable.remove(this._rowDefinitionObservers[e]),this._rowDefinitions[e]=new r.s(t,i?r.s.UNITMODE_PIXEL:r.s.UNITMODE_PERCENTAGE),this._rowDefinitionObservers[e]=this._rowDefinitions[e].onChangedObservable.add((()=>this._markAsDirty())),this._markAsDirty()),this}setColumnDefinition(e,t,i=!1){if(e<0||e>=this._columnDefinitions.length)return this;const n=this._columnDefinitions[e];return n&&n.isPixel===i&&n.value===t||(this._columnDefinitions[e].onChangedObservable.remove(this._columnDefinitionObservers[e]),this._columnDefinitions[e]=new r.s(t,i?r.s.UNITMODE_PIXEL:r.s.UNITMODE_PERCENTAGE),this._columnDefinitionObservers[e]=this._columnDefinitions[e].onChangedObservable.add((()=>this._markAsDirty())),this._markAsDirty()),this}getChildrenAt(e,t){const i=this._cells[`${e}:${t}`];return i?i.children:null}getChildCellInfo(e){return e._tag}_removeCell(e,t){if(e){super.removeControl(e);for(const t of e.children){const e=this._childControls.indexOf(t);-1!==e&&this._childControls.splice(e,1)}delete this._cells[t]}}_offsetCell(e,t){if(this._cells[t]){this._cells[e]=this._cells[t];for(const t of this._cells[e].children)t._tag=e;delete this._cells[t]}}removeColumnDefinition(e){if(e<0||e>=this._columnDefinitions.length)return this;for(let t=0;t=this._rowDefinitions.length)return this;for(let t=0;t{for(const r in this._cells){if(!Object.prototype.hasOwnProperty.call(this._cells,r))continue;const s=r.split(":"),o=parseInt(s[0]),a=parseInt(s[1]),l=this._cells[r];l.left=e[a]+"px",l.top=t[o]+"px",l.width=i[a]+"px",l.height=n[o]+"px",l._left.ignoreAdaptiveScaling=!0,l._top.ignoreAdaptiveScaling=!0,l._width.ignoreAdaptiveScaling=!0,l._height.ignoreAdaptiveScaling=!0}})),super._additionalProcessing(e,t)}_flagDescendantsAsMatrixDirty(){for(const e in this._cells)Object.prototype.hasOwnProperty.call(this._cells,e)&&this._cells[e]._markMatrixAsDirty()}_renderHighlightSpecific(e){super._renderHighlightSpecific(e),this._getGridDefinitions(((t,i,n,r)=>{for(let i=0;i{e.tags.push(t._tag)}))}_parseFromContent(e,t){super._parseFromContent(e,t);const i=[];this.children.forEach((e=>{i.push(e)})),this.removeRowDefinition(0),this.removeColumnDefinition(0);for(let t=0;t{this._rotate90SourceProperties(e,t,i),this._markAsDirty()})))}_rotate90SourceProperties(e,t,i){let n=e.sourceLeft,r=e.sourceTop,s=e.domImage.width,o=e.domImage.height,a=n,l=r,c=e.sourceWidth,h=e.sourceHeight;if(0!=i){const e=i<0?-1:1;i%=4;for(let t=0;t127&&-1===this._sliceLeft)this._sliceLeft=e;else if(t<127&&this._sliceLeft>-1){this._sliceRight=e;break}}this._sliceTop=-1,this._sliceBottom=-1;for(let e=0;e127&&-1===this._sliceTop)this._sliceTop=e;else if(t<127&&this._sliceTop>-1){this._sliceBottom=e;break}}}set domImage(e){this._domImage=e,this._loaded=!1,this._imageDataCache.data=null,this._domImage.width?this._onImageLoaded():this._domImage.onload=()=>{this._onImageLoaded()}}get domImage(){return this._domImage}_onImageLoaded(){this._imageDataCache.data=null,this._imageWidth=this._domImage.width,this._imageHeight=this._domImage.height,this._loaded=!0,this._populateNinePatchSlicesFromImage&&this._extractNinePatchSliceDataFromImage(),this._autoScale&&this.synchronizeSizeWithContent(),this.onImageLoadedObservable.notifyObservers(this),this._markAsDirty()}get source(){return this._source}set source(e){var t,i;if(this._source===e)return;this._loaded=!1,this._source=e,this._imageDataCache.data=null,e&&(e=this._svgCheck(e));const n=(null===(i=null===(t=this._host)||void 0===t?void 0:t.getScene())||void 0===i?void 0:i.getEngine())||c.l.LastCreatedEngine;if(!n)throw new Error("Invalid engine. Unable to create a canvas.");this._domImage=n.createCanvasImage(),this._domImage.onload=()=>{this._onImageLoaded()},e&&(s.w1.SetCorsBehavior(e,this._domImage),s.w1.SetReferrerPolicyBehavior(this.referrerPolicy,this._domImage),this._domImage.src=e)}_svgCheck(e){if(window.SVGSVGElement&&-1!==e.search(/.svg#/gi)&&e.indexOf("#")===e.lastIndexOf("#")){this._isSVG=!0;const t=e.split("#")[0],i=e.split("#")[1],n=document.body.querySelector('object[data="'+t+'"]');if(n){const t=n.contentDocument;if(t&&t.documentElement){const r=t.documentElement.getAttribute("viewBox"),s=Number(t.documentElement.getAttribute("width")),o=Number(t.documentElement.getAttribute("height"));if(t.getElementById(i)&&r&&s&&o)return this._getSVGAttribs(n,i),e}n.addEventListener("load",(()=>{this._getSVGAttribs(n,i)}))}else{const e=document.createElement("object");e.data=t,e.type="image/svg+xml",e.width="0%",e.height="0%",document.body.appendChild(e),e.onload=()=>{const e=document.body.querySelector('object[data="'+t+'"]');e&&this._getSVGAttribs(e,i)}}return t}return e}_getSVGAttribs(e,t){const i=e.contentDocument;if(i&&i.documentElement){const e=i.documentElement.getAttribute("viewBox"),n=Number(i.documentElement.getAttribute("width")),r=Number(i.documentElement.getAttribute("height")),s=i.getElementById(t);if(e&&n&&r&&s){const t=Number(e.split(" ")[2]),i=Number(e.split(" ")[3]),o=s.getBBox();let a=1,l=1,c=0,h=0;const _=s.transform.baseVal.consolidate().matrix;s.transform&&s.transform.baseVal.consolidate()&&(a=_.a,l=_.d,c=_.e,h=_.f),this.sourceLeft=(a*o.x+c)*n/t,this.sourceTop=(l*o.y+h)*r/i,this.sourceWidth=o.width*a*(n/t),this.sourceHeight=o.height*l*(r/i),this._svgAttributesComputationCompleted=!0,this.onSVGAttributesComputedObservable.notifyObservers(this)}}}get cellWidth(){return this._cellWidth}set cellWidth(e){this._cellWidth!==e&&(this._cellWidth=e,this._markAsDirty())}get cellHeight(){return this._cellHeight}set cellHeight(e){this._cellHeight!==e&&(this._cellHeight=e,this._markAsDirty())}get cellId(){return this._cellId}set cellId(e){this._cellId!==e&&(this._cellId=e,this._markAsDirty())}contains(e,t){if(!super.contains(e,t))return!1;if(!this._detectPointerOnOpaqueOnly||!this._workingCanvas)return!0;const i=0|this._currentMeasure.width,n=0|this._currentMeasure.height,r=i+"_"+n;let s=this._imageDataCache.data;if(!s||this._imageDataCache.key!==r){const e=this._workingCanvas.getContext("2d");this._imageDataCache.data=s=e.getImageData(0,0,i,n).data,this._imageDataCache.key=r}return s[4*((e=e-this._currentMeasure.left|0)+(t=t-this._currentMeasure.top|0)*i)+3]>0}_getTypeName(){return"Image"}synchronizeSizeWithContent(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")}_processMeasures(e,t){if(this._loaded)switch(this._stretch){case h.STRETCH_NONE:case h.STRETCH_FILL:case h.STRETCH_UNIFORM:case h.STRETCH_NINE_PATCH:break;case h.STRETCH_EXTEND:this._autoScale&&this.synchronizeSizeWithContent(),this.parent&&this.parent.parent&&(this.parent.adaptWidthToChildren=!0,this.parent.adaptHeightToChildren=!0)}super._processMeasures(e,t)}_prepareWorkingCanvasForOpaqueDetection(){var e,t;if(!this._detectPointerOnOpaqueOnly)return;const i=this._currentMeasure.width,n=this._currentMeasure.height;if(!this._workingCanvas){const r=(null===(t=null===(e=this._host)||void 0===e?void 0:e.getScene())||void 0===t?void 0:t.getEngine())||c.l.LastCreatedEngine;if(!r)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=r.createCanvas(i,n)}this._workingCanvas.getContext("2d").clearRect(0,0,i,n)}_drawImage(e,t,i,n,r,s,o,a,l){e.drawImage(this._domImage,t,i,n,r,s,o,a,l),this._detectPointerOnOpaqueOnly&&(e=this._workingCanvas.getContext("2d")).drawImage(this._domImage,t,i,n,r,s-this._currentMeasure.left,o-this._currentMeasure.top,a,l)}_draw(e){let t,i,n,r;if(e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),-1==this.cellId)t=this._sourceLeft,i=this._sourceTop,n=this._sourceWidth?this._sourceWidth:this._imageWidth,r=this._sourceHeight?this._sourceHeight:this._imageHeight;else{const e=this._domImage.naturalWidth/this.cellWidth,s=this.cellId/e>>0,o=this.cellId%e;t=this.cellWidth*o,i=this.cellHeight*s,n=this.cellWidth,r=this.cellHeight}if(this._prepareWorkingCanvasForOpaqueDetection(),this._applyStates(e),this._loaded)switch(this._stretch){case h.STRETCH_NONE:case h.STRETCH_FILL:this._drawImage(e,t,i,n,r,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case h.STRETCH_UNIFORM:{const s=this._currentMeasure.width/n,o=this._currentMeasure.height/r,a=Math.min(s,o),l=(this._currentMeasure.width-n*a)/2,c=(this._currentMeasure.height-r*a)/2;this._drawImage(e,t,i,n,r,this._currentMeasure.left+l,this._currentMeasure.top+c,n*a,r*a);break}case h.STRETCH_EXTEND:this._drawImage(e,t,i,n,r,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case h.STRETCH_NINE_PATCH:this._renderNinePatch(e)}e.restore()}_renderNinePatch(e){const t=this._sliceLeft,i=this._sliceTop,n=this._imageHeight-this._sliceBottom,r=this._imageWidth-this._sliceRight,s=this._sliceRight-this._sliceLeft,o=this._sliceBottom-this._sliceTop,a=this._currentMeasure.width-r-t+2,l=this._currentMeasure.height-n-i+2,c=this._currentMeasure.left+t-1,h=this._currentMeasure.top+i-1,_=this._currentMeasure.left+this._currentMeasure.width-r,d=this._currentMeasure.top+this._currentMeasure.height-n;this._drawImage(e,0,0,t,i,this._currentMeasure.left,this._currentMeasure.top,t,i),e.clearRect(c,this._currentMeasure.top,a,i),this._drawImage(e,this._sliceLeft,0,s,i,c,this._currentMeasure.top,a,i),e.clearRect(_,this._currentMeasure.top,r,i),this._drawImage(e,this._sliceRight,0,r,i,_,this._currentMeasure.top,r,i),e.clearRect(this._currentMeasure.left,h,t,l),this._drawImage(e,0,this._sliceTop,t,o,this._currentMeasure.left,h,t,l),e.clearRect(c,h,a,l),this._drawImage(e,this._sliceLeft,this._sliceTop,s,o,c,h,a,l),e.clearRect(_,h,r,l),this._drawImage(e,this._sliceRight,this._sliceTop,r,o,_,h,r,l),e.clearRect(this._currentMeasure.left,d,t,n),this._drawImage(e,0,this._sliceBottom,t,n,this._currentMeasure.left,d,t,n),e.clearRect(c,d,a,n),this._drawImage(e,this.sliceLeft,this._sliceBottom,s,n,c,d,a,n),e.clearRect(_,d,r,n),this._drawImage(e,this._sliceRight,this._sliceBottom,r,n,_,d,r,n)}dispose(){super.dispose(),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear()}}h.STRETCH_NONE=0,h.STRETCH_FILL=1,h.STRETCH_UNIFORM=2,h.STRETCH_EXTEND=3,h.STRETCH_NINE_PATCH=4,(0,n.gn)([(0,l.qC)()],h.prototype,"detectPointerOnOpaqueOnly",null),(0,n.gn)([(0,l.qC)()],h.prototype,"sliceLeft",null),(0,n.gn)([(0,l.qC)()],h.prototype,"sliceRight",null),(0,n.gn)([(0,l.qC)()],h.prototype,"sliceTop",null),(0,n.gn)([(0,l.qC)()],h.prototype,"sliceBottom",null),(0,n.gn)([(0,l.qC)()],h.prototype,"sourceLeft",null),(0,n.gn)([(0,l.qC)()],h.prototype,"sourceTop",null),(0,n.gn)([(0,l.qC)()],h.prototype,"sourceWidth",null),(0,n.gn)([(0,l.qC)()],h.prototype,"sourceHeight",null),(0,n.gn)([(0,l.qC)()],h.prototype,"populateNinePatchSlicesFromImage",null),(0,n.gn)([(0,l.qC)()],h.prototype,"autoScale",null),(0,n.gn)([(0,l.qC)()],h.prototype,"stretch",null),(0,n.gn)([(0,l.qC)()],h.prototype,"source",null),(0,n.gn)([(0,l.qC)()],h.prototype,"cellWidth",null),(0,n.gn)([(0,l.qC)()],h.prototype,"cellHeight",null),(0,n.gn)([(0,l.qC)()],h.prototype,"cellId",null),(0,a.H)("BABYLON.GUI.Image",h)},"../../../node_modules/@babylonjs/gui/2D/controls/rectangle.js":function(e,t,i){"use strict";i.d(t,{A:function(){return a}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/gui/2D/controls/container.js"),s=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),o=i("../../../node_modules/@babylonjs/core/Misc/decorators.js");class a extends r.W{constructor(e){super(e),this.name=e,this._thickness=1,this._cornerRadius=0}get thickness(){return this._thickness}set thickness(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())}get cornerRadius(){return this._cornerRadius}set cornerRadius(e){e<0&&(e=0),this._cornerRadius!==e&&(this._cornerRadius=e,this._markAsDirty())}_getTypeName(){return"Rectangle"}_computeAdditionnalOffsetX(){return this._cornerRadius?1:0}_computeAdditionnalOffsetY(){return this._cornerRadius?1:0}_localDraw(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._background&&(e.fillStyle="Button"===this.typeName?this.isEnabled?this._background:this.disabledColor:this._background,this._cornerRadius?(this._drawRoundedRect(e,this._thickness/2),e.fill()):e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(e,this._thickness/2),e.stroke()):e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),e.restore()}_additionalProcessing(e,t){super._additionalProcessing(e,t),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness}_drawRoundedRect(e,t=0){const i=this._currentMeasure.left+t,n=this._currentMeasure.top+t,r=this._currentMeasure.width-2*t,s=this._currentMeasure.height-2*t;let o=Math.min(s/2,Math.min(r/2,this._cornerRadius));o=Math.abs(o),e.beginPath(),e.moveTo(i+o,n),e.lineTo(i+r-o,n),e.arc(i+r-o,n+o,o,3*Math.PI/2,2*Math.PI),e.lineTo(i+r,n+s-o),e.arc(i+r-o,n+s-o,o,0,Math.PI/2),e.lineTo(i+o,n+s),e.arc(i+o,n+s-o,o,Math.PI/2,Math.PI),e.lineTo(i,n+o),e.arc(i+o,n+o,o,Math.PI,3*Math.PI/2),e.closePath()}_clipForChildren(e){this._cornerRadius&&(this._drawRoundedRect(e,this._thickness),e.clip())}}(0,n.gn)([(0,o.qC)()],a.prototype,"thickness",null),(0,n.gn)([(0,o.qC)()],a.prototype,"cornerRadius",null),(0,s.H)("BABYLON.GUI.Rectangle",a)},"../../../node_modules/@babylonjs/gui/2D/controls/stackPanel.js":function(e,t,i){"use strict";i.d(t,{e:function(){return c}});var n=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),r=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),s=i("../../../node_modules/@babylonjs/gui/2D/controls/container.js"),o=i("../../../node_modules/@babylonjs/gui/2D/controls/control.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),l=i("../../../node_modules/@babylonjs/core/Misc/decorators.js");class c extends s.W{constructor(e){super(e),this.name=e,this._isVertical=!0,this._manualWidth=!1,this._manualHeight=!1,this._doNotTrackManualChanges=!1,this._spacing=0,this.ignoreLayoutWarnings=!1}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical!==e&&(this._isVertical=e,this._markAsDirty())}get spacing(){return this._spacing}set spacing(e){this._spacing!==e&&(this._spacing=e,this._markAsDirty())}set width(e){this._doNotTrackManualChanges||(this._manualWidth=!0),this._width.toString(this._host)!==e&&this._width.fromString(e)&&this._markAsDirty()}get width(){return this._width.toString(this._host)}set height(e){this._doNotTrackManualChanges||(this._manualHeight=!0),this._height.toString(this._host)!==e&&this._height.fromString(e)&&this._markAsDirty()}get height(){return this._height.toString(this._host)}_getTypeName(){return"StackPanel"}_preMeasure(e,t){for(const e of this._children)this._isVertical?e.verticalAlignment=o.o.VERTICAL_ALIGNMENT_TOP:e.horizontalAlignment=o.o.HORIZONTAL_ALIGNMENT_LEFT;super._preMeasure(e,t)}_additionalProcessing(e,t){super._additionalProcessing(e,t),this._measureForChildren.copyFrom(e),this._measureForChildren.left=this._currentMeasure.left,this._measureForChildren.top=this._currentMeasure.top,this.isVertical&&!this._manualWidth||(this._measureForChildren.width=this._currentMeasure.width),(this.isVertical||this._manualHeight)&&(this._measureForChildren.height=this._currentMeasure.height)}_postMeasure(){let e=0,t=0;const i=this._children.length;for(let n=0;ni&&(i=t.width)}if(this._resizeToFit){if(this._textWrapping===n.Clip){const e=this._paddingLeftInPixels+this._paddingRightInPixels+i|0;e!==this._width.internalValue&&(this._width.updateInPlace(e,o.s.UNITMODE_PIXEL),this._rebuildLayout=!0)}let e=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*this._lines.length|0;if(this._lines.length>0&&0!==this._lineSpacing.internalValue){let t=0;t=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),e+=(this._lines.length-1)*t}e!==this._height.internalValue&&(this._height.updateInPlace(e,o.s.UNITMODE_PIXEL),this._rebuildLayout=!0)}}_drawText(e,t,i,n){const r=this._currentMeasure.width;let s=0;switch(this._textHorizontalAlignment){case a.o.HORIZONTAL_ALIGNMENT_LEFT:s=0;break;case a.o.HORIZONTAL_ALIGNMENT_RIGHT:s=r-t;break;case a.o.HORIZONTAL_ALIGNMENT_CENTER:s=(r-t)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&n.strokeText(e,this._currentMeasure.left+s,i),n.fillText(e,this._currentMeasure.left+s,i),this._underline&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+s,i+3),n.lineTo(this._currentMeasure.left+s+t,i+3),n.stroke(),n.closePath()),this._lineThrough&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+s,i-this.fontSizeInPixels/3),n.lineTo(this._currentMeasure.left+s+t,i-this.fontSizeInPixels/3),n.stroke(),n.closePath())}_draw(e){e.save(),this._applyStates(e),this._renderLines(e),e.restore()}_applyStates(e){super._applyStates(e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor,e.lineJoin="miter",e.miterLimit=2)}_breakLines(e,t,i){const r=[],s=this.text.split("\n");if(this._textWrapping===n.Ellipsis)for(const t of s)r.push(this._parseLineEllipsis(t,e,i));else if(this._textWrapping===n.WordWrap)for(const t of s)r.push(...this._parseLineWordWrap(t,e,i));else if(this._textWrapping===n.WordWrapEllipsis)for(const n of s)r.push(...this._parseLineWordWrapEllipsis(n,e,t,i));else for(const e of s)r.push(this._parseLine(e,i));return r}_parseLine(e="",t){return{text:e,width:this._getTextMetricsWidth(t.measureText(e))}}_getCharsToRemove(e,t,i){const n=e>t?e-t:0,r=e/i;return Math.max(Math.floor(n/r),1)}_parseLineEllipsis(e="",t,i){let n=this._getTextMetricsWidth(i.measureText(e)),r=this._getCharsToRemove(n,t,e.length);const s=Array.from&&Array.from(e);if(s)for(;s.length&&n>t;)s.splice(s.length-r,r),e=`${s.join("")}…`,n=this._getTextMetricsWidth(i.measureText(e)),r=this._getCharsToRemove(n,t,e.length);else{for(;e.length>2&&n>t;)e=e.slice(0,-r),n=this._getTextMetricsWidth(i.measureText(e+"…")),r=this._getCharsToRemove(n,t,e.length);e+="…"}return{text:e,width:n}}_getTextMetricsWidth(e){return void 0!==e.actualBoundingBoxLeft?Math.abs(e.actualBoundingBoxLeft)+Math.abs(e.actualBoundingBoxRight):e.width}_parseLineWordWrap(e="",t,i){const n=[],r=this.wordSplittingFunction?this.wordSplittingFunction(e):e.split(this._wordDivider);let s=this._getTextMetricsWidth(i.measureText(e));for(let o=0;o0?e+this._wordDivider+r[o]:r[0],l=this._getTextMetricsWidth(i.measureText(a));l>t&&o>0?(n.push({text:e,width:s}),e=r[o],s=this._getTextMetricsWidth(i.measureText(e))):(s=l,e=a)}return n.push({text:e,width:s}),n}_parseLineWordWrapEllipsis(e="",t,i,n){const r=this._parseLineWordWrap(e,t,n);for(let e=1;e<=r.length;e++)if(this._computeHeightForLinesOf(e)>i&&e>1){const i=r[e-2],s=r[e-1];r[e-2]=this._parseLineEllipsis(`${i.text+s.text}`,t,n);const o=r.length-e+1;for(let e=0;e0&&0!==this._lineSpacing.internalValue){let i=0;i=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),t+=(e-1)*i}return t}computeExpectedHeight(){var e;if(this.text&&this.widthInPixels){const t=null===(e=h.l.LastCreatedEngine)||void 0===e?void 0:e.createCanvas(0,0).getContext("2d");if(t){this._applyStates(t),this._fontOffset||(this._fontOffset=a.o._GetFontOffset(t.font));const e=this._lines?this._lines:this._breakLines(this.widthInPixels-this._paddingLeftInPixels-this._paddingRightInPixels,this.heightInPixels-this._paddingTopInPixels-this._paddingBottomInPixels,t);return this._computeHeightForLinesOf(e.length)}}return 0}dispose(){super.dispose(),this.onTextChangedObservable.clear()}}(0,r.gn)([(0,c.qC)()],_.prototype,"resizeToFit",null),(0,r.gn)([(0,c.qC)()],_.prototype,"textWrapping",null),(0,r.gn)([(0,c.qC)()],_.prototype,"text",null),(0,r.gn)([(0,c.qC)()],_.prototype,"textHorizontalAlignment",null),(0,r.gn)([(0,c.qC)()],_.prototype,"textVerticalAlignment",null),(0,r.gn)([(0,c.qC)()],_.prototype,"lineSpacing",null),(0,r.gn)([(0,c.qC)()],_.prototype,"outlineWidth",null),(0,r.gn)([(0,c.qC)()],_.prototype,"underline",null),(0,r.gn)([(0,c.qC)()],_.prototype,"lineThrough",null),(0,r.gn)([(0,c.qC)()],_.prototype,"outlineColor",null),(0,r.gn)([(0,c.qC)()],_.prototype,"wordDivider",null),(0,l.H)("BABYLON.GUI.TextBlock",_)},"../../../node_modules/@babylonjs/gui/2D/index.js":function(e,t,i){"use strict";i.d(t,{in:function(){return H.i},zx:function(){return l},W2:function(){return S.W},oT:function(){return r.o},rj:function(){return y.r},Ee:function(){return o.E},oH:function(){return b},Ae:function(){return n.A},am:function(){return U},eL:function(){return _.e},al:function(){return s.a}});var n=i("../../../node_modules/@babylonjs/gui/2D/controls/rectangle.js"),r=i("../../../node_modules/@babylonjs/gui/2D/controls/control.js"),s=i("../../../node_modules/@babylonjs/gui/2D/controls/textBlock.js"),o=i("../../../node_modules/@babylonjs/gui/2D/controls/image.js"),a=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js");class l extends n.A{constructor(e){super(e),this.name=e,this.delegatePickingToChildren=!1,this.thickness=1,this.isPointerBlocker=!0;let t=null;this.pointerEnterAnimation=()=>{t=this.alpha,this.alpha-=.1},this.pointerOutAnimation=()=>{null!==t&&(this.alpha=t)},this.pointerDownAnimation=()=>{this.scaleX-=.05,this.scaleY-=.05},this.pointerUpAnimation=()=>{this.scaleX+=.05,this.scaleY+=.05}}get image(){return this._image}get textBlock(){return this._textBlock}_getTypeName(){return"Button"}_processPicking(e,t,i,n,r,s,o,a){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!super.contains(e,t))return!1;if(this.delegatePickingToChildren){let i=!1;for(let n=this._children.length-1;n>=0;n--){const r=this._children[n];if(r.isEnabled&&r.isHitTestVisible&&r.isVisible&&!r.notRenderable&&r.contains(e,t)){i=!0;break}}if(!i)return!1}return this._processObservables(n,e,t,i,r,s,o,a),!0}_onPointerEnter(e,t){return!!super._onPointerEnter(e,t)&&(!this.isReadOnly&&this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)}_onPointerOut(e,t,i=!1){!this.isReadOnly&&this.pointerOutAnimation&&this.pointerOutAnimation(),super._onPointerOut(e,t,i)}_onPointerDown(e,t,i,n,r){return!!super._onPointerDown(e,t,i,n,r)&&(!this.isReadOnly&&this.pointerDownAnimation&&this.pointerDownAnimation(),!0)}_onPointerUp(e,t,i,n,r,s){!this.isReadOnly&&this.pointerUpAnimation&&this.pointerUpAnimation(),super._onPointerUp(e,t,i,n,r,s)}serialize(e){super.serialize(e),this._textBlock&&(e.textBlockName=this._textBlock.name),this._image&&(e.imageName=this._image.name)}_parseFromContent(e,t){super._parseFromContent(e,t),e.textBlockName&&(this._textBlock=this.getChildByName(e.textBlockName)),e.imageName&&(this._image=this.getChildByName(e.imageName))}static CreateImageButton(e,t,i){const n=new this(e),a=new s.a(e+"_button",t);a.textWrapping=!0,a.textHorizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_CENTER,a.paddingLeft="20%",n.addControl(a);const l=new o.E(e+"_icon",i);return l.width="20%",l.stretch=o.E.STRETCH_UNIFORM,l.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,n.addControl(l),n._image=l,n._textBlock=a,n}static CreateImageOnlyButton(e,t){const i=new this(e),n=new o.E(e+"_icon",t);return n.stretch=o.E.STRETCH_FILL,n.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,i.addControl(n),i._image=n,i}static CreateSimpleButton(e,t){const i=new this(e),n=new s.a(e+"_button",t);return n.textWrapping=!0,n.textHorizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_CENTER,i.addControl(n),i._textBlock=n,i}static CreateImageWithCenterTextButton(e,t,i){const n=new this(e),a=new o.E(e+"_icon",i);a.stretch=o.E.STRETCH_FILL,n.addControl(a);const l=new s.a(e+"_button",t);return l.textWrapping=!0,l.textHorizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_CENTER,n.addControl(l),n._image=a,n._textBlock=l,n}}(0,a.H)("BABYLON.GUI.Button",l);var c=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),h=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),_=i("../../../node_modules/@babylonjs/gui/2D/controls/stackPanel.js"),d=i("../../../node_modules/@babylonjs/core/Misc/decorators.js");class u extends r.o{constructor(e){super(e),this.name=e,this._isChecked=!1,this._background="black",this._checkSizeRatio=.8,this._thickness=1,this.onIsCheckedChangedObservable=new h.y$,this.isPointerBlocker=!0}get thickness(){return this._thickness}set thickness(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())}get checkSizeRatio(){return this._checkSizeRatio}set checkSizeRatio(e){e=Math.max(Math.min(1,e),0),this._checkSizeRatio!==e&&(this._checkSizeRatio=e,this._markAsDirty())}get background(){return this._background}set background(e){this._background!==e&&(this._background=e,this._markAsDirty())}get isChecked(){return this._isChecked}set isChecked(e){this._isChecked!==e&&(this._isChecked=e,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(e))}_getTypeName(){return"Checkbox"}_draw(e){e.save(),this._applyStates(e);const t=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,t,i),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._isChecked){e.fillStyle=this._isEnabled?this.color:this._disabledColorItem;const n=t*this._checkSizeRatio,r=i*this._checkSizeRatio;e.fillRect(this._currentMeasure.left+this._thickness/2+(t-n)/2,this._currentMeasure.top+this._thickness/2+(i-r)/2,n,r)}e.strokeStyle=this.color,e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,t,i),e.restore()}_onPointerDown(e,t,i,n,r){return!!super._onPointerDown(e,t,i,n,r)&&(this.isReadOnly||(this.isChecked=!this.isChecked),!0)}static AddCheckBoxWithHeader(e,t){const i=new _.e;i.isVertical=!1,i.height="30px";const n=new u;n.width="20px",n.height="20px",n.isChecked=!0,n.color="green",n.onIsCheckedChangedObservable.add(t),i.addControl(n);const o=new s.a;return o.text=e,o.width="180px",o.paddingLeft="5px",o.textHorizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,o.color="white",i.addControl(o),i}}(0,c.gn)([(0,d.qC)()],u.prototype,"thickness",null),(0,c.gn)([(0,d.qC)()],u.prototype,"checkSizeRatio",null),(0,c.gn)([(0,d.qC)()],u.prototype,"background",null),(0,c.gn)([(0,d.qC)()],u.prototype,"isChecked",null),(0,a.H)("BABYLON.GUI.Checkbox",u);var p=i("../../../node_modules/@babylonjs/core/Events/clipboardEvents.js"),f=i("../../../node_modules/@babylonjs/core/Events/pointerEvents.js"),m=i("../../../node_modules/@babylonjs/gui/2D/valueAndUnit.js");class g{get text(){return this._characters?this._characters.join(""):this._text}set text(e){this._text=e,this._characters=Array.from&&Array.from(e)}get length(){return this._characters?this._characters.length:this._text.length}removePart(e,t,i){if(this._text=this._text.slice(0,e)+(i||"")+this._text.slice(t),this._characters){const n=i?Array.from(i):[];this._characters.splice(e,t-e,...n)}}charAt(e){return this._characters?this._characters[e]:this._text.charAt(e)}substr(e,t){if(this._characters){e=isNaN(e)?0:e>=0?Math.min(e,this._characters.length):this._characters.length+Math.max(e,-this._characters.length),void 0===t?t=this._characters.length-e:(isNaN(t)||t<0)&&(t=0);const i=[];for(;--t>=0;)i[t]=this._characters[e+t];return i.join("")}return this._text.substr(e,t)}substring(e,t){if(this._characters){isNaN(e)?e=0:e>this._characters.length?e=this._characters.length:e<0&&(e=0),void 0===t?t=this._characters.length:isNaN(t)?t=0:t>this._characters.length?t=this._characters.length:t<0&&(t=0);const i=[];let n=0;for(;e{switch(e.type){case p.p.COPY:this._onCopyText(e.event),this.onTextCopyObservable.notifyObservers(this);break;case p.p.CUT:this._onCutText(e.event),this.onTextCutObservable.notifyObservers(this);break;case p.p.PASTE:this._onPasteText(e.event),this.onTextPasteObservable.notifyObservers(this);break;default:return}}));const e=this._host.getScene();e&&(this._onPointerDblTapObserver=e.onPointerObservable.add((e=>{this._isFocused&&e.type===f.kD.POINTERDOUBLETAP&&this._processDblClick(e)}))),this._onFocusSelectAll&&this._selectAllText()}focus(){this._host.moveFocusToControl(this)}blur(){this._host.focusedControl=null}_getTypeName(){return"InputText"}keepsFocusWith(){return this._connectedVirtualKeyboard?[this._connectedVirtualKeyboard]:null}processKey(e,t,i){var n;if(!this.isReadOnly&&(!i||!i.ctrlKey&&!i.metaKey||67!==e&&86!==e&&88!==e)){if(i&&(i.ctrlKey||i.metaKey)&&65===e)return this._selectAllText(),void i.preventDefault();switch(e){case 32:t=" ";break;case 191:i&&i.preventDefault();break;case 8:if(this._textWrapper.text&&this._textWrapper.length>0){if(this._isTextHighlightOn)return this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this._blinkIsEven=!1,void(i&&i.preventDefault());if(0===this._cursorOffset)this.text=this._textWrapper.substr(0,this._textWrapper.length-1);else{const e=this._textWrapper.length-this._cursorOffset;e>0&&(this._textWrapper.removePart(e-1,e),this._textHasChanged())}}return void(i&&i.preventDefault());case 46:if(this._isTextHighlightOn)return this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,void(i&&i.preventDefault());if(this._textWrapper.text&&this._textWrapper.length>0&&this._cursorOffset>0){const e=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(e,e+1),this._textHasChanged(),this._cursorOffset--}return void(i&&i.preventDefault());case 13:return this._host.focusedControl=null,void(this._isTextHighlightOn=!1);case 35:return this._cursorOffset=0,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case 36:return this._cursorOffset=this._textWrapper.length,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case 37:if(this._cursorOffset++,this._cursorOffset>this._textWrapper.length&&(this._cursorOffset=this._textWrapper.length),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this._isTextHighlightOn){if(this._textWrapper.length===this._cursorOffset)return;this._endHighlightIndex=this._textWrapper.length-this._cursorOffset+1}return this._startHighlightIndex=0,this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=this._textWrapper.length,this._isTextHighlightOn=!0,void this._markAsDirty()}return this._isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=0===this._startHighlightIndex?this._textWrapper.length:this._textWrapper.length-this._startHighlightIndex+1):(this._isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset>=this._textWrapper.length?this._textWrapper.length:this._cursorOffset-1),this._cursorIndexthis._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this._isTextHighlightOn=!1,void this._markAsDirty()}return this._isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this._isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=this._textWrapper.length,i.preventDefault()),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty();case 39:if(this._cursorOffset--,this._cursorOffset<0&&(this._cursorOffset=0),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this._isTextHighlightOn){if(0===this._cursorOffset)return;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset-1}return this._endHighlightIndex=this._textWrapper.length,this._isTextHighlightOn=!0,this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=0,void this._markAsDirty()}return this._isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=this._textWrapper.length===this._endHighlightIndex?0:this._textWrapper.length-this._endHighlightIndex-1):(this._isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset<=0?0:this._cursorOffset+1),this._cursorIndexthis._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this._isTextHighlightOn=!1,void this._markAsDirty()}return this._isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._endHighlightIndex,this._isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=0,i.preventDefault()),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty()}if(32===e&&(t=null!==(n=null==i?void 0:i.key)&&void 0!==n?n:" "),this._deadKey="Dead"===t,t&&(-1===e||32===e||34===e||39===e||e>47&&e<64||e>64&&e<91||e>159&&e<193||e>218&&e<223||e>95&&e<112)&&(this._currentKey=t,this.onBeforeKeyAddObservable.notifyObservers(this),t=this._currentKey,this._addKey&&!this._deadKey))if(this._isTextHighlightOn)this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex,t),this._textHasChanged(),this._cursorOffset=this._textWrapper.length-(this._startHighlightIndex+1),this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._markAsDirty();else if(0===this._cursorOffset)this.text+=this._deadKey&&(null==i?void 0:i.key)?i.key:t;else{const e=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(e,e,t),this._textHasChanged()}}}_updateValueFromCursorIndex(e){if(this._blinkIsEven=!1,-1===this._cursorIndex)this._cursorIndex=e;else if(this._cursorIndexthis._cursorOffset))return this._isTextHighlightOn=!1,void this._markAsDirty();this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex}this._isTextHighlightOn=!0,this._markAsDirty()}_processDblClick(e){let t,i;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset,this._endHighlightIndex=this._startHighlightIndex;do{i=this._endHighlightIndex0&&this._textWrapper.isWord(this._startHighlightIndex-1)?--this._startHighlightIndex:0}while(t||i);this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=!0,this._clickedCoordinate=null,this._blinkIsEven=!0,this._cursorIndex=-1,this._markAsDirty()}_selectAllText(){this._blinkIsEven=!0,this._isTextHighlightOn=!0,this._startHighlightIndex=0,this._endHighlightIndex=this._textWrapper.length,this._cursorOffset=this._textWrapper.length,this._cursorIndex=-1,this._markAsDirty()}processKeyboard(e){this.processKey(e.keyCode,e.key,e),this.onKeyboardEventProcessedObservable.notifyObservers(e)}_onCopyText(e){this._isTextHighlightOn=!1;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText}_onCutText(e){if(this._highlightedText){this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this._isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText,this._highlightedText=""}}_onPasteText(e){let t="";t=e.clipboardData&&-1!==e.clipboardData.types.indexOf("text/plain")?e.clipboardData.getData("text/plain"):this._host.clipboardData;const i=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(i,i,t),this._textHasChanged()}_draw(e){e.save(),this._applyStates(e),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(e.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._fontOffset&&!this._wasDirty||(this._fontOffset=r.o._GetFontOffset(e.font));const t=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this.color&&(e.fillStyle=this.color);let i=this._beforeRenderText(this._textWrapper);this._isFocused||this._textWrapper.text||!this._placeholderText||(i=new g,i.text=this._placeholderText,this._placeholderColor&&(e.fillStyle=this._placeholderColor)),this._textWidth=e.measureText(i.text).width;const n=2*this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this._autoStretchWidth&&(this.width=Math.min(this._maxWidth.getValueInPixel(this._host,this._tempParentMeasure.width),this._textWidth+n)+"px",this._autoStretchWidth=!0);const s=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,o=this._width.getValueInPixel(this._host,this._tempParentMeasure.width)-n;if(e.save(),e.beginPath(),e.rect(t,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,o+2,this._currentMeasure.height),e.clip(),this._isFocused&&this._textWidth>o){const e=t-this._textWidth+o;this._scrollLeft||(this._scrollLeft=e)}else this._scrollLeft=t;if(e.fillText(i.text,this._scrollLeft,this._currentMeasure.top+s),this._isFocused){if(this._clickedCoordinate){const t=this._scrollLeft+this._textWidth-this._clickedCoordinate;let n=0;this._cursorOffset=0;let r=0;do{this._cursorOffset&&(r=Math.abs(t-n)),this._cursorOffset++,n=e.measureText(i.substr(i.length-this._cursorOffset,this._cursorOffset)).width}while(n=this._cursorOffset);Math.abs(t-n)>r&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){const n=i.substr(i.length-this._cursorOffset),r=e.measureText(n).width;let s=this._scrollLeft+this._textWidth-r;st+o&&(this._scrollLeft+=t+o-s,s=t+o,this._markAsDirty()),this._isTextHighlightOn||e.fillRect(s,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}if(clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((()=>{this._blinkIsEven=!this._blinkIsEven,this._markAsDirty()}),500),this._isTextHighlightOn){clearTimeout(this._blinkTimeout);const n=e.measureText(i.substring(this._startHighlightIndex)).width;let r=this._scrollLeft+this._textWidth-n;this._highlightedText=i.substring(this._startHighlightIndex,this._endHighlightIndex);let s=e.measureText(i.substring(this._startHighlightIndex,this._endHighlightIndex)).width;r=1-C._Epsilon&&(this._value.r=1),this._value.g>=1-C._Epsilon&&(this._value.g=1),this._value.b>=1-C._Epsilon&&(this._value.b=1),this.onValueChangedObservable.notifyObservers(this._value))}get width(){return this._width.toString(this._host)}set width(e){this._width.toString(this._host)!==e&&this._width.fromString(e)&&(0===this._width.getValue(this._host)&&(e="1px",this._width.fromString(e)),this._height.fromString(e),this._markAsDirty())}get height(){return this._height.toString(this._host)}set height(e){this._height.toString(this._host)!==e&&this._height.fromString(e)&&(0===this._height.getValue(this._host)&&(e="1px",this._height.fromString(e)),this._width.fromString(e),this._markAsDirty())}get size(){return this.width}set size(e){this.width=e}_getTypeName(){return"ColorPicker"}_preMeasure(e){e.widthl||ng?f:(f-p)*(e-m)/(g-m)+p,d=(r-c)/(e-c),o[_+3]=d1-u?255*(1-(d-(1-u))/u):255}return r.putImageData(s,0,0),n}_draw(e){e.save(),this._applyStates(e);const t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*t,n=this._currentMeasure.left,r=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*t||(this._colorWheelCanvas=this._createColorWheelCanvas(t,i)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY,e.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),e.drawImage(this._colorWheelCanvas,n,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,e);let s=this._squareLeft+this._squareSize*this._s,o=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(s,o,.04*t,e);const a=t-.5*i;s=n+t+Math.cos((this._h-180)*Math.PI/180)*a,o=r+t+Math.sin((this._h-180)*Math.PI/180)*a,this._drawCircle(s,o,.35*i,e),e.restore()}_updateValueFromPointer(e,t){if(this._pointerStartedOnWheel){const i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),n=i+this._currentMeasure.left,r=i+this._currentMeasure.top;this._h=180*Math.atan2(t-r,e-n)/Math.PI+180}else this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(e-this._squareLeft)/this._squareSize,this._v=1-(t-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,C._Epsilon),this._v=Math.min(this._v,1),this._v=Math.max(this._v,C._Epsilon));v.Wo.HSVtoRGBToRef(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor}_isPointOnSquare(e,t){this._updateSquareProps();const i=this._squareLeft,n=this._squareTop,r=this._squareSize;return e>=i&&e<=i+r&&t>=n&&t<=n+r}_isPointOnWheel(e,t){const i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),n=i-.2*i,r=e-(i+this._currentMeasure.left),s=t-(i+this._currentMeasure.top),o=r*r+s*s;return o<=i*i&&o>=n*n}_onPointerDown(e,t,i,n,r){if(!super._onPointerDown(e,t,i,n,r))return!1;if(this.isReadOnly)return!0;this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._invertTransformMatrix.transformCoordinates(t.x,t.y,this._transformedPosition);const s=this._transformedPosition.x,o=this._transformedPosition.y;return this._isPointOnSquare(s,o)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(s,o)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(s,o),this._host._capturingControl[i]=this,this._lastPointerDownId=i,!0}_onPointerMove(e,t,i,n){if(i==this._lastPointerDownId){if(!this.isReadOnly){this._invertTransformMatrix.transformCoordinates(t.x,t.y,this._transformedPosition);const e=this._transformedPosition.x,i=this._transformedPosition.y;this._pointerIsDown&&this._updateValueFromPointer(e,i)}super._onPointerMove(e,t,i,n)}}_onPointerUp(e,t,i,n,r,s){this._pointerIsDown=!1,delete this._host._capturingControl[i],super._onPointerUp(e,t,i,n,r,s)}_onCanvasBlur(){this._forcePointerUp(),super._onCanvasBlur()}static ShowPickerDialogAsync(e,t){return new Promise((i=>{t.pickerWidth=t.pickerWidth||"640px",t.pickerHeight=t.pickerHeight||"400px",t.headerHeight=t.headerHeight||"35px",t.lastColor=t.lastColor||"#000000",t.swatchLimit=t.swatchLimit||20,t.numSwatchesPerLine=t.numSwatchesPerLine||10;const o=t.swatchLimit/t.numSwatchesPerLine,a=parseFloat(t.pickerWidth)/t.numSwatchesPerLine,c=Math.floor(.25*a),h=c*(t.numSwatchesPerLine+1),_=Math.floor((parseFloat(t.pickerWidth)-h)/t.numSwatchesPerLine),d=_*o+c*(o+1),u=(parseInt(t.pickerHeight)+d+Math.floor(.25*_)).toString()+"px",p="#c0c0c0",f="#535353",m="#414141",g="515151",A=v.Wo.FromHexString("#dddddd"),S=A.r+A.g+A.b;let x,T;const E=["R","G","B"],R="#454545",P="#f0f0f0";let I,M,D,O,w,F=!1;const B=new y.r;if(B.name="Dialog Container",B.width=t.pickerWidth,t.savedColors){B.height=u;const e=parseInt(t.pickerHeight)/parseInt(u);B.addRowDefinition(e,!1),B.addRowDefinition(1-e,!1)}else B.height=t.pickerHeight,B.addRowDefinition(1,!1);if(e.addControl(B),t.savedColors){M=new y.r,M.name="Swatch Drawer",M.verticalAlignment=r.o.VERTICAL_ALIGNMENT_TOP,M.background=f,M.width=t.pickerWidth;const e=t.savedColors.length/t.numSwatchesPerLine;let i;i=0==e?0:e+1,M.height=(_*e+i*c).toString()+"px",M.top=Math.floor(.25*_).toString()+"px";for(let e=0;e<2*Math.ceil(t.savedColors.length/t.numSwatchesPerLine)+1;e++)e%2!=0?M.addRowDefinition(_,!0):M.addRowDefinition(c,!0);for(let e=0;e<2*t.numSwatchesPerLine+1;e++)e%2!=0?M.addColumnDefinition(_,!0):M.addColumnDefinition(c,!0);B.addControl(M,1,0)}const N=new y.r;N.name="Picker Panel",N.height=t.pickerHeight;const L=parseInt(t.headerHeight)/parseInt(t.pickerHeight),k=[L,1-L];N.addRowDefinition(k[0],!1),N.addRowDefinition(k[1],!1),B.addControl(N,0,0);const V=new n.A;V.name="Dialogue Header Bar",V.background="#cccccc",V.thickness=0,N.addControl(V,0,0);const U=l.CreateSimpleButton("closeButton","a");U.fontFamily="coreglyphs";const G=v.Wo.FromHexString(V.background),j=new v.Wo(1-G.r,1-G.g,1-G.b);U.color=j.toHexString(),U.fontSize=Math.floor(.6*parseInt(t.headerHeight)),U.textBlock.textVerticalAlignment=r.o.VERTICAL_ALIGNMENT_CENTER,U.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_RIGHT,U.height=U.width=t.headerHeight,U.background=V.background,U.thickness=0,U.pointerDownAnimation=()=>{},U.pointerUpAnimation=()=>{U.background=V.background},U.pointerEnterAnimation=()=>{U.color=V.background,U.background="red"},U.pointerOutAnimation=()=>{U.color=j.toHexString(),U.background=V.background},U.onPointerClickObservable.add((()=>{Be(se.background)})),N.addControl(U,0,0);const W=new y.r;W.name="Dialogue Body",W.background=f;const z=[.4375,.5625];W.addRowDefinition(1,!1),W.addColumnDefinition(z[0],!1),W.addColumnDefinition(z[1],!1),N.addControl(W,1,0);const H=new y.r;H.name="Picker Grid",H.addRowDefinition(.85,!1),H.addRowDefinition(.15,!1),W.addControl(H,0,0);const X=new C;X.name="GUI Color Picker",t.pickerHeight{w=X.name,O="",De(!1)})),X.onValueChangedObservable.add((function(e){w==X.name&&Re(e,X.name)})),H.addControl(X,0,0);const Y=new y.r;Y.name="Dialogue Right Half",Y.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT;const Q=[.514,.486];Y.addRowDefinition(Q[0],!1),Y.addRowDefinition(Q[1],!1),W.addControl(Y,1,1);const q=new y.r;q.name="Swatches and Buttons";const K=[.417,.583];q.addRowDefinition(1,!1),q.addColumnDefinition(K[0],!1),q.addColumnDefinition(K[1],!1),Y.addControl(q,0,0);const Z=new y.r;Z.name="New and Current Swatches";const $=[.04,.16,.64,.16];Z.addRowDefinition($[0],!1),Z.addRowDefinition($[1],!1),Z.addRowDefinition($[2],!1),Z.addRowDefinition($[3],!1),q.addControl(Z,0,0);const J=new y.r;J.name="Active Swatches",J.width=.67,J.addRowDefinition(.5,!1),J.addRowDefinition(.5,!1),Z.addControl(J,2,0);const ee=Math.floor(parseInt(t.pickerWidth)*z[1]*K[0]*.11),te=Math.floor(parseInt(t.pickerHeight)*k[1]*Q[0]*$[1]*.5);let ie;ie=t.pickerWidth>t.pickerHeight?te:ee;const ne=new s.a;ne.text="new",ne.name="New Color Label",ne.color=p,ne.fontSize=ie,Z.addControl(ne,1,0);const re=new n.A;re.name="New Color Swatch",re.background=t.lastColor,re.thickness=0,J.addControl(re,0,0);const se=l.CreateSimpleButton("currentSwatch","");se.background=t.lastColor,se.thickness=0,se.onPointerClickObservable.add((()=>{Re(v.Wo.FromHexString(se.background),se.name),De(!1)})),se.pointerDownAnimation=()=>{},se.pointerUpAnimation=()=>{},se.pointerEnterAnimation=()=>{},se.pointerOutAnimation=()=>{},J.addControl(se,1,0);const oe=new n.A;oe.name="Swatch Outline",oe.width=.67,oe.thickness=2,oe.color="#404040",oe.isHitTestVisible=!1,Z.addControl(oe,2,0);const ae=new s.a;ae.name="Current Color Label",ae.text="current",ae.color=p,ae.fontSize=ie,Z.addControl(ae,3,0);const le=new y.r;le.name="Button Grid",le.height=.8;const ce=1/3;le.addRowDefinition(ce,!1),le.addRowDefinition(ce,!1),le.addRowDefinition(ce,!1),q.addControl(le,0,1);const he=Math.floor(parseInt(t.pickerWidth)*z[1]*K[1]*.67).toString()+"px",_e=Math.floor(parseInt(t.pickerHeight)*k[1]*Q[0]*(parseFloat(le.height.toString())/100)*ce*.7).toString()+"px";x=parseFloat(he)>parseFloat(_e)?Math.floor(.45*parseFloat(_e)):Math.floor(.11*parseFloat(he));const de=l.CreateSimpleButton("butOK","OK");de.width=he,de.height=_e,de.verticalAlignment=r.o.VERTICAL_ALIGNMENT_CENTER,de.thickness=2,de.color=p,de.fontSize=x,de.background=f,de.onPointerEnterObservable.add((()=>{de.background=m})),de.onPointerOutObservable.add((()=>{de.background=f})),de.pointerDownAnimation=()=>{de.background=g},de.pointerUpAnimation=()=>{de.background=m},de.onPointerClickObservable.add((()=>{De(!1),Be(re.background)})),le.addControl(de,0,0);const ue=l.CreateSimpleButton("butCancel","Cancel");ue.width=he,ue.height=_e,ue.verticalAlignment=r.o.VERTICAL_ALIGNMENT_CENTER,ue.thickness=2,ue.color=p,ue.fontSize=x,ue.background=f,ue.onPointerEnterObservable.add((()=>{ue.background=m})),ue.onPointerOutObservable.add((()=>{ue.background=f})),ue.pointerDownAnimation=()=>{ue.background=g},ue.pointerUpAnimation=()=>{ue.background=m},ue.onPointerClickObservable.add((()=>{De(!1),Be(se.background)})),le.addControl(ue,1,0),t.savedColors&&(D=l.CreateSimpleButton("butSave","Save"),D.width=he,D.height=_e,D.verticalAlignment=r.o.VERTICAL_ALIGNMENT_CENTER,D.thickness=2,D.fontSize=x,t.savedColors.length{t.savedColors&&t.savedColors.length{t.savedColors&&t.savedColors.length{t.savedColors&&t.savedColors.length{t.savedColors&&t.savedColors.length{t.savedColors&&(0==t.savedColors.length&&we(!0),t.savedColors.length0&&we(!0),le.addControl(D,2,0));const pe=new y.r;pe.name="Dialog Lower Right",pe.addRowDefinition(.02,!1),pe.addRowDefinition(.63,!1),pe.addRowDefinition(.21,!1),pe.addRowDefinition(.14,!1),Y.addControl(pe,1,0);const fe=v.Wo.FromHexString(t.lastColor),me=new y.r;me.name="RGB Values",me.width=.82,me.verticalAlignment=r.o.VERTICAL_ALIGNMENT_CENTER,me.addRowDefinition(1/3,!1),me.addRowDefinition(1/3,!1),me.addRowDefinition(1/3,!1),me.addColumnDefinition(.1,!1),me.addColumnDefinition(.2,!1),me.addColumnDefinition(.7,!1),pe.addControl(me,1,0);for(let e=0;e{w=ge.name,O=ge.text,De(!1)})),ge.onBlurObservable.add((()=>{""==ge.text&&(ge.text="0"),Pe(ge,"r"),w==ge.name&&(w="")})),ge.onTextChangedObservable.add((()=>{w==ge.name&&Pe(ge,"r")})),me.addControl(ge,0,1);const be=new b;be.width=.83,be.height=.72,be.name="gIntField",be.fontSize=x,be.text=(255*fe.g).toString(),be.color=P,be.background=R,be.onFocusObservable.add((()=>{w=be.name,O=be.text,De(!1)})),be.onBlurObservable.add((()=>{""==be.text&&(be.text="0"),Pe(be,"g"),w==be.name&&(w="")})),be.onTextChangedObservable.add((()=>{w==be.name&&Pe(be,"g")})),me.addControl(be,1,1);const ye=new b;ye.width=.83,ye.height=.72,ye.name="bIntField",ye.fontSize=x,ye.text=(255*fe.b).toString(),ye.color=P,ye.background=R,ye.onFocusObservable.add((()=>{w=ye.name,O=ye.text,De(!1)})),ye.onBlurObservable.add((()=>{""==ye.text&&(ye.text="0"),Pe(ye,"b"),w==ye.name&&(w="")})),ye.onTextChangedObservable.add((()=>{w==ye.name&&Pe(ye,"b")})),me.addControl(ye,2,1);const ve=new b;ve.width=.95,ve.height=.72,ve.name="rDecField",ve.fontSize=x,ve.text=fe.r.toString(),ve.color=P,ve.background=R,ve.onFocusObservable.add((()=>{w=ve.name,O=ve.text,De(!1)})),ve.onBlurObservable.add((()=>{0!=parseFloat(ve.text)&&""!=ve.text||(ve.text="0",Ie(ve,"r")),w==ve.name&&(w="")})),ve.onTextChangedObservable.add((()=>{w==ve.name&&Ie(ve,"r")})),me.addControl(ve,0,2);const Ae=new b;Ae.width=.95,Ae.height=.72,Ae.name="gDecField",Ae.fontSize=x,Ae.text=fe.g.toString(),Ae.color=P,Ae.background=R,Ae.onFocusObservable.add((()=>{w=Ae.name,O=Ae.text,De(!1)})),Ae.onBlurObservable.add((()=>{0!=parseFloat(Ae.text)&&""!=Ae.text||(Ae.text="0",Ie(Ae,"g")),w==Ae.name&&(w="")})),Ae.onTextChangedObservable.add((()=>{w==Ae.name&&Ie(Ae,"g")})),me.addControl(Ae,1,2);const Ce=new b;Ce.width=.95,Ce.height=.72,Ce.name="bDecField",Ce.fontSize=x,Ce.text=fe.b.toString(),Ce.color=P,Ce.background=R,Ce.onFocusObservable.add((()=>{w=Ce.name,O=Ce.text,De(!1)})),Ce.onBlurObservable.add((()=>{0!=parseFloat(Ce.text)&&""!=Ce.text||(Ce.text="0",Ie(Ce,"b")),w==Ce.name&&(w="")})),Ce.onTextChangedObservable.add((()=>{w==Ce.name&&Ie(Ce,"b")})),me.addControl(Ce,2,2);const Se=new y.r;Se.name="Hex Value",Se.width=.82,Se.addRowDefinition(1,!1),Se.addColumnDefinition(.1,!1),Se.addColumnDefinition(.9,!1),pe.addControl(Se,2,0);const xe=new s.a;xe.text="#",xe.color=p,xe.fontSize=x,Se.addControl(xe,0,0);const Te=new b;Te.width=.96,Te.height=.72,Te.name="hexField",Te.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_CENTER,Te.fontSize=x;const Ee=t.lastColor.split("#");function Re(e,t){w=t;const i=e.toHexString();if(re.background=i,ge.name!=w&&(ge.text=Math.floor(255*e.r).toString()),be.name!=w&&(be.text=Math.floor(255*e.g).toString()),ye.name!=w&&(ye.text=Math.floor(255*e.b).toString()),ve.name!=w&&(ve.text=e.r.toString()),Ae.name!=w&&(Ae.text=e.g.toString()),Ce.name!=w&&(Ce.text=e.b.toString()),Te.name!=w){const e=i.split("#");Te.text=e[1]}X.name!=w&&(X.value=e)}function Pe(e,t){let i=e.text;if(/[^0-9]/g.test(i))e.text=O;else if(""!=i&&(Math.floor(parseInt(i))<0?i="0":Math.floor(parseInt(i))>255?i="255":isNaN(parseInt(i))&&(i="0")),w==e.name&&(O=i),""!=i){i=parseInt(i).toString(),e.text=i;const n=v.Wo.FromHexString(re.background);w==e.name&&Re("r"==t?new v.Wo(parseInt(i)/255,n.g,n.b):"g"==t?new v.Wo(n.r,parseInt(i)/255,n.b):new v.Wo(n.r,n.g,parseInt(i)/255),e.name)}}function Ie(e,t){let i=e.text;if(/[^0-9.]/g.test(i))return void(e.text=O);""!=i&&"."!=i&&0!=parseFloat(i)&&(parseFloat(i)<0?i="0.0":parseFloat(i)>1?i="1.0":isNaN(parseFloat(i))&&(i="0.0")),w==e.name&&(O=i),""!=i&&"."!=i&&0!=parseFloat(i)?(i=parseFloat(i).toString(),e.text=i):i="0.0";const n=v.Wo.FromHexString(re.background);w==e.name&&Re("r"==t?new v.Wo(parseFloat(i),n.g,n.b):"g"==t?new v.Wo(n.r,parseFloat(i),n.b):new v.Wo(n.r,n.g,parseFloat(i)),e.name)}function Me(){if(t.savedColors&&t.savedColors[I]){let e;e=F?"b":"";const i=l.CreateSimpleButton("Swatch_"+I,e);i.fontFamily="coreglyphs";const n=v.Wo.FromHexString(t.savedColors[I]),s=n.r+n.g+n.b;i.color=s>S?"#aaaaaa":"#ffffff",i.fontSize=Math.floor(.7*_),i.textBlock.verticalAlignment=r.o.VERTICAL_ALIGNMENT_CENTER,i.height=i.width=_.toString()+"px",i.background=t.savedColors[I],i.thickness=2;const o=I;return i.pointerDownAnimation=()=>{i.thickness=4},i.pointerUpAnimation=()=>{i.thickness=3},i.pointerEnterAnimation=()=>{i.thickness=3},i.pointerOutAnimation=()=>{i.thickness=2},i.onPointerClickObservable.add((()=>{var e;F?(e=o,t.savedColors&&t.savedColors.splice(e,1),t.savedColors&&0==t.savedColors.length&&(we(!1),F=!1),Oe("",D)):t.savedColors&&Re(v.Wo.FromHexString(t.savedColors[o]),i.name)})),i}return null}function De(e){let t;if(void 0!==e&&(F=e),F){for(let e=0;ei*t.numSwatchesPerLine?t.numSwatchesPerLine:t.savedColors.length-(i-1)*t.numSwatchesPerLine;const r=Math.min(Math.max(n,0),t.numSwatchesPerLine);for(let i=0,n=1;it.numSwatchesPerLine)continue;const r=Me();null!=r&&(M.addControl(r,e,n),n+=2,I++)}}t.savedColors.length>=t.swatchLimit?Fe(i,!0):Fe(i,!1)}}function we(e){e?(T=l.CreateSimpleButton("butEdit","Edit"),T.width=he,T.height=_e,T.left=Math.floor(.1*parseInt(he)).toString()+"px",T.top=(-1*parseFloat(T.left)).toString()+"px",T.verticalAlignment=r.o.VERTICAL_ALIGNMENT_BOTTOM,T.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,T.thickness=2,T.color=p,T.fontSize=x,T.background=f,T.onPointerEnterObservable.add((()=>{T.background=m})),T.onPointerOutObservable.add((()=>{T.background=f})),T.pointerDownAnimation=()=>{T.background=g},T.pointerUpAnimation=()=>{T.background=m},T.onPointerClickObservable.add((()=>{F=!F,De()})),H.addControl(T,1,0)):H.removeControl(T)}function Fe(e,t){t?(e.color="#555555",e.background="#454545"):(e.color=p,e.background=f)}function Be(n){t.savedColors&&t.savedColors.length>0?i({savedColors:t.savedColors,pickedColor:n}):i({pickedColor:n}),e.removeControl(B)}Te.text=Ee[1],Te.color=P,Te.background=R,Te.onFocusObservable.add((()=>{w=Te.name,O=Te.text,De(!1)})),Te.onBlurObservable.add((()=>{if(3==Te.text.length){const e=Te.text.split("");Te.text=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]}""==Te.text&&(Te.text="000000",Re(v.Wo.FromHexString(Te.text),"b")),w==Te.name&&(w="")})),Te.onTextChangedObservable.add((()=>{let e=Te.text;const t=/[^0-9A-F]/i.test(e);if((Te.text.length>6||t)&&w==Te.name)Te.text=O;else{if(Te.text.length<6){const t=6-Te.text.length;for(let i=0;i0&&Oe("",D)}))}}C._Epsilon=1e-6,(0,c.gn)([(0,d.qC)()],C.prototype,"value",null),(0,c.gn)([(0,d.qC)()],C.prototype,"width",null),(0,c.gn)([(0,d.qC)()],C.prototype,"height",null),(0,c.gn)([(0,d.qC)()],C.prototype,"size",null),(0,a.H)("BABYLON.GUI.ColorPicker",C);var S=i("../../../node_modules/@babylonjs/gui/2D/controls/container.js");class x extends S.W{constructor(e){super(e),this.name=e,this._thickness=1}get thickness(){return this._thickness}set thickness(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())}_getTypeName(){return"Ellipse"}_localDraw(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),r.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),this._background&&(e.fillStyle=this._background,e.fill()),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._thickness&&(this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.stroke()),e.restore()}_additionalProcessing(e,t){super._additionalProcessing(e,t),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness}_clipForChildren(e){r.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,e),e.clip()}_renderHighlightSpecific(e){r.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._highlightLineWidth/2,this._currentMeasure.height/2-this._highlightLineWidth/2,e),e.stroke()}}(0,c.gn)([(0,d.qC)()],x.prototype,"thickness",null),(0,a.H)("BABYLON.GUI.Ellipse",x),(0,a.H)("BABYLON.GUI.FocusableButton",class extends l{constructor(e){super(e),this.name=e,this.focusedColor=null,this._isFocused=!1,this._unfocusedColor=null,this.onFocusObservable=new h.y$,this.onBlurObservable=new h.y$,this.onKeyboardEventProcessedObservable=new h.y$,this._unfocusedColor=this.color}onBlur(){this._isFocused&&(this._isFocused=!1,this.focusedColor&&null!=this._unfocusedColor&&(this.color=this._unfocusedColor),this.onBlurObservable.notifyObservers(this))}onFocus(){this._isFocused=!0,this.focusedColor&&(this._unfocusedColor=this.color,this.color=this.focusedColor),this.onFocusObservable.notifyObservers(this)}keepsFocusWith(){return null}focus(){this._host.moveFocusToControl(this)}blur(){this._host.focusedControl=null}processKeyboard(e){this.onKeyboardEventProcessedObservable.notifyObservers(e,-1,this)}_onPointerDown(e,t,i,n,r){return this.isReadOnly||this.focus(),super._onPointerDown(e,t,i,n,r)}displose(){super.dispose(),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onKeyboardEventProcessedObservable.clear()}});class T extends b{constructor(e,t=""){super(e),this.name=e,this._textHorizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,this._textVerticalAlignment=r.o.VERTICAL_ALIGNMENT_TOP,this._lineSpacing=new m.s(0),this._outlineWidth=0,this._outlineColor="white",this._maxHeight=new m.s(1,m.s.UNITMODE_PERCENTAGE,!1),this.onLinesReadyObservable=new h.y$,this.text=t,this.isPointerBlocker=!0,this.onLinesReadyObservable.add((()=>this._updateCursorPosition())),this._highlightCursorInfo={initialStartIndex:-1,initialRelativeStartIndex:-1,initialLineIndex:-1},this._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeEndIndex:0,relativeStartIndex:0,currentLineIndex:0}}get outlineWidth(){return this._outlineWidth}set outlineWidth(e){this._outlineWidth!==e&&(this._outlineWidth=e,this._markAsDirty())}get outlineColor(){return this._outlineColor}set outlineColor(e){this._outlineColor!==e&&(this._outlineColor=e,this._markAsDirty())}get autoStretchHeight(){return this._autoStretchHeight}set autoStretchHeight(e){this._autoStretchHeight!==e&&(this._autoStretchHeight=e,this._markAsDirty())}set height(e){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==e&&(this._height.fromString(e)&&this._markAsDirty(),this._autoStretchHeight=!1)}get maxHeight(){return this._maxHeight.toString(this._host)}get maxHeightInPixels(){return this._maxHeight.getValueInPixel(this._host,this._cachedParentMeasure.height)}set maxHeight(e){this._maxHeight.toString(this._host)!==e&&this._maxHeight.fromString(e)&&this._markAsDirty()}_getTypeName(){return"InputTextArea"}processKeyboard(e){this.alternativeProcessKey(e.code,e.key,e),this.onKeyboardEventProcessedObservable.notifyObservers(e)}alternativeProcessKey(e,t,i){if(!i||!i.ctrlKey&&!i.metaKey||"KeyC"!==e&&"KeyV"!==e&&"KeyX"!==e){switch(e){case"KeyA":if(i&&(i.ctrlKey||i.metaKey))return this._selectAllText(),void i.preventDefault();break;case"Period":i&&i.shiftKey&&i.preventDefault();break;case"Backspace":!this._isTextHighlightOn&&this._cursorInfo.globalStartIndex>0&&(this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex--),this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,i&&i.preventDefault(),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._textHasChanged();break;case"Delete":!this._isTextHighlightOn&&this._cursorInfo.globalEndIndexthis._highlightCursorInfo.initialStartIndex?this._cursorInfo.globalEndIndex--:this._cursorInfo.globalStartIndex--:(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex--,this._isTextHighlightOn=!0),this._blinkIsEven=!0,void i.preventDefault()):(this._isTextHighlightOn?this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex:i&&(i.ctrlKey||i.metaKey)?(this._cursorInfo.globalStartIndex-=this._cursorInfo.relativeStartIndex,i.preventDefault()):this._cursorInfo.globalStartIndex>0&&this._cursorInfo.globalStartIndex--,this._blinkIsEven=!1,void(this._isTextHighlightOn=!1));case"ArrowRight":if(this._markAsDirty(),i&&i.shiftKey){if(i.ctrlKey||i.metaKey){const e=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex-1;this._cursorInfo.globalEndIndex+=e,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex}return this._isTextHighlightOn?this._cursorInfo.globalStartIndexa&&l>0&&i--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<=this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=i,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):this._cursorInfo.globalEndIndex=i:this._cursorInfo.globalStartIndex=i}return void this._markAsDirty();case"ArrowDown":if(this._blinkIsEven=!1,i&&(i.shiftKey?(this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex),this._isTextHighlightOn=!0,this._blinkIsEven=!0):this._isTextHighlightOn=!1,i.preventDefault()),this._cursorInfo.currentLineIndex===this._lines.length-1)this._cursorInfo.globalStartIndex=this.text.length;else{const e=this._lines[this._cursorInfo.currentLineIndex],t=this._lines[this._cursorInfo.currentLineIndex+1];let i=0,n=0;!this._isTextHighlightOn||this._cursorInfo.currentLineIndexa&&l>0&&i--,this._isTextHighlightOn?this._cursorInfo.currentLineIndexthis._cursorInfo.globalEndIndex&&(this._cursorInfo.globalEndIndex+=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex=this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex-=this._cursorInfo.globalStartIndex)):(this._cursorInfo.globalEndIndex=i,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex):this._cursorInfo.globalStartIndex=i}return void this._markAsDirty()}1===(null==t?void 0:t.length)&&(null==i||i.preventDefault(),this._currentKey=t,this.onBeforeKeyAddObservable.notifyObservers(this),t=this._currentKey,this._addKey&&(this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,t),this._cursorInfo.globalStartIndex+=t.length,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()))}}_parseLineWordWrap(e="",t,i){const n=[],r=e.split(" ");let s=0;for(let o=0;o0?e+" "+r[o]:r[0],l=i.measureText(a).width;if(l>t){o>0&&(s=i.measureText(e).width,n.push({text:e,width:s,lineEnding:" "})),e=r[o];let a="";e.split("").map((e=>{i.measureText(a+e).width>t&&(n.push({text:a,width:i.measureText(a).width,lineEnding:"\n"}),a=""),a+=e})),e=a,s=i.measureText(e).width}else s=l,e=a}return n.push({text:e,width:s,lineEnding:" "}),n}_breakLines(e,t){const i=[],n=this.text.split("\n");if(this.clipContent)for(const r of n)i.push(...this._parseLineWordWrap(r,e,t));else for(const e of n)i.push(this._parseLine(e,t));return i[i.length-1].lineEnding="\n",i}_parseLine(e="",t){return{text:e,width:t.measureText(e).width,lineEnding:" "}}_preMeasure(e,t){this._fontOffset&&!this._wasDirty||(this._fontOffset=r.o._GetFontOffset(t.font));let i=this._beforeRenderText(this._textWrapper).text;this._isFocused||this.text||!this._placeholderText||(i=this._placeholderText,this._placeholderColor&&(t.fillStyle=this._placeholderColor)),this._textWidth=t.measureText(i).width;const n=2*this._margin.getValueInPixel(this._host,e.width);if(this._autoStretchWidth){const r=i.split("\n").reduce(((e,i)=>t.measureText(i).width>t.measureText(e).width?i:e),""),s=t.measureText(r).width;this.width=Math.min(this._maxWidth.getValueInPixel(this._host,e.width),s+n)+"px",this.autoStretchWidth=!0}if(this._availableWidth=this._width.getValueInPixel(this._host,e.width)-n,this._lines=this._breakLines(this._availableWidth,t),this._contextForBreakLines=t,this._autoStretchHeight){const t=this._lines.length*this._fontOffset.height+2*this._margin.getValueInPixel(this._host,e.height);this.height=Math.min(this._maxHeight.getValueInPixel(this._host,e.height),t)+"px",this._autoStretchHeight=!0}if(this._availableHeight=this._height.getValueInPixel(this._host,e.height)-n,this._isFocused){this._cursorInfo.currentLineIndex=0;let e=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,t=0;for(;t+e<=this._cursorInfo.globalStartIndex;)t+=e,this._cursorInfo.currentLineIndexthis._availableWidth){const e=this._clipTextLeft-this._lines[this._cursorInfo.currentLineIndex].width+this._availableWidth;this._scrollLeft||(this._scrollLeft=e)}else this._scrollLeft=this._clipTextLeft;if(this._isFocused&&!this._autoStretchHeight){const e=(this._cursorInfo.currentLineIndex+1)*this._fontOffset.height,t=this._clipTextTop-e;this._scrollTop||(this._scrollTop=t)}else this._scrollTop=this._clipTextTop;this.highlightedText="",this.onLinesReadyObservable.notifyObservers(this)}_drawText(e,t,i,n){const s=this._currentMeasure.width;let o=this._scrollLeft;switch(this._textHorizontalAlignment){case r.o.HORIZONTAL_ALIGNMENT_LEFT:o+=0;break;case r.o.HORIZONTAL_ALIGNMENT_RIGHT:o+=s-t;break;case r.o.HORIZONTAL_ALIGNMENT_CENTER:o+=(s-t)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&n.strokeText(e,this._currentMeasure.left+o,i),n.fillText(e,o,i)}_onCopyText(e){this._isTextHighlightOn=!1;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText}_onCutText(e){if(this._highlightedText){try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._textHasChanged()}}_onPasteText(e){let t="";t=e.clipboardData&&-1!==e.clipboardData.types.indexOf("text/plain")?e.clipboardData.getData("text/plain"):this._host.clipboardData,this._isTextHighlightOn=!1,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,t);const i=t.length-(this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex);this._cursorInfo.globalStartIndex+=i,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()}_draw(e){var t,i;this._scrollLeft=null!==(t=this._scrollLeft)&&void 0!==t?t:0,this._scrollTop=null!==(i=this._scrollTop)&&void 0!==i?i:0,e.save(),this._applyStates(e),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(e.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this.color&&(e.fillStyle=this.color);const n=this._currentMeasure.height,s=this._currentMeasure.width;let o=0;switch(this._textVerticalAlignment){case r.o.VERTICAL_ALIGNMENT_TOP:o=this._fontOffset.ascent;break;case r.o.VERTICAL_ALIGNMENT_BOTTOM:o=n-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case r.o.VERTICAL_ALIGNMENT_CENTER:o=this._fontOffset.ascent+(n-this._fontOffset.height*this._lines.length)/2}e.save(),e.beginPath(),e.fillStyle=this.fontStyle,e.rect(this._clipTextLeft,this._clipTextTop,this._availableWidth+2,this._availableHeight+2),e.clip(),o+=this._scrollTop;for(let t=0;tthis._clipTextLeft+this._availableWidth&&(this._scrollLeft+=this._clipTextLeft+this._availableWidth-t,t=this._clipTextLeft+this._availableWidth,this._markAsDirty());let i=this._scrollTop+this._cursorInfo.currentLineIndex*this._fontOffset.height;ithis._clipTextTop+this._availableHeight&&(this._scrollTop+=this._clipTextTop+this._availableHeight-i-this._fontOffset.height,i=this._clipTextTop+this._availableHeight-this._fontOffset.height,this._markAsDirty()),this._isTextHighlightOn||e.fillRect(t,i,2,this._fontOffset.height)}if(this._resetBlinking(),this._isTextHighlightOn){clearTimeout(this._blinkTimeout),this._highlightedText=this.text.substring(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),e.globalAlpha=this._highligherOpacity,e.fillStyle=this._textHighlightColor;const t=Math.min(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),i=Math.max(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex);let n=this._scrollTop+t*this._fontOffset.height;for(let o=t;o<=i;o++){const a=this._lines[o];let l=this._scrollLeft;switch(this._textHorizontalAlignment){case r.o.HORIZONTAL_ALIGNMENT_LEFT:l+=0;break;case r.o.HORIZONTAL_ALIGNMENT_RIGHT:l+=s-a.width;break;case r.o.HORIZONTAL_ALIGNMENT_CENTER:l+=(s-a.width)/2}const c=o===t?this._cursorInfo.relativeStartIndex:0,h=o===i?this._cursorInfo.relativeEndIndex:a.text.length,_=e.measureText(a.text.substr(0,c)).width,d=a.text.substring(c,h),u=e.measureText(d).width;e.fillRect(l+_,n,u,this._fontOffset.height),n+=this._fontOffset.height}this._cursorInfo.globalEndIndex===this._cursorInfo.globalStartIndex&&this._resetBlinking()}}e.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(e.strokeStyle=this.focusedColor):this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))}_resetBlinking(){clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((()=>{this._blinkIsEven=!this._blinkIsEven,this._markAsDirty()}),500)}_applyStates(e){super._applyStates(e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor)}_onPointerDown(e,t,i,n,r){return!(!super._onPointerDown(e,t,i,n,r)||(this._clickedCoordinateX=t.x,this._clickedCoordinateY=t.y,this._isTextHighlightOn=!1,this._highlightedText="",this._isPointerDown=!0,this._host._capturingControl[i]=this,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))}_onPointerMove(e,t,i,n){0===n.event.movementX&&0===n.event.movementY||(this._host.focusedControl===this&&this._isPointerDown&&(this._clickedCoordinateX=t.x,this._clickedCoordinateY=t.y,this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._isTextHighlightOn=!0),this._markAsDirty()),super._onPointerMove(e,t,i,n))}_updateCursorPosition(){var e;if(this._isFocused)if(this._clickedCoordinateX&&this._clickedCoordinateY){this._isTextHighlightOn||(this._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeStartIndex:0,relativeEndIndex:0,currentLineIndex:0});let t=0,i=0;const n=this._clickedCoordinateY-this._scrollTop,r=Math.floor(n/this._fontOffset.height);this._cursorInfo.currentLineIndex=Math.min(Math.max(r,0),this._lines.length-1);let s=0;const o=this._clickedCoordinateX-(null!==(e=this._scrollLeft)&&void 0!==e?e:0);let a=0;for(let e=0;ei;)i++,a=Math.abs(o-s),s=this._contextForBreakLines.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,i)).width;Math.abs(o-s)>a&&i>0&&i--,t+=i,this._isTextHighlightOn?t=this._highlightCursorInfo.initialStartIndex){for(;t+e<=this._cursorInfo.globalEndIndex;)t+=e,this._cursorInfo.currentLineIndex0&&this._textWrapper.isWord(this._cursorInfo.globalStartIndex-1)?--this._cursorInfo.globalStartIndex:0,i=this._cursorInfo.globalEndIndexthis._markAsDirty()))),this._connectedControl=e,this._markAsDirty())}get x1(){return this._x1.toString(this._host)}set x1(e){this._x1.toString(this._host)!==e&&this._x1.fromString(e)&&this._markAsDirty()}get y1(){return this._y1.toString(this._host)}set y1(e){this._y1.toString(this._host)!==e&&this._y1.fromString(e)&&this._markAsDirty()}get x2(){return this._x2.toString(this._host)}set x2(e){this._x2.toString(this._host)!==e&&this._x2.fromString(e)&&this._markAsDirty()}get y2(){return this._y2.toString(this._host)}set y2(e){this._y2.toString(this._host)!==e&&this._y2.fromString(e)&&this._markAsDirty()}get lineWidth(){return this._lineWidth}set lineWidth(e){this._lineWidth!==e&&(this._lineWidth=e,this._markAsDirty())}set horizontalAlignment(e){}set verticalAlignment(e){}get _effectiveX2(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)}get _effectiveY2(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)}_getTypeName(){return"Line"}_draw(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath(),e.moveTo(this._cachedParentMeasure.left+this._x1.getValue(this._host),this._cachedParentMeasure.top+this._y1.getValue(this._host)),e.lineTo(this._cachedParentMeasure.left+this._effectiveX2,this._cachedParentMeasure.top+this._effectiveY2),e.stroke(),e.restore()}_measure(){this._currentMeasure.width=Math.abs(this._x1.getValue(this._host)-this._effectiveX2)+this._lineWidth,this._currentMeasure.height=Math.abs(this._y1.getValue(this._host)-this._effectiveY2)+this._lineWidth}_computeAlignment(e){this._currentMeasure.left=e.left+Math.min(this._x1.getValue(this._host),this._effectiveX2)-this._lineWidth/2,this._currentMeasure.top=e.top+Math.min(this._y1.getValue(this._host),this._effectiveY2)-this._lineWidth/2}moveToVector3(e,t,i=!1){if(!this._host||this.parent!==this._host._rootContainer)return void R.w1.Error("Cannot move a control to a vector3 if the control is not at root level");const n=this._host._getGlobalViewport(),r=E.P.Project(e,E.y3.Identity(),t.getTransformMatrix(),n);this._moveToProjectedPosition(r,i),r.z<0||r.z>1?this.notRenderable=!0:this.notRenderable=!1}_moveToProjectedPosition(e,t=!1){const i=e.x+this._linkOffsetX.getValue(this._host)+"px",n=e.y+this._linkOffsetY.getValue(this._host)+"px";t?(this.x2=i,this.y2=n,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=n,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)}}(0,c.gn)([(0,d.qC)()],P.prototype,"dash",null),(0,c.gn)([(0,d.qC)()],P.prototype,"x1",null),(0,c.gn)([(0,d.qC)()],P.prototype,"y1",null),(0,c.gn)([(0,d.qC)()],P.prototype,"x2",null),(0,c.gn)([(0,d.qC)()],P.prototype,"y2",null),(0,c.gn)([(0,d.qC)()],P.prototype,"lineWidth",null),(0,a.H)("BABYLON.GUI.Line",P);var I=i("../../../node_modules/@babylonjs/core/Meshes/abstractMesh.js"),M=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js");class D{constructor(e){this._multiLine=e,this._x=new m.s(0),this._y=new m.s(0),this._point=new E.P(0,0,0)}get x(){return this._x.toString(this._multiLine._host)}set x(e){this._x.toString(this._multiLine._host)!==e&&this._x.fromString(e)&&this._multiLine._markAsDirty()}get y(){return this._y.toString(this._multiLine._host)}set y(e){this._y.toString(this._multiLine._host)!==e&&this._y.fromString(e)&&this._multiLine._markAsDirty()}get control(){return this._control}set control(e){this._control!==e&&(this._control&&this._controlObserver&&(this._control.onDirtyObservable.remove(this._controlObserver),this._controlObserver=null),this._control=e,this._control&&(this._controlObserver=this._control.onDirtyObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())}get mesh(){return this._mesh}set mesh(e){this._mesh!==e&&(this._mesh&&this._meshObserver&&this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver),this._mesh=e,this._mesh&&(this._meshObserver=this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())}resetLinks(){this.control=null,this.mesh=null}translate(){return this._point=this._translatePoint(),this._point}_translatePoint(){if(null!=this._mesh)return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new E.P(this._control.centerX,this._control.centerY,1-M.kn);{const e=this._multiLine._host,t=this._x.getValueInPixel(e,Number(e._canvas.width)),i=this._y.getValueInPixel(e,Number(e._canvas.height));return new E.P(t,i,1-M.kn)}}dispose(){this.resetLinks()}}class O extends r.o{constructor(e){super(e),this.name=e,this._lineWidth=1,this.onPointUpdate=()=>{this._markAsDirty()},this._automaticSize=!0,this.isHitTestVisible=!1,this._horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,this._verticalAlignment=r.o.VERTICAL_ALIGNMENT_TOP,this._dash=[],this._points=[]}get dash(){return this._dash}set dash(e){this._dash!==e&&(this._dash=e,this._markAsDirty())}getAt(e){return this._points[e]||(this._points[e]=new D(this)),this._points[e]}add(...e){return e.map((e=>this.push(e)))}push(e){const t=this.getAt(this._points.length);return null==e||(e instanceof I.x?t.mesh=e:e instanceof r.o?t.control=e:null!=e.x&&null!=e.y&&(t.x=e.x,t.y=e.y)),t}remove(e){let t;if(e instanceof D){if(t=this._points.indexOf(e),-1===t)return}else t=e;const i=this._points[t];i&&(i.dispose(),this._points.splice(t,1))}reset(){for(;this._points.length>0;)this.remove(this._points.length-1)}resetLinks(){this._points.forEach((e=>{null!=e&&e.resetLinks()}))}get lineWidth(){return this._lineWidth}set lineWidth(e){this._lineWidth!==e&&(this._lineWidth=e,this._markAsDirty())}set horizontalAlignment(e){}set verticalAlignment(e){}_getTypeName(){return"MultiLine"}_draw(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath();let t,i=!0;this._points.forEach((n=>{n&&(i?(e.moveTo(n._point.x,n._point.y),i=!1):n._point.z<1&&t.z<1?e.lineTo(n._point.x,n._point.y):e.moveTo(n._point.x,n._point.y),t=n._point)})),e.stroke(),e.restore()}_additionalProcessing(){this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((e=>{e&&(e.translate(),(null==this._minX||e._point.xthis._maxX)&&(this._maxX=e._point.x),(null==this._maxY||e._point.y>this._maxY)&&(this._maxY=e._point.y))})),null==this._minX&&(this._minX=0),null==this._minY&&(this._minY=0),null==this._maxX&&(this._maxX=0),null==this._maxY&&(this._maxY=0)}_measure(){null!=this._minX&&null!=this._maxX&&null!=this._minY&&null!=this._maxY&&(this._currentMeasure.width=Math.abs(this._maxX-this._minX)+this._lineWidth,this._currentMeasure.height=Math.abs(this._maxY-this._minY)+this._lineWidth)}_computeAlignment(){null!=this._minX&&null!=this._minY&&(this._currentMeasure.left=this._minX-this._lineWidth/2,this._currentMeasure.top=this._minY-this._lineWidth/2)}dispose(){this.reset(),super.dispose()}}(0,c.gn)([(0,d.qC)()],O.prototype,"dash",null),(0,a.H)("BABYLON.GUI.MultiLine",O);class w extends r.o{constructor(e){super(e),this.name=e,this._isChecked=!1,this._background="black",this._checkSizeRatio=.8,this._thickness=1,this.group="",this.onIsCheckedChangedObservable=new h.y$,this.isPointerBlocker=!0}get thickness(){return this._thickness}set thickness(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())}get checkSizeRatio(){return this._checkSizeRatio}set checkSizeRatio(e){e=Math.max(Math.min(1,e),0),this._checkSizeRatio!==e&&(this._checkSizeRatio=e,this._markAsDirty())}get background(){return this._background}set background(e){this._background!==e&&(this._background=e,this._markAsDirty())}get isChecked(){return this._isChecked}set isChecked(e){this._isChecked!==e&&(this._isChecked=e,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(e),this._isChecked&&this._host&&this._host.executeOnAllControls((e=>{if(e===this)return;if(void 0===e.group)return;const t=e;t.group===this.group&&(t.isChecked=!1)})))}_getTypeName(){return"RadioButton"}_draw(e){e.save(),this._applyStates(e);const t=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),r.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this.color,e.lineWidth=this._thickness,e.stroke(),this._isChecked){e.fillStyle=this._isEnabled?this.color:this._disabledColor;const n=t*this._checkSizeRatio,s=i*this._checkSizeRatio;r.o.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,n/2-this._thickness/2,s/2-this._thickness/2,e),e.fill()}e.restore()}_onPointerDown(e,t,i,n,r){return!!super._onPointerDown(e,t,i,n,r)&&(this.isReadOnly||this.isChecked||(this.isChecked=!0),!0)}static AddRadioButtonWithHeader(e,t,i,n){const o=new _.e;o.isVertical=!1,o.height="30px";const a=new w;a.width="20px",a.height="20px",a.isChecked=i,a.color="green",a.group=t,a.onIsCheckedChangedObservable.add((e=>n(a,e))),o.addControl(a);const l=new s.a;return l.text=e,l.width="180px",l.paddingLeft="5px",l.textHorizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,l.color="white",o.addControl(l),o}}(0,c.gn)([(0,d.qC)()],w.prototype,"thickness",null),(0,c.gn)([(0,d.qC)()],w.prototype,"group",void 0),(0,c.gn)([(0,d.qC)()],w.prototype,"checkSizeRatio",null),(0,c.gn)([(0,d.qC)()],w.prototype,"background",null),(0,c.gn)([(0,d.qC)()],w.prototype,"isChecked",null),(0,a.H)("BABYLON.GUI.RadioButton",w);class F extends r.o{constructor(e){super(e),this.name=e,this._thumbWidth=new m.s(20,m.s.UNITMODE_PIXEL,!1),this._minimum=0,this._maximum=100,this._value=50,this._isVertical=!1,this._barOffset=new m.s(5,m.s.UNITMODE_PIXEL,!1),this._isThumbClamped=!1,this._displayThumb=!0,this._step=0,this._lastPointerDownId=-1,this._effectiveBarOffset=0,this.onValueChangedObservable=new h.y$,this._pointerIsDown=!1,this.isPointerBlocker=!0}get displayThumb(){return this._displayThumb}set displayThumb(e){this._displayThumb!==e&&(this._displayThumb=e,this._markAsDirty())}get step(){return this._step}set step(e){this._step!==e&&(this._step=e,this._markAsDirty())}get barOffset(){return this._barOffset.toString(this._host)}get barOffsetInPixels(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)}set barOffset(e){this._barOffset.toString(this._host)!==e&&this._barOffset.fromString(e)&&this._markAsDirty()}get thumbWidth(){return this._thumbWidth.toString(this._host)}get thumbWidthInPixels(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)}set thumbWidth(e){this._thumbWidth.toString(this._host)!==e&&this._thumbWidth.fromString(e)&&this._markAsDirty()}get minimum(){return this._minimum}set minimum(e){this._minimum!==e&&(this._minimum=e,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))}get maximum(){return this._maximum}set maximum(e){this._maximum!==e&&(this._maximum=e,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))}get value(){return this._value}set value(e){e=Math.max(Math.min(e,this._maximum),this._minimum),this._value!==e&&(this._value=e,this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical!==e&&(this._isVertical=e,this._markAsDirty())}get isThumbClamped(){return this._isThumbClamped}set isThumbClamped(e){this._isThumbClamped!==e&&(this._isThumbClamped=e,this._markAsDirty())}_getTypeName(){return"BaseSlider"}_getThumbPosition(){return this.isVertical?(this.maximum-this.value)/(this.maximum-this.minimum)*this._backgroundBoxLength:(this.value-this.minimum)/(this.maximum-this.minimum)*this._backgroundBoxLength}_getThumbThickness(e){let t=0;switch(e){case"circle":t=this._thumbWidth.isPixel?Math.max(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host);break;case"rectangle":t=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)}return t}_prepareRenderingData(e){this._effectiveBarOffset=0,this._renderLeft=this._currentMeasure.left,this._renderTop=this._currentMeasure.top,this._renderWidth=this._currentMeasure.width,this._renderHeight=this._currentMeasure.height,this._backgroundBoxLength=Math.max(this._currentMeasure.width,this._currentMeasure.height),this._backgroundBoxThickness=Math.min(this._currentMeasure.width,this._currentMeasure.height),this._effectiveThumbThickness=this._getThumbThickness(e),this.displayThumb&&(this._backgroundBoxLength-=this._effectiveThumbThickness),this.isVertical&&this._currentMeasure.height0&&this._bucketHeight>0}_makeBuckets(){this._buckets={},this._bucketLen=Math.ceil(this.widthInPixels/this._bucketWidth),this._dispatchInBuckets(this._children),this._oldLeft=null,this._oldTop=null}_dispatchInBuckets(e){for(let t=0;t0&&this._dispatchInBuckets(i._children)}}_updateMeasures(){const e=0|this.leftInPixels,t=0|this.topInPixels;this._measureForChildren.left-=e,this._measureForChildren.top-=t,this._currentMeasure.left-=e,this._currentMeasure.top-=t,this._customData.origLeftForChildren=this._measureForChildren.left,this._customData.origTopForChildren=this._measureForChildren.top,this._customData.origLeft=this._currentMeasure.left,this._customData.origTop=this._currentMeasure.top,this._updateChildrenMeasures(this._children,e,t)}_updateChildrenMeasures(e,t,i){for(let n=0;n0&&this._updateChildrenMeasures(r._children,t,i)}}_restoreMeasures(){const e=0|this.leftInPixels,t=0|this.topInPixels;this._measureForChildren.left=this._customData.origLeftForChildren+e,this._measureForChildren.top=this._customData.origTopForChildren+t,this._currentMeasure.left=this._customData.origLeft+e,this._currentMeasure.top=this._customData.origTop+t}_getTypeName(){return"ScrollViewerWindow"}_additionalProcessing(e,t){super._additionalProcessing(e,t),this._parentMeasure=e,this._measureForChildren.left=this._currentMeasure.left,this._measureForChildren.top=this._currentMeasure.top,this._measureForChildren.width=e.width,this._measureForChildren.height=e.height}_layout(e,t){return this._freezeControls?(this.invalidateRect(),!1):super._layout(e,t)}_scrollChildren(e,t,i){for(let n=0;n0&&this._scrollChildren(r._children,t,i)}}_scrollChildrenWithBuckets(e,t,i,n){const r=Math.max(0,Math.floor(-e/this._bucketWidth)),s=Math.floor((-e+this._parentMeasure.width-1)/this._bucketWidth),o=Math.floor((-t+this._parentMeasure.height-1)/this._bucketHeight);let a=Math.max(0,Math.floor(-t/this._bucketHeight));for(;a<=o;){for(let e=r;e<=s;++e){const t=a*this._bucketLen+e,r=this._buckets[t];if(r)for(let e=0;ethis._tempMeasure.left+this._tempMeasure.width||tthis._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(t-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(e-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));let n=0;n=this.isVertical?-(t-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(e-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*n*(this.maximum-this.minimum),this._originX=e,this._originY=t}_onPointerDown(e,t,i,n,r){return this._first=!0,super._onPointerDown(e,t,i,n,r)}}(0,c.gn)([(0,d.qC)()],k.prototype,"borderColor",null),(0,c.gn)([(0,d.qC)()],k.prototype,"background",null),(0,c.gn)([(0,d.qC)()],k.prototype,"invertScrollDirection",null);class V extends F{constructor(e){super(e),this.name=e,this._thumbLength=.5,this._thumbHeight=1,this._barImageHeight=1,this._tempMeasure=new N.U(0,0,0,0),this._invertScrollDirection=!1,this.num90RotationInVerticalMode=1}get invertScrollDirection(){return this._invertScrollDirection}set invertScrollDirection(e){this._invertScrollDirection=e}get backgroundImage(){return this._backgroundBaseImage}set backgroundImage(e){this._backgroundBaseImage!==e&&(this._backgroundBaseImage=e,this.isVertical&&0!==this.num90RotationInVerticalMode?e.isLoaded?(this._backgroundImage=e._rotate90(this.num90RotationInVerticalMode,!0),this._markAsDirty()):e.onImageLoadedObservable.addOnce((()=>{const t=e._rotate90(this.num90RotationInVerticalMode,!0);this._backgroundImage=t,t.isLoaded||t.onImageLoadedObservable.addOnce((()=>{this._markAsDirty()})),this._markAsDirty()})):(this._backgroundImage=e,e&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((()=>{this._markAsDirty()})),this._markAsDirty()))}get thumbImage(){return this._thumbBaseImage}set thumbImage(e){this._thumbBaseImage!==e&&(this._thumbBaseImage=e,this.isVertical&&0!==this.num90RotationInVerticalMode?e.isLoaded?(this._thumbImage=e._rotate90(-this.num90RotationInVerticalMode,!0),this._markAsDirty()):e.onImageLoadedObservable.addOnce((()=>{const t=e._rotate90(-this.num90RotationInVerticalMode,!0);this._thumbImage=t,t.isLoaded||t.onImageLoadedObservable.addOnce((()=>{this._markAsDirty()})),this._markAsDirty()})):(this._thumbImage=e,e&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((()=>{this._markAsDirty()})),this._markAsDirty()))}get thumbLength(){return this._thumbLength}set thumbLength(e){this._thumbLength!==e&&(this._thumbLength=e,this._markAsDirty())}get thumbHeight(){return this._thumbHeight}set thumbHeight(e){this._thumbLength!==e&&(this._thumbHeight=e,this._markAsDirty())}get barImageHeight(){return this._barImageHeight}set barImageHeight(e){this._barImageHeight!==e&&(this._barImageHeight=e,this._markAsDirty())}_getTypeName(){return"ImageScrollBar"}_getThumbThickness(){let e=0;return e=this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host),e}_draw(e){e.save(),this._applyStates(e),this._prepareRenderingData("rectangle");const t=this._getThumbPosition(),i=this._renderLeft,n=this._renderTop,r=this._renderWidth,s=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,n,r,s),this.isVertical?(this._tempMeasure.copyFromFloats(i+r*(1-this._barImageHeight)*.5,this._currentMeasure.top,r*this._barImageHeight,s),this._tempMeasure.height+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,n+s*(1-this._barImageHeight)*.5,r,s*this._barImageHeight),this._tempMeasure.width+=this._effectiveThumbThickness,this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure)),this._backgroundImage._draw(e)),this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset+this._currentMeasure.width*(1-this._thumbHeight)*.5,this._currentMeasure.top+t,this._currentMeasure.width*this._thumbHeight,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+t,this._currentMeasure.top+this._currentMeasure.height*(1-this._thumbHeight)*.5,this._effectiveThumbThickness,this._currentMeasure.height*this._thumbHeight),this._thumbImage&&(this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(e)),e.restore()}_updateValueFromPointer(e,t){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(e,t,this._transformedPosition),e=this._transformedPosition.x,t=this._transformedPosition.y);const i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=e,this._originY=t,(ethis._tempMeasure.left+this._tempMeasure.width||tthis._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(t-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(e-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));let n=0;n=this.isVertical?-(t-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(e-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness),this.value+=i*n*(this.maximum-this.minimum),this._originX=e,this._originY=t}_onPointerDown(e,t,i,n,r){return this._first=!0,super._onPointerDown(e,t,i,n,r)}}(0,c.gn)([(0,d.qC)()],V.prototype,"num90RotationInVerticalMode",void 0),(0,c.gn)([(0,d.qC)()],V.prototype,"invertScrollDirection",null);class U extends n.A{constructor(e,t){super(e),this._barSize=20,this._pointerIsOver=!1,this._wheelPrecision=.05,this._thumbLength=.5,this._thumbHeight=1,this._barImageHeight=1,this._horizontalBarImageHeight=1,this._verticalBarImageHeight=1,this._oldWindowContentsWidth=0,this._oldWindowContentsHeight=0,this._forceHorizontalBar=!1,this._forceVerticalBar=!1,this._useImageBar=t||!1,this.onDirtyObservable.add((()=>{this._horizontalBarSpace.color=this.color,this._verticalBarSpace.color=this.color,this._dragSpace.color=this.color})),this.onPointerEnterObservable.add((()=>{this._pointerIsOver=!0})),this.onPointerOutObservable.add((()=>{this._pointerIsOver=!1})),this._grid=new y.r,this._useImageBar?(this._horizontalBar=new V,this._verticalBar=new V):(this._horizontalBar=new k,this._verticalBar=new k),this._window=new L("scrollViewer_window"),this._window.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,this._window.verticalAlignment=r.o.VERTICAL_ALIGNMENT_TOP,this._grid.addColumnDefinition(1),this._grid.addColumnDefinition(0,!0),this._grid.addRowDefinition(1),this._grid.addRowDefinition(0,!0),super.addControl(this._grid),this._grid.addControl(this._window,0,0),this._verticalBarSpace=new n.A,this._verticalBarSpace.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,this._verticalBarSpace.verticalAlignment=r.o.VERTICAL_ALIGNMENT_TOP,this._verticalBarSpace.thickness=1,this._grid.addControl(this._verticalBarSpace,0,1),this._addBar(this._verticalBar,this._verticalBarSpace,!0,Math.PI),this._horizontalBarSpace=new n.A,this._horizontalBarSpace.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,this._horizontalBarSpace.verticalAlignment=r.o.VERTICAL_ALIGNMENT_TOP,this._horizontalBarSpace.thickness=1,this._grid.addControl(this._horizontalBarSpace,1,0),this._addBar(this._horizontalBar,this._horizontalBarSpace,!1,0),this._dragSpace=new n.A,this._dragSpace.thickness=1,this._grid.addControl(this._dragSpace,1,1),this._useImageBar||(this.barColor="grey",this.barBackground="transparent")}get horizontalBar(){return this._horizontalBar}get verticalBar(){return this._verticalBar}addControl(e){return e?(this._window.addControl(e),this):this}removeControl(e){return this._window.removeControl(e),this}get children(){return this._window.children}_flagDescendantsAsMatrixDirty(){for(const e of this._children)e._markMatrixAsDirty()}get freezeControls(){return this._window.freezeControls}set freezeControls(e){this._window.freezeControls=e}get bucketWidth(){return this._window.bucketWidth}get bucketHeight(){return this._window.bucketHeight}setBucketSizes(e,t){this._window.setBucketSizes(e,t)}get forceHorizontalBar(){return this._forceHorizontalBar}set forceHorizontalBar(e){this._grid.setRowDefinition(1,e?this._barSize:0,!0),this._horizontalBar.isVisible=e,this._forceHorizontalBar=e}get forceVerticalBar(){return this._forceVerticalBar}set forceVerticalBar(e){this._grid.setColumnDefinition(1,e?this._barSize:0,!0),this._verticalBar.isVisible=e,this._forceVerticalBar=e}resetWindow(){this._window.width="100%",this._window.height="100%"}_getTypeName(){return"ScrollViewer"}_buildClientSizes(){const e=this.host.idealRatio;this._window.parentClientWidth=this._currentMeasure.width-(this._verticalBar.isVisible||this.forceVerticalBar?this._barSize*e:0)-2*this.thickness,this._window.parentClientHeight=this._currentMeasure.height-(this._horizontalBar.isVisible||this.forceHorizontalBar?this._barSize*e:0)-2*this.thickness,this._clientWidth=this._window.parentClientWidth,this._clientHeight=this._window.parentClientHeight}_additionalProcessing(e,t){super._additionalProcessing(e,t),this._buildClientSizes()}_postMeasure(){super._postMeasure(),this._updateScroller(),this._setWindowPosition(!1)}get wheelPrecision(){return this._wheelPrecision}set wheelPrecision(e){this._wheelPrecision!==e&&(e<0&&(e=0),e>1&&(e=1),this._wheelPrecision=e)}get scrollBackground(){return this._horizontalBarSpace.background}set scrollBackground(e){this._horizontalBarSpace.background!==e&&(this._horizontalBarSpace.background=e,this._verticalBarSpace.background=e)}get barColor(){return this._barColor}set barColor(e){this._barColor!==e&&(this._barColor=e,this._horizontalBar.color=e,this._verticalBar.color=e)}get thumbImage(){return this._barImage}set thumbImage(e){if(this._barImage===e)return;this._barImage=e;const t=this._horizontalBar,i=this._verticalBar;t.thumbImage=e,i.thumbImage=e}get horizontalThumbImage(){return this._horizontalBarImage}set horizontalThumbImage(e){this._horizontalBarImage!==e&&(this._horizontalBarImage=e,this._horizontalBar.thumbImage=e)}get verticalThumbImage(){return this._verticalBarImage}set verticalThumbImage(e){this._verticalBarImage!==e&&(this._verticalBarImage=e,this._verticalBar.thumbImage=e)}get barSize(){return this._barSize}set barSize(e){this._barSize!==e&&(this._barSize=e,this._markAsDirty(),this._horizontalBar.isVisible&&this._grid.setRowDefinition(1,this._barSize,!0),this._verticalBar.isVisible&&this._grid.setColumnDefinition(1,this._barSize,!0))}get thumbLength(){return this._thumbLength}set thumbLength(e){if(this._thumbLength===e)return;e<=0&&(e=.1),e>1&&(e=1),this._thumbLength=e;const t=this._horizontalBar,i=this._verticalBar;t.thumbLength=e,i.thumbLength=e,this._markAsDirty()}get thumbHeight(){return this._thumbHeight}set thumbHeight(e){if(this._thumbHeight===e)return;e<=0&&(e=.1),e>1&&(e=1),this._thumbHeight=e;const t=this._horizontalBar,i=this._verticalBar;t.thumbHeight=e,i.thumbHeight=e,this._markAsDirty()}get barImageHeight(){return this._barImageHeight}set barImageHeight(e){if(this._barImageHeight===e)return;e<=0&&(e=.1),e>1&&(e=1),this._barImageHeight=e;const t=this._horizontalBar,i=this._verticalBar;t.barImageHeight=e,i.barImageHeight=e,this._markAsDirty()}get horizontalBarImageHeight(){return this._horizontalBarImageHeight}set horizontalBarImageHeight(e){this._horizontalBarImageHeight!==e&&(e<=0&&(e=.1),e>1&&(e=1),this._horizontalBarImageHeight=e,this._horizontalBar.barImageHeight=e,this._markAsDirty())}get verticalBarImageHeight(){return this._verticalBarImageHeight}set verticalBarImageHeight(e){this._verticalBarImageHeight!==e&&(e<=0&&(e=.1),e>1&&(e=1),this._verticalBarImageHeight=e,this._verticalBar.barImageHeight=e,this._markAsDirty())}get barBackground(){return this._barBackground}set barBackground(e){if(this._barBackground===e)return;this._barBackground=e;const t=this._horizontalBar,i=this._verticalBar;t.background=e,i.background=e,this._dragSpace.background=e}get barImage(){return this._barBackgroundImage}set barImage(e){this._barBackgroundImage=e;const t=this._horizontalBar,i=this._verticalBar;t.backgroundImage=e,i.backgroundImage=e}get horizontalBarImage(){return this._horizontalBarBackgroundImage}set horizontalBarImage(e){this._horizontalBarBackgroundImage=e,this._horizontalBar.backgroundImage=e}get verticalBarImage(){return this._verticalBarBackgroundImage}set verticalBarImage(e){this._verticalBarBackgroundImage=e,this._verticalBar.backgroundImage=e}_setWindowPosition(e=!0){const t=this.host.idealRatio,i=this._window._currentMeasure.width,n=this._window._currentMeasure.height;if(!e&&this._oldWindowContentsWidth===i&&this._oldWindowContentsHeight===n)return;this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=n;const r=this._clientWidth-i,s=this._clientHeight-n,o=this._horizontalBar.value/t*r+"px",a=this._verticalBar.value/t*s+"px";o!==this._window.left&&(this._window.left=o,this.freezeControls||(this._rebuildLayout=!0)),a!==this._window.top&&(this._window.top=a,this.freezeControls||(this._rebuildLayout=!0))}_updateScroller(){const e=this._window._currentMeasure.width,t=this._window._currentMeasure.height;this._horizontalBar.isVisible&&e<=this._clientWidth&&!this.forceHorizontalBar?(this._grid.setRowDefinition(1,0,!0),this._horizontalBar.isVisible=!1,this._horizontalBar.value=0,this._rebuildLayout=!0):!this._horizontalBar.isVisible&&(e>this._clientWidth||this.forceHorizontalBar)&&(this._grid.setRowDefinition(1,this._barSize,!0),this._horizontalBar.isVisible=!0,this._rebuildLayout=!0),this._verticalBar.isVisible&&t<=this._clientHeight&&!this.forceVerticalBar?(this._grid.setColumnDefinition(1,0,!0),this._verticalBar.isVisible=!1,this._verticalBar.value=0,this._rebuildLayout=!0):!this._verticalBar.isVisible&&(t>this._clientHeight||this.forceVerticalBar)&&(this._grid.setColumnDefinition(1,this._barSize,!0),this._verticalBar.isVisible=!0,this._rebuildLayout=!0),this._buildClientSizes();const i=this.host.idealRatio;this._horizontalBar.thumbWidth=.9*this._thumbLength*(this._clientWidth/i)+"px",this._verticalBar.thumbWidth=.9*this._thumbLength*(this._clientHeight/i)+"px"}_link(e){super._link(e),this._attachWheel()}_addBar(e,t,i,n){e.paddingLeft=0,e.width="100%",e.height="100%",e.barOffset=0,e.value=0,e.maximum=1,e.horizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_CENTER,e.verticalAlignment=r.o.VERTICAL_ALIGNMENT_CENTER,e.isVertical=i,e.rotation=n,e.isVisible=!1,t.addControl(e),e.onValueChangedObservable.add((()=>{this._setWindowPosition()}))}_attachWheel(){this._host&&!this._onWheelObserver&&(this._onWheelObserver=this.onWheelObservable.add((e=>{this._pointerIsOver&&!this.isReadOnly&&(1==this._verticalBar.isVisible&&(e.y<0&&this._verticalBar.value>0?this._verticalBar.value-=this._wheelPrecision:e.y>0&&this._verticalBar.value0&&this._horizontalBar.value>0&&(this._horizontalBar.value-=this._wheelPrecision)))})))}_renderHighlightSpecific(e){this.isHighlighted&&(super._renderHighlightSpecific(e),this._grid._renderHighlightSpecific(e),e.restore())}dispose(){this.onWheelObservable.remove(this._onWheelObserver),this._onWheelObserver=null,super.dispose()}}(0,c.gn)([(0,d.qC)()],U.prototype,"wheelPrecision",null),(0,c.gn)([(0,d.qC)()],U.prototype,"scrollBackground",null),(0,c.gn)([(0,d.qC)()],U.prototype,"barColor",null),(0,c.gn)([(0,d.qC)()],U.prototype,"barSize",null),(0,c.gn)([(0,d.qC)()],U.prototype,"barBackground",null),(0,a.H)("BABYLON.GUI.ScrollViewer",U);class G extends n.A{constructor(e,t){super(e),this.name=e,this.onIsActiveChangedObservable=new h.y$,this.delegatePickingToChildren=!1,this._isActive=!1,this.group=null!=t?t:"",this.thickness=0,this.isPointerBlocker=!0;let i=null;this.toActiveAnimation=()=>{this.thickness=1},this.toInactiveAnimation=()=>{this.thickness=0},this.pointerEnterActiveAnimation=()=>{i=this.alpha,this.alpha-=.1},this.pointerOutActiveAnimation=()=>{null!==i&&(this.alpha=i)},this.pointerDownActiveAnimation=()=>{this.scaleX-=.05,this.scaleY-=.05},this.pointerUpActiveAnimation=()=>{this.scaleX+=.05,this.scaleY+=.05},this.pointerEnterInactiveAnimation=()=>{i=this.alpha,this.alpha-=.1},this.pointerOutInactiveAnimation=()=>{null!==i&&(this.alpha=i)},this.pointerDownInactiveAnimation=()=>{this.scaleX-=.05,this.scaleY-=.05},this.pointerUpInactiveAnimation=()=>{this.scaleX+=.05,this.scaleY+=.05}}get group(){return this._group}set group(e){this._group!==e&&(this._group=e)}get isActive(){return this._isActive}set isActive(e){var t,i;this._isActive!==e&&(this._isActive=e,this._isActive?null===(t=this.toActiveAnimation)||void 0===t||t.call(this):null===(i=this.toInactiveAnimation)||void 0===i||i.call(this),this._markAsDirty(),this.onIsActiveChangedObservable.notifyObservers(e),this._isActive&&this._host&&this._group&&this._host.executeOnAllControls((e=>{if("ToggleButton"===e.typeName){if(e===this)return;const t=e;t.group===this.group&&(t.isActive=!1)}})))}_getTypeName(){return"ToggleButton"}_processPicking(e,t,i,n,r,s,o,a){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!super.contains(e,t))return!1;if(this.delegatePickingToChildren){let i=!1;for(let n=this._children.length-1;n>=0;n--){const r=this._children[n];if(r.isEnabled&&r.isHitTestVisible&&r.isVisible&&!r.notRenderable&&r.contains(e,t)){i=!0;break}}if(!i)return!1}return this._processObservables(n,e,t,i,r,s,o,a),!0}_onPointerEnter(e,t){return!!super._onPointerEnter(e,t)&&(this.isReadOnly||(this._isActive?this.pointerEnterActiveAnimation&&this.pointerEnterActiveAnimation():this.pointerEnterInactiveAnimation&&this.pointerEnterInactiveAnimation()),!0)}_onPointerOut(e,t,i=!1){this.isReadOnly||(this._isActive?this.pointerOutActiveAnimation&&this.pointerOutActiveAnimation():this.pointerOutInactiveAnimation&&this.pointerOutInactiveAnimation()),super._onPointerOut(e,t,i)}_onPointerDown(e,t,i,n,r){return!!super._onPointerDown(e,t,i,n,r)&&(this.isReadOnly||(this._isActive?this.pointerDownActiveAnimation&&this.pointerDownActiveAnimation():this.pointerDownInactiveAnimation&&this.pointerDownInactiveAnimation()),!0)}_onPointerUp(e,t,i,n,r,s){this.isReadOnly||(this._isActive?this.pointerUpActiveAnimation&&this.pointerUpActiveAnimation():this.pointerUpInactiveAnimation&&this.pointerUpInactiveAnimation()),super._onPointerUp(e,t,i,n,r,s)}}(0,a.H)("BABYLON.GUI.ToggleButton",G);class j extends _.e{constructor(){super(...arguments),this.onKeyPressObservable=new h.y$,this.defaultButtonWidth="40px",this.defaultButtonHeight="40px",this.defaultButtonPaddingLeft="2px",this.defaultButtonPaddingRight="2px",this.defaultButtonPaddingTop="2px",this.defaultButtonPaddingBottom="2px",this.defaultButtonColor="#DDD",this.defaultButtonBackground="#070707",this.shiftButtonColor="#7799FF",this.selectedShiftThickness=1,this.shiftState=0,this._currentlyConnectedInputText=null,this._connectedInputTexts=[],this._onKeyPressObserver=null}_getTypeName(){return"VirtualKeyboard"}_createKey(e,t){const i=l.CreateSimpleButton(e,e);return i.width=t&&t.width?t.width:this.defaultButtonWidth,i.height=t&&t.height?t.height:this.defaultButtonHeight,i.color=t&&t.color?t.color:this.defaultButtonColor,i.background=t&&t.background?t.background:this.defaultButtonBackground,i.paddingLeft=t&&t.paddingLeft?t.paddingLeft:this.defaultButtonPaddingLeft,i.paddingRight=t&&t.paddingRight?t.paddingRight:this.defaultButtonPaddingRight,i.paddingTop=t&&t.paddingTop?t.paddingTop:this.defaultButtonPaddingTop,i.paddingBottom=t&&t.paddingBottom?t.paddingBottom:this.defaultButtonPaddingBottom,i.thickness=0,i.isFocusInvisible=!0,i.shadowColor=this.shadowColor,i.shadowBlur=this.shadowBlur,i.shadowOffsetX=this.shadowOffsetX,i.shadowOffsetY=this.shadowOffsetY,i.onPointerUpObservable.add((()=>{this.onKeyPressObservable.notifyObservers(e)})),i}addKeysRow(e,t){const i=new _.e;i.isVertical=!1,i.isFocusInvisible=!0;let n=null;for(let r=0;rn.heightInPixels)&&(n=o),i.addControl(o)}i.height=n?n.height:this.defaultButtonHeight,this.addControl(i)}applyShiftState(e){if(this.children)for(let t=0;t1?this.selectedShiftThickness:0),r.text=e>0?r.text.toUpperCase():r.text.toLowerCase()}}}get connectedInputText(){return this._currentlyConnectedInputText}connect(e){if(this._connectedInputTexts.some((t=>t.input===e)))return;null===this._onKeyPressObserver&&(this._onKeyPressObserver=this.onKeyPressObservable.add((e=>{if(this._currentlyConnectedInputText){switch(this._currentlyConnectedInputText._host.focusedControl=this._currentlyConnectedInputText,e){case"⇧":return this.shiftState++,this.shiftState>2&&(this.shiftState=0),void this.applyShiftState(this.shiftState);case"←":return void(this._currentlyConnectedInputText instanceof T?this._currentlyConnectedInputText.alternativeProcessKey("Backspace"):this._currentlyConnectedInputText.processKey(8));case"↵":return void(this._currentlyConnectedInputText instanceof T?this._currentlyConnectedInputText.alternativeProcessKey("Enter"):this._currentlyConnectedInputText.processKey(13))}this._currentlyConnectedInputText instanceof T?this._currentlyConnectedInputText.alternativeProcessKey("",this.shiftState?e.toUpperCase():e):this._currentlyConnectedInputText.processKey(-1,this.shiftState?e.toUpperCase():e),1===this.shiftState&&(this.shiftState=0,this.applyShiftState(this.shiftState))}}))),this.isVisible=!1,this._currentlyConnectedInputText=e,e._connectedVirtualKeyboard=this;const t=e.onFocusObservable.add((()=>{this._currentlyConnectedInputText=e,e._connectedVirtualKeyboard=this,this.isVisible=!0})),i=e.onBlurObservable.add((()=>{e._connectedVirtualKeyboard=null,this._currentlyConnectedInputText=null,this.isVisible=!1}));this._connectedInputTexts.push({input:e,onBlurObserver:i,onFocusObserver:t})}disconnect(e){if(e){const t=this._connectedInputTexts.filter((t=>t.input===e));1===t.length&&(this._removeConnectedInputObservables(t[0]),this._connectedInputTexts=this._connectedInputTexts.filter((t=>t.input!==e)),this._currentlyConnectedInputText===e&&(this._currentlyConnectedInputText=null))}else this._connectedInputTexts.forEach((e=>{this._removeConnectedInputObservables(e)})),this._connectedInputTexts.length=0;0===this._connectedInputTexts.length&&(this._currentlyConnectedInputText=null,this.onKeyPressObservable.remove(this._onKeyPressObserver),this._onKeyPressObserver=null)}_removeConnectedInputObservables(e){e.input._connectedVirtualKeyboard=null,e.input.onFocusObservable.remove(e.onFocusObserver),e.input.onBlurObservable.remove(e.onBlurObserver)}dispose(){super.dispose(),this.disconnect()}static CreateDefaultLayout(e){const t=new j(e);return t.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),t.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),t.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),t.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),t.addKeysRow([" "],[{width:"200px"}]),t}_parseFromContent(e,t){super._parseFromContent(e,t);for(const e of this.children)if("StackPanel"===e.getClassName()){const t=e;for(const e of t.children)"Button"===e.getClassName()&&e.name&&e.onPointerUpObservable.add((()=>{this.onKeyPressObservable.notifyObservers(e.name)}))}}}(0,a.H)("BABYLON.GUI.VirtualKeyboard",j);class W extends r.o{constructor(e){super(e),this.name=e,this._cellWidth=20,this._cellHeight=20,this._minorLineTickness=1,this._minorLineColor="DarkGray",this._majorLineTickness=2,this._majorLineColor="White",this._majorLineFrequency=5,this._background="Black",this._displayMajorLines=!0,this._displayMinorLines=!0}get displayMinorLines(){return this._displayMinorLines}set displayMinorLines(e){this._displayMinorLines!==e&&(this._displayMinorLines=e,this._markAsDirty())}get displayMajorLines(){return this._displayMajorLines}set displayMajorLines(e){this._displayMajorLines!==e&&(this._displayMajorLines=e,this._markAsDirty())}get background(){return this._background}set background(e){this._background!==e&&(this._background=e,this._markAsDirty())}get cellWidth(){return this._cellWidth}set cellWidth(e){this._cellWidth=e,this._markAsDirty()}get cellHeight(){return this._cellHeight}set cellHeight(e){this._cellHeight=e,this._markAsDirty()}get minorLineTickness(){return this._minorLineTickness}set minorLineTickness(e){this._minorLineTickness=e,this._markAsDirty()}get minorLineColor(){return this._minorLineColor}set minorLineColor(e){this._minorLineColor=e,this._markAsDirty()}get majorLineTickness(){return this._majorLineTickness}set majorLineTickness(e){this._majorLineTickness=e,this._markAsDirty()}get majorLineColor(){return this._majorLineColor}set majorLineColor(e){this._majorLineColor=e,this._markAsDirty()}get majorLineFrequency(){return this._majorLineFrequency}set majorLineFrequency(e){this._majorLineFrequency=e,this._markAsDirty()}_draw(e){if(e.save(),this._applyStates(e),this._isEnabled){this._background&&(e.fillStyle=this._background,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height));const t=this._currentMeasure.width/this._cellWidth,i=this._currentMeasure.height/this._cellHeight,n=this._currentMeasure.left+this._currentMeasure.width/2,r=this._currentMeasure.top+this._currentMeasure.height/2;if(this._displayMinorLines){e.strokeStyle=this._minorLineColor,e.lineWidth=this._minorLineTickness;for(let i=-t/2+1;ithis._markAsDirty())),this._markAsDirty())}get valueBarImage(){return this._valueBarImage}set valueBarImage(e){this._valueBarImage!==e&&(this._valueBarImage=e,e&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((()=>this._markAsDirty())),this._markAsDirty())}get thumbImage(){return this._thumbImage}set thumbImage(e){this._thumbImage!==e&&(this._thumbImage=e,e&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((()=>this._markAsDirty())),this._markAsDirty())}_getTypeName(){return"ImageBasedSlider"}_draw(e){e.save(),this._applyStates(e),this._prepareRenderingData("rectangle");const t=this._getThumbPosition(),i=this._renderLeft,n=this._renderTop,r=this._renderWidth,s=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,n,r,s),this.isThumbClamped&&this.displayThumb&&(this.isVertical?this._tempMeasure.height+=this._effectiveThumbThickness:this._tempMeasure.width+=this._effectiveThumbThickness),this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure),this._backgroundImage._draw(e)),this._valueBarImage&&(this.isVertical?this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,n+t,r,s-t+this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(i,n+t,r,s-t):this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,n,t+this._effectiveThumbThickness/2,s):this._tempMeasure.copyFromFloats(i,n,t,s),this._valueBarImage._currentMeasure.copyFrom(this._tempMeasure),this._valueBarImage._draw(e)),this.displayThumb&&(this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset,this._currentMeasure.top+t,this._currentMeasure.width,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+t,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(e)),e.restore()}serialize(e){super.serialize(e);const t={},i={},n={};this.backgroundImage.serialize(t),this.thumbImage.serialize(i),this.valueBarImage.serialize(n),e.backgroundImage=t,e.thumbImage=i,e.valueBarImage=n}_parseFromContent(e,t){super._parseFromContent(e,t),this.backgroundImage=o.E.Parse(e.backgroundImage,t),this.thumbImage=o.E.Parse(e.thumbImage,t),this.valueBarImage=o.E.Parse(e.valueBarImage,t)}}(0,c.gn)([(0,d.qC)()],z.prototype,"displayThumb",null),(0,a.H)("BABYLON.GUI.ImageBasedSlider",z),r.o.AddHeader=function(e,t,i,n){const o=new _.e("panel"),a=!n||n.isHorizontal,l=!n||n.controlFirst;o.isVertical=!a;const c=new s.a("header");return c.text=t,c.textHorizontalAlignment=r.o.HORIZONTAL_ALIGNMENT_LEFT,a?c.width=i:c.height=i,l?(o.addControl(e),o.addControl(c),c.paddingLeft="5px"):(o.addControl(c),o.addControl(e),c.paddingRight="5px"),c.shadowBlur=e.shadowBlur,c.shadowColor=e.shadowColor,c.shadowOffsetX=e.shadowOffsetX,c.shadowOffsetY=e.shadowOffsetY,o};var H=i("../../../node_modules/@babylonjs/gui/2D/advancedDynamicTexture.js");i("../../../node_modules/@babylonjs/core/Misc/perfCounter.js"),i("../../../node_modules/@babylonjs/gui/2D/math2D.js"),i("../../../node_modules/@babylonjs/gui/2D/style.js")},"../../../node_modules/@babylonjs/gui/2D/math2D.js":function(e,t,i){"use strict";i.d(t,{G:function(){return o},N:function(){return s}});var n=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),r=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js");class s extends n.FM{constructor(e,t=0){super(e.x,e.y),this.buttonIndex=t}}class o{constructor(e,t,i,n,r,s){this.m=new Float32Array(6),this.fromValues(e,t,i,n,r,s)}fromValues(e,t,i,n,r,s){return this.m[0]=e,this.m[1]=t,this.m[2]=i,this.m[3]=n,this.m[4]=r,this.m[5]=s,this}determinant(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]}invertToRef(e){const t=this.m[0],i=this.m[1],n=this.m[2],s=this.m[3],o=this.m[4],a=this.m[5],l=this.determinant();if(l{e.attach(this)})):e.attach(this),this._behaviors.push(e),this}removeBehavior(e){const t=this._behaviors.indexOf(e);return-1===t||(this._behaviors[t].detach(),this._behaviors.splice(t,1)),this}getBehaviorByName(e){for(const t of this._behaviors)if(t.name===e)return t;return null}get isVisible(){return this._isVisible}set isVisible(e){if(this._isVisible===e)return;this._isVisible=e;const t=this.mesh;t&&t.setEnabled(e)}get typeName(){return this._getTypeName()}getClassName(){return this._getTypeName()}_getTypeName(){return"Control3D"}get node(){return this._node}get mesh(){return this._node instanceof c.x?this._node:null}linkToTransformNode(e){return this._node&&(this._node.parent=e),this}_prepareNode(e){if(!this._node){if(this._node=this._createNode(e),!this.node)return;this._injectGUI3DReservedDataStore(this.node).control=this;const t=this.mesh;t&&(t.isPickable=!0,this._affectMaterial(t))}}_injectGUI3DReservedDataStore(e){var t,i;return e.reservedDataStore=null!==(t=e.reservedDataStore)&&void 0!==t?t:{},e.reservedDataStore.GUI3D=null!==(i=e.reservedDataStore.GUI3D)&&void 0!==i?i:{},e.reservedDataStore.GUI3D}_createNode(e){return null}_affectMaterial(e){e.material=null}_isTouchButton3D(e){return void 0!==e._generatePointerEventType}_onPointerMove(e,t){this.onPointerMoveObservable.notifyObservers(t,-1,e,this)}_onPointerEnter(e){return-1===this._enterCount&&(this._enterCount=0),this._enterCount++,!(this._enterCount>1||(this.onPointerEnterObservable.notifyObservers(this,-1,e,this),this.pointerEnterAnimation&&this.pointerEnterAnimation(),0))}_onPointerOut(e){this._enterCount--,this._enterCount>0||(this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,e,this),this.pointerOutAnimation&&this.pointerOutAnimation())}_onPointerDown(e,t,i,n){return this._downCount++,this._downPointerIds[i]=this._downPointerIds[i]+1||1,1===this._downCount&&(this.onPointerDownObservable.notifyObservers(new h(t,n),-1,e,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)}_onPointerUp(e,t,i,n,r){this._downCount--,this._downPointerIds[i]--,this._downPointerIds[i]<=0&&delete this._downPointerIds[i],this._downCount<0?this._downCount=0:0==this._downCount&&(r&&(this._enterCount>0||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new h(t,n),-1,e,this),this.onPointerUpObservable.notifyObservers(new h(t,n),-1,e,this),this.pointerUpAnimation&&this.pointerUpAnimation())}forcePointerUp(e=null){if(null!==e)this._onPointerUp(this,a.P.Zero(),e,0,!0);else{for(const e in this._downPointerIds)this._onPointerUp(this,a.P.Zero(),+e,0,!0);this._downCount>0&&(this._downCount=1,this._onPointerUp(this,a.P.Zero(),0,0,!0))}}_processObservables(e,t,i,n,r){if(this._isTouchButton3D(this)&&i&&(e=this._generatePointerEventType(e,i,this._downCount)),e===l.kD.POINTERMOVE){this._onPointerMove(this,t);const e=this._host._lastControlOver[n];return e&&e!==this&&e._onPointerOut(this),e!==this&&this._onPointerEnter(this),this._host._lastControlOver[n]=this,!0}return e===l.kD.POINTERDOWN?(this._onPointerDown(this,t,n,r),this._host._lastControlDown[n]=this,this._host._lastPickedControl=this,!0):(e===l.kD.POINTERUP||e===l.kD.POINTERDOUBLETAP)&&(this._host._lastControlDown[n]&&this._host._lastControlDown[n]._onPointerUp(this,t,n,r,!0),delete this._host._lastControlDown[n],!0)}_disposeNode(){this._node&&(this._node.dispose(),this._node=null)}dispose(){this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._disposeNode();for(const e of this._behaviors)e.detach()}}var d=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js");class u extends _{constructor(){super(...arguments),this._contentResolution=512,this._contentScaleRatio=2}get content(){return this._content}set content(e){this._content=e,e&&this._host&&this._host.utilityLayer&&(this._facadeTexture?this._facadeTexture.rootContainer.clearControls():(this._facadeTexture=new s.i("Facade",this._contentResolution,this._contentResolution,this._host.utilityLayer.utilityLayerScene,!0,d.x.TRILINEAR_SAMPLINGMODE),this._facadeTexture.rootContainer.scaleX=this._contentScaleRatio,this._facadeTexture.rootContainer.scaleY=this._contentScaleRatio,this._facadeTexture.premulAlpha=!0),this._facadeTexture.addControl(e),this._applyFacade(this._facadeTexture))}get contentResolution(){return this._contentResolution}set contentResolution(e){this._contentResolution!==e&&(this._contentResolution=e,this._resetContent())}_disposeFacadeTexture(){this._facadeTexture&&(this._facadeTexture.dispose(),this._facadeTexture=null)}_resetContent(){this._disposeFacadeTexture(),this.content=this._content}_applyFacade(e){}}class p extends u{constructor(e){super(e)}_getTypeName(){return"AbstractButton3D"}_createNode(e){return new r.Y("button"+this.name,e)}}var f=i("../../../node_modules/@babylonjs/core/Meshes/Builders/boxBuilder.js"),m=i("../../../node_modules/@babylonjs/core/Materials/standardMaterial.js"),g=i("../../../node_modules/@babylonjs/core/Maths/math.color.js");class b extends p{constructor(e){super(e),this.pointerEnterAnimation=()=>{this.mesh&&(this._currentMaterial.emissiveColor=g.Wo.Red())},this.pointerOutAnimation=()=>{this._currentMaterial.emissiveColor=g.Wo.Black()},this.pointerDownAnimation=()=>{this.mesh&&this.mesh.scaling.scaleInPlace(.95)},this.pointerUpAnimation=()=>{this.mesh&&this.mesh.scaling.scaleInPlace(1/.95)}}_applyFacade(e){this._currentMaterial.emissiveTexture=e}_getTypeName(){return"Button3D"}_createNode(e){const t=new Array(6);for(let e=0;e<6;e++)t[e]=new a.Lt(0,0,0,0);return e.useRightHandedSystem?t[0].copyFromFloats(1,0,0,1):t[1].copyFromFloats(0,0,1,1),(0,f.NR)(this.name+"_rootMesh",{width:1,height:1,depth:.08,faceUV:t,wrap:!0},e)}_affectMaterial(e){const t=new m.K(this.name+"Material",e.getScene());t.specularColor=g.Wo.Black(),e.material=t,this._currentMaterial=t,this._resetContent()}dispose(){super.dispose(),this._disposeFacadeTexture(),this._currentMaterial&&this._currentMaterial.dispose()}}class y extends _{constructor(e){super(e),this._blockLayout=!1,this._children=new Array}get children(){return this._children}get blockLayout(){return this._blockLayout}set blockLayout(e){this._blockLayout!==e&&(this._blockLayout=e,this._blockLayout||this._arrangeChildren())}updateLayout(){return this._arrangeChildren(),this}containsControl(e){return-1!==this._children.indexOf(e)}addControl(e){return-1!==this._children.indexOf(e)||(e.parent=this,e._host=this._host,this._children.push(e),this._host.utilityLayer&&(e._prepareNode(this._host.utilityLayer.utilityLayerScene),e.node&&(e.node.parent=this.node),this.blockLayout||this._arrangeChildren())),this}_arrangeChildren(){}_createNode(e){return new r.Y("ContainerNode",e)}removeControl(e){const t=this._children.indexOf(e);return-1!==t&&(this._children.splice(t,1),e.parent=null,e._disposeNode()),this}_getTypeName(){return"Container3D"}dispose(){for(const e of this._children)e.dispose();this._children.length=0,super.dispose()}}y.UNSET_ORIENTATION=0,y.FACEORIGIN_ORIENTATION=1,y.FACEORIGINREVERSED_ORIENTATION=2,y.FACEFORWARD_ORIENTATION=3,y.FACEFORWARDREVERSED_ORIENTATION=4;var v=i("../../../node_modules/@babylonjs/core/Misc/tools.js");class A extends y{constructor(e){super(e),this._columns=10,this._rows=0,this._rowThenColum=!0,this._orientation=y.FACEORIGIN_ORIENTATION,this.margin=0}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,v.w1.SetImmediate((()=>{this._arrangeChildren()})))}get columns(){return this._columns}set columns(e){this._columns!==e&&(this._columns=e,this._rowThenColum=!0,v.w1.SetImmediate((()=>{this._arrangeChildren()})))}get rows(){return this._rows}set rows(e){this._rows!==e&&(this._rows=e,this._rowThenColum=!1,v.w1.SetImmediate((()=>{this._arrangeChildren()})))}_arrangeChildren(){this._cellWidth=0,this._cellHeight=0;let e=0,t=0,i=0;const n=a.y3.Invert(this.node.computeWorldMatrix(!0));for(const e of this._children){if(!e.mesh)continue;i++,e.mesh.computeWorldMatrix(!0);const t=e.mesh.getHierarchyBoundingVectors(),r=a.jp.Vector3[0],s=a.jp.Vector3[1];t.max.subtractToRef(t.min,s),s.scaleInPlace(.5),a.P.TransformNormalToRef(s,n,r),this._cellWidth=Math.max(this._cellWidth,2*r.x),this._cellHeight=Math.max(this._cellHeight,2*r.y)}this._cellWidth+=2*this.margin,this._cellHeight+=2*this.margin,this._rowThenColum?(t=this._columns,e=Math.ceil(i/this._columns)):(e=this._rows,t=Math.ceil(i/this._rows));const r=.5*t*this._cellWidth,s=.5*e*this._cellHeight,o=[];let l=0;if(this._rowThenColum)for(let n=0;ni));e++);else for(let n=0;ni));t++);l=0;for(const e of this._children)e.mesh&&(this._mapGridNode(e,o[l]),l++);this._finalProcessing()}_finalProcessing(){}}i("../../../node_modules/@babylonjs/core/Maths/math.axis.js");var C=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),S=i("../../../node_modules/@babylonjs/core/tslib.es6.js"),x=i("../../../node_modules/@babylonjs/core/Misc/decorators.js"),T=i("../../../node_modules/@babylonjs/core/Materials/materialDefines.js"),E=i("../../../node_modules/@babylonjs/core/Materials/materialHelper.js"),R=i("../../../node_modules/@babylonjs/core/Materials/pushMaterial.js"),P=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),I=i("../../../node_modules/@babylonjs/core/Misc/typeStore.js"),M=i("../../../node_modules/@babylonjs/core/Engines/shaderStore.js");M.v.ShadersStore.fluentVertexShader="precision highp float;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nuniform mat4 world;\nuniform mat4 viewProjection;\nvarying vec2 vUV;\n#ifdef BORDER\nvarying vec2 scaleInfo;\nuniform float borderWidth;\nuniform vec3 scaleFactor;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\n#endif\nvoid main(void) {\nvUV=uv;\n#ifdef BORDER\nvec3 scale=scaleFactor;\nfloat minScale=min(min(scale.x,scale.y),scale.z);\nfloat maxScale=max(max(scale.x,scale.y),scale.z);\nfloat minOverMiddleScale=minScale/(scale.x+scale.y+scale.z-minScale-maxScale);\nfloat areaYZ=scale.y*scale.z;\nfloat areaXZ=scale.x*scale.z;\nfloat areaXY=scale.x*scale.y;\nfloat scaledBorderWidth=borderWidth; \nif (abs(normal.x)==1.0) \n{\nscale.x=scale.y;\nscale.y=scale.z;\nif (areaYZ>areaXZ && areaYZ>areaXY)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nelse if (abs(normal.y)==1.0) \n{\nscale.x=scale.z;\nif (areaXZ>areaXY && areaXZ>areaYZ)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nelse \n{\nif (areaXY>areaYZ && areaXY>areaXZ)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nfloat scaleRatio=min(scale.x,scale.y)/max(scale.x,scale.y);\nif (scale.x>scale.y)\n{\nscaleInfo.x=1.0-(scaledBorderWidth*scaleRatio);\nscaleInfo.y=1.0-scaledBorderWidth;\n}\nelse\n{\nscaleInfo.x=1.0-scaledBorderWidth;\nscaleInfo.y=1.0-(scaledBorderWidth*scaleRatio);\n} \n#endif \nvec4 worldPos=world*vec4(position,1.0);\n#ifdef HOVERLIGHT\nworldPosition=worldPos.xyz;\n#endif\ngl_Position=viewProjection*worldPos;\n}\n";M.v.ShadersStore.fluentPixelShader="precision highp float;\nvarying vec2 vUV;\nuniform vec4 albedoColor;\n#ifdef INNERGLOW\nuniform vec4 innerGlowColor;\n#endif\n#ifdef BORDER\nvarying vec2 scaleInfo;\nuniform float edgeSmoothingValue;\nuniform float borderMinValue;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\nuniform vec3 hoverPosition;\nuniform vec4 hoverColor;\nuniform float hoverRadius;\n#endif\n#ifdef TEXTURE\nuniform sampler2D albedoSampler;\nuniform mat4 textureMatrix;\nvec2 finalUV;\n#endif\nvoid main(void) {\nvec3 albedo=albedoColor.rgb;\nfloat alpha=albedoColor.a;\n#ifdef TEXTURE\nfinalUV=vec2(textureMatrix*vec4(vUV,1.0,0.0));\nalbedo=texture2D(albedoSampler,finalUV).rgb;\n#endif\n#ifdef HOVERLIGHT\nfloat pointToHover=(1.0-clamp(length(hoverPosition-worldPosition)/hoverRadius,0.,1.))*hoverColor.a;\nalbedo=clamp(albedo+hoverColor.rgb*pointToHover,0.,1.);\n#else\nfloat pointToHover=1.0;\n#endif\n#ifdef BORDER \nfloat borderPower=10.0;\nfloat inverseBorderPower=1.0/borderPower;\nvec3 borderColor=albedo*borderPower;\nvec2 distanceToEdge;\ndistanceToEdge.x=abs(vUV.x-0.5)*2.0;\ndistanceToEdge.y=abs(vUV.y-0.5)*2.0;\nfloat borderValue=max(smoothstep(scaleInfo.x-edgeSmoothingValue,scaleInfo.x+edgeSmoothingValue,distanceToEdge.x),\nsmoothstep(scaleInfo.y-edgeSmoothingValue,scaleInfo.y+edgeSmoothingValue,distanceToEdge.y));\nborderColor=borderColor*borderValue*max(borderMinValue*inverseBorderPower,pointToHover); \nalbedo+=borderColor;\nalpha=max(alpha,borderValue);\n#endif\n#ifdef INNERGLOW\nvec2 uvGlow=(vUV-vec2(0.5,0.5))*(innerGlowColor.a*2.0);\nuvGlow=uvGlow*uvGlow;\nuvGlow=uvGlow*uvGlow;\nalbedo+=mix(vec3(0.0,0.0,0.0),innerGlowColor.rgb,uvGlow.x+uvGlow.y); \n#endif\ngl_FragColor=vec4(albedo,alpha);\n}";class D extends T.H{constructor(){super(),this.INNERGLOW=!1,this.BORDER=!1,this.HOVERLIGHT=!1,this.TEXTURE=!1,this.rebuild()}}class O extends R.a{constructor(e,t){super(e,t),this.innerGlowColorIntensity=.5,this.innerGlowColor=new g.Wo(1,1,1),this.albedoColor=new g.Wo(.3,.35,.4),this.renderBorders=!1,this.borderWidth=.5,this.edgeSmoothingValue=.02,this.borderMinValue=.1,this.renderHoverLight=!1,this.hoverRadius=.01,this.hoverColor=new g.HE(.3,.3,.3,1),this.hoverPosition=a.P.Zero()}needAlphaBlending(){return 1!==this.alpha}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new D);const i=this.getScene(),n=t.materialDefines;if(!this.checkReadyOnEveryCall&&t.effect&&n._renderId===i.getRenderId())return!0;if(n._areTexturesDirty)if(n.INNERGLOW=this.innerGlowColorIntensity>0,n.BORDER=this.renderBorders,n.HOVERLIGHT=this.renderHoverLight,this._albedoTexture){if(!this._albedoTexture.isReadyOrNotBlocking())return!1;n.TEXTURE=!0}else n.TEXTURE=!1;const r=i.getEngine();if(n.isDirty){n.markAsProcessed(),i.resetCachedMaterial();const e=[P.o.PositionKind];e.push(P.o.NormalKind),e.push(P.o.UVKind);const s="fluent",o=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius","textureMatrix"],a=["albedoSampler"],l=new Array;E.G.PrepareUniformsAndSamplersList({uniformsNames:o,uniformBuffersNames:l,samplers:a,defines:n,maxSimultaneousLights:4});const c=n.toString();t.setEffect(i.getEngine().createEffect(s,{attributes:e,uniformsNames:o,uniformBuffersNames:l,samplers:a,defines:c,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),n,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(n._renderId=i.getRenderId(),t.effect._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,i){const n=this.getScene(),r=i.materialDefines;if(!r)return;const s=i.effect;if(s){if(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._mustRebind(n,s)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),r.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),r.BORDER&&(this._activeEffect.setFloat("borderWidth",this.borderWidth),this._activeEffect.setFloat("edgeSmoothingValue",this.edgeSmoothingValue),this._activeEffect.setFloat("borderMinValue",this.borderMinValue),t.getBoundingInfo().boundingBox.extendSize.multiplyToRef(t.scaling,a.jp.Vector3[0]),this._activeEffect.setVector3("scaleFactor",a.jp.Vector3[0])),r.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition)),r.TEXTURE&&this._albedoTexture)){this._activeEffect.setTexture("albedoSampler",this._albedoTexture);const e=this._albedoTexture.getTextureMatrix();this._activeEffect.setMatrix("textureMatrix",e)}this._afterBind(t,this._activeEffect)}}getActiveTextures(){return super.getActiveTextures()}hasTexture(e){return!!super.hasTexture(e)}dispose(e){super.dispose(e)}clone(e){return x.p4.Clone((()=>new O(e,this.getScene())),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.GUI.FluentMaterial",e}getClassName(){return"FluentMaterial"}static Parse(e,t,i){return x.p4.Parse((()=>new O(e.name,t)),e,t,i)}}(0,S.gn)([(0,x.qC)(),(0,x.wz)("_markAllSubMeshesAsTexturesDirty")],O.prototype,"innerGlowColorIntensity",void 0),(0,S.gn)([(0,x.n9)()],O.prototype,"innerGlowColor",void 0),(0,S.gn)([(0,x.n9)()],O.prototype,"albedoColor",void 0),(0,S.gn)([(0,x.qC)(),(0,x.wz)("_markAllSubMeshesAsTexturesDirty")],O.prototype,"renderBorders",void 0),(0,S.gn)([(0,x.qC)()],O.prototype,"borderWidth",void 0),(0,S.gn)([(0,x.qC)()],O.prototype,"edgeSmoothingValue",void 0),(0,S.gn)([(0,x.qC)()],O.prototype,"borderMinValue",void 0),(0,S.gn)([(0,x.qC)(),(0,x.wz)("_markAllSubMeshesAsTexturesDirty")],O.prototype,"renderHoverLight",void 0),(0,S.gn)([(0,x.qC)()],O.prototype,"hoverRadius",void 0),(0,S.gn)([(0,x.XX)()],O.prototype,"hoverColor",void 0),(0,S.gn)([(0,x.hd)()],O.prototype,"hoverPosition",void 0),(0,S.gn)([(0,x.oU)("albedoTexture")],O.prototype,"_albedoTexture",void 0),(0,S.gn)([(0,x.wz)("_markAllSubMeshesAsTexturesAndMiscDirty")],O.prototype,"albedoTexture",void 0),(0,I.H)("BABYLON.GUI.FluentMaterial",O);var w=i("../../../node_modules/@babylonjs/core/Misc/logger.js");class F extends A{constructor(e){super(e),this._backPlateMargin=1.25}get backPlateMargin(){return this._backPlateMargin}set backPlateMargin(e){this._backPlateMargin=e,this._children.length>=1&&(this.children.forEach((e=>{this._updateCurrentMinMax(e.position)})),this._updateMargins())}_createNode(e){const t=new C.Kj(`menu_${this.name}`,e);return this._backPlate=(0,f.NR)("backPlate"+this.name,{size:1},e),this._backPlate.parent=t,t}_affectMaterial(e){this._backPlateMaterial=new O(this.name+"backPlateMaterial",e.getScene()),this._backPlateMaterial.albedoColor=new g.Wo(.08,.15,.55),this._backPlateMaterial.renderBorders=!0,this._backPlateMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((e=>{e?(this._backPlateMaterial.hoverPosition=e,this._backPlateMaterial.hoverColor.a=1):this._backPlateMaterial.hoverColor.a=0})),this._backPlate.material=this._backPlateMaterial}_mapGridNode(e,t){e.mesh&&(e.position=t.clone(),this._updateCurrentMinMax(t))}_finalProcessing(){this._updateMargins()}_updateCurrentMinMax(e){this._currentMin||(this._currentMin=e.clone(),this._currentMax=e.clone()),this._currentMin.minimizeInPlace(e),this._currentMax.maximizeInPlace(e)}_updateMargins(){if(this._children.length>0){this._currentMin.addInPlaceFromFloats(-this._cellWidth/2,-this._cellHeight/2,0),this._currentMax.addInPlaceFromFloats(this._cellWidth/2,this._cellHeight/2,0);const e=this._currentMax.subtract(this._currentMin);this._backPlate.scaling.x=e.x+this._cellWidth*this.backPlateMargin,this._backPlate.scaling.y=e.y+this._cellHeight*this.backPlateMargin,this._backPlate.scaling.z=.001;for(let t=0;t0.0 ? g : 1.0;\nGradient2=Position_Object.z>0.0 ? 1.0 : g;\n} else {\nGradient1=g+(1.0-g)*(Radial_Gradient);\nGradient2=1.0;\n}\n}\nvoid Pick_Radius_B144(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{\nbool whichY=Position.y>0.0;\nResult=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);\nResult*=Radius;\n}\nvoid main()\n{\nvec3 Nrm_World_Q128;\nNrm_World_Q128=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Tangent_World_Q131;\nvec3 Tangent_World_N_Q131;\nfloat Tangent_Length_Q131;\nTangent_World_Q131=(world*vec4(vec3(1,0,0),0.0)).xyz;\nTangent_Length_Q131=length(Tangent_World_Q131);\nTangent_World_N_Q131=Tangent_World_Q131/Tangent_Length_Q131;\nvec3 Binormal_World_Q132;\nvec3 Binormal_World_N_Q132;\nfloat Binormal_Length_Q132;\nObject_To_World_Dir_B132(vec3(0,1,0),Binormal_World_Q132,Binormal_World_N_Q132,Binormal_Length_Q132);\nfloat Anisotropy_Q133=Tangent_Length_Q131/Binormal_Length_Q132;\nvec3 Result_Q177;\nResult_Q177=mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(_Use_Global_Left_Index_));\nvec3 Result_Q178;\nResult_Q178=mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(_Use_Global_Right_Index_));\nfloat Result_Q144;\nPick_Radius_B144(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q144);\nvec3 Dir_Q140;\nPickDir_B140(_Angle_,Tangent_World_N_Q131,Binormal_World_N_Q132,Dir_Q140);\nfloat Radius_Q147;\nfloat Line_Width_Q147;\nRelativeOrAbsoluteDetail_B147(Result_Q144,_Line_Width_,_Absolute_Sizes_,Binormal_Length_Q132,Radius_Q147,Line_Width_Q147);\nvec4 Out_Color_Q145=vec4(Radius_Q147,Line_Width_Q147,0,1);\nvec3 New_P_Q129;\nvec2 New_UV_Q129;\nfloat Radial_Gradient_Q129;\nvec3 Radial_Dir_Q129;\nMove_Verts_B129(Anisotropy_Q133,position,Radius_Q147,New_P_Q129,New_UV_Q129,Radial_Gradient_Q129,Radial_Dir_Q129);\nvec3 Pos_World_Q115;\nObject_To_World_Pos_B115(New_P_Q129,Pos_World_Q115);\nvec4 Blob_Info_Q180;\n#if BLOB_ENABLE\nBlob_Vertex_B180(Pos_World_Q115,Nrm_World_Q128,Tangent_World_N_Q131,Binormal_World_N_Q132,Result_Q177,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q180);\n#else\nBlob_Info_Q180=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q181;\n#if BLOB_ENABLE_2\nBlob_Vertex_B180(Pos_World_Q115,Nrm_World_Q128,Tangent_World_N_Q131,Binormal_World_N_Q132,Result_Q178,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q181);\n#else\nBlob_Info_Q181=vec4(0,0,0,0);\n#endif\nfloat Gradient1_Q130;\nfloat Gradient2_Q130;\n#if SMOOTH_EDGES\nEdge_AA_Vertex_B130(Pos_World_Q115,position,normal,cameraPosition,Radial_Gradient_Q129,Radial_Dir_Q129,tangent,Gradient1_Q130,Gradient2_Q130);\n#else\nGradient1_Q130=1.0;\nGradient2_Q130=1.0;\n#endif\nvec2 Rect_UV_Q139;\nvec4 Rect_Parms_Q139;\nvec2 Scale_XY_Q139;\nvec2 Line_UV_Q139;\nRound_Rect_Vertex_B139(New_UV_Q129,Radius_Q147,0.0,Anisotropy_Q133,Gradient1_Q130,Gradient2_Q130,Rect_UV_Q139,Rect_Parms_Q139,Scale_XY_Q139,Line_UV_Q139);\nvec3 Line_Vertex_Q135;\nLine_Vertex_B135(Scale_XY_Q139,Line_UV_Q139,0.0,_Rate_,_Highlight_Transform_,Line_Vertex_Q135);\nvec3 Position=Pos_World_Q115;\nvec3 Normal=Dir_Q140;\nvec2 UV=Rect_UV_Q139;\nvec3 Tangent=Line_Vertex_Q135;\nvec3 Binormal=Nrm_World_Q128;\nvec4 Color=Out_Color_Q145;\nvec4 Extra1=Rect_Parms_Q139;\nvec4 Extra2=Blob_Info_Q180;\nvec4 Extra3=Blob_Info_Q181;\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvColor=Color;\nvExtra1=Extra1;\nvExtra2=Extra2;\nvExtra3=Extra3;\n}";class L extends T.H{constructor(){super(),this.BLOB_ENABLE=!0,this.BLOB_ENABLE_2=!0,this.SMOOTH_EDGES=!0,this.IRIDESCENT_MAP_ENABLE=!0,this._needNormals=!0,this.rebuild()}}class k extends R.a{constructor(e,t){super(e,t),this.radius=.03,this.lineWidth=.01,this.absoluteSizes=!1,this._filterWidth=1,this.baseColor=new g.HE(.0392157,.0666667,.207843,1),this.lineColor=new g.HE(.14902,.133333,.384314,1),this.blobIntensity=.98,this.blobFarSize=.04,this.blobNearDistance=0,this.blobFarDistance=.08,this.blobFadeLength=.08,this.blobNearSize=.22,this.blobPulse=0,this.blobFade=0,this.blobNearSize2=.22,this.blobPulse2=0,this.blobFade2=0,this._rate=.135,this.highlightColor=new g.HE(.98,.98,.98,1),this.highlightWidth=.25,this._highlightTransform=new a.Lt(1,1,0,0),this._highlight=1,this.iridescenceIntensity=0,this.iridescenceEdgeIntensity=1,this._angle=-45,this.fadeOut=1,this._reflected=!0,this._frequency=1,this._verticalOffset=0,this.globalLeftIndexTipPosition=a.P.Zero(),this._globalLeftIndexTipPosition4=a.Lt.Zero(),this.globalRightIndexTipPosition=a.P.Zero(),this._globalRightIndexTipPosition4=a.Lt.Zero(),this.alphaMode=N.g.ALPHA_DISABLE,this.backFaceCulling=!1,this._blobTexture=new d.x(k.BLOB_TEXTURE_URL,this.getScene(),!0,!1,d.x.NEAREST_SAMPLINGMODE),this._iridescentMap=new d.x(k.IM_TEXTURE_URL,this.getScene(),!0,!1,d.x.NEAREST_SAMPLINGMODE)}needAlphaBlending(){return!1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new L);const i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;const r=n.getEngine();if(E.G.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty){i.markAsProcessed(),n.resetCachedMaterial();const e=new B.L;i.FOG&&e.addFallback(1,"FOG"),E.G.HandleFallbacksForShadows(i,e),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess;const s=[P.o.PositionKind];i.NORMAL&&s.push(P.o.NormalKind),i.UV1&&s.push(P.o.UVKind),i.UV2&&s.push(P.o.UV2Kind),i.VERTEXCOLOR&&s.push(P.o.ColorKind),i.TANGENT&&s.push(P.o.TangentKind),E.G.PrepareAttributesForInstances(s,i);const o="fluentBackplate",a=i.toString(),l=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Angle_","_Fade_Out_","_Reflected_","_Frequency_","_Vertical_Offset_","_Iridescent_Map_","_Use_Global_Left_Index_","_Use_Global_Right_Index_","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position"],c=["_Blob_Texture_","_Iridescent_Map_"],h=new Array;E.G.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect(o,{attributes:s,uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:a,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),i,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,i){var n,r;if(!i.materialDefines)return;const s=i.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",null!==(r=null===(n=this.getScene().activeCamera)||void 0===n?void 0:n.position)&&void 0!==r?r:a.P.ZeroReadOnly),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Base_Color_",this.baseColor),this._activeEffect.setDirectColor4("_Line_Color_",this.lineColor),this._activeEffect.setFloat("_Radius_Top_Left_",1),this._activeEffect.setFloat("_Radius_Top_Right_",1),this._activeEffect.setFloat("_Radius_Bottom_Left_",1),this._activeEffect.setFloat("_Radius_Bottom_Right_",1),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setFloat("_Rate_",this._rate),this._activeEffect.setDirectColor4("_Highlight_Color_",this.highlightColor),this._activeEffect.setFloat("_Highlight_Width_",this.highlightWidth),this._activeEffect.setVector4("_Highlight_Transform_",this._highlightTransform),this._activeEffect.setFloat("_Highlight_",this._highlight),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setFloat("_Iridescence_Edge_Intensity_",this.iridescenceEdgeIntensity),this._activeEffect.setFloat("_Angle_",this._angle),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._activeEffect.setFloat("_Reflected_",this._reflected?1:0),this._activeEffect.setFloat("_Frequency_",this._frequency),this._activeEffect.setFloat("_Vertical_Offset_",this._verticalOffset),this._activeEffect.setTexture("_Iridescent_Map_",this._iridescentMap),this._activeEffect.setFloat("_Use_Global_Left_Index_",1),this._activeEffect.setFloat("_Use_Global_Right_Index_",1),this._globalLeftIndexTipPosition4.set(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this._globalLeftIndexTipPosition4),this._globalRightIndexTipPosition4.set(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this._globalRightIndexTipPosition4),this._afterBind(t,this._activeEffect))}getAnimatables(){return[]}dispose(e){super.dispose(e),this._blobTexture.dispose(),this._iridescentMap.dispose()}clone(e){return x.p4.Clone((()=>new k(e,this.getScene())),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.FluentBackplateMaterial",e}getClassName(){return"FluentBackplateMaterial"}static Parse(e,t,i){return x.p4.Parse((()=>new k(e.name,t)),e,t,i)}}k.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png",k.IM_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png",(0,S.gn)([(0,x.qC)()],k.prototype,"radius",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"lineWidth",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"absoluteSizes",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"baseColor",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"lineColor",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobIntensity",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobFarSize",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobNearDistance",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobFarDistance",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobFadeLength",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobNearSize",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobPulse",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobFade",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobNearSize2",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobPulse2",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"blobFade2",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"highlightColor",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"highlightWidth",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"iridescenceIntensity",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"iridescenceEdgeIntensity",void 0),(0,S.gn)([(0,x.qC)()],k.prototype,"fadeOut",void 0),(0,S.gn)([(0,x.hd)()],k.prototype,"globalLeftIndexTipPosition",void 0),(0,S.gn)([(0,x.hd)()],k.prototype,"globalRightIndexTipPosition",void 0),(0,I.H)("BABYLON.GUI.FluentBackplateMaterial",k);var V=i("../../../node_modules/@babylonjs/core/Loading/sceneLoader.js");class U extends _{constructor(e,t=!0){super(e),this._shareMaterials=t}set renderingGroupId(e){this._model.renderingGroupId=e}get renderingGroupId(){return this._model.renderingGroupId}get material(){return this._material}get shareMaterials(){return this._shareMaterials}_getTypeName(){return"HolographicBackplate"}_createNode(e){var t;const i=(0,f.NR)((null!==(t=this.name)&&void 0!==t?t:"HolographicBackplate")+"_CollisionMesh",{width:1,height:1,depth:1},e);return i.isPickable=!0,i.visibility=0,V.n.ImportMeshAsync(void 0,U.MODEL_BASE_URL,U.MODEL_FILENAME,e).then((e=>{const t=e.meshes[1];t.name=`${this.name}_frontPlate`,t.isPickable=!1,t.parent=i,this._material&&(t.material=this._material),this._model=t})),i}_createMaterial(e){this._material=new k(this.name+" Material",e.getScene())}_affectMaterial(e){this._shareMaterials?this._host._touchSharedMaterials.fluentBackplateMaterial?this._material=this._host._touchSharedMaterials.fluentBackplateMaterial:(this._createMaterial(e),this._host._touchSharedMaterials.fluentBackplateMaterial=this._material):this._createMaterial(e)}dispose(){super.dispose(),this.shareMaterials||this._material.dispose(),this._model.dispose()}}U.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",U.MODEL_FILENAME="mrtk-fluent-backplate.glb";var G=i("../../../node_modules/@babylonjs/core/Meshes/Builders/planeBuilder.js"),j=i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/fadeInOutBehavior.js"),W=i("../../../node_modules/@babylonjs/gui/2D/controls/stackPanel.js"),z=i("../../../node_modules/@babylonjs/gui/2D/controls/image.js"),H=i("../../../node_modules/@babylonjs/gui/2D/controls/textBlock.js"),X=i("../../../node_modules/@babylonjs/core/Misc/domManagement.js");M.v.ShadersStore.fluentButtonPixelShader="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nuniform float _Edge_Width_;\nuniform vec4 _Edge_Color_;\nuniform bool _Relative_Width_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Active_Face_Dir_;\nuniform vec3 _Active_Face_Up_;\nuniform bool Enable_Fade;\nuniform float _Fade_Width_;\nuniform bool _Smooth_Active_Face_;\nuniform bool _Show_Frame_;\nuniform bool _Use_Blob_Texture_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvoid Holo_Edge_Fragment_B35(\nvec4 Edges,\nfloat Edge_Width,\nout float NotEdge)\n{\nvec2 c=vec2(min(Edges.r,Edges.g),min(Edges.b,Edges.a));\nvec2 df=fwidth(c)*Edge_Width;\nvec2 g=clamp(c/df,0.0,1.0);\nNotEdge=g.x*g.y;\n}\nvoid Blob_Fragment_B39(\nvec2 UV,\nvec3 Blob_Info,\nsampler2D Blob_Texture,\nout vec4 Blob_Color)\n{\nfloat k=dot(UV,UV);\nBlob_Color=Blob_Info.y*texture(Blob_Texture,vec2(vec2(sqrt(k),Blob_Info.x).x,1.0-vec2(sqrt(k),Blob_Info.x).y))*(1.0-clamp(k,0.0,1.0));\n}\nvec2 FilterStep(vec2 Edge,vec2 X)\n{\nvec2 dX=max(fwidth(X),vec2(0.00001,0.00001));\nreturn clamp( (X+dX-max(Edge,X-dX))/(dX*2.0),0.0,1.0);\n}\nvoid Wireframe_Fragment_B59(\nvec3 Widths,\nvec2 UV,\nfloat Proximity,\nvec4 Edge_Color,\nout vec4 Wireframe)\n{\nvec2 c=min(UV,vec2(1.0,1.0)-UV);\nvec2 g=FilterStep(Widths.xy*0.5,c); \nWireframe=(1.0-min(g.x,g.y))*Proximity*Edge_Color;\n}\nvoid Proximity_B53(\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Proximity_Max_Intensity,\nfloat Proximity_Near_Radius,\nvec3 Position,\nvec3 Show_Selection,\nvec4 Extra1,\nfloat Dist_To_Face,\nfloat Intensity,\nout float Proximity)\n{\nvec2 delta1=Extra1.xy;\nvec2 delta2=Extra1.zw;\nfloat d2=sqrt(min(dot(delta1,delta1),dot(delta2,delta2))+Dist_To_Face*Dist_To_Face);\nProximity=Intensity*Proximity_Max_Intensity*(1.0-clamp(d2/Proximity_Near_Radius,0.0,1.0))*(1.0-Show_Selection.x)+Show_Selection.x;\n}\nvoid To_XYZ_B46(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid main()\n{\nfloat NotEdge_Q35;\n#if ENABLE_FADE\nHolo_Edge_Fragment_B35(vColor,_Fade_Width_,NotEdge_Q35);\n#else\nNotEdge_Q35=1.0;\n#endif\nvec4 Blob_Color_Q39;\nfloat k=dot(vUV,vUV);\nvec2 blobTextureCoord=vec2(vec2(sqrt(k),vTangent.x).x,1.0-vec2(sqrt(k),vTangent.x).y);\nvec4 blobColor=mix(vec4(1.0,1.0,1.0,1.0)*step(1.0-vTangent.x,clamp(sqrt(k)+0.1,0.0,1.0)),texture(_Blob_Texture_,blobTextureCoord),float(_Use_Blob_Texture_));\nBlob_Color_Q39=vTangent.y*blobColor*(1.0-clamp(k,0.0,1.0));\nfloat Is_Quad_Q24;\nIs_Quad_Q24=vNormal.z;\nvec3 Blob_Position_Q41= mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));\nvec3 Blob_Position_Q42= mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));\nfloat X_Q46;\nfloat Y_Q46;\nfloat Z_Q46;\nTo_XYZ_B46(vBinormal,X_Q46,Y_Q46,Z_Q46);\nfloat Proximity_Q53;\nProximity_B53(Blob_Position_Q41,Blob_Position_Q42,_Proximity_Max_Intensity_,_Proximity_Near_Radius_,vPosition,vBinormal,vExtra1,Y_Q46,Z_Q46,Proximity_Q53);\nvec4 Wireframe_Q59;\nWireframe_Fragment_B59(vNormal,vUV,Proximity_Q53,_Edge_Color_,Wireframe_Q59);\nvec4 Wire_Or_Blob_Q23=mix(Wireframe_Q59,Blob_Color_Q39,Is_Quad_Q24);\nvec4 Result_Q22;\nResult_Q22=mix(Wire_Or_Blob_Q23,vec4(0.3,0.3,0.3,0.3),float(_Show_Frame_));\nvec4 Final_Color_Q37=NotEdge_Q35*Result_Q22;\nvec4 Out_Color=Final_Color_Q37;\nfloat Clip_Threshold=0.0;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";M.v.ShadersStore.fluentButtonVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec3 tangent;\nattribute vec4 color;\nuniform float _Edge_Width_;\nuniform vec4 _Edge_Color_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Active_Face_Dir_;\nuniform vec3 _Active_Face_Up_;\nuniform bool _Enable_Fade_;\nuniform float _Fade_Width_;\nuniform bool _Smooth_Active_Face_;\nuniform bool _Show_Frame_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvoid Blob_Vertex_B47(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nvec4 Vx_Color,\nvec2 UV,\nvec3 Face_Center,\nvec2 Face_Size,\nvec2 In_UV,\nfloat Blob_Fade_Length,\nfloat Selection_Fade,\nfloat Selection_Fade_Size,\nfloat Inner_Fade,\nvec3 Active_Face_Center,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nfloat Blob_Enabled,\nout vec3 Out_Position,\nout vec2 Out_UV,\nout vec3 Blob_Info)\n{\nfloat blobSize,fadeIn;\nvec3 Hit_Position;\nBlob_Info=vec3(0.0,0.0,0.0);\nfloat Hit_Distance=dot(Blob_Position-Face_Center,Normal);\nHit_Position=Blob_Position-Hit_Distance*Normal;\nfloat absD=abs(Hit_Distance);\nfloat lerpVal=clamp((absD-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfadeIn=1.0-clamp((absD-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat innerFade=1.0-clamp(-Hit_Distance/Inner_Fade,0.0,1.0);\nfloat farClip=clamp(1.0-step(Blob_Far_Distance+Blob_Fade_Length,absD),0.0,1.0);\nfloat size=mix(Blob_Near_Size,Blob_Far_Size,lerpVal)*farClip;\nblobSize=mix(size,Selection_Fade_Size,Selection_Fade)*innerFade*Blob_Enabled;\nBlob_Info.x=lerpVal*0.5+0.5;\nBlob_Info.y=fadeIn*Intensity*(1.0-Selection_Fade)*Blob_Fade;\nBlob_Info.x*=(1.0-Blob_Pulse);\nvec3 delta=Hit_Position-Face_Center;\nvec2 blobCenterXY=vec2(dot(delta,Tangent),dot(delta,Bitangent));\nvec2 quadUVin=2.0*UV-1.0; \nvec2 blobXY=blobCenterXY+quadUVin*blobSize;\nvec2 blobClipped=clamp(blobXY,-Face_Size*0.5,Face_Size*0.5);\nvec2 blobUV=(blobClipped-blobCenterXY)/max(blobSize,0.0001)*2.0;\nvec3 blobCorner=Face_Center+blobClipped.x*Tangent+blobClipped.y*Bitangent;\nOut_Position=mix(Position,blobCorner,Vx_Color.rrr);\nOut_UV=mix(In_UV,blobUV,Vx_Color.rr);\n}\nvec2 ProjectProximity(\nvec3 blobPosition,\nvec3 position,\nvec3 center,\nvec3 dir,\nvec3 xdir,\nvec3 ydir,\nout float vdistance\n)\n{\nvec3 delta=blobPosition-position;\nvec2 xy=vec2(dot(delta,xdir),dot(delta,ydir));\nvdistance=abs(dot(delta,dir));\nreturn xy;\n}\nvoid Proximity_Vertex_B66(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Active_Face_Center,\nvec3 Active_Face_Dir,\nvec3 Position,\nfloat Proximity_Far_Distance,\nfloat Relative_Scale,\nfloat Proximity_Anisotropy,\nvec3 Up,\nout vec4 Extra1,\nout float Distance_To_Face,\nout float Intensity)\n{\nvec3 Active_Face_Dir_X=normalize(cross(Active_Face_Dir,Up));\nvec3 Active_Face_Dir_Y=cross(Active_Face_Dir,Active_Face_Dir_X);\nfloat distz1,distz2;\nExtra1.xy=ProjectProximity(Blob_Position,Position,Active_Face_Center,Active_Face_Dir,Active_Face_Dir_X*Proximity_Anisotropy,Active_Face_Dir_Y,distz1)/Relative_Scale;\nExtra1.zw=ProjectProximity(Blob_Position_2,Position,Active_Face_Center,Active_Face_Dir,Active_Face_Dir_X*Proximity_Anisotropy,Active_Face_Dir_Y,distz2)/Relative_Scale;\nDistance_To_Face=dot(Active_Face_Dir,Position-Active_Face_Center);\nIntensity=1.0-clamp(min(distz1,distz2)/Proximity_Far_Distance,0.0,1.0);\n}\nvoid Holo_Edge_Vertex_B44(\nvec3 Incident,\nvec3 Normal,\nvec2 UV,\nvec3 Tangent,\nvec3 Bitangent,\nbool Smooth_Active_Face,\nfloat Active,\nout vec4 Holo_Edges)\n{\nfloat NdotI=dot(Incident,Normal);\nvec2 flip=(UV-vec2(0.5,0.5));\nfloat udot=dot(Incident,Tangent)*flip.x*NdotI;\nfloat uval=1.0-float(udot>0.0);\nfloat vdot=-dot(Incident,Bitangent)*flip.y*NdotI;\nfloat vval=1.0-float(vdot>0.0);\nfloat Smooth_And_Active=step(1.0,float(Smooth_Active_Face && Active>0.0));\nuval=mix(uval,max(1.0,uval),Smooth_And_Active); \nvval=mix(vval,max(1.0,vval),Smooth_And_Active);\nHolo_Edges=vec4(1.0,1.0,1.0,1.0)-vec4(uval*UV.x,uval*(1.0-UV.x),vval*UV.y,vval*(1.0-UV.y));\n}\nvoid Object_To_World_Pos_B13(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Choose_Blob_B38(\nvec4 Vx_Color,\nvec3 Position1,\nvec3 Position2,\nbool Blob_Enable_1,\nbool Blob_Enable_2,\nfloat Near_Size_1,\nfloat Near_Size_2,\nfloat Blob_Inner_Fade_1,\nfloat Blob_Inner_Fade_2,\nfloat Blob_Pulse_1,\nfloat Blob_Pulse_2,\nfloat Blob_Fade_1,\nfloat Blob_Fade_2,\nout vec3 Position,\nout float Near_Size,\nout float Inner_Fade,\nout float Blob_Enable,\nout float Fade,\nout float Pulse)\n{\nPosition=Position1*(1.0-Vx_Color.g)+Vx_Color.g*Position2;\nfloat b1=float(Blob_Enable_1);\nfloat b2=float(Blob_Enable_2);\nBlob_Enable=b1+(b2-b1)*Vx_Color.g;\nPulse=Blob_Pulse_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Pulse_2;\nFade=Blob_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Fade_2;\nNear_Size=Near_Size_1*(1.0-Vx_Color.g)+Vx_Color.g*Near_Size_2;\nInner_Fade=Blob_Inner_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Inner_Fade_2;\n}\nvoid Wireframe_Vertex_B51(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nfloat Edge_Width,\nvec2 Face_Size,\nout vec3 Wire_Vx_Pos,\nout vec2 UV,\nout vec2 Widths)\n{\nWidths.xy=Edge_Width/Face_Size;\nfloat x=dot(Position,Tangent);\nfloat y=dot(Position,Bitangent);\nfloat dx=0.5-abs(x);\nfloat newx=(0.5-dx*Widths.x*2.0)*sign(x);\nfloat dy=0.5-abs(y);\nfloat newy=(0.5-dy*Widths.y*2.0)*sign(y);\nWire_Vx_Pos=Normal*0.5+newx*Tangent+newy*Bitangent;\nUV.x=dot(Wire_Vx_Pos,Tangent)+0.5;\nUV.y=dot(Wire_Vx_Pos,Bitangent)+0.5;\n}\nvec2 ramp2(vec2 start,vec2 end,vec2 x)\n{\nreturn clamp((x-start)/(end-start),vec2(0.0,0.0),vec2(1.0,1.0));\n}\nfloat computeSelection(\nvec3 blobPosition,\nvec3 normal,\nvec3 tangent,\nvec3 bitangent,\nvec3 faceCenter,\nvec2 faceSize,\nfloat selectionFuzz,\nfloat farDistance,\nfloat fadeLength\n)\n{\nvec3 delta=blobPosition-faceCenter;\nfloat absD=abs(dot(delta,normal));\nfloat fadeIn=1.0-clamp((absD-farDistance)/fadeLength,0.0,1.0);\nvec2 blobCenterXY=vec2(dot(delta,tangent),dot(delta,bitangent));\nvec2 innerFace=faceSize*(1.0-selectionFuzz)*0.5;\nvec2 selectPulse=ramp2(-faceSize*0.5,-innerFace,blobCenterXY)-ramp2(innerFace,faceSize*0.5,blobCenterXY);\nreturn selectPulse.x*selectPulse.y*fadeIn;\n}\nvoid Selection_Vertex_B48(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Face_Center,\nvec2 Face_Size,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nfloat Selection_Fuzz,\nfloat Selected,\nfloat Far_Distance,\nfloat Fade_Length,\nvec3 Active_Face_Dir,\nout float Show_Selection)\n{\nfloat select1=computeSelection(Blob_Position,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nfloat select2=computeSelection(Blob_Position_2,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nfloat Active=max(0.0,dot(Active_Face_Dir,Normal));\nShow_Selection=mix(max(select1,select2),1.0,Selected)*Active;\n}\nvoid Proximity_Visibility_B54(\nfloat Selection,\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Input_Width,\nfloat Proximity_Far_Distance,\nfloat Proximity_Radius,\nvec3 Active_Face_Center,\nvec3 Active_Face_Dir,\nout float Width)\n{\nvec3 boxEdges=(world*vec4(vec3(0.5,0.5,0.5),0.0)).xyz;\nfloat boxMaxSize=length(boxEdges);\nfloat d1=dot(Proximity_Center-Active_Face_Center,Active_Face_Dir);\nvec3 blob1=Proximity_Center-d1*Active_Face_Dir;\nfloat d2=dot(Proximity_Center_2-Active_Face_Center,Active_Face_Dir);\nvec3 blob2=Proximity_Center_2-d2*Active_Face_Dir;\nvec3 delta1=blob1-Active_Face_Center;\nvec3 delta2=blob2-Active_Face_Center;\nfloat dist1=dot(delta1,delta1);\nfloat dist2=dot(delta2,delta2);\nfloat nearestProxDist=sqrt(min(dist1,dist2));\nWidth=Input_Width*(1.0-step(boxMaxSize+Proximity_Radius,nearestProxDist))*(1.0-step(Proximity_Far_Distance,min(d1,d2))*(1.0-step(0.0001,Selection)));\n}\nvoid Object_To_World_Dir_B67(\nvec3 Dir_Object,\nout vec3 Dir_World)\n{\nDir_World=(world*vec4(Dir_Object,0.0)).xyz;\n}\nvoid main()\n{\nvec3 Active_Face_Center_Q49;\nActive_Face_Center_Q49=(world*vec4(_Active_Face_Dir_*0.5,1.0)).xyz;\nvec3 Blob_Position_Q41= mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));\nvec3 Blob_Position_Q42= mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));\nvec3 Active_Face_Dir_Q64=normalize((world*vec4(_Active_Face_Dir_,0.0)).xyz);\nfloat Relative_Scale_Q57;\n#if RELATIVE_WIDTH\nRelative_Scale_Q57=length((world*vec4(vec3(0,1,0),0.0)).xyz);\n#else\nRelative_Scale_Q57=1.0;\n#endif\nvec3 Tangent_World_Q30;\nTangent_World_Q30=(world*vec4(tangent,0.0)).xyz;\nvec3 Binormal_World_Q31;\nBinormal_World_Q31=(world*vec4((cross(normal,tangent)),0.0)).xyz;\nvec3 Normal_World_Q60;\nNormal_World_Q60=(world*vec4(normal,0.0)).xyz;\nvec3 Result_Q18=0.5*normal;\nvec3 Dir_World_Q67;\nObject_To_World_Dir_B67(_Active_Face_Up_,Dir_World_Q67);\nfloat Product_Q56=_Edge_Width_*Relative_Scale_Q57;\nvec3 Normal_World_N_Q29=normalize(Normal_World_Q60);\nvec3 Tangent_World_N_Q28=normalize(Tangent_World_Q30);\nvec3 Binormal_World_N_Q32=normalize(Binormal_World_Q31);\nvec3 Position_Q38;\nfloat Near_Size_Q38;\nfloat Inner_Fade_Q38;\nfloat Blob_Enable_Q38;\nfloat Fade_Q38;\nfloat Pulse_Q38;\nChoose_Blob_B38(color,Blob_Position_Q41,Blob_Position_Q42,_Blob_Enable_,_Blob_Enable_2_,_Blob_Near_Size_,_Blob_Near_Size_2_,_Blob_Inner_Fade_,_Blob_Inner_Fade_2_,_Blob_Pulse_,_Blob_Pulse_2_,_Blob_Fade_,_Blob_Fade_2_,Position_Q38,Near_Size_Q38,Inner_Fade_Q38,Blob_Enable_Q38,Fade_Q38,Pulse_Q38);\nvec3 Face_Center_Q33;\nFace_Center_Q33=(world*vec4(Result_Q18,1.0)).xyz;\nvec2 Face_Size_Q50=vec2(length(Tangent_World_Q30),length(Binormal_World_Q31));\nfloat Show_Selection_Q48;\nSelection_Vertex_B48(Blob_Position_Q41,Blob_Position_Q42,Face_Center_Q33,Face_Size_Q50,Normal_World_N_Q29,Tangent_World_N_Q28,Binormal_World_N_Q32,_Selection_Fuzz_,_Selected_,_Selected_Distance_,_Selected_Fade_Length_,Active_Face_Dir_Q64,Show_Selection_Q48);\nvec3 Normalized_Q72=normalize(Dir_World_Q67);\nfloat Active_Q34=max(0.0,dot(Active_Face_Dir_Q64,Normal_World_N_Q29));\nfloat Width_Q54;\nProximity_Visibility_B54(Show_Selection_Q48,Blob_Position_Q41,Blob_Position_Q42,Product_Q56,_Proximity_Far_Distance_,_Proximity_Near_Radius_,Active_Face_Center_Q49,Active_Face_Dir_Q64,Width_Q54);\nvec3 Wire_Vx_Pos_Q51;\nvec2 UV_Q51;\nvec2 Widths_Q51;\nWireframe_Vertex_B51(position,normal,tangent,(cross(normal,tangent)),Width_Q54,Face_Size_Q50,Wire_Vx_Pos_Q51,UV_Q51,Widths_Q51);\nvec3 Vec3_Q27=vec3(Widths_Q51.x,Widths_Q51.y,color.r);\nvec3 Pos_World_Q13;\nObject_To_World_Pos_B13(Wire_Vx_Pos_Q51,Pos_World_Q13);\nvec3 Incident_Q36=normalize(Pos_World_Q13-cameraPosition);\nvec3 Out_Position_Q47;\nvec2 Out_UV_Q47;\nvec3 Blob_Info_Q47;\nBlob_Vertex_B47(Pos_World_Q13,Normal_World_N_Q29,Tangent_World_N_Q28,Binormal_World_N_Q32,Position_Q38,_Blob_Intensity_,Near_Size_Q38,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,color,uv,Face_Center_Q33,Face_Size_Q50,UV_Q51,_Blob_Fade_Length_,_Selection_Fade_,_Selection_Fade_Size_,Inner_Fade_Q38,Active_Face_Center_Q49,Pulse_Q38,Fade_Q38,Blob_Enable_Q38,Out_Position_Q47,Out_UV_Q47,Blob_Info_Q47);\nvec4 Extra1_Q66;\nfloat Distance_To_Face_Q66;\nfloat Intensity_Q66;\nProximity_Vertex_B66(Blob_Position_Q41,Blob_Position_Q42,Active_Face_Center_Q49,Active_Face_Dir_Q64,Pos_World_Q13,_Proximity_Far_Distance_,Relative_Scale_Q57,_Proximity_Anisotropy_,Normalized_Q72,Extra1_Q66,Distance_To_Face_Q66,Intensity_Q66);\nvec4 Holo_Edges_Q44;\nHolo_Edge_Vertex_B44(Incident_Q36,Normal_World_N_Q29,uv,Tangent_World_Q30,Binormal_World_Q31,_Smooth_Active_Face_,Active_Q34,Holo_Edges_Q44);\nvec3 Vec3_Q19=vec3(Show_Selection_Q48,Distance_To_Face_Q66,Intensity_Q66);\nvec3 Position=Out_Position_Q47;\nvec2 UV=Out_UV_Q47;\nvec3 Tangent=Blob_Info_Q47;\nvec3 Binormal=Vec3_Q19;\nvec3 Normal=Vec3_Q27;\nvec4 Extra1=Extra1_Q66;\nvec4 Color=Holo_Edges_Q44;\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvColor=Color;\nvExtra1=Extra1;\n}";class Y extends T.H{constructor(){super(),this.RELATIVE_WIDTH=!0,this.ENABLE_FADE=!0,this._needNormals=!0,this._needUVs=!0,this.rebuild()}}class Q extends R.a{constructor(e,t){super(e,t),this.edgeWidth=.04,this.edgeColor=new g.HE(.592157,.592157,.592157,1),this.proximityMaxIntensity=.45,this.proximityFarDistance=.16,this.proximityNearRadius=1.5,this.proximityAnisotropy=1,this.selectionFuzz=.5,this.selected=0,this.selectionFade=0,this.selectionFadeSize=.3,this.selectedDistance=.08,this.selectedFadeLength=.08,this.blobIntensity=.5,this.blobFarSize=.05,this.blobNearDistance=0,this.blobFarDistance=.08,this.blobFadeLength=.08,this.leftBlobEnable=!0,this.leftBlobNearSize=.025,this.leftBlobPulse=0,this.leftBlobFade=1,this.leftBlobInnerFade=.01,this.rightBlobEnable=!0,this.rightBlobNearSize=.025,this.rightBlobPulse=0,this.rightBlobFade=1,this.rightBlobInnerFade=.01,this.activeFaceDir=new a.P(0,0,-1),this.activeFaceUp=new a.P(0,1,0),this.enableFade=!0,this.fadeWidth=1.5,this.smoothActiveFace=!0,this.showFrame=!1,this.useBlobTexture=!0,this.globalLeftIndexTipPosition=a.P.Zero(),this.globalRightIndexTipPosition=a.P.Zero(),this.alphaMode=N.g.ALPHA_ADD,this.disableDepthWrite=!0,this.backFaceCulling=!1,this._blobTexture=new d.x(Q.BLOB_TEXTURE_URL,this.getScene(),!0,!1,d.x.NEAREST_SAMPLINGMODE)}needAlphaBlending(){return!0}needAlphaTesting(){return!0}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new Y);const i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;const r=n.getEngine();if(E.G.PrepareDefinesForAttributes(e,i,!0,!1),i.isDirty){i.markAsProcessed(),n.resetCachedMaterial();const e=new B.L;i.FOG&&e.addFallback(1,"FOG"),E.G.HandleFallbacksForShadows(i,e),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess;const s=[P.o.PositionKind];i.NORMAL&&s.push(P.o.NormalKind),i.UV1&&s.push(P.o.UVKind),i.UV2&&s.push(P.o.UV2Kind),i.VERTEXCOLOR&&s.push(P.o.ColorKind),i.TANGENT&&s.push(P.o.TangentKind),E.G.PrepareAttributesForInstances(s,i);const o="fluentButton",a=i.toString(),l=["world","viewProjection","cameraPosition","_Edge_Width_","_Edge_Color_","_Relative_Width_","_Proximity_Max_Intensity_","_Proximity_Far_Distance_","_Proximity_Near_Radius_","_Proximity_Anisotropy_","_Selection_Fuzz_","_Selected_","_Selection_Fade_","_Selection_Fade_Size_","_Selected_Distance_","_Selected_Fade_Length_","_Blob_Enable_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Inner_Fade_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Enable_2_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Inner_Fade_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Active_Face_Dir_","_Active_Face_Up_","_Enable_Fade_","_Fade_Width_","_Smooth_Active_Face_","_Show_Frame_","_Use_Blob_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Blob_Texture_"],h=new Array;E.G.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect(o,{attributes:s,uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:a,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),i,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,i){const n=this.getScene();if(!i.materialDefines)return;const r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setColor4("_Edge_Color_",new g.Wo(this.edgeColor.r,this.edgeColor.g,this.edgeColor.b),this.edgeColor.a),this._activeEffect.setFloat("_Proximity_Max_Intensity_",this.proximityMaxIntensity),this._activeEffect.setFloat("_Proximity_Far_Distance_",this.proximityFarDistance),this._activeEffect.setFloat("_Proximity_Near_Radius_",this.proximityNearRadius),this._activeEffect.setFloat("_Proximity_Anisotropy_",this.proximityAnisotropy),this._activeEffect.setFloat("_Selection_Fuzz_",this.selectionFuzz),this._activeEffect.setFloat("_Selected_",this.selected),this._activeEffect.setFloat("_Selection_Fade_",this.selectionFade),this._activeEffect.setFloat("_Selection_Fade_Size_",this.selectionFadeSize),this._activeEffect.setFloat("_Selected_Distance_",this.selectedDistance),this._activeEffect.setFloat("_Selected_Fade_Length_",this.selectedFadeLength),this._activeEffect.setFloat("_Blob_Enable_",this.leftBlobEnable?1:0),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.leftBlobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Inner_Fade_",this.leftBlobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_",this.leftBlobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.leftBlobFade),this._activeEffect.setFloat("_Blob_Enable_2_",this.rightBlobEnable?1:0),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.rightBlobNearSize),this._activeEffect.setFloat("_Blob_Inner_Fade_2_",this.rightBlobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_2_",this.rightBlobPulse),this._activeEffect.setFloat("_Blob_Fade_2_",this.rightBlobFade),this._activeEffect.setVector3("_Active_Face_Dir_",this.activeFaceDir),this._activeEffect.setVector3("_Active_Face_Up_",this.activeFaceUp),this._activeEffect.setFloat("_Fade_Width_",this.fadeWidth),this._activeEffect.setFloat("_Smooth_Active_Face_",this.smoothActiveFace?1:0),this._activeEffect.setFloat("_Show_Frame_",this.showFrame?1:0),this._activeEffect.setFloat("_Use_Blob_Texture_",this.useBlobTexture?1:0),this._activeEffect.setFloat("Use_Global_Left_Index",1),this._activeEffect.setFloat("Use_Global_Right_Index",1),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",new a.Lt(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1)),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",new a.Lt(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1)),this._afterBind(t,this._activeEffect))}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(e){return x.p4.Clone((()=>new Q(e,this.getScene())),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.FluentButtonMaterial",e}getClassName(){return"FluentButtonMaterial"}static Parse(e,t,i){return x.p4.Parse((()=>new Q(e.name,t)),e,t,i)}}Q.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png",(0,S.gn)([(0,x.qC)()],Q.prototype,"edgeWidth",void 0),(0,S.gn)([(0,x.XX)()],Q.prototype,"edgeColor",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"proximityMaxIntensity",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"proximityFarDistance",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"proximityNearRadius",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"proximityAnisotropy",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"selectionFuzz",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"selected",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"selectionFade",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"selectionFadeSize",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"selectedDistance",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"selectedFadeLength",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"blobIntensity",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"blobFarSize",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"blobNearDistance",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"blobFarDistance",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"blobFadeLength",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"leftBlobEnable",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"leftBlobNearSize",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"leftBlobPulse",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"leftBlobFade",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"leftBlobInnerFade",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"rightBlobEnable",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"rightBlobNearSize",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"rightBlobPulse",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"rightBlobFade",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"rightBlobInnerFade",void 0),(0,S.gn)([(0,x.hd)()],Q.prototype,"activeFaceDir",void 0),(0,S.gn)([(0,x.hd)()],Q.prototype,"activeFaceUp",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"enableFade",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"fadeWidth",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"smoothActiveFace",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"showFrame",void 0),(0,S.gn)([(0,x.qC)()],Q.prototype,"useBlobTexture",void 0),(0,S.gn)([(0,x.hd)()],Q.prototype,"globalLeftIndexTipPosition",void 0),(0,S.gn)([(0,x.hd)()],Q.prototype,"globalRightIndexTipPosition",void 0),(0,I.H)("BABYLON.GUI.FluentButtonMaterial",Q);class q extends b{constructor(e,t){super(e),this._isNearPressed=!1,this._interactionSurfaceHeight=0,this._isToggleButton=!1,this._toggleState=!1,this._toggleButtonCallback=()=>{this._onToggle(!this._toggleState)},this.onToggleObservable=new o.y$,this.collidableFrontDirection=a.P.Zero(),t&&(this.collisionMesh=t)}get isActiveNearInteraction(){return this._isNearPressed}set collidableFrontDirection(e){if(this._collidableFrontDirection=e.normalize(),this._collisionMesh){const e=a.jp.Matrix[0];e.copyFrom(this._collisionMesh.getWorldMatrix()),e.invert(),a.P.TransformNormalToRef(this._collidableFrontDirection,e,this._collidableFrontDirection),this._collidableFrontDirection.normalize()}}get collidableFrontDirection(){if(this._collisionMesh){const e=a.jp.Vector3[0];return a.P.TransformNormalToRef(this._collidableFrontDirection,this._collisionMesh.getWorldMatrix(),e),e.normalize()}return this._collidableFrontDirection}set collisionMesh(e){var t;this._collisionMesh&&(this._collisionMesh.isNearPickable=!1,(null===(t=this._collisionMesh.reservedDataStore)||void 0===t?void 0:t.GUI3D)&&(this._collisionMesh.reservedDataStore.GUI3D={}),this._collisionMesh.getChildMeshes().forEach((e=>{var t;e.isNearPickable=!1,(null===(t=e.reservedDataStore)||void 0===t?void 0:t.GUI3D)&&(e.reservedDataStore.GUI3D={})}))),this._collisionMesh=e,this._injectGUI3DReservedDataStore(this._collisionMesh).control=this,this._collisionMesh.isNearPickable=!0,this._collisionMesh.getChildMeshes().forEach((e=>{this._injectGUI3DReservedDataStore(e).control=this,e.isNearPickable=!0})),this.collidableFrontDirection=e.forward}set isToggleButton(e){e!==this._isToggleButton&&(this._isToggleButton=e,e?this.onPointerUpObservable.add(this._toggleButtonCallback):(this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this._toggleState&&this._onToggle(!1)))}get isToggleButton(){return this._isToggleButton}set isToggled(e){this._isToggleButton&&this._toggleState!==e&&this._onToggle(e)}get isToggled(){return this._toggleState}_onToggle(e){this._toggleState=e,this.onToggleObservable.notifyObservers(e)}_isInteractionInFrontOfButton(e){return this._getInteractionHeight(e,this._collisionMesh.getAbsolutePosition())>0}getPressDepth(e){if(!this._isNearPressed)return 0;const t=this._getInteractionHeight(e,this._collisionMesh.getAbsolutePosition());return this._interactionSurfaceHeight-t}_getInteractionHeight(e,t){const i=this.collidableFrontDirection;if(0===i.length())return a.P.Distance(e,t);const n=a.P.Dot(t,i);return a.P.Dot(e,i)-n}_generatePointerEventType(e,t,i){if(e===l.kD.POINTERDOWN||e===l.kD.POINTERMOVE){if(!this._isInteractionInFrontOfButton(t))return l.kD.POINTERMOVE;this._isNearPressed=!0,this._interactionSurfaceHeight=this._getInteractionHeight(t,this._collisionMesh.getAbsolutePosition())}if(e===l.kD.POINTERUP){if(0==i)return l.kD.POINTERMOVE;this._isNearPressed=!1}return e}_getTypeName(){return"TouchButton3D"}_createNode(e){return super._createNode(e)}dispose(){super.dispose(),this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this.onToggleObservable.clear(),this._collisionMesh&&this._collisionMesh.dispose()}}var K=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js");class Z extends q{constructor(e,t=!0){super(e),this._shareMaterials=!0,this._isBackplateVisible=!0,this._frontPlateDepth=.5,this._backPlateDepth=.04,this._backplateColor=new g.Wo(.08,.15,.55),this._backplateToggledColor=new g.Wo(.25,.4,.95),this._shareMaterials=t,this.pointerEnterAnimation=()=>{this._frontMaterial.leftBlobEnable=!0,this._frontMaterial.rightBlobEnable=!0},this.pointerOutAnimation=()=>{this._frontMaterial.leftBlobEnable=!1,this._frontMaterial.rightBlobEnable=!1},this.pointerDownAnimation=()=>{this._frontPlate&&!this.isActiveNearInteraction&&(this._frontPlate.scaling.z=.2*this._frontPlateDepth,this._frontPlate.position=a.P.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth-.2*this._frontPlateDepth)/2),this._textPlate.position=a.P.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth+.2*this._frontPlateDepth)/2))},this.pointerUpAnimation=()=>{this._frontPlate&&(this._frontPlate.scaling.z=this._frontPlateDepth,this._frontPlate.position=a.P.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth-this._frontPlateDepth)/2),this._textPlate.position=a.P.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth+this._frontPlateDepth)/2))},this.onPointerMoveObservable.add((e=>{if(this._frontPlate&&this.isActiveNearInteraction){const t=a.P.Zero();if(this._backPlate.getWorldMatrix().decompose(t,void 0,void 0)){let i=this._getInteractionHeight(e,this._backPlate.getAbsolutePosition())/t.z;i=K.R.Clamp(i-this._backPlateDepth/2,.2*this._frontPlateDepth,this._frontPlateDepth),this._frontPlate.scaling.z=i,this._frontPlate.position=a.P.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth-i)/2),this._textPlate.position=a.P.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth+i)/2)}}})),this._pointerHoverObserver=this.onPointerMoveObservable.add((e=>{this._frontMaterial.globalLeftIndexTipPosition=e}))}_disposeTooltip(){this._tooltipFade=null,this._tooltipTextBlock&&this._tooltipTextBlock.dispose(),this._tooltipTexture&&this._tooltipTexture.dispose(),this._tooltipMesh&&this._tooltipMesh.dispose(),this.onPointerEnterObservable.remove(this._tooltipHoverObserver),this.onPointerOutObservable.remove(this._tooltipOutObserver)}set renderingGroupId(e){this._backPlate.renderingGroupId=e,this._textPlate.renderingGroupId=e,this._frontPlate.renderingGroupId=e,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=e)}get renderingGroupId(){return this._backPlate.renderingGroupId}get mesh(){return this._backPlate}set tooltipText(e){if(e){if(!this._tooltipFade){const e=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,G.pT)("",{size:1},this._backPlate._scene);const t=(0,G.pT)("",{size:1,sideOrientation:C.Kj.DOUBLESIDE},this._backPlate._scene),i=new m.K("",this._backPlate._scene);i.diffuseColor=g.Wo.FromHexString("#212121"),t.material=i,t.isPickable=!1,this._tooltipMesh.addChild(t),t.position=a.P.Forward(e).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=a.P.Up().scale(.7).add(a.P.Forward(e).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=s.i.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new H.a,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new j.Y,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((()=>{this._tooltipFade&&this._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((()=>{this._tooltipFade&&this._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=e)}else this._disposeTooltip()}get tooltipText(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null}get text(){return this._text}set text(e){this._text!==e&&(this._text=e,this._rebuildContent())}get imageUrl(){return this._imageUrl}set imageUrl(e){this._imageUrl!==e&&(this._imageUrl=e,this._rebuildContent())}get backMaterial(){return this._backMaterial}get frontMaterial(){return this._frontMaterial}get plateMaterial(){return this._plateMaterial}get shareMaterials(){return this._shareMaterials}set isBackplateVisible(e){this.mesh&&this._backMaterial&&(e&&!this._isBackplateVisible?this._backPlate.visibility=1:!e&&this._isBackplateVisible&&(this._backPlate.visibility=0)),this._isBackplateVisible=e}_getTypeName(){return"TouchHolographicButton"}_rebuildContent(){this._disposeFacadeTexture();const e=new W.e;if(e.isVertical=!0,X.MZ.IsDocumentAvailable()&&document.createElement&&this._imageUrl){const t=new z.E;t.source=this._imageUrl,t.paddingTop="40px",t.height="180px",t.width="100px",t.paddingBottom="40px",e.addControl(t)}if(this._text){const t=new H.a;t.text=this._text,t.color="white",t.height="30px",t.fontSize=24,e.addControl(t)}this.content=e}_createNode(e){var t;this.name=null!==(t=this.name)&&void 0!==t?t:"TouchHolographicButton";const i=(0,f.NR)(`${this.name}_collisionMesh`,{width:1,height:1,depth:this._frontPlateDepth},e);i.isPickable=!0,i.isNearPickable=!0,i.visibility=0,i.position=a.P.Forward(e.useRightHandedSystem).scale(-this._frontPlateDepth/2),V.n.ImportMeshAsync(void 0,Z.MODEL_BASE_URL,Z.MODEL_FILENAME,e).then((t=>{const n=(0,f.NR)("${this.name}_alphaMesh",{width:1,height:1,depth:1},e);n.isPickable=!1,n.material=new m.K("${this.name}_alphaMesh_material",e),n.material.alpha=.15;const r=t.meshes[1];r.name=`${this.name}_frontPlate`,r.isPickable=!1,r.scaling.z=this._frontPlateDepth,n.parent=r,r.parent=i,this._frontMaterial&&(r.material=this._frontMaterial),this._frontPlate=r})),this._backPlate=(0,f.NR)(`${this.name}_backPlate`,{width:1,height:1,depth:this._backPlateDepth},e),this._backPlate.position=a.P.Forward(e.useRightHandedSystem).scale(this._backPlateDepth/2),this._backPlate.isPickable=!1,this._textPlate=super._createNode(e),this._textPlate.name=`${this.name}_textPlate`,this._textPlate.isPickable=!1,this._textPlate.position=a.P.Forward(e.useRightHandedSystem).scale(-this._frontPlateDepth/2),this._backPlate.addChild(i),this._backPlate.addChild(this._textPlate);const n=new r.Y("{this.name}_root",e);return this._backPlate.setParent(n),this.collisionMesh=i,this.collidableFrontDirection=this._backPlate.forward.negate(),n}_applyFacade(e){this._plateMaterial.emissiveTexture=e,this._plateMaterial.opacityTexture=e,this._plateMaterial.diffuseColor=new g.Wo(.4,.4,.4)}_createBackMaterial(e){this._backMaterial=new O(this.name+"backPlateMaterial",e.getScene()),this._backMaterial.albedoColor=this._backplateColor,this._backMaterial.renderBorders=!0,this._backMaterial.renderHoverLight=!1}_createFrontMaterial(e){this._frontMaterial=new Q(this.name+"Front Material",e.getScene())}_createPlateMaterial(e){this._plateMaterial=new m.K(this.name+"Plate Material",e.getScene()),this._plateMaterial.specularColor=g.Wo.Black()}_onToggle(e){this._backMaterial&&(this._backMaterial.albedoColor=e?this._backplateToggledColor:this._backplateColor),super._onToggle(e)}_affectMaterial(e){this._shareMaterials?(this._host._touchSharedMaterials.backFluentMaterial?this._backMaterial=this._host._touchSharedMaterials.backFluentMaterial:(this._createBackMaterial(e),this._host._touchSharedMaterials.backFluentMaterial=this._backMaterial),this._host._touchSharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._touchSharedMaterials.frontFluentMaterial:(this._createFrontMaterial(e),this._host._touchSharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(e),this._createFrontMaterial(e)),this._createPlateMaterial(e),this._backPlate.material=this._backMaterial,this._textPlate.material=this._plateMaterial,this._isBackplateVisible||(this._backPlate.visibility=0),this._frontPlate&&(this._frontPlate.material=this._frontMaterial),this._rebuildContent()}dispose(){super.dispose(),this._disposeTooltip(),this.onPointerMoveObservable.remove(this._pointerHoverObserver),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))}}Z.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",Z.MODEL_FILENAME="mrtk-fluent-button.glb";var $=i("../../../node_modules/@babylonjs/gui/2D/controls/control.js"),J=i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/followBehavior.js"),ee=i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/sixDofDragBehavior.js"),te=i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/surfaceMagnetismBehavior.js");class ie{constructor(){this.followBehaviorEnabled=!1,this.sixDofDragBehaviorEnabled=!0,this.surfaceMagnetismBehaviorEnabled=!0,this._followBehavior=new J.j,this._sixDofDragBehavior=new ee.K,this._surfaceMagnetismBehavior=new te.p}get name(){return"Default"}get followBehavior(){return this._followBehavior}get sixDofDragBehavior(){return this._sixDofDragBehavior}get surfaceMagnetismBehavior(){return this._surfaceMagnetismBehavior}init(){}attach(e,t,i){this._scene=e.getScene(),this.attachedNode=e,this._addObservables(),this._followBehavior.attach(e),this._sixDofDragBehavior.attach(e),this._sixDofDragBehavior.draggableMeshes=t||null,this._sixDofDragBehavior.faceCameraOnDragStart=!0,this._surfaceMagnetismBehavior.attach(e,this._scene),i&&(this._surfaceMagnetismBehavior.meshes=i),this._surfaceMagnetismBehavior.enabled=!1}detach(){this.attachedNode=null,this._removeObservables(),this._followBehavior.detach(),this._sixDofDragBehavior.detach(),this._surfaceMagnetismBehavior.detach()}_addObservables(){this._onBeforeRenderObserver=this._scene.onBeforeRenderObservable.add((()=>{this._followBehavior._enabled=!this._sixDofDragBehavior.isMoving&&this.followBehaviorEnabled})),this._onDragObserver=this._sixDofDragBehavior.onDragObservable.add((e=>{this._sixDofDragBehavior.disableMovement=this._surfaceMagnetismBehavior.findAndUpdateTarget(e.pickInfo)}))}_removeObservables(){this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._sixDofDragBehavior.onDragObservable.remove(this._onDragObserver)}}var ne=i("../../../node_modules/@babylonjs/core/Gizmos/gizmo.js"),re=i("../../../node_modules/@babylonjs/core/Maths/math.constants.js"),se=i("../../../node_modules/@babylonjs/core/Misc/pivotTools.js"),oe=i("../../../node_modules/@babylonjs/core/Materials/shaderMaterial.js");M.v.ShadersStore.handleVertexShader="precision highp float;\nattribute vec3 position;\nuniform vec3 positionOffset;\nuniform mat4 worldViewProjection;\nuniform float scale;\nvoid main(void) {\nvec4 vPos=vec4((vec3(position)+positionOffset)*scale,1.0);\ngl_Position=worldViewProjection*vPos;\n}";M.v.ShadersStore.handlePixelShader="uniform vec3 color;\nvoid main(void) {\ngl_FragColor=vec4(color,1.0);\n}";class ae extends oe.j{constructor(e,t){super(e,t,"handle",{attributes:["position"],uniforms:["worldViewProjection","color","scale","positionOffset"],needAlphaBlending:!1,needAlphaTesting:!1}),this._hover=!1,this._drag=!1,this._color=new g.Wo,this._scale=1,this._lastTick=-1,this.animationLength=100,this.hoverColor=new g.Wo(0,.467,.84),this.baseColor=new g.Wo(1,1,1),this.hoverScale=.75,this.baseScale=.35,this.dragScale=.55,this._positionOffset=a.P.Zero(),this._updateInterpolationTarget(),this._lastTick=Date.now(),this._onBeforeRender=this.getScene().onBeforeRenderObservable.add((()=>{const e=Date.now(),t=e-this._lastTick,i=this._targetScale-this._scale,n=g.zZ.Color3[0].copyFrom(this._targetColor).subtractToRef(this._color,g.zZ.Color3[0]);this._scale=this._scale+i*t/this.animationLength,n.scaleToRef(t/this.animationLength,n),this._color.addToRef(n,this._color),this.setColor3("color",this._color),this.setFloat("scale",this._scale),this.setVector3("positionOffset",this._positionOffset),this._lastTick=e}))}get hover(){return this._hover}set hover(e){this._hover=e,this._updateInterpolationTarget()}get drag(){return this._drag}set drag(e){this._drag=e,this._updateInterpolationTarget()}_updateInterpolationTarget(){this.drag?(this._targetColor=this.hoverColor,this._targetScale=this.dragScale):this.hover?(this._targetColor=this.hoverColor,this._targetScale=this.hoverScale):(this._targetColor=this.baseColor,this._targetScale=this.baseScale)}dispose(){super.dispose(),this.getScene().onBeforeRenderObservable.remove(this._onBeforeRender)}}var le,ce=i("../../../node_modules/@babylonjs/core/Behaviors/Meshes/baseSixDofDragBehavior.js");!function(e){e[e.IDLE=0]="IDLE",e[e.HOVER=1]="HOVER",e[e.DRAG=2]="DRAG"}(le||(le={}));class he{constructor(e,t){this._state=le.IDLE,this._materials=[],this._scene=t,this._gizmo=e,this.node=this.createNode(),this.node.reservedDataStore={handle:this}}get state(){return this._state}get gizmo(){return this._gizmo}set hover(e){e?this._state|=le.HOVER:this._state&=~le.HOVER,this._updateMaterial()}set drag(e){e?this._state|=le.DRAG:this._state&=~le.DRAG,this._updateMaterial()}_createMaterial(e){const t=new ae("handle",this._scene);return e&&(t._positionOffset=e),t}_updateMaterial(){const e=this._state;for(const e of this._materials)e.hover=!1,e.drag=!1;if(e&le.DRAG)for(const e of this._materials)e.drag=!0;else if(e&le.HOVER)for(const e of this._materials)e.hover=!0}setDragBehavior(e,t,i){const n=new ce.N;this._dragBehavior=n,this._dragStartObserver=n.onDragStartObservable.add(e),this._draggingObserver=n.onDragObservable.add(t),this._dragEndObserver=n.onDragEndObservable.add(i),this._dragBehavior.attach(this.node)}dispose(){this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver),this._dragBehavior.onDragObservable.remove(this._draggingObserver),this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver),this._dragBehavior.detach();for(const e of this._materials)e.dispose();this.node.dispose()}}class _e extends he{createNode(){const e=(0,f.NR)("sideVert",{width:1,height:10,depth:.1},this._scene),t=new r.Y("side",this._scene);e.parent=t;const i=this._createMaterial();return e.material=i,e.isNearGrabbable=!0,this._materials.push(i),t}}class de extends he{createNode(){const e=(0,f.NR)("angleHor",{width:3,height:1,depth:.1},this._scene),t=(0,f.NR)("angleVert",{width:1,height:3,depth:.1},this._scene),i=new r.Y("angle",this._scene);return e.parent=i,t.parent=i,e.material=this._createMaterial(new a.P(1,0,0)),t.material=this._createMaterial(new a.P(0,1,0)),t.isNearGrabbable=!0,e.isNearGrabbable=!0,this._materials.push(e.material),this._materials.push(t.material),i}}class ue extends ne.t{constructor(e){super(e),this._boundingDimensions=new a.P(0,0,0),this._renderObserver=null,this._tmpQuaternion=new a._f,this._tmpVector=new a.P(0,0,0),this._corners=[],this._sides=[],this._boundingBoxGizmo={min:new a.P,max:new a.P},this._margin=.35,this._handleSize=.075,this._attachedSlate=null,this._existingSlateScale=new a.P,this.fixedScreenSize=!1,this.fixedScreenSizeDistanceFactor=10,this._createNode(),this.updateScale=!1,this._renderObserver=this.gizmoLayer.originalScene.onBeforeRenderObservable.add((()=>{this.attachedMesh&&!this._existingSlateScale.equals(this.attachedMesh.scaling)&&this.updateBoundingBox()}))}set attachedSlate(e){e?(this.attachedMesh=e.mesh,this.updateBoundingBox(),this._pickedPointObserver=e._host.onPickingObservable.add((e=>{if(!this._handleHovered||e&&e.parent===this._handleHovered.node||(this._handleHovered.hover=!1,this._handleHovered=null),e&&e.parent&&e.parent.reservedDataStore&&e.parent.reservedDataStore.handle){const t=e.parent.reservedDataStore.handle;t.gizmo===this&&(this._handleHovered=t,this._handleHovered.hover=!0)}}))):this._attachedSlate&&this._attachedSlate._host.onPickingObservable.remove(this._pickedPointObserver),this._attachedSlate=e}get attachedSlate(){return this._attachedSlate}_createNode(){this._handlesParent=new r.Y("handlesParent",this.gizmoLayer.utilityLayerScene),this._handlesParent.rotationQuaternion=a._f.Identity();const e=[{dimensions:new a.P(-1,-1,0),origin:new a.P(1,0,0)},{dimensions:new a.P(1,-1,0),origin:new a.P(0,0,0)},{dimensions:new a.P(1,1,0),origin:new a.P(0,1,0)},{dimensions:new a.P(-1,1,0),origin:new a.P(1,1,0)}];for(let t=0;t<4;t++){const i=new de(this,this.gizmoLayer.utilityLayerScene);this._corners.push(i),i.node.rotation.z=Math.PI/2*t,i.node.parent=this._handlesParent,this._assignDragBehaviorCorners(i,((e,t,i,n)=>this._moveHandle(e,t,i,n,!0)),e[t])}for(let e=0;e<4;e++){const t=new _e(this,this.gizmoLayer.utilityLayerScene);this._sides.push(t),t.node.rotation.z=Math.PI/2*e,t.node.parent=this._handlesParent,this._assignDragBehaviorSides(t,e%2==0?new a.P(0,1,0):new a.P(1,0,0))}this._handlesParent.parent=this._rootMesh}_keepAspectRatio(e,t,i=!1){const n=a.jp.Vector3[0];n.copyFromFloats(t,1,0).normalize(),i&&(n.y*=-1);const r=a.P.Dot(e,n);e.copyFrom(n).scaleInPlace(r)}_clampDimensions(e,t,i,n=!1){const r=a.jp.Vector3[0];r.copyFrom(e).multiplyInPlace(i);const s=a.jp.Vector3[1];if(s.copyFromFloats(Math.max(this._attachedSlate.minDimensions.x,r.x+t.x),Math.max(this._attachedSlate.minDimensions.y,r.y+t.y),0),n){const e=t.x/t.y;s.x=Math.max(s.x,s.y*e),s.y=Math.max(s.y,s.x/e)}r.copyFrom(s).subtractInPlace(t),e.x=Math.sign(e.x)*Math.abs(r.x),e.y=Math.sign(e.y)*Math.abs(r.y)}_moveHandle(e,t,i,n,r){if(!this._attachedSlate)return;if(r){const e=t.x/t.y;this._keepAspectRatio(i,e,n.dimensions.x*n.dimensions.y<0)}this._clampDimensions(i,t,n.dimensions,r);const s=a.jp.Vector3[0],o=a.jp.Vector3[1];s.copyFrom(i).multiplyInPlace(n.origin),o.copyFrom(i).multiplyInPlace(n.dimensions),this._attachedSlate.origin.copyFrom(e).addInPlace(s),this._attachedSlate.dimensions.set(t.x+o.x,t.y+o.y)}_assignDragBehaviorCorners(e,t,i){const n=new a.P,r=new a.P,s=new a.P,o=new a.y3,l=new a.P;e.setDragBehavior((e=>{this.attachedSlate&&this.attachedMesh&&(n.set(this.attachedSlate.dimensions.x,this.attachedSlate.dimensions.y,re.kn),r.copyFrom(this.attachedSlate.origin),s.copyFrom(e.position),o.copyFrom(this.attachedMesh.computeWorldMatrix(!0)),o.invert(),this.attachedSlate._followButton.isToggled=!1,a.P.TransformNormalToRef(a.P.Forward(),this.attachedMesh.getWorldMatrix(),l),l.normalize(),this._handleHovered&&(this._handleDragged=this._handleHovered,this._handleDragged.drag=!0))}),(e=>{this.attachedSlate&&this.attachedMesh&&(((e,t,i,n)=>{e.subtractToRef(i,a.jp.Vector3[0]);const r=a.P.Dot(a.jp.Vector3[0],t);a.jp.Vector3[1].copyFrom(t).scaleInPlace(r),a.jp.Vector3[0].subtractInPlace(a.jp.Vector3[1]),a.jp.Vector3[0].addToRef(i,n)})(e.position,l,s,this._tmpVector),this._tmpVector.subtractInPlace(s),a.P.TransformNormalToRef(this._tmpVector,o,this._tmpVector),t(r,n,this._tmpVector,i),this.attachedSlate._positionElements(),this.updateBoundingBox())}),(()=>{this.attachedSlate&&this.attachedNode&&(this.attachedSlate._updatePivot(),this._handleDragged&&(this._handleDragged.drag=!1,this._handleDragged=null))}))}_assignDragBehaviorSides(e,t){const i=new a._f,n=new a.P,r=new a.P,s=new a.P,o=new a.P;e.setDragBehavior((e=>{this.attachedSlate&&this.attachedMesh&&(i.copyFrom(this.attachedMesh.rotationQuaternion),n.copyFrom(e.position),s.copyFrom(this.attachedMesh.getAbsolutePivotPoint()),r.copyFrom(n).subtractInPlace(s).normalize(),this.attachedSlate._followButton.isToggled=!1,a.P.TransformNormalToRef(t,this.attachedMesh.getWorldMatrix(),o),o.normalize(),this._handleHovered&&(this._handleDragged=this._handleHovered,this._handleDragged.drag=!0))}),(e=>{if(this.attachedSlate&&this.attachedMesh){this._tmpVector.copyFrom(e.position),this._tmpVector.subtractInPlace(s),this._tmpVector.normalize();const n=-a.P.GetAngleBetweenVectorsOnPlane(this._tmpVector,r,o);a._f.RotationAxisToRef(t,n,this._tmpQuaternion),i.multiplyToRef(this._tmpQuaternion,this.attachedMesh.rotationQuaternion)}}),(()=>{this.attachedSlate&&this.attachedNode&&(this.attachedSlate._updatePivot(),this._handleDragged&&(this._handleDragged.drag=!1,this._handleDragged=null))}))}_attachedNodeChanged(e){e&&this.updateBoundingBox()}updateBoundingBox(){if(this.attachedMesh){se.m._RemoveAndStorePivotPoint(this.attachedMesh);const e=this.attachedMesh.parent;this.attachedMesh.setParent(null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=a._f.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0);const t=this.attachedMesh.getHierarchyBoundingVectors();t.max.subtractToRef(t.min,this._boundingDimensions),this._boundingBoxGizmo.min=t.min,this._boundingBoxGizmo.max=t.max,this._updateHandlesPosition(),this._updateHandlesScaling(),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),se.m._RestorePivotPoint(this.attachedMesh),this.attachedMesh.setParent(e),this.attachedMesh.computeWorldMatrix(!0),this._existingSlateScale.copyFrom(this.attachedMesh.scaling)}}_updateHandlesPosition(){const e=this._boundingBoxGizmo.min.clone(),t=this._boundingBoxGizmo.max.clone(),i=this._corners[0].node.scaling.length();e.x-=this._margin*i,e.y-=this._margin*i,t.x+=this._margin*i,t.y+=this._margin*i;const n=e.add(t).scaleInPlace(.5);this._corners[0].node.position.copyFromFloats(e.x,e.y,0),this._corners[1].node.position.copyFromFloats(t.x,e.y,0),this._corners[2].node.position.copyFromFloats(t.x,t.y,0),this._corners[3].node.position.copyFromFloats(e.x,t.y,0),this._sides[0].node.position.copyFromFloats(e.x,n.y,0),this._sides[1].node.position.copyFromFloats(n.x,e.y,0),this._sides[2].node.position.copyFromFloats(t.x,n.y,0),this._sides[3].node.position.copyFromFloats(n.x,t.y,0)}_updateHandlesScaling(){if(this._attachedSlate&&this._attachedSlate.mesh){const e=this._attachedSlate.mesh.scaling.x*this._attachedSlate.dimensions.x,t=this._attachedSlate.mesh.scaling.y*this._attachedSlate.dimensions.y,i=Math.min(e,t)*this._handleSize;for(let e=0;ei?this.minDimensions.x/e.x:this.minDimensions.y/e.y}this._dimensions.copyFrom(e).scaleInPlace(t),this._updatePivot(),this._positionElements()}get titleBarHeight(){return this._titleBarHeight}set titleBarHeight(e){this._titleBarHeight=e}set renderingGroupId(e){this._titleBar.renderingGroupId=e,this._titleBarTitle.renderingGroupId=e,this._contentPlate.renderingGroupId=e,this._backPlate.renderingGroupId=e}get renderingGroupId(){return this._titleBar.renderingGroupId}set title(e){this._titleText=e,this._titleTextComponent&&(this._titleTextComponent.text=e)}get title(){return this._titleText}_applyFacade(e){this._contentMaterial.albedoTexture=e,this._resetContentPositionAndZoom(),this._applyContentViewport(),e.attachToMesh(this._contentPlate,!0)}_addControl(e){e._host=this._host,this._host.utilityLayer&&e._prepareNode(this._host.utilityLayer.utilityLayerScene)}_getTypeName(){return"HolographicSlate"}_positionElements(){const e=this._followButton,t=this._closeButton,i=this._titleBar,n=this._titleBarTitle,r=this._contentPlate,s=this._backPlate;if(e&&t&&i){t.scaling.setAll(this.titleBarHeight),e.scaling.setAll(this.titleBarHeight),t.position.copyFromFloats(this.dimensions.x-this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin),e.position.copyFromFloats(this.dimensions.x-3*this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin);const o=this.dimensions.y-this.titleBarHeight-this.titleBarMargin,a=r.getScene().useRightHandedSystem;i.scaling.set(this.dimensions.x,this.titleBarHeight,re.kn),n.scaling.set(this.dimensions.x-2*this.titleBarHeight,this.titleBarHeight,re.kn),r.scaling.copyFromFloats(this.dimensions.x,o,re.kn),s.scaling.copyFromFloats(this.dimensions.x,o,re.kn),i.position.copyFromFloats(this.dimensions.x/2,-this.titleBarHeight/2,0).addInPlace(this.origin),n.position.copyFromFloats(this.dimensions.x/2-this.titleBarHeight,-this.titleBarHeight/2,a?re.kn:-re.kn).addInPlace(this.origin),r.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+o/2),0).addInPlace(this.origin),s.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+o/2),a?-re.kn:re.kn).addInPlace(this.origin),this._titleTextComponent.host.scaleTo(be._DEFAULT_TEXT_RESOLUTION_Y*n.scaling.x/n.scaling.y,be._DEFAULT_TEXT_RESOLUTION_Y);const l=this.dimensions.x/o;this._contentViewport.width=this._contentScaleRatio,this._contentViewport.height=this._contentScaleRatio/l,this._applyContentViewport(),this._gizmo&&this._gizmo.updateBoundingBox()}}_applyContentViewport(){var e;if((null===(e=this._contentPlate)||void 0===e?void 0:e.material)&&this._contentPlate.material.albedoTexture){const e=this._contentPlate.material.albedoTexture;e.uScale=this._contentScaleRatio,e.vScale=this._contentScaleRatio/this._contentViewport.width*this._contentViewport.height,e.uOffset=this._contentViewport.x,e.vOffset=this._contentViewport.y}}_resetContentPositionAndZoom(){this._contentViewport.x=0,this._contentViewport.y=1-this._contentViewport.height/this._contentViewport.width,this._contentScaleRatio=1}_updatePivot(){if(!this.mesh)return;const e=new a.P(.5*this.dimensions.x,.5*-this.dimensions.y,re.kn);e.addInPlace(this.origin),e.z=0;const t=new a.P(0,0,0);a.P.TransformCoordinatesToRef(t,this.mesh.computeWorldMatrix(!0),t),this.mesh.setPivotPoint(e);const i=new a.P(0,0,0);a.P.TransformCoordinatesToRef(i,this.mesh.computeWorldMatrix(!0),i),this.mesh.position.addInPlace(t).subtractInPlace(i)}_createNode(e){const t=new C.Kj("slate_"+this.name,e);this._titleBar=(0,f.NR)("titleBar_"+this.name,{size:1},e),this._titleBarTitle=(0,G.pT)("titleText_"+this.name,{size:1},e),this._titleBarTitle.parent=t,this._titleBarTitle.isPickable=!1;const i=s.i.CreateForMesh(this._titleBarTitle);if(this._titleTextComponent=new H.a("titleText_"+this.name,this._titleText),this._titleTextComponent.textWrapping=H.i.Ellipsis,this._titleTextComponent.textHorizontalAlignment=$.o.HORIZONTAL_ALIGNMENT_LEFT,this._titleTextComponent.color="white",this._titleTextComponent.fontSize=be._DEFAULT_TEXT_RESOLUTION_Y/2,this._titleTextComponent.paddingLeft=be._DEFAULT_TEXT_RESOLUTION_Y/4,i.addControl(this._titleTextComponent),e.useRightHandedSystem){const t=new fe.Lt(0,0,1,1);this._contentPlate=(0,G.pT)("contentPlate_"+this.name,{size:1,sideOrientation:ge.x.BACKSIDE,frontUVs:t},e),this._backPlate=(0,G.pT)("backPlate_"+this.name,{size:1,sideOrientation:ge.x.FRONTSIDE},e)}else{const t=new fe.Lt(0,0,1,1);this._contentPlate=(0,G.pT)("contentPlate_"+this.name,{size:1,sideOrientation:ge.x.FRONTSIDE,frontUVs:t},e),this._backPlate=(0,G.pT)("backPlate_"+this.name,{size:1,sideOrientation:ge.x.BACKSIDE},e)}this._titleBar.parent=t,this._titleBar.isNearGrabbable=!0,this._contentPlate.parent=t,this._backPlate.parent=t,this._attachContentPlateBehavior(),this._addControl(this._followButton),this._addControl(this._closeButton);const n=this._followButton,r=this._closeButton;return n.node.parent=t,r.node.parent=t,this._positionElements(),this._followButton.imageUrl=be.ASSETS_BASE_URL+be.FOLLOW_ICON_FILENAME,this._closeButton.imageUrl=be.ASSETS_BASE_URL+be.CLOSE_ICON_FILENAME,this._followButton.isBackplateVisible=!1,this._closeButton.isBackplateVisible=!1,this._followButton.onToggleObservable.add((e=>{this._defaultBehavior.followBehaviorEnabled=e,this._defaultBehavior.followBehaviorEnabled&&this._defaultBehavior.followBehavior.recenter()})),this._closeButton.onPointerClickObservable.add((()=>{this.dispose()})),t.rotationQuaternion=a._f.Identity(),t.isVisible=!1,t}_attachContentPlateBehavior(){this._contentDragBehavior.attach(this._contentPlate),this._contentDragBehavior.moveAttached=!1,this._contentDragBehavior.useObjectOrientationForDragging=!0,this._contentDragBehavior.updateDragPlane=!1;const e=new a.P,t=new a.P,i=new a.P,n=new a.P,r=new a.FM;let s,o;this._contentDragBehavior.onDragStartObservable.add((r=>{this.node&&(s=this._contentViewport.clone(),o=this.node.computeWorldMatrix(!0),e.copyFrom(r.dragPlanePoint),t.set(this.dimensions.x,this.dimensions.y,re.kn),t.y-=this.titleBarHeight+this.titleBarMargin,a.P.TransformNormalToRef(t,o,t),i.copyFromFloats(0,1,0),a.P.TransformNormalToRef(i,o,i),n.copyFromFloats(1,0,0),a.P.TransformNormalToRef(n,o,n),i.normalize(),i.scaleInPlace(1/a.P.Dot(i,t)),n.normalize(),n.scaleInPlace(1/a.P.Dot(n,t)))}));const l=new a.P;this._contentDragBehavior.onDragObservable.add((t=>{l.copyFrom(t.dragPlanePoint),l.subtractInPlace(e),r.copyFromFloats(a.P.Dot(l,n),a.P.Dot(l,i)),this._contentViewport.x=K.R.Clamp(s.x-l.x,0,1-this._contentViewport.width*this._contentScaleRatio),this._contentViewport.y=K.R.Clamp(s.y-l.y,0,1-this._contentViewport.height*this._contentScaleRatio),this._applyContentViewport()}))}_affectMaterial(e){this._titleBarMaterial=new k(`${this.name} plateMaterial`,e.getScene()),this._contentMaterial=new O(`${this.name} contentMaterial`,e.getScene()),this._contentMaterial.renderBorders=!0,this._backMaterial=new k(`${this.name} backPlate`,e.getScene()),this._backMaterial.lineWidth=re.kn,this._backMaterial.radius=.005,this._backMaterial.backFaceCulling=!0,this._titleBar.material=this._titleBarMaterial,this._contentPlate.material=this._contentMaterial,this._backPlate.material=this._backMaterial,this._resetContent(),this._applyContentViewport()}_prepareNode(e){super._prepareNode(e),this._gizmo=new ue(this._host.utilityLayer),this._gizmo.attachedSlate=this,this._defaultBehavior=new ie,this._defaultBehavior.attach(this.node,[this._titleBar]),this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add((()=>{this._followButton.isToggled=!1})),this._positionChangedObserver=this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add((()=>{this._gizmo.updateBoundingBox()})),this._updatePivot(),this.resetDefaultAspectAndPose(!1)}resetDefaultAspectAndPose(e=!0){if(!this._host||!this._host.utilityLayer||!this.node)return;const t=this._host.utilityLayer.utilityLayerScene,i=t.activeCamera;if(i){const n=i.getWorldMatrix(),r=a.P.TransformNormal(a.P.Backward(t.useRightHandedSystem),n);this.origin.setAll(0),this._gizmo.updateBoundingBox();const s=this.node.getAbsolutePivotPoint();this.node.position.copyFrom(i.position).subtractInPlace(r).subtractInPlace(s),this.node.rotationQuaternion=a._f.FromLookDirectionLH(r,new a.P(0,1,0)),e&&(this.dimensions=this.defaultDimensions)}}dispose(){super.dispose(),this._titleBarMaterial.dispose(),this._contentMaterial.dispose(),this._titleBar.dispose(),this._titleBarTitle.dispose(),this._contentPlate.dispose(),this._backPlate.dispose(),this._followButton.dispose(),this._closeButton.dispose(),this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver),this._defaultBehavior.detach(),this._gizmo.dispose(),this._contentDragBehavior.detach()}}be.ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",be.CLOSE_ICON_FILENAME="IconClose.png",be.FOLLOW_ICON_FILENAME="IconFollowMe.png",be._DEFAULT_TEXT_RESOLUTION_Y=102.4;class ye extends F{constructor(e){super(e),this._isPinned=!1,this._defaultBehavior=new ie,this._dragObserver=this._defaultBehavior.sixDofDragBehavior.onDragObservable.add((()=>{this.isPinned=!0})),this.backPlateMargin=1}get defaultBehavior(){return this._defaultBehavior}get isPinned(){return this._isPinned}set isPinned(e){this._pinButton.isToggled===e?(this._isPinned=e,this._defaultBehavior.followBehaviorEnabled=!e):this._pinButton.isToggled=e}_createPinButton(e){const t=new Z("pin"+this.name,!1);return t.imageUrl=ye._ASSETS_BASE_URL+ye._PIN_ICON_FILENAME,t.parent=this,t._host=this._host,t.isToggleButton=!0,t.onToggleObservable.add((e=>{this.isPinned=e})),this._host.utilityLayer&&(t._prepareNode(this._host.utilityLayer.utilityLayerScene),t.scaling.scaleInPlace(F.MENU_BUTTON_SCALE),t.node&&(t.node.parent=e)),t}_createNode(e){const t=super._createNode(e);return this._pinButton=this._createPinButton(t),this.isPinned=!1,this._defaultBehavior.attach(t,[this._backPlate]),this._defaultBehavior.followBehavior.ignoreCameraPitchAndRoll=!0,this._defaultBehavior.followBehavior.pitchOffset=-15,this._defaultBehavior.followBehavior.minimumDistance=.3,this._defaultBehavior.followBehavior.defaultDistance=.4,this._defaultBehavior.followBehavior.maximumDistance=.6,this._backPlate.isNearGrabbable=!0,t.isVisible=!1,t}_finalProcessing(){super._finalProcessing(),this._pinButton.position.copyFromFloats((this._backPlate.scaling.x+F.MENU_BUTTON_SCALE)/2,this._backPlate.scaling.y/2,0)}dispose(){super.dispose(),this._defaultBehavior.sixDofDragBehavior.onDragObservable.remove(this._dragObserver),this._defaultBehavior.detach()}}ye._ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",ye._PIN_ICON_FILENAME="IconPin.png";M.v.ShadersStore.mrdlSliderBarPixelShader="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nuniform float _Radius_;\nuniform float _Bevel_Front_;\nuniform float _Bevel_Front_Stretch_;\nuniform float _Bevel_Back_;\nuniform float _Bevel_Back_Stretch_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform bool _Bulge_Enabled_;\nuniform float _Bulge_Height_;\nuniform float _Bulge_Radius_;\nuniform float _Sun_Intensity_;\nuniform float _Sun_Theta_;\nuniform float _Sun_Phi_;\nuniform float _Indirect_Diffuse_;\nuniform vec4 _Albedo_;\nuniform float _Specular_;\nuniform float _Shininess_;\nuniform float _Sharpness_;\nuniform float _Subsurface_;\nuniform vec4 _Left_Color_;\nuniform vec4 _Right_Color_;\nuniform float _Reflection_;\nuniform float _Front_Reflect_;\nuniform float _Edge_Reflect_;\nuniform float _Power_;\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\nuniform float _Width_;\nuniform float _Fuzz_;\nuniform float _Min_Fuzz_;\nuniform float _Clip_Fade_;\nuniform float _Hue_Shift_;\nuniform float _Saturation_Shift_;\nuniform float _Value_Shift_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Left_Index_Pos_;\nuniform vec3 _Right_Index_Pos_;\nuniform vec3 _Left_Index_Middle_Pos_;\nuniform vec3 _Right_Index_Middle_Pos_;\nuniform sampler2D _Decal_;\nuniform vec2 _Decal_Scale_XY_;\nuniform bool _Decal_Front_Only_;\nuniform float _Rim_Intensity_;\nuniform sampler2D _Rim_Texture_;\nuniform float _Rim_Hue_Shift_;\nuniform float _Rim_Saturation_Shift_;\nuniform float _Rim_Value_Shift_;\nuniform float _Iridescence_Intensity_;\nuniform sampler2D _Iridescence_Texture_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform vec4 Global_Left_Index_Middle_Position;\nuniform vec4 Global_Right_Index_Middle_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvoid Blob_Fragment_B30(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{\nfloat k1=dot(Blob_Info1.xy,Blob_Info1.xy);\nfloat k2=dot(Blob_Info2.xy,Blob_Info2.xy);\nvec3 closer=k10.0) {\nC=mix(H,S,k);\n} else {\nC=mix(H,G,k); \n}\nreturn C;\n}\nvoid Sky_Environment_B50(\nvec3 Normal,\nvec3 Reflected,\nvec4 Sky_Color,\nvec4 Horizon_Color,\nvec4 Ground_Color,\nfloat Horizon_Power,\nout vec4 Reflected_Color,\nout vec4 Indirect_Color)\n{\nReflected_Color=SampleEnv_Bid50(Reflected,Sky_Color,Horizon_Color,Ground_Color,Horizon_Power);\nIndirect_Color=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\n}\nvoid Min_Segment_Distance_B65(\nvec3 P0,\nvec3 P1,\nvec3 Q0,\nvec3 Q1,\nout vec3 NearP,\nout vec3 NearQ,\nout float Distance)\n{\nvec3 u=P1-P0;\nvec3 v=Q1-Q0;\nvec3 w=P0-Q0;\nfloat a=dot(u,u);\nfloat b=dot(u,v);\nfloat c=dot(v,v);\nfloat d=dot(u,w);\nfloat e=dot(v,w);\nfloat D=a*c-b*b;\nfloat sD=D;\nfloat tD=D;\nfloat sc,sN,tc,tN;\nif (D<0.00001) {\nsN=0.0;\nsD=1.0;\ntN=e;\ntD=c;\n} else {\nsN=(b*e-c*d);\ntN=(a*e-b*d);\nif (sN<0.0) {\nsN=0.0;\ntN=e;\ntD=c;\n} else if (sN>sD) {\nsN=sD;\ntN=e+b;\ntD=c;\n}\n}\nif (tN<0.0) {\ntN=0.0;\nif (-d<0.0) {\nsN=0.0;\n} else if (-d>a) {\nsN=sD;\n} else {\nsN=-d;\nsD=a;\n}\n} else if (tN>tD) {\ntN=tD;\nif ((-d+b)<0.0) {\nsN=0.0;\n} else if ((-d+b)>a) {\nsN=sD;\n} else {\nsN=(-d+b);\nsD=a;\n}\n}\nsc=abs(sN)<0.000001 ? 0.0 : sN/sD;\ntc=abs(tN)<0.000001 ? 0.0 : tN/tD;\nNearP=P0+sc*u;\nNearQ=Q0+tc*v;\nDistance=distance(NearP,NearQ);\n}\nvoid To_XYZ_B74(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Finger_Positions_B64(\nvec3 Left_Index_Pos,\nvec3 Right_Index_Pos,\nvec3 Left_Index_Middle_Pos,\nvec3 Right_Index_Middle_Pos,\nout vec3 Left_Index,\nout vec3 Right_Index,\nout vec3 Left_Index_Middle,\nout vec3 Right_Index_Middle)\n{\nLeft_Index= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Left_Index_Pos);\nRight_Index= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Right_Index_Pos);\nLeft_Index_Middle= (Use_Global_Left_Index ? Global_Left_Index_Middle_Position.xyz : Left_Index_Middle_Pos);\nRight_Index_Middle= (Use_Global_Right_Index ? Global_Right_Index_Middle_Position.xyz : Right_Index_Middle_Pos);\n}\nvoid VaryHSV_B108(\nvec3 HSV_In,\nfloat Hue_Shift,\nfloat Saturation_Shift,\nfloat Value_Shift,\nout vec3 HSV_Out)\n{\nHSV_Out=vec3(fract(HSV_In.x+Hue_Shift),clamp(HSV_In.y+Saturation_Shift,0.0,1.0),clamp(HSV_In.z+Value_Shift,0.0,1.0));\n}\nvoid Remap_Range_B114(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{\nOut=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));\n}\nvoid To_HSV_B75(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{\nvec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);\nvec4 p=Color.g0.0;\nResult=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);\nResult*=Radius;\n}\nvoid Conditional_Float_B36(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Greater_Than_B37(\nfloat Left,\nfloat Right,\nout bool Not_Greater_Than,\nout bool Greater_Than)\n{\nGreater_Than=Left>Right;\nNot_Greater_Than=!Greater_Than;\n}\nvoid Remap_Range_B105(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{\nOut=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));\n}\nvoid main()\n{\nvec2 XY_Q85;\nXY_Q85=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);\nvec3 Tangent_World_Q27;\nvec3 Tangent_World_N_Q27;\nfloat Tangent_Length_Q27;\nTangent_World_Q27=(world*vec4(vec3(1,0,0),0.0)).xyz;\nTangent_Length_Q27=length(Tangent_World_Q27);\nTangent_World_N_Q27=Tangent_World_Q27/Tangent_Length_Q27;\nvec3 Normal_World_Q60;\nvec3 Normal_World_N_Q60;\nfloat Normal_Length_Q60;\nObject_To_World_Dir_B60(vec3(0,0,1),Normal_World_Q60,Normal_World_N_Q60,Normal_Length_Q60);\nfloat X_Q78;\nfloat Y_Q78;\nfloat Z_Q78;\nTo_XYZ_B78(position,X_Q78,Y_Q78,Z_Q78);\nvec3 Nrm_World_Q26;\nNrm_World_Q26=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Binormal_World_Q28;\nvec3 Binormal_World_N_Q28;\nfloat Binormal_Length_Q28;\nObject_To_World_Dir_B28(vec3(0,1,0),Binormal_World_Q28,Binormal_World_N_Q28,Binormal_Length_Q28);\nfloat Anisotropy_Q29=Tangent_Length_Q27/Binormal_Length_Q28;\nfloat Result_Q69;\nPick_Radius_B69(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q69);\nfloat Anisotropy_Q53=Binormal_Length_Q28/Normal_Length_Q60;\nbool Not_Greater_Than_Q37;\nbool Greater_Than_Q37;\nGreater_Than_B37(Z_Q78,0.0,Not_Greater_Than_Q37,Greater_Than_Q37);\nvec4 Linear_Q101;\nLinear_Q101.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);\nLinear_Q101.a=_Left_Color_.a;\nvec4 Linear_Q102;\nLinear_Q102.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);\nLinear_Q102.a=_Right_Color_.a;\nvec3 Difference_Q61=vec3(0,0,0)-Normal_World_N_Q60;\nvec4 Out_Color_Q34=vec4(X_Q78,Y_Q78,Z_Q78,1);\nfloat Result_Q36;\nConditional_Float_B36(Greater_Than_Q37,_Bevel_Back_,_Bevel_Front_,Result_Q36);\nfloat Result_Q94;\nConditional_Float_B36(Greater_Than_Q37,_Bevel_Back_Stretch_,_Bevel_Front_Stretch_,Result_Q94);\nvec3 New_P_Q130;\nvec2 New_UV_Q130;\nfloat Radial_Gradient_Q130;\nvec3 Radial_Dir_Q130;\nvec3 New_Normal_Q130;\nMove_Verts_B130(Anisotropy_Q29,position,Result_Q69,Result_Q36,normal,Anisotropy_Q53,Result_Q94,New_P_Q130,New_UV_Q130,Radial_Gradient_Q130,Radial_Dir_Q130,New_Normal_Q130);\nfloat X_Q98;\nfloat Y_Q98;\nX_Q98=New_UV_Q130.x;\nY_Q98=New_UV_Q130.y;\nvec3 Pos_World_Q12;\nObject_To_World_Pos_B12(New_P_Q130,Pos_World_Q12);\nvec3 Nrm_World_Q32;\nObject_To_World_Normal_B32(New_Normal_Q130,Nrm_World_Q32);\nvec4 Blob_Info_Q23;\n#if BLOB_ENABLE\nBlob_Vertex_B23(Pos_World_Q12,Nrm_World_Q26,Tangent_World_N_Q27,Binormal_World_N_Q28,_Blob_Position_,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q23);\n#else\nBlob_Info_Q23=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q24;\n#if BLOB_ENABLE_2\nBlob_Vertex_B24(Pos_World_Q12,Nrm_World_Q26,Tangent_World_N_Q27,Binormal_World_N_Q28,_Blob_Position_2_,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q24);\n#else\nBlob_Info_Q24=vec4(0,0,0,0);\n#endif\nfloat Out_Q105;\nRemap_Range_B105(0.0,1.0,0.0,1.0,X_Q98,Out_Q105);\nfloat X_Q86;\nfloat Y_Q86;\nfloat Z_Q86;\nTo_XYZ_B78(Nrm_World_Q32,X_Q86,Y_Q86,Z_Q86);\nvec4 Color_At_T_Q97=mix(Linear_Q101,Linear_Q102,Out_Q105);\nfloat Minus_F_Q87=-Z_Q86;\nfloat R_Q99;\nfloat G_Q99;\nfloat B_Q99;\nfloat A_Q99;\nR_Q99=Color_At_T_Q97.r; G_Q99=Color_At_T_Q97.g; B_Q99=Color_At_T_Q97.b; A_Q99=Color_At_T_Q97.a;\nfloat ClampF_Q88=clamp(0.0,Minus_F_Q87,1.0);\nfloat Result_Q93;\nConditional_Float_B93(_Decal_Front_Only_,ClampF_Q88,1.0,Result_Q93);\nvec4 Vec4_Q89=vec4(Result_Q93,Radial_Gradient_Q130,G_Q99,B_Q99);\nvec3 Position=Pos_World_Q12;\nvec3 Normal=Nrm_World_Q32;\nvec2 UV=XY_Q85;\nvec3 Tangent=Tangent_World_N_Q27;\nvec3 Binormal=Difference_Q61;\nvec4 Color=Out_Color_Q34;\nvec4 Extra1=Vec4_Q89;\nvec4 Extra2=Blob_Info_Q23;\nvec4 Extra3=Blob_Info_Q24;\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvColor=Color;\nvExtra1=Extra1;\nvExtra2=Extra2;\nvExtra3=Extra3;\n}";class ve extends T.H{constructor(){super(),this.SKY_ENABLED=!0,this.BLOB_ENABLE_2=!0,this.IRIDESCENCE_ENABLED=!0,this._needNormals=!0,this._needUVs=!0,this.rebuild()}}class Ae extends R.a{constructor(e,t){super(e,t),this.radius=.6,this.bevelFront=.6,this.bevelFrontStretch=.077,this.bevelBack=0,this.bevelBackStretch=0,this.radiusTopLeft=1,this.radiusTopRight=1,this.radiusBottomLeft=1,this.radiusBottomRight=1,this.bulgeEnabled=!1,this.bulgeHeight=-.323,this.bulgeRadius=.73,this.sunIntensity=1.102,this.sunTheta=.76,this.sunPhi=.526,this.indirectDiffuse=.658,this.albedo=new g.HE(.0117647,.505882,.996078,1),this.specular=0,this.shininess=10,this.sharpness=0,this.subsurface=0,this.leftGradientColor=new g.HE(.0117647,.505882,.996078,1),this.rightGradientColor=new g.HE(.0117647,.505882,.996078,1),this.reflection=.749,this.frontReflect=0,this.edgeReflect=.09,this.power=8.13,this.skyColor=new g.HE(.0117647,.964706,.996078,1),this.horizonColor=new g.HE(.0117647,.333333,.996078,1),this.groundColor=new g.HE(0,.254902,.996078,1),this.horizonPower=1,this.width=.02,this.fuzz=.5,this.minFuzz=.001,this.clipFade=.01,this.hueShift=0,this.saturationShift=0,this.valueShift=0,this.blobPosition=new a.P(0,0,.1),this.blobIntensity=.5,this.blobNearSize=.01,this.blobFarSize=.03,this.blobNearDistance=0,this.blobFarDistance=.08,this.blobFadeLength=.576,this.blobPulse=0,this.blobFade=1,this.blobPosition2=new a.P(.2,0,.1),this.blobNearSize2=.01,this.blobPulse2=0,this.blobFade2=1,this.blobTexture=new d.x("",this.getScene()),this.leftIndexPosition=new a.P(0,0,1),this.rightIndexPosition=new a.P(-1,-1,-1),this.leftIndexMiddlePosition=new a.P(0,0,0),this.rightIndexMiddlePosition=new a.P(0,0,0),this.decalScaleXY=new a.FM(1.5,1.5),this.decalFrontOnly=!0,this.rimIntensity=.287,this.rimHueShift=0,this.rimSaturationShift=0,this.rimValueShift=-1,this.iridescenceIntensity=0,this.useGlobalLeftIndex=1,this.useGlobalRightIndex=1,this.globalLeftIndexTipProximity=0,this.globalRightIndexTipProximity=0,this.globalLeftIndexTipPosition=new a.Lt(.5,0,-.55,1),this.globaRightIndexTipPosition=new a.Lt(0,0,0,1),this.globalLeftThumbTipPosition=new a.Lt(.5,0,-.55,1),this.globalRightThumbTipPosition=new a.Lt(0,0,0,1),this.globalLeftIndexMiddlePosition=new a.Lt(.5,0,-.55,1),this.globalRightIndexMiddlePosition=new a.Lt(0,0,0,1),this.alphaMode=N.g.ALPHA_DISABLE,this.backFaceCulling=!1,this._blueGradientTexture=new d.x(Ae.BLUE_GRADIENT_TEXTURE_URL,this.getScene(),!0,!1,d.x.NEAREST_SAMPLINGMODE)}needAlphaBlending(){return!1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new ve);const i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;const r=n.getEngine();if(E.G.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty){i.markAsProcessed(),n.resetCachedMaterial();const e=new B.L;i.FOG&&e.addFallback(1,"FOG"),E.G.HandleFallbacksForShadows(i,e),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess;const s=[P.o.PositionKind];i.NORMAL&&s.push(P.o.NormalKind),i.UV1&&s.push(P.o.UVKind),i.UV2&&s.push(P.o.UV2Kind),i.VERTEXCOLOR&&s.push(P.o.ColorKind),i.TANGENT&&s.push(P.o.TangentKind),E.G.PrepareAttributesForInstances(s,i);const o="mrdlSliderBar",a=i.toString(),l=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Rim_Texture_","_Iridescence_Texture_"],h=new Array;E.G.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect(o,{attributes:s,uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:a,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),i,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,i){if(!i.materialDefines)return;const n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Bevel_Front_",this.bevelFront),this._activeEffect.setFloat("_Bevel_Front_Stretch_",this.bevelFrontStretch),this._activeEffect.setFloat("_Bevel_Back_",this.bevelBack),this._activeEffect.setFloat("_Bevel_Back_Stretch_",this.bevelBackStretch),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Bulge_Enabled_",this.bulgeEnabled?1:0),this._activeEffect.setFloat("_Bulge_Height_",this.bulgeHeight),this._activeEffect.setFloat("_Bulge_Radius_",this.bulgeRadius),this._activeEffect.setFloat("_Sun_Intensity_",this.sunIntensity),this._activeEffect.setFloat("_Sun_Theta_",this.sunTheta),this._activeEffect.setFloat("_Sun_Phi_",this.sunPhi),this._activeEffect.setFloat("_Indirect_Diffuse_",this.indirectDiffuse),this._activeEffect.setDirectColor4("_Albedo_",this.albedo),this._activeEffect.setFloat("_Specular_",this.specular),this._activeEffect.setFloat("_Shininess_",this.shininess),this._activeEffect.setFloat("_Sharpness_",this.sharpness),this._activeEffect.setFloat("_Subsurface_",this.subsurface),this._activeEffect.setDirectColor4("_Left_Color_",this.leftGradientColor),this._activeEffect.setDirectColor4("_Right_Color_",this.rightGradientColor),this._activeEffect.setFloat("_Reflection_",this.reflection),this._activeEffect.setFloat("_Front_Reflect_",this.frontReflect),this._activeEffect.setFloat("_Edge_Reflect_",this.edgeReflect),this._activeEffect.setFloat("_Power_",this.power),this._activeEffect.setDirectColor4("_Sky_Color_",this.skyColor),this._activeEffect.setDirectColor4("_Horizon_Color_",this.horizonColor),this._activeEffect.setDirectColor4("_Ground_Color_",this.groundColor),this._activeEffect.setFloat("_Horizon_Power_",this.horizonPower),this._activeEffect.setTexture("_Reflection_Map_",new d.x("",this.getScene())),this._activeEffect.setTexture("_Indirect_Environment_",new d.x("",this.getScene())),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",new d.x("",this.getScene())),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(t,this._activeEffect))}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(e){return x.p4.Clone((()=>new Ae(e,this.getScene())),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.MRDLSliderBarMaterial",e}getClassName(){return"MRDLSliderBarMaterial"}static Parse(e,t,i){return x.p4.Parse((()=>new Ae(e.name,t)),e,t,i)}}Ae.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",(0,S.gn)([(0,x.qC)()],Ae.prototype,"radius",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"bevelFront",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"bevelFrontStretch",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"bevelBack",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"bevelBackStretch",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"radiusTopLeft",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"radiusTopRight",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"radiusBottomLeft",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"radiusBottomRight",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"bulgeEnabled",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"bulgeHeight",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"bulgeRadius",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"sunIntensity",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"sunTheta",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"sunPhi",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"indirectDiffuse",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"albedo",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"specular",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"shininess",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"sharpness",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"subsurface",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"leftGradientColor",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"rightGradientColor",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"reflection",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"frontReflect",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"edgeReflect",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"power",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"skyColor",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"horizonColor",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"groundColor",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"horizonPower",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"width",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"fuzz",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"minFuzz",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"clipFade",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"hueShift",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"saturationShift",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"valueShift",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobPosition",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobIntensity",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobNearSize",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobFarSize",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobNearDistance",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobFarDistance",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobFadeLength",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobPulse",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobFade",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobPosition2",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobNearSize2",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobPulse2",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobFade2",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"blobTexture",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"leftIndexPosition",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"rightIndexPosition",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"leftIndexMiddlePosition",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"rightIndexMiddlePosition",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"decalScaleXY",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"decalFrontOnly",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"rimIntensity",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"rimHueShift",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"rimSaturationShift",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"rimValueShift",void 0),(0,S.gn)([(0,x.qC)()],Ae.prototype,"iridescenceIntensity",void 0),(0,I.H)("BABYLON.GUI.MRDLSliderBarMaterial",Ae);M.v.ShadersStore.mrdlSliderThumbPixelShader="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nuniform float _Radius_;\nuniform float _Bevel_Front_;\nuniform float _Bevel_Front_Stretch_;\nuniform float _Bevel_Back_;\nuniform float _Bevel_Back_Stretch_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform bool _Bulge_Enabled_;\nuniform float _Bulge_Height_;\nuniform float _Bulge_Radius_;\nuniform float _Sun_Intensity_;\nuniform float _Sun_Theta_;\nuniform float _Sun_Phi_;\nuniform float _Indirect_Diffuse_;\nuniform vec4 _Albedo_;\nuniform float _Specular_;\nuniform float _Shininess_;\nuniform float _Sharpness_;\nuniform float _Subsurface_;\nuniform vec4 _Left_Color_;\nuniform vec4 _Right_Color_;\nuniform float _Reflection_;\nuniform float _Front_Reflect_;\nuniform float _Edge_Reflect_;\nuniform float _Power_;\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\nuniform float _Width_;\nuniform float _Fuzz_;\nuniform float _Min_Fuzz_;\nuniform float _Clip_Fade_;\nuniform float _Hue_Shift_;\nuniform float _Saturation_Shift_;\nuniform float _Value_Shift_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Left_Index_Pos_;\nuniform vec3 _Right_Index_Pos_;\nuniform vec3 _Left_Index_Middle_Pos_;\nuniform vec3 _Right_Index_Middle_Pos_;\nuniform sampler2D _Decal_;\nuniform vec2 _Decal_Scale_XY_;\nuniform bool _Decal_Front_Only_;\nuniform float _Rim_Intensity_;\nuniform sampler2D _Rim_Texture_;\nuniform float _Rim_Hue_Shift_;\nuniform float _Rim_Saturation_Shift_;\nuniform float _Rim_Value_Shift_;\nuniform float _Iridescence_Intensity_;\nuniform sampler2D _Iridescence_Texture_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform vec4 Global_Left_Index_Middle_Position;\nuniform vec4 Global_Right_Index_Middle_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvoid Blob_Fragment_B180(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{\nfloat k1=dot(Blob_Info1.xy,Blob_Info1.xy);\nfloat k2=dot(Blob_Info2.xy,Blob_Info2.xy);\nvec3 closer=k10.0) {\nC=mix(H,S,k);\n} else {\nC=mix(H,G,k); \n}\nreturn C;\n}\nvoid Sky_Environment_B200(\nvec3 Normal,\nvec3 Reflected,\nvec4 Sky_Color,\nvec4 Horizon_Color,\nvec4 Ground_Color,\nfloat Horizon_Power,\nout vec4 Reflected_Color,\nout vec4 Indirect_Color)\n{\nReflected_Color=SampleEnv_Bid200(Reflected,Sky_Color,Horizon_Color,Ground_Color,Horizon_Power);\nIndirect_Color=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\n}\nvoid Min_Segment_Distance_B215(\nvec3 P0,\nvec3 P1,\nvec3 Q0,\nvec3 Q1,\nout vec3 NearP,\nout vec3 NearQ,\nout float Distance)\n{\nvec3 u=P1-P0;\nvec3 v=Q1-Q0;\nvec3 w=P0-Q0;\nfloat a=dot(u,u);\nfloat b=dot(u,v);\nfloat c=dot(v,v);\nfloat d=dot(u,w);\nfloat e=dot(v,w);\nfloat D=a*c-b*b;\nfloat sD=D;\nfloat tD=D;\nfloat sc,sN,tc,tN;\nif (D<0.00001) {\nsN=0.0;\nsD=1.0;\ntN=e;\ntD=c;\n} else {\nsN=(b*e-c*d);\ntN=(a*e-b*d);\nif (sN<0.0) {\nsN=0.0;\ntN=e;\ntD=c;\n} else if (sN>sD) {\nsN=sD;\ntN=e+b;\ntD=c;\n}\n}\nif (tN<0.0) {\ntN=0.0;\nif (-d<0.0) {\nsN=0.0;\n} else if (-d>a) {\nsN=sD;\n} else {\nsN=-d;\nsD=a;\n}\n} else if (tN>tD) {\ntN=tD;\nif ((-d+b)<0.0) {\nsN=0.0;\n} else if ((-d+b)>a) {\nsN=sD;\n} else {\nsN=(-d+b);\nsD=a;\n}\n}\nsc=abs(sN)<0.000001 ? 0.0 : sN/sD;\ntc=abs(tN)<0.000001 ? 0.0 : tN/tD;\nNearP=P0+sc*u;\nNearQ=Q0+tc*v;\nDistance=distance(NearP,NearQ);\n}\nvoid To_XYZ_B224(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Finger_Positions_B214(\nvec3 Left_Index_Pos,\nvec3 Right_Index_Pos,\nvec3 Left_Index_Middle_Pos,\nvec3 Right_Index_Middle_Pos,\nout vec3 Left_Index,\nout vec3 Right_Index,\nout vec3 Left_Index_Middle,\nout vec3 Right_Index_Middle)\n{\nLeft_Index= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Left_Index_Pos);\nRight_Index= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Right_Index_Pos);\nLeft_Index_Middle= (Use_Global_Left_Index ? Global_Left_Index_Middle_Position.xyz : Left_Index_Middle_Pos);\nRight_Index_Middle= (Use_Global_Right_Index ? Global_Right_Index_Middle_Position.xyz : Right_Index_Middle_Pos);\n}\nvoid VaryHSV_B258(\nvec3 HSV_In,\nfloat Hue_Shift,\nfloat Saturation_Shift,\nfloat Value_Shift,\nout vec3 HSV_Out)\n{\nHSV_Out=vec3(fract(HSV_In.x+Hue_Shift),clamp(HSV_In.y+Saturation_Shift,0.0,1.0),clamp(HSV_In.z+Value_Shift,0.0,1.0));\n}\nvoid Remap_Range_B264(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{\nOut=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));\n}\nvoid To_HSV_B225(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{\nvec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);\nvec4 p=Color.g0.0;\nResult=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);\nResult*=Radius;\n}\nvoid Conditional_Float_B186(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Greater_Than_B187(\nfloat Left,\nfloat Right,\nout bool Not_Greater_Than,\nout bool Greater_Than)\n{\nGreater_Than=Left>Right;\nNot_Greater_Than=!Greater_Than;\n}\nvoid Remap_Range_B255(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{\nOut=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));\n}\nvoid main()\n{\nvec2 XY_Q235;\nXY_Q235=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);\nvec3 Tangent_World_Q177;\nvec3 Tangent_World_N_Q177;\nfloat Tangent_Length_Q177;\nTangent_World_Q177=(world*vec4(vec3(1,0,0),0.0)).xyz;\nTangent_Length_Q177=length(Tangent_World_Q177);\nTangent_World_N_Q177=Tangent_World_Q177/Tangent_Length_Q177;\nvec3 Normal_World_Q210;\nvec3 Normal_World_N_Q210;\nfloat Normal_Length_Q210;\nObject_To_World_Dir_B210(vec3(0,0,1),Normal_World_Q210,Normal_World_N_Q210,Normal_Length_Q210);\nfloat X_Q228;\nfloat Y_Q228;\nfloat Z_Q228;\nTo_XYZ_B228(position,X_Q228,Y_Q228,Z_Q228);\nvec3 Nrm_World_Q176;\nNrm_World_Q176=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Binormal_World_Q178;\nvec3 Binormal_World_N_Q178;\nfloat Binormal_Length_Q178;\nObject_To_World_Dir_B178(vec3(0,1,0),Binormal_World_Q178,Binormal_World_N_Q178,Binormal_Length_Q178);\nfloat Anisotropy_Q179=Tangent_Length_Q177/Binormal_Length_Q178;\nfloat Result_Q219;\nPick_Radius_B219(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q219);\nfloat Anisotropy_Q203=Binormal_Length_Q178/Normal_Length_Q210;\nbool Not_Greater_Than_Q187;\nbool Greater_Than_Q187;\nGreater_Than_B187(Z_Q228,0.0,Not_Greater_Than_Q187,Greater_Than_Q187);\nvec4 Linear_Q251;\nLinear_Q251.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);\nLinear_Q251.a=_Left_Color_.a;\nvec4 Linear_Q252;\nLinear_Q252.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);\nLinear_Q252.a=_Right_Color_.a;\nvec3 Difference_Q211=vec3(0,0,0)-Normal_World_N_Q210;\nvec4 Out_Color_Q184=vec4(X_Q228,Y_Q228,Z_Q228,1);\nfloat Result_Q186;\nConditional_Float_B186(Greater_Than_Q187,_Bevel_Back_,_Bevel_Front_,Result_Q186);\nfloat Result_Q244;\nConditional_Float_B186(Greater_Than_Q187,_Bevel_Back_Stretch_,_Bevel_Front_Stretch_,Result_Q244);\nvec3 New_P_Q280;\nvec2 New_UV_Q280;\nfloat Radial_Gradient_Q280;\nvec3 Radial_Dir_Q280;\nvec3 New_Normal_Q280;\nMove_Verts_B280(Anisotropy_Q179,position,Result_Q219,Result_Q186,normal,Anisotropy_Q203,Result_Q244,New_P_Q280,New_UV_Q280,Radial_Gradient_Q280,Radial_Dir_Q280,New_Normal_Q280);\nfloat X_Q248;\nfloat Y_Q248;\nX_Q248=New_UV_Q280.x;\nY_Q248=New_UV_Q280.y;\nvec3 Pos_World_Q162;\nObject_To_World_Pos_B162(New_P_Q280,Pos_World_Q162);\nvec3 Nrm_World_Q182;\nObject_To_World_Normal_B182(New_Normal_Q280,Nrm_World_Q182);\nvec4 Blob_Info_Q173;\n#if BLOB_ENABLE\nBlob_Vertex_B173(Pos_World_Q162,Nrm_World_Q176,Tangent_World_N_Q177,Binormal_World_N_Q178,_Blob_Position_,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q173);\n#else\nBlob_Info_Q173=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q174;\n#if BLOB_ENABLE_2\nBlob_Vertex_B174(Pos_World_Q162,Nrm_World_Q176,Tangent_World_N_Q177,Binormal_World_N_Q178,_Blob_Position_2_,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q174);\n#else\nBlob_Info_Q174=vec4(0,0,0,0);\n#endif\nfloat Out_Q255;\nRemap_Range_B255(0.0,1.0,0.0,1.0,X_Q248,Out_Q255);\nfloat X_Q236;\nfloat Y_Q236;\nfloat Z_Q236;\nTo_XYZ_B228(Nrm_World_Q182,X_Q236,Y_Q236,Z_Q236);\nvec4 Color_At_T_Q247=mix(Linear_Q251,Linear_Q252,Out_Q255);\nfloat Minus_F_Q237=-Z_Q236;\nfloat R_Q249;\nfloat G_Q249;\nfloat B_Q249;\nfloat A_Q249;\nR_Q249=Color_At_T_Q247.r; G_Q249=Color_At_T_Q247.g; B_Q249=Color_At_T_Q247.b; A_Q249=Color_At_T_Q247.a;\nfloat ClampF_Q238=clamp(0.0,Minus_F_Q237,1.0);\nfloat Result_Q243;\nConditional_Float_B243(_Decal_Front_Only_,ClampF_Q238,1.0,Result_Q243);\nvec4 Vec4_Q239=vec4(Result_Q243,Radial_Gradient_Q280,G_Q249,B_Q249);\nvec3 Position=Pos_World_Q162;\nvec3 Normal=Nrm_World_Q182;\nvec2 UV=XY_Q235;\nvec3 Tangent=Tangent_World_N_Q177;\nvec3 Binormal=Difference_Q211;\nvec4 Color=Out_Color_Q184;\nvec4 Extra1=Vec4_Q239;\nvec4 Extra2=Blob_Info_Q173;\nvec4 Extra3=Blob_Info_Q174;\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvColor=Color;\nvExtra1=Extra1;\nvExtra2=Extra2;\nvExtra3=Extra3;\n}";class Ce extends T.H{constructor(){super(),this.SKY_ENABLED=!0,this.BLOB_ENABLE_2=!0,this.IRIDESCENCE_ENABLED=!0,this._needNormals=!0,this._needUVs=!0,this.rebuild()}}class Se extends R.a{constructor(e,t){super(e,t),this.radius=.157,this.bevelFront=.065,this.bevelFrontStretch=.077,this.bevelBack=.031,this.bevelBackStretch=0,this.radiusTopLeft=1,this.radiusTopRight=1,this.radiusBottomLeft=1,this.radiusBottomRight=1,this.bulgeEnabled=!1,this.bulgeHeight=-.323,this.bulgeRadius=.73,this.sunIntensity=2,this.sunTheta=.937,this.sunPhi=.555,this.indirectDiffuse=1,this.albedo=new g.HE(.0117647,.505882,.996078,1),this.specular=0,this.shininess=10,this.sharpness=0,this.subsurface=.31,this.leftGradientColor=new g.HE(.0117647,.505882,.996078,1),this.rightGradientColor=new g.HE(.0117647,.505882,.996078,1),this.reflection=.749,this.frontReflect=0,this.edgeReflect=.09,this.power=8.1,this.skyColor=new g.HE(.0117647,.960784,.996078,1),this.horizonColor=new g.HE(.0117647,.333333,.996078,1),this.groundColor=new g.HE(0,.254902,.996078,1),this.horizonPower=1,this.width=.02,this.fuzz=.5,this.minFuzz=.001,this.clipFade=.01,this.hueShift=0,this.saturationShift=0,this.valueShift=0,this.blobPosition=new a.P(0,0,.1),this.blobIntensity=.5,this.blobNearSize=.01,this.blobFarSize=.03,this.blobNearDistance=0,this.blobFarDistance=.08,this.blobFadeLength=.576,this.blobPulse=0,this.blobFade=1,this.blobPosition2=new a.P(.2,0,.1),this.blobNearSize2=.01,this.blobPulse2=0,this.blobFade2=1,this.blobTexture=new d.x("",this.getScene()),this.leftIndexPosition=new a.P(0,0,1),this.rightIndexPosition=new a.P(-1,-1,-1),this.leftIndexMiddlePosition=new a.P(0,0,0),this.rightIndexMiddlePosition=new a.P(0,0,0),this.decalScaleXY=new a.FM(1.5,1.5),this.decalFrontOnly=!0,this.rimIntensity=.287,this.rimHueShift=0,this.rimSaturationShift=0,this.rimValueShift=-1,this.iridescenceIntensity=0,this.useGlobalLeftIndex=1,this.useGlobalRightIndex=1,this.globalLeftIndexTipProximity=0,this.globalRightIndexTipProximity=0,this.globalLeftIndexTipPosition=new a.Lt(.5,0,-.55,1),this.globaRightIndexTipPosition=new a.Lt(0,0,0,1),this.globalLeftThumbTipPosition=new a.Lt(.5,0,-.55,1),this.globalRightThumbTipPosition=new a.Lt(0,0,0,1),this.globalLeftIndexMiddlePosition=new a.Lt(.5,0,-.55,1),this.globalRightIndexMiddlePosition=new a.Lt(0,0,0,1),this.alphaMode=N.g.ALPHA_DISABLE,this.backFaceCulling=!1,this._blueGradientTexture=new d.x(Se.BLUE_GRADIENT_TEXTURE_URL,t,!0,!1,d.x.NEAREST_SAMPLINGMODE)}needAlphaBlending(){return!1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new Ce);const i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;const r=n.getEngine();if(E.G.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty){i.markAsProcessed(),n.resetCachedMaterial();const e=new B.L;i.FOG&&e.addFallback(1,"FOG"),E.G.HandleFallbacksForShadows(i,e),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess;const s=[P.o.PositionKind];i.NORMAL&&s.push(P.o.NormalKind),i.UV1&&s.push(P.o.UVKind),i.UV2&&s.push(P.o.UV2Kind),i.VERTEXCOLOR&&s.push(P.o.ColorKind),i.TANGENT&&s.push(P.o.TangentKind),E.G.PrepareAttributesForInstances(s,i);const o="mrdlSliderThumb",a=i.toString(),l=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],c=["_Rim_Texture_","_Iridescence_Texture_"],h=new Array;E.G.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect(o,{attributes:s,uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:a,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),i)}return!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,i){if(!i.materialDefines)return;const n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Bevel_Front_",this.bevelFront),this._activeEffect.setFloat("_Bevel_Front_Stretch_",this.bevelFrontStretch),this._activeEffect.setFloat("_Bevel_Back_",this.bevelBack),this._activeEffect.setFloat("_Bevel_Back_Stretch_",this.bevelBackStretch),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Bulge_Enabled_",this.bulgeEnabled?1:0),this._activeEffect.setFloat("_Bulge_Height_",this.bulgeHeight),this._activeEffect.setFloat("_Bulge_Radius_",this.bulgeRadius),this._activeEffect.setFloat("_Sun_Intensity_",this.sunIntensity),this._activeEffect.setFloat("_Sun_Theta_",this.sunTheta),this._activeEffect.setFloat("_Sun_Phi_",this.sunPhi),this._activeEffect.setFloat("_Indirect_Diffuse_",this.indirectDiffuse),this._activeEffect.setDirectColor4("_Albedo_",this.albedo),this._activeEffect.setFloat("_Specular_",this.specular),this._activeEffect.setFloat("_Shininess_",this.shininess),this._activeEffect.setFloat("_Sharpness_",this.sharpness),this._activeEffect.setFloat("_Subsurface_",this.subsurface),this._activeEffect.setDirectColor4("_Left_Color_",this.leftGradientColor),this._activeEffect.setDirectColor4("_Right_Color_",this.rightGradientColor),this._activeEffect.setFloat("_Reflection_",this.reflection),this._activeEffect.setFloat("_Front_Reflect_",this.frontReflect),this._activeEffect.setFloat("_Edge_Reflect_",this.edgeReflect),this._activeEffect.setFloat("_Power_",this.power),this._activeEffect.setDirectColor4("_Sky_Color_",this.skyColor),this._activeEffect.setDirectColor4("_Horizon_Color_",this.horizonColor),this._activeEffect.setDirectColor4("_Ground_Color_",this.groundColor),this._activeEffect.setFloat("_Horizon_Power_",this.horizonPower),this._activeEffect.setTexture("_Reflection_Map_",new d.x("",this.getScene())),this._activeEffect.setTexture("_Indirect_Environment_",new d.x("",this.getScene())),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",new d.x("",this.getScene())),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(t,this._activeEffect))}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(e){return x.p4.Clone((()=>new Se(e,this.getScene())),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.MRDLSliderThumbMaterial",e}getClassName(){return"MRDLSliderThumbMaterial"}static Parse(e,t,i){return x.p4.Parse((()=>new Se(e.name,t)),e,t,i)}}Se.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",(0,S.gn)([(0,x.qC)()],Se.prototype,"radius",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"bevelFront",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"bevelFrontStretch",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"bevelBack",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"bevelBackStretch",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"radiusTopLeft",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"radiusTopRight",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"radiusBottomLeft",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"radiusBottomRight",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"bulgeEnabled",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"bulgeHeight",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"bulgeRadius",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"sunIntensity",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"sunTheta",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"sunPhi",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"indirectDiffuse",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"albedo",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"specular",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"shininess",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"sharpness",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"subsurface",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"leftGradientColor",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"rightGradientColor",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"reflection",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"frontReflect",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"edgeReflect",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"power",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"skyColor",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"horizonColor",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"groundColor",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"horizonPower",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"width",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"fuzz",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"minFuzz",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"clipFade",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"hueShift",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"saturationShift",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"valueShift",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobPosition",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobIntensity",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobNearSize",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobFarSize",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobNearDistance",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobFarDistance",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobFadeLength",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobPulse",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobFade",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobPosition2",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobNearSize2",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobPulse2",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobFade2",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"blobTexture",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"leftIndexPosition",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"rightIndexPosition",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"leftIndexMiddlePosition",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"rightIndexMiddlePosition",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"decalScaleXY",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"decalFrontOnly",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"rimIntensity",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"rimHueShift",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"rimSaturationShift",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"rimValueShift",void 0),(0,S.gn)([(0,x.qC)()],Se.prototype,"iridescenceIntensity",void 0),(0,I.H)("BABYLON.GUI.MRDLSliderThumbMaterial",Se);M.v.ShadersStore.mrdlBackplatePixelShader="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Filter_Width_;\nuniform vec4 _Base_Color_;\nuniform vec4 _Line_Color_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform float _Rate_;\nuniform vec4 _Highlight_Color_;\nuniform float _Highlight_Width_;\nuniform vec4 _Highlight_Transform_;\nuniform float _Highlight_;\nuniform float _Iridescence_Intensity_;\nuniform float _Iridescence_Edge_Intensity_;\nuniform vec4 _Iridescence_Tint_;\nuniform sampler2D _Iridescent_Map_;\nuniform float _Angle_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform vec4 _Gradient_Color_;\nuniform vec4 _Top_Left_;\nuniform vec4 _Top_Right_;\nuniform vec4 _Bottom_Left_;\nuniform vec4 _Bottom_Right_;\nuniform float _Edge_Width_;\nuniform float _Edge_Power_;\nuniform float _Line_Gradient_Blend_;\nuniform float _Fade_Out_;\nvoid FastLinearTosRGB_B353(\nvec4 Linear,\nout vec4 sRGB)\n{\nsRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));\nsRGB.a=Linear.a;\n}\nvoid Round_Rect_Fragment_B332(\nfloat Radius,\nfloat Line_Width,\nvec4 Line_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Line_Visibility,\nvec4 Rect_Parms,\nvec4 Fill_Color,\nout vec4 Color)\n{\nfloat d=length(max(abs(UV)-Rect_Parms.xy,0.0));\nfloat dx=max(fwidth(d)*Filter_Width,0.00001);\nfloat g=min(Rect_Parms.z,Rect_Parms.w);\nfloat dgrad=max(fwidth(g)*Filter_Width,0.00001);\nfloat Inside_Rect=clamp(g/dgrad,0.0,1.0);\nfloat inner=clamp((d+dx*0.5-max(Radius-Line_Width,d-dx*0.5))/dx,0.0,1.0);\nColor=clamp(mix(Fill_Color,Line_Color,inner),0.0,1.0)*Inside_Rect;\n}\nvoid Iridescence_B343(\nvec3 Position,\nvec3 Normal,\nvec2 UV,\nvec3 Axis,\nvec3 Eye,\nvec4 Tint,\nsampler2D Texture,\nbool Reflected,\nfloat Frequency,\nfloat Vertical_Offset,\nout vec4 Color)\n{\nvec3 i=normalize(Position-Eye);\nvec3 r=reflect(i,Normal);\nfloat idota=dot(i,Axis);\nfloat idotr=dot(i,r);\nfloat x=Reflected ? idotr : idota;\nvec2 xy;\nxy.x=fract((x*Frequency+1.0)*0.5+UV.y*Vertical_Offset);\nxy.y=0.5;\nColor=texture(Texture,xy);\nColor.rgb*=Tint.rgb;\n}\nvoid Scale_RGB_B346(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Scale_RGB_B344(\nfloat Scalar,\nvec4 Color,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Line_Fragment_B362(\nvec4 Base_Color,\nvec4 Highlight_Color,\nfloat Highlight_Width,\nvec3 Line_Vertex,\nfloat Highlight,\nout vec4 Line_Color)\n{\nfloat k2=1.0-clamp(abs(Line_Vertex.y/Highlight_Width),0.0,1.0);\nLine_Color=mix(Base_Color,Highlight_Color,Highlight*k2);\n}\nvoid Edge_B356(\nvec4 RectParms,\nfloat Radius,\nfloat Line_Width,\nvec2 UV,\nfloat Edge_Width,\nfloat Edge_Power,\nout float Result)\n{\nfloat d=length(max(abs(UV)-RectParms.xy,0.0));\nfloat edge=1.0-clamp((1.0-d/(Radius-Line_Width))/Edge_Width,0.0,1.0);\nResult=pow(edge,Edge_Power);\n}\nvoid Gradient_B355(\nvec4 Gradient_Color,\nvec4 Top_Left,\nvec4 Top_Right,\nvec4 Bottom_Left,\nvec4 Bottom_Right,\nvec2 UV,\nout vec4 Result)\n{\nvec3 top=Top_Left.rgb+(Top_Right.rgb-Top_Left.rgb)*UV.x;\nvec3 bottom=Bottom_Left.rgb+(Bottom_Right.rgb-Bottom_Left.rgb)*UV.x;\nResult.rgb=Gradient_Color.rgb*(bottom+(top-bottom)*UV.y);\nResult.a=1.0;\n}\nvoid main()\n{\nfloat X_Q338;\nfloat Y_Q338;\nfloat Z_Q338;\nfloat W_Q338;\nX_Q338=vExtra2.x;\nY_Q338=vExtra2.y;\nZ_Q338=vExtra2.z;\nW_Q338=vExtra2.w;\nvec4 Color_Q343;\n#if IRIDESCENCE_ENABLE\nIridescence_B343(vPosition,vNormal,vUV,vBinormal,cameraPosition,_Iridescence_Tint_,_Iridescent_Map_,_Reflected_,_Frequency_,_Vertical_Offset_,Color_Q343);\n#else\nColor_Q343=vec4(0,0,0,0);\n#endif\nvec4 Result_Q344;\nScale_RGB_B344(_Iridescence_Intensity_,Color_Q343,Result_Q344);\nvec4 Line_Color_Q362;\nLine_Fragment_B362(_Line_Color_,_Highlight_Color_,_Highlight_Width_,vTangent,_Highlight_,Line_Color_Q362);\nfloat Result_Q356;\n#if EDGE_ONLY\nEdge_B356(vExtra1,Z_Q338,W_Q338,vUV,_Edge_Width_,_Edge_Power_,Result_Q356);\n#else\nResult_Q356=1.0;\n#endif\nvec2 Vec2_Q339=vec2(X_Q338,Y_Q338);\nvec4 Result_Q355;\nGradient_B355(_Gradient_Color_,_Top_Left_,_Top_Right_,_Bottom_Left_,_Bottom_Right_,Vec2_Q339,Result_Q355);\nvec4 Linear_Q348;\nLinear_Q348.rgb=clamp(Result_Q355.rgb*Result_Q355.rgb,0.0,1.0);\nLinear_Q348.a=Result_Q355.a;\nvec4 Result_Q346;\nScale_RGB_B346(Linear_Q348,Result_Q356,Result_Q346);\nvec4 Sum_Q345=Result_Q346+Result_Q344;\nvec4 Color_At_T_Q347=mix(Line_Color_Q362,Result_Q346,_Line_Gradient_Blend_);\nvec4 Base_And_Iridescent_Q350;\nBase_And_Iridescent_Q350=_Base_Color_+vec4(Sum_Q345.rgb,0.0);\nvec4 Sum_Q349=Color_At_T_Q347+_Iridescence_Edge_Intensity_*Color_Q343;\nvec4 Result_Q351=Sum_Q349; Result_Q351.a=1.0;\nvec4 Color_Q332;\nRound_Rect_Fragment_B332(Z_Q338,W_Q338,Result_Q351,_Filter_Width_,vUV,1.0,vExtra1,Base_And_Iridescent_Q350,Color_Q332);\nvec4 Result_Q354=_Fade_Out_*Color_Q332;\nvec4 sRGB_Q353;\nFastLinearTosRGB_B353(Result_Q354,sRGB_Q353);\nvec4 Out_Color=sRGB_Q353;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";M.v.ShadersStore.mrdlBackplateVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 tangent;\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Filter_Width_;\nuniform vec4 _Base_Color_;\nuniform vec4 _Line_Color_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform float _Rate_;\nuniform vec4 _Highlight_Color_;\nuniform float _Highlight_Width_;\nuniform vec4 _Highlight_Transform_;\nuniform float _Highlight_;\nuniform float _Iridescence_Intensity_;\nuniform float _Iridescence_Edge_Intensity_;\nuniform vec4 _Iridescence_Tint_;\nuniform sampler2D _Iridescent_Map_;\nuniform float _Angle_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform vec4 _Gradient_Color_;\nuniform vec4 _Top_Left_;\nuniform vec4 _Top_Right_;\nuniform vec4 _Bottom_Left_;\nuniform vec4 _Bottom_Right_;\nuniform float _Edge_Width_;\nuniform float _Edge_Power_;\nuniform float _Line_Gradient_Blend_;\nuniform float _Fade_Out_;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvoid Object_To_World_Pos_B314(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Round_Rect_Vertex_B357(\nvec2 UV,\nfloat Radius,\nfloat Margin,\nfloat Anisotropy,\nfloat Gradient1,\nfloat Gradient2,\nvec3 Normal,\nvec4 Color_Scale_Translate,\nout vec2 Rect_UV,\nout vec4 Rect_Parms,\nout vec2 Scale_XY,\nout vec2 Line_UV,\nout vec2 Color_UV_Info)\n{\nScale_XY=vec2(Anisotropy,1.0);\nLine_UV=(UV-vec2(0.5,0.5));\nRect_UV=Line_UV*Scale_XY;\nRect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius)-vec2(Margin,Margin);\nRect_Parms.z=Gradient1; \nRect_Parms.w=Gradient2;\nColor_UV_Info=(Line_UV+vec2(0.5,0.5))*Color_Scale_Translate.xy+Color_Scale_Translate.zw;\n}\nvoid Line_Vertex_B333(\nvec2 Scale_XY,\nvec2 UV,\nfloat Time,\nfloat Rate,\nvec4 Highlight_Transform,\nout vec3 Line_Vertex)\n{\nfloat angle2=(Rate*Time)*2.0*3.1416;\nfloat sinAngle2=sin(angle2);\nfloat cosAngle2=cos(angle2);\nvec2 xformUV=UV*Highlight_Transform.xy+Highlight_Transform.zw;\nLine_Vertex.x=0.0;\nLine_Vertex.y=cosAngle2*xformUV.x-sinAngle2*xformUV.y;\nLine_Vertex.z=0.0; \n}\nvoid PickDir_B334(\nfloat Degrees,\nvec3 DirX,\nvec3 DirY,\nout vec3 Dir)\n{\nfloat a=Degrees*3.14159/180.0;\nDir=cos(a)*DirX+sin(a)*DirY;\n}\nvoid Move_Verts_B327(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir)\n{\nvec2 UV=P.xy*2.0+0.5;\nvec2 center=clamp(UV,0.0,1.0);\nvec2 delta=UV-center;\nvec2 r2=2.0*vec2(Radius/Anisotropy,Radius);\nNew_UV=center+r2*(UV-2.0*center+0.5);\nNew_P=vec3(New_UV-0.5,P.z);\nRadial_Gradient=1.0-length(delta)*2.0;\nRadial_Dir=vec3(delta*r2,0.0);\n}\nvoid Pick_Radius_B336(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{\nbool whichY=Position.y>0.0;\nResult=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);\nResult*=Radius;\n}\nvoid Edge_AA_Vertex_B328(\nvec3 Position_World,\nvec3 Position_Object,\nvec3 Normal_Object,\nvec3 Eye,\nfloat Radial_Gradient,\nvec3 Radial_Dir,\nvec3 Tangent,\nout float Gradient1,\nout float Gradient2)\n{\nvec3 I=(Eye-Position_World);\nvec3 T=(vec4(Tangent,0.0)).xyz;\nfloat g=(dot(T,I)<0.0) ? 0.0 : 1.0;\nif (Normal_Object.z==0.0) { \nGradient1=Position_Object.z>0.0 ? g : 1.0;\nGradient2=Position_Object.z>0.0 ? 1.0 : g;\n} else {\nGradient1=g+(1.0-g)*(Radial_Gradient);\nGradient2=1.0;\n}\n}\nvoid Object_To_World_Dir_B330(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{\nBinormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nBinormal_Length=length(Binormal_World);\nBinormal_World_N=Binormal_World/Binormal_Length;\n}\nvoid RelativeOrAbsoluteDetail_B341(\nfloat Nominal_Radius,\nfloat Nominal_LineWidth,\nbool Absolute_Measurements,\nfloat Height,\nout float Radius,\nout float Line_Width)\n{\nfloat scale=Absolute_Measurements ? 1.0/Height : 1.0;\nRadius=Nominal_Radius*scale;\nLine_Width=Nominal_LineWidth*scale;\n}\nvoid main()\n{\nvec3 Nrm_World_Q326;\nNrm_World_Q326=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Tangent_World_Q329;\nvec3 Tangent_World_N_Q329;\nfloat Tangent_Length_Q329;\nTangent_World_Q329=(world*vec4(vec3(1,0,0),0.0)).xyz;\nTangent_Length_Q329=length(Tangent_World_Q329);\nTangent_World_N_Q329=Tangent_World_Q329/Tangent_Length_Q329;\nvec3 Binormal_World_Q330;\nvec3 Binormal_World_N_Q330;\nfloat Binormal_Length_Q330;\nObject_To_World_Dir_B330(vec3(0,1,0),Binormal_World_Q330,Binormal_World_N_Q330,Binormal_Length_Q330);\nfloat Radius_Q341;\nfloat Line_Width_Q341;\nRelativeOrAbsoluteDetail_B341(_Radius_,_Line_Width_,_Absolute_Sizes_,Binormal_Length_Q330,Radius_Q341,Line_Width_Q341);\nvec3 Dir_Q334;\nPickDir_B334(_Angle_,Tangent_World_N_Q329,Binormal_World_N_Q330,Dir_Q334);\nfloat Result_Q336;\nPick_Radius_B336(Radius_Q341,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q336);\nfloat Anisotropy_Q331=Tangent_Length_Q329/Binormal_Length_Q330;\nvec4 Out_Color_Q337=vec4(Result_Q336,Line_Width_Q341,0,1);\nvec3 New_P_Q327;\nvec2 New_UV_Q327;\nfloat Radial_Gradient_Q327;\nvec3 Radial_Dir_Q327;\nMove_Verts_B327(Anisotropy_Q331,position,Result_Q336,New_P_Q327,New_UV_Q327,Radial_Gradient_Q327,Radial_Dir_Q327);\nvec3 Pos_World_Q314;\nObject_To_World_Pos_B314(New_P_Q327,Pos_World_Q314);\nfloat Gradient1_Q328;\nfloat Gradient2_Q328;\n#if SMOOTH_EDGES\nEdge_AA_Vertex_B328(Pos_World_Q314,position,normal,cameraPosition,Radial_Gradient_Q327,Radial_Dir_Q327,tangent,Gradient1_Q328,Gradient2_Q328);\n#else\nGradient1_Q328=1.0;\nGradient2_Q328=1.0;\n#endif\nvec2 Rect_UV_Q357;\nvec4 Rect_Parms_Q357;\nvec2 Scale_XY_Q357;\nvec2 Line_UV_Q357;\nvec2 Color_UV_Info_Q357;\nRound_Rect_Vertex_B357(New_UV_Q327,Result_Q336,0.0,Anisotropy_Q331,Gradient1_Q328,Gradient2_Q328,normal,vec4(1,1,0,0),Rect_UV_Q357,Rect_Parms_Q357,Scale_XY_Q357,Line_UV_Q357,Color_UV_Info_Q357);\nvec3 Line_Vertex_Q333;\nLine_Vertex_B333(Scale_XY_Q357,Line_UV_Q357,(20.0),_Rate_,_Highlight_Transform_,Line_Vertex_Q333);\nfloat X_Q359;\nfloat Y_Q359;\nX_Q359=Color_UV_Info_Q357.x;\nY_Q359=Color_UV_Info_Q357.y;\nvec4 Vec4_Q358=vec4(X_Q359,Y_Q359,Result_Q336,Line_Width_Q341);\nvec3 Position=Pos_World_Q314;\nvec3 Normal=Nrm_World_Q326;\nvec2 UV=Rect_UV_Q357;\nvec3 Tangent=Line_Vertex_Q333;\nvec3 Binormal=Dir_Q334;\nvec4 Color=Out_Color_Q337;\nvec4 Extra1=Rect_Parms_Q357;\nvec4 Extra2=Vec4_Q358;\nvec4 Extra3=vec4(0,0,0,0);\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvExtra1=Extra1;\nvExtra2=Extra2;\n}";class xe extends T.H{constructor(){super(),this.IRIDESCENCE_ENABLE=!0,this.SMOOTH_EDGES=!0,this._needNormals=!0,this.rebuild()}}class Te extends R.a{constructor(e,t){super(e,t),this.radius=.3,this.lineWidth=.003,this.absoluteSizes=!1,this._filterWidth=1,this.baseColor=new g.HE(0,0,0,1),this.lineColor=new g.HE(.2,.262745,.4,1),this.radiusTopLeft=1,this.radiusTopRight=1,this.radiusBottomLeft=1,this.radiusBottomRight=1,this._rate=0,this.highlightColor=new g.HE(.239216,.435294,.827451,1),this.highlightWidth=0,this._highlightTransform=new a.Lt(1,1,0,0),this._highlight=1,this.iridescenceIntensity=.45,this.iridescenceEdgeIntensity=1,this.iridescenceTint=new g.HE(1,1,1,1),this._angle=-45,this.fadeOut=1,this._reflected=!0,this._frequency=1,this._verticalOffset=0,this.gradientColor=new g.HE(.74902,.74902,.74902,1),this.topLeftGradientColor=new g.HE(.00784314,.294118,.580392,1),this.topRightGradientColor=new g.HE(.305882,0,1,1),this.bottomLeftGradientColor=new g.HE(.133333,.258824,.992157,1),this.bottomRightGradientColor=new g.HE(.176471,.176471,.619608,1),this.edgeWidth=.5,this.edgePower=1,this.edgeLineGradientBlend=.5,this.alphaMode=N.g.ALPHA_DISABLE,this.backFaceCulling=!1,this._iridescentMapTexture=new d.x(Te.IRIDESCENT_MAP_TEXTURE_URL,this.getScene(),!0,!1,d.x.NEAREST_SAMPLINGMODE)}needAlphaBlending(){return!1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new xe);const i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;const r=n.getEngine();if(E.G.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty){i.markAsProcessed(),n.resetCachedMaterial();const e=new B.L;i.FOG&&e.addFallback(1,"FOG"),E.G.HandleFallbacksForShadows(i,e),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess;const s=[P.o.PositionKind];i.NORMAL&&s.push(P.o.NormalKind),i.UV1&&s.push(P.o.UVKind),i.UV2&&s.push(P.o.UV2Kind),i.VERTEXCOLOR&&s.push(P.o.ColorKind),i.TANGENT&&s.push(P.o.TangentKind),E.G.PrepareAttributesForInstances(s,i);const o="mrdlBackplate",a=i.toString(),l=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Iridescence_Tint_","_Iridescent_Map_","_Angle_","_Reflected_","_Frequency_","_Vertical_Offset_","_Gradient_Color_","_Top_Left_","_Top_Right_","_Bottom_Left_","_Bottom_Right_","_Edge_Width_","_Edge_Power_","_Line_Gradient_Blend_","_Fade_Out_"],c=["_Iridescent_Map_"],h=new Array;E.G.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect(o,{attributes:s,uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:a,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),i)}return!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,i){if(!i.materialDefines)return;const n=i.effect;n&&(this._activeEffect=n,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Base_Color_",this.baseColor),this._activeEffect.setDirectColor4("_Line_Color_",this.lineColor),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Rate_",this._rate),this._activeEffect.setDirectColor4("_Highlight_Color_",this.highlightColor),this._activeEffect.setFloat("_Highlight_Width_",this.highlightWidth),this._activeEffect.setVector4("_Highlight_Transform_",this._highlightTransform),this._activeEffect.setFloat("_Highlight_",this._highlight),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setFloat("_Iridescence_Edge_Intensity_",this.iridescenceEdgeIntensity),this._activeEffect.setDirectColor4("_Iridescence_Tint_",this.iridescenceTint),this._activeEffect.setTexture("_Iridescent_Map_",this._iridescentMapTexture),this._activeEffect.setFloat("_Angle_",this._angle),this._activeEffect.setFloat("_Reflected_",this._reflected?1:0),this._activeEffect.setFloat("_Frequency_",this._frequency),this._activeEffect.setFloat("_Vertical_Offset_",this._verticalOffset),this._activeEffect.setDirectColor4("_Gradient_Color_",this.gradientColor),this._activeEffect.setDirectColor4("_Top_Left_",this.topLeftGradientColor),this._activeEffect.setDirectColor4("_Top_Right_",this.topRightGradientColor),this._activeEffect.setDirectColor4("_Bottom_Left_",this.bottomLeftGradientColor),this._activeEffect.setDirectColor4("_Bottom_Right_",this.bottomRightGradientColor),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setFloat("_Edge_Power_",this.edgePower),this._activeEffect.setFloat("_Line_Gradient_Blend_",this.edgeLineGradientBlend),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._afterBind(t,this._activeEffect))}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(e){return x.p4.Clone((()=>new Te(e,this.getScene())),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.MRDLBackplateMaterial",e}getClassName(){return"MRDLBackplateMaterial"}static Parse(e,t,i){return x.p4.Parse((()=>new Te(e.name,t)),e,t,i)}}Te.IRIDESCENT_MAP_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-backplate-iridescence.png",(0,S.gn)([(0,x.qC)()],Te.prototype,"radius",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"lineWidth",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"absoluteSizes",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"baseColor",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"lineColor",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"radiusTopLeft",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"radiusTopRight",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"radiusBottomLeft",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"radiusBottomRight",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"highlightColor",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"highlightWidth",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"iridescenceIntensity",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"iridescenceEdgeIntensity",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"iridescenceTint",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"fadeOut",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"gradientColor",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"topLeftGradientColor",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"topRightGradientColor",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"bottomLeftGradientColor",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"bottomRightGradientColor",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"edgeWidth",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"edgePower",void 0),(0,S.gn)([(0,x.qC)()],Te.prototype,"edgeLineGradientBlend",void 0),(0,I.H)("BABYLON.GUI.MRDLBackplateMaterial",Te);class Ee extends _{constructor(e,t){super(e),this.onValueChangedObservable=new o.y$,this._sliderBackplateVisible=t||!1,this._minimum=0,this._maximum=100,this._step=0,this._value=50}get mesh(){return this.node?this._sliderThumb:null}get minimum(){return this._minimum}set minimum(e){this._minimum!==e&&(this._minimum=Math.max(e,0),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))}get maximum(){return this._maximum}set maximum(e){this._maximum!==e&&(this._maximum=Math.max(e,this._minimum),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))}get step(){return this._step}set step(e){this._step!==e&&(this._step=Math.max(Math.min(e,this._maximum-this._minimum),0))}get value(){return this._value}set value(e){this._value!==e&&(this._value=Math.max(Math.min(e,this._maximum),this._minimum),this._sliderThumb&&(this._sliderThumb.position.x=this._convertToPosition(this.value)),this.onValueChangedObservable.notifyObservers(this._value))}get start(){return this.node?this._sliderBar.position.x-this._sliderBar.scaling.x/2:-.5}get end(){return this.node?this._sliderBar.position.x+this._sliderBar.scaling.x/2:.5}get sliderBarMaterial(){return this._sliderBarMaterial}get sliderThumbMaterial(){return this._sliderThumbMaterial}get sliderBackplateMaterial(){return this._sliderBackplateMaterial}set isVisible(e){var t;this._isVisible!==e&&(this._isVisible=e,null===(t=this.node)||void 0===t||t.setEnabled(e))}_createNode(e){const t=(0,f.NR)(`${this.name}_sliderbackplate`,{width:1,height:1,depth:1},e);return t.isPickable=!1,t.visibility=0,t.scaling=new a.P(1,.5,.8),V.n.ImportMeshAsync(void 0,Ee.MODEL_BASE_URL,Ee.MODEL_FILENAME,e).then((e=>{const i=e.meshes[1],n=e.meshes[1].clone(`${this.name}_sliderbar`,t),r=e.meshes[1].clone(`${this.name}_sliderthumb`,t);i.visibility=0,this._sliderBackplateVisible&&(i.visibility=1,i.name=`${this.name}_sliderbackplate`,i.isPickable=!1,i.scaling.x=1,i.scaling.z=.2,i.parent=t,this._sliderBackplateMaterial&&(i.material=this._sliderBackplateMaterial),this._sliderBackplate=i),n&&(n.parent=t,n.position.z=-.1,n.scaling=new a.P(.8,.04,.3),n.isPickable=!1,this._sliderBarMaterial&&(n.material=this._sliderBarMaterial),this._sliderBar=n),r&&(r.parent=t,r.isPickable=!0,r.position.z=-.115,r.scaling=new a.P(.025,.3,.6),r.position.x=this._convertToPosition(this.value),r.addBehavior(this._createBehavior()),this._sliderThumbMaterial&&(r.material=this._sliderThumbMaterial),this._sliderThumb=r),this._injectGUI3DReservedDataStore(t).control=this,t.getChildMeshes().forEach((e=>{this._injectGUI3DReservedDataStore(e).control=this}))})),this._affectMaterial(t),t}_affectMaterial(e){var t,i,n;this._sliderBackplateMaterial=null!==(t=this._sliderBackplateMaterial)&&void 0!==t?t:new Te(`${this.name}_sliderbackplate_material`,e.getScene()),this._sliderBarMaterial=null!==(i=this._sliderBarMaterial)&&void 0!==i?i:new Ae(`${this.name}_sliderbar_material`,e.getScene()),this._sliderThumbMaterial=null!==(n=this._sliderThumbMaterial)&&void 0!==n?n:new Se(`${this.name}_sliderthumb_material`,e.getScene())}_createBehavior(){const e=new pe.M({dragAxis:a.P.Right()});return e.moveAttached=!1,e.onDragStartObservable.add((()=>{this._draggedPosition=this._sliderThumb.position.x})),e.onDragObservable.add((e=>{this._draggedPosition+=e.dragDistance/this.scaling.x,this.value=this._convertToValue(this._draggedPosition)})),e}_convertToPosition(e){const t=(e-this.minimum)/(this.maximum-this.minimum)*(this.end-this.start)+this.start;return Math.min(Math.max(t,this.start),this.end)}_convertToValue(e){let t=(e-this.start)/(this.end-this.start)*(this.maximum-this.minimum);return t=this.step?Math.round(t/this.step)*this.step:t,Math.max(Math.min(this.minimum+t,this._maximum),this._minimum)}dispose(){var e,t,i,n,r,s;super.dispose(),null===(e=this._sliderBar)||void 0===e||e.dispose(),null===(t=this._sliderThumb)||void 0===t||t.dispose(),null===(i=this._sliderBarMaterial)||void 0===i||i.dispose(),null===(n=this._sliderThumbMaterial)||void 0===n||n.dispose(),null===(r=this._sliderBackplate)||void 0===r||r.dispose(),null===(s=this._sliderBackplateMaterial)||void 0===s||s.dispose()}}Ee.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",Ee.MODEL_FILENAME="mrtk-fluent-backplate.glb";var Re=i("../../../node_modules/@babylonjs/core/Animations/animation.js"),Pe=i("../../../node_modules/@babylonjs/core/Animations/animationGroup.js"),Ie=i("../../../node_modules/@babylonjs/gui/2D/controls/grid.js");M.v.ShadersStore.mrdlBackglowPixelShader="uniform vec3 cameraPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nuniform float _Bevel_Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Tuning_Motion_;\nuniform float _Motion_;\nuniform float _Max_Intensity_;\nuniform float _Intensity_Fade_In_Exponent_;\nuniform float _Outer_Fuzz_Start_;\nuniform float _Outer_Fuzz_End_;\nuniform vec4 _Color_;\nuniform vec4 _Inner_Color_;\nuniform float _Blend_Exponent_;\nuniform float _Falloff_;\nuniform float _Bias_;\nfloat BiasFunc(float b,float v) {\nreturn pow(v,log(clamp(b,0.001,0.999))/log(0.5));\n}\nvoid Fuzzy_Round_Rect_B33(\nfloat Size_X,\nfloat Size_Y,\nfloat Radius_X,\nfloat Radius_Y,\nfloat Line_Width,\nvec2 UV,\nfloat Outer_Fuzz,\nfloat Max_Outer_Fuzz,\nout float Rect_Distance,\nout float Inner_Distance)\n{\nvec2 halfSize=vec2(Size_X,Size_Y)*0.5;\nvec2 r=max(min(vec2(Radius_X,Radius_Y),halfSize),vec2(0.001,0.001));\nfloat radius=min(r.x,r.y)-Max_Outer_Fuzz;\nvec2 v=abs(UV);\nvec2 nearestp=min(v,halfSize-r);\nfloat d=distance(nearestp,v);\nInner_Distance=clamp(1.0-(radius-d)/Line_Width,0.0,1.0);\nRect_Distance=clamp(1.0-(d-radius)/Outer_Fuzz,0.0,1.0)*Inner_Distance;\n}\nvoid main()\n{\nfloat X_Q42;\nfloat Y_Q42;\nX_Q42=vNormal.x;\nY_Q42=vNormal.y;\nfloat MaxAB_Q24=max(_Tuning_Motion_,_Motion_);\nfloat Sqrt_F_Q27=sqrt(MaxAB_Q24);\nfloat Power_Q43=pow(MaxAB_Q24,_Intensity_Fade_In_Exponent_);\nfloat Value_At_T_Q26=mix(_Outer_Fuzz_Start_,_Outer_Fuzz_End_,Sqrt_F_Q27);\nfloat Product_Q23=_Max_Intensity_*Power_Q43;\nfloat Rect_Distance_Q33;\nfloat Inner_Distance_Q33;\nFuzzy_Round_Rect_B33(X_Q42,Y_Q42,_Bevel_Radius_,_Bevel_Radius_,_Line_Width_,vUV,Value_At_T_Q26,_Outer_Fuzz_Start_,Rect_Distance_Q33,Inner_Distance_Q33);\nfloat Power_Q44=pow(Inner_Distance_Q33,_Blend_Exponent_);\nfloat Result_Q45=pow(BiasFunc(_Bias_,Rect_Distance_Q33),_Falloff_);\nvec4 Color_At_T_Q25=mix(_Inner_Color_,_Color_,Power_Q44);\nfloat Product_Q22=Result_Q45*Product_Q23;\nvec4 Result_Q28=Product_Q22*Color_At_T_Q25;\nvec4 Out_Color=Result_Q28;\nfloat Clip_Threshold=0.0;\ngl_FragColor=Out_Color;\n}";M.v.ShadersStore.mrdlBackglowVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec3 tangent;\nuniform float _Bevel_Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Tuning_Motion_;\nuniform float _Motion_;\nuniform float _Max_Intensity_;\nuniform float _Intensity_Fade_In_Exponent_;\nuniform float _Outer_Fuzz_Start_;\nuniform float _Outer_Fuzz_End_;\nuniform vec4 _Color_;\nuniform vec4 _Inner_Color_;\nuniform float _Blend_Exponent_;\nuniform float _Falloff_;\nuniform float _Bias_;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvoid main()\n{\nvec3 Dir_World_Q41=(world*vec4(tangent,0.0)).xyz;\nvec3 Dir_World_Q40=(world*vec4((cross(normal,tangent)),0.0)).xyz;\nfloat MaxAB_Q24=max(_Tuning_Motion_,_Motion_);\nfloat Length_Q16=length(Dir_World_Q41);\nfloat Length_Q17=length(Dir_World_Q40);\nbool Greater_Than_Q37=MaxAB_Q24>0.0;\nvec3 Sizes_Q35;\nvec2 XY_Q35;\nSizes_Q35=(_Absolute_Sizes_ ? vec3(Length_Q16,Length_Q17,0) : vec3(Length_Q16/Length_Q17,1,0));\nXY_Q35=(uv-vec2(0.5,0.5))*Sizes_Q35.xy;\nvec3 Result_Q38=Greater_Than_Q37 ? position : vec3(0,0,0);\nvec3 Pos_World_Q39=(world*vec4(Result_Q38,1.0)).xyz;\nvec3 Position=Pos_World_Q39;\nvec3 Normal=Sizes_Q35;\nvec2 UV=XY_Q35;\nvec3 Tangent=vec3(0,0,0);\nvec3 Binormal=vec3(0,0,0);\nvec4 Color=vec4(1,1,1,1);\ngl_Position=viewProjection*vec4(Position,1);\nvNormal=Normal;\nvUV=UV;\n}";class Me extends T.H{constructor(){super(),this._needNormals=!0,this._needUVs=!0,this.rebuild()}}class De extends R.a{constructor(e,t){super(e,t),this.bevelRadius=.16,this.lineWidth=.16,this.absoluteSizes=!1,this.tuningMotion=0,this.motion=1,this.maxIntensity=.7,this.intensityFadeInExponent=2,this.outerFuzzStart=.04,this.outerFuzzEnd=.04,this.color=new g.HE(.682353,.698039,1,1),this.innerColor=new g.HE(.356863,.392157,.796078,1),this.blendExponent=1.5,this.falloff=2,this.bias=.5,this.alphaMode=N.g.ALPHA_ADD,this.disableDepthWrite=!0,this.backFaceCulling=!1}needAlphaBlending(){return!0}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new Me);const i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;const r=n.getEngine();if(E.G.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty){i.markAsProcessed(),n.resetCachedMaterial();const e=new B.L;i.FOG&&e.addFallback(1,"FOG"),E.G.HandleFallbacksForShadows(i,e),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess;const s=[P.o.PositionKind];i.NORMAL&&s.push(P.o.NormalKind),i.UV1&&s.push(P.o.UVKind),i.UV2&&s.push(P.o.UV2Kind),i.VERTEXCOLOR&&s.push(P.o.ColorKind),i.TANGENT&&s.push(P.o.TangentKind),E.G.PrepareAttributesForInstances(s,i);const o="mrdlBackglow",a=i.toString(),l=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Bevel_Radius_","_Line_Width_","_Absolute_Sizes_","_Tuning_Motion_","_Motion_","_Max_Intensity_","_Intensity_Fade_In_Exponent_","_Outer_Fuzz_Start_","_Outer_Fuzz_End_","_Color_","_Inner_Color_","_Blend_Exponent_","_Falloff_","_Bias_"],c=[],h=new Array;E.G.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect(o,{attributes:s,uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:a,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),i)}return!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,i){const n=this.getScene();if(!i.materialDefines)return;const r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setFloat("_Bevel_Radius_",this.bevelRadius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Tuning_Motion_",this.tuningMotion),this._activeEffect.setFloat("_Motion_",this.motion),this._activeEffect.setFloat("_Max_Intensity_",this.maxIntensity),this._activeEffect.setFloat("_Intensity_Fade_In_Exponent_",this.intensityFadeInExponent),this._activeEffect.setFloat("_Outer_Fuzz_Start_",this.outerFuzzStart),this._activeEffect.setFloat("_Outer_Fuzz_End_",this.outerFuzzEnd),this._activeEffect.setDirectColor4("_Color_",this.color),this._activeEffect.setDirectColor4("_Inner_Color_",this.innerColor),this._activeEffect.setFloat("_Blend_Exponent_",this.blendExponent),this._activeEffect.setFloat("_Falloff_",this.falloff),this._activeEffect.setFloat("_Bias_",this.bias),this._afterBind(t,this._activeEffect))}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(e){return x.p4.Clone((()=>new De(e,this.getScene())),this)}serialize(){const e=x.p4.Serialize(this);return e.customType="BABYLON.MRDLBackglowMaterial",e}getClassName(){return"MRDLBackglowMaterial"}static Parse(e,t,i){return x.p4.Parse((()=>new De(e.name,t)),e,t,i)}}(0,S.gn)([(0,x.qC)()],De.prototype,"bevelRadius",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"lineWidth",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"absoluteSizes",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"tuningMotion",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"motion",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"maxIntensity",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"intensityFadeInExponent",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"outerFuzzStart",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"outerFuzzEnd",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"color",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"innerColor",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"blendExponent",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"falloff",void 0),(0,S.gn)([(0,x.qC)()],De.prototype,"bias",void 0),(0,I.H)("BABYLON.GUI.MRDLBackglowMaterial",De);M.v.ShadersStore.mrdlFrontplatePixelShader="uniform vec3 cameraPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Relative_To_Height_;\nuniform float _Filter_Width_;\nuniform vec4 _Edge_Color_;\nuniform float _Fade_Out_;\nuniform bool _Smooth_Edges_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform float _Blob_Pulse_Max_Size_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform float _Gaze_Intensity_;\nuniform float _Gaze_Focus_;\nuniform sampler2D _Blob_Texture_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform bool _Use_Global_Left_Index_;\nuniform bool _Use_Global_Right_Index_;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nvoid Scale_Color_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\nvoid Scale_RGB_B50(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Proximity_Fragment_B51(\nfloat Proximity_Max_Intensity,\nfloat Proximity_Near_Radius,\nvec4 Deltas,\nfloat Show_Selection,\nfloat Distance_Fade1,\nfloat Distance_Fade2,\nfloat Strength,\nout float Proximity)\n{\nfloat proximity1=(1.0-clamp(length(Deltas.xy)/Proximity_Near_Radius,0.0,1.0))*Distance_Fade1;\nfloat proximity2=(1.0-clamp(length(Deltas.zw)/Proximity_Near_Radius,0.0,1.0))*Distance_Fade2;\nProximity=Strength*(Proximity_Max_Intensity*max(proximity1,proximity2) *(1.0-Show_Selection)+Show_Selection);\n}\nvoid Blob_Fragment_B56(\nvec2 UV,\nvec3 Blob_Info,\nsampler2D Blob_Texture,\nout vec4 Blob_Color)\n{\nfloat k=dot(UV,UV);\nBlob_Color=Blob_Info.y*texture(Blob_Texture,vec2(vec2(sqrt(k),Blob_Info.x).x,1.0-vec2(sqrt(k),Blob_Info.x).y))*(1.0-clamp(k,0.0,1.0));\n}\nvoid Round_Rect_Fragment_B61(\nfloat Radius,\nvec4 Line_Color,\nfloat Filter_Width,\nfloat Line_Visibility,\nvec4 Fill_Color,\nbool Smooth_Edges,\nvec4 Rect_Parms,\nout float Inside_Rect)\n{\nfloat d=length(max(abs(Rect_Parms.zw)-Rect_Parms.xy,0.0));\nfloat dx=max(fwidth(d)*Filter_Width,0.00001);\nInside_Rect=Smooth_Edges ? clamp((Radius-d)/dx,0.0,1.0) : 1.0-step(Radius,d);\n}\nvoid main()\n{\nfloat Is_Quad_Q53;\nIs_Quad_Q53=vNormal.z;\nvec4 Blob_Color_Q56;\nBlob_Fragment_B56(vUV,vTangent,_Blob_Texture_,Blob_Color_Q56);\nfloat X_Q52;\nfloat Y_Q52;\nfloat Z_Q52;\nfloat W_Q52;\nX_Q52=vExtra3.x;\nY_Q52=vExtra3.y;\nZ_Q52=vExtra3.z;\nW_Q52=vExtra3.w;\nfloat Proximity_Q51;\nProximity_Fragment_B51(_Proximity_Max_Intensity_,_Proximity_Near_Radius_,vExtra2,X_Q52,Y_Q52,Z_Q52,1.0,Proximity_Q51);\nfloat Inside_Rect_Q61;\nRound_Rect_Fragment_B61(W_Q52,vec4(1,1,1,1),_Filter_Width_,1.0,vec4(0,0,0,0),_Smooth_Edges_,vExtra1,Inside_Rect_Q61);\nvec4 Result_Q50;\nScale_RGB_B50(_Edge_Color_,Proximity_Q51,Result_Q50);\nvec4 Result_Q47=Inside_Rect_Q61*Blob_Color_Q56;\nvec4 Color_At_T_Q48=mix(Result_Q50,Result_Q47,Is_Quad_Q53);\nvec4 Result_Q54;\nScale_Color_B54(Color_At_T_Q48,_Fade_Out_,Result_Q54);\nvec4 Out_Color=Result_Q54;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}";M.v.ShadersStore.mrdlFrontplateVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec3 tangent;\nattribute vec4 color;\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Relative_To_Height_;\nuniform float _Filter_Width_;\nuniform vec4 _Edge_Color_;\nuniform float _Fade_Out_;\nuniform bool _Smooth_Edges_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform float _Blob_Pulse_Max_Size_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform float _Gaze_Intensity_;\nuniform float _Gaze_Focus_;\nuniform sampler2D _Blob_Texture_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform bool _Use_Global_Left_Index_;\nuniform bool _Use_Global_Right_Index_;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nvoid Blob_Vertex_B40(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nvec4 Vx_Color,\nvec2 UV,\nvec3 Face_Center,\nvec2 Face_Size,\nvec2 In_UV,\nfloat Blob_Fade_Length,\nfloat Selection_Fade,\nfloat Selection_Fade_Size,\nfloat Inner_Fade,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nfloat Blob_Enabled,\nfloat DistanceOffset,\nout vec3 Out_Position,\nout vec2 Out_UV,\nout vec3 Blob_Info,\nout vec2 Blob_Relative_UV)\n{\nfloat blobSize,fadeIn;\nvec3 Hit_Position;\nBlob_Info=vec3(0.0,0.0,0.0);\nfloat Hit_Distance=dot(Blob_Position-Face_Center,Normal)+DistanceOffset*Blob_Far_Distance;\nHit_Position=Blob_Position-Hit_Distance*Normal;\nfloat absD=abs(Hit_Distance);\nfloat lerpVal=clamp((absD-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfadeIn=1.0-clamp((absD-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat innerFade=1.0-clamp(-Hit_Distance/Inner_Fade,0.0,1.0);\nfloat farClip=clamp(1.0-step(Blob_Far_Distance+Blob_Fade_Length,absD),0.0,1.0);\nfloat size=mix(Blob_Near_Size,Blob_Far_Size,lerpVal)*farClip;\nblobSize=mix(size,Selection_Fade_Size,Selection_Fade)*innerFade*Blob_Enabled;\nBlob_Info.x=lerpVal*0.5+0.5;\nBlob_Info.y=fadeIn*Intensity*(1.0-Selection_Fade)*Blob_Fade;\nBlob_Info.x*=(1.0-Blob_Pulse);\nvec3 delta=Hit_Position-Face_Center;\nvec2 blobCenterXY=vec2(dot(delta,Tangent),dot(delta,Bitangent));\nvec2 quadUVin=2.0*UV-1.0; \nvec2 blobXY=blobCenterXY+quadUVin*blobSize;\nvec2 blobClipped=clamp(blobXY,-Face_Size*0.5,Face_Size*0.5);\nvec2 blobUV=(blobClipped-blobCenterXY)/max(blobSize,0.0001)*2.0;\nvec3 blobCorner=Face_Center+blobClipped.x*Tangent+blobClipped.y*Bitangent;\nOut_Position=mix(Position,blobCorner,Vx_Color.rrr);\nOut_UV=mix(In_UV,blobUV,Vx_Color.rr);\nBlob_Relative_UV=blobClipped/Face_Size.y;\n}\nvoid Round_Rect_Vertex_B36(\nvec2 UV,\nvec3 Tangent,\nvec3 Binormal,\nfloat Radius,\nfloat Anisotropy,\nvec2 Blob_Center_UV,\nout vec2 Rect_UV,\nout vec2 Scale_XY,\nout vec4 Rect_Parms)\n{\nScale_XY=vec2(Anisotropy,1.0);\nRect_UV=(UV-vec2(0.5,0.5))*Scale_XY;\nRect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius);\nRect_Parms.zw=Blob_Center_UV;\n}\nvec2 ProjectProximity(\nvec3 blobPosition,\nvec3 position,\nvec3 center,\nvec3 dir,\nvec3 xdir,\nvec3 ydir,\nout float vdistance\n)\n{\nvec3 delta=blobPosition-position;\nvec2 xy=vec2(dot(delta,xdir),dot(delta,ydir));\nvdistance=abs(dot(delta,dir));\nreturn xy;\n}\nvoid Proximity_Vertex_B33(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Face_Center,\nvec3 Position,\nfloat Proximity_Far_Distance,\nfloat Relative_Scale,\nfloat Proximity_Anisotropy,\nvec3 Normal,\nvec3 Tangent,\nvec3 Binormal,\nout vec4 Extra,\nout float Distance_To_Face,\nout float Distance_Fade1,\nout float Distance_Fade2)\n{\nfloat distz1,distz2;\nExtra.xy=ProjectProximity(Blob_Position,Position,Face_Center,Normal,Tangent*Proximity_Anisotropy,Binormal,distz1)/Relative_Scale;\nExtra.zw=ProjectProximity(Blob_Position_2,Position,Face_Center,Normal,Tangent*Proximity_Anisotropy,Binormal,distz2)/Relative_Scale;\nDistance_To_Face=dot(Normal,Position-Face_Center);\nDistance_Fade1=1.0-clamp(distz1/Proximity_Far_Distance,0.0,1.0);\nDistance_Fade2=1.0-clamp(distz2/Proximity_Far_Distance,0.0,1.0);\n}\nvoid Object_To_World_Pos_B12(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Choose_Blob_B27(\nvec4 Vx_Color,\nvec3 Position1,\nvec3 Position2,\nbool Blob_Enable_1,\nbool Blob_Enable_2,\nfloat Near_Size_1,\nfloat Near_Size_2,\nfloat Blob_Inner_Fade_1,\nfloat Blob_Inner_Fade_2,\nfloat Blob_Pulse_1,\nfloat Blob_Pulse_2,\nfloat Blob_Fade_1,\nfloat Blob_Fade_2,\nout vec3 Position,\nout float Near_Size,\nout float Inner_Fade,\nout float Blob_Enable,\nout float Fade,\nout float Pulse)\n{\nPosition=Position1*(1.0-Vx_Color.g)+Vx_Color.g*Position2;\nfloat b1=Blob_Enable_1 ? 1.0 : 0.0;\nfloat b2=Blob_Enable_2 ? 1.0 : 0.0;\nBlob_Enable=b1+(b2-b1)*Vx_Color.g;\nPulse=Blob_Pulse_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Pulse_2;\nFade=Blob_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Fade_2;\nNear_Size=Near_Size_1*(1.0-Vx_Color.g)+Vx_Color.g*Near_Size_2;\nInner_Fade=Blob_Inner_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Inner_Fade_2;\n}\nvoid Move_Verts_B32(\nvec2 UV,\nfloat Radius,\nfloat Anisotropy,\nfloat Line_Width,\nfloat Visible,\nout vec3 New_P,\nout vec2 New_UV)\n{\nvec2 xy=2.0*UV-vec2(0.5,0.5);\nvec2 center=clamp(xy,0.0,1.0);\nvec2 delta=2.0*(xy-center);\nfloat deltaLength=length(delta);\nvec2 aniso=vec2(1.0/Anisotropy,1.0);\ncenter=(center-vec2(0.5,0.5))*(1.0-2.0*Radius*aniso);\nNew_UV=vec2((2.0-2.0*deltaLength)*Visible,0.0);\nfloat deltaRadius= (Radius-Line_Width*New_UV.x);\nNew_P.xy=(center+deltaRadius/deltaLength *aniso*delta);\nNew_P.z=0.0;\n}\nvoid Object_To_World_Dir_B14(\nvec3 Dir_Object,\nout vec3 Binormal_World)\n{\nBinormal_World=(world*vec4(Dir_Object,0.0)).xyz;\n}\nvoid Proximity_Visibility_B55(\nfloat Selection,\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Proximity_Far_Distance,\nfloat Proximity_Radius,\nvec3 Face_Center,\nvec3 Normal,\nvec2 Face_Size,\nfloat Gaze,\nout float Width)\n{\nfloat boxMaxSize=length(Face_Size)*0.5;\nfloat d1=dot(Proximity_Center-Face_Center,Normal);\nvec3 blob1=Proximity_Center-d1*Normal;\nfloat d2=dot(Proximity_Center_2-Face_Center,Normal);\nvec3 blob2=Proximity_Center_2-d2*Normal;\nvec3 delta1=blob1-Face_Center;\nvec3 delta2=blob2-Face_Center;\nfloat dist1=dot(delta1,delta1);\nfloat dist2=dot(delta2,delta2);\nfloat nearestProxDist=sqrt(min(dist1,dist2));\nWidth=(1.0-step(boxMaxSize+Proximity_Radius,nearestProxDist))*(1.0-step(Proximity_Far_Distance,min(d1,d2))*(1.0-step(0.0001,Selection)));\nWidth=max(Gaze,Width);\n}\nvec2 ramp2(vec2 start,vec2 end,vec2 x)\n{\nreturn clamp((x-start)/(end-start),vec2(0.0,0.0),vec2(1.0,1.0));\n}\nfloat computeSelection(\nvec3 blobPosition,\nvec3 normal,\nvec3 tangent,\nvec3 bitangent,\nvec3 faceCenter,\nvec2 faceSize,\nfloat selectionFuzz,\nfloat farDistance,\nfloat fadeLength\n)\n{\nvec3 delta=blobPosition-faceCenter;\nfloat absD=abs(dot(delta,normal));\nfloat fadeIn=1.0-clamp((absD-farDistance)/fadeLength,0.0,1.0);\nvec2 blobCenterXY=vec2(dot(delta,tangent),dot(delta,bitangent));\nvec2 innerFace=faceSize*(1.0-selectionFuzz)*0.5;\nvec2 selectPulse=ramp2(-faceSize*0.5,-innerFace,blobCenterXY)-ramp2(innerFace,faceSize*0.5,blobCenterXY);\nreturn selectPulse.x*selectPulse.y*fadeIn;\n}\nvoid Selection_Vertex_B31(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Face_Center,\nvec2 Face_Size,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nfloat Selection_Fuzz,\nfloat Selected,\nfloat Far_Distance,\nfloat Fade_Length,\nvec3 Active_Face_Dir,\nout float Show_Selection)\n{\nfloat select1=computeSelection(Blob_Position,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nfloat select2=computeSelection(Blob_Position_2,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nShow_Selection=mix(max(select1,select2),1.0,Selected);\n}\nvoid main()\n{\nvec3 Vec3_Q29=vec3(vec2(0,0).x,vec2(0,0).y,color.r);\nvec3 Nrm_World_Q24;\nNrm_World_Q24=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Face_Center_Q30;\nFace_Center_Q30=(world*vec4(vec3(0,0,0),1.0)).xyz;\nvec3 Tangent_World_Q13;\nTangent_World_Q13=(world*vec4(tangent,0.0)).xyz;\nvec3 Result_Q42;\nResult_Q42=_Use_Global_Left_Index_ ? Global_Left_Index_Tip_Position.xyz : _Blob_Position_;\nvec3 Result_Q43;\nResult_Q43=_Use_Global_Right_Index_ ? Global_Right_Index_Tip_Position.xyz : _Blob_Position_2_;\nfloat Value_At_T_Q58=mix(_Blob_Near_Size_,_Blob_Pulse_Max_Size_,_Blob_Pulse_);\nfloat Value_At_T_Q59=mix(_Blob_Near_Size_2_,_Blob_Pulse_Max_Size_,_Blob_Pulse_2_);\nvec3 Cross_Q70=cross(normal,tangent);\nfloat Product_Q45=_Gaze_Intensity_*_Gaze_Focus_;\nfloat Step_Q46=step(0.0001,Product_Q45);\nvec3 Tangent_World_N_Q15=normalize(Tangent_World_Q13);\nvec3 Position_Q27;\nfloat Near_Size_Q27;\nfloat Inner_Fade_Q27;\nfloat Blob_Enable_Q27;\nfloat Fade_Q27;\nfloat Pulse_Q27;\nChoose_Blob_B27(color,Result_Q42,Result_Q43,_Blob_Enable_,_Blob_Enable_2_,Value_At_T_Q58,Value_At_T_Q59,_Blob_Inner_Fade_,_Blob_Inner_Fade_2_,_Blob_Pulse_,_Blob_Pulse_2_,_Blob_Fade_,_Blob_Fade_2_,Position_Q27,Near_Size_Q27,Inner_Fade_Q27,Blob_Enable_Q27,Fade_Q27,Pulse_Q27);\nvec3 Binormal_World_Q14;\nObject_To_World_Dir_B14(Cross_Q70,Binormal_World_Q14);\nfloat Anisotropy_Q21=length(Tangent_World_Q13)/length(Binormal_World_Q14);\nvec3 Binormal_World_N_Q16=normalize(Binormal_World_Q14);\nvec2 Face_Size_Q35;\nfloat ScaleY_Q35;\nFace_Size_Q35=vec2(length(Tangent_World_Q13),length(Binormal_World_Q14));\nScaleY_Q35=Face_Size_Q35.y;\nfloat Out_Radius_Q38;\nfloat Out_Line_Width_Q38;\nOut_Radius_Q38=_Relative_To_Height_ ? _Radius_ : _Radius_/ScaleY_Q35;\nOut_Line_Width_Q38=_Relative_To_Height_ ? _Line_Width_ : _Line_Width_/ScaleY_Q35;\nfloat Show_Selection_Q31;\nSelection_Vertex_B31(Result_Q42,Result_Q43,Face_Center_Q30,Face_Size_Q35,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,_Selection_Fuzz_,_Selected_,_Selected_Distance_,_Selected_Fade_Length_,vec3(0,0,-1),Show_Selection_Q31);\nfloat MaxAB_Q41=max(Show_Selection_Q31,Product_Q45);\nfloat Width_Q55;\nProximity_Visibility_B55(Show_Selection_Q31,Result_Q42,Result_Q43,_Proximity_Far_Distance_,_Proximity_Near_Radius_,Face_Center_Q30,Nrm_World_Q24,Face_Size_Q35,Step_Q46,Width_Q55);\nvec3 New_P_Q32;\nvec2 New_UV_Q32;\nMove_Verts_B32(uv,Out_Radius_Q38,Anisotropy_Q21,Out_Line_Width_Q38,Width_Q55,New_P_Q32,New_UV_Q32);\nvec3 Pos_World_Q12;\nObject_To_World_Pos_B12(New_P_Q32,Pos_World_Q12);\nvec3 Out_Position_Q40;\nvec2 Out_UV_Q40;\nvec3 Blob_Info_Q40;\nvec2 Blob_Relative_UV_Q40;\nBlob_Vertex_B40(Pos_World_Q12,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,Position_Q27,_Blob_Intensity_,Near_Size_Q27,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,color,uv,Face_Center_Q30,Face_Size_Q35,New_UV_Q32,_Blob_Fade_Length_,_Selection_Fade_,_Selection_Fade_Size_,Inner_Fade_Q27,Pulse_Q27,Fade_Q27,Blob_Enable_Q27,0.0,Out_Position_Q40,Out_UV_Q40,Blob_Info_Q40,Blob_Relative_UV_Q40);\nvec2 Rect_UV_Q36;\nvec2 Scale_XY_Q36;\nvec4 Rect_Parms_Q36;\nRound_Rect_Vertex_B36(New_UV_Q32,Tangent_World_Q13,Binormal_World_Q14,Out_Radius_Q38,Anisotropy_Q21,Blob_Relative_UV_Q40,Rect_UV_Q36,Scale_XY_Q36,Rect_Parms_Q36);\nvec4 Extra_Q33;\nfloat Distance_To_Face_Q33;\nfloat Distance_Fade1_Q33;\nfloat Distance_Fade2_Q33;\nProximity_Vertex_B33(Result_Q42,Result_Q43,Face_Center_Q30,Pos_World_Q12,_Proximity_Far_Distance_,1.0,_Proximity_Anisotropy_,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,Extra_Q33,Distance_To_Face_Q33,Distance_Fade1_Q33,Distance_Fade2_Q33);\nvec4 Vec4_Q37=vec4(MaxAB_Q41,Distance_Fade1_Q33,Distance_Fade2_Q33,Out_Radius_Q38);\nvec3 Position=Out_Position_Q40;\nvec3 Normal=Vec3_Q29;\nvec2 UV=Out_UV_Q40;\nvec3 Tangent=Blob_Info_Q40;\nvec3 Binormal=vec3(0,0,0);\nvec4 Color=vec4(1,1,1,1);\nvec4 Extra1=Rect_Parms_Q36;\nvec4 Extra2=Extra_Q33;\nvec4 Extra3=Vec4_Q37;\ngl_Position=viewProjection*vec4(Position,1);\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvExtra1=Extra1;\nvExtra2=Extra2;\nvExtra3=Extra3;\n}";class Oe extends T.H{constructor(){super(),this.SMOOTH_EDGES=!0,this._needNormals=!0,this._needUVs=!0,this.rebuild()}}class we extends R.a{constructor(e,t){super(e,t),this.radius=.12,this.lineWidth=.01,this.relativeToHeight=!1,this._filterWidth=1,this.edgeColor=new g.HE(.53,.53,.53,1),this.blobEnable=!0,this.blobPosition=new a.P(100,100,100),this.blobIntensity=.5,this.blobNearSize=.032,this.blobFarSize=.048,this.blobNearDistance=.008,this.blobFarDistance=.064,this.blobFadeLength=.04,this.blobInnerFade=.01,this.blobPulse=0,this.blobFade=1,this.blobPulseMaxSize=.05,this.blobEnable2=!0,this.blobPosition2=new a.P(10,10.1,-.6),this.blobNearSize2=.008,this.blobInnerFade2=.1,this.blobPulse2=0,this.blobFade2=1,this.gazeIntensity=.8,this.gazeFocus=0,this.selectionFuzz=.5,this.selected=1,this.selectionFade=.2,this.selectionFadeSize=0,this.selectedDistance=.08,this.selectedFadeLength=.08,this.proximityMaxIntensity=.45,this.proximityFarDistance=.16,this.proximityNearRadius=.016,this.proximityAnisotropy=1,this.useGlobalLeftIndex=!0,this.useGlobalRightIndex=!0,this.fadeOut=1,this.alphaMode=N.g.ALPHA_ADD,this.disableDepthWrite=!0,this.backFaceCulling=!1,this._blobTexture=new d.x(we.BLOB_TEXTURE_URL,t,!0,!1,d.x.NEAREST_SAMPLINGMODE)}needAlphaBlending(){return!0}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new Oe);const i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;const r=n.getEngine();if(E.G.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty){i.markAsProcessed(),n.resetCachedMaterial();const e=new B.L;i.FOG&&e.addFallback(1,"FOG"),E.G.HandleFallbacksForShadows(i,e),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess;const s=[P.o.PositionKind];i.NORMAL&&s.push(P.o.NormalKind),i.UV1&&s.push(P.o.UVKind),i.UV2&&s.push(P.o.UV2Kind),i.VERTEXCOLOR&&s.push(P.o.ColorKind),i.TANGENT&&s.push(P.o.TangentKind),E.G.PrepareAttributesForInstances(s,i);const o="mrdlFrontplate",a=i.toString(),l=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Relative_To_Height_","_Filter_Width_","_Edge_Color_","_Fade_Out_","_Smooth_Edges_","_Blob_Enable_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Inner_Fade_","_Blob_Pulse_","_Blob_Fade_","_Blob_Pulse_Max_Size_","_Blob_Enable_2_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Inner_Fade_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Gaze_Intensity_","_Gaze_Focus_","_Blob_Texture_","_Selection_Fuzz_","_Selected_","_Selection_Fade_","_Selection_Fade_Size_","_Selected_Distance_","_Selected_Fade_Length_","_Proximity_Max_Intensity_","_Proximity_Far_Distance_","_Proximity_Near_Radius_","_Proximity_Anisotropy_","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","_Use_Global_Left_Index_","_Use_Global_Right_Index_"],c=[],h=new Array;E.G.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect(o,{attributes:s,uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:a,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),i)}return!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,i){const n=this.getScene();if(!i.materialDefines)return;const r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Relative_To_Height_",this.relativeToHeight?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Edge_Color_",this.edgeColor),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._activeEffect.setFloat("_Blob_Enable_",this.blobEnable?1:0),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Inner_Fade_",this.blobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setFloat("_Blob_Pulse_Max_Size_",this.blobPulseMaxSize),this._activeEffect.setFloat("_Blob_Enable_2_",this.blobEnable2?1:0),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Inner_Fade_2_",this.blobInnerFade2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setFloat("_Gaze_Intensity_",this.gazeIntensity),this._activeEffect.setFloat("_Gaze_Focus_",this.gazeFocus),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Selection_Fuzz_",this.selectionFuzz),this._activeEffect.setFloat("_Selected_",this.selected),this._activeEffect.setFloat("_Selection_Fade_",this.selectionFade),this._activeEffect.setFloat("_Selection_Fade_Size_",this.selectionFadeSize),this._activeEffect.setFloat("_Selected_Distance_",this.selectedDistance),this._activeEffect.setFloat("_Selected_Fade_Length_",this.selectedFadeLength),this._activeEffect.setFloat("_Proximity_Max_Intensity_",this.proximityMaxIntensity),this._activeEffect.setFloat("_Proximity_Far_Distance_",this.proximityFarDistance),this._activeEffect.setFloat("_Proximity_Near_Radius_",this.proximityNearRadius),this._activeEffect.setFloat("_Proximity_Anisotropy_",this.proximityAnisotropy),this._activeEffect.setFloat("_Use_Global_Left_Index_",this.useGlobalLeftIndex?1:0),this._activeEffect.setFloat("_Use_Global_Right_Index_",this.useGlobalRightIndex?1:0),this._afterBind(t,this._activeEffect))}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(e){return x.p4.Clone((()=>new we(e,this.getScene())),this)}serialize(){const e=x.p4.Serialize(this);return e.customType="BABYLON.MRDLFrontplateMaterial",e}getClassName(){return"MRDLFrontplateMaterial"}static Parse(e,t,i){return x.p4.Parse((()=>new we(e.name,t)),e,t,i)}}we.BLOB_TEXTURE_URL="",(0,S.gn)([(0,x.qC)()],we.prototype,"radius",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"lineWidth",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"relativeToHeight",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"edgeColor",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobEnable",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobPosition",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobIntensity",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobNearSize",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobFarSize",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobNearDistance",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobFarDistance",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobFadeLength",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobInnerFade",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobPulse",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobFade",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobPulseMaxSize",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobEnable2",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobPosition2",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobNearSize2",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobInnerFade2",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobPulse2",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"blobFade2",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"gazeIntensity",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"gazeFocus",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"selectionFuzz",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"selected",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"selectionFade",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"selectionFadeSize",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"selectedDistance",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"selectedFadeLength",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"proximityMaxIntensity",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"proximityFarDistance",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"proximityNearRadius",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"proximityAnisotropy",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"useGlobalLeftIndex",void 0),(0,S.gn)([(0,x.qC)()],we.prototype,"useGlobalRightIndex",void 0),(0,I.H)("BABYLON.GUI.MRDLFrontplateMaterial",we);M.v.ShadersStore.mrdlInnerquadPixelShader="uniform vec3 cameraPosition;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nuniform vec4 _Color_;\nuniform float _Radius_;\nuniform bool _Fixed_Radius_;\nuniform float _Filter_Width_;\nuniform float _Glow_Fraction_;\nuniform float _Glow_Max_;\nuniform float _Glow_Falloff_;\nfloat FilterStep_Bid194(float edge,float x,float filterWidth)\n{\nfloat dx=max(1.0E-5,fwidth(x)*filterWidth);\nreturn max((x+dx*0.5-max(edge,x-dx*0.5))/dx,0.0);\n}\nvoid Round_Rect_B194(\nfloat Size_X,\nfloat Size_Y,\nfloat Radius,\nvec4 Rect_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Glow_Fraction,\nfloat Glow_Max,\nfloat Glow_Falloff,\nout vec4 Color)\n{\nvec2 halfSize=vec2(Size_X,Size_Y)*0.5;\nvec2 r=max(min(vec2(Radius,Radius),halfSize),vec2(0.01,0.01));\nvec2 v=abs(UV);\nvec2 nearestp=min(v,halfSize-r);\nvec2 delta=(v-nearestp)/max(vec2(0.01,0.01),r);\nfloat Distance=length(delta);\nfloat insideRect=1.0-FilterStep_Bid194(1.0-Glow_Fraction,Distance,Filter_Width);\nfloat glow=clamp((1.0-Distance)/Glow_Fraction,0.0,1.0);\nglow=pow(glow,Glow_Falloff);\nColor=Rect_Color*max(insideRect,glow*Glow_Max);\n}\nvoid main()\n{\nfloat X_Q192;\nfloat Y_Q192;\nfloat Z_Q192;\nX_Q192=vTangent.x;\nY_Q192=vTangent.y;\nZ_Q192=vTangent.z;\nvec4 Color_Q194;\nRound_Rect_B194(X_Q192,1.0,Y_Q192,_Color_,_Filter_Width_,vUV,_Glow_Fraction_,_Glow_Max_,_Glow_Falloff_,Color_Q194);\nvec4 Out_Color=Color_Q194;\nfloat Clip_Threshold=0.0;\ngl_FragColor=Out_Color;\n}\n";M.v.ShadersStore.mrdlInnerquadVertexShader="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec3 tangent;\nattribute vec4 color;\nuniform vec4 _Color_;\nuniform float _Radius_;\nuniform bool _Fixed_Radius_;\nuniform float _Filter_Width_;\nuniform float _Glow_Fraction_;\nuniform float _Glow_Max_;\nuniform float _Glow_Falloff_;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvoid main()\n{\nvec3 Pos_World_Q189;\nPos_World_Q189=(world*vec4(position,1.0)).xyz;\nvec3 Dir_World_Q190;\nDir_World_Q190=(world*vec4(tangent,0.0)).xyz;\nvec3 Dir_World_Q191;\nDir_World_Q191=(world*vec4((cross(normal,tangent)),0.0)).xyz;\nfloat Length_Q180=length(Dir_World_Q190);\nfloat Length_Q181=length(Dir_World_Q191);\nfloat Quotient_Q184=Length_Q180/Length_Q181;\nfloat Quotient_Q195=_Radius_/Length_Q181;\nvec2 Result_Q193;\nResult_Q193=vec2((uv.x-0.5)*Length_Q180/Length_Q181,(uv.y-0.5));\nfloat Result_Q198=_Fixed_Radius_ ? Quotient_Q195 : _Radius_;\nvec3 Vec3_Q183=vec3(Quotient_Q184,Result_Q198,0);\nvec3 Position=Pos_World_Q189;\nvec3 Normal=vec3(0,0,0);\nvec2 UV=Result_Q193;\nvec3 Tangent=Vec3_Q183;\nvec3 Binormal=vec3(0,0,0);\nvec4 Color=color;\ngl_Position=viewProjection*vec4(Position,1);\nvUV=UV;\nvTangent=Tangent;\n}\n";class Fe extends T.H{constructor(){super(),this._needNormals=!0,this._needUVs=!0,this.rebuild()}}class Be extends R.a{constructor(e,t){super(e,t),this.color=new g.HE(1,1,1,.05),this.radius=.12,this.fixedRadius=!0,this._filterWidth=1,this.glowFraction=0,this.glowMax=.5,this.glowFalloff=2,this.alphaMode=N.g.ALPHA_COMBINE,this.backFaceCulling=!1}needAlphaBlending(){return!0}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new Fe);const i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;const r=n.getEngine();if(E.G.PrepareDefinesForAttributes(e,i,!0,!1),i.isDirty){i.markAsProcessed(),n.resetCachedMaterial();const e=new B.L;i.FOG&&e.addFallback(1,"FOG"),E.G.HandleFallbacksForShadows(i,e),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess;const s=[P.o.PositionKind];i.NORMAL&&s.push(P.o.NormalKind),i.UV1&&s.push(P.o.UVKind),i.UV2&&s.push(P.o.UV2Kind),i.VERTEXCOLOR&&s.push(P.o.ColorKind),i.TANGENT&&s.push(P.o.TangentKind),E.G.PrepareAttributesForInstances(s,i);const o="mrdlInnerquad",a=i.toString(),l=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Color_","_Radius_","_Fixed_Radius_","_Filter_Width_","_Glow_Fraction_","_Glow_Max_","_Glow_Falloff_"],c=[],h=new Array;E.G.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect(o,{attributes:s,uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:a,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},r),i)}return!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,i){const n=this.getScene();if(!i.materialDefines)return;const r=i.effect;r&&(this._activeEffect=r,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setDirectColor4("_Color_",this.color),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Fixed_Radius_",this.fixedRadius?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setFloat("_Glow_Fraction_",this.glowFraction),this._activeEffect.setFloat("_Glow_Max_",this.glowMax),this._activeEffect.setFloat("_Glow_Falloff_",this.glowFalloff),this._afterBind(t,this._activeEffect))}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(e){return x.p4.Clone((()=>new Be(e,this.getScene())),this)}serialize(){const e=x.p4.Serialize(this);return e.customType="BABYLON.MRDLInnerquadMaterial",e}getClassName(){return"MRDLInnerquadMaterial"}static Parse(e,t,i){return x.p4.Parse((()=>new Be(e.name,t)),e,t,i)}}(0,S.gn)([(0,x.qC)()],Be.prototype,"color",void 0),(0,S.gn)([(0,x.qC)()],Be.prototype,"radius",void 0),(0,S.gn)([(0,x.qC)()],Be.prototype,"fixedRadius",void 0),(0,S.gn)([(0,x.qC)()],Be.prototype,"glowFraction",void 0),(0,S.gn)([(0,x.qC)()],Be.prototype,"glowMax",void 0),(0,S.gn)([(0,x.qC)()],Be.prototype,"glowFalloff",void 0),(0,I.H)("BABYLON.GUI.MRDLInnerquadMaterial",Be);var Ne=i("../../../node_modules/@babylonjs/gui/2D/controls/rectangle.js");class Le extends q{constructor(e,t=!0){super(e),this.width=1,this.height=1,this.radius=.14,this.textSizeInPixels=18,this.imageSizeInPixels=40,this.plateMaterialColor=new g.Wo(.4,.4,.4),this.frontPlateDepth=.2,this.backPlateDepth=.04,this.backGlowOffset=.1,this.flatPlaneDepth=.001,this.innerQuadRadius=this.radius-.04,this.innerQuadColor=new g.HE(0,0,0,0),this.innerQuadToggledColor=new g.HE(.5197843,.6485234,.9607843,.6),this.innerQuadHoverColor=new g.HE(1,1,1,.05),this.innerQuadToggledHoverColor=new g.HE(.5197843,.6485234,.9607843,1),this._isBackplateVisible=!0,this._shareMaterials=!0,this._shareMaterials=t,this.pointerEnterAnimation=()=>{this._frontPlate&&this._textPlate&&!this.isToggleButton&&this._performEnterExitAnimation(1),this.isToggleButton&&this._innerQuadMaterial&&(this.isToggled?this._innerQuadMaterial.color=this.innerQuadToggledHoverColor:this._innerQuadMaterial.color=this.innerQuadHoverColor)},this.pointerOutAnimation=()=>{this._frontPlate&&this._textPlate&&!this.isToggleButton&&this._performEnterExitAnimation(-.8),this.isToggleButton&&this._innerQuadMaterial&&this._onToggle(this.isToggled)},this.pointerDownAnimation=()=>{},this.pointerUpAnimation=()=>{},this._pointerClickObserver=this.onPointerClickObservable.add((()=>{this._frontPlate&&this._backGlow&&!this.isActiveNearInteraction&&this._performClickAnimation(),this.isToggleButton&&this._innerQuadMaterial&&this._onToggle(this.isToggled)})),this._pointerEnterObserver=this.onPointerEnterObservable.add((()=>{this.pointerEnterAnimation()})),this._pointerOutObserver=this.onPointerOutObservable.add((()=>{this.pointerOutAnimation()})),this._toggleObserver=this.onToggleObservable.add((e=>{this._innerQuadMaterial.color=e?this.innerQuadToggledColor:this.innerQuadColor}))}_disposeTooltip(){this._tooltipFade=null,this._tooltipTextBlock&&this._tooltipTextBlock.dispose(),this._tooltipTexture&&this._tooltipTexture.dispose(),this._tooltipMesh&&this._tooltipMesh.dispose(),this.onPointerEnterObservable.remove(this._tooltipHoverObserver),this.onPointerOutObservable.remove(this._tooltipOutObserver)}set renderingGroupId(e){this._backPlate.renderingGroupId=e,this._textPlate.renderingGroupId=e,this._frontPlate.renderingGroupId=e,this._backGlow.renderingGroupId=e,this._innerQuad.renderingGroupId=e,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=e)}get renderingGroupId(){return this._backPlate.renderingGroupId}get mesh(){return this._backPlate}set tooltipText(e){if(e){if(!this._tooltipFade){const e=this._backPlate._scene.useRightHandedSystem;this._tooltipMesh=(0,G.pT)("",{size:1},this._backPlate._scene),this._tooltipMesh.position=a.P.Down().scale(.7).add(a.P.Forward(e).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._frontPlateCollisionMesh,this._tooltipTexture=s.i.CreateForMesh(this._tooltipMesh);const t=new Ne.A;t.height=.25,t.width=.8,t.cornerRadius=25,t.color="#ffffff",t.thickness=20,t.background="#060668",this._tooltipTexture.addControl(t),this._tooltipTextBlock=new H.a,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=100,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new j.Y,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((()=>{this._tooltipFade&&this._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((()=>{this._tooltipFade&&this._tooltipFade.fadeIn(!1)}))}this._tooltipTextBlock&&(this._tooltipTextBlock.text=e)}else this._disposeTooltip()}get tooltipText(){var e;return(null===(e=this._tooltipTextBlock)||void 0===e?void 0:e.text)||null}get text(){return this._text}set text(e){this._text!==e&&(this._text=e,this._rebuildContent())}get subtext(){return this._subtext}set subtext(e){this._subtext!==e&&(this._subtext=e,this._rebuildContent())}get imageUrl(){return this._imageUrl}set imageUrl(e){this._imageUrl!==e&&(this._imageUrl=e,this._rebuildContent())}get backMaterial(){return this._backMaterial}get frontMaterial(){return this._frontMaterial}get backGlowMaterial(){return this._backGlowMaterial}get innerQuadMaterial(){return this._innerQuadMaterial}get plateMaterial(){return this._plateMaterial}get shareMaterials(){return this._shareMaterials}set isBackplateVisible(e){this.mesh&&this._backMaterial&&(e&&!this._isBackplateVisible?this._backPlate.visibility=1:!e&&this._isBackplateVisible&&(this._backPlate.visibility=0)),this._isBackplateVisible=e}_getTypeName(){return"TouchHolographicButton"}_rebuildContent(){let e;e=this._getAspectRatio()<=1?this._alignContentVertically():this._alignContentHorizontally(),this.content=e}_getAspectRatio(){return this.width/this.height}_alignContentVertically(){const e=new W.e;if(e.isVertical=!0,X.MZ.IsDocumentAvailable()&&document.createElement&&this._imageUrl){const t=new z.E;t.source=this._imageUrl,t.heightInPixels=180,t.widthInPixels=100,t.paddingTopInPixels=40,t.paddingBottomInPixels=40,e.addControl(t)}if(this._text){const t=new H.a;t.text=this._text,t.color="white",t.heightInPixels=30,t.fontSize=24,e.addControl(t)}return e}_alignContentHorizontally(){let e=240;const t=15,i=new Ne.A;i.widthInPixels=e,i.heightInPixels=e,i.color="transparent",i.setPaddingInPixels(t,t,t,t),e-=30;const n=new W.e;if(n.isVertical=!1,n.scaleY=this._getAspectRatio(),X.MZ.IsDocumentAvailable()&&document.createElement&&this._imageUrl){const t=new Ne.A(`${this.name}_image`);t.widthInPixels=this.imageSizeInPixels,t.heightInPixels=this.imageSizeInPixels,t.color="transparent",e-=this.imageSizeInPixels;const i=new z.E;i.source=this._imageUrl,t.addControl(i),n.addControl(t)}if(this._text){const i=new H.a(`${this.name}_text`);if(i.text=this._text,i.color="white",i.fontSize=this.textSizeInPixels,i.widthInPixels=e,this._imageUrl&&(i.textHorizontalAlignment=$.o.HORIZONTAL_ALIGNMENT_LEFT,i.paddingLeftInPixels=t),this._subtext){const r=new Ie.r;r.addColumnDefinition(1),r.addRowDefinition(.5),r.addRowDefinition(.5),r.widthInPixels=e,r.heightInPixels=45;const s=new H.a(`${this.name}_subtext`);s.text=this._subtext,s.color="#EEEEEEAB",s.fontSize=.75*this.textSizeInPixels,s.fontWeight="600",this._imageUrl&&(s.textHorizontalAlignment=$.o.HORIZONTAL_ALIGNMENT_LEFT,s.paddingLeftInPixels=t),r.addControl(i,0),r.addControl(s,1),n.addControl(r)}else n.addControl(i)}return i.addControl(n),i}_createNode(e){var t;this.name=null!==(t=this.name)&&void 0!==t?t:"TouchHolographicButton";const i=this._createBackPlate(e),n=this._createFrontPlate(e),s=this._createInnerQuad(e),o=this._createBackGlow(e);this._frontPlateCollisionMesh=n,this._textPlate=super._createNode(e),this._textPlate.name=`${this.name}_textPlate`,this._textPlate.isPickable=!1,this._textPlate.scaling.x=this.width,this._textPlate.parent=n,this._backPlate=i,this._backPlate.position=a.P.Forward(e.useRightHandedSystem).scale(this.backPlateDepth/2),this._backPlate.isPickable=!1,this._backPlate.addChild(n),this._backPlate.addChild(s),o&&this._backPlate.addChild(o);const l=new r.Y(`${this.name}_root`,e);return this._backPlate.setParent(l),this.collisionMesh=n,this.collidableFrontDirection=this._backPlate.forward.negate(),l}_createBackPlate(e){const t=(0,f.NR)(`${this.name}_backPlate`,{},e);return t.isPickable=!1,t.visibility=0,t.scaling.z=.2,V.n.ImportMeshAsync(void 0,Le.MRTK_ASSET_BASE_URL,Le.BACKPLATE_MODEL_FILENAME,e).then((e=>{const i=e.meshes[1];i.visibility=0,this._isBackplateVisible&&(i.visibility=1,i.name=`${this.name}_backPlate`,i.isPickable=!1,i.scaling.x=this.width,i.scaling.y=this.height,i.parent=t),this._backMaterial&&(i.material=this._backMaterial),this._backPlate=i})),t}_createFrontPlate(e){const t=(0,f.NR)(`${this.name}_frontPlate`,{width:this.width,height:this.height,depth:this.frontPlateDepth},e);return t.isPickable=!0,t.isNearPickable=!0,t.visibility=0,t.position=a.P.Forward(e.useRightHandedSystem).scale((this.backPlateDepth-this.frontPlateDepth)/2),V.n.ImportMeshAsync(void 0,Le.MRTK_ASSET_BASE_URL,Le.FRONTPLATE_MODEL_FILENAME,e).then((i=>{const n=(0,f.NR)(`${this.name}_collisionPlate`,{width:this.width,height:this.height},e);n.isPickable=!1,n.scaling.z=this.frontPlateDepth,n.visibility=0,n.parent=t,this._collisionPlate=n;const r=i.meshes[1];r.name=`${this.name}_frontPlate`,r.isPickable=!1,r.scaling.x=this.width-this.backGlowOffset,r.scaling.y=this.height-this.backGlowOffset,r.position=a.P.Forward(e.useRightHandedSystem).scale(-.5),r.parent=n,this.isToggleButton&&(r.visibility=0),this._frontMaterial&&(r.material=this._frontMaterial),this._textPlate.scaling.x=1,this._textPlate.parent=r,this._frontPlate=r})),t}_createInnerQuad(e){const t=(0,f.NR)(`${this.name}_innerQuad`,{},e);return t.isPickable=!1,t.visibility=0,t.scaling.z=this.flatPlaneDepth,t.position.z+=this.backPlateDepth/2-this.flatPlaneDepth,V.n.ImportMeshAsync(void 0,Le.MRTK_ASSET_BASE_URL,Le.INNERQUAD_MODEL_FILENAME,e).then((e=>{const i=e.meshes[1];i.name=`${this.name}_innerQuad`,i.isPickable=!1,i.scaling.x=this.width-this.backGlowOffset,i.scaling.y=this.height-this.backGlowOffset,i.parent=t,this._innerQuadMaterial&&(i.material=this._innerQuadMaterial),this._innerQuad=i})),t}_createBackGlow(e){if(this.isToggleButton)return;const t=(0,f.NR)(`${this.name}_backGlow`,{},e);return t.isPickable=!1,t.visibility=0,t.scaling.z=this.flatPlaneDepth,t.position.z+=this.backPlateDepth/2-2*this.flatPlaneDepth,V.n.ImportMeshAsync(void 0,Le.MRTK_ASSET_BASE_URL,Le.BACKGLOW_MODEL_FILENAME,e).then((e=>{const i=e.meshes[1];i.name=`${this.name}_backGlow`,i.isPickable=!1,i.scaling.x=this.width-this.backGlowOffset,i.scaling.y=this.height-this.backGlowOffset,i.parent=t,this._backGlowMaterial&&(i.material=this._backGlowMaterial),this._backGlow=i})),t}_applyFacade(e){this._plateMaterial.emissiveTexture=e,this._plateMaterial.opacityTexture=e,this._plateMaterial.diffuseColor=this.plateMaterialColor}_performClickAnimation(){const e=new Pe.O("Click Animation Group"),t=[{name:"backGlowMotion",mesh:this._backGlow,property:"material.motion",keys:[{frame:0,values:[0,0,0]},{frame:20,values:[1,.0144,.0144]},{frame:40,values:[.0027713229489760476,0,0]},{frame:45,values:[.0027713229489760476]}]},{name:"_collisionPlateZSlide",mesh:this._collisionPlate,property:"position.z",keys:[{frame:0,values:[0,0,0]},{frame:20,values:[a.P.Forward(this._collisionPlate._scene.useRightHandedSystem).scale(this.frontPlateDepth/2).z,0,0]},{frame:40,values:[0,.005403332496794331]},{frame:45,values:[0]}]},{name:"_collisionPlateZScale",mesh:this._collisionPlate,property:"scaling.z",keys:[{frame:0,values:[this.frontPlateDepth,0,0]},{frame:20,values:[this.backPlateDepth,0,0]},{frame:40,values:[this.frontPlateDepth,.0054]},{frame:45,values:[this.frontPlateDepth]}]}];for(const i of t){const t=new Re.f(i.name,i.property,60,Re.f.ANIMATIONTYPE_FLOAT,Re.f.ANIMATIONLOOPMODE_CYCLE),n=[];for(const e of i.keys)n.push({frame:e.frame,value:e.values[0],inTangent:e.values[1],outTangent:e.values[2],interpolation:e.values[3]});t.setKeys(n),i.mesh&&e.addTargetedAnimation(t,i.mesh)}e.normalize(0,45),e.speedRatio=1,e.play()}_performEnterExitAnimation(e){const t=new Pe.O("Enter Exit Animation Group"),i=[{name:"frontPlateFadeOut",mesh:this._frontPlate,property:"material.fadeOut",keys:[{frame:0,values:[0,0,.025045314830017686,0]},{frame:40,values:[1.00205599570012,.025045314830017686,0,0]}]},{name:"textPlateZSlide",mesh:this._textPlate,property:"position.z",keys:[{frame:0,values:[0,0,0]},{frame:40,values:[a.P.Forward(this._textPlate._scene.useRightHandedSystem).scale(-.15).z,0,0]}]}];for(const e of i){const i=new Re.f(e.name,e.property,60,Re.f.ANIMATIONTYPE_FLOAT,Re.f.ANIMATIONLOOPMODE_CYCLE),n=[];for(const t of e.keys)n.push({frame:t.frame,value:t.values[0],inTangent:t.values[1],outTangent:t.values[2],interpolation:t.values[3]});i.setKeys(n),e.mesh&&t.addTargetedAnimation(i,e.mesh)}t.normalize(0,45),t.speedRatio=e,t.play()}_createBackMaterial(e){var t;this._backMaterial=null!==(t=this._backMaterial)&&void 0!==t?t:new Te(this.name+"backPlateMaterial",e.getScene()),this._backMaterial.absoluteSizes=!0,this._backMaterial.radius=this.radius,this._backMaterial.lineWidth=.02}_createFrontMaterial(e){var t;this._frontMaterial=null!==(t=this._frontMaterial)&&void 0!==t?t:new we(this.name+"Front Material",e.getScene()),this.frontMaterial.radius=this.innerQuadRadius,this.frontMaterial.fadeOut=0}_createBackGlowMaterial(e){var t;const i=this.radius+.04;this._backGlowMaterial=null!==(t=this._backGlowMaterial)&&void 0!==t?t:new De(this.name+"Back Glow Material",e.getScene()),this._backGlowMaterial.bevelRadius=i,this._backGlowMaterial.lineWidth=i,this._backGlowMaterial.motion=0}_createInnerQuadMaterial(e){var t;this._innerQuadMaterial=null!==(t=this._innerQuadMaterial)&&void 0!==t?t:new Be("inner_quad",e.getScene()),this._innerQuadMaterial.radius=this.innerQuadRadius,this.isToggleButton&&(this._innerQuadMaterial.color=this.innerQuadColor)}_createPlateMaterial(e){var t;this._plateMaterial=null!==(t=this._plateMaterial)&&void 0!==t?t:new m.K(this.name+"Plate Material",e.getScene()),this._plateMaterial.specularColor=g.Wo.Black()}_onToggle(e){super._onToggle(e)}_affectMaterial(e){this._shareMaterials?(this._host._touchSharedMaterials.mrdlBackplateMaterial?this._backMaterial=this._host._touchSharedMaterials.mrdlBackplateMaterial:(this._createBackMaterial(e),this._host._touchSharedMaterials.mrdlBackplateMaterial=this._backMaterial),this._host._touchSharedMaterials.mrdlFrontplateMaterial?this._frontMaterial=this._host._touchSharedMaterials.mrdlFrontplateMaterial:(this._createFrontMaterial(e),this._host._touchSharedMaterials.mrdlFrontplateMaterial=this._frontMaterial),this._host._touchSharedMaterials.mrdlBackglowMaterial?this._backGlowMaterial=this._host._touchSharedMaterials.mrdlBackglowMaterial:(this._createBackGlowMaterial(e),this._host._touchSharedMaterials.mrdlBackglowMaterial=this._backGlowMaterial),this._host._touchSharedMaterials.mrdlInnerQuadMaterial?this._innerQuadMaterial=this._host._touchSharedMaterials.mrdlInnerQuadMaterial:(this._createInnerQuadMaterial(e),this._host._touchSharedMaterials.mrdlInnerQuadMaterial=this._innerQuadMaterial)):(this._createBackMaterial(e),this._createFrontMaterial(e),this._createBackGlowMaterial(e),this._createInnerQuadMaterial(e)),this._createPlateMaterial(e),this._backPlate.material=this._backMaterial,this._textPlate.material=this._plateMaterial,this._isBackplateVisible||(this._backPlate.visibility=0),this._frontPlate&&(this._frontPlate.material=this._frontMaterial),this._backGlow&&(this._backGlow.material=this._backGlowMaterial),this._innerQuad&&(this._innerQuad.material=this._innerQuadMaterial),this._rebuildContent()}dispose(){super.dispose(),this._disposeTooltip(),this.onPointerClickObservable.remove(this._pointerClickObserver),this.onPointerEnterObservable.remove(this._pointerEnterObserver),this.onPointerOutObservable.remove(this._pointerOutObserver),this.onToggleObservable.remove(this._toggleObserver),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._backGlowMaterial.dispose(),this._innerQuadMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))}}Le.MRTK_ASSET_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",Le.FRONTPLATE_MODEL_FILENAME="mrtk-fluent-frontplate.glb",Le.BACKPLATE_MODEL_FILENAME="mrtk-fluent-backplate.glb",Le.BACKGLOW_MODEL_FILENAME="mrtk-fluent-button.glb",Le.INNERQUAD_MODEL_FILENAME="SlateProximity.glb";var ke=i("../../../node_modules/@babylonjs/core/Lights/hemisphericLight.js"),Ve=i("../../../node_modules/@babylonjs/core/Rendering/utilityLayerRenderer.js"),Ue=i("../../../node_modules/@babylonjs/core/Engines/engineStore.js");class Ge{constructor(e){this._customControlScaling=1,this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new o.y$,this.onPickingObservable=new o.y$,this._sharedMaterials={},this._touchSharedMaterials={},this._scene=e||Ue.l.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((()=>{this._sceneDisposeObserver=null,this._utilityLayer=null,this.dispose()})),this._utilityLayer=Ve.x._CreateDefaultUtilityLayerFromScene(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.mainSceneTrackerPredicate=e=>{var t,i,n;return e&&(null===(n=null===(i=null===(t=e.reservedDataStore)||void 0===t?void 0:t.GUI3D)||void 0===i?void 0:i.control)||void 0===n?void 0:n._node)},this._rootContainer=new y("RootContainer"),this._rootContainer._host=this;const t=this._utilityLayer.utilityLayerScene;this._pointerOutObserver=this._utilityLayer.onPointerOutObservable.add((e=>{this._handlePointerOut(e,!0)})),this._pointerObserver=t.onPointerObservable.add((e=>{this._doPicking(e)})),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new ke.e("hemi",a.P.Up(),this._utilityLayer.utilityLayerScene)}get scene(){return this._scene}get utilityLayer(){return this._utilityLayer}get controlScaling(){return this._customControlScaling}set controlScaling(e){if(this._customControlScaling!==e&&e>0){const t=e/this._customControlScaling;this._customControlScaling=e,this._rootContainer.children.forEach((i=>{i.scaling.scaleInPlace(t),1!==e&&(i._isScaledByManager=!0)}))}}get useRealisticScaling(){return this.controlScaling===Ge.MRTK_REALISTIC_SCALING}set useRealisticScaling(e){this.controlScaling=e?Ge.MRTK_REALISTIC_SCALING:1}_handlePointerOut(e,t){const i=this._lastControlOver[e];i&&(i._onPointerOut(i),delete this._lastControlOver[e]),t&&this._lastControlDown[e]&&(this._lastControlDown[e].forcePointerUp(),delete this._lastControlDown[e]),this.onPickedPointChangedObservable.notifyObservers(null)}_doPicking(e){var t,i,n;if(!this._utilityLayer||!this._utilityLayer.shouldRender||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;const r=e.event,s=r.pointerId||0,o=r.button,a=e.pickInfo;if(a&&this.onPickingObservable.notifyObservers(a.pickedMesh),!a||!a.hit)return this._handlePointerOut(s,e.type===l.kD.POINTERUP),!1;a.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(a.pickedPoint);const c=null===(i=null===(t=a.pickedMesh.reservedDataStore)||void 0===t?void 0:t.GUI3D)||void 0===i?void 0:i.control;return c&&!c._processObservables(e.type,a.pickedPoint,(null===(n=a.originMesh)||void 0===n?void 0:n.position)||null,s,o)&&e.type===l.kD.POINTERMOVE&&(this._lastControlOver[s]&&this._lastControlOver[s]._onPointerOut(this._lastControlOver[s]),delete this._lastControlOver[s]),e.type===l.kD.POINTERUP&&(this._lastControlDown[r.pointerId]&&(this._lastControlDown[r.pointerId].forcePointerUp(),delete this._lastControlDown[r.pointerId]),"touch"===r.pointerType&&this._handlePointerOut(s,!1)),!0}get rootContainer(){return this._rootContainer}containsControl(e){return this._rootContainer.containsControl(e)}addControl(e){return this._rootContainer.addControl(e),1!==this._customControlScaling&&(e.scaling.scaleInPlace(this._customControlScaling),e._isScaledByManager=!0),this}removeControl(e){return this._rootContainer.removeControl(e),e._isScaledByManager&&(e.scaling.scaleInPlace(1/this._customControlScaling),e._isScaledByManager=!1),this}dispose(){this._rootContainer.dispose();for(const e in this._sharedMaterials)Object.prototype.hasOwnProperty.call(this._sharedMaterials,e)&&this._sharedMaterials[e].dispose();this._sharedMaterials={};for(const e in this._touchSharedMaterials)Object.prototype.hasOwnProperty.call(this._touchSharedMaterials,e)&&this._touchSharedMaterials[e].dispose();this._touchSharedMaterials={},this._pointerOutObserver&&this._utilityLayer&&(this._utilityLayer.onPointerOutObservable.remove(this._pointerOutObserver),this._pointerOutObserver=null),this.onPickedPointChangedObservable.clear(),this.onPickingObservable.clear();const e=this._utilityLayer?this._utilityLayer.utilityLayerScene:null;e&&this._pointerObserver&&(e.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=null),this._scene&&this._sceneDisposeObserver&&(this._scene.onDisposeObservable.remove(this._sceneDisposeObserver),this._sceneDisposeObserver=null),this._utilityLayer&&this._utilityLayer.dispose()}}Ge.MRTK_REALISTIC_SCALING=.032},"../../../node_modules/@babylonjs/loaders/OBJ/index.d.ts":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Maths/math.color.js"),r=i("../../../node_modules/@babylonjs/core/Materials/Textures/texture.js"),s=i("../../../node_modules/@babylonjs/core/Materials/standardMaterial.js");class o{constructor(){this.materials=[]}parseMTL(e,t,i,r){if(t instanceof ArrayBuffer)return;const a=t.split("\n"),l=/\s+/;let c,h=null;for(let t=0;t=0?_.substring(0,d):_;u=u.toLowerCase();const p=d>=0?_.substring(d+1).trim():"";if("newmtl"===u)h&&this.materials.push(h),e._blockEntityCollection=!!r,h=new s.K(p,e),h._parentContainer=r,e._blockEntityCollection=!1;else if("kd"===u&&h)c=p.split(l,3).map(parseFloat),h.diffuseColor=n.Wo.FromArray(c);else if("ka"===u&&h)c=p.split(l,3).map(parseFloat),h.ambientColor=n.Wo.FromArray(c);else if("ks"===u&&h)c=p.split(l,3).map(parseFloat),h.specularColor=n.Wo.FromArray(c);else if("ke"===u&&h)c=p.split(l,3).map(parseFloat),h.emissiveColor=n.Wo.FromArray(c);else if("ns"===u&&h)h.specularPower=parseFloat(p);else if("d"===u&&h)h.alpha=parseFloat(p);else if("map_ka"===u&&h)h.ambientTexture=o._GetTexture(i,p,e);else if("map_kd"===u&&h)h.diffuseTexture=o._GetTexture(i,p,e);else if("map_ks"===u&&h)h.specularTexture=o._GetTexture(i,p,e);else if("map_ns"===u);else if("map_bump"===u&&h){const t=p.split(l),n=t.indexOf("-bm");let r=null;n>=0&&(r=t[n+1],t.splice(n,2)),h.bumpTexture=o._GetTexture(i,t.join(" "),e),h.bumpTexture&&null!==r&&(h.bumpTexture.level=parseFloat(r))}else"map_d"===u&&h&&(h.opacityTexture=o._GetTexture(i,p,e))}h&&this.materials.push(h)}static _GetTexture(e,t,i){if(!t)return null;let n=e;if("file:"===e){let e=t.lastIndexOf("\\");-1===e&&(e=t.lastIndexOf("/")),n+=e>-1?t.substr(e+1):t}else n+=t;return new r.x(n,i,!1,o.INVERT_TEXTURE_Y)}}o.INVERT_TEXTURE_Y=!0;var a=i("../../../node_modules/@babylonjs/core/Buffers/buffer.js"),l=i("../../../node_modules/@babylonjs/core/Maths/math.vector.js"),c=i("../../../node_modules/@babylonjs/core/Meshes/geometry.js"),h=i("../../../node_modules/@babylonjs/core/Meshes/mesh.js"),_=i("../../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js");class d{constructor(e,t,i){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new n.HE(.5,.5,.5,1),this._materialToUse=e,this._babylonMeshesArray=t,this._loadingOptions=i}_isInArray(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[]});const i=e[t[0]].normals.indexOf(t[1]);return-1===i?-1:e[t[0]].idx[i]}_isInArrayUV(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[],uv:[]});const i=e[t[0]].normals.indexOf(t[1]);return 1!=i&&t[2]===e[t[0]].uv[i]?e[t[0]].idx[i]:-1}_setData(e,t,i,n,r,s,o){let a;a=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[e,i,t]):this._isInArray(this._tuplePosNorm,[e,i]),-1===a?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(n),this._wrappedUvsForBabylon.push(r),this._wrappedNormalsForBabylon.push(s),void 0!==o&&this._wrappedColorsForBabylon.push(o),this._tuplePosNorm[e].normals.push(i),this._tuplePosNorm[e].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[e].uv.push(t)):this._indicesForBabylon.push(a)}_unwrapData(){for(let e=0;e0&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice(),this._handledMesh.uvs=this._unwrappedUVForBabylon.slice(),this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0)}_optimizeNormals(e){const t=e.getVerticesData(a.o.PositionKind),i=e.getVerticesData(a.o.NormalKind),n={};if(!t||!i)return;for(let e=0;e=7){const e=parseFloat(i[4]),t=parseFloat(i[5]),r=parseFloat(i[6]);this._colors.push(new n.HE(e>1?e/255:e,t>1?t/255:t,r>1?r/255:r,7===i.length||void 0===i[7]?1:parseFloat(i[7])))}else this._colors.push(this._grayColor)}else if(null!==(i=d.NormalPattern.exec(t)))this._normals.push(new l.P(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3])));else if(null!==(i=d.UVPattern.exec(t)))this._uvs.push(new l.FM(parseFloat(i[1])*this._loadingOptions.UVScaling.x,parseFloat(i[2])*this._loadingOptions.UVScaling.y));else if(null!==(i=d.FacePattern3.exec(t)))this._setDataForCurrentFaceWithPattern3(i[1].trim().split(" "),1);else if(null!==(i=d.FacePattern4.exec(t)))this._setDataForCurrentFaceWithPattern4(i[1].trim().split(" "),1);else if(null!==(i=d.FacePattern5.exec(t)))this._setDataForCurrentFaceWithPattern5(i[1].trim().split(" "),1);else if(null!==(i=d.FacePattern2.exec(t)))this._setDataForCurrentFaceWithPattern2(i[1].trim().split(" "),1);else if(null!==(i=d.FacePattern1.exec(t)))this._setDataForCurrentFaceWithPattern1(i[1].trim().split(" "),1);else if(d.GroupDescriptor.test(t)||d.ObjectDescriptor.test(t)){const e={name:t.substring(2).trim(),indices:void 0,positions:void 0,normals:void 0,uvs:void 0,colors:void 0,materialName:this._materialNameFromObj};this._addPreviousObjMesh(),this._meshesFromObj.push(e),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1}else if(d.UseMtlDescriptor.test(t)){if(this._materialNameFromObj=t.substring(7).trim(),!this._isFirstMaterial||!this._hasMeshes){this._addPreviousObjMesh();const e={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:void 0,positions:void 0,normals:void 0,uvs:void 0,colors:void 0,materialName:this._materialNameFromObj};this._increment++,this._meshesFromObj.push(e),this._hasMeshes=!0}this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)}else d.MtlLibGroupDescriptor.test(t)?o(t.substring(7).trim()):d.SmoothDescriptor.test(t)||console.log("Unhandled expression at line : "+t)}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._handledMesh.normals=this._unwrappedNormalsForBabylon,this._handledMesh.uvs=this._unwrappedUVForBabylon,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon)),!this._hasMeshes){let e=null;if(this._indicesForBabylon.length)this._indicesForBabylon.reverse(),this._unwrapData();else{for(const e of this._positions)this._unwrappedPositionsForBabylon.push(e.x,e.y,e.z);if(this._normals.length)for(const e of this._normals)this._unwrappedNormalsForBabylon.push(e.x,e.y,e.z);if(this._uvs.length)for(const e of this._uvs)this._unwrappedUVForBabylon.push(e.x,e.y);if(this._colors.length)for(const e of this._colors)this._unwrappedColorsForBabylon.push(e.r,e.g,e.b,e.a);this._materialNameFromObj||(e=new s.K(c.Z.RandomId(),i),e.pointsCloud=!0,this._materialNameFromObj=e.name,this._normals.length||(e.disableLighting=!0,e.emissiveColor=n.Wo.White()))}this._meshesFromObj.push({name:c.Z.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:e})}for(let t=0;t{n(r,t)}))}createPlugin(){return new m(m._DefaultLoadingOptions)}canDirectLoad(){return!1}importMeshAsync(e,t,i,n){return this._parseSolid(e,t,i,n).then((e=>({meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[]})))}loadAsync(e,t,i){return this.importMeshAsync(null,e,t,i).then((()=>{}))}loadAssetContainerAsync(e,t,i){const n=new f.TJ(e);return this._assetContainer=n,this.importMeshAsync(null,e,t,i).then((e=>(e.meshes.forEach((e=>n.meshes.push(e))),e.meshes.forEach((e=>{const t=e.material;t&&-1==n.materials.indexOf(t)&&(n.materials.push(t),t.getActiveTextures().forEach((e=>{-1==n.textures.indexOf(e)&&n.textures.push(e)})))})),this._assetContainer=null,n))).catch((e=>{throw this._assetContainer=null,e}))}_parseSolid(e,t,i,n){let r="";const s=new o,a=new Array,l=[];new d(a,l,this._loadingOptions).parse(e,i,t,this._assetContainer,(e=>{r=e}));const c=[];return""===r||this._loadingOptions.skipMaterials||c.push(new Promise(((e,i)=>{this._loadMTL(r,n,(o=>{try{s.parseMTL(t,o,n,this._assetContainer);for(let e=0;e-1;)i.push(n),t=n+1;if(-1===n&&0===i.length)s.materials[e].dispose();else for(let t=0;t{u.w1.Warn(`Error downloading MTL file: '${r}'`),this._loadingOptions.materialLoadingFailsSilently?e():i(n)}))}))),Promise.all(c).then((()=>l))}}m.OPTIMIZE_WITH_UV=!0,m.INVERT_Y=!1,m.IMPORT_VERTEX_COLORS=!1,m.COMPUTE_NORMALS=!1,m.OPTIMIZE_NORMALS=!1,m.UV_SCALING=new l.FM(1,1),m.SKIP_MATERIALS=!1,m.MATERIAL_LOADING_FAILS_SILENTLY=!0,p.n&&p.n.RegisterPlugin(new m)},"../../../node_modules/@babylonjs/loaders/glTF/index.d.ts":function(e,t,i){"use strict";var n=i("../../../node_modules/@babylonjs/core/Misc/observable.js"),r=i("../../../node_modules/@babylonjs/core/Misc/tools.js"),s=i("../../../node_modules/@babylonjs/core/Loading/sceneLoader.js"),o=i("../../../node_modules/@babylonjs/core/assetContainer.js"),a=i("../../../node_modules/@babylonjs/core/Misc/logger.js"),l=i("../../../node_modules/@babylonjs/core/Misc/dataReader.js");function c(e,t,i,n){const r={externalResourceFunction:e=>n(e).then((e=>new Uint8Array(e)))};return i&&(r.uri="file:"===t?i:t+i),e instanceof ArrayBuffer?GLTFValidator.validateBytes(new Uint8Array(e),r):GLTFValidator.validateString(e,r)}function h(){const e=[];onmessage=t=>{const i=t.data;switch(i.id){case"init":importScripts(i.url);break;case"validate":c(i.data,i.rootUrl,i.fileName,(t=>new Promise(((i,n)=>{const r=e.length;e.push({resolve:i,reject:n}),postMessage({id:"getExternalResource",index:r,uri:t})})))).then((e=>{postMessage({id:"validate.resolve",value:e})}),(e=>{postMessage({id:"validate.reject",reason:e})}));break;case"getExternalResource.resolve":e[i.index].resolve(i.value);break;case"getExternalResource.reject":e[i.index].reject(i.reason)}}}class _{static ValidateAsync(e,t,i,n){return"function"==typeof Worker?new Promise(((r,s)=>{const o=`${c}(${h})()`,a=URL.createObjectURL(new Blob([o],{type:"application/javascript"})),l=new Worker(a),_=e=>{l.removeEventListener("error",_),l.removeEventListener("message",d),s(e)},d=e=>{const t=e.data;switch(t.id){case"getExternalResource":n(t.uri).then((e=>{l.postMessage({id:"getExternalResource.resolve",index:t.index,value:e},[e])}),(e=>{l.postMessage({id:"getExternalResource.reject",index:t.index,reason:e})}));break;case"validate.resolve":l.removeEventListener("error",_),l.removeEventListener("message",d),r(t.value),l.terminate();break;case"validate.reject":l.removeEventListener("error",_),l.removeEventListener("message",d),s(t.reason),l.terminate()}};l.addEventListener("error",_),l.addEventListener("message",d),l.postMessage({id:"init",url:this.Configuration.url}),l.postMessage({id:"validate",data:e,rootUrl:t,fileName:i})})):(this._LoadScriptPromise||(this._LoadScriptPromise=r.w1.LoadScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((()=>c(e,t,i,n))))}}_.Configuration={url:"https://preview.babylonjs.com/gltf_validator.js"};var d,u,p,f,m,g,b,y,v,A,C,S=i("../../../node_modules/@babylonjs/core/Misc/fileTools.js"),x=i("../../../node_modules/@babylonjs/core/Misc/error.js");function T(e,t,i){try{return Promise.resolve(new Uint8Array(e,t,i))}catch(e){return Promise.reject(e)}}!function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"}(d||(d={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"}(u||(u={})),function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"}(p||(p={}));class E{constructor(){this.onParsedObservable=new n.y$,this.coordinateSystemMode=d.AUTO,this.animationStartMode=u.FIRST,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this.useRangeRequests=!1,this.createInstances=!0,this.alwaysComputeBoundingBox=!1,this.loadAllMaterials=!1,this.loadOnlyMaterials=!1,this.skipMaterials=!1,this.useSRGBBuffers=!0,this.targetFps=60,this.alwaysComputeSkeletonRootNode=!1,this.preprocessUrlAsync=e=>Promise.resolve(e),this.onMeshLoadedObservable=new n.y$,this.onSkinLoadedObservable=new n.y$,this.onTextureLoadedObservable=new n.y$,this.onMaterialLoadedObservable=new n.y$,this.onCameraLoadedObservable=new n.y$,this.onCompleteObservable=new n.y$,this.onErrorObservable=new n.y$,this.onDisposeObservable=new n.y$,this.onExtensionLoadedObservable=new n.y$,this.validate=!1,this.onValidatedObservable=new n.y$,this._loader=null,this._state=null,this._requests=new Array,this.name="gltf",this.extensions={".gltf":{isBinary:!1},".glb":{isBinary:!0}},this.onLoaderStateChangedObservable=new n.y$,this._logIndentLevel=0,this._loggingEnabled=!1,this._log=this._logDisabled,this._capturePerformanceCounters=!1,this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled}set onParsed(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),this._onParsedObserver=this.onParsedObservable.add(e)}set onMeshLoaded(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e)}set onTextureLoaded(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e)}set onMaterialLoaded(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e)}set onCameraLoaded(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e)}set onComplete(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)}set onError(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}set onExtensionLoaded(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)}get loggingEnabled(){return this._loggingEnabled}set loggingEnabled(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)}get capturePerformanceCounters(){return this._capturePerformanceCounters}set capturePerformanceCounters(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))}set onValidated(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)}dispose(){this._loader&&(this._loader.dispose(),this._loader=null);for(const e of this._requests)e.abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=e=>Promise.resolve(e),this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()}loadFile(e,t,i,s,o,c){this._progressCallback=s;const h=t.name?"file:":r.w1.GetFolderPath(t),_=t.name||r.w1.GetFilename(t);if(o){if(this.useRangeRequests){this.validate&&a.Y.Warn("glTF validation is not supported when range requests are enabled");const r={abort:()=>{},onCompleteObservable:new n.y$},s={readAsync:(i,n)=>new Promise(((r,s)=>{this._loadFile(e,t,(e=>{r(new Uint8Array(e))}),!0,(e=>{s(e)}),(e=>{e.setRequestHeader("Range",`bytes=${i}-${i+n-1}`)}))})),byteLength:0};return this._unpackBinaryAsync(new l.d(s)).then((e=>{r.onCompleteObservable.notifyObservers(r),i(e)}),c?e=>c(void 0,e):void 0),r}return this._loadFile(e,t,(t=>{this._validate(e,t,h,_),this._unpackBinaryAsync(new l.d({readAsync:(e,i)=>T(t,e,i),byteLength:t.byteLength})).then((e=>{i(e)}),c?e=>c(void 0,e):void 0)}),!0,c)}return this._loadFile(e,t,(t=>{this._validate(e,t,h,_),i({json:this._parseJson(t)})}),o,c)}importMeshAsync(e,t,i,n,r,s){return Promise.resolve().then((()=>(this.onParsedObservable.notifyObservers(i),this.onParsedObservable.clear(),this._log(`Loading ${s||""}`),this._loader=this._getLoader(i),this._loader.importMeshAsync(e,t,null,i,n,r,s))))}loadAsync(e,t,i,n,r){return Promise.resolve().then((()=>(this.onParsedObservable.notifyObservers(t),this.onParsedObservable.clear(),this._log(`Loading ${r||""}`),this._loader=this._getLoader(t),this._loader.loadAsync(e,t,i,n,r))))}loadAssetContainerAsync(e,t,i,n,r){return Promise.resolve().then((()=>{this.onParsedObservable.notifyObservers(t),this.onParsedObservable.clear(),this._log(`Loading ${r||""}`),this._loader=this._getLoader(t);const s=new o.TJ(e),a=[];this.onMaterialLoadedObservable.add((e=>{a.push(e)}));const l=[];this.onTextureLoadedObservable.add((e=>{l.push(e)}));const c=[];return this.onCameraLoadedObservable.add((e=>{c.push(e)})),this._loader.importMeshAsync(null,e,s,t,i,n,r).then((e=>(Array.prototype.push.apply(s.geometries,e.geometries),Array.prototype.push.apply(s.meshes,e.meshes),Array.prototype.push.apply(s.particleSystems,e.particleSystems),Array.prototype.push.apply(s.skeletons,e.skeletons),Array.prototype.push.apply(s.animationGroups,e.animationGroups),Array.prototype.push.apply(s.materials,a),Array.prototype.push.apply(s.textures,l),Array.prototype.push.apply(s.lights,e.lights),Array.prototype.push.apply(s.transformNodes,e.transformNodes),Array.prototype.push.apply(s.cameras,c),s)))}))}canDirectLoad(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+E._MagicBase64Encoded)||e.startsWith("data:;base64,"+E._MagicBase64Encoded)||e.startsWith("data:application/octet-stream;base64,"+E._MagicBase64Encoded)||e.startsWith("data:model/gltf-binary;base64,"+E._MagicBase64Encoded)}directLoad(e,t){if(t.startsWith("base64,"+E._MagicBase64Encoded)||t.startsWith(";base64,"+E._MagicBase64Encoded)||t.startsWith("application/octet-stream;base64,"+E._MagicBase64Encoded)||t.startsWith("model/gltf-binary;base64,"+E._MagicBase64Encoded)){const i=(0,S.$K)(t);return this._validate(e,i),this._unpackBinaryAsync(new l.d({readAsync:(e,t)=>T(i,e,t),byteLength:i.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})}createPlugin(){return new E}get loaderState(){return this._state}whenCompleteAsync(){return new Promise(((e,t)=>{this.onCompleteObservable.addOnce((()=>{e()})),this.onErrorObservable.addOnce((e=>{t(e)}))}))}_setState(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(p[this._state]))}_loadFile(e,t,i,n,r,s){const o=e._loadFile(t,i,(e=>{this._onProgress(e,o)}),!0,n,r,s);return o.onCompleteObservable.add((e=>{this._requests.splice(this._requests.indexOf(e),1)})),this._requests.push(o),o}_onProgress(e,t){if(!this._progressCallback)return;t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;let i=!0,n=0,r=0;for(const e of this._requests){if(void 0===e._lengthComputable||void 0===e._loaded||void 0===e._total)return;i=i&&e._lengthComputable,n+=e._loaded,r+=e._total}this._progressCallback({lengthComputable:i,loaded:n,total:i?r:0})}_validate(e,t,i="",n=""){this.validate&&(this._startPerformanceCounter("Validate JSON"),_.ValidateAsync(t,i,n,(t=>this.preprocessUrlAsync(i+t).then((t=>e._loadFileAsync(t,void 0,!0,!0))))).then((e=>{this._endPerformanceCounter("Validate JSON"),this.onValidatedObservable.notifyObservers(e),this.onValidatedObservable.clear()}),(e=>{this._endPerformanceCounter("Validate JSON"),r.w1.Warn(`Failed to validate: ${e.message}`),this.onValidatedObservable.clear()})))}_getLoader(e){const t=e.json.asset||{};this._log(`Asset version: ${t.version}`),t.minVersion&&this._log(`Asset minimum version: ${t.minVersion}`),t.generator&&this._log(`Asset generator: ${t.generator}`);const i=E._parseVersion(t.version);if(!i)throw new Error("Invalid version: "+t.version);if(void 0!==t.minVersion){const e=E._parseVersion(t.minVersion);if(!e)throw new Error("Invalid minimum version: "+t.minVersion);if(E._compareVersion(e,{major:2,minor:0})>0)throw new Error("Incompatible minimum version: "+t.minVersion)}const n={1:E._CreateGLTF1Loader,2:E._CreateGLTF2Loader}[i.major];if(!n)throw new Error("Unsupported version: "+t.version);return n(this)}_parseJson(e){this._startPerformanceCounter("Parse JSON"),this._log(`JSON length: ${e.length}`);const t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t}_unpackBinaryAsync(e){return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((()=>{const t=e.readUint32();if(1179937895!==t)throw new x.LH("Unexpected magic: "+t,x.SM.GLTFLoaderUnexpectedMagicError);const i=e.readUint32();this.loggingEnabled&&this._log(`Binary version: ${i}`);const n=e.readUint32();if(0!==e.buffer.byteLength&&n!==e.buffer.byteLength)throw new Error(`Length in header does not match actual data length: ${n} != ${e.buffer.byteLength}`);let r;switch(i){case 1:r=this._unpackBinaryV1Async(e,n);break;case 2:r=this._unpackBinaryV2Async(e,n);break;default:throw new Error("Unsupported version: "+i)}return this._endPerformanceCounter("Unpack Binary"),r}))}_unpackBinaryV1Async(e,t){const i=e.readUint32(),n=e.readUint32();if(0!==n)throw new Error(`Unexpected content format: ${n}`);const r=t-e.byteOffset,s={json:this._parseJson(e.readString(i)),bin:null};if(0!==r){const t=e.byteOffset;s.bin={readAsync:(i,n)=>e.buffer.readAsync(t+i,n),byteLength:r}}return Promise.resolve(s)}_unpackBinaryV2Async(e,t){const i=1313821514,n=e.readUint32();if(e.readUint32()!==i)throw new Error("First chunk format is not JSON");return e.byteOffset+n===t?e.loadAsync(n).then((()=>({json:this._parseJson(e.readString(n)),bin:null}))):e.loadAsync(n+8).then((()=>{const r={json:this._parseJson(e.readString(n)),bin:null},s=()=>{const n=e.readUint32();switch(e.readUint32()){case i:throw new Error("Unexpected JSON chunk");case 5130562:{const t=e.byteOffset;r.bin={readAsync:(i,n)=>e.buffer.readAsync(t+i,n),byteLength:n},e.skipBytes(n);break}default:e.skipBytes(n)}return e.byteOffset!==t?e.loadAsync(8).then(s):Promise.resolve(r)};return s()}))}static _parseVersion(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};const t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null}static _compareVersion(e,t){return e.major>t.major?1:e.majort.minor?1:e.minors.byteLength)throw new Error("Buffer access is out of range");const o=s.buffer;switch(i+=s.byteOffset,r){case f.BYTE:return new Int8Array(o,i,n);case f.UNSIGNED_BYTE:return new Uint8Array(o,i,n);case f.SHORT:return new Int16Array(o,i,n);case f.UNSIGNED_SHORT:return new Uint16Array(o,i,n);default:return new Float32Array(o,i,n)}}static GetBufferFromAccessor(e,t){const i=e.bufferViews[t.bufferView],n=t.count*K.GetByteStrideFromType(t);return K.GetBufferFromBufferView(e,i,t.byteOffset,n,t.componentType)}static DecodeBufferToText(e){let t="";const i=e.byteLength;for(let n=0;n=this._maxPos}}const ee=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],te=["world","view","projection","worldView","worldViewProjection","mBones"],ie=["translation","rotation","scale"],ne=["position","rotationQuaternion","scaling"],re=(e,t,i)=>{for(const n in e){const r=e[n];i[t][n]=r}},se=e=>{if(e)for(let t=0;t{if("NORMAL"===e.semantic)return"normal";if("POSITION"===e.semantic)return"position";if("JOINT"===e.semantic)return"matricesIndices";if("WEIGHT"===e.semantic)return"matricesWeights";if("COLOR"===e.semantic)return"color";if(e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")){const t=Number(e.semantic.split("_")[1]);return"uv"+(0===t?"":t+1)}return null},ae=e=>{let t=null;if(e.translation||e.rotation||e.scale){const i=R.P.FromArray(e.scale||[1,1,1]),n=R._f.FromArray(e.rotation||[0,0,0,1]),r=R.P.FromArray(e.translation||[0,0,0]);t=R.y3.Compose(i,n,r)}else t=R.y3.FromArray(e.matrix);return t},le=(e,t,i,n)=>{for(let e=0;e{for(let i=0;i{const i=e.nodes;let n=i[t];if(n)return{node:n,id:t};for(const e in i)if(n=i[e],n.jointName===t)return{node:n,id:e};return null},_e=(e,t)=>{for(let i=0;i{if(r||(e.scene._blockEntityCollection=!!e.assetContainer,(r=new H.Kj(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,r.id=n),!t.babylonNode)return r;const s=[];let o=null;const a=new Array,l=new Array,c=new Array,h=new Array;for(let t=0;t1?(_=new N.G("multimat"+n,e.scene),_.subMaterials=s):_=new L.K("multimat"+n,e.scene),1===s.length&&(_=s[0]),_._parentContainer=e.assetContainer,r.material||(r.material=_),new j.Z(n,e.scene,o,!1,r),r.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,r.subMeshes=[];let d=0;for(let t=0;t{e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=i),e.scaling&&(e.scaling=n)},pe=(e,t,i)=>{let n=null;if(e.importOnlyMeshes&&(t.skin||t.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){const s=e.skins[t.skin],o=de(e,t,t.meshes,i,t.babylonNode);o.skeleton=e.scene.getLastSkeletonById(t.skin),null===o.skeleton&&(o.skeleton=((e,t,i,n)=>{if(n||(n=new w.O(t.name||"","",e.scene)),!t.babylonSkeleton)return n;const s=[],o=[];((e,t,i,n)=>{for(const r in e.nodes){const s=e.nodes[r],o=r;if(!s.jointName||_e(i,s.jointName))continue;const a=ae(s),l=new O.N(s.name||"",t,null,a);l.id=o,n.push({bone:l,node:s,id:o})}for(let e=0;e0&&(d=ce(s,c),d&&-1===o.indexOf(d)&&o.push(d)),new O.N(l.jointName||"",n,d,u).id=c}const a=n.bones;n.bones=[];for(let i=0;i{if(t.matrix){const i=new R.P(0,0,0),n=new R._f,r=new R.P(0,0,0);R.y3.FromArray(t.matrix).decompose(r,n,i),ue(e,i,n,r)}else t.translation&&t.rotation&&t.scale&&ue(e,R.P.FromArray(t.translation),R._f.FromArray(t.rotation),R.P.FromArray(t.scale));e.computeWorldMatrix(!0)})(n,t);else{const e=t.translation||[0,0,0],i=t.rotation||[0,0,0,1],r=t.scale||[1,1,1];ue(n,R.P.FromArray(e),R._f.FromArray(i),R.P.FromArray(r))}n.updateCache(!0),t.babylonNode=n}return n},fe=(e,t,i,n=!1)=>{const r=e.nodes[t];let s=null;if(n=!(e.importOnlyMeshes&&!n&&e.importMeshesNames)||-1!==e.importMeshesNames.indexOf(r.name||"")||0===e.importMeshesNames.length,!r.jointName&&n&&(s=pe(e,r,t),null!==s&&(s.id=t,s.parent=i)),r.children)for(let t=0;t{let t=e.currentScene;if(t)for(let i=0;i{for(const t in e.animations){const i=e.animations[t];if(!i.channels||!i.samplers)continue;let n=null;for(let s=0;s{for(const n in t.uniforms){const r=t.uniforms[n],s=t.parameters[r];if(e.currentIdentifier===n&&s.semantic&&!s.source&&!s.node){const e=ee.indexOf(s.semantic);if(-1!==e)return delete i[n],te[e]}}return e.currentIdentifier},be=e=>{for(const t in e.materials)Ae.LoadMaterialAsync(e,t,(()=>{}),(()=>{}))};class ye{static CreateRuntime(e,t,i){const n={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:i,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null};return e.extensions&&re(e.extensions,"extensions",n),e.extensionsUsed&&re(e.extensionsUsed,"extensionsUsed",n),e.buffers&&((e,t)=>{for(const i in e){const n=e[i];t.buffers[i]=n,t.buffersCount++}})(e.buffers,n),e.bufferViews&&re(e.bufferViews,"bufferViews",n),e.accessors&&re(e.accessors,"accessors",n),e.meshes&&re(e.meshes,"meshes",n),e.lights&&re(e.lights,"lights",n),e.cameras&&re(e.cameras,"cameras",n),e.nodes&&re(e.nodes,"nodes",n),e.images&&re(e.images,"images",n),e.textures&&re(e.textures,"textures",n),e.shaders&&((e,t)=>{for(const i in e){const n=e[i];t.shaders[i]=n,t.shaderscount++}})(e.shaders,n),e.programs&&re(e.programs,"programs",n),e.samplers&&re(e.samplers,"samplers",n),e.techniques&&re(e.techniques,"techniques",n),e.materials&&re(e.materials,"materials",n),e.animations&&re(e.animations,"animations",n),e.skins&&re(e.skins,"skins",n),e.scenes&&(n.scenes=e.scenes),e.scene&&e.scenes&&(n.currentScene=e.scenes[e.scene]),n}static LoadBufferAsync(e,t,i,n,s){const o=e.buffers[t];r.w1.IsBase64(o.uri)?setTimeout((()=>i(new Uint8Array(r.w1.DecodeBase64(o.uri))))):r.w1.LoadFile(e.rootUrl+o.uri,(e=>i(new Uint8Array(e))),s,void 0,!0,(e=>{e&&n(e.status+" "+e.statusText)}))}static LoadTextureBufferAsync(e,t,i,n){const s=e.textures[t];if(!s||!s.source)return void n("");if(s.babylonTexture)return void i(null);const o=e.images[s.source];r.w1.IsBase64(o.uri)?setTimeout((()=>i(new Uint8Array(r.w1.DecodeBase64(o.uri))))):r.w1.LoadFile(e.rootUrl+o.uri,(e=>i(new Uint8Array(e))),void 0,void 0,!0,(e=>{e&&n(e.status+" "+e.statusText)}))}static CreateTextureAsync(e,t,i,n){const r=e.textures[t];if(r.babylonTexture)return void n(r.babylonTexture);const s=e.samplers[r.sampler],o=s.minFilter===y.NEAREST_MIPMAP_NEAREST||s.minFilter===y.NEAREST_MIPMAP_LINEAR||s.minFilter===y.LINEAR_MIPMAP_NEAREST||s.minFilter===y.LINEAR_MIPMAP_LINEAR,a=V.x.BILINEAR_SAMPLINGMODE,l=null==i?new Blob:new Blob([i]),c=URL.createObjectURL(l),h=()=>URL.revokeObjectURL(c),_=new V.x(c,e.scene,!o,!0,a,h,h);void 0!==s.wrapS&&(_.wrapU=K.GetWrapMode(s.wrapS)),void 0!==s.wrapT&&(_.wrapV=K.GetWrapMode(s.wrapT)),_.name=t,r.babylonTexture=_,n(_)}static LoadShaderStringAsync(e,t,i,n){const s=e.shaders[t];if(r.w1.IsBase64(s.uri)){const e=atob(s.uri.split(",")[1]);i&&i(e)}else r.w1.LoadFile(e.rootUrl+s.uri,i,void 0,void 0,!1,(e=>{e&&n&&n(e.status+" "+e.statusText)}))}static LoadMaterialAsync(e,t,i,n){const r=e.materials[t];if(!r.technique)return void(n&&n("No technique found."));const s=e.techniques[r.technique];if(!s){e.scene._blockEntityCollection=!!e.assetContainer;const n=new L.K(t,e.scene);return n._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,n.diffuseColor=new P.Wo(.5,.5,.5),n.sideOrientation=B.F.CounterClockWiseSideOrientation,void i(n)}const o=e.programs[s.program],a=s.states,l=F.Q.ShadersStore[o.vertexShader+"VertexShader"],c=F.Q.ShadersStore[o.fragmentShader+"PixelShader"];let h="",_="";const d=new J(l),u=new J(c),p={},f=[],m=[],b=[];for(const e in s.uniforms){const t=s.uniforms[e],i=s.parameters[t];if(p[e]=i,!i.semantic||i.node||i.source)i.type===g.SAMPLER_2D?b.push(e):f.push(e);else{const t=ee.indexOf(i.semantic);-1!==t?(f.push(te[t]),delete p[e]):f.push(e)}}for(const e in s.attributes){const t=s.attributes[e],i=s.parameters[t];if(i.semantic){const e=oe(i);e&&m.push(e)}}for(;!d.isEnd()&&d.getNextToken();){if(d.currentToken!==Z.IDENTIFIER){h+=d.currentString;continue}let e=!1;for(const t in s.attributes){const i=s.attributes[t],n=s.parameters[i];if(d.currentIdentifier===t&&n.semantic){h+=oe(n),e=!0;break}}e||(h+=ge(d,s,p))}for(;!u.isEnd()&&u.getNextToken();)u.currentToken===Z.IDENTIFIER?_+=ge(u,s,p):_+=u.currentString;const y={vertex:o.vertexShader+t,fragment:o.fragmentShader+t},v={attributes:m,uniforms:f,samplers:b,needAlphaBlending:a&&a.enable&&-1!==a.enable.indexOf(3042)};F.Q.ShadersStore[o.vertexShader+t+"VertexShader"]=h,F.Q.ShadersStore[o.fragmentShader+t+"PixelShader"]=_;const S=new k.j(t,e.scene,y,v);if(S.onError=((e,t,i)=>(n,r)=>{t.dispose(!0),i("Cannot compile program named "+e.name+". Error: "+r+". Default material will be applied")})(o,S,n),S.onCompiled=((e,t,i,n,r,s)=>o=>{((e,t,i,n,r)=>{const s=n.values||i.parameters,o=i.uniforms;for(const i in r){const a=r[i],l=a.type;let c=s[o[i]];if(void 0===c&&(c=a.value),!c)continue;const h=e=>i=>{a.value&&e&&(t.setTexture(e,i),delete r[e])};l===g.SAMPLER_2D?Ae.LoadTextureAsync(e,n.values?c:a.value,h(i),(()=>h(null))):a.value&&K.SetUniform(t,i,n.values?c:a.value,l)&&delete r[i]}})(e,t,i,n,r),t.onBind=o=>{((e,t,i,n,r,s,o)=>{const a=s.values||r.parameters;for(const o in i){const l=i[o],c=l.type;if(c===g.FLOAT_MAT2||c===g.FLOAT_MAT3||c===g.FLOAT_MAT4)if(!l.semantic||l.source||l.node){if(l.semantic&&(l.source||l.node)){let e=t.scene.getNodeByName(l.source||l.node||"");if(null===e&&(e=t.scene.getNodeById(l.source||l.node||"")),null===e)continue;K.SetMatrix(t.scene,e,l,o,n.getEffect())}}else K.SetMatrix(t.scene,e,l,o,n.getEffect());else{const e=a[r.uniforms[o]];if(!e)continue;if(c===g.SAMPLER_2D){const i=t.textures[s.values?e:l.value].babylonTexture;if(null==i)continue;n.getEffect().setTexture(o,i)}else K.SetUniform(n.getEffect(),o,e,c)}}o(n)})(o,e,r,t,i,n,s)}})(e,S,s,r,p,i),S.sideOrientation=B.F.CounterClockWiseSideOrientation,a&&a.functions){const e=a.functions;e.cullFace&&e.cullFace[0]!==A.BACK&&(S.backFaceCulling=!1);const t=e.blendFuncSeparate;t&&(t[0]===C.SRC_ALPHA&&t[1]===C.ONE_MINUS_SRC_ALPHA&&t[2]===C.ONE&&t[3]===C.ONE?S.alphaMode=$.g.ALPHA_COMBINE:t[0]===C.ONE&&t[1]===C.ONE&&t[2]===C.ZERO&&t[3]===C.ONE?S.alphaMode=$.g.ALPHA_ONEONE:t[0]===C.SRC_ALPHA&&t[1]===C.ONE&&t[2]===C.ZERO&&t[3]===C.ONE?S.alphaMode=$.g.ALPHA_ADD:t[0]===C.ZERO&&t[1]===C.ONE_MINUS_SRC_COLOR&&t[2]===C.ONE&&t[3]===C.ONE?S.alphaMode=$.g.ALPHA_SUBTRACT:t[0]===C.DST_COLOR&&t[1]===C.ZERO&&t[2]===C.ONE&&t[3]===C.ONE?S.alphaMode=$.g.ALPHA_MULTIPLY:t[0]===C.SRC_ALPHA&&t[1]===C.ONE_MINUS_SRC_COLOR&&t[2]===C.ONE&&t[3]===C.ONE&&(S.alphaMode=$.g.ALPHA_MAXIMIZED))}}}class ve{static RegisterExtension(e){ve.Extensions[e.name]?r.w1.Error('Tool with the same name "'+e.name+'" already exists'):ve.Extensions[e.name]=e}dispose(){}_importMeshAsync(e,t,i,n,s,o,a,l){return t.useRightHandedSystem=!0,Ae.LoadRuntimeAsync(t,i,n,(t=>{t.assetContainer=s,t.importOnlyMeshes=!0,""===e?t.importMeshesNames=[]:"string"==typeof e?t.importMeshesNames=[e]:!e||e instanceof Array?(t.importMeshesNames=[],r.w1.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[e],this._createNodes(t);const i=new Array,n=new Array;for(const e in t.nodes){const n=t.nodes[e];n.babylonNode instanceof z.x&&i.push(n.babylonNode)}for(const e in t.skins){const i=t.skins[e];i.babylonSkeleton instanceof w.O&&n.push(i.babylonSkeleton)}this._loadBuffersAsync(t,(()=>{this._loadShadersAsync(t,(()=>{be(t),me(t),!E.IncrementalLoading&&o&&o(i,n)}))})),E.IncrementalLoading&&o&&o(i,n)}),l),!0}importMeshAsync(e,t,i,n,r,s){return new Promise(((o,a)=>{this._importMeshAsync(e,t,n,r,i,((e,t)=>{o({meshes:e,particleSystems:[],skeletons:t,animationGroups:[],lights:[],transformNodes:[],geometries:[]})}),s,(e=>{a(new Error(e))}))}))}_loadAsync(e,t,i,n,r,s){e.useRightHandedSystem=!0,Ae.LoadRuntimeAsync(e,t,i,(e=>{Ae.LoadRuntimeExtensionsAsync(e,(()=>{this._createNodes(e),this._loadBuffersAsync(e,(()=>{this._loadShadersAsync(e,(()=>{be(e),me(e),E.IncrementalLoading||n()}))})),E.IncrementalLoading&&n()}),s)}),s)}loadAsync(e,t,i,n){return new Promise(((r,s)=>{this._loadAsync(e,t,i,(()=>{r()}),n,(e=>{s(new Error(e))}))}))}_loadShadersAsync(e,t){let i=!1;const n=(i,n)=>{Ae.LoadShaderStringAsync(e,i,(r=>{r instanceof ArrayBuffer||(e.loadedShaderCount++,r&&(F.Q.ShadersStore[i+(n.type===m.VERTEX?"VertexShader":"PixelShader")]=r),e.loadedShaderCount===e.shaderscount&&t())}),(()=>{r.w1.Error("Error when loading shader program named "+i+" located at "+n.uri)}))};for(const t in e.shaders){i=!0;const s=e.shaders[t];s?n.bind(this,t,s)():r.w1.Error("No shader named: "+t)}i||t()}_loadBuffersAsync(e,t){let i=!1;const n=(i,n)=>{Ae.LoadBufferAsync(e,i,(s=>{e.loadedBufferCount++,s&&(s.byteLength!=e.buffers[i].byteLength&&r.w1.Error("Buffer named "+i+" is length "+s.byteLength+". Expected: "+n.byteLength),e.loadedBufferViews[i]=s),e.loadedBufferCount===e.buffersCount&&t()}),(()=>{r.w1.Error("Error when loading buffer named "+i+" located at "+n.uri)}))};for(const t in e.buffers){i=!0;const s=e.buffers[t];s?n.bind(this,t,s)():r.w1.Error("No buffer named: "+t)}i||t()}_createNodes(e){let t=e.currentScene;if(t)for(let i=0;is.loadRuntimeAsync(e,t,i,n,r)),(()=>{setTimeout((()=>{n&&n(ye.CreateRuntime(t.json,e,i))}))}))}static LoadRuntimeExtensionsAsync(e,t,i){Ae._ApplyExtensions((n=>n.loadRuntimeExtensionsAsync(e,t,i)),(()=>{setTimeout((()=>{t()}))}))}static LoadBufferAsync(e,t,i,n,r){Ae._ApplyExtensions((s=>s.loadBufferAsync(e,t,i,n,r)),(()=>{ye.LoadBufferAsync(e,t,i,n,r)}))}static LoadTextureAsync(e,t,i,n){Ae._LoadTextureBufferAsync(e,t,(r=>{r&&Ae._CreateTextureAsync(e,t,r,i,n)}),n)}static LoadShaderStringAsync(e,t,i,n){Ae._ApplyExtensions((r=>r.loadShaderStringAsync(e,t,i,n)),(()=>{ye.LoadShaderStringAsync(e,t,i,n)}))}static LoadMaterialAsync(e,t,i,n){Ae._ApplyExtensions((r=>r.loadMaterialAsync(e,t,i,n)),(()=>{ye.LoadMaterialAsync(e,t,i,n)}))}static _LoadTextureBufferAsync(e,t,i,n){Ae._ApplyExtensions((r=>r.loadTextureBufferAsync(e,t,i,n)),(()=>{ye.LoadTextureBufferAsync(e,t,i,n)}))}static _CreateTextureAsync(e,t,i,n,r){Ae._ApplyExtensions((s=>s.createTextureAsync(e,t,i,n,r)),(()=>{ye.CreateTextureAsync(e,t,i,n)}))}static _ApplyExtensions(e,t){for(const t in ve.Extensions)if(e(ve.Extensions[t]))return;t()}}E._CreateGLTF1Loader=()=>new ve,ve.RegisterExtension(new class extends Ae{constructor(){super("KHR_binary_glTF")}loadRuntimeAsync(e,t,i,n){const r=t.json.extensionsUsed;return!(!r||-1===r.indexOf(this.name)||!t.bin||(this._bin=t.bin,n(ye.CreateRuntime(t.json,e,i)),0))}loadBufferAsync(e,t,i,n){return-1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(i,(e=>n(e.message))),!0)}loadTextureBufferAsync(e,t,i){const n=e.textures[t],r=e.images[n.source];if(!r.extensions||!(this.name in r.extensions))return!1;const s=r.extensions[this.name],o=e.bufferViews[s.bufferView];return i(K.GetBufferFromBufferView(e,o,0,o.byteLength,f.UNSIGNED_BYTE)),!0}loadShaderStringAsync(e,t,i){const n=e.shaders[t];if(!n.extensions||!(this.name in n.extensions))return!1;const r=n.extensions[this.name],s=e.bufferViews[r.bufferView],o=K.GetBufferFromBufferView(e,s,0,s.byteLength,f.UNSIGNED_BYTE);return setTimeout((()=>{const e=K.DecodeBufferToText(o);i(e)})),!0}}),ve.RegisterExtension(new class extends Ae{constructor(){super("KHR_materials_common")}loadRuntimeExtensionsAsync(e){if(!e.extensions)return!1;const t=e.extensions[this.name];if(!t)return!1;const i=t.lights;if(i)for(const t in i){const n=i[t];switch(n.type){case"ambient":{const t=new X.e(n.name,new R.P(0,1,0),e.scene),i=n.ambient;i&&(t.diffuse=P.Wo.FromArray(i.color||[1,1,1]));break}case"point":{const t=new Q.c(n.name,new R.P(10,10,10),e.scene),i=n.point;i&&(t.diffuse=P.Wo.FromArray(i.color||[1,1,1]));break}case"directional":{const t=new Y.O(n.name,new R.P(0,-1,0),e.scene),i=n.directional;i&&(t.diffuse=P.Wo.FromArray(i.color||[1,1,1]));break}case"spot":{const t=n.spot;t&&(new q.P(n.name,new R.P(0,10,0),new R.P(0,-1,0),t.fallOffAngle||Math.PI,t.fallOffExponent||0,e.scene).diffuse=P.Wo.FromArray(t.color||[1,1,1]));break}default:r.w1.Warn('GLTF Material Common extension: light type "'+n.type+"” not supported")}}return!1}loadMaterialAsync(e,t,i,n){const r=e.materials[t];if(!r||!r.extensions)return!1;const s=r.extensions[this.name];if(!s)return!1;const o=new L.K(t,e.scene);return o.sideOrientation=B.F.CounterClockWiseSideOrientation,"CONSTANT"===s.technique&&(o.disableLighting=!0),o.backFaceCulling=void 0!==s.doubleSided&&!s.doubleSided,o.alpha=void 0===s.values.transparency?1:s.values.transparency,o.specularPower=void 0===s.values.shininess?0:s.values.shininess,"string"==typeof s.values.ambient?this._loadTexture(e,s.values.ambient,o,"ambientTexture",n):o.ambientColor=P.Wo.FromArray(s.values.ambient||[0,0,0]),"string"==typeof s.values.diffuse?this._loadTexture(e,s.values.diffuse,o,"diffuseTexture",n):o.diffuseColor=P.Wo.FromArray(s.values.diffuse||[0,0,0]),"string"==typeof s.values.emission?this._loadTexture(e,s.values.emission,o,"emissiveTexture",n):o.emissiveColor=P.Wo.FromArray(s.values.emission||[0,0,0]),"string"==typeof s.values.specular?this._loadTexture(e,s.values.specular,o,"specularTexture",n):o.specularColor=P.Wo.FromArray(s.values.specular||[0,0,0]),!0}_loadTexture(e,t,i,n,r){ye.LoadTextureBufferAsync(e,t,(r=>{ye.CreateTextureAsync(e,t,r,(e=>i[n]=e))}),r)}});var Ce=i("../../../node_modules/@babylonjs/core/Misc/deferred.js"),Se=i("../../../node_modules/@babylonjs/core/Animations/animationKey.js"),xe=i("../../../node_modules/@babylonjs/core/Animations/animationGroup.js"),Te=i("../../../node_modules/@babylonjs/core/Materials/PBR/pbrMaterial.js"),Ee=i("../../../node_modules/@babylonjs/core/Meshes/transformNode.js"),Re=i("../../../node_modules/@babylonjs/core/Morph/morphTarget.js"),Pe=i("../../../node_modules/@babylonjs/core/Morph/morphTargetManager.js"),Ie=i("../../../node_modules/@babylonjs/core/Culling/boundingInfo.js");function Me(e,t,i,n){return R.P.FromArray(t,i).scaleInPlace(n)}class De{constructor(e,t,i,n){this.type=e,this.name=t,this.getValue=i,this.getStride=n}_buildAnimation(e,t,i){const n=new D.f(e,this.name,t,this.type);return n.setKeys(i),n}}class Oe extends De{buildAnimations(e,t,i,n,r){r(e._babylonTransformNode,this._buildAnimation(t,i,n))}}const we={translation:[new Oe(D.f.ANIMATIONTYPE_VECTOR3,"position",Me,(()=>3))],rotation:[new Oe(D.f.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",(function(e,t,i,n){return R._f.FromArray(t,i).scaleInPlace(n)}),(()=>4))],scale:[new Oe(D.f.ANIMATIONTYPE_VECTOR3,"scaling",Me,(()=>3))],weights:[new class extends De{buildAnimations(e,t,i,n,r){if(e._numMorphTargets)for(let s=0;s({frame:e.frame,inTangent:e.inTangent?e.inTangent[s]:void 0,value:e.value[s],outTangent:e.outTangent?e.outTangent[s]:void 0,interpolation:e.interpolation})))),e._primitiveBabylonMeshes)for(const t of e._primitiveBabylonMeshes)if(t.morphTargetManager){const e=t.morphTargetManager.getTarget(s),i=o.clone();e.animations.push(i),r(e,i)}}}}(D.f.ANIMATIONTYPE_FLOAT,"influence",(function(e,t,i,n){const r=new Array(e._numMorphTargets);for(let e=0;ee._numMorphTargets))]};function Fe(...e){const t=e=>e&&"object"==typeof e;return e.reduce(((e,i)=>(Object.keys(i).forEach((n=>{const r=e[n],s=i[n];Array.isArray(r)&&Array.isArray(s)?e[n]=r.concat(...s):t(r)&&t(s)?e[n]=Fe(r,s):e[n]=s})),e)),{})}class Be{static Get(e,t,i){if(!t||null==i||!t[i])throw new Error(`${e}: Failed to find index (${i})`);return t[i]}static Assign(e){if(e)for(let t=0;te.dispose&&e.dispose())),this._extensions.length=0,this._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())}importMeshAsync(e,t,i,n,r,s,o=""){return Promise.resolve().then((()=>{this._babylonScene=t,this._assetContainer=i,this._loadData(n);let s=null;if(e){const t={};if(this._gltf.nodes)for(const e of this._gltf.nodes)e.name&&(t[e.name]=e.index);s=(e instanceof Array?e:[e]).map((e=>{const i=t[e];if(void 0===i)throw new Error(`Failed to find node '${e}'`);return i}))}return this._loadAsync(r,o,s,(()=>({meshes:this._getMeshes(),particleSystems:[],skeletons:this._getSkeletons(),animationGroups:this._getAnimationGroups(),lights:this._babylonLights,transformNodes:this._getTransformNodes(),geometries:this._getGeometries()})))}))}loadAsync(e,t,i,n,r=""){return Promise.resolve().then((()=>(this._babylonScene=e,this._loadData(t),this._loadAsync(i,r,null,(()=>{})))))}_loadAsync(e,t,i,n){return Promise.resolve().then((()=>{this._rootUrl=e,this._uniqueRootUrl=!e.startsWith("file:")&&t?e:`${e}${Date.now()}/`,this._fileName=t,this._loadExtensions(),this._checkExtensions();const s=`${p[p.LOADING]} => ${p[p.READY]}`,o=`${p[p.LOADING]} => ${p[p.COMPLETE]}`;this._parent._startPerformanceCounter(s),this._parent._startPerformanceCounter(o),this._parent._setState(p.LOADING),this._extensionsOnLoading();const a=new Array,l=this._babylonScene.blockMaterialDirtyMechanism;if(this._babylonScene.blockMaterialDirtyMechanism=!0,!this.parent.loadOnlyMaterials)if(i)a.push(this.loadSceneAsync("/nodes",{nodes:i,index:-1}));else if(null!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0]){const e=Be.Get("/scene",this._gltf.scenes,this._gltf.scene||0);a.push(this.loadSceneAsync(`/scenes/${e.index}`,e))}if(!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(let e=0;e{})))}return this._babylonScene.blockMaterialDirtyMechanism=l,this._parent.compileMaterials&&a.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&a.push(this._compileShadowGeneratorsAsync()),Promise.all(a).then((()=>(this._rootBabylonMesh&&this._rootBabylonMesh.setEnabled(!0),this._extensionsOnReady(),this._parent._setState(p.READY),this._startAnimations(),n()))).then((e=>(this._parent._endPerformanceCounter(s),r.w1.SetImmediate((()=>{this._disposed||Promise.all(this._completePromises).then((()=>{this._parent._endPerformanceCounter(o),this._parent._setState(p.COMPLETE),this._parent.onCompleteObservable.notifyObservers(void 0),this._parent.onCompleteObservable.clear(),this.dispose()}),(e=>{this._parent.onErrorObservable.notifyObservers(e),this._parent.onErrorObservable.clear(),this.dispose()}))})),e)))})).catch((e=>{throw this._disposed||(this._parent.onErrorObservable.notifyObservers(e),this._parent.onErrorObservable.clear(),this.dispose()),e}))}_loadData(e){if(this._gltf=e.json,this._setupData(),e.bin){const t=this._gltf.buffers;if(t&&t[0]&&!t[0].uri){const i=t[0];(i.byteLengthe.bin.byteLength)&&a.Y.Warn(`Binary buffer length (${i.byteLength}) from JSON does not match chunk length (${e.bin.byteLength})`),this._bin=e.bin}else a.Y.Warn("Unexpected BIN chunk")}}_setupData(){if(Be.Assign(this._gltf.accessors),Be.Assign(this._gltf.animations),Be.Assign(this._gltf.buffers),Be.Assign(this._gltf.bufferViews),Be.Assign(this._gltf.cameras),Be.Assign(this._gltf.images),Be.Assign(this._gltf.materials),Be.Assign(this._gltf.meshes),Be.Assign(this._gltf.nodes),Be.Assign(this._gltf.samplers),Be.Assign(this._gltf.scenes),Be.Assign(this._gltf.skins),Be.Assign(this._gltf.textures),this._gltf.nodes){const e={};for(const t of this._gltf.nodes)if(t.children)for(const i of t.children)e[i]=t.index;const t=this._createRootNode();for(const i of this._gltf.nodes){const n=e[i.index];i.parent=void 0===n?t:this._gltf.nodes[n]}}}_loadExtensions(){for(const e in Ne._RegisteredExtensions){const t=Ne._RegisteredExtensions[e].factory(this);t.name!==e&&a.Y.Warn(`The name of the glTF loader extension instance does not match the registered name: ${t.name} !== ${e}`),this._extensions.push(t),this._parent.onExtensionLoadedObservable.notifyObservers(t)}this._extensions.sort(((e,t)=>(e.order||Number.MAX_VALUE)-(t.order||Number.MAX_VALUE))),this._parent.onExtensionLoadedObservable.clear()}_checkExtensions(){if(this._gltf.extensionsRequired)for(const e of this._gltf.extensionsRequired)if(!this._extensions.some((t=>t.name===e&&t.enabled)))throw new Error(`Require extension ${e} is not available`)}_createRootNode(){this._babylonScene._blockEntityCollection=!!this._assetContainer,this._rootBabylonMesh=new H.Kj("__root__",this._babylonScene),this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);const e={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case d.AUTO:this._babylonScene.useRightHandedSystem||(e.rotation=[0,1,0,0],e.scale=[1,1,-1],Ne._LoadTransform(e,this._rootBabylonMesh));break;case d.FORCE_RIGHT_HANDED:this._babylonScene.useRightHandedSystem=!0;break;default:throw new Error(`Invalid coordinate system mode (${this._parent.coordinateSystemMode})`)}return this._parent.onMeshLoadedObservable.notifyObservers(this._rootBabylonMesh),e}loadSceneAsync(e,t){const i=this._extensionsLoadSceneAsync(e,t);if(i)return i;const n=new Array;if(this.logOpen(`${e} ${t.name||""}`),t.nodes)for(const i of t.nodes){const t=Be.Get(`${e}/nodes/${i}`,this._gltf.nodes,i);n.push(this.loadNodeAsync(`/nodes/${t.index}`,t,(e=>{e.parent=this._rootBabylonMesh})))}for(const e of this._postSceneLoadActions)e();return n.push(this._loadAnimationsAsync()),this.logClose(),Promise.all(n).then((()=>{}))}_forEachPrimitive(e,t){if(e._primitiveBabylonMeshes)for(const i of e._primitiveBabylonMeshes)t(i)}_getGeometries(){const e=new Array,t=this._gltf.nodes;if(t)for(const i of t)this._forEachPrimitive(i,(t=>{const i=t.geometry;i&&-1===e.indexOf(i)&&e.push(i)}));return e}_getMeshes(){const e=new Array;this._rootBabylonMesh&&e.push(this._rootBabylonMesh);const t=this._gltf.nodes;if(t)for(const i of t)this._forEachPrimitive(i,(t=>{e.push(t)}));return e}_getTransformNodes(){const e=new Array,t=this._gltf.nodes;if(t)for(const i of t)i._babylonTransformNode&&"TransformNode"===i._babylonTransformNode.getClassName()&&e.push(i._babylonTransformNode),i._babylonTransformNodeForSkin&&e.push(i._babylonTransformNodeForSkin);return e}_getSkeletons(){const e=new Array,t=this._gltf.skins;if(t)for(const i of t)i._data&&e.push(i._data.babylonSkeleton);return e}_getAnimationGroups(){const e=new Array,t=this._gltf.animations;if(t)for(const i of t)i._babylonAnimationGroup&&e.push(i._babylonAnimationGroup);return e}_startAnimations(){switch(this._parent.animationStartMode){case u.NONE:break;case u.FIRST:{const e=this._getAnimationGroups();0!==e.length&&e[0].start(!0);break}case u.ALL:{const e=this._getAnimationGroups();for(const t of e)t.start(!0);break}default:return void a.Y.Error(`Invalid animation start mode (${this._parent.animationStartMode})`)}}loadNodeAsync(e,t,i=(()=>{})){const n=this._extensionsLoadNodeAsync(e,t,i);if(n)return n;if(t._babylonTransformNode)throw new Error(`${e}: Invalid recursive node hierarchy`);const r=new Array;this.logOpen(`${e} ${t.name||""}`);const s=n=>{if(Ne.AddPointerMetadata(n,e),Ne._LoadTransform(t,n),null!=t.camera){const i=Be.Get(`${e}/camera`,this._gltf.cameras,t.camera);r.push(this.loadCameraAsync(`/cameras/${i.index}`,i,(e=>{e.parent=n})))}if(t.children)for(const i of t.children){const t=Be.Get(`${e}/children/${i}`,this._gltf.nodes,i);r.push(this.loadNodeAsync(`/nodes/${t.index}`,t,(e=>{e.parent=n})))}i(n)};if(null==t.mesh||null!=t.skin){const e=t.name||`node${t.index}`;this._babylonScene._blockEntityCollection=!!this._assetContainer;const i=new Ee.Y(e,this._babylonScene);i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==t.mesh?t._babylonTransformNode=i:t._babylonTransformNodeForSkin=i,s(i)}if(null!=t.mesh)if(null==t.skin){const i=Be.Get(`${e}/mesh`,this._gltf.meshes,t.mesh);r.push(this._loadMeshAsync(`/meshes/${i.index}`,t,i,s))}else{const i=Be.Get(`${e}/mesh`,this._gltf.meshes,t.mesh);r.push(this._loadMeshAsync(`/meshes/${i.index}`,t,i,(i=>{const n=t._babylonTransformNodeForSkin;i.metadata=Fe(n.metadata,i.metadata||{});const s=Be.Get(`${e}/skin`,this._gltf.skins,t.skin);r.push(this._loadSkinAsync(`/skins/${s.index}`,t,s,(e=>{this._forEachPrimitive(t,(t=>{t.skeleton=e})),this._postSceneLoadActions.push((()=>{if(null!=s.skeleton){const e=Be.Get(`/skins/${s.index}/skeleton`,this._gltf.nodes,s.skeleton).parent;t.index===e.index?i.parent=n.parent:i.parent=e._babylonTransformNode}else i.parent=this._rootBabylonMesh;this._parent.onSkinLoadedObservable.notifyObservers({node:n,skinnedNode:i})}))})))})))}return this.logClose(),Promise.all(r).then((()=>(this._forEachPrimitive(t,(e=>{e.geometry&&e.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0)})),t._babylonTransformNode)))}_loadMeshAsync(e,t,i,n){const r=i.primitives;if(!r||!r.length)throw new Error(`${e}: Primitives are missing`);null==r[0].index&&Be.Assign(r);const s=new Array;this.logOpen(`${e} ${i.name||""}`);const o=t.name||`node${t.index}`;if(1===r.length){const n=i.primitives[0];s.push(this._loadMeshPrimitiveAsync(`${e}/primitives/${n.index}`,o,t,i,n,(e=>{t._babylonTransformNode=e,t._primitiveBabylonMeshes=[e]})))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,t._babylonTransformNode=new Ee.Y(o,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[];for(const n of r)s.push(this._loadMeshPrimitiveAsync(`${e}/primitives/${n.index}`,`${o}_primitive${n.index}`,t,i,n,(e=>{e.parent=t._babylonTransformNode,t._primitiveBabylonMeshes.push(e)})))}return n(t._babylonTransformNode),this.logClose(),Promise.all(s).then((()=>t._babylonTransformNode))}_loadMeshPrimitiveAsync(e,t,i,n,r,s){const o=this._extensionsLoadMeshPrimitiveAsync(e,t,i,n,r,s);if(o)return o;this.logOpen(`${e}`);const a=0===this._disableInstancedMesh&&this._parent.createInstances&&null==i.skin&&!n.primitives[0].targets;let l,c;if(a&&r._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,l=r._instanceData.babylonSourceMesh.createInstance(t),l._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,c=r._instanceData.promise;else{const s=new Array;this._babylonScene._blockEntityCollection=!!this._assetContainer;const o=new H.Kj(t,this._babylonScene);o._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,o.overrideMaterialSideOrientation=this._babylonScene.useRightHandedSystem?B.F.CounterClockWiseSideOrientation:B.F.ClockWiseSideOrientation,this._createMorphTargets(e,i,n,r,o),s.push(this._loadVertexDataAsync(e,r,o).then((t=>this._loadMorphTargetsAsync(e,r,o,t).then((()=>{this._disposed||(this._babylonScene._blockEntityCollection=!!this._assetContainer,t.applyToMesh(o),t._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1)})))));const h=Ne._GetDrawMode(e,r.mode);if(null==r.material){let e=this._defaultBabylonMaterialData[h];e||(e=this._createDefaultMaterial("__GLTFLoader._default",h),this._parent.onMaterialLoadedObservable.notifyObservers(e),this._defaultBabylonMaterialData[h]=e),o.material=e}else if(!this.parent.skipMaterials){const t=Be.Get(`${e}/material`,this._gltf.materials,r.material);s.push(this._loadMaterialAsync(`/materials/${t.index}`,t,o,h,(e=>{o.material=e})))}c=Promise.all(s),a&&(r._instanceData={babylonSourceMesh:o,promise:c}),l=o}return Ne.AddPointerMetadata(l,e),this._parent.onMeshLoadedObservable.notifyObservers(l),s(l),this.logClose(),c.then((()=>l))}_loadVertexDataAsync(e,t,i){const n=this._extensionsLoadVertexDataAsync(e,t,i);if(n)return n;const r=t.attributes;if(!r)throw new Error(`${e}: Attributes are missing`);const s=new Array,o=new j.Z(i.name,this._babylonScene);if(null==t.indices)i.isUnIndexed=!0;else{const i=Be.Get(`${e}/indices`,this._gltf.accessors,t.indices);s.push(this._loadIndicesAccessorAsync(`/accessors/${i.index}`,i).then((e=>{o.setIndices(e)})))}const a=(t,n,a)=>{if(null==r[t])return;i._delayInfo=i._delayInfo||[],-1===i._delayInfo.indexOf(n)&&i._delayInfo.push(n);const l=Be.Get(`${e}/attributes/${t}`,this._gltf.accessors,r[t]);s.push(this._loadVertexAccessorAsync(`/accessors/${l.index}`,l,n).then((e=>{if(e.getKind()===G.o.PositionKind&&!this.parent.alwaysComputeBoundingBox&&!i.skeleton){const e=l.min,t=l.max;if(void 0!==e&&void 0!==t){if(l.normalized&&5126!==l.componentType){let i=1;switch(l.componentType){case 5120:i=127;break;case 5121:i=255;break;case 5122:i=32767;break;case 5123:i=65535}for(let n=0;n<3;++n)e[n]=Math.max(e[n]/i,-1),t[n]=Math.max(t[n]/i,-1)}const i=R.jp.Vector3[0],n=R.jp.Vector3[1];i.copyFromFloats(...e),n.copyFromFloats(...t),o._boundingInfo=new Ie.j(i,n),o.useBoundingInfoFromGeometry=!0}}o.setVerticesBuffer(e,l.count)}))),n==G.o.MatricesIndicesExtraKind&&(i.numBoneInfluencers=8),a&&a(l)};return a("POSITION",G.o.PositionKind),a("NORMAL",G.o.NormalKind),a("TANGENT",G.o.TangentKind),a("TEXCOORD_0",G.o.UVKind),a("TEXCOORD_1",G.o.UV2Kind),a("TEXCOORD_2",G.o.UV3Kind),a("TEXCOORD_3",G.o.UV4Kind),a("TEXCOORD_4",G.o.UV5Kind),a("TEXCOORD_5",G.o.UV6Kind),a("JOINTS_0",G.o.MatricesIndicesKind),a("WEIGHTS_0",G.o.MatricesWeightsKind),a("JOINTS_1",G.o.MatricesIndicesExtraKind),a("WEIGHTS_1",G.o.MatricesWeightsExtraKind),a("COLOR_0",G.o.ColorKind,(e=>{"VEC4"===e.type&&(i.hasVertexAlpha=!0)})),Promise.all(s).then((()=>o))}_createMorphTargets(e,t,i,n,r){if(!n.targets)return;if(null==t._numMorphTargets)t._numMorphTargets=n.targets.length;else if(n.targets.length!==t._numMorphTargets)throw new Error(`${e}: Primitives do not have the same number of targets`);const s=i.extras?i.extras.targetNames:null;r.morphTargetManager=new Pe.O(r.getScene()),r.morphTargetManager.areUpdatesFrozen=!0;for(let e=0;e{s.areUpdatesFrozen=!1}))}_loadMorphTargetVertexDataAsync(e,t,i,n){const r=new Array,s=(n,s,o)=>{if(null==i[n])return;const a=t.getVertexBuffer(s);if(!a)return;const l=Be.Get(`${e}/${n}`,this._gltf.accessors,i[n]);r.push(this._loadFloatAccessorAsync(`/accessors/${l.index}`,l).then((e=>{o(a,e)})))};return s("POSITION",G.o.PositionKind,((e,t)=>{const i=new Float32Array(t.length);e.forEach(t.length,((e,n)=>{i[n]=t[n]+e})),n.setPositions(i)})),s("NORMAL",G.o.NormalKind,((e,t)=>{const i=new Float32Array(t.length);e.forEach(i.length,((e,n)=>{i[n]=t[n]+e})),n.setNormals(i)})),s("TANGENT",G.o.TangentKind,((e,t)=>{const i=new Float32Array(t.length/3*4);let r=0;e.forEach(t.length/3*4,((e,n)=>{(n+1)%4!=0&&(i[r]=t[r]+e,r++)})),n.setTangents(i)})),Promise.all(r).then((()=>{}))}static _LoadTransform(e,t){if(null!=e.skin)return;let i=R.P.Zero(),n=R._f.Identity(),r=R.P.One();e.matrix?R.y3.FromArray(e.matrix).decompose(r,n,i):(e.translation&&(i=R.P.FromArray(e.translation)),e.rotation&&(n=R._f.FromArray(e.rotation)),e.scale&&(r=R.P.FromArray(e.scale))),t.position=i,t.rotationQuaternion=n,t.scaling=r}_loadSkinAsync(e,t,i,n){const r=this._extensionsLoadSkinAsync(e,t,i);if(r)return r;if(i._data)return n(i._data.babylonSkeleton),i._data.promise;const s=`skeleton${i.index}`;this._babylonScene._blockEntityCollection=!!this._assetContainer;const o=new w.O(i.name||s,s,this._babylonScene);o._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,i,o);const a=this._loadSkinInverseBindMatricesDataAsync(e,i).then((e=>{this._updateBoneMatrices(o,e)}));return i._data={babylonSkeleton:o,promise:a},n(o),a}_loadBones(e,t,i){if(null==t.skeleton||this._parent.alwaysComputeSkeletonRootNode){const i=this._findSkeletonRootNode(`${e}/joints`,t.joints);if(i)if(void 0===t.skeleton)t.skeleton=i.index;else{const n=(e,t)=>{for(;t.parent;t=t.parent)if(t.parent===e)return!0;return!1},r=Be.Get(`${e}/skeleton`,this._gltf.nodes,t.skeleton);r===i||n(r,i)||(a.Y.Warn(`${e}/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root`),t.skeleton=i.index)}else a.Y.Warn(`${e}: Failed to find common root`)}const n={};for(const r of t.joints){const s=Be.Get(`${e}/joints/${r}`,this._gltf.nodes,r);this._loadBone(s,t,i,n)}}_findSkeletonRootNode(e,t){if(0===t.length)return null;const i={};for(const n of t){const t=new Array;let r=Be.Get(`${e}/${n}`,this._gltf.nodes,n);for(;-1!==r.index;)t.unshift(r),r=r.parent;i[n]=t}let n=null;for(let e=0;;++e){let r=i[t[0]];if(e>=r.length)return n;const s=r[e];for(let o=1;o=r.length||s!==r[e])return n;n=s}}_loadBone(e,t,i,n){let r=n[e.index];if(r)return r;let s=null;e.index!==t.skeleton&&(e.parent&&-1!==e.parent.index?s=this._loadBone(e.parent,t,i,n):void 0!==t.skeleton&&a.Y.Warn(`/skins/${t.index}/skeleton: Skeleton node is not a common root`));const o=t.joints.indexOf(e.index);return r=new O.N(e.name||`joint${e.index}`,i,s,this._getNodeMatrix(e),null,null,o),n[e.index]=r,this._postSceneLoadActions.push((()=>{r.linkTransformNode(e._babylonTransformNode)})),r}_loadSkinInverseBindMatricesDataAsync(e,t){if(null==t.inverseBindMatrices)return Promise.resolve(null);const i=Be.Get(`${e}/inverseBindMatrices`,this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync(`/accessors/${i.index}`,i)}_updateBoneMatrices(e,t){for(const i of e.bones){const e=R.y3.Identity(),n=i._index;t&&-1!==n&&(R.y3.FromArrayToRef(t,16*n,e),e.invertToRef(e));const r=i.getParent();r&&e.multiplyToRef(r.getInvertedAbsoluteTransform(),e),i.updateMatrix(e,!1,!1),i._updateDifferenceMatrix(void 0,!1)}}_getNodeMatrix(e){return e.matrix?R.y3.FromArray(e.matrix):R.y3.Compose(e.scale?R.P.FromArray(e.scale):R.P.One(),e.rotation?R._f.FromArray(e.rotation):R._f.Identity(),e.translation?R.P.FromArray(e.translation):R.P.Zero())}loadCameraAsync(e,t,i=(()=>{})){const n=this._extensionsLoadCameraAsync(e,t,i);if(n)return n;const r=new Array;this.logOpen(`${e} ${t.name||""}`),this._babylonScene._blockEntityCollection=!!this._assetContainer;const s=new M.c(t.name||`camera${t.index}`,R.P.Zero(),this._babylonScene,!1);switch(s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,s.ignoreParentScaling=!0,t._babylonCamera=s,s.rotation=new R.P(0,Math.PI,0),t.type){case"perspective":{const i=t.perspective;if(!i)throw new Error(`${e}: Camera perspective properties are missing`);s.fov=i.yfov,s.minZ=i.znear,s.maxZ=i.zfar||0;break}case"orthographic":if(!t.orthographic)throw new Error(`${e}: Camera orthographic properties are missing`);s.mode=I.V.ORTHOGRAPHIC_CAMERA,s.orthoLeft=-t.orthographic.xmag,s.orthoRight=t.orthographic.xmag,s.orthoBottom=-t.orthographic.ymag,s.orthoTop=t.orthographic.ymag,s.minZ=t.orthographic.znear,s.maxZ=t.orthographic.zfar;break;default:throw new Error(`${e}: Invalid camera type (${t.type})`)}return Ne.AddPointerMetadata(s,e),this._parent.onCameraLoadedObservable.notifyObservers(s),i(s),this.logClose(),Promise.all(r).then((()=>s))}_loadAnimationsAsync(){const e=this._gltf.animations;if(!e)return Promise.resolve();const t=new Array;for(let i=0;i{0===e.targetedAnimations.length&&e.dispose()})))}return Promise.all(t).then((()=>{}))}loadAnimationAsync(e,t){const i=this._extensionsLoadAnimationAsync(e,t);if(i)return i;this._babylonScene._blockEntityCollection=!!this._assetContainer;const n=new xe.O(t.name||`animation${t.index}`,this._babylonScene);n._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._babylonAnimationGroup=n;const r=new Array;Be.Assign(t.channels),Be.Assign(t.samplers);for(const i of t.channels)r.push(this._loadAnimationChannelAsync(`${e}/channels/${i.index}`,e,t,i,((e,t)=>{e.animations=e.animations||[],e.animations.push(t),n.addTargetedAnimation(t,e)})));return Promise.all(r).then((()=>(n.normalize(0),n)))}_loadAnimationChannelAsync(e,t,i,n,r){const s=this._extensionsLoadAnimationChannelAsync(e,t,i,n,r);if(s)return s;if(null==n.target.node)return Promise.resolve();const o=Be.Get(`${e}/target/node`,this._gltf.nodes,n.target.node);if("weights"===n.target.path&&!o._numMorphTargets||"weights"!==n.target.path&&!o._babylonTransformNode)return Promise.resolve();let a;switch(n.target.path){case"translation":a=we.translation;break;case"rotation":a=we.rotation;break;case"scale":a=we.scale;break;case"weights":a=we.weights;break;default:throw new Error(`${e}/target/path: Invalid value (${n.target.path})`)}const l={target:o,properties:a};return this._loadAnimationChannelFromTargetInfoAsync(e,t,i,n,l,r)}_loadAnimationChannelFromTargetInfoAsync(e,t,i,n,r,s){const o=this.parent.targetFps,a=1/o,l=Be.Get(`${e}/sampler`,i.samplers,n.sampler);return this._loadAnimationSamplerAsync(`${t}/samplers/${n.sampler}`,l).then((e=>{let t=0;for(const l of r.properties){const c=l.getStride(r.target),h=e.input,_=e.output,d=new Array(h.length);let u=0;switch(e.interpolation){case"STEP":for(let e=0;e0){const e=`${i.name||`animation${i.index}`}_channel${n.index}_${t}`;l.buildAnimations(r.target,e,o,d,((e,i)=>{++t,s(e,i)}))}}}))}_loadAnimationSamplerAsync(e,t){if(t._data)return t._data;const i=t.interpolation||"LINEAR";switch(i){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw new Error(`${e}/interpolation: Invalid value (${t.interpolation})`)}const n=Be.Get(`${e}/input`,this._gltf.accessors,t.input),r=Be.Get(`${e}/output`,this._gltf.accessors,t.output);return t._data=Promise.all([this._loadFloatAccessorAsync(`/accessors/${n.index}`,n),this._loadFloatAccessorAsync(`/accessors/${r.index}`,r)]).then((([e,t])=>({input:e,interpolation:i,output:t}))),t._data}loadBufferAsync(e,t,i,n){const r=this._extensionsLoadBufferAsync(e,t,i,n);if(r)return r;if(!t._data)if(t.uri)t._data=this.loadUriAsync(`${e}/uri`,t,t.uri);else{if(!this._bin)throw new Error(`${e}: Uri is missing or the binary glTF is missing its binary chunk`);t._data=this._bin.readAsync(0,t.byteLength)}return t._data.then((t=>{try{return new Uint8Array(t.buffer,t.byteOffset+i,n)}catch(t){throw new Error(`${e}: ${t.message}`)}}))}loadBufferViewAsync(e,t){const i=this._extensionsLoadBufferViewAsync(e,t);if(i)return i;if(t._data)return t._data;const n=Be.Get(`${e}/buffer`,this._gltf.buffers,t.buffer);return t._data=this.loadBufferAsync(`/buffers/${n.index}`,n,t.byteOffset||0,t.byteLength),t._data}_loadAccessorAsync(e,t,i){if(t._data)return t._data;const n=Ne._GetNumComponents(e,t.type),r=n*G.o.GetTypeByteLength(t.componentType),s=n*t.count;if(null==t.bufferView)t._data=Promise.resolve(new i(s));else{const o=Be.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync(`/bufferViews/${o.index}`,o).then((a=>{if(5126!==t.componentType||t.normalized||o.byteStride&&o.byteStride!==r){const e=new i(s);return G.o.ForEach(a,t.byteOffset||0,o.byteStride||r,n,t.componentType,e.length,t.normalized||!1,((t,i)=>{e[i]=t})),e}return Ne._GetTypedArray(e,t.componentType,a,t.byteOffset,s)}))}if(t.sparse){const s=t.sparse;t._data=t._data.then((o=>{const a=o,l=Be.Get(`${e}/sparse/indices/bufferView`,this._gltf.bufferViews,s.indices.bufferView),c=Be.Get(`${e}/sparse/values/bufferView`,this._gltf.bufferViews,s.values.bufferView);return Promise.all([this.loadBufferViewAsync(`/bufferViews/${l.index}`,l),this.loadBufferViewAsync(`/bufferViews/${c.index}`,c)]).then((([o,l])=>{const c=Ne._GetTypedArray(`${e}/sparse/indices`,s.indices.componentType,o,s.indices.byteOffset,s.count),h=n*s.count;let _;if(5126!==t.componentType||t.normalized){const o=Ne._GetTypedArray(`${e}/sparse/values`,t.componentType,l,s.values.byteOffset,h);_=new i(h),G.o.ForEach(o,0,r,n,t.componentType,_.length,t.normalized||!1,((e,t)=>{_[t]=e}))}else _=Ne._GetTypedArray(`${e}/sparse/values`,t.componentType,l,s.values.byteOffset,h);let d=0;for(let e=0;eNe._GetTypedArray(e,t.componentType,i,t.byteOffset,t.count)))}return t._data}_loadVertexBufferViewAsync(e){if(e._babylonBuffer)return e._babylonBuffer;const t=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync(`/bufferViews/${e.index}`,e).then((e=>new G.l(t,e,!1))),e._babylonBuffer}_loadVertexAccessorAsync(e,t,i){var n;if(null===(n=t._babylonVertexBuffer)||void 0===n?void 0:n[i])return t._babylonVertexBuffer[i];t._babylonVertexBuffer||(t._babylonVertexBuffer={});const r=this._babylonScene.getEngine();if(t.sparse)t._babylonVertexBuffer[i]=this._loadFloatAccessorAsync(e,t).then((e=>new G.o(r,e,i,!1)));else if(i===G.o.MatricesIndicesKind||i===G.o.MatricesIndicesExtraKind)t._babylonVertexBuffer[i]=this._loadFloatAccessorAsync(e,t).then((e=>new G.o(r,e,i,!1)));else{const n=Be.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._babylonVertexBuffer[i]=this._loadVertexBufferViewAsync(n).then((s=>{const o=Ne._GetNumComponents(e,t.type);return new G.o(r,s,i,!1,!1,n.byteStride,!1,t.byteOffset,o,t.componentType,t.normalized,!0,1,!0)}))}return t._babylonVertexBuffer[i]}_loadMaterialMetallicRoughnessPropertiesAsync(e,t,i){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const n=new Array;return t&&(t.baseColorFactor?(i.albedoColor=P.Wo.FromArray(t.baseColorFactor),i.alpha=t.baseColorFactor[3]):i.albedoColor=P.Wo.White(),i.metallic=null==t.metallicFactor?1:t.metallicFactor,i.roughness=null==t.roughnessFactor?1:t.roughnessFactor,t.baseColorTexture&&n.push(this.loadTextureInfoAsync(`${e}/baseColorTexture`,t.baseColorTexture,(e=>{e.name=`${i.name} (Base Color)`,i.albedoTexture=e}))),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.nonColorData=!0,n.push(this.loadTextureInfoAsync(`${e}/metallicRoughnessTexture`,t.metallicRoughnessTexture,(e=>{e.name=`${i.name} (Metallic Roughness)`,i.metallicTexture=e}))),i.useMetallnessFromMetallicTextureBlue=!0,i.useRoughnessFromMetallicTextureGreen=!0,i.useRoughnessFromMetallicTextureAlpha=!1)),Promise.all(n).then((()=>{}))}_loadMaterialAsync(e,t,i,n,r=(()=>{})){const s=this._extensionsLoadMaterialAsync(e,t,i,n,r);if(s)return s;t._data=t._data||{};let o=t._data[n];if(!o){this.logOpen(`${e} ${t.name||""}`);const i=this.createMaterial(e,t,n);o={babylonMaterial:i,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(e,t,i)},t._data[n]=o,Ne.AddPointerMetadata(i,e),this._parent.onMaterialLoadedObservable.notifyObservers(i),this.logClose()}return i&&(o.babylonMeshes.push(i),i.onDisposeObservable.addOnce((()=>{const e=o.babylonMeshes.indexOf(i);-1!==e&&o.babylonMeshes.splice(e,1)}))),r(o.babylonMaterial),o.promise.then((()=>o.babylonMaterial))}_createDefaultMaterial(e,t){this._babylonScene._blockEntityCollection=!!this._assetContainer;const i=new Te.Y(e,this._babylonScene);return i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,i.fillMode=t,i.enableSpecularAntiAliasing=!0,i.useRadianceOverAlpha=!this._parent.transparencyAsCoverage,i.useSpecularOverAlpha=!this._parent.transparencyAsCoverage,i.transparencyMode=Te.Y.PBRMATERIAL_OPAQUE,i.metallic=1,i.roughness=1,i}createMaterial(e,t,i){const n=this._extensionsCreateMaterial(e,t,i);if(n)return n;const r=t.name||`material${t.index}`;return this._createDefaultMaterial(r,i)}loadMaterialPropertiesAsync(e,t,i){const n=this._extensionsLoadMaterialPropertiesAsync(e,t,i);if(n)return n;const r=new Array;return r.push(this.loadMaterialBasePropertiesAsync(e,t,i)),t.pbrMetallicRoughness&&r.push(this._loadMaterialMetallicRoughnessPropertiesAsync(`${e}/pbrMetallicRoughness`,t.pbrMetallicRoughness,i)),this.loadMaterialAlphaProperties(e,t,i),Promise.all(r).then((()=>{}))}loadMaterialBasePropertiesAsync(e,t,i){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const n=new Array;return i.emissiveColor=t.emissiveFactor?P.Wo.FromArray(t.emissiveFactor):new P.Wo(0,0,0),t.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,n.push(this.loadTextureInfoAsync(`${e}/normalTexture`,t.normalTexture,(e=>{e.name=`${i.name} (Normal)`,i.bumpTexture=e}))),i.invertNormalMapX=!this._babylonScene.useRightHandedSystem,i.invertNormalMapY=this._babylonScene.useRightHandedSystem,null!=t.normalTexture.scale&&i.bumpTexture&&(i.bumpTexture.level=t.normalTexture.scale),i.forceIrradianceInFragment=!0),t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,n.push(this.loadTextureInfoAsync(`${e}/occlusionTexture`,t.occlusionTexture,(e=>{e.name=`${i.name} (Occlusion)`,i.ambientTexture=e}))),i.useAmbientInGrayScale=!0,null!=t.occlusionTexture.strength&&(i.ambientTextureStrength=t.occlusionTexture.strength)),t.emissiveTexture&&n.push(this.loadTextureInfoAsync(`${e}/emissiveTexture`,t.emissiveTexture,(e=>{e.name=`${i.name} (Emissive)`,i.emissiveTexture=e}))),Promise.all(n).then((()=>{}))}loadMaterialAlphaProperties(e,t,i){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);switch(t.alphaMode||"OPAQUE"){case"OPAQUE":i.transparencyMode=Te.Y.PBRMATERIAL_OPAQUE;break;case"MASK":i.transparencyMode=Te.Y.PBRMATERIAL_ALPHATEST,i.alphaCutOff=null==t.alphaCutoff?.5:t.alphaCutoff,i.albedoTexture&&(i.albedoTexture.hasAlpha=!0);break;case"BLEND":i.transparencyMode=Te.Y.PBRMATERIAL_ALPHABLEND,i.albedoTexture&&(i.albedoTexture.hasAlpha=!0,i.useAlphaFromAlbedoTexture=!0);break;default:throw new Error(`${e}/alphaMode: Invalid value (${t.alphaMode})`)}}loadTextureInfoAsync(e,t,i=(()=>{})){const n=this._extensionsLoadTextureInfoAsync(e,t,i);if(n)return n;if(this.logOpen(`${e}`),t.texCoord>=6)throw new Error(`${e}/texCoord: Invalid value (${t.texCoord})`);const r=Be.Get(`${e}/index`,this._gltf.textures,t.index);r._textureInfo=t;const s=this._loadTextureAsync(`/textures/${t.index}`,r,(n=>{n.coordinatesIndex=t.texCoord||0,Ne.AddPointerMetadata(n,e),this._parent.onTextureLoadedObservable.notifyObservers(n),i(n)}));return this.logClose(),s}_loadTextureAsync(e,t,i=(()=>{})){const n=this._extensionsLoadTextureAsync(e,t,i);if(n)return n;this.logOpen(`${e} ${t.name||""}`);const r=null==t.sampler?Ne.DefaultSampler:Be.Get(`${e}/sampler`,this._gltf.samplers,t.sampler),s=Be.Get(`${e}/source`,this._gltf.images,t.source),o=this._createTextureAsync(e,r,s,i,void 0,!t._textureInfo.nonColorData);return this.logClose(),o}_createTextureAsync(e,t,i,n=(()=>{}),r,s){const o=this._loadSampler(`/samplers/${t.index}`,t),a=new Array,l=new Ce.B;this._babylonScene._blockEntityCollection=!!this._assetContainer;const c={noMipmap:o.noMipMaps,invertY:!1,samplingMode:o.samplingMode,onLoad:()=>{this._disposed||l.resolve()},onError:(t,i)=>{this._disposed||l.reject(new Error(`${e}: ${i&&i.message?i.message:t||"Failed to load texture"}`))},mimeType:i.mimeType,loaderOptions:r,useSRGBBuffer:!!s&&this._parent.useSRGBBuffers},h=new V.x(null,this._babylonScene,c);return h._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,a.push(l.promise),a.push(this.loadImageAsync(`/images/${i.index}`,i).then((e=>{const t=i.uri||`${this._fileName}#image${i.index}`,n=`data:${this._uniqueRootUrl}${t}`;h.updateURL(n,e)}))),h.wrapU=o.wrapU,h.wrapV=o.wrapV,n(h),Promise.all(a).then((()=>h))}_loadSampler(e,t){return t._data||(t._data={noMipMaps:9728===t.minFilter||9729===t.minFilter,samplingMode:Ne._GetTextureSamplingMode(e,t),wrapU:Ne._GetTextureWrapMode(`${e}/wrapS`,t.wrapS),wrapV:Ne._GetTextureWrapMode(`${e}/wrapT`,t.wrapT)}),t._data}loadImageAsync(e,t){if(!t._data){if(this.logOpen(`${e} ${t.name||""}`),t.uri)t._data=this.loadUriAsync(`${e}/uri`,t,t.uri);else{const i=Be.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync(`/bufferViews/${i.index}`,i)}this.logClose()}return t._data}loadUriAsync(e,t,i){const n=this._extensionsLoadUriAsync(e,t,i);if(n)return n;if(!Ne._ValidateUri(i))throw new Error(`${e}: '${i}' is invalid`);if((0,S.VL)(i)){const t=new Uint8Array((0,S.$K)(i));return this.log(`${e}: Decoded ${i.substr(0,64)}... (${t.length} bytes)`),Promise.resolve(t)}return this.log(`${e}: Loading ${i}`),this._parent.preprocessUrlAsync(this._rootUrl+i).then((t=>new Promise(((n,r)=>{this._parent._loadFile(this._babylonScene,t,(t=>{this._disposed||(this.log(`${e}: Loaded ${i} (${t.byteLength} bytes)`),n(new Uint8Array(t)))}),!0,(t=>{r(new S.eh(`${e}: Failed to load '${i}'${t?": "+t.status+" "+t.statusText:""}`,t))}))}))))}static AddPointerMetadata(e,t){const i=e.metadata=e.metadata||{},n=i.gltf=i.gltf||{};(n.pointers=n.pointers||[]).push(t)}static _GetTextureWrapMode(e,t){switch(t=null==t?10497:t){case 33071:return V.x.CLAMP_ADDRESSMODE;case 33648:return V.x.MIRROR_ADDRESSMODE;case 10497:return V.x.WRAP_ADDRESSMODE;default:return a.Y.Warn(`${e}: Invalid value (${t})`),V.x.WRAP_ADDRESSMODE}}static _GetTextureSamplingMode(e,t){const i=null==t.magFilter?9729:t.magFilter,n=null==t.minFilter?9987:t.minFilter;if(9729===i)switch(n){case 9728:return V.x.LINEAR_NEAREST;case 9729:return V.x.LINEAR_LINEAR;case 9984:return V.x.LINEAR_NEAREST_MIPNEAREST;case 9985:return V.x.LINEAR_LINEAR_MIPNEAREST;case 9986:return V.x.LINEAR_NEAREST_MIPLINEAR;case 9987:return V.x.LINEAR_LINEAR_MIPLINEAR;default:return a.Y.Warn(`${e}/minFilter: Invalid value (${n})`),V.x.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==i&&a.Y.Warn(`${e}/magFilter: Invalid value (${i})`),n){case 9728:return V.x.NEAREST_NEAREST;case 9729:return V.x.NEAREST_LINEAR;case 9984:return V.x.NEAREST_NEAREST_MIPNEAREST;case 9985:return V.x.NEAREST_LINEAR_MIPNEAREST;case 9986:return V.x.NEAREST_NEAREST_MIPLINEAR;case 9987:return V.x.NEAREST_LINEAR_MIPLINEAR;default:return a.Y.Warn(`${e}/minFilter: Invalid value (${n})`),V.x.NEAREST_NEAREST_MIPNEAREST}}static _GetTypedArrayConstructor(e,t){switch(t){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5125:return Uint32Array;case 5126:return Float32Array;default:throw new Error(`${e}: Invalid component type ${t}`)}}static _GetTypedArray(e,t,i,n,r){const s=i.buffer;n=i.byteOffset+(n||0);const o=Ne._GetTypedArrayConstructor(`${e}/componentType`,t),l=G.o.GetTypeByteLength(t);return n%l!=0?(a.Y.Warn(`${e}: Copying buffer as byte offset (${n}) is not a multiple of component type byte length (${l})`),new o(s.slice(n,n+r*l),0)):new o(s,n,r)}static _GetNumComponents(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw new Error(`${e}: Invalid type (${t})`)}static _ValidateUri(e){return r.w1.IsBase64(e)||-1===e.indexOf("..")}static _GetDrawMode(e,t){switch(null==t&&(t=4),t){case 0:return B.F.PointListDrawMode;case 1:return B.F.LineListDrawMode;case 2:return B.F.LineLoopDrawMode;case 3:return B.F.LineStripDrawMode;case 4:return B.F.TriangleFillMode;case 5:return B.F.TriangleStripDrawMode;case 6:return B.F.TriangleFanDrawMode}throw new Error(`${e}: Invalid mesh primitive mode (${t})`)}_compileMaterialsAsync(){this._parent._startPerformanceCounter("Compile materials");const e=new Array;if(this._gltf.materials)for(const t of this._gltf.materials)if(t._data)for(const i in t._data){const n=t._data[i];for(const t of n.babylonMeshes){t.computeWorldMatrix(!0);const i=n.babylonMaterial;e.push(i.forceCompilationAsync(t)),e.push(i.forceCompilationAsync(t,{useInstances:!0})),this._parent.useClipPlane&&(e.push(i.forceCompilationAsync(t,{clipPlane:!0})),e.push(i.forceCompilationAsync(t,{clipPlane:!0,useInstances:!0})))}}return Promise.all(e).then((()=>{this._parent._endPerformanceCounter("Compile materials")}))}_compileShadowGeneratorsAsync(){this._parent._startPerformanceCounter("Compile shadow generators");const e=new Array,t=this._babylonScene.lights;for(const i of t){const t=i.getShadowGenerator();t&&e.push(t.forceCompilationAsync())}return Promise.all(e).then((()=>{this._parent._endPerformanceCounter("Compile shadow generators")}))}_forEachExtensions(e){for(const t of this._extensions)t.enabled&&e(t)}_applyExtensions(e,t,i){for(const n of this._extensions)if(n.enabled){const r=`${n.name}.${t}`,s=e;s._activeLoaderExtensionFunctions=s._activeLoaderExtensionFunctions||{};const o=s._activeLoaderExtensionFunctions;if(!o[r]){o[r]=!0;try{const e=i(n);if(e)return e}finally{delete o[r]}}}return null}_extensionsOnLoading(){this._forEachExtensions((e=>e.onLoading&&e.onLoading()))}_extensionsOnReady(){this._forEachExtensions((e=>e.onReady&&e.onReady()))}_extensionsLoadSceneAsync(e,t){return this._applyExtensions(t,"loadScene",(i=>i.loadSceneAsync&&i.loadSceneAsync(e,t)))}_extensionsLoadNodeAsync(e,t,i){return this._applyExtensions(t,"loadNode",(n=>n.loadNodeAsync&&n.loadNodeAsync(e,t,i)))}_extensionsLoadCameraAsync(e,t,i){return this._applyExtensions(t,"loadCamera",(n=>n.loadCameraAsync&&n.loadCameraAsync(e,t,i)))}_extensionsLoadVertexDataAsync(e,t,i){return this._applyExtensions(t,"loadVertexData",(n=>n._loadVertexDataAsync&&n._loadVertexDataAsync(e,t,i)))}_extensionsLoadMeshPrimitiveAsync(e,t,i,n,r,s){return this._applyExtensions(r,"loadMeshPrimitive",(o=>o._loadMeshPrimitiveAsync&&o._loadMeshPrimitiveAsync(e,t,i,n,r,s)))}_extensionsLoadMaterialAsync(e,t,i,n,r){return this._applyExtensions(t,"loadMaterial",(s=>s._loadMaterialAsync&&s._loadMaterialAsync(e,t,i,n,r)))}_extensionsCreateMaterial(e,t,i){return this._applyExtensions(t,"createMaterial",(n=>n.createMaterial&&n.createMaterial(e,t,i)))}_extensionsLoadMaterialPropertiesAsync(e,t,i){return this._applyExtensions(t,"loadMaterialProperties",(n=>n.loadMaterialPropertiesAsync&&n.loadMaterialPropertiesAsync(e,t,i)))}_extensionsLoadTextureInfoAsync(e,t,i){return this._applyExtensions(t,"loadTextureInfo",(n=>n.loadTextureInfoAsync&&n.loadTextureInfoAsync(e,t,i)))}_extensionsLoadTextureAsync(e,t,i){return this._applyExtensions(t,"loadTexture",(n=>n._loadTextureAsync&&n._loadTextureAsync(e,t,i)))}_extensionsLoadAnimationAsync(e,t){return this._applyExtensions(t,"loadAnimation",(i=>i.loadAnimationAsync&&i.loadAnimationAsync(e,t)))}_extensionsLoadAnimationChannelAsync(e,t,i,n,r){return this._applyExtensions(i,"loadAnimationChannel",(s=>s._loadAnimationChannelAsync&&s._loadAnimationChannelAsync(e,t,i,n,r)))}_extensionsLoadSkinAsync(e,t,i){return this._applyExtensions(i,"loadSkin",(n=>n._loadSkinAsync&&n._loadSkinAsync(e,t,i)))}_extensionsLoadUriAsync(e,t,i){return this._applyExtensions(t,"loadUri",(n=>n._loadUriAsync&&n._loadUriAsync(e,t,i)))}_extensionsLoadBufferViewAsync(e,t){return this._applyExtensions(t,"loadBufferView",(i=>i.loadBufferViewAsync&&i.loadBufferViewAsync(e,t)))}_extensionsLoadBufferAsync(e,t,i,n){return this._applyExtensions(t,"loadBuffer",(r=>r.loadBufferAsync&&r.loadBufferAsync(e,t,i,n)))}static LoadExtensionAsync(e,t,i,n){if(!t.extensions)return null;const r=t.extensions[i];return r?n(`${e}/extensions/${i}`,r):null}static LoadExtraAsync(e,t,i,n){if(!t.extras)return null;const r=t.extras[i];return r?n(`${e}/extras/${i}`,r):null}isExtensionUsed(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)}logOpen(e){this._parent._logOpen(e)}logClose(){this._parent._logClose()}log(e){this._parent._log(e)}startPerformanceCounter(e){this._parent._startPerformanceCounter(e)}endPerformanceCounter(e){this._parent._endPerformanceCounter(e)}}Ne._RegisteredExtensions={},Ne.DefaultSampler={index:-1},E._CreateGLTF2Loader=e=>new Ne(e);var Le=i("../../../node_modules/@babylonjs/core/Maths/math.scalar.js"),ke=i("../../../node_modules/@babylonjs/core/Maths/sphericalPolynomial.js"),Ve=i("../../../node_modules/@babylonjs/core/Materials/Textures/rawCubeTexture.js");const Ue="EXT_lights_image_based";class Ge{constructor(e){this.name=Ue,this._loader=e,this.enabled=this._loader.isExtensionUsed(Ue)}dispose(){this._loader=null,delete this._lights}onLoading(){const e=this._loader.gltf.extensions;if(e&&e[this.name]){const t=e[this.name];this._lights=t.lights}}loadSceneAsync(e,t){return Ne.LoadExtensionAsync(e,t,this.name,((i,n)=>{const r=new Array;r.push(this._loader.loadSceneAsync(e,t)),this._loader.logOpen(`${i}`);const s=Be.Get(`${i}/light`,this._lights,n.light);return r.push(this._loadLightAsync(`/extensions/${this.name}/lights/${n.light}`,s).then((e=>{this._loader.babylonScene.environmentTexture=e}))),this._loader.logClose(),Promise.all(r).then((()=>{}))}))}_loadLightAsync(e,t){if(!t._loaded){const i=new Array;this._loader.logOpen(`${e}`);const n=new Array(t.specularImages.length);for(let r=0;r{n[r][t]=e}))),this._loader.logClose()}}this._loader.logClose(),t._loaded=Promise.all(i).then((()=>{const i=new Ve.N(this._loader.babylonScene,null,t.specularImageSize);if(i.name=t.name||"environment",t._babylonTexture=i,null!=t.intensity&&(i.level=t.intensity),t.rotation){let e=R._f.FromArray(t.rotation);this._loader.babylonScene.useRightHandedSystem||(e=R._f.Inverse(e)),R.y3.FromQuaternionToRef(e,i.getReflectionTextureMatrix())}if(!t.irradianceCoefficients)throw new Error(`${e}: Irradiance coefficients are missing`);const r=ke._.FromArray(t.irradianceCoefficients);r.scaleInPlace(t.intensity),r.convertIrradianceToLambertianRadiance();const s=ke.i.FromHarmonics(r),o=(n.length-1)/Le.R.Log2(t.specularImageSize);return i.updateRGBDAsync(n,s,o)}))}return t._loaded.then((()=>t._babylonTexture))}}Ne.RegisterExtension(Ue,(e=>new Ge(e))),i("../../../node_modules/@babylonjs/core/Meshes/thinInstanceMesh.js");const je="EXT_mesh_gpu_instancing";class We{constructor(e){this.name=je,this._loader=e,this.enabled=this._loader.isExtensionUsed(je)}dispose(){this._loader=null}loadNodeAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((e,n)=>{this._loader._disableInstancedMesh++;const r=this._loader.loadNodeAsync(`/nodes/${t.index}`,t,i);if(this._loader._disableInstancedMesh--,!t._primitiveBabylonMeshes)return r;const s=new Array;let o=0;const a=t=>{if(null==n.attributes[t])return void s.push(Promise.resolve(null));const i=Be.Get(`${e}/attributes/${t}`,this._loader.gltf.accessors,n.attributes[t]);if(s.push(this._loader._loadFloatAccessorAsync(`/accessors/${i.bufferView}`,i)),0===o)o=i.count;else if(o!==i.count)throw new Error(`${e}/attributes: Instance buffer accessors do not have the same count.`)};return a("TRANSLATION"),a("ROTATION"),a("SCALE"),r.then((e=>Promise.all(s).then((([i,n,r])=>{const s=new Float32Array(16*o);R.jp.Vector3[0].copyFromFloats(0,0,0),R.jp.Quaternion[0].copyFromFloats(0,0,0,1),R.jp.Vector3[1].copyFromFloats(1,1,1);for(let e=0;enew We(e)));var ze=i("../../../node_modules/@babylonjs/core/Meshes/Compression/meshoptCompression.js");const He="EXT_meshopt_compression";class Xe{constructor(e){this.name=He,this.enabled=e.isExtensionUsed(He),this._loader=e}dispose(){this._loader=null}loadBufferViewAsync(e,t){return Ne.LoadExtensionAsync(e,t,this.name,((i,n)=>{const r=t;if(r._meshOptData)return r._meshOptData;const s=Be.Get(`${e}/buffer`,this._loader.gltf.buffers,n.buffer);return r._meshOptData=this._loader.loadBufferAsync(`/buffers/${s.index}`,s,n.byteOffset||0,n.byteLength).then((e=>ze.K.Default.decodeGltfBufferAsync(e,n.count,n.byteStride,n.mode,n.filter))),r._meshOptData}))}}Ne.RegisterExtension(He,(e=>new Xe(e)));const Ye="EXT_texture_webp";class Qe{constructor(e){this.name=Ye,this._loader=e,this.enabled=e.isExtensionUsed(Ye)}dispose(){this._loader=null}_loadTextureAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=null==t.sampler?Ne.DefaultSampler:Be.Get(`${e}/sampler`,this._loader.gltf.samplers,t.sampler),o=Be.Get(`${n}/source`,this._loader.gltf.images,r.source);return this._loader._createTextureAsync(e,s,o,(e=>{i(e)}),void 0,!t._textureInfo.nonColorData)}))}}Ne.RegisterExtension(Ye,(e=>new Qe(e)));var qe=i("../../../node_modules/@babylonjs/core/Meshes/Compression/dracoCompression.js");const Ke="KHR_draco_mesh_compression";class Ze{constructor(e){this.name=Ke,this._loader=e,this.enabled=qe.J.DecoderAvailable&&this._loader.isExtensionUsed(Ke)}dispose(){delete this.dracoCompression,this._loader=null}_loadVertexDataAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{if(null!=t.mode){if(5!==t.mode&&4!==t.mode)throw new Error(`${e}: Unsupported mode ${t.mode}`);if(5===t.mode)throw new Error(`${e}: Mode ${t.mode} is not currently supported`)}const s={},o={},a=(n,a)=>{const l=r.attributes[n];if(void 0===l||void 0===t.attributes[n])return;s[a]=l;const c=Be.Get(`${e}/attributes/${n}`,this._loader.gltf.accessors,t.attributes[n]);if(c.normalized&&5126!==c.componentType){let e=1;switch(c.componentType){case 5120:e=127;break;case 5121:e=255;break;case 5122:e=32767;break;case 5123:e=65535}o[a]=e}i._delayInfo=i._delayInfo||[],-1===i._delayInfo.indexOf(a)&&i._delayInfo.push(a)};a("POSITION",G.o.PositionKind),a("NORMAL",G.o.NormalKind),a("TANGENT",G.o.TangentKind),a("TEXCOORD_0",G.o.UVKind),a("TEXCOORD_1",G.o.UV2Kind),a("TEXCOORD_2",G.o.UV3Kind),a("TEXCOORD_3",G.o.UV4Kind),a("TEXCOORD_4",G.o.UV5Kind),a("TEXCOORD_5",G.o.UV6Kind),a("JOINTS_0",G.o.MatricesIndicesKind),a("WEIGHTS_0",G.o.MatricesWeightsKind),a("COLOR_0",G.o.ColorKind);const l=Be.Get(n,this._loader.gltf.bufferViews,r.bufferView);return l._dracoBabylonGeometry||(l._dracoBabylonGeometry=this._loader.loadBufferViewAsync(`/bufferViews/${l.index}`,l).then((t=>(this.dracoCompression||qe.J.Default).decodeMeshAsync(t,s,o).then((e=>{const t=new j.Z(i.name,this._loader.babylonScene);return e.applyToGeometry(t),t})).catch((t=>{throw new Error(`${e}: ${t.message}`)}))))),l._dracoBabylonGeometry}))}}Ne.RegisterExtension(Ke,(e=>new Ze(e)));var $e=i("../../../node_modules/@babylonjs/core/Lights/light.js");const Je="KHR_lights_punctual";class et{constructor(e){this.name=Je,this._loader=e,this.enabled=this._loader.isExtensionUsed(Je)}dispose(){this._loader=null,delete this._lights}onLoading(){const e=this._loader.gltf.extensions;if(e&&e[this.name]){const t=e[this.name];this._lights=t.lights,Be.Assign(this._lights)}}loadNodeAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>this._loader.loadNodeAsync(e,t,(e=>{let t;const s=Be.Get(n,this._lights,r.light),o=s.name||e.name;switch(this._loader.babylonScene._blockEntityCollection=!!this._loader._assetContainer,s.type){case"directional":t=new Y.O(o,R.P.Backward(),this._loader.babylonScene);break;case"point":t=new Q.c(o,R.P.Zero(),this._loader.babylonScene);break;case"spot":{const e=new q.P(o,R.P.Zero(),R.P.Backward(),0,1,this._loader.babylonScene);e.angle=2*(s.spot&&s.spot.outerConeAngle||Math.PI/4),e.innerAngle=2*(s.spot&&s.spot.innerConeAngle||0),t=e;break}default:throw this._loader.babylonScene._blockEntityCollection=!1,new Error(`${n}: Invalid light type (${s.type})`)}t._parentContainer=this._loader._assetContainer,this._loader.babylonScene._blockEntityCollection=!1,s._babylonLight=t,t.falloffType=$e._.FALLOFF_GLTF,t.diffuse=s.color?P.Wo.FromArray(s.color):P.Wo.White(),t.intensity=null==s.intensity?1:s.intensity,t.range=null==s.range?Number.MAX_VALUE:s.range,t.parent=e,this._loader._babylonLights.push(t),Ne.AddPointerMetadata(t,n),i(e)}))))}}Ne.RegisterExtension(Je,(e=>new et(e)));const tt="KHR_materials_pbrSpecularGlossiness";class it{constructor(e){this.name=tt,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(tt)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=new Array;return s.push(this._loader.loadMaterialBasePropertiesAsync(e,t,i)),s.push(this._loadSpecularGlossinessPropertiesAsync(n,t,r,i)),this._loader.loadMaterialAlphaProperties(e,t,i),Promise.all(s).then((()=>{}))}))}_loadSpecularGlossinessPropertiesAsync(e,t,i,n){if(!(n instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const r=new Array;return n.metallic=null,n.roughness=null,i.diffuseFactor?(n.albedoColor=P.Wo.FromArray(i.diffuseFactor),n.alpha=i.diffuseFactor[3]):n.albedoColor=P.Wo.White(),n.reflectivityColor=i.specularFactor?P.Wo.FromArray(i.specularFactor):P.Wo.White(),n.microSurface=null==i.glossinessFactor?1:i.glossinessFactor,i.diffuseTexture&&r.push(this._loader.loadTextureInfoAsync(`${e}/diffuseTexture`,i.diffuseTexture,(e=>{e.name=`${n.name} (Diffuse)`,n.albedoTexture=e}))),i.specularGlossinessTexture&&(r.push(this._loader.loadTextureInfoAsync(`${e}/specularGlossinessTexture`,i.specularGlossinessTexture,(e=>{e.name=`${n.name} (Specular Glossiness)`,n.reflectivityTexture=e,n.reflectivityTexture.hasAlpha=!0}))),n.useMicroSurfaceFromReflectivityMapAlpha=!0),Promise.all(r).then((()=>{}))}}Ne.RegisterExtension(tt,(e=>new it(e)));const nt="KHR_materials_unlit";class rt{constructor(e){this.name=nt,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(nt)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,(()=>this._loadUnlitPropertiesAsync(e,t,i)))}_loadUnlitPropertiesAsync(e,t,i){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const n=new Array;i.unlit=!0;const r=t.pbrMetallicRoughness;return r&&(r.baseColorFactor?(i.albedoColor=P.Wo.FromArray(r.baseColorFactor),i.alpha=r.baseColorFactor[3]):i.albedoColor=P.Wo.White(),r.baseColorTexture&&n.push(this._loader.loadTextureInfoAsync(`${e}/baseColorTexture`,r.baseColorTexture,(e=>{e.name=`${i.name} (Base Color)`,i.albedoTexture=e})))),t.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,t,i),Promise.all(n).then((()=>{}))}}Ne.RegisterExtension(nt,(e=>new rt(e)));const st="KHR_materials_clearcoat";class ot{constructor(e){this.name=st,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(st)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=new Array;return s.push(this._loader.loadMaterialPropertiesAsync(e,t,i)),s.push(this._loadClearCoatPropertiesAsync(n,r,i)),Promise.all(s).then((()=>{}))}))}_loadClearCoatPropertiesAsync(e,t,i){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const n=new Array;return i.clearCoat.isEnabled=!0,i.clearCoat.useRoughnessFromMainTexture=!1,i.clearCoat.remapF0OnInterfaceChange=!1,null!=t.clearcoatFactor?i.clearCoat.intensity=t.clearcoatFactor:i.clearCoat.intensity=0,t.clearcoatTexture&&n.push(this._loader.loadTextureInfoAsync(`${e}/clearcoatTexture`,t.clearcoatTexture,(e=>{e.name=`${i.name} (ClearCoat Intensity)`,i.clearCoat.texture=e}))),null!=t.clearcoatRoughnessFactor?i.clearCoat.roughness=t.clearcoatRoughnessFactor:i.clearCoat.roughness=0,t.clearcoatRoughnessTexture&&(t.clearcoatRoughnessTexture.nonColorData=!0,n.push(this._loader.loadTextureInfoAsync(`${e}/clearcoatRoughnessTexture`,t.clearcoatRoughnessTexture,(e=>{e.name=`${i.name} (ClearCoat Roughness)`,i.clearCoat.textureRoughness=e})))),t.clearcoatNormalTexture&&(t.clearcoatNormalTexture.nonColorData=!0,n.push(this._loader.loadTextureInfoAsync(`${e}/clearcoatNormalTexture`,t.clearcoatNormalTexture,(e=>{e.name=`${i.name} (ClearCoat Normal)`,i.clearCoat.bumpTexture=e}))),i.invertNormalMapX=!i.getScene().useRightHandedSystem,i.invertNormalMapY=i.getScene().useRightHandedSystem,null!=t.clearcoatNormalTexture.scale&&(i.clearCoat.bumpTexture.level=t.clearcoatNormalTexture.scale)),Promise.all(n).then((()=>{}))}}Ne.RegisterExtension(st,(e=>new ot(e)));const at="KHR_materials_iridescence";class lt{constructor(e){this.name=at,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(at)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=new Array;return s.push(this._loader.loadMaterialPropertiesAsync(e,t,i)),s.push(this._loadIridescencePropertiesAsync(n,r,i)),Promise.all(s).then((()=>{}))}))}_loadIridescencePropertiesAsync(e,t,i){var n,r,s,o,a;if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const l=new Array;return i.iridescence.isEnabled=!0,i.iridescence.intensity=null!==(n=t.iridescenceFactor)&&void 0!==n?n:0,i.iridescence.indexOfRefraction=null!==(s=null!==(r=t.iridescenceIor)&&void 0!==r?r:t.iridescenceIOR)&&void 0!==s?s:1.3,i.iridescence.minimumThickness=null!==(o=t.iridescenceThicknessMinimum)&&void 0!==o?o:100,i.iridescence.maximumThickness=null!==(a=t.iridescenceThicknessMaximum)&&void 0!==a?a:400,t.iridescenceTexture&&l.push(this._loader.loadTextureInfoAsync(`${e}/iridescenceTexture`,t.iridescenceTexture,(e=>{e.name=`${i.name} (Iridescence Intensity)`,i.iridescence.texture=e}))),t.iridescenceThicknessTexture&&l.push(this._loader.loadTextureInfoAsync(`${e}/iridescenceThicknessTexture`,t.iridescenceThicknessTexture,(e=>{e.name=`${i.name} (Iridescence Thickness)`,i.iridescence.thicknessTexture=e}))),Promise.all(l).then((()=>{}))}}Ne.RegisterExtension(at,(e=>new lt(e)));const ct="KHR_materials_emissive_strength";class ht{constructor(e){this.name=ct,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(ct)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>this._loader.loadMaterialPropertiesAsync(e,t,i).then((()=>{this._loadEmissiveProperties(n,r,i)}))))}_loadEmissiveProperties(e,t,i){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);void 0!==t.emissiveStrength&&i.emissiveColor.scaleToRef(t.emissiveStrength,i.emissiveColor)}}Ne.RegisterExtension(ct,(e=>new ht(e)));const _t="KHR_materials_sheen";class dt{constructor(e){this.name=_t,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(_t)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=new Array;return s.push(this._loader.loadMaterialPropertiesAsync(e,t,i)),s.push(this._loadSheenPropertiesAsync(n,r,i)),Promise.all(s).then((()=>{}))}))}_loadSheenPropertiesAsync(e,t,i){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const n=new Array;return i.sheen.isEnabled=!0,i.sheen.intensity=1,null!=t.sheenColorFactor?i.sheen.color=P.Wo.FromArray(t.sheenColorFactor):i.sheen.color=P.Wo.Black(),t.sheenColorTexture&&n.push(this._loader.loadTextureInfoAsync(`${e}/sheenColorTexture`,t.sheenColorTexture,(e=>{e.name=`${i.name} (Sheen Color)`,i.sheen.texture=e}))),void 0!==t.sheenRoughnessFactor?i.sheen.roughness=t.sheenRoughnessFactor:i.sheen.roughness=0,t.sheenRoughnessTexture&&(t.sheenRoughnessTexture.nonColorData=!0,n.push(this._loader.loadTextureInfoAsync(`${e}/sheenRoughnessTexture`,t.sheenRoughnessTexture,(e=>{e.name=`${i.name} (Sheen Roughness)`,i.sheen.textureRoughness=e})))),i.sheen.albedoScaling=!0,i.sheen.useRoughnessFromMainTexture=!1,Promise.all(n).then((()=>{}))}}Ne.RegisterExtension(_t,(e=>new dt(e)));const ut="KHR_materials_specular";class pt{constructor(e){this.name=ut,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ut)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=new Array;return s.push(this._loader.loadMaterialPropertiesAsync(e,t,i)),s.push(this._loadSpecularPropertiesAsync(n,r,i)),Promise.all(s).then((()=>{}))}))}_loadSpecularPropertiesAsync(e,t,i){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const n=new Array;return void 0!==t.specularFactor&&(i.metallicF0Factor=t.specularFactor),void 0!==t.specularColorFactor&&(i.metallicReflectanceColor=P.Wo.FromArray(t.specularColorFactor)),t.specularTexture&&(t.specularTexture.nonColorData=!0,n.push(this._loader.loadTextureInfoAsync(`${e}/specularTexture`,t.specularTexture,(e=>{e.name=`${i.name} (Specular F0 Strength)`,i.metallicReflectanceTexture=e,i.useOnlyMetallicFromMetallicReflectanceTexture=!0})))),t.specularColorTexture&&n.push(this._loader.loadTextureInfoAsync(`${e}/specularColorTexture`,t.specularColorTexture,(e=>{e.name=`${i.name} (Specular F0 Color)`,i.reflectanceTexture=e}))),Promise.all(n).then((()=>{}))}}Ne.RegisterExtension(ut,(e=>new pt(e)));const ft="KHR_materials_ior";class mt{constructor(e){this.name=ft,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(ft)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=new Array;return s.push(this._loader.loadMaterialPropertiesAsync(e,t,i)),s.push(this._loadIorPropertiesAsync(n,r,i)),Promise.all(s).then((()=>{}))}))}_loadIorPropertiesAsync(e,t,i){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);return void 0!==t.ior?i.indexOfRefraction=t.ior:i.indexOfRefraction=mt._DEFAULT_IOR,Promise.resolve()}}mt._DEFAULT_IOR=1.5,Ne.RegisterExtension(ft,(e=>new mt(e)));const gt="KHR_materials_variants";class bt{constructor(e){this.name=gt,this._loader=e,this.enabled=this._loader.isExtensionUsed(gt)}dispose(){this._loader=null}static GetAvailableVariants(e){const t=this._GetExtensionMetadata(e);return t?Object.keys(t.variants):[]}getAvailableVariants(e){return bt.GetAvailableVariants(e)}static SelectVariant(e,t){const i=this._GetExtensionMetadata(e);if(!i)throw new Error("Cannot select variant on a glTF mesh that does not have the KHR_materials_variants extension");const n=e=>{const t=i.variants[e];if(t)for(const e of t)e.mesh.material=e.material};if(t instanceof Array)for(const e of t)n(e);else n(t);i.lastSelected=t}selectVariant(e,t){return bt.SelectVariant(e,t)}static Reset(e){const t=this._GetExtensionMetadata(e);if(!t)throw new Error("Cannot reset on a glTF mesh that does not have the KHR_materials_variants extension");for(const e of t.original)e.mesh.material=e.material;t.lastSelected=null}reset(e){return bt.Reset(e)}static GetLastSelectedVariant(e){const t=this._GetExtensionMetadata(e);if(!t)throw new Error("Cannot get the last selected variant on a glTF mesh that does not have the KHR_materials_variants extension");return t.lastSelected}getLastSelectedVariant(e){return bt.GetLastSelectedVariant(e)}static _GetExtensionMetadata(e){var t,i;return(null===(i=null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.gltf)||void 0===i?void 0:i.KHR_materials_variants)||null}onLoading(){const e=this._loader.gltf.extensions;if(e&&e[this.name]){const t=e[this.name];this._variants=t.variants}}_loadMeshPrimitiveAsync(e,t,i,n,r,s){return Ne.LoadExtensionAsync(e,r,this.name,((o,a)=>{const l=new Array;return l.push(this._loader._loadMeshPrimitiveAsync(e,t,i,n,r,(t=>{if(s(t),t instanceof H.Kj){const i=Ne._GetDrawMode(e,r.mode),n=this._loader.rootBabylonMesh,s=n?n.metadata=n.metadata||{}:{},c=s.gltf=s.gltf||{},h=c.KHR_materials_variants=c.KHR_materials_variants||{lastSelected:null,original:[],variants:{}};h.original.push({mesh:t,material:t.material});for(let e=0;e{for(let i=0;i{const i=e;let r=null,s=i;do{if(s=s.parent,!s)return;r=bt._GetExtensionMetadata(s)}while(null===r);if(n&&r===bt._GetExtensionMetadata(n)){s.metadata={};for(const e in n.metadata)s.metadata[e]=n.metadata[e];s.metadata.gltf=[];for(const e in n.metadata.gltf)s.metadata.gltf[e]=n.metadata.gltf[e];s.metadata.gltf.KHR_materials_variants={lastSelected:null,original:[],variants:{}};for(const e of r.original)s.metadata.gltf.KHR_materials_variants.original.push({mesh:e.mesh,material:e.material});for(const e in r.variants)if(Object.prototype.hasOwnProperty.call(r.variants,e)){s.metadata.gltf.KHR_materials_variants.variants[e]=[];for(const t of r.variants[e])s.metadata.gltf.KHR_materials_variants.variants[e].push({mesh:t.mesh,material:t.material})}r=s.metadata.gltf.KHR_materials_variants}for(const e of r.original)e.mesh===t&&(e.mesh=i);for(const e of r.variants[o.name])e.mesh===t&&(e.mesh=i)}))}})))}}}))),Promise.all(l).then((([e])=>e))}))}}Ne.RegisterExtension(gt,(e=>new bt(e)));var yt=i("../../../node_modules/@babylonjs/core/Materials/Textures/renderTargetTexture.js");class vt{constructor(e,t){this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options={...vt._GetDefaultOptions(),...e},this._scene=t,this._scene._transmissionHelper=this,this.onErrorObservable=new n.y$,this._scene.onDisposeObservable.addOnce((()=>{this.dispose()})),this._parseScene(),this._setupRenderTargets()}static _GetDefaultOptions(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:$.g.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}}updateOptions(e){if(!Object.keys(e).filter((t=>this._options[t]!==e[t])).length)return;const t={...this._options,...e},i=this._options;this._options=t,t.renderSize===i.renderSize&&t.renderTargetTextureType===i.renderTargetTextureType&&t.generateMipmaps===i.generateMipmaps&&this._opaqueRenderTarget?(this._opaqueRenderTarget.samples=t.samples,this._opaqueRenderTarget.lodGenerationScale=t.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=t.lodGenerationOffset):this._setupRenderTargets()}getOpaqueTarget(){return this._opaqueRenderTarget}_shouldRenderAsTransmission(e){return!!e&&!!(e instanceof Te.Y&&e.subSurface.isRefractionEnabled)}_addMesh(e){this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),r.w1.SetImmediate((()=>{this._shouldRenderAsTransmission(e.material)?(e.material.refractionTexture=this._opaqueRenderTarget,this._transparentMeshesCache.push(e)):this._opaqueMeshesCache.push(e)}))}_removeMesh(e){e.onMaterialChangedObservable.remove(this._materialObservers[e.uniqueId]),delete this._materialObservers[e.uniqueId];let t=this._transparentMeshesCache.indexOf(e);-1!==t&&this._transparentMeshesCache.splice(t,1),t=this._opaqueMeshesCache.indexOf(e),-1!==t&&this._opaqueMeshesCache.splice(t,1)}_parseScene(){this._scene.meshes.forEach(this._addMesh.bind(this)),this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this)),this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this))}_onMeshMaterialChanged(e){const t=this._transparentMeshesCache.indexOf(e),i=this._opaqueMeshesCache.indexOf(e);this._shouldRenderAsTransmission(e.material)?(e.material instanceof Te.Y&&(e.material.subSurface.refractionTexture=this._opaqueRenderTarget),-1!==i?(this._opaqueMeshesCache.splice(i,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e)):-1!==t?(this._transparentMeshesCache.splice(t,1),this._opaqueMeshesCache.push(e)):-1===i&&this._opaqueMeshesCache.push(e)}_setupRenderTargets(){var e,t;let i,n;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new yt._("opaqueSceneTexture",this._options.renderSize,this._scene,this._options.generateMipmaps,void 0,this._options.renderTargetTextureType),this._opaqueRenderTarget.ignoreCameraViewport=!0,this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.clearColor=null!==(t=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==t?t:this._scene.clearColor.clone(),this._opaqueRenderTarget.gammaSpace=!1,this._opaqueRenderTarget.lodGenerationScale=this._options.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=this._options.lodGenerationOffset,this._opaqueRenderTarget.samples=this._options.samples,this._opaqueRenderTarget.onBeforeBindObservable.add((e=>{n=this._scene.environmentIntensity,this._scene.environmentIntensity=1,i=this._scene.imageProcessingConfiguration.applyByPostProcess,this._options.clearColor?e.clearColor.copyFrom(this._options.clearColor):this._scene.clearColor.toLinearSpaceToRef(e.clearColor),this._scene.imageProcessingConfiguration._applyByPostProcess=!0})),this._opaqueRenderTarget.onAfterUnbindObservable.add((()=>{this._scene.environmentIntensity=n,this._scene.imageProcessingConfiguration._applyByPostProcess=i})),this._transparentMeshesCache.forEach((e=>{this._shouldRenderAsTransmission(e.material)&&(e.material.refractionTexture=this._opaqueRenderTarget)}))}dispose(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]}}const At="KHR_materials_transmission";class Ct{constructor(e){this.name=At,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(At),this.enabled&&(e.parent.transparencyAsCoverage=!0)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=new Array;return s.push(this._loader.loadMaterialBasePropertiesAsync(e,t,i)),s.push(this._loader.loadMaterialPropertiesAsync(e,t,i)),s.push(this._loadTransparentPropertiesAsync(n,t,i,r)),Promise.all(s).then((()=>{}))}))}_loadTransparentPropertiesAsync(e,t,i,n){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const r=i;if(r.subSurface.isRefractionEnabled=!0,r.subSurface.volumeIndexOfRefraction=1,r.subSurface.useAlbedoToTintRefraction=!0,void 0===n.transmissionFactor)return r.subSurface.refractionIntensity=0,r.subSurface.isRefractionEnabled=!1,Promise.resolve();{r.subSurface.refractionIntensity=n.transmissionFactor;const e=r.getScene();r.subSurface.refractionIntensity&&!e._transmissionHelper&&new vt({},r.getScene())}return r.subSurface.minimumThickness=0,r.subSurface.maximumThickness=0,n.transmissionTexture?(n.transmissionTexture.nonColorData=!0,this._loader.loadTextureInfoAsync(`${e}/transmissionTexture`,n.transmissionTexture,void 0).then((e=>{r.subSurface.refractionIntensityTexture=e,r.subSurface.useGltfStyleTextures=!0}))):Promise.resolve()}}Ne.RegisterExtension(At,(e=>new Ct(e)));const St="KHR_materials_translucency";class xt{constructor(e){this.name=St,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(St),this.enabled&&(e.parent.transparencyAsCoverage=!0)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=new Array;return s.push(this._loader.loadMaterialBasePropertiesAsync(e,t,i)),s.push(this._loader.loadMaterialPropertiesAsync(e,t,i)),s.push(this._loadTranslucentPropertiesAsync(n,t,i,r)),Promise.all(s).then((()=>{}))}))}_loadTranslucentPropertiesAsync(e,t,i,n){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);const r=i;return r.subSurface.isTranslucencyEnabled=!0,r.subSurface.volumeIndexOfRefraction=1,r.subSurface.minimumThickness=0,r.subSurface.maximumThickness=0,r.subSurface.useAlbedoToTintTranslucency=!0,void 0===n.translucencyFactor?(r.subSurface.translucencyIntensity=0,r.subSurface.isTranslucencyEnabled=!1,Promise.resolve()):(r.subSurface.translucencyIntensity=n.translucencyFactor,n.translucencyTexture?(n.translucencyTexture.nonColorData=!0,this._loader.loadTextureInfoAsync(`${e}/translucencyTexture`,n.translucencyTexture).then((e=>{r.subSurface.translucencyIntensityTexture=e}))):Promise.resolve())}}Ne.RegisterExtension(St,(e=>new xt(e)));const Tt="KHR_materials_volume";class Et{constructor(e){this.name=Tt,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(Tt),this.enabled&&this._loader._disableInstancedMesh++}dispose(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=new Array;return s.push(this._loader.loadMaterialBasePropertiesAsync(e,t,i)),s.push(this._loader.loadMaterialPropertiesAsync(e,t,i)),s.push(this._loadVolumePropertiesAsync(n,t,i,r)),Promise.all(s).then((()=>{}))}))}_loadVolumePropertiesAsync(e,t,i,n){if(!(i instanceof Te.Y))throw new Error(`${e}: Material type not supported`);if(!i.subSurface.isRefractionEnabled&&!i.subSurface.isTranslucencyEnabled||!n.thicknessFactor)return Promise.resolve();i.subSurface.volumeIndexOfRefraction=i.indexOfRefraction;const r=void 0!==n.attenuationDistance?n.attenuationDistance:Number.MAX_VALUE;return i.subSurface.tintColorAtDistance=r,void 0!==n.attenuationColor&&3==n.attenuationColor.length&&i.subSurface.tintColor.copyFromFloats(n.attenuationColor[0],n.attenuationColor[1],n.attenuationColor[2]),i.subSurface.minimumThickness=0,i.subSurface.maximumThickness=n.thicknessFactor,i.subSurface.useThicknessAsDepth=!0,n.thicknessTexture?(n.thicknessTexture.nonColorData=!0,this._loader.loadTextureInfoAsync(`${e}/thicknessTexture`,n.thicknessTexture).then((e=>{i.subSurface.thicknessTexture=e,i.subSurface.useGltfStyleTextures=!0}))):Promise.resolve()}}Ne.RegisterExtension(Tt,(e=>new Et(e)));const Rt="KHR_mesh_quantization";class Pt{constructor(e){this.name=Rt,this.enabled=e.isExtensionUsed(Rt)}dispose(){}}Ne.RegisterExtension(Rt,(e=>new Pt(e)));const It="KHR_texture_basisu";class Mt{constructor(e){this.name=It,this._loader=e,this.enabled=e.isExtensionUsed(It)}dispose(){this._loader=null}_loadTextureAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>{const s=null==t.sampler?Ne.DefaultSampler:Be.Get(`${e}/sampler`,this._loader.gltf.samplers,t.sampler),o=Be.Get(`${n}/source`,this._loader.gltf.images,r.source);return this._loader._createTextureAsync(e,s,o,(e=>{i(e)}),t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)}))}}Ne.RegisterExtension(It,(e=>new Mt(e)));const Dt="KHR_texture_transform";class Ot{constructor(e){this.name=Dt,this._loader=e,this.enabled=this._loader.isExtensionUsed(Dt)}dispose(){this._loader=null}loadTextureInfoAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((n,r)=>this._loader.loadTextureInfoAsync(e,t,(e=>{if(!(e instanceof V.x))throw new Error(`${n}: Texture type not supported`);r.offset&&(e.uOffset=r.offset[0],e.vOffset=r.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,r.rotation&&(e.wAng=-r.rotation),r.scale&&(e.uScale=r.scale[0],e.vScale=r.scale[1]),null!=r.texCoord&&(e.coordinatesIndex=r.texCoord),i(e)}))))}}Ne.RegisterExtension(Dt,(e=>new Ot(e)));const wt="KHR_xmp_json_ld";class Ft{constructor(e){this.name=wt,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(wt)}dispose(){this._loader=null}onLoading(){var e,t,i;if(null===this._loader.rootBabylonMesh)return;const n=null===(e=this._loader.gltf.extensions)||void 0===e?void 0:e.KHR_xmp_json_ld,r=null===(i=null===(t=this._loader.gltf.asset)||void 0===t?void 0:t.extensions)||void 0===i?void 0:i.KHR_xmp_json_ld;if(n&&r){const e=+r.packet;n.packets&&e2)),new jt(D.f.ANIMATIONTYPE_FLOAT,`${e}.vScale`,kt,(()=>2))],offset:[new jt(D.f.ANIMATIONTYPE_FLOAT,`${e}.uOffset`,Nt,(()=>2)),new jt(D.f.ANIMATIONTYPE_FLOAT,`${e}.vOffset`,kt,(()=>2))],rotation:[new jt(D.f.ANIMATIONTYPE_FLOAT,`${e}.wAng`,Lt,(()=>1))]}}Ne.RegisterExtension(wt,(e=>new Ft(e)));class Gt extends De{buildAnimations(e,t,i,n,r){r(e._babylonCamera,this._buildAnimation(t,i,n))}}class jt extends De{buildAnimations(e,t,i,n,r){for(const s in e._data)r(e._data[s].babylonMaterial,this._buildAnimation(t,i,n))}}class Wt extends De{buildAnimations(e,t,i,n,r){r(e._babylonLight,this._buildAnimation(t,i,n))}}const zt={__array__:{__target__:!0,...we}},Ht={__array__:{__target__:!0,orthographic:{xmag:[new Gt(D.f.ANIMATIONTYPE_FLOAT,"orthoLeft",Lt,(()=>1)),new Gt(D.f.ANIMATIONTYPE_FLOAT,"orthoRight",kt,(()=>1))],ymag:[new Gt(D.f.ANIMATIONTYPE_FLOAT,"orthoBottom",Lt,(()=>1)),new Gt(D.f.ANIMATIONTYPE_FLOAT,"orthoTop",kt,(()=>1))],zfar:[new Gt(D.f.ANIMATIONTYPE_FLOAT,"maxZ",Nt,(()=>1))],znear:[new Gt(D.f.ANIMATIONTYPE_FLOAT,"minZ",Nt,(()=>1))]},perspective:{yfov:[new Gt(D.f.ANIMATIONTYPE_FLOAT,"fov",Nt,(()=>1))],zfar:[new Gt(D.f.ANIMATIONTYPE_FLOAT,"maxZ",Nt,(()=>1))],znear:[new Gt(D.f.ANIMATIONTYPE_FLOAT,"minZ",Nt,(()=>1))]}}},Xt={nodes:zt,materials:{__array__:{__target__:!0,pbrMetallicRoughness:{baseColorFactor:[new jt(D.f.ANIMATIONTYPE_COLOR3,"albedoColor",Bt,(()=>4)),new jt(D.f.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,i,n){return t[i+3]*n}),(()=>4))],metallicFactor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"metallic",Nt,(()=>1))],roughnessFactor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"roughness",Nt,(()=>1))],baseColorTexture:{extensions:{KHR_texture_transform:Ut("albedoTexture")}}},emissiveFactor:[new jt(D.f.ANIMATIONTYPE_COLOR3,"emissiveColor",Bt,(()=>3))],normalTexture:{scale:[new jt(D.f.ANIMATIONTYPE_FLOAT,"bumpTexture.level",Nt,(()=>1))]},occlusionTexture:{strength:[new jt(D.f.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",Nt,(()=>1))],extensions:{KHR_texture_transform:Ut("ambientTexture")}},emissiveTexture:{extensions:{KHR_texture_transform:Ut("emissiveTexture")}},extensions:{KHR_materials_ior:{ior:[new jt(D.f.ANIMATIONTYPE_FLOAT,"indexOfRefraction",Nt,(()=>1))]},KHR_materials_clearcoat:{clearcoatFactor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",Nt,(()=>1))],clearcoatRoughnessFactor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",Nt,(()=>1))]},KHR_materials_sheen:{sheenColorFactor:[new jt(D.f.ANIMATIONTYPE_COLOR3,"sheen.color",Bt,(()=>3))],sheenRoughnessFactor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"sheen.roughness",Nt,(()=>1))]},KHR_materials_specular:{specularFactor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"metallicF0Factor",Nt,(()=>1))],specularColorFactor:[new jt(D.f.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",Bt,(()=>3))]},KHR_materials_emissive_strength:{emissiveStrength:[new jt(D.f.ANIMATIONTYPE_FLOAT,"emissiveIntensity",Nt,(()=>1))]},KHR_materials_transmission:{transmissionFactor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",Nt,(()=>1))]},KHR_materials_volume:{attenuationColor:[new jt(D.f.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",Bt,(()=>3))],attenuationDistance:[new jt(D.f.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",Nt,(()=>1))],thicknessFactor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",Nt,(()=>1))]},KHR_materials_iridescence:{iridescenceFactor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"iridescence.intensity",Nt,(()=>1))],iridescenceIor:[new jt(D.f.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",Nt,(()=>1))],iridescenceThicknessMinimum:[new jt(D.f.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",Nt,(()=>1))],iridescenceThicknessMaximum:[new jt(D.f.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",Nt,(()=>1))]}}}},cameras:Ht,extensions:{KHR_lights_punctual:{lights:{__array__:{__target__:!0,color:[new Wt(D.f.ANIMATIONTYPE_COLOR3,"diffuse",Bt,(()=>3))],intensity:[new Wt(D.f.ANIMATIONTYPE_FLOAT,"intensity",Nt,(()=>1))],range:[new Wt(D.f.ANIMATIONTYPE_FLOAT,"range",Nt,(()=>1))],spot:{innerConeAngle:[new Wt(D.f.ANIMATIONTYPE_FLOAT,"innerAngle",Vt,(()=>1))],outerConeAngle:[new Wt(D.f.ANIMATIONTYPE_FLOAT,"angle",Vt,(()=>1))]}}}}}},Yt="KHR_animation_pointer";class Qt{constructor(e){this.name=Yt,this._loader=e}get enabled(){return this._loader.isExtensionUsed(Yt)}dispose(){this._loader=null}_loadAnimationChannelAsync(e,t,i,n,r){var s;const o=null===(s=n.target.extensions)||void 0===s?void 0:s.KHR_animation_pointer;if(!o)return null;"pointer"!==n.target.path&&a.Y.Warn(`${e}/target/path: Value (${n.target.path}) must be (pointer) when using the ${this.name} extension`),null!=n.target.node&&a.Y.Warn(`${e}/target/node: Value (${n.target.node}) must not be present when using the ${this.name} extension`);const l=`${e}/extensions/${this.name}`,c=o.pointer;if(!c)throw new Error(`${l}: Pointer is missing`);const h=this._parseAnimationPointer(`${l}/pointer`,c);return h?this._loader._loadAnimationChannelFromTargetInfoAsync(e,t,i,n,h,r):(a.Y.Warn(`${l}/pointer: Invalid pointer (${c}) skipped`),null)}_parseAnimationPointer(e,t){if(!t.startsWith("/"))return a.Y.Warn(`${e}: Value (${t}) must start with a slash`),null;const i=t.split("/");i.shift();let n,r=Xt,s=this._loader.gltf;for(const e of i){if(r.__array__)r=r.__array__;else if(r=r[e],!r)return null;s=s&&s[e],r.__target__&&(n=s)}return n&&Array.isArray(r)?{target:n,properties:r}:null}}Ne.RegisterExtension(Yt,(e=>new Qt(e)));var qt=i("../../../node_modules/@babylonjs/core/Animations/animationEvent.js"),Kt=i("../../../node_modules/@babylonjs/core/Audio/sound.js"),Zt=i("../../../node_modules/@babylonjs/core/Audio/weightedsound.js");const $t="MSFT_audio_emitter";class Jt{constructor(e){this.name=$t,this._loader=e,this.enabled=this._loader.isExtensionUsed($t)}dispose(){this._loader=null,this._clips=null,this._emitters=null}onLoading(){const e=this._loader.gltf.extensions;if(e&&e[this.name]){const t=e[this.name];this._clips=t.clips,this._emitters=t.emitters,Be.Assign(this._clips),Be.Assign(this._emitters)}}loadSceneAsync(e,t){return Ne.LoadExtensionAsync(e,t,this.name,((i,n)=>{const r=new Array;r.push(this._loader.loadSceneAsync(e,t));for(const e of n.emitters){const t=Be.Get(`${i}/emitters`,this._emitters,e);if(null!=t.refDistance||null!=t.maxDistance||null!=t.rolloffFactor||null!=t.distanceModel||null!=t.innerAngle||null!=t.outerAngle)throw new Error(`${i}: Direction or Distance properties are not allowed on emitters attached to a scene`);r.push(this._loadEmitterAsync(`${i}/emitters/${t.index}`,t))}return Promise.all(r).then((()=>{}))}))}loadNodeAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((e,n)=>{const s=new Array;return this._loader.loadNodeAsync(e,t,(t=>{for(const i of n.emitters){const n=Be.Get(`${e}/emitters`,this._emitters,i);s.push(this._loadEmitterAsync(`${e}/emitters/${n.index}`,n).then((()=>{for(const e of n._babylonSounds)e.attachToMesh(t),null==n.innerAngle&&null==n.outerAngle||(e.setLocalDirectionToMesh(R.P.Forward()),e.setDirectionalCone(2*r.w1.ToDegrees(null==n.innerAngle?Math.PI:n.innerAngle),2*r.w1.ToDegrees(null==n.outerAngle?Math.PI:n.outerAngle),0))})))}i(t)})).then((e=>Promise.all(s).then((()=>e))))}))}loadAnimationAsync(e,t){return Ne.LoadExtensionAsync(e,t,this.name,((i,n)=>this._loader.loadAnimationAsync(e,t).then((r=>{const s=new Array;Be.Assign(n.events);for(const o of n.events)s.push(this._loadAnimationEventAsync(`${i}/events/${o.index}`,e,t,o,r));return Promise.all(s).then((()=>r))}))))}_loadClipAsync(e,t){if(t._objectURL)return t._objectURL;let i;if(t.uri)i=this._loader.loadUriAsync(e,t,t.uri);else{const n=Be.Get(`${e}/bufferView`,this._loader.gltf.bufferViews,t.bufferView);i=this._loader.loadBufferViewAsync(`/bufferViews/${n.index}`,n)}return t._objectURL=i.then((e=>URL.createObjectURL(new Blob([e],{type:t.mimeType})))),t._objectURL}_loadEmitterAsync(e,t){if(t._babylonSounds=t._babylonSounds||[],!t._babylonData){const e=new Array,i=t.name||`emitter${t.index}`,n={loop:!1,autoplay:!1,volume:null==t.volume?1:t.volume};for(let r=0;r{const s=t._babylonSounds[r]=new Kt.$(i,e,this._loader.babylonScene,null,n);s.refDistance=t.refDistance||1,s.maxDistance=t.maxDistance||256,s.rolloffFactor=t.rolloffFactor||1,s.distanceModel=t.distanceModel||"exponential"})))}const s=Promise.all(e).then((()=>{const e=t.clips.map((e=>e.weight||1)),i=new Zt.s(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(i.directionalConeInnerAngle=2*r.w1.ToDegrees(t.innerAngle)),t.outerAngle&&(i.directionalConeOuterAngle=2*r.w1.ToDegrees(t.outerAngle)),t.volume&&(i.volume=t.volume),t._babylonData.sound=i}));t._babylonData={loaded:s}}return t._babylonData.loaded}_getEventAction(e,t,i,n,r){switch(i){case"play":return e=>{const i=(r||0)+(e-n);t.play(i)};case"stop":return()=>{t.stop()};case"pause":return()=>{t.pause()};default:throw new Error(`${e}: Unsupported action ${i}`)}}_loadAnimationEventAsync(e,t,i,n,r){if(0==r.targetedAnimations.length)return Promise.resolve();const s=r.targetedAnimations[0],o=n.emitter,a=Be.Get(`/extensions/${this.name}/emitters`,this._emitters,o);return this._loadEmitterAsync(e,a).then((()=>{const t=a._babylonData.sound;if(t){const i=new qt.O(n.time,this._getEventAction(e,t,n.action,n.time,n.startOffset));s.animation.addEvent(i),r.onAnimationGroupEndObservable.add((()=>{t.stop()})),r.onAnimationGroupPauseObservable.add((()=>{t.pause()}))}}))}}Ne.RegisterExtension($t,(e=>new Jt(e)));const ei="MSFT_lod";class ti{constructor(e){this.name=ei,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new n.y$,this.onMaterialLODsLoadedObservable=new n.y$,this._bufferLODs=new Array,this._nodeIndexLOD=null,this._nodeSignalLODs=new Array,this._nodePromiseLODs=new Array,this._nodeBufferLODs=new Array,this._materialIndexLOD=null,this._materialSignalLODs=new Array,this._materialPromiseLODs=new Array,this._materialBufferLODs=new Array,this._loader=e,this.enabled=this._loader.isExtensionUsed(ei)}dispose(){this._loader=null,this._nodeIndexLOD=null,this._nodeSignalLODs.length=0,this._nodePromiseLODs.length=0,this._nodeBufferLODs.length=0,this._materialIndexLOD=null,this._materialSignalLODs.length=0,this._materialPromiseLODs.length=0,this._materialBufferLODs.length=0,this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()}onReady(){for(let e=0;e{0!==e&&(this._loader.endPerformanceCounter(`Node LOD ${e}`),this._loader.log(`Loaded node LOD ${e}`)),this.onNodeLODsLoadedObservable.notifyObservers(e),e!==this._nodePromiseLODs.length-1&&(this._loader.startPerformanceCounter(`Node LOD ${e+1}`),this._loadBufferLOD(this._nodeBufferLODs,e+1),this._nodeSignalLODs[e]&&this._nodeSignalLODs[e].resolve())}));this._loader._completePromises.push(t)}for(let e=0;e{0!==e&&(this._loader.endPerformanceCounter(`Material LOD ${e}`),this._loader.log(`Loaded material LOD ${e}`)),this.onMaterialLODsLoadedObservable.notifyObservers(e),e!==this._materialPromiseLODs.length-1&&(this._loader.startPerformanceCounter(`Material LOD ${e+1}`),this._loadBufferLOD(this._materialBufferLODs,e+1),this._materialSignalLODs[e]&&this._materialSignalLODs[e].resolve())}));this._loader._completePromises.push(t)}}loadSceneAsync(e,t){const i=this._loader.loadSceneAsync(e,t);return this._loadBufferLOD(this._bufferLODs,0),i}loadNodeAsync(e,t,i){return Ne.LoadExtensionAsync(e,t,this.name,((e,n)=>{let r;const s=this._getLODs(e,t,this._loader.gltf.nodes,n.ids);this._loader.logOpen(`${e}`);for(let e=0;e{i(e),e.setEnabled(!1)},o=this._loader.loadNodeAsync(`/nodes/${t.index}`,t,n).then((t=>{if(0!==e){const t=s[e-1];t._babylonTransformNode&&(this._disposeTransformNode(t._babylonTransformNode),delete t._babylonTransformNode)}return t.setEnabled(!0),t}));this._nodePromiseLODs[e]=this._nodePromiseLODs[e]||[],0===e?r=o:(this._nodeIndexLOD=null,this._nodePromiseLODs[e].push(o))}return this._loader.logClose(),r}))}_loadMaterialAsync(e,t,i,n,r){return this._nodeIndexLOD?null:Ne.LoadExtensionAsync(e,t,this.name,((e,s)=>{let o;const a=this._getLODs(e,t,this._loader.gltf.materials,s.ids);this._loader.logOpen(`${e}`);for(let e=0;e{0===e&&r(t)})).then((t=>{if(0!==e){r(t);const i=a[e-1]._data;i[n]&&(this._disposeMaterials([i[n].babylonMaterial]),delete i[n])}return t}));this._materialPromiseLODs[e]=this._materialPromiseLODs[e]||[],0===e?o=s:(this._materialIndexLOD=null,this._materialPromiseLODs[e].push(s))}return this._loader.logClose(),o}))}_loadUriAsync(e,t,i){if(null!==this._nodeIndexLOD){this._loader.log("deferred");const n=this._nodeIndexLOD-1;return this._nodeSignalLODs[n]=this._nodeSignalLODs[n]||new Ce.B,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((()=>this._loader.loadUriAsync(e,t,i)))}if(null!==this._materialIndexLOD){this._loader.log("deferred");const n=this._materialIndexLOD-1;return this._materialSignalLODs[n]=this._materialSignalLODs[n]||new Ce.B,this._materialSignalLODs[n].promise.then((()=>this._loader.loadUriAsync(e,t,i)))}return null}loadBufferAsync(e,t,i,n){if(this._loader.parent.useRangeRequests&&!t.uri){if(!this._loader.bin)throw new Error(`${e}: Uri is missing or the binary glTF is missing its binary chunk`);const t=(e,t)=>{const r=i,s=r+n-1;let o=e[t];return o?(o.start=Math.min(o.start,r),o.end=Math.max(o.end,s)):(o={start:r,end:s,loaded:new Ce.B},e[t]=o),o.loaded.promise.then((e=>new Uint8Array(e.buffer,e.byteOffset+i-o.start,n)))};return this._loader.log("deferred"),null!==this._nodeIndexLOD?t(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?t(this._materialBufferLODs,this._materialIndexLOD):t(this._bufferLODs,0)}return null}_loadBufferLOD(e,t){const i=e[t];i&&(this._loader.log(`Loading buffer range [${i.start}-${i.end}]`),this._loader.bin.readAsync(i.start,i.end-i.start+1).then((e=>{i.loaded.resolve(e)}),(e=>{i.loaded.reject(e)})))}_getLODs(e,t,i,n){if(this.maxLODsToLoad<=0)throw new Error("maxLODsToLoad must be greater than zero");const r=new Array;for(let t=n.length-1;t>=0;t--)if(r.push(Be.Get(`${e}/ids/${n[t]}`,i,n[t])),r.length===this.maxLODsToLoad)return r;return r.push(t),r}_disposeTransformNode(e){const t=new Array,i=e.material;i&&t.push(i);for(const i of e.getChildMeshes())i.material&&t.push(i.material);e.dispose();const n=t.filter((e=>this._loader.babylonScene.meshes.every((t=>t.material!=e))));this._disposeMaterials(n)}_disposeMaterials(e){const t={};for(const i of e){for(const e of i.getActiveTextures())t[e.uniqueId]=e;i.dispose()}for(const e in t)for(const i of this._loader.babylonScene.materials)i.hasTexture(t[e])&&delete t[e];for(const e in t)t[e].dispose()}}Ne.RegisterExtension(ei,(e=>new ti(e)));const ii="MSFT_minecraftMesh";class ni{constructor(e){this.name=ii,this._loader=e,this.enabled=this._loader.isExtensionUsed(ii)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtraAsync(e,t,this.name,((n,r)=>{if(r){if(!(i instanceof Te.Y))throw new Error(`${n}: Material type not supported`);const r=this._loader.loadMaterialPropertiesAsync(e,t,i);return i.needAlphaBlending()&&(i.forceDepthWrite=!0,i.separateCullingPass=!0),i.backFaceCulling=i.forceDepthWrite,i.twoSidedLighting=!0,r}return null}))}}Ne.RegisterExtension(ii,(e=>new ni(e)));const ri="MSFT_sRGBFactors";class si{constructor(e){this.name=ri,this._loader=e,this.enabled=this._loader.isExtensionUsed(ri)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,i){return Ne.LoadExtraAsync(e,t,this.name,((n,r)=>{if(r){if(!(i instanceof Te.Y))throw new Error(`${n}: Material type not supported`);const r=this._loader.loadMaterialPropertiesAsync(e,t,i);return i.albedoTexture||i.albedoColor.toLinearSpaceToRef(i.albedoColor),i.reflectivityTexture||i.reflectivityColor.toLinearSpaceToRef(i.reflectivityColor),r}return null}))}}Ne.RegisterExtension(ri,(e=>new si(e)));const oi="ExtrasAsMetadata";class ai{constructor(e){this.name=oi,this.enabled=!0,this._loader=e}_assignExtras(e,t){if(t.extras&&Object.keys(t.extras).length>0){const i=e.metadata=e.metadata||{};(i.gltf=i.gltf||{}).extras=t.extras}}dispose(){this._loader=null}loadNodeAsync(e,t,i){return this._loader.loadNodeAsync(e,t,(e=>{this._assignExtras(e,t),i(e)}))}loadCameraAsync(e,t,i){return this._loader.loadCameraAsync(e,t,(e=>{this._assignExtras(e,t),i(e)}))}createMaterial(e,t,i){const n=this._loader.createMaterial(e,t,i);return this._assignExtras(n,t),n}}Ne.RegisterExtension(oi,(e=>new ai(e)))},"../../../node_modules/ammojs-typed/ammo/ammo.js":function(e,t,i){var n,r=(n=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e){var t;e=e||{},t||(t=void 0!==e?e:{});var r,s=function(){function e(){}function t(e){if(!(this instanceof t))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this.m=0,this.ia=!1,this.o=void 0,this.s=[],a(e,this)}function i(e,i){for(;3===e.m;)e=e.o;0===e.m?e.s.push(i):(e.ia=!0,t.ja((function(){var t=1===e.m?i.Vc:i.Wc;if(null===t)(1===e.m?n:r)(i.Y,e.o);else{try{var s=t(e.o)}catch(e){return void r(i.Y,e)}n(i.Y,s)}})))}function n(e,i){try{if(i===e)throw new TypeError("A promise cannot be resolved with itself.");if(i&&("object"==typeof i||"function"==typeof i)){var n=i.then;if(i instanceof t)return e.m=3,e.o=i,void s(e);if("function"==typeof n)return void a(function(e,t){return function(){e.apply(t,arguments)}}(n,i),e)}e.m=1,e.o=i,s(e)}catch(t){r(e,t)}}function r(e,t){e.m=2,e.o=t,s(e)}function s(e){2===e.m&&0===e.s.length&&t.ja((function(){e.ia||t.ka(e.o)}));for(var n=0,r=e.s.length;n=0;--d)_[48+d]=52+d,_[65+d]=d,_[97+d]=26+d;function u(e,t,i){for(var n,r,s=0,o=t,a=i.length,l=t+(3*a>>2)-("="==i[a-2])-("="==i[a-1]);s>4,o>2),o>2]=0,d[n+156>>2]=0,d[n+144>>2]=0,d[n+148>>2]=0,d[n+136>>2]=1065353216,d[n+140>>2]=0,d[n+128>>2]=1065353216,d[n+132>>2]=1065353216,d[n+120>>2]=0,d[n+124>>2]=0,d[n+112>>2]=1065353216,d[n+116>>2]=0;e:if(256&i){if(d[7720]=1805,d[7721]=0,(0|(p=d[e+1112>>2]))<1)break e;for(;;){if(u[d[(M=N<<2)+d[e+1120>>2]>>2]+377|0]){if(o=id(d[7720],d[7721],1284865837,1481765933)+1|0,h=w,h=o>>>0<1?h+1|0:h,d[7720]=o,d[7721]=h,p=h>>>1|0,o=id(d[7720],d[7721],1284865837,1481765933)+1|0,h=w,h=o>>>0<1?h+1|0:h,d[7720]=o,d[7721]=h,S=h>>>1|0,o=id(d[7720],d[7721],1284865837,1481765933)+1|0,_=w,_=o>>>0<1?_+1|0:_,d[7720]=o,d[7721]=_,a=y(y(_>>>1|0)*y(4.656612873077393e-10)),c=y(y(0|p)*y(4.656612873077393e-10)),f=y(y(0|S)*y(4.656612873077393e-10)),l=y(y(1)/y(x(y(y(a*a)+y(y(c*c)+y(f*f)))))),m[n+168>>2]=y(a*l)*y(.75),m[n+164>>2]=y(f*l)*y(.75),m[n+160>>2]=y(c*l)*y(.75),d[n+172>>2]=0,(0|(o=d[d[M+d[e+1120>>2]>>2]+24>>2]))<=0)S=0;else{for(p=0,d[7717]=d[7717]+1,S=0|r[d[6606]](o<<4,16);B=d[n+52>>2],d[(_=h=(p<<4)+S|0)>>2]=d[n+48>>2],d[_+4>>2]=B,_=d[n+60>>2],d[h+8>>2]=d[n+56>>2],d[h+12>>2]=_,(0|o)!=(0|(p=p+1|0)););if(p=0,!((0|o)<1))for(;h=d[d[d[M+d[e+1120>>2]>>2]+32>>2]+(p<<2)>>2],B=d[h+12>>2],d[(_=(p<<4)+S|0)>>2]=d[h+8>>2],d[_+4>>2]=B,B=d[h+20>>2],d[_+8>>2]=d[h+16>>2],d[_+12>>2]=B,(0|o)!=(0|(p=p+1|0)););}if(B=0,d[n+60>>2]=0,s[n+64|0]=1,s[n+84|0]=1,d[n+52>>2]=0,d[n+56>>2]=0,d[n+80>>2]=0,s[n+104|0]=1,d[n+72>>2]=0,d[n+76>>2]=0,d[n+100>>2]=0,d[n+92>>2]=0,d[n+96>>2]=0,H(n+48|0,S,o),(0|(h=d[n+92>>2]))>0)for(;;){if(M=d[n+80>>2]+b(d[d[n+100>>2]+(B<<2)>>2],12)|0,o=b(d[M+4>>2],12)+M|0,(0|(p=b(d[o>>2],12)+o|0))!=(0|M)){for(h=d[o+8>>2],o=d[M+8>>2];k=(_=d[n+60>>2])+(h<<4)|0,V=(o<<4)+_|0,h=_,_=d[p+8>>2],r[d[d[t>>2]+28>>2]](t,k,V,h+(_<<4)|0,n+160|0,y(1)),h=o,o=_,_=b(d[p+4>>2],12)+p|0,(0|M)!=(0|(p=b(d[_>>2],12)+_|0)););h=d[n+92>>2]}if(!((0|(B=B+1|0))<(0|h)))break}(o=d[n+100>>2])&&(u[n+104|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[n+100>>2]=0),d[n+100>>2]=0,s[n+104|0]=1,d[n+92>>2]=0,d[n+96>>2]=0,(o=d[n+80>>2])&&(u[n+84|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[n+80>>2]=0),d[n+80>>2]=0,s[n+84|0]=1,d[n+72>>2]=0,d[n+76>>2]=0,(o=d[n+60>>2])&&(u[n+64|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[n+60>>2]=0),S&&S&&(d[7718]=d[7718]+1,r[d[6607]](S)),p=d[e+1112>>2]}if(!((0|(N=N+1|0))<(0|p)))break}}else{if(1&i&&!((0|(h=d[e+712>>2]))<1))for(;_=d[e+720>>2]+b(o,104)|0,1&s[d[_+4>>2]+16|0]&&(l=m[_+8>>2],h=d[_+16>>2],d[n+52>>2]=d[_+12>>2],d[n+56>>2]=h,d[n+60>>2]=0,m[n+48>>2]=l+y(-.10000000149011612),l=m[_+8>>2],a=m[_+12>>2],c=m[_+16>>2],d[n+172>>2]=0,m[n+168>>2]=c+y(0),m[n+164>>2]=a+y(0),m[n+160>>2]=l+y(.10000000149011612),d[n+40>>2]=0,d[n+44>>2]=0,d[n+32>>2]=1065353216,d[n+36>>2]=0,r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+32|0),l=m[_+12>>2],h=d[_+8>>2],S=d[_+16>>2],d[n+60>>2]=0,d[n+56>>2]=S,d[n+48>>2]=h,m[n+52>>2]=l+y(-.10000000149011612),l=m[_+8>>2],a=m[_+12>>2],c=m[_+16>>2],d[n+172>>2]=0,m[n+168>>2]=c+y(0),m[n+164>>2]=a+y(.10000000149011612),m[n+160>>2]=l+y(0),d[n+40>>2]=0,d[n+44>>2]=0,d[n+32>>2]=0,d[n+36>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+32|0),l=m[_+16>>2],h=d[_+12>>2],S=d[_+8>>2],d[n+60>>2]=0,d[n+48>>2]=S,d[n+52>>2]=h,m[n+56>>2]=l+y(-.10000000149011612),l=m[_+8>>2],a=m[_+12>>2],c=m[_+16>>2],d[n+172>>2]=0,m[n+168>>2]=c+y(.10000000149011612),m[n+164>>2]=a+y(0),m[n+160>>2]=l+y(0),d[n+40>>2]=1065353216,d[n+44>>2]=0,d[n+32>>2]=0,d[n+36>>2]=0,r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+32|0),h=d[e+712>>2]),(0|(o=o+1|0))<(0|h););if(2&i&&!((0|(h=d[e+732>>2]))<1))for(;o=d[e+740>>2]+b(p,52)|0,1&s[d[o+4>>2]+16|0]&&(r[d[d[t>>2]+8>>2]](t,d[o+8>>2]+8|0,d[o+12>>2]+8|0,n+144|0),h=d[e+732>>2]),(0|(p=p+1|0))<(0|h););if(16&i&&!((0|(h=d[e+712>>2]))<1))for(o=0;_=d[e+720>>2]+b(o,104)|0,1&s[d[_+4>>2]+16|0]&&(l=m[_+72>>2],a=m[_+76>>2],c=m[_+80>>2],f=m[_+8>>2],g=m[_+12>>2],v=m[_+16>>2],d[n+60>>2]=0,c=y(c*y(.5)),m[n+56>>2]=v+c,a=y(a*y(.5)),m[n+52>>2]=g+a,l=y(l*y(.5)),m[n+48>>2]=f+l,h=_+8|0,r[d[d[t>>2]+8>>2]](t,h,n+48|0,n+128|0),f=m[_+8>>2],g=m[_+12>>2],v=m[_+16>>2],d[n+60>>2]=0,m[n+56>>2]=v-c,m[n+52>>2]=g-a,m[n+48>>2]=f-l,d[n+172>>2]=0,m[n+168>>2]=m[n+136>>2]*y(.5),m[n+164>>2]=m[n+132>>2]*y(.5),m[n+160>>2]=m[n+128>>2]*y(.5),r[d[d[t>>2]+8>>2]](t,h,n+48|0,n+160|0),h=d[e+712>>2]),(0|(o=o+1|0))<(0|h););if(32&i&&(1&s[30816]||mc(30816)&&(d[7693]=0,d[7694]=0,d[7692]=1065353216,d[7695]=0,d[7696]=0,d[7698]=0,d[7699]=0,d[7697]=1065353216,d[7700]=0,d[7701]=0,d[7702]=1065353216,d[7703]=0,uh(30816)),!(d[e+812>>2]<1)))for(o=0;h=d[e+820>>2]+b(o,104)|0,C=m[h+20>>2],l=m[h+12>>2],_=d[h+24>>2],a=m[_+16>>2],c=m[h+8>>2],f=m[_+12>>2],g=m[h+4>>2],v=m[_+8>>2],d[n+60>>2]=0,L=g,g=y(C+y(y(y(v*g)+y(f*c))+y(a*l))),v=y(v-y(L*g)),m[n+48>>2]=v,C=y(f-y(c*g)),m[n+52>>2]=C,g=y(a-y(l*g)),m[n+56>>2]=g,l=m[h+4>>2],a=m[h+12>>2],c=m[h+8>>2],f=m[30772+(_=(l>2],T=m[_+30768>>2],E=m[_+30776>>2],d[n+172>>2]=0,A=y(y(l*f)-y(c*T)),R=y(y(c*E)-y(a*f)),T=y(y(a*T)-y(l*E)),f=y(y(1)/y(x(y(y(A*A)+y(y(R*R)+y(T*T)))))),E=y(A*f),A=y(E*y(.5)),m[n+168>>2]=g-A,T=y(T*f),P=y(T*y(.5)),m[n+164>>2]=C-P,f=y(R*f),R=y(f*y(.5)),m[n+160>>2]=v-R,d[n+44>>2]=0,m[n+40>>2]=g+A,m[n+36>>2]=C+P,m[n+32>>2]=v+R,r[d[d[t>>2]+8>>2]](t,n+160|0,n+32|0,n+112|0),d[n+172>>2]=0,g=y(y(c*f)-y(l*T)),c=y(y(a*T)-y(c*E)),a=y(y(l*E)-y(a*f)),l=y(y(1)/y(x(y(y(g*g)+y(y(c*c)+y(a*a)))))),f=m[n+56>>2],g=y(y(g*l)*y(.5)),m[n+168>>2]=f-g,v=m[n+52>>2],a=y(y(a*l)*y(.5)),m[n+164>>2]=v-a,C=m[n+48>>2],l=y(y(c*l)*y(.5)),m[n+160>>2]=C-l,d[n+44>>2]=0,m[n+40>>2]=g+f,m[n+36>>2]=a+v,m[n+32>>2]=C+l,r[d[d[t>>2]+8>>2]](t,n+160|0,n+32|0,n+112|0),l=m[h+4>>2],a=m[h+8>>2],c=m[h+12>>2],d[n+172>>2]=0,m[n+168>>2]=y(y(c*y(.5))*y(3))+m[n+56>>2],m[n+164>>2]=y(y(a*y(.5))*y(3))+m[n+52>>2],m[n+160>>2]=y(y(l*y(.5))*y(3))+m[n+48>>2],d[n+40>>2]=0,d[n+44>>2]=0,d[n+32>>2]=1065353216,d[n+36>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+32|0),(0|(o=o+1|0))>2];);if(4&i&&(d[n+56>>2]=0,d[n+60>>2]=0,d[n+48>>2]=0,d[n+52>>2]=1060320051,!((0|(h=d[e+752>>2]))<1)))for(p=0;o=d[e+760>>2]+b(p,44)|0,1&s[d[o+4>>2]+16|0]&&(h=d[o+16>>2],f=m[h+12>>2],_=d[o+8>>2],g=m[_+12>>2],o=d[o+12>>2],v=m[o+12>>2],C=m[h+16>>2],c=m[_+16>>2],T=m[o+16>>2],E=m[h+8>>2],a=m[_+8>>2],A=m[o+8>>2],d[n+172>>2]=0,l=y(y(E+y(a+A))*y(.3333333432674408)),m[n+160>>2]=l+y(y(a-l)*y(.800000011920929)),a=y(y(C+y(c+T))*y(.3333333432674408)),m[n+168>>2]=a+y(y(c-a)*y(.800000011920929)),c=y(y(f+y(g+v))*y(.3333333432674408)),m[n+164>>2]=c+y(y(g-c)*y(.800000011920929)),d[n+44>>2]=0,m[n+40>>2]=a+y(y(T-a)*y(.800000011920929)),m[n+36>>2]=c+y(y(v-c)*y(.800000011920929)),m[n+32>>2]=l+y(y(A-l)*y(.800000011920929)),d[n+28>>2]=0,m[n+24>>2]=a+y(y(C-a)*y(.800000011920929)),m[n+20>>2]=c+y(y(f-c)*y(.800000011920929)),m[n+16>>2]=l+y(y(E-l)*y(.800000011920929)),r[d[d[t>>2]+28>>2]](t,n+160|0,n+32|0,n+16|0,n+48|0,y(1)),h=d[e+752>>2]),(0|(p=p+1|0))<(0|h););if(8&i&&(d[n+56>>2]=1060320051,d[n+60>>2]=0,d[n+48>>2]=1050253722,d[n+52>>2]=1050253722,!((0|(h=d[e+772>>2]))<1)))for(p=0;o=d[e+780>>2]+b(p,104)|0,1&s[d[o+4>>2]+16|0]&&(h=d[o+20>>2],f=m[h+12>>2],_=d[o+16>>2],g=m[_+12>>2],S=d[o+8>>2],v=m[S+12>>2],o=d[o+12>>2],C=m[o+12>>2],T=m[h+16>>2],E=m[_+16>>2],c=m[S+16>>2],A=m[o+16>>2],R=m[h+8>>2],P=m[_+8>>2],a=m[S+8>>2],I=m[o+8>>2],d[n+172>>2]=0,l=y(y(R+y(P+y(a+I)))*y(.25)),D=y(l+y(y(a-l)*y(.800000011920929))),m[n+160>>2]=D,a=y(y(T+y(E+y(c+A)))*y(.25)),F=y(a+y(y(c-a)*y(.800000011920929))),m[n+168>>2]=F,c=y(y(f+y(g+y(v+C)))*y(.25)),v=y(c+y(y(v-c)*y(.800000011920929))),m[n+164>>2]=v,d[n+44>>2]=0,A=y(a+y(y(A-a)*y(.800000011920929))),m[n+40>>2]=A,C=y(c+y(y(C-c)*y(.800000011920929))),m[n+36>>2]=C,I=y(l+y(y(I-l)*y(.800000011920929))),m[n+32>>2]=I,d[n+28>>2]=0,E=y(a+y(y(E-a)*y(.800000011920929))),m[n+24>>2]=E,g=y(c+y(y(g-c)*y(.800000011920929))),m[n+20>>2]=g,P=y(l+y(y(P-l)*y(.800000011920929))),m[n+16>>2]=P,r[d[d[t>>2]+28>>2]](t,n+160|0,n+32|0,n+16|0,n+48|0,y(1)),d[n+172>>2]=0,m[n+168>>2]=F,m[n+164>>2]=v,m[n+160>>2]=D,d[n+44>>2]=0,m[n+40>>2]=A,m[n+36>>2]=C,m[n+32>>2]=I,d[n+28>>2]=0,a=y(a+y(y(T-a)*y(.800000011920929))),m[n+24>>2]=a,c=y(c+y(y(f-c)*y(.800000011920929))),m[n+20>>2]=c,l=y(l+y(y(R-l)*y(.800000011920929))),m[n+16>>2]=l,r[d[d[t>>2]+28>>2]](t,n+160|0,n+32|0,n+16|0,n+48|0,y(1)),d[n+172>>2]=0,m[n+168>>2]=A,m[n+164>>2]=C,m[n+160>>2]=I,d[n+44>>2]=0,m[n+40>>2]=E,m[n+36>>2]=g,m[n+32>>2]=P,d[n+28>>2]=0,m[n+24>>2]=a,m[n+20>>2]=c,m[n+16>>2]=l,r[d[d[t>>2]+28>>2]](t,n+160|0,n+32|0,n+16|0,n+48|0,y(1)),d[n+172>>2]=0,m[n+168>>2]=E,m[n+164>>2]=g,m[n+160>>2]=P,d[n+44>>2]=0,m[n+40>>2]=F,m[n+36>>2]=v,m[n+32>>2]=D,d[n+28>>2]=0,m[n+24>>2]=a,m[n+20>>2]=c,m[n+16>>2]=l,r[d[d[t>>2]+28>>2]](t,n+160|0,n+32|0,n+16|0,n+48|0,y(1)),h=d[e+772>>2]),(0|(p=p+1|0))<(0|h););}if(64&i){if(d[e+792>>2]>=1)for(h=0;_=d[e+800>>2]+b(h,96)|0,o=d[_+20>>2],f=m[o+52>>2],g=m[o+12>>2],v=m[o+8>>2],C=m[o+4>>2],T=m[o+56>>2],E=m[o+28>>2],A=m[o+20>>2],R=m[o+24>>2],P=m[o+60>>2],l=m[_+12>>2],I=m[o+44>>2],a=m[_+4>>2],D=m[o+36>>2],c=m[_+8>>2],F=m[o+40>>2],d[n+44>>2]=0,m[n+40>>2]=P+y(y(y(a*D)+y(c*F))+y(l*I)),m[n+36>>2]=T+y(y(y(a*A)+y(c*R))+y(l*E)),m[n+32>>2]=f+y(y(y(a*C)+y(c*v))+y(l*g)),o=d[_>>2],d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=1065353216,d[n+20>>2]=0,l=m[o+8>>2],a=m[o+12>>2],c=m[o+16>>2],d[n+60>>2]=0,m[n+56>>2]=c,m[n+52>>2]=a,m[n+48>>2]=l+y(-.25),d[n+172>>2]=0,m[n+168>>2]=c+y(0),m[n+164>>2]=a+y(0),m[n+160>>2]=l+y(.25),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+16|0),l=m[o+12>>2],a=m[o+8>>2],c=m[o+16>>2],d[n+60>>2]=0,m[n+56>>2]=c,m[n+48>>2]=a,m[n+52>>2]=l+y(-.25),d[n+172>>2]=0,m[n+168>>2]=c+y(0),m[n+164>>2]=l+y(.25),m[n+160>>2]=a+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+16|0),l=m[o+16>>2],a=m[o+8>>2],c=m[o+12>>2],d[n+60>>2]=0,m[n+52>>2]=c,m[n+48>>2]=a,m[n+56>>2]=l+y(-.25),d[n+172>>2]=0,m[n+168>>2]=l+y(.25),m[n+164>>2]=c+y(0),m[n+160>>2]=a+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+16|0),d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=0,d[n+20>>2]=1065353216,d[n+60>>2]=0,l=m[n+40>>2],m[n+56>>2]=l,a=m[n+36>>2],m[n+52>>2]=a,c=m[n+32>>2],m[n+48>>2]=c+y(-.25),d[n+172>>2]=0,m[n+168>>2]=l+y(0),m[n+164>>2]=a+y(0),m[n+160>>2]=c+y(.25),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+16|0),d[n+60>>2]=0,l=m[n+40>>2],m[n+56>>2]=l,a=m[n+36>>2],m[n+52>>2]=a+y(-.25),c=m[n+32>>2],m[n+48>>2]=c,d[n+172>>2]=0,m[n+168>>2]=l+y(0),m[n+164>>2]=a+y(.25),m[n+160>>2]=c+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+16|0),d[n+60>>2]=0,l=m[n+40>>2],m[n+56>>2]=l+y(-.25),a=m[n+36>>2],m[n+52>>2]=a,c=m[n+32>>2],m[n+48>>2]=c,d[n+172>>2]=0,m[n+168>>2]=l+y(.25),m[n+164>>2]=a+y(0),m[n+160>>2]=c+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+16|0),o=d[_>>2],d[n+56>>2]=1065353216,d[n+60>>2]=0,d[n+48>>2]=1065353216,d[n+52>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,o+8|0,n+32|0,n+48|0),(0|(h=h+1|0))>2];);if(!((0|(h=d[e+712>>2]))<1))for(p=0;o=d[e+720>>2]+b(p,104)|0,!(1&s[d[o+4>>2]+16|0])|m[o+88>>2]<=y(0)^1||(d[n+40>>2]=0,d[n+44>>2]=0,d[n+32>>2]=1065353216,d[n+36>>2]=0,l=m[o+8>>2],a=m[o+12>>2],c=m[o+16>>2],d[n+60>>2]=0,m[n+56>>2]=c,m[n+52>>2]=a,m[n+48>>2]=l+y(-.25),d[n+172>>2]=0,m[n+168>>2]=c+y(0),m[n+164>>2]=a+y(0),m[n+160>>2]=l+y(.25),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+32|0),l=m[o+12>>2],a=m[o+8>>2],c=m[o+16>>2],d[n+60>>2]=0,m[n+56>>2]=c,m[n+48>>2]=a,m[n+52>>2]=l+y(-.25),d[n+172>>2]=0,m[n+168>>2]=c+y(0),m[n+164>>2]=l+y(.25),m[n+160>>2]=a+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+32|0),l=m[o+16>>2],a=m[o+8>>2],c=m[o+12>>2],d[n+60>>2]=0,m[n+52>>2]=c,m[n+48>>2]=a,m[n+56>>2]=l+y(-.25),d[n+172>>2]=0,m[n+168>>2]=l+y(.25),m[n+164>>2]=c+y(0),m[n+160>>2]=a+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n+32|0),h=d[e+712>>2]),(0|(p=p+1|0))<(0|h););}if(!(!(128&i)|d[e+692>>2]<1))for(h=0;;){if(o=d[e+700>>2]+b(h,60)|0,_=d[o+20>>2],d[n+56>>2]=d[o+16>>2],d[n+60>>2]=_,_=d[o+12>>2],d[n+48>>2]=d[o+8>>2],d[n+52>>2]=_,(0|(S=d[o+24>>2]))>=1)for(p=0,l=m[n+56>>2],a=m[n+52>>2],c=m[n+48>>2];_=d[28+(M=o+(p<<2)|0)>>2],g=m[_+12>>2],v=m[_+16>>2],f=m[M+44>>2],c=y(y(m[_+8>>2]*f)+c),m[n+48>>2]=c,l=y(y(f*v)+l),m[n+56>>2]=l,a=y(y(f*g)+a),m[n+52>>2]=a,(0|S)!=(0|(p=p+1|0)););if(r[d[d[t>>2]+40>>2]](t,n+48|0,d[o+4>>2]),!((0|(h=h+1|0))>2]))break}if(512&i&&(o=d[e+928>>2],d[n+56>>2]=1065353216,d[n+60>>2]=0,d[n+48>>2]=1065353216,d[n+52>>2]=0,d[n+168>>2]=1065353216,d[n+172>>2]=0,d[n+160>>2]=1065353216,d[n+164>>2]=1065353216,Jt(t,o,0,n+48|0,n+160|0,0,-1)),1024&i&&(o=d[e+988>>2],d[n+56>>2]=0,d[n+60>>2]=0,d[n+48>>2]=0,d[n+52>>2]=1065353216,d[n+168>>2]=0,d[n+172>>2]=0,d[n+160>>2]=1065353216,d[n+164>>2]=0,Jt(t,o,0,n+48|0,n+160|0,0,-1)),2048&i&&(o=d[e+1048>>2],d[n+56>>2]=1065353216,d[n+60>>2]=0,d[n+48>>2]=0,d[n+52>>2]=1065353216,d[n+168>>2]=0,d[n+172>>2]=0,d[n+160>>2]=1065353216,d[n+164>>2]=0,Jt(t,o,0,n+48|0,n+160|0,0,-1)),!(!(4096&i)|d[e+852>>2]<1))for(h=0;;){e:{t:{i:switch(i=d[d[e+860>>2]+(h<<2)>>2],0|r[d[d[i>>2]+20>>2]](i)){case 1:break t;case 0:break i;default:break e}o=qi(_=i+4|0),f=m[o+52>>2],g=m[o+16>>2],v=m[o+20>>2],C=m[o+24>>2],T=m[o+56>>2],E=m[o+32>>2],A=m[o+36>>2],R=m[o+40>>2],P=m[o+48>>2],I=m[o>>2],D=m[o+4>>2],l=m[i+32>>2],F=m[o+8>>2],a=m[i+36>>2],c=m[i+28>>2],d[n+44>>2]=0,m[n+32>>2]=P+y(y(y(c*I)+y(l*D))+y(a*F)),m[n+40>>2]=T+y(y(y(c*E)+y(l*A))+y(a*R)),m[n+36>>2]=f+y(y(y(c*g)+y(l*v))+y(a*C)),o=qi(p=i+16|0),f=m[o+52>>2],g=m[o+24>>2],v=m[o+20>>2],C=m[o+16>>2],T=m[o+56>>2],E=m[o+40>>2],A=m[o+36>>2],R=m[o+32>>2],P=m[o+48>>2],I=m[o+8>>2],l=m[i+52>>2],D=m[o>>2],a=m[i+44>>2],F=m[o+4>>2],c=m[i+48>>2],d[n+28>>2]=0,m[n+16>>2]=P+y(y(y(a*D)+y(c*F))+y(l*I)),m[n+24>>2]=T+y(y(y(a*R)+y(c*A))+y(l*E)),m[n+20>>2]=f+y(y(y(a*C)+y(c*v))+y(l*g)),i=qi(_),d[n+56>>2]=0,d[n+60>>2]=0,d[n+48>>2]=1065353216,d[n+52>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,i+48|0,n+32|0,n+48|0),i=qi(p),d[n+56>>2]=1065353216,d[n+60>>2]=0,d[n+48>>2]=0,d[n+52>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,i+48|0,n+16|0,n+48|0),d[n+8>>2]=0,d[n+12>>2]=0,d[n>>2]=1065353216,d[n+4>>2]=1065353216,d[n+60>>2]=0,l=m[n+40>>2],m[n+56>>2]=l,a=m[n+36>>2],m[n+52>>2]=a,c=m[n+32>>2],m[n+48>>2]=c+y(-.25),d[n+172>>2]=0,m[n+168>>2]=l+y(0),m[n+164>>2]=a+y(0),m[n+160>>2]=c+y(.25),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n),d[n+60>>2]=0,l=m[n+40>>2],m[n+56>>2]=l,a=m[n+36>>2],m[n+52>>2]=a+y(-.25),c=m[n+32>>2],m[n+48>>2]=c,d[n+172>>2]=0,m[n+168>>2]=l+y(0),m[n+164>>2]=a+y(.25),m[n+160>>2]=c+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n),d[n+60>>2]=0,l=m[n+40>>2],m[n+56>>2]=l+y(-.25),a=m[n+36>>2],m[n+52>>2]=a,c=m[n+32>>2],m[n+48>>2]=c,d[n+172>>2]=0,m[n+168>>2]=l+y(.25),m[n+164>>2]=a+y(0),m[n+160>>2]=c+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n),d[n+8>>2]=1065353216,d[n+12>>2]=0,d[n>>2]=0,d[n+4>>2]=1065353216,d[n+60>>2]=0,l=m[n+24>>2],m[n+56>>2]=l,a=m[n+20>>2],m[n+52>>2]=a,c=m[n+16>>2],m[n+48>>2]=c+y(-.25),d[n+172>>2]=0,m[n+168>>2]=l+y(0),m[n+164>>2]=a+y(0),m[n+160>>2]=c+y(.25),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n),d[n+60>>2]=0,l=m[n+24>>2],m[n+56>>2]=l,a=m[n+20>>2],m[n+52>>2]=a+y(-.25),c=m[n+16>>2],m[n+48>>2]=c,d[n+172>>2]=0,m[n+168>>2]=l+y(0),m[n+164>>2]=a+y(.25),m[n+160>>2]=c+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n),d[n+60>>2]=0,l=m[n+24>>2],m[n+56>>2]=l+y(-.25),a=m[n+20>>2],m[n+52>>2]=a,c=m[n+16>>2],m[n+48>>2]=c,d[n+172>>2]=0,m[n+168>>2]=l+y(.25),m[n+164>>2]=a+y(0),m[n+160>>2]=c+y(0),r[d[d[t>>2]+8>>2]](t,n+48|0,n+160|0,n);break e}o=qi(_=i+4|0),p=d[o+60>>2],d[n+56>>2]=d[o+56>>2],d[n+60>>2]=p,p=d[o+52>>2],d[n+48>>2]=d[o+48>>2],d[n+52>>2]=p,o=qi(p=i+16|0),S=d[o+60>>2],d[n+168>>2]=d[o+56>>2],d[n+172>>2]=S,S=d[o+52>>2],d[n+160>>2]=d[o+48>>2],d[n+164>>2]=S,o=qi(_),C=m[o+16>>2],T=m[o+20>>2],E=m[o+24>>2],A=m[o+32>>2],R=m[o+36>>2],P=m[o+40>>2],I=m[o>>2],l=m[i+32>>2],D=m[o+4>>2],a=m[i+36>>2],F=m[o+8>>2],c=m[i+28>>2],o=qi(p),U=m[o+8>>2],G=m[o>>2],j=m[o+4>>2],W=m[o+24>>2],z=m[o+20>>2],X=m[o+16>>2],f=m[i+52>>2],Y=m[o+40>>2],g=m[i+48>>2],Q=m[o+36>>2],L=m[o+32>>2],v=m[i+44>>2],d[n+44>>2]=0,I=y(y(y(y(I*c)+y(D*l))+y(F*a))*y(10)),m[n+32>>2]=I+m[n+48>>2],A=y(y(y(y(c*A)+y(l*R))+y(a*P))*y(10)),m[n+40>>2]=A+m[n+56>>2],l=y(y(y(y(c*C)+y(l*T))+y(a*E))*y(10)),m[n+36>>2]=l+m[n+52>>2],d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=1065353216,d[n+20>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,n+48|0,n+32|0,n+16|0),d[n+44>>2]=0,a=y(y(y(y(v*L)+y(g*Q))+y(f*Y))*y(10)),m[n+40>>2]=a+m[n+56>>2],c=y(y(y(y(v*X)+y(g*z))+y(f*W))*y(10)),m[n+36>>2]=c+m[n+52>>2],f=y(y(y(y(G*v)+y(j*g))+y(U*f))*y(10)),m[n+32>>2]=f+m[n+48>>2],d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=1065353216,d[n+20>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,n+48|0,n+32|0,n+16|0),d[n+44>>2]=0,m[n+40>>2]=A+m[n+168>>2],m[n+36>>2]=l+m[n+164>>2],m[n+32>>2]=I+m[n+160>>2],d[n+24>>2]=1065353216,d[n+28>>2]=0,d[n+16>>2]=0,d[n+20>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,n+160|0,n+32|0,n+16|0),d[n+44>>2]=0,m[n+40>>2]=a+m[n+168>>2],m[n+36>>2]=c+m[n+164>>2],m[n+32>>2]=f+m[n+160>>2],d[n+24>>2]=1065353216,d[n+28>>2]=0,d[n+16>>2]=0,d[n+20>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,n+160|0,n+32|0,n+16|0)}if(!((0|(h=h+1|0))>2]))break}O=n+176|0}function B(e,t){var i,n=0,s=0,o=0,a=y(0),l=y(0),c=0,h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=0,v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=0,U=y(0),G=0,j=y(0),W=y(0);O=i=O-176|0,n=0|r[d[d[e>>2]+20>>2]](e),c=0|r[d[d[n>>2]+48>>2]](n),n=0|r[d[d[e>>2]+20>>2]](e),n=0|r[d[d[n>>2]+48>>2]](n);e:if(!((k=m[t+40>>2])<=y(0))){s=2048&c,V=4096&n;t:switch(d[t+4>>2]+-3|0){case 0:if(d[i+124>>2]=0,d[i+128>>2]=0,d[i+136>>2]=0,d[i+140>>2]=0,d[i+132>>2]=1065353216,d[i+156>>2]=0,d[i+160>>2]=0,d[i+152>>2]=1065353216,d[i+164>>2]=0,d[i+168>>2]=0,d[i+172>>2]=0,d[i+116>>2]=0,d[i+120>>2]=0,d[i+112>>2]=1065353216,d[i+144>>2]=0,d[i+148>>2]=0,n=d[t+28>>2],B=m[n+52>>2],v=m[n+8>>2],P=m[n+12>>2],I=m[n+56>>2],D=m[n+28>>2],_=m[n+20>>2],p=m[n+24>>2],f=m[n+60>>2],M=m[t+308>>2],h=m[n+44>>2],w=m[t+300>>2],g=m[n+36>>2],F=m[t+304>>2],a=m[n+40>>2],l=m[n+4>>2],d[i+172>>2]=0,m[i+168>>2]=f+y(y(y(w*g)+y(F*a))+y(M*h)),m[i+164>>2]=I+y(y(y(w*_)+y(F*p))+y(M*D)),m[i+160>>2]=B+y(y(y(w*l)+y(F*v))+y(M*P)),n=0|r[d[d[e>>2]+20>>2]](e),r[d[d[n>>2]+56>>2]](n,i+112|0,k),n=d[t+32>>2],B=m[n+52>>2],v=m[n+8>>2],P=m[n+12>>2],I=m[n+56>>2],D=m[n+28>>2],_=m[n+20>>2],p=m[n+24>>2],f=m[n+60>>2],M=m[t+324>>2],h=m[n+44>>2],w=m[t+316>>2],g=m[n+36>>2],F=m[t+320>>2],a=m[n+40>>2],l=m[n+4>>2],d[i+172>>2]=0,m[i+168>>2]=f+y(y(y(w*g)+y(F*a))+y(M*h)),m[i+164>>2]=I+y(y(y(w*_)+y(F*p))+y(M*D)),m[i+160>>2]=B+y(y(y(w*l)+y(F*v))+y(M*P)),!s)break e;e=0|r[d[d[e>>2]+20>>2]](e),r[d[d[e>>2]+56>>2]](e,i+112|0,k);break e;case 1:if(n=d[t+28>>2],g=m[n+52>>2],C=m[n+8>>2],S=m[n+12>>2],M=m[t+584>>2],w=m[t+552>>2],F=m[t+568>>2],a=m[n+56>>2],l=m[n+60>>2],B=m[t+608>>2],v=m[t+600>>2],P=m[t+604>>2],A=m[n+28>>2],x=m[n+20>>2],T=m[n+24>>2],I=m[t+588>>2],D=m[t+556>>2],_=m[t+572>>2],p=m[t+592>>2],E=m[n+44>>2],f=m[t+560>>2],R=m[n+36>>2],h=m[t+576>>2],N=m[n+40>>2],L=m[n+4>>2],d[i+172>>2]=0,d[i+156>>2]=0,d[i+140>>2]=0,m[i+152>>2]=y(y(f*R)+y(h*N))+y(p*E),m[i+148>>2]=y(y(D*R)+y(_*N))+y(I*E),m[i+136>>2]=y(y(f*x)+y(h*T))+y(p*A),m[i+132>>2]=y(y(D*x)+y(_*T))+y(I*A),m[i+168>>2]=l+y(y(y(R*v)+y(N*P))+y(E*B)),m[i+164>>2]=a+y(y(y(x*v)+y(T*P))+y(A*B)),d[i+124>>2]=0,m[i+144>>2]=y(y(w*R)+y(F*N))+y(M*E),m[i+128>>2]=y(y(w*x)+y(F*T))+y(M*A),m[i+120>>2]=y(y(L*f)+y(C*h))+y(S*p),m[i+116>>2]=y(y(L*D)+y(C*_))+y(S*I),m[i+112>>2]=y(y(w*L)+y(F*C))+y(M*S),m[i+160>>2]=g+y(y(y(L*v)+y(C*P))+y(S*B)),s?(n=0|r[d[d[e>>2]+20>>2]](e),r[d[d[n>>2]+56>>2]](n,i+112|0,k),n=d[t+32>>2],g=m[n+52>>2],a=m[n+56>>2],l=m[n+60>>2],M=m[t+672>>2],w=m[t+664>>2],F=m[t+668>>2],C=m[n+8>>2],S=m[n+12>>2],A=m[n+28>>2],x=m[n+20>>2],T=m[n+24>>2],B=m[t+648>>2],v=m[t+616>>2],P=m[t+632>>2],I=m[t+652>>2],D=m[t+620>>2],_=m[t+636>>2],p=m[t+656>>2],E=m[n+44>>2],f=m[t+624>>2],R=m[n+36>>2],h=m[t+640>>2],N=m[n+40>>2],L=m[n+4>>2],d[i+172>>2]=0,d[i+156>>2]=0,d[i+140>>2]=0,d[i+124>>2]=0,m[i+152>>2]=y(y(f*R)+y(h*N))+y(p*E),m[i+148>>2]=y(y(D*R)+y(_*N))+y(I*E),m[i+144>>2]=y(y(v*R)+y(P*N))+y(B*E),m[i+136>>2]=y(y(f*x)+y(h*T))+y(p*A),m[i+132>>2]=y(y(D*x)+y(_*T))+y(I*A),m[i+128>>2]=y(y(v*x)+y(P*T))+y(B*A),m[i+120>>2]=y(y(L*f)+y(C*h))+y(S*p),m[i+116>>2]=y(y(L*D)+y(C*_))+y(S*I),m[i+112>>2]=y(y(v*L)+y(P*C))+y(B*S),m[i+168>>2]=l+y(y(y(R*w)+y(N*F))+y(E*M)),m[i+164>>2]=a+y(y(y(x*w)+y(T*F))+y(A*M)),m[i+160>>2]=g+y(y(y(L*w)+y(C*F))+y(S*M)),n=0|r[d[d[e>>2]+20>>2]](e),r[d[d[n>>2]+56>>2]](n,i+112|0,k)):(n=d[t+32>>2],g=m[n+52>>2],a=m[n+56>>2],l=m[n+60>>2],M=m[t+672>>2],w=m[t+664>>2],F=m[t+668>>2],C=m[n+8>>2],S=m[n+12>>2],A=m[n+28>>2],x=m[n+20>>2],T=m[n+24>>2],B=m[t+648>>2],v=m[t+616>>2],P=m[t+632>>2],I=m[t+652>>2],D=m[t+620>>2],_=m[t+636>>2],p=m[t+656>>2],E=m[n+44>>2],f=m[t+624>>2],R=m[n+36>>2],h=m[t+640>>2],N=m[n+40>>2],L=m[n+4>>2],d[i+172>>2]=0,d[i+156>>2]=0,d[i+140>>2]=0,d[i+124>>2]=0,m[i+152>>2]=y(y(f*R)+y(h*N))+y(p*E),m[i+148>>2]=y(y(D*R)+y(_*N))+y(I*E),m[i+144>>2]=y(y(v*R)+y(P*N))+y(B*E),m[i+136>>2]=y(y(f*x)+y(h*T))+y(p*A),m[i+132>>2]=y(y(D*x)+y(_*T))+y(I*A),m[i+128>>2]=y(y(v*x)+y(P*T))+y(B*A),m[i+120>>2]=y(y(L*f)+y(C*h))+y(S*p),m[i+116>>2]=y(y(L*D)+y(C*_))+y(S*I),m[i+112>>2]=y(y(v*L)+y(P*C))+y(B*S),m[i+168>>2]=l+y(y(y(R*w)+y(N*F))+y(E*M)),m[i+164>>2]=a+y(y(y(x*w)+y(T*F))+y(A*M)),m[i+160>>2]=g+y(y(y(L*w)+y(C*F))+y(S*M))),!V|(a=mo(t=t+688|0))==(l=fo(t)))break e;d[i+96>>2]=d[i+120>>2],d[i+100>>2]=d[i+136>>2],d[i+108>>2]=0,d[i+104>>2]=d[i+152>>2],d[i+80>>2]=d[i+112>>2],d[i+84>>2]=d[i+128>>2],d[i+92>>2]=0,d[i+88>>2]=d[i+144>>2],t=0|r[d[d[e>>2]+20>>2]](e),d[i+72>>2]=0,d[i+76>>2]=0,d[i+64>>2]=0,d[i+68>>2]=0,e=a>l,r[d[d[t>>2]+60>>2]](t,i+160|0,i+96|0,i+80|0,k,k,e?y(0):a,e?y(6.2831854820251465):l,i- -64|0,1^e,y(10));break e;case 2:if(n=d[t+28>>2],g=m[n+52>>2],C=m[n+8>>2],S=m[n+12>>2],M=m[t+332>>2],w=m[t+300>>2],F=m[t+316>>2],a=m[n+56>>2],l=m[n+60>>2],B=m[t+356>>2],v=m[t+348>>2],P=m[t+352>>2],A=m[n+28>>2],x=m[n+20>>2],T=m[n+24>>2],I=m[t+336>>2],D=m[t+304>>2],_=m[t+320>>2],p=m[t+340>>2],E=m[n+44>>2],f=m[t+308>>2],R=m[n+36>>2],h=m[t+324>>2],N=m[n+40>>2],L=m[n+4>>2],d[i+172>>2]=0,d[i+156>>2]=0,d[i+140>>2]=0,m[i+152>>2]=y(y(f*R)+y(h*N))+y(p*E),m[i+148>>2]=y(y(D*R)+y(_*N))+y(I*E),m[i+136>>2]=y(y(f*x)+y(h*T))+y(p*A),m[i+132>>2]=y(y(D*x)+y(_*T))+y(I*A),m[i+168>>2]=l+y(y(y(R*v)+y(N*P))+y(E*B)),m[i+164>>2]=a+y(y(y(x*v)+y(T*P))+y(A*B)),d[i+124>>2]=0,m[i+144>>2]=y(y(w*R)+y(F*N))+y(M*E),m[i+128>>2]=y(y(w*x)+y(F*T))+y(M*A),m[i+120>>2]=y(y(L*f)+y(C*h))+y(S*p),m[i+116>>2]=y(y(L*D)+y(C*_))+y(S*I),m[i+112>>2]=y(y(w*L)+y(F*C))+y(M*S),m[i+160>>2]=g+y(y(y(L*v)+y(C*P))+y(S*B)),s?(n=0|r[d[d[e>>2]+20>>2]](e),r[d[d[n>>2]+56>>2]](n,i+112|0,k),n=d[t+32>>2],g=m[n+52>>2],a=m[n+56>>2],l=m[n+60>>2],M=m[t+420>>2],w=m[t+412>>2],F=m[t+416>>2],C=m[n+8>>2],S=m[n+12>>2],A=m[n+28>>2],x=m[n+20>>2],T=m[n+24>>2],B=m[t+396>>2],v=m[t+364>>2],P=m[t+380>>2],I=m[t+400>>2],D=m[t+368>>2],_=m[t+384>>2],p=m[t+404>>2],E=m[n+44>>2],f=m[t+372>>2],R=m[n+36>>2],h=m[t+388>>2],N=m[n+40>>2],L=m[n+4>>2],d[i+172>>2]=0,d[i+156>>2]=0,d[i+140>>2]=0,d[i+124>>2]=0,m[i+152>>2]=y(y(f*R)+y(h*N))+y(p*E),m[i+148>>2]=y(y(D*R)+y(_*N))+y(I*E),m[i+144>>2]=y(y(v*R)+y(P*N))+y(B*E),m[i+136>>2]=y(y(f*x)+y(h*T))+y(p*A),m[i+132>>2]=y(y(D*x)+y(_*T))+y(I*A),m[i+128>>2]=y(y(v*x)+y(P*T))+y(B*A),m[i+120>>2]=y(y(L*f)+y(C*h))+y(S*p),m[i+116>>2]=y(y(L*D)+y(C*_))+y(S*I),m[i+112>>2]=y(y(v*L)+y(P*C))+y(B*S),m[i+168>>2]=l+y(y(y(R*w)+y(N*F))+y(E*M)),m[i+164>>2]=a+y(y(y(x*w)+y(T*F))+y(A*M)),m[i+160>>2]=g+y(y(y(L*w)+y(C*F))+y(S*M)),n=0|r[d[d[e>>2]+20>>2]](e),r[d[d[n>>2]+56>>2]](n,i+112|0,k)):(n=d[t+32>>2],g=m[n+52>>2],a=m[n+56>>2],l=m[n+60>>2],M=m[t+420>>2],w=m[t+412>>2],F=m[t+416>>2],C=m[n+8>>2],S=m[n+12>>2],A=m[n+28>>2],x=m[n+20>>2],T=m[n+24>>2],B=m[t+396>>2],v=m[t+364>>2],P=m[t+380>>2],I=m[t+400>>2],D=m[t+368>>2],_=m[t+384>>2],p=m[t+404>>2],E=m[n+44>>2],f=m[t+372>>2],R=m[n+36>>2],h=m[t+388>>2],N=m[n+40>>2],L=m[n+4>>2],d[i+172>>2]=0,d[i+156>>2]=0,d[i+140>>2]=0,d[i+124>>2]=0,m[i+152>>2]=y(y(f*R)+y(h*N))+y(p*E),m[i+148>>2]=y(y(D*R)+y(_*N))+y(I*E),m[i+144>>2]=y(y(v*R)+y(P*N))+y(B*E),m[i+136>>2]=y(y(f*x)+y(h*T))+y(p*A),m[i+132>>2]=y(y(D*x)+y(_*T))+y(I*A),m[i+128>>2]=y(y(v*x)+y(P*T))+y(B*A),m[i+120>>2]=y(y(L*f)+y(C*h))+y(S*p),m[i+116>>2]=y(y(L*D)+y(C*_))+y(S*I),m[i+112>>2]=y(y(v*L)+y(P*C))+y(B*S),m[i+168>>2]=l+y(y(y(R*w)+y(N*F))+y(E*M)),m[i+164>>2]=a+y(y(y(x*w)+y(T*F))+y(A*M)),m[i+160>>2]=g+y(y(y(L*w)+y(C*F))+y(S*M))),!V)break e;for(Xn(i+96|0,t,y(6.0868353843688965),k),d[i+108>>2]=0,g=m[i+96>>2],a=m[i+100>>2],l=m[i+104>>2],m[i+104>>2]=y(y(y(g*m[i+144>>2])+y(a*m[i+148>>2]))+y(l*m[i+152>>2]))+m[i+168>>2],m[i+100>>2]=y(y(y(g*m[i+128>>2])+y(a*m[i+132>>2]))+y(l*m[i+136>>2]))+m[i+164>>2],m[i+96>>2]=y(y(y(g*m[i+112>>2])+y(a*m[i+116>>2]))+y(l*m[i+120>>2]))+m[i+160>>2],n=i+160|0;Xn(i+80|0,t,y(y(y(0|b)*y(6.283185005187988))*y(.03125)),k),d[i+92>>2]=0,g=m[i+80>>2],a=m[i+84>>2],l=m[i+88>>2],m[i+88>>2]=y(y(y(g*m[i+144>>2])+y(a*m[i+148>>2]))+y(l*m[i+152>>2]))+m[i+168>>2],m[i+84>>2]=y(y(y(g*m[i+128>>2])+y(a*m[i+132>>2]))+y(l*m[i+136>>2]))+m[i+164>>2],m[i+80>>2]=y(y(y(g*m[i+112>>2])+y(a*m[i+116>>2]))+y(l*m[i+120>>2]))+m[i+160>>2],c=0|r[d[d[e>>2]+20>>2]](e),d[i+72>>2]=0,d[i+76>>2]=0,d[i+64>>2]=0,d[i+68>>2]=0,r[d[d[c>>2]+8>>2]](c,i+96|0,i+80|0,i- -64|0),3&b||(c=0|r[d[d[e>>2]+20>>2]](e),d[i+72>>2]=0,d[i+76>>2]=0,d[i+64>>2]=0,d[i+68>>2]=0,r[d[d[c>>2]+8>>2]](c,n,i+80|0,i- -64|0)),c=d[i+92>>2],d[i+104>>2]=d[i+88>>2],d[i+108>>2]=c,c=d[i+84>>2],d[i+96>>2]=d[i+80>>2],d[i+100>>2]=c,32!=(0|(b=b+1|0)););N=m[t+512>>2],L=m[t+452>>2],b=d[t+32>>2],m[b+344>>2]>y(0)?(U=m[b+36>>2],a=m[t+412>>2],v=m[b+40>>2],l=m[t+416>>2],M=y(y(U*a)+y(v*l)),C=m[b+20>>2],S=m[b+24>>2],A=m[b+28>>2],P=m[t+420>>2],w=y(y(y(C*a)+y(S*l))+y(A*P)),x=m[b+4>>2],T=m[b+8>>2],E=m[b+12>>2],F=y(y(y(x*a)+y(T*l))+y(E*P)),I=m[t+372>>2],D=m[t+388>>2],_=m[t+404>>2],R=m[b+44>>2],B=y(y(y(I*U)+y(D*v))+y(_*R)),p=m[t+368>>2],f=m[t+384>>2],h=m[t+400>>2],j=y(y(y(p*U)+y(f*v))+y(h*R)),g=m[t+364>>2],a=m[t+380>>2],l=m[t+396>>2],W=y(y(y(g*U)+y(a*v))+y(l*R)),v=y(y(y(I*C)+y(D*S))+y(_*A)),U=y(y(y(p*C)+y(f*S))+y(h*A)),A=y(y(y(g*C)+y(a*S))+y(l*A)),_=y(y(y(x*I)+y(T*D))+y(E*_)),p=y(y(y(x*p)+y(T*f))+y(E*h)),f=y(y(y(g*x)+y(a*T))+y(l*E)),h=y(R*P)):(b=d[t+28>>2],U=m[b+36>>2],a=m[t+348>>2],v=m[b+40>>2],l=m[t+352>>2],M=y(y(U*a)+y(v*l)),C=m[b+20>>2],S=m[b+24>>2],A=m[b+28>>2],P=m[t+356>>2],w=y(y(y(C*a)+y(S*l))+y(A*P)),x=m[b+4>>2],T=m[b+8>>2],E=m[b+12>>2],F=y(y(y(x*a)+y(T*l))+y(E*P)),I=m[t+308>>2],D=m[t+324>>2],_=m[t+340>>2],R=m[b+44>>2],B=y(y(y(I*U)+y(D*v))+y(_*R)),p=m[t+304>>2],f=m[t+320>>2],h=m[t+336>>2],j=y(y(y(p*U)+y(f*v))+y(h*R)),g=m[t+300>>2],a=m[t+316>>2],l=m[t+332>>2],W=y(y(y(g*U)+y(a*v))+y(l*R)),v=y(y(y(I*C)+y(D*S))+y(_*A)),U=y(y(y(p*C)+y(f*S))+y(h*A)),A=y(y(y(g*C)+y(a*S))+y(l*A)),_=y(y(y(x*I)+y(T*D))+y(E*_)),p=y(y(y(x*p)+y(T*f))+y(E*h)),f=y(y(y(g*x)+y(a*T))+y(l*E)),h=y(R*P)),g=m[b+52>>2],a=m[b+56>>2],l=m[b+60>>2],d[i+172>>2]=0,d[i+156>>2]=0,m[i+152>>2]=B,m[i+148>>2]=j,m[i+144>>2]=W,d[i+140>>2]=0,m[i+136>>2]=v,m[i+132>>2]=U,m[i+128>>2]=A,d[i+124>>2]=0,m[i+120>>2]=_,m[i+116>>2]=p,m[i+112>>2]=f,m[i+168>>2]=l+y(M+h),m[i+164>>2]=w+a,m[i+160>>2]=g+F,t=d[n+12>>2],d[i+88>>2]=d[n+8>>2],d[i+92>>2]=t,t=d[n+4>>2],d[i+80>>2]=d[n>>2],d[i+84>>2]=t,d[i+76>>2]=0,m[i+72>>2]=W,m[i+68>>2]=A,m[i+64>>2]=f,d[i+60>>2]=0,m[i+56>>2]=j,m[i+52>>2]=U,m[i+48>>2]=p,e=0|r[d[d[e>>2]+20>>2]](e),d[i+40>>2]=0,d[i+44>>2]=0,d[i+32>>2]=0,d[i+36>>2]=0,r[d[d[e>>2]+60>>2]](e,i+80|0,i- -64|0,i+48|0,k,k,y(y(-N)-L),y(L-N),i+32|0,1,y(10));break e;case 3:case 6:if(n=d[4+(c=t+1072|0)>>2],d[i+120>>2]=d[c>>2],d[i+124>>2]=n,n=d[4+(c=G=t+1064|0)>>2],d[i+112>>2]=d[c>>2],d[i+116>>2]=n,n=d[4+(c=t+1088|0)>>2],d[i+136>>2]=d[c>>2],d[i+140>>2]=n,n=d[4+(c=b=t+1080|0)>>2],d[i+128>>2]=d[c>>2],d[i+132>>2]=n,n=d[4+(c=t+1104|0)>>2],d[i+152>>2]=d[c>>2],d[i+156>>2]=n,n=d[4+(o=c=t+1096|0)>>2],d[i+144>>2]=d[o>>2],d[i+148>>2]=n,n=d[4+(o=t+1120|0)>>2],d[i+168>>2]=d[o>>2],d[i+172>>2]=n,o=d[4+(n=t+1112|0)>>2],d[i+160>>2]=d[n>>2],d[i+164>>2]=o,s?(o=0|r[d[d[e>>2]+20>>2]](e),r[d[d[o>>2]+56>>2]](o,i+112|0,k),o=d[4+(s=t+1136|0)>>2],d[i+120>>2]=d[s>>2],d[i+124>>2]=o,o=d[4+(s=t+1128|0)>>2],d[i+112>>2]=d[s>>2],d[i+116>>2]=o,o=d[4+(s=t+1152|0)>>2],d[i+136>>2]=d[s>>2],d[i+140>>2]=o,o=d[4+(s=t+1144|0)>>2],d[i+128>>2]=d[s>>2],d[i+132>>2]=o,o=d[4+(s=t+1168|0)>>2],d[i+152>>2]=d[s>>2],d[i+156>>2]=o,o=d[4+(s=t+1160|0)>>2],d[i+144>>2]=d[s>>2],d[i+148>>2]=o,o=d[4+(s=t+1184|0)>>2],d[i+168>>2]=d[s>>2],d[i+172>>2]=o,o=d[4+(s=t+1176|0)>>2],d[i+160>>2]=d[s>>2],d[i+164>>2]=o,o=0|r[d[d[e>>2]+20>>2]](e),r[d[d[o>>2]+56>>2]](o,i+112|0,k)):(o=d[4+(s=t+1136|0)>>2],d[i+120>>2]=d[s>>2],d[i+124>>2]=o,o=d[4+(s=t+1128|0)>>2],d[i+112>>2]=d[s>>2],d[i+116>>2]=o,o=d[4+(s=t+1152|0)>>2],d[i+136>>2]=d[s>>2],d[i+140>>2]=o,o=d[4+(s=t+1144|0)>>2],d[i+128>>2]=d[s>>2],d[i+132>>2]=o,o=d[4+(s=t+1168|0)>>2],d[i+152>>2]=d[s>>2],d[i+156>>2]=o,o=d[4+(s=t+1160|0)>>2],d[i+144>>2]=d[s>>2],d[i+148>>2]=o,o=d[4+(s=t+1184|0)>>2],d[i+168>>2]=d[s>>2],d[i+172>>2]=o,o=d[4+(s=t+1176|0)>>2],d[i+160>>2]=d[s>>2],d[i+164>>2]=o),!V)break e;s=d[(o=G)+12>>2],d[i+120>>2]=d[o+8>>2],d[i+124>>2]=s,s=d[o+4>>2],d[i+112>>2]=d[o>>2],d[i+116>>2]=s,s=d[(o=b)+12>>2],d[i+136>>2]=d[o+8>>2],d[i+140>>2]=s,s=d[o+4>>2],d[i+128>>2]=d[o>>2],d[i+132>>2]=s,s=d[(o=c)+12>>2],d[i+152>>2]=d[o+8>>2],d[i+156>>2]=s,s=d[o+4>>2],d[i+144>>2]=d[o>>2],d[i+148>>2]=s,s=d[n+12>>2],d[i+168>>2]=d[n+8>>2],d[i+172>>2]=s,s=d[n+4>>2],d[i+160>>2]=d[n>>2],d[i+164>>2]=s,d[i+96>>2]=d[i+120>>2],d[i+100>>2]=d[i+136>>2],d[i+108>>2]=0,d[i+104>>2]=d[i+152>>2],d[i+80>>2]=d[i+112>>2],d[i+84>>2]=d[i+128>>2],d[i+92>>2]=0,d[i+88>>2]=d[i+144>>2],h=m[t+1e3>>2],g=m[t+996>>2],a=m[t+936>>2],l=m[t+932>>2],o=0|r[d[d[e>>2]+20>>2]](e),d[i+72>>2]=0,d[i+76>>2]=0,d[i+64>>2]=0,d[i+68>>2]=0,V=t+1176|0,r[d[d[o>>2]+64>>2]](o,V,i+96|0,i+80|0,y(k*y(.8999999761581421)),l,a,g,h,i- -64|0,y(10),1),d[i+92>>2]=0,d[i+88>>2]=d[i+148>>2],d[i+84>>2]=d[i+132>>2],d[i+80>>2]=d[i+116>>2],a=m[t+1196>>2],_=m[i+80>>2],p=An(l=m[t+1200>>2]),f=m[i+84>>2],h=yn(l),m[i+68>>2]=y(f*h)-y(p*_),g=An(a),l=m[i+88>>2],a=yn(a),m[i+72>>2]=y(y(_*y(h*g))+y(f*y(g*p)))+y(l*a),m[i+64>>2]=y(y(_*y(a*h))+y(f*y(a*p)))-y(g*l),o=d[4+(s=t+1136|0)>>2],d[i+120>>2]=d[s>>2],d[i+124>>2]=o,o=d[4+(s=t+1128|0)>>2],d[i+112>>2]=d[s>>2],d[i+116>>2]=o,o=d[4+(s=t+1152|0)>>2],d[i+136>>2]=d[s>>2],d[i+140>>2]=o,o=d[4+(s=t+1144|0)>>2],d[i+128>>2]=d[s>>2],d[i+132>>2]=o,o=d[4+(s=t+1168|0)>>2],d[i+152>>2]=d[s>>2],d[i+156>>2]=o,o=d[4+(s=t+1160|0)>>2],d[i+144>>2]=d[s>>2],d[i+148>>2]=o,o=d[V+4>>2],d[i+160>>2]=d[V>>2],d[i+164>>2]=o,o=d[4+(s=t+1184|0)>>2],d[i+168>>2]=d[s>>2],d[i+172>>2]=o,d[i+60>>2]=0,m[i+56>>2]=-m[i+144>>2],m[i+52>>2]=-m[i+128>>2],m[i+48>>2]=-m[i+112>>2],(a=m[t+868>>2])>(l=m[t+872>>2])?(o=0|r[d[d[e>>2]+20>>2]](e),d[i+40>>2]=0,d[i+44>>2]=0,d[i+32>>2]=0,d[i+36>>2]=0,r[d[d[o>>2]+60>>2]](o,V,i+48|0,i- -64|0,k,k,y(-3.1415927410125732),y(3.1415927410125732),i+32|0,0,y(10))):a>2]+20>>2]](e),d[i+40>>2]=0,d[i+44>>2]=0,d[i+32>>2]=0,d[i+36>>2]=0,r[d[d[o>>2]+60>>2]](o,V,i+48|0,i- -64|0,k,k,a,l,i+32|0,1,y(10))),o=d[G+12>>2],d[i+120>>2]=d[G+8>>2],d[i+124>>2]=o,o=d[G+4>>2],d[i+112>>2]=d[G>>2],d[i+116>>2]=o,G=d[b+12>>2],d[i+136>>2]=d[b+8>>2],d[i+140>>2]=G,G=d[b+4>>2],d[i+128>>2]=d[b>>2],d[i+132>>2]=G,b=d[c+12>>2],d[i+152>>2]=d[c+8>>2],d[i+156>>2]=b,b=d[c+4>>2],d[i+144>>2]=d[c>>2],d[i+148>>2]=b,c=d[n+12>>2],d[i+168>>2]=d[n+8>>2],d[i+172>>2]=c,c=d[n+4>>2],d[i+160>>2]=d[n>>2],d[i+164>>2]=c,n=d[t+692>>2],d[i+40>>2]=d[t+688>>2],d[i+44>>2]=n,n=d[t+684>>2],d[i+32>>2]=d[t+680>>2],d[i+36>>2]=n,n=d[t+708>>2],d[i+24>>2]=d[t+704>>2],d[i+28>>2]=n,n=d[t+700>>2],d[i+16>>2]=d[t+696>>2],d[i+20>>2]=n,e=0|r[d[d[e>>2]+20>>2]](e),d[i+8>>2]=0,d[i+12>>2]=0,d[i>>2]=0,d[i+4>>2]=0,r[d[d[e>>2]+72>>2]](e,i+32|0,i+16|0,i+112|0,i);break e;case 4:break t;default:break e}n=d[t+836>>2],d[i+120>>2]=d[t+832>>2],d[i+124>>2]=n,n=d[4+(c=b=t+824|0)>>2],d[i+112>>2]=d[c>>2],d[i+116>>2]=n,n=d[t+852>>2],d[i+136>>2]=d[t+848>>2],d[i+140>>2]=n,n=d[t+844>>2],d[i+128>>2]=d[t+840>>2],d[i+132>>2]=n,n=d[t+868>>2],d[i+152>>2]=d[t+864>>2],d[i+156>>2]=n,n=d[t+860>>2],d[i+144>>2]=d[t+856>>2],d[i+148>>2]=n,n=d[t+884>>2],d[i+168>>2]=d[t+880>>2],d[i+172>>2]=n,n=d[t+876>>2],d[i+160>>2]=d[t+872>>2],d[i+164>>2]=n,s?(n=0|r[d[d[e>>2]+20>>2]](e),r[d[d[n>>2]+56>>2]](n,i+112|0,k),n=d[t+900>>2],d[i+120>>2]=d[t+896>>2],d[i+124>>2]=n,n=d[t+892>>2],d[i+112>>2]=d[t+888>>2],d[i+116>>2]=n,n=d[t+916>>2],d[i+136>>2]=d[t+912>>2],d[i+140>>2]=n,n=d[t+908>>2],d[i+128>>2]=d[t+904>>2],d[i+132>>2]=n,n=d[t+932>>2],d[i+152>>2]=d[t+928>>2],d[i+156>>2]=n,n=d[t+924>>2],d[i+144>>2]=d[t+920>>2],d[i+148>>2]=n,n=d[t+948>>2],d[i+168>>2]=d[t+944>>2],d[i+172>>2]=n,n=d[t+940>>2],d[i+160>>2]=d[t+936>>2],d[i+164>>2]=n,n=0|r[d[d[e>>2]+20>>2]](e),r[d[d[n>>2]+56>>2]](n,i+112|0,k)):(n=d[t+900>>2],d[i+120>>2]=d[t+896>>2],d[i+124>>2]=n,n=d[t+892>>2],d[i+112>>2]=d[t+888>>2],d[i+116>>2]=n,n=d[t+916>>2],d[i+136>>2]=d[t+912>>2],d[i+140>>2]=n,n=d[t+908>>2],d[i+128>>2]=d[t+904>>2],d[i+132>>2]=n,n=d[t+932>>2],d[i+152>>2]=d[t+928>>2],d[i+156>>2]=n,n=d[t+924>>2],d[i+144>>2]=d[t+920>>2],d[i+148>>2]=n,n=d[t+948>>2],d[i+168>>2]=d[t+944>>2],d[i+172>>2]=n,n=d[t+940>>2],d[i+160>>2]=d[t+936>>2],d[i+164>>2]=n),V&&(n=u[t+180|0],w=m[(c=n?b:t+888|0)+48>>2],D=m[c+8>>2],_=m[c+4>>2],s=d[c+4>>2],F=m[c+52>>2],h=m[c+24>>2],B=m[c+16>>2],o=d[c+16>>2],g=m[c+20>>2],G=d[c+20>>2],v=m[c+56>>2],a=m[c+40>>2],P=m[c+32>>2],b=d[c+32>>2],l=m[c+36>>2],c=d[c+36>>2],I=m[(n=(n?824:888)+t|0)>>2],n=d[n>>2],M=m[t+184>>2],d[i+108>>2]=0,p=y(a*y(0)),f=y(l*y(0)),m[i+104>>2]=v+y(p+y(f+y(M*P))),h=y(h*y(0)),g=y(g*y(0)),m[i+100>>2]=F+y(h+y(g+y(M*B))),a=y(D*y(0)),l=y(_*y(0)),m[i+96>>2]=w+y(a+y(l+y(M*I))),_=m[t+188>>2],d[i+92>>2]=0,m[i+88>>2]=v+y(p+y(f+y(_*P))),m[i+84>>2]=F+y(h+y(g+y(_*B))),m[i+80>>2]=w+y(a+y(l+y(_*I))),V=0|r[d[d[e>>2]+20>>2]](e),d[i+72>>2]=0,d[i+76>>2]=0,d[i+64>>2]=0,d[i+68>>2]=0,r[d[d[V>>2]+8>>2]](V,i+96|0,i+80|0,i- -64|0),d[i+76>>2]=0,d[i+72>>2]=b,d[i+68>>2]=o,d[i+64>>2]=n,d[i+60>>2]=0,d[i+56>>2]=c,d[i+52>>2]=G,d[i+48>>2]=s,a=m[t+196>>2],l=m[t+192>>2],e=0|r[d[d[e>>2]+20>>2]](e),d[i+40>>2]=0,d[i+44>>2]=0,d[i+32>>2]=0,d[i+36>>2]=0,r[d[d[e>>2]+60>>2]](e,t+936|0,i- -64|0,i+48|0,k,k,l,a,i+32|0,1,y(10)))}O=i+176|0}function N(e,t,i){var n,o=0,a=0,l=0,c=0,h=0,p=0,f=0,g=y(0),C=0,S=y(0),x=y(0),T=y(0),E=0,R=0,P=0,I=y(0),M=y(0),D=0,w=y(0),F=y(0),B=0;if(O=n=O-16|0,(0|(o=d[e+1112>>2]))>=1)for(;gn(e,0),(0|(o=d[e+1112>>2]))>0;);if((0|o)<(0|(c=(0|(a=d[e+712>>2]))>(0|t)?t:a))){if(d[e+1116>>2]<(0|c)){if(c){if(d[7717]=d[7717]+1,a=0|r[d[6606]](c<<2,16),!((0|(l=d[e+1112>>2]))<1))for(t=0;d[(f=t<<2)+a>>2]=d[f+d[e+1120>>2]>>2],(0|l)!=(0|(t=t+1|0)););}else a=0;(t=d[e+1120>>2])&&(u[e+1124|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+1120>>2]=0),d[e+1120>>2]=a,d[e+1116>>2]=c,s[e+1124|0]=1}for(;d[d[e+1120>>2]+(o<<2)>>2]=0,(0|c)!=(0|(o=o+1|0)););}d[e+1112>>2]=c;e:{t:{i:{n:{if(!((0|c)<1)){for(t=0;d[7717]=d[7717]+1,o=0|r[d[6606]](384,16),s[o+36|0]=1,d[o+4>>2]=0,d[o+8>>2]=0,d[o+12>>2]=0,s[o+16|0]=1,d[o+32>>2]=0,s[o+56|0]=1,d[o+24>>2]=0,d[o+28>>2]=0,d[o+52>>2]=0,d[o+348>>2]=0,d[o+352>>2]=0,d[o+44>>2]=0,d[o+48>>2]=0,s[o+376|0]=0,d[o+368>>2]=1120403456,d[o+372>>2]=1008981770,d[o+356>>2]=0,d[o+360>>2]=0,d[o+364>>2]=0,d[(a=t<<2)+d[e+1120>>2]>>2]=o,s[d[a+d[e+1120>>2]>>2]+377|0]=1,(0|(t=t+1|0))<(0|(c=d[e+1112>>2])););if(!((0|c)<1)){if((0|(a=d[e+712>>2]))<=0){S=g=y(y(y(1)/y(0|a))*y(0)),T=g;break n}for(o=c;;){if(f=d[e+720>>2]+b(h,104)|0,T=m[f+8>>2],I=m[f+16>>2],M=m[f+12>>2],t=d[d[e+1120>>2]+((0|b(h,29873))%(0|o)<<2)>>2],(0|(l=d[t+24>>2]))==d[t+28>>2]&&!((0|l)>=(0|(C=l?l<<1:1)))){if(C?(d[7717]=d[7717]+1,p=0|r[d[6606]](C<<2,16),l=d[t+24>>2]):p=0,(0|l)>=1)for(o=0;d[(a=o<<2)+p>>2]=d[a+d[t+32>>2]>>2],(0|l)!=(0|(o=o+1|0)););(o=d[t+32>>2])&&(u[t+36|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),l=d[t+24>>2]),d[t+32>>2]=0),d[t+32>>2]=p,d[t+28>>2]=C,s[t+36|0]=1,a=d[e+712>>2]}if(x=y(x+T),g=y(g+I),S=y(S+M),d[d[t+32>>2]+(l<<2)>>2]=f,d[t+24>>2]=l+1,!((0|(h=h+1|0))<(0|a)))break;o=d[e+1112>>2]}if(f=0,(0|c)<0)break t;if(T=g,g=y(y(1)/y(0|a)),T=y(T*g),S=y(S*g),g=y(x*g),c)break n;c=0,f=0;break i}}if(i=d[e+772>>2]){if((0|c)<(0|i)){if(d[e+1116>>2]<(0|i)){if(d[7717]=d[7717]+1,o=0|r[d[6606]](i<<2,16),(0|(a=d[e+1112>>2]))>=1)for(t=0;d[(l=t<<2)+o>>2]=d[l+d[e+1120>>2]>>2],(0|a)!=(0|(t=t+1|0)););(t=d[e+1120>>2])&&(u[e+1124|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+1120>>2]=0),d[e+1120>>2]=o,d[e+1116>>2]=i,s[e+1124|0]=1}for(;d[d[e+1120>>2]+(c<<2)>>2]=0,(0|i)!=(0|(c=c+1|0)););}if(d[e+1112>>2]=i,(0|i)>=1)for(t=0;d[7717]=d[7717]+1,i=0|r[d[6606]](384,16),s[i+36|0]=1,d[i+4>>2]=0,d[i+8>>2]=0,d[i+12>>2]=0,s[i+16|0]=1,d[i+32>>2]=0,s[i+56|0]=1,d[i+24>>2]=0,d[i+28>>2]=0,d[i+52>>2]=0,d[i+348>>2]=0,d[i+352>>2]=0,d[i+44>>2]=0,d[i+48>>2]=0,s[i+376|0]=0,d[i+368>>2]=1120403456,d[i+372>>2]=1008981770,d[i+356>>2]=0,d[i+360>>2]=0,d[i+364>>2]=0,d[(o=t<<2)+d[e+1120>>2]>>2]=i,s[d[o+d[e+1120>>2]>>2]+377|0]=1,(0|(t=t+1|0))>2];);if(d[e+772>>2]<1)break e;for(;;){for(p=0;;){if(a=(d[e+780>>2]+b(h,104)|0)+(p<<2)|0,t=d[d[e+1120>>2]+(h<<2)>>2],(0|(l=d[t+24>>2]))==d[t+28>>2]&&!((0|l)>=(0|(i=l?l<<1:1)))){if(i?(d[7717]=d[7717]+1,c=0|r[d[6606]](i<<2,16),l=d[t+24>>2]):c=0,(0|l)>=1)for(o=0;d[(f=o<<2)+c>>2]=d[f+d[t+32>>2]>>2],(0|l)!=(0|(o=o+1|0)););(o=d[t+32>>2])&&(u[t+36|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),l=d[t+24>>2]),d[t+32>>2]=0),d[t+32>>2]=c,d[t+28>>2]=i,s[t+36|0]=1}if(d[d[t+32>>2]+(l<<2)>>2]=d[a+8>>2],d[t+24>>2]=l+1,4==(0|(p=p+1|0)))break}if(!((0|(h=h+1|0))>2]))break}break e}if((0|c)<(0|(i=d[e+752>>2]))){if(d[e+1116>>2]<(0|i)){if(i){if(d[7717]=d[7717]+1,a=0|r[d[6606]](i<<2,16),!((0|(o=d[e+1112>>2]))<1))for(t=0;d[(l=t<<2)+a>>2]=d[l+d[e+1120>>2]>>2],(0|o)!=(0|(t=t+1|0)););}else a=0;(t=d[e+1120>>2])&&(u[e+1124|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+1120>>2]=0),d[e+1120>>2]=a,d[e+1116>>2]=i,s[e+1124|0]=1}for(;d[d[e+1120>>2]+(c<<2)>>2]=0,(0|i)!=(0|(c=c+1|0)););}if(d[e+1112>>2]=i,(0|i)>=1)for(t=0;d[7717]=d[7717]+1,i=0|r[d[6606]](384,16),s[i+36|0]=1,d[i+4>>2]=0,d[i+8>>2]=0,d[i+12>>2]=0,s[i+16|0]=1,d[i+32>>2]=0,s[i+56|0]=1,d[i+24>>2]=0,d[i+28>>2]=0,d[i+52>>2]=0,d[i+348>>2]=0,d[i+352>>2]=0,d[i+44>>2]=0,d[i+48>>2]=0,s[i+376|0]=0,d[i+368>>2]=1120403456,d[i+372>>2]=1008981770,d[i+356>>2]=0,d[i+360>>2]=0,d[i+364>>2]=0,d[(o=t<<2)+d[e+1120>>2]>>2]=i,s[d[o+d[e+1120>>2]>>2]+377|0]=1,(0|(t=t+1|0))>2];);if(d[e+752>>2]<1)break e;for(;;){for(p=0;;){if(a=(d[e+760>>2]+b(h,44)|0)+(p<<2)|0,t=d[d[e+1120>>2]+(h<<2)>>2],(0|(l=d[t+24>>2]))==d[t+28>>2]&&!((0|l)>=(0|(i=l?l<<1:1)))){if(i?(d[7717]=d[7717]+1,c=0|r[d[6606]](i<<2,16),l=d[t+24>>2]):c=0,(0|l)>=1)for(o=0;d[(f=o<<2)+c>>2]=d[f+d[t+32>>2]>>2],(0|l)!=(0|(o=o+1|0)););(o=d[t+32>>2])&&(u[t+36|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),l=d[t+24>>2]),d[t+32>>2]=0),d[t+32>>2]=c,d[t+28>>2]=i,s[t+36|0]=1}if(d[d[t+32>>2]+(l<<2)>>2]=d[a+8>>2],d[t+24>>2]=l+1,3==(0|(p=p+1|0)))break}if(!((0|(h=h+1|0))>2]))break}break e}d[7717]=d[7717]+1,f=0|r[d[6606]](c<<4,16)}for(t=0;d[12+(o=(t<<4)+f|0)>>2]=0,m[o+8>>2]=T,m[o+4>>2]=S,m[o>>2]=g,(0|c)!=(0|(t=t+1|0)););}for(t=0;;){for(t=(o=t)+1|0,T=y(y(2)-y(A(y(y(0|o)*y(.0625)),y(1)))),E=0,p=0;;){if(o=d[(h=p<<2)+d[e+1120>>2]>>2],(0|(a=d[o+24>>2]))<1)g=y(0),S=y(0),x=y(0);else for(C=d[o+32>>2],x=y(0),o=0,S=y(0),g=y(0);l=d[C+(o<<2)>>2],g=y(g+m[l+8>>2]),x=y(x+m[l+16>>2]),S=y(S+m[l+12>>2]),(0|a)!=(0|(o=o+1|0)););if(a){if(d[12+(o=(p<<4)+f|0)>>2]=0,I=m[o+8>>2],M=x,x=y(y(1)/y(0|a)),w=y(I+y(T*y(y(M*x)-I))),m[o+8>>2]=w,M=m[o+4>>2],F=y(M+y(T*y(y(S*x)-M))),m[o+4>>2]=F,S=m[o>>2],g=y(S+y(T*y(y(g*x)-S))),m[o>>2]=g,g=y(g-S),S=y(g*g),g=y(F-M),S=y(S+y(g*g)),g=y(w-I),C=y(S+y(g*g))>y(1.1920928955078125e-7),l=d[h+d[e+1120>>2]>>2],(0|(o=d[l+24>>2]))<=-1)for(d[l+28>>2]<=-1&&((a=d[l+32>>2])&&(u[l+36|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[l+32>>2]=0),d[l+28>>2]=0,d[l+32>>2]=0,s[l+36|0]=1);d[d[l+32>>2]+(o<<2)>>2]=0,h=(a=o+1|0)>>>0>=o>>>0,o=a,h;);d[l+24>>2]=0,E|=C}if((0|(p=p+1|0))==(0|c))break}if(C=0,(0|(a=d[e+712>>2]))>0)for(;;){if(P=d[e+720>>2]+b(C,104)|0,l=0,(0|c)>=2)for(T=m[P+8>>2],S=m[P+12>>2],x=m[P+16>>2],g=y(y(y(v(y(m[f>>2]-T)))+y(v(y(m[f+4>>2]-S))))+y(v(y(m[f+8>>2]-x)))),o=1;g=(p=(I=y(y(y(v(y(m[(p=(o<<4)+f|0)>>2]-T)))+y(v(y(m[p+4>>2]-S))))+y(v(y(m[p+8>>2]-x)))))>2]+(l<<2)>>2],(0|(l=d[h+24>>2]))==d[h+28>>2]&&!((0|l)>=(0|(R=l?l<<1:1)))){if(R?(d[7717]=d[7717]+1,p=0|r[d[6606]](R<<2,16),l=d[h+24>>2]):p=0,(0|l)>=1)for(o=0;d[(a=o<<2)+p>>2]=d[a+d[h+32>>2]>>2],(0|l)!=(0|(o=o+1|0)););(o=d[h+32>>2])&&(u[h+36|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),l=d[h+24>>2]),d[h+32>>2]=0),d[h+32>>2]=p,d[h+28>>2]=R,s[h+36|0]=1,a=d[e+712>>2]}if(d[d[h+32>>2]+(l<<2)>>2]=P,d[h+24>>2]=l+1,!((0|(C=C+1|0))<(0|a)))break}if(!((0|t)<(0|i)&E))break}if((0|a)<1?C=0:(d[7717]=d[7717]+1,t=a<<2,Mn(C=0|r[d[6606]](t,16),255,t)),(0|(a=d[e+1112>>2]))>=1)for(l=d[e+1120>>2],t=0;;){if(i=d[l+(t<<2)>>2],d[i+24>>2]>=1){for(a=d[i+32>>2],c=d[e+720>>2],o=0;d[((d[a+(o<<2)>>2]-c|0)/104<<2)+C>>2]=t,(0|(o=o+1|0))>2];);a=d[e+1112>>2]}if(!((0|(t=t+1|0))<(0|a)))break}if(d[e+752>>2]>=1){for(i=0;;){for(t=d[e+760>>2]+b(i,44)|0,a=d[e+720>>2],o=(d[t+8>>2]-a|0)/104|0,d[n+4>>2]=o,d[n+8>>2]=(d[t+12>>2]-a|0)/104,d[n+12>>2]=(d[t+16>>2]-a|0)/104,E=0;;){for(c=d[(o<<2)+C>>2],p=1;;){t=d[(n+4|0)+((p+E>>>0)%3<<2)>>2];t:if((0|c)!=d[(t<<2)+C>>2]){P=d[e+720>>2]+b(t,104)|0,a=d[d[e+1120>>2]+(c<<2)>>2];i:if(!((0|(t=d[a+24>>2]))<1)){for(l=d[a+32>>2],o=0;;){if((0|P)!=d[l+(o<<2)>>2]){if((0|(o=o+1|0))!=(0|t))continue;break i}break}if((0|t)!=(0|o))break t}if(d[a+28>>2]==(0|t)&&!((0|t)>=(0|(l=t?t<<1:1)))){if(l?(d[7717]=d[7717]+1,h=0|r[d[6606]](l<<2,16),t=d[a+24>>2]):h=0,(0|t)>=1)for(o=0;d[(R=o<<2)+h>>2]=d[R+d[a+32>>2]>>2],(0|(o=o+1|0))!=(0|t););(o=d[a+32>>2])&&(u[a+36|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),t=d[a+24>>2]),d[a+32>>2]=0),d[a+32>>2]=h,d[a+28>>2]=l,s[a+36|0]=1}d[d[a+32>>2]+(t<<2)>>2]=P,d[a+24>>2]=t+1}if(3==(0|(p=p+1|0)))break}if(3==(0|(E=E+1|0)))break;o=d[(n+4|0)+(E<<2)>>2]}if(!((0|(i=i+1|0))>2]))break}a=d[e+1112>>2]}if((0|a)>=2){if(o=0,d[7717]=d[7717]+1,i=0|r[d[6606]](384,16),_[i+376>>1]=0,d[i+368>>2]=1120403456,d[i+372>>2]=1008981770,d[i+348>>2]=0,d[i+352>>2]=0,d[i+12>>2]=0,s[i+16|0]=1,s[i+36|0]=1,d[i+4>>2]=0,d[i+8>>2]=0,d[i+32>>2]=0,s[i+56|0]=1,d[i+24>>2]=0,d[i+28>>2]=0,d[i+52>>2]=0,d[i+44>>2]=0,d[i+48>>2]=0,d[i+364>>2]=0,d[i+356>>2]=0,d[i+360>>2]=0,!((0|(a=d[e+712>>2]))<1)){if(d[7717]=d[7717]+1,t=0|r[d[6606]](a<<2,16),(0|(l=d[i+24>>2]))>=1)for(;d[(c=o<<2)+t>>2]=d[c+d[i+32>>2]>>2],(0|l)!=(0|(o=o+1|0)););if((o=d[i+32>>2])&&(u[i+36|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[i+32>>2]=0),d[i+32>>2]=t,s[i+36|0]=1,d[i+28>>2]=a,!((0|(l=d[e+712>>2]))<1))for(o=d[i+24>>2],p=0;;){if(h=d[e+720>>2]+b(p,104)|0,(0|o)==(0|a))if((0|a)>=(0|(t=a?a<<1:1)))o=a;else{if(o=0,c=0,t&&(d[7717]=d[7717]+1,c=0|r[d[6606]](t<<2,16),a=d[i+24>>2]),(0|a)>=1)for(;d[(l=o<<2)+c>>2]=d[l+d[i+32>>2]>>2],(0|a)!=(0|(o=o+1|0)););(o=d[i+32>>2])&&(u[i+36|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),a=d[i+24>>2]),d[i+32>>2]=0),o=a,d[i+32>>2]=c,s[i+36|0]=1,d[i+28>>2]=t,l=d[e+712>>2],a=t}if(d[d[i+32>>2]+(o<<2)>>2]=h,o=o+1|0,d[i+24>>2]=o,!((0|(p=p+1|0))<(0|l)))break}}if((0|(a=d[e+1112>>2]))==d[e+1116>>2]&&!((0|a)>=(0|(t=a?a<<1:1)))){if(o=0,c=0,t&&(d[7717]=d[7717]+1,c=0|r[d[6606]](t<<2,16),a=d[e+1112>>2]),(0|a)>=1)for(;d[(l=o<<2)+c>>2]=d[l+d[e+1120>>2]>>2],(0|a)!=(0|(o=o+1|0)););(o=d[e+1120>>2])&&(u[e+1124|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),a=d[e+1112>>2]),d[e+1120>>2]=0),d[e+1120>>2]=c,d[e+1116>>2]=t,s[e+1124|0]=1}d[(o=a<<2)+d[e+1120>>2]>>2]=i,a=a+1|0,d[e+1112>>2]=a,t=d[e+1120>>2],i=d[t>>2],l=t,t=t+o|0,d[l>>2]=d[t>>2],d[t>>2]=i}if((0|a)>=1)for(o=0;d[d[d[e+1120>>2]+(o<<2)>>2]+24>>2]||(gn(e,o),a=d[e+1112>>2],o=o+-1|0),(0|(o=o+1|0))<(0|a););C&&C&&(d[7718]=d[7718]+1,r[d[6607]](C)),f&&f&&(d[7718]=d[7718]+1,r[d[6607]](f))}if(d[e+1112>>2]){if(function(e){var t,i=0,n=0,o=y(0),a=0,l=0,c=0,h=y(0),_=y(0),p=0,f=y(0),g=0,b=y(0),v=y(0),A=0,C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=0,P=0,I=y(0),M=y(0),D=y(0);if(O=t=O-16|0,d[e+1112>>2]>=1)for(;;){if(i=d[d[e+1120>>2]+(R<<2)>>2],d[i+128>>2]=0,(0|(l=p=d[i+24>>2]))>(0|(a=d[i+4>>2]))){if(d[i+8>>2]>=(0|p))g=d[i+12>>2];else{l=0,n=a,g=0,p&&(d[7717]=d[7717]+1,g=0|r[d[6606]](p<<2,16),n=d[i+4>>2]),c=d[i+12>>2];e:{t:{if((0|n)>=1)for(;;)if(d[(A=l<<2)+g>>2]=d[c+A>>2],(0|n)==(0|(l=l+1|0)))break t;if(!c)break e}u[i+16|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c))}d[i+12>>2]=g,s[i+16|0]=1,d[i+8>>2]=p}Mn((a<<2)+g|0,0,p-a<<2),l=d[i+24>>2]}d[i+4>>2]=p;e:{t:{if(g=(0|l)>0){for(a=d[i+32>>2],p=d[i+12>>2],n=0;(o=m[d[(c=n<<2)+a>>2]+88>>2])!=y(0)?o=y(y(1)/o):(s[i+376|0]=1,o=y(0xde0b6b000000000)),m[p+c>>2]=o,o=y(o+m[i+128>>2]),m[i+128>>2]=o,(0|(n=n+1|0))!=(0|l););if(o=y(y(1)/o),m[i+128>>2]=o,(0|l)>=1)break t}else o=y(y(1)/m[i+128>>2]),m[i+128>>2]=o;h=y(0),f=y(0),b=y(0);break e}for(p=d[i+32>>2],c=d[i+12>>2],b=y(0),n=0,f=y(0),h=y(0);a=d[(A=n<<2)+p>>2],_=m[c+A>>2],h=y(h+y(m[a+8>>2]*_)),b=y(b+y(_*m[a+16>>2])),f=y(f+y(_*m[a+12>>2])),(0|(n=n+1|0))!=(0|l););}if(d[i+316>>2]=0,d[i+320>>2]=0,d[i+132>>2]=0,d[i+136>>2]=0,d[i+240>>2]=0,I=y(o*b),m[i+236>>2]=I,M=y(o*f),m[i+232>>2]=M,D=y(o*h),m[i+228>>2]=D,d[i+164>>2]=0,d[i+168>>2]=0,d[i+172>>2]=0,d[i+176>>2]=0,d[i+324>>2]=0,d[i+328>>2]=0,d[i+332>>2]=0,d[i+336>>2]=0,d[i+340>>2]=0,d[i+344>>2]=0,d[i+348>>2]=0,d[i+148>>2]=0,d[i+152>>2]=0,d[i+156>>2]=0,d[i+160>>2]=0,d[i+140>>2]=0,d[i+144>>2]=0,g)for(f=m[i+156>>2],o=m[i+140>>2],h=m[i+136>>2],_=m[i+152>>2],g=d[i+32>>2],b=m[i+132>>2],p=d[i+12>>2],n=0,S=y(0);a=d[(c=n<<2)+g>>2],v=m[a+12>>2],C=y(m[a+16>>2]-I),T=y(m[a+8>>2]-D),x=m[p+c>>2],E=y(T*x),o=y(o-y(C*E)),m[i+140>>2]=o,v=y(v-M),h=y(h-y(v*E)),m[i+136>>2]=h,f=y(f-y(C*y(v*x))),m[i+156>>2]=f,T=y(T*T),v=y(v*v),S=y(y(x*y(T+v))+S),m[i+172>>2]=S,C=y(C*C),_=y(y(x*y(T+C))+_),m[i+152>>2]=_,b=y(b+y(x*y(v+C))),m[i+132>>2]=b,(0|(n=n+1|0))!=(0|l););else _=m[i+152>>2],f=m[i+156>>2],o=m[i+140>>2],h=m[i+136>>2],b=m[i+132>>2],S=y(0);if(d[i+176>>2]=0,d[i+60>>2]=1065353216,d[i+160>>2]=0,d[i+144>>2]=0,d[(n=i- -64|0)>>2]=0,d[n+4>>2]=0,d[i+72>>2]=0,d[i+76>>2]=0,d[i+84>>2]=0,d[i+88>>2]=0,d[i+80>>2]=1065353216,d[i+92>>2]=0,d[i+96>>2]=0,E=y(y(_*b)-y(h*h)),x=y(y(_*S)-y(f*f)),C=y(y(f*o)-y(S*h)),v=y(y(f*h)-y(_*o)),_=y(y(1)/y(y(y(x*b)+y(h*C))+y(v*o))),m[i+172>>2]=E*_,h=y(y(y(h*o)-y(f*b))*_),m[i+168>>2]=h,f=y(v*_),m[i+164>>2]=f,m[i+156>>2]=h,m[i+152>>2]=y(y(S*b)-y(o*o))*_,o=y(C*_),m[i+148>>2]=o,m[i+140>>2]=f,m[i+136>>2]=o,m[i+132>>2]=x*_,d[i+100>>2]=1065353216,d[i+104>>2]=0,n=d[i+232>>2],d[i+108>>2]=d[i+228>>2],d[i+112>>2]=n,n=d[i+240>>2],d[i+116>>2]=d[i+236>>2],d[i+120>>2]=n,(0|(n=d[i+44>>2]))<(0|l)){if(d[i+48>>2]<(0|l)){if(l?(d[7717]=d[7717]+1,p=0|r[d[6606]](l<<4,16),a=d[i+44>>2]):(p=0,a=n),(0|a)>=1)for(g=0;A=(c=g<<4)+p|0,c=c+d[i+52>>2]|0,P=d[c+4>>2],d[A>>2]=d[c>>2],d[A+4>>2]=P,P=d[c+12>>2],d[A+8>>2]=d[c+8>>2],d[A+12>>2]=P,(0|a)!=(0|(g=g+1|0)););(a=d[i+52>>2])&&(u[i+56|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[i+52>>2]=0),d[i+52>>2]=p,d[i+48>>2]=l,s[i+56|0]=1}for(;p=d[t+4>>2],a=d[i+52>>2]+(n<<4)|0,d[a>>2]=d[t>>2],d[a+4>>2]=p,g=d[t+12>>2],d[a+8>>2]=d[t+8>>2],d[a+12>>2]=g,(0|(n=n+1|0))!=(0|l););}if(d[i+44>>2]=l,(0|l)>=1)for(l=0;n=d[d[i+32>>2]+(l<<2)>>2],o=m[n+12>>2],h=m[n+16>>2],f=m[n+8>>2],b=m[i+232>>2],_=m[i+236>>2],S=m[i+228>>2],n=d[i+52>>2]+(l<<4)|0,d[n+12>>2]=0,m[n>>2]=f-S,m[n+8>>2]=h-_,m[n+4>>2]=o-b,(0|(l=l+1|0))>2];);if(!((0|(R=R+1|0))>2]))break}O=t+16|0}(e),X(e),C=d[e+1112>>2],(0|(a=b(C,C)))>(0|(i=d[e+1132>>2]))){e:if(d[e+1136>>2]>=(0|a))t=d[e+1140>>2];else{o=0,l=i,t=0,a&&(d[7717]=d[7717]+1,t=0|r[d[6606]](a,16),l=d[e+1132>>2]),c=d[e+1140>>2];t:{if((0|l)>=1)for(;;)if(s[t+o|0]=u[o+c|0],(0|l)==(0|(o=o+1|0)))break t;if(!c){d[e+1140>>2]=t,d[e+1136>>2]=a,s[e+1144|0]=1;break e}}u[e+1144|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[e+1140>>2]=t,s[e+1144|0]=1,d[e+1136>>2]=a}Mn(t+i|0,0,a-i|0),C=d[e+1112>>2]}if(d[e+1132>>2]=a,!((0|C)<1))for(c=d[e+1140>>2],e=d[e+1120>>2],f=0;;){for(t=d[e+(f<<2)>>2],d[t+380>>2]=f,E=(0|(i=d[t+24>>2]))>0?i:0,h=0;;){B=c+(b(h,C)+f|0)|0;e:{if((0|i)>=1)for(R=d[e+(h<<2)>>2],a=d[R+24>>2],p=0;;){if((0|a)>=1)for(l=d[d[t+32>>2]+(p<<2)>>2],P=d[R+32>>2],o=0;;){if(D=1,(0|l)==d[P+(o<<2)>>2])break e;if(!((0|(o=o+1|0))<(0|a)))break}if((0|E)==(0|(p=p+1|0)))break}D=0}if(s[0|B]=D,(0|C)==(0|(h=h+1|0)))break}if((0|(f=f+1|0))==(0|C))break}}else C=0;return O=n+16|0,C}function L(e){var t,i=0,n=0,r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0;O=t=O-16|0;e:{t:{i:{n:{r:{s:{o:{a:{l:{c:{h:{if((e|=0)>>>0<=244){if(3&(i=(o=d[7724])>>>(e=(a=e>>>0<11?16:e+11&-8)>>>3|0)|0)){e=(i=d[30944+(s=(n=e+(1&(-1^i))|0)<<3)>>2])+8|0,(0|(r=d[i+8>>2]))!=(0|(s=s+30936|0))?(d[r+12>>2]=s,d[s+8>>2]=r):d[7724]=a_(n)&o,n<<=3,d[i+4>>2]=3|n,d[4+(i=i+n|0)>>2]=1|d[i+4>>2];break e}if(a>>>0<=(c=d[7726])>>>0)break h;if(i){n=i=(e=(0-(e=(0-(n=2<>>12&16,n|=i=(e=e>>>i|0)>>>5&8,n|=i=(e=e>>>i|0)>>>2&4,i=d[30944+(r=(n=((n|=i=(e=e>>>i|0)>>>1&2)|(i=(e=e>>>i|0)>>>1&1))+(e>>>i|0)|0)<<3)>>2],(0|(e=d[i+8>>2]))!=(0|(r=r+30936|0))?(d[e+12>>2]=r,d[r+8>>2]=e):(o=a_(n)&o,d[7724]=o),e=i+8|0,d[i+4>>2]=3|a,s=(n<<=3)-a|0,d[4+(l=i+a|0)>>2]=1|s,d[i+n>>2]=s,c&&(i=30936+((n=c>>>3|0)<<3)|0,r=d[7729],(n=1<>2]:(d[7724]=n|o,n=i),d[i+8>>2]=r,d[n+12>>2]=r,d[r+12>>2]=i,d[r+8>>2]=n),d[7729]=l,d[7726]=s;break e}if(!(_=d[7725]))break h;for(n=i=(e=(_&0-_)-1|0)>>>12&16,n|=i=(e=e>>>i|0)>>>5&8,n|=i=(e=e>>>i|0)>>>2&4,i=d[31200+(((n|=i=(e=e>>>i|0)>>>1&2)|(i=(e=e>>>i|0)>>>1&1))+(e>>>i|0)<<2)>>2],r=(-8&d[i+4>>2])-a|0,n=i;(e=d[n+16>>2])||(e=d[n+20>>2]);)r=(n=(s=(-8&d[e+4>>2])-a|0)>>>0>>0)?s:r,i=n?e:i,n=e;if(h=d[i+24>>2],(0|(s=d[i+12>>2]))!=(0|i)){e=d[i+8>>2],d[e+12>>2]=s,d[s+8>>2]=e;break t}if(!(e=d[(n=i+20|0)>>2])){if(!(e=d[i+16>>2]))break c;n=i+16|0}for(;l=n,s=e,(e=d[(n=e+20|0)>>2])||(n=s+16|0,e=d[s+16>>2]););d[l>>2]=0;break t}if(a=-1,!(e>>>0>4294967231)&&(a=-8&(i=e+11|0),c=d[7725])){n=0-a|0,o=0,(i=i>>>8|0)&&(o=31,a>>>0>16777215||(o=28+((e=((o=(i<<=r=i+1048320>>>16&8)<<(e=i+520192>>>16&4))<<(i=o+245760>>>16&2)>>>15|0)-(i|e|r)|0)<<1|a>>>e+21&1)|0));_:{d:{if(r=d[31200+(o<<2)>>2])for(i=a<<(31==(0|o)?0:25-(o>>>1|0)|0),e=0;;){if(!((l=(-8&d[r+4>>2])-a|0)>>>0>=n>>>0||(s=r,n=l))){n=0,e=r;break d}if(l=d[r+20>>2],r=d[16+((i>>>29&4)+r|0)>>2],e=l?(0|l)==(0|r)?e:l:e,i<<=0!=(0|r),!r)break}else e=0;if(!(e|s)){if(!(e=(0-(e=2<>>12&16,r|=i=(e=e>>>i|0)>>>5&8,r|=i=(e=e>>>i|0)>>>2&4,e=d[31200+(((r|=i=(e=e>>>i|0)>>>1&2)|(i=(e=e>>>i|0)>>>1&1))+(e>>>i|0)<<2)>>2]}if(!e)break _}for(;n=(i=(r=(-8&d[e+4>>2])-a|0)>>>0>>0)?r:n,s=i?e:s,e=(i=d[e+16>>2])||d[e+20>>2];);}if(!(!s|n>>>0>=d[7726]-a>>>0)){if(l=d[s+24>>2],(0|s)!=(0|(i=d[s+12>>2]))){e=d[s+8>>2],d[e+12>>2]=i,d[i+8>>2]=e;break i}if(!(e=d[(r=s+20|0)>>2])){if(!(e=d[s+16>>2]))break l;r=s+16|0}for(;o=r,i=e,(e=d[(r=e+20|0)>>2])||(r=i+16|0,e=d[i+16>>2]););d[o>>2]=0;break i}}}if((i=d[7726])>>>0>=a>>>0){e=d[7729],(n=i-a|0)>>>0>=16?(d[7726]=n,r=e+a|0,d[7729]=r,d[r+4>>2]=1|n,d[e+i>>2]=n,d[e+4>>2]=3|a):(d[7729]=0,d[7726]=0,d[e+4>>2]=3|i,d[4+(i=e+i|0)>>2]=1|d[i+4>>2]),e=e+8|0;break e}if((r=d[7727])>>>0>a>>>0){i=r-a|0,d[7727]=i,n=(e=d[7730])+a|0,d[7730]=n,d[n+4>>2]=1|i,d[e+4>>2]=3|a,e=e+8|0;break e}if(e=0,n=s=a+47|0,d[7842]?i=d[7844]:(d[7845]=-1,d[7846]=-1,d[7843]=4096,d[7844]=4096,d[7842]=t+12&-16^1431655768,d[7847]=0,d[7835]=0,i=4096),(n=(o=n+i|0)&(l=0-i|0))>>>0<=a>>>0)break e;if((i=d[7834])&&(h=(c=d[7832])+n|0)>>>0<=c>>>0|h>>>0>i>>>0)break e;if(4&u[31340])break s;h:{_:{if(i=d[7730])for(e=31344;;){if((c=d[e>>2])+d[e+4>>2]>>>0>i>>>0&&c>>>0<=i>>>0)break _;if(!(e=d[e+8>>2]))break}if(-1==(0|(i=na(0))))break o;if(o=n,(r=(e=d[7843])+-1|0)&i&&(o=(n-i|0)+(i+r&0-e)|0),o>>>0<=a>>>0|o>>>0>2147483646)break o;if((e=d[7834])&&(l=(r=d[7832])+o|0)>>>0<=r>>>0|l>>>0>e>>>0)break o;if((0|i)!=(0|(e=na(o))))break h;break r}if((o=l&o-r)>>>0>2147483646)break o;if((0|(i=na(o)))==(d[e>>2]+d[e+4>>2]|0))break a;e=i}if(!(-1==(0|e)|a+48>>>0<=o>>>0)){if((i=(i=d[7844])+(s-o|0)&0-i)>>>0>2147483646){i=e;break r}if(-1!=(0|na(i))){o=i+o|0,i=e;break r}na(0-o|0);break o}if(i=e,-1!=(0|e))break r;break o}s=0;break t}i=0;break i}if(-1!=(0|i))break r}d[7835]=4|d[7835]}if(n>>>0>2147483646)break n;if((i=na(n))>>>0>=(e=na(0))>>>0|-1==(0|i)|-1==(0|e))break n;if((o=e-i|0)>>>0<=a+40>>>0)break n}e=d[7832]+o|0,d[7832]=e,e>>>0>f[7833]&&(d[7833]=e);r:{s:{o:{if(n=d[7730]){for(e=31344;;){if(((r=d[e>>2])+(s=d[e+4>>2])|0)==(0|i))break o;if(!(e=d[e+8>>2]))break}break s}for(i>>>0>=(e=d[7728])>>>0&&e||(d[7728]=i),e=0,d[7837]=o,d[7836]=i,d[7732]=-1,d[7733]=d[7842],d[7839]=0;r=30936+(n=e<<3)|0,d[n+30944>>2]=r,d[n+30948>>2]=r,32!=(0|(e=e+1|0)););r=(e=o+-40|0)-(n=i+8&7?-8-i&7:0)|0,d[7727]=r,n=i+n|0,d[7730]=n,d[n+4>>2]=1|r,d[4+(e+i|0)>>2]=40,d[7731]=d[7846];break r}if(!(8&u[e+12|0]|i>>>0<=n>>>0|r>>>0>n>>>0)){d[e+4>>2]=s+o,i=(e=n+8&7?-8-n&7:0)+n|0,d[7730]=i,e=(r=d[7727]+o|0)-e|0,d[7727]=e,d[i+4>>2]=1|e,d[4+(n+r|0)>>2]=40,d[7731]=d[7846];break r}}i>>>0<(s=d[7728])>>>0&&(d[7728]=i,s=0),r=i+o|0,e=31344;s:{o:{a:{l:{c:{h:{for(;;){if((0|r)!=d[e>>2]){if(e=d[e+8>>2])continue;break h}break}if(!(8&u[e+12|0]))break c}for(e=31344;;){if((r=d[e>>2])>>>0<=n>>>0&&(s=r+d[e+4>>2]|0)>>>0>n>>>0)break l;e=d[e+8>>2]}}if(d[e>>2]=i,d[e+4>>2]=d[e+4>>2]+o,d[4+(h=(i+8&7?-8-i&7:0)+i|0)>>2]=3|a,e=((i=r+(r+8&7?-8-r&7:0)|0)-h|0)-a|0,l=a+h|0,(0|i)==(0|n)){d[7730]=l,e=d[7727]+e|0,d[7727]=e,d[l+4>>2]=1|e;break o}if(d[7729]==(0|i)){d[7729]=l,e=d[7726]+e|0,d[7726]=e,d[l+4>>2]=1|e,d[e+l>>2]=e;break o}if(1==(3&(n=d[i+4>>2]))){_=-8&n;c:if(n>>>0<=255){if(s=n>>>3|0,n=d[i+8>>2],(0|(r=d[i+12>>2]))==(0|n)){d[7724]=d[7724]&a_(s);break c}d[n+12>>2]=r,d[r+8>>2]=n}else{if(c=d[i+24>>2],(0|(o=d[i+12>>2]))==(0|i))if((a=d[(r=i+20|0)>>2])||(a=d[(r=i+16|0)>>2])){for(;n=r,o=a,(a=d[(r=a+20|0)>>2])||(r=o+16|0,a=d[o+16>>2]););d[n>>2]=0}else o=0;else n=d[i+8>>2],d[n+12>>2]=o,d[o+8>>2]=n;if(c){n=d[i+28>>2];h:{if(d[(r=31200+(n<<2)|0)>>2]==(0|i)){if(d[r>>2]=o,o)break h;d[7725]=d[7725]&a_(n);break c}if(d[c+(d[c+16>>2]==(0|i)?16:20)>>2]=o,!o)break c}d[o+24>>2]=c,(n=d[i+16>>2])&&(d[o+16>>2]=n,d[n+24>>2]=o),(n=d[i+20>>2])&&(d[o+20>>2]=n,d[n+24>>2]=o)}}i=i+_|0,e=e+_|0}if(d[i+4>>2]=-2&d[i+4>>2],d[l+4>>2]=1|e,d[e+l>>2]=e,e>>>0<=255){e=30936+((i=e>>>3|0)<<3)|0,(n=d[7724])&(i=1<>2]:(d[7724]=i|n,i=e),d[e+8>>2]=l,d[i+12>>2]=l,d[l+12>>2]=e,d[l+8>>2]=i;break o}if(i=0,(r=e>>>8|0)&&(i=31,e>>>0>16777215||(i=28+((i=((a=(r<<=s=r+1048320>>>16&8)<<(i=r+520192>>>16&4))<<(r=a+245760>>>16&2)>>>15|0)-(r|i|s)|0)<<1|e>>>i+21&1)|0)),d[(n=l)+28>>2]=i,d[l+16>>2]=0,d[l+20>>2]=0,n=31200+(i<<2)|0,(r=d[7725])&(s=1<>>1|0)|0),i=d[n>>2];;){if(n=i,(-8&d[i+4>>2])==(0|e))break a;if(i=r>>>29|0,r<<=1,!(i=d[16+(s=(4&i)+n|0)>>2]))break}d[s+16>>2]=l}else d[7725]=r|s,d[n>>2]=l;d[l+24>>2]=n,d[l+12>>2]=l,d[l+8>>2]=l;break o}for(l=(e=o+-40|0)-(r=i+8&7?-8-i&7:0)|0,d[7727]=l,r=i+r|0,d[7730]=r,d[r+4>>2]=1|l,d[4+(e+i|0)>>2]=40,d[7731]=d[7846],d[(r=(e=(s+(s+-39&7?39-s&7:0)|0)-47|0)>>>0>>0?n:e)+4>>2]=27,e=d[7839],d[r+16>>2]=d[7838],d[r+20>>2]=e,e=d[7837],d[r+8>>2]=d[7836],d[r+12>>2]=e,d[7838]=r+8,d[7837]=o,d[7836]=i,d[7839]=0,e=r+24|0;d[e+4>>2]=7,i=e+8|0,e=e+4|0,s>>>0>i>>>0;);if((0|n)==(0|r))break r;if(d[r+4>>2]=-2&d[r+4>>2],s=r-n|0,d[n+4>>2]=1|s,d[r>>2]=s,s>>>0<=255){e=30936+((i=s>>>3|0)<<3)|0,(r=d[7724])&(i=1<>2]:(d[7724]=i|r,i=e),d[e+8>>2]=n,d[i+12>>2]=n,d[n+12>>2]=e,d[n+8>>2]=i;break r}if(d[n+16>>2]=0,d[n+20>>2]=0,e=0,(r=s>>>8|0)&&(e=31,s>>>0>16777215||(e=28+((e=((l=(r<<=o=r+1048320>>>16&8)<<(e=r+520192>>>16&4))<<(r=l+245760>>>16&2)>>>15|0)-(r|e|o)|0)<<1|s>>>e+21&1)|0)),d[(i=n)+28>>2]=e,i=31200+(e<<2)|0,(r=d[7725])&(o=1<>>1|0)|0),i=d[i>>2];;){if(r=i,(0|s)==(-8&d[i+4>>2]))break s;if(i=e>>>29|0,e<<=1,!(i=d[16+(o=r+(4&i)|0)>>2]))break}d[o+16>>2]=n,d[n+24>>2]=r}else d[7725]=r|o,d[i>>2]=n,d[n+24>>2]=i;d[n+12>>2]=n,d[n+8>>2]=n;break r}e=d[n+8>>2],d[e+12>>2]=l,d[n+8>>2]=l,d[l+24>>2]=0,d[l+12>>2]=n,d[l+8>>2]=e}e=h+8|0;break e}e=d[r+8>>2],d[e+12>>2]=n,d[r+8>>2]=n,d[n+24>>2]=0,d[n+12>>2]=r,d[n+8>>2]=e}if(!((e=d[7727])>>>0<=a>>>0)){i=e-a|0,d[7727]=i,n=(e=d[7730])+a|0,d[7730]=n,d[n+4>>2]=1|i,d[e+4>>2]=3|a,e=e+8|0;break e}}d[7722]=48,e=0;break e}i:if(l){e=d[s+28>>2];n:{if(d[(r=31200+(e<<2)|0)>>2]==(0|s)){if(d[r>>2]=i,i)break n;c=a_(e)&c,d[7725]=c;break i}if(d[l+(d[l+16>>2]==(0|s)?16:20)>>2]=i,!i)break i}d[i+24>>2]=l,(e=d[s+16>>2])&&(d[i+16>>2]=e,d[e+24>>2]=i),(e=d[s+20>>2])&&(d[i+20>>2]=e,d[e+24>>2]=i)}i:if(n>>>0<=15)e=n+a|0,d[s+4>>2]=3|e,d[4+(e=e+s|0)>>2]=1|d[e+4>>2];else if(d[s+4>>2]=3|a,d[4+(r=s+a|0)>>2]=1|n,d[n+r>>2]=n,n>>>0<=255)e=30936+((i=n>>>3|0)<<3)|0,(n=d[7724])&(i=1<>2]:(d[7724]=i|n,i=e),d[e+8>>2]=r,d[i+12>>2]=r,d[r+12>>2]=e,d[r+8>>2]=i;else{e=0,(a=n>>>8|0)&&(e=31,n>>>0>16777215||(e=28+((e=((l=(a<<=o=a+1048320>>>16&8)<<(e=a+520192>>>16&4))<<(a=l+245760>>>16&2)>>>15|0)-(a|e|o)|0)<<1|n>>>e+21&1)|0)),d[(i=r)+28>>2]=e,d[r+16>>2]=0,d[r+20>>2]=0,i=31200+(e<<2)|0;n:{if((a=1<>>1|0)|0),a=d[i>>2];;){if((-8&d[(i=a)+4>>2])==(0|n))break n;if(a=e>>>29|0,e<<=1,!(a=d[16+(o=(4&a)+i|0)>>2]))break}d[o+16>>2]=r}else d[7725]=a|c,d[i>>2]=r;d[r+24>>2]=i,d[r+12>>2]=r,d[r+8>>2]=r;break i}e=d[i+8>>2],d[e+12>>2]=r,d[i+8>>2]=r,d[r+24>>2]=0,d[r+12>>2]=i,d[r+8>>2]=e}e=s+8|0;break e}t:if(h){e=d[i+28>>2];i:{if(d[(n=31200+(e<<2)|0)>>2]==(0|i)){if(d[n>>2]=s,s)break i;d[7725]=a_(e)&_;break t}if(d[h+(d[h+16>>2]==(0|i)?16:20)>>2]=s,!s)break t}d[s+24>>2]=h,(e=d[i+16>>2])&&(d[s+16>>2]=e,d[e+24>>2]=s),(e=d[i+20>>2])&&(d[s+20>>2]=e,d[e+24>>2]=s)}r>>>0<=15?(e=r+a|0,d[i+4>>2]=3|e,d[4+(e=e+i|0)>>2]=1|d[e+4>>2]):(d[i+4>>2]=3|a,d[4+(a=i+a|0)>>2]=1|r,d[r+a>>2]=r,c&&(e=30936+((n=c>>>3|0)<<3)|0,s=d[7729],(n=1<>2]:(d[7724]=n|o,n=e),d[e+8>>2]=s,d[n+12>>2]=s,d[s+12>>2]=e,d[s+8>>2]=n),d[7729]=a,d[7726]=r),e=i+8|0}return O=t+16|0,0|e}function k(e,t,i,n,r){var o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0),se=y(0),oe=y(0),ae=y(0),le=y(0),ce=y(0),he=y(0),_e=y(0),de=y(0),ue=y(0),pe=y(0),fe=y(0),me=y(0),ge=y(0),be=y(0),ye=y(0),ve=y(0),Ae=y(0),Ce=y(0),Se=y(0),xe=y(0),Te=y(0),Ee=y(0),Re=y(0),Pe=y(0),Ie=y(0),Me=y(0),De=0,Oe=y(0),we=y(0),Fe=y(0),Be=y(0),Ne=y(0),Le=y(0);O=o=O-80|0,s[e+525|0]=0,s[e+526|0]=0,d[e+500>>2]=0,d[e+504>>2]=0;e:if(u[e+527|0]|!u[e+552|0]){st(t,o+16|0),st(e+300|0,o),l=m[o+24>>2],a=m[o+8>>2],c=m[o+4>>2],_=m[o+20>>2],g=m[o+12>>2],k=m[o+28>>2],P=m[o+16>>2],D=m[o>>2],st(i,o+16|0),st(e+364|0,o),N=y(-0),V=y(1),w=y(y(y(D*l)+y(y(g*_)+y(k*c)))-y(P*a)),S=m[o+28>>2],F=m[o+8>>2],E=m[o+12>>2],b=m[o+24>>2],f=m[o+16>>2],z=m[o+4>>2],T=m[o>>2],L=m[o+20>>2],p=y(y(y(y(S*F)+y(E*b))+y(f*z))-y(T*L)),j=y(y(y(y(k*D)+y(P*g))+y(_*a))-y(l*c)),I=y(y(y(y(S*E)-y(T*f))-y(L*z))-y(F*b)),W=y(y(y(y(k*g)-y(D*P))-y(_*c))-y(a*l)),M=y(y(y(y(S*T)+y(f*E))+y(L*F))-y(b*z)),k=y(y(y(y(k*a)+y(g*l))+y(P*c))-y(D*_)),g=y(y(y(T*b)+y(y(E*L)+y(S*z)))-y(f*F)),P=y(y(w*p)+y(y(y(j*I)-y(W*M))-y(k*g))),D=y(y(j*g)+y(y(y(k*I)-y(W*p))-y(w*M))),S=y(y(k*p)+y(y(y(j*M)+y(W*I))+y(w*g))),a=y(S*y(0)),c=y(P*y(0)),l=y(y(D+a)-c),F=y(y(k*M)+y(y(y(w*I)-y(W*g))-y(j*p))),a=y(y(a+c)-F),_=y(F*y(0)),E=y(D*y(0)),c=y(y(y(-P)-_)-E),_=y(y(S+_)-E),f=E=y(y(P*l)+y(y(y(S*a)-y(D*c))-y(F*_))),R=y(E*E),E=y(y(F*a)+y(y(y(S*_)-y(P*c))-y(D*l))),l=y(y(D*_)+y(y(y(S*l)-y(F*c))-y(P*a))),a=y(y(1)/y(x(y(R+y(y(E*E)+y(l*l)))))),_=y(f*a),l=y(l*a),c=y(E*a),(a=y(y(_*y(0))+y(y(l*y(0))+c)))>2])>=(T=m[e+456>>2]))&&(b=m[e+448>>2])>=T){if(_=Ki(y(A(y(C(z,y(-1))),y(1)))),f=y(_+_),l=y(0),f>y(1.1920928955078125e-7)&&(_=y(y(1)/y(x(y(y(E*E)+y(y(N*N)+y(V*V)))))),c=y(E*_),h=y(N*_),_=y(V*_),l=a,y(v(_))>y(1.1920928955078125e-7)&&(l=y(y(c*c)/y(_*_)),l=y(x(y(y(l+y(1))/y(y(l/y(a*a))+y(y(1)/y(b*b)))))))),R=m[e+428>>2],!(f>(T=y(l*R))))break t;s[e+526|0]=1,B=y(1),L=y(f-T),m[e+504>>2]=L,m[e+528>>2]=fy(1.1920928955078125e-7)&&(l=y(v(y(_*y(y(b/a)*y(y(-c)/_))))),l=c>2]=0,d[e+540>>2]=0,d[e+472>>2]=0,d[e+544>>2]=0,d[e+548>>2]=0,l=y(-_),a=y(y(y(I*l)-y(p*h))+y(M*c)),b=y(y(g*h)+y(y(M*l)-y(I*c))),f=y(y(y(M*h)+y(g*_))+y(p*c)),c=y(y(p*_)+y(y(g*y(-c))-y(I*h))),l=y(y(M*a)+y(y(y(I*b)-y(p*f))-y(g*c))),m[e+468>>2]=l,h=y(y(p*c)+y(y(y(I*a)-y(g*f))-y(M*b))),m[e+464>>2]=h,a=y(y(g*b)+y(y(y(I*c)-y(M*f))-y(p*a))),m[e+460>>2]=a,m[e+492>>2]=y(1)/y(y(y(y(a*y(y(y(a*m[n>>2])+y(m[n+16>>2]*h))+y(m[n+32>>2]*l)))+y(h*y(y(y(a*m[n+4>>2])+y(h*m[n+20>>2]))+y(l*m[n+36>>2]))))+y(l*y(y(y(a*m[n+8>>2])+y(h*m[n+24>>2]))+y(l*m[n+40>>2]))))+y(y(y(a*y(y(y(a*m[r>>2])+y(h*m[r+16>>2]))+y(l*m[r+32>>2])))+y(h*y(y(y(a*m[r+4>>2])+y(h*m[r+20>>2]))+y(l*m[r+36>>2]))))+y(l*y(y(y(a*m[r+8>>2])+y(h*m[r+24>>2]))+y(l*m[r+40>>2])))))}else{c=m[t>>2],l=m[e+308>>2],L=m[t+4>>2],h=m[e+324>>2],B=m[t+8>>2],f=m[e+340>>2],oe=y(y(y(c*l)+y(L*h))+y(B*f)),R=m[e+364>>2],G=m[e+380>>2],H=m[e+396>>2],_=y(y(y(R*m[i>>2])+y(G*m[i+4>>2]))+y(H*m[i+8>>2])),Y=m[t+16>>2],Q=m[t+20>>2],q=m[t+24>>2],ae=y(y(y(Y*l)+y(Q*h))+y(q*f)),b=y(y(y(R*m[i+16>>2])+y(G*m[i+20>>2]))+y(H*m[i+24>>2])),K=m[t+32>>2],Z=m[t+36>>2],$=m[t+40>>2],le=y(y(y(K*l)+y(Z*h))+y($*f)),f=y(y(y(R*m[i+32>>2])+y(G*m[i+36>>2]))+y(H*m[i+40>>2])),l=y(y(y(oe*_)+y(ae*b))+y(le*f)),h=m[e+304>>2],R=m[e+320>>2],G=m[e+336>>2],H=y(y(y(c*h)+y(L*R))+y(B*G)),ce=y(y(y(Y*h)+y(Q*R))+y(q*G)),he=y(y(y(K*h)+y(Z*R))+y($*G)),h=y(y(y(H*_)+y(ce*b))+y(he*f)),R=m[e+300>>2],U=y(R*c),c=m[e+316>>2],G=m[e+332>>2],L=y(y(U+y(c*L))+y(G*B)),B=y(y(y(R*Y)+y(c*Q))+y(G*q)),R=y(y(y(R*K)+y(c*Z))+y(G*$)),c=y(y(y(L*_)+y(B*b))+y(R*f));i:if(a>2])>2]=0,m[e+468>>2]=-y(y(B*_)-y(L*b)),m[e+464>>2]=-y(y(L*f)-y(R*_)),m[e+460>>2]=-y(y(R*b)-y(B*f));break t}if(y(v(l))=T))break i;if((T=tn(l,c))>a){h=y(0),l=An(a),c=yn(a);break i}if(h=y(0),!(Ta)l=y(0),h=An(a);else{if(l=y(0),!(T>2]=0,a=y(y(le*l)+y(y(he*h)+y(R*c))),T=y(y(oe*l)+y(y(H*h)+y(L*c))),h=y(y(ae*l)+y(y(ce*h)+y(B*c))),l=y(y(1)/y(x(y(y(a*a)+y(y(T*T)+y(h*h)))))),a=y(a*l),c=y(h*l),h=y(y(b*a)-y(f*c)),R=f,f=y(T*l),l=y(y(R*f)-y(_*a)),a=y(y(_*c)-y(b*f)),c=y(x(y(y(y(h*h)+y(l*l))+y(a*a)))),m[e+504>>2]=c,c=y(y(1)/c),m[e+468>>2]=c*y(-a),m[e+464>>2]=c*y(-l),m[e+460>>2]=c*y(-h)}if((b=m[e+452>>2])>=y(0)){if(_=y(y(D*E)+y(y(F*V)+y(y(S*z)+y(P*N)))),l=y(y(P*V)+y(y(y(D*z)-y(S*E))-y(F*N))),h=y(y(F*E)+y(y(y(P*z)-y(S*N))-y(D*V))),c=y(y(D*N)+y(y(y(F*z)-y(S*V))-y(P*E))),a=y(y(1)/y(x(y(y(_*_)+y(y(l*l)+y(y(h*h)+y(c*c))))))),l=y(l*a),c=y(c*a),h=y(h*a),a=y(_*a),_=Ki(y(A(y(C(a,y(-1))),y(1)))),(_=y(_+_))>y(3.1415927410125732)&&(a=Ki(y(A(y(C(y(-a),y(-1))),y(1)))),_=y(a+a),c=y(-c),h=y(-h),l=y(-l)),m[e+512>>2]=_,_>y(1.1920928955078125e-7)&&(a=y(y(1)/y(x(y(y(y(h*h)+y(c*c))+y(l*l))))),l=y(l*a),c=y(c*a),h=y(h*a)),D=m[e+428>>2],_>(P=y(b*D))&&(s[e+525|0]=1,S=y(_-P),m[e+508>>2]=S,t=e,a=y(1),_>2]=a,d[e+488>>2]=0,a=y(-c),P=y(y(y(I*a)-y(p*h))+y(M*l)),D=y(y(g*h)+y(y(M*a)-y(I*l))),S=y(y(y(M*h)+y(g*c))+y(p*l)),F=y(y(p*c)+y(y(g*y(-l))-y(I*h))),a=y(y(M*P)+y(y(y(I*D)-y(p*S))-y(g*F))),m[e+484>>2]=a,_=y(y(p*F)+y(y(y(I*P)-y(g*S))-y(M*D))),m[e+480>>2]=_,p=y(y(g*D)+y(y(y(I*F)-y(M*S))-y(p*P))),m[e+476>>2]=p,m[e+496>>2]=y(1)/y(y(y(y(p*y(y(y(p*m[n>>2])+y(m[n+16>>2]*_))+y(m[n+32>>2]*a)))+y(_*y(y(y(p*m[n+4>>2])+y(_*m[n+20>>2]))+y(a*m[n+36>>2]))))+y(a*y(y(y(p*m[n+8>>2])+y(_*m[n+24>>2]))+y(a*m[n+40>>2]))))+y(y(y(p*y(y(y(p*m[r>>2])+y(_*m[r+16>>2]))+y(a*m[r+32>>2])))+y(_*y(y(y(p*m[r+4>>2])+y(_*m[r+20>>2]))+y(a*m[r+36>>2]))))+y(a*y(y(y(p*m[r+8>>2])+y(_*m[r+24>>2]))+y(a*m[r+40>>2])))))),!u[e+526|0])break e;d[e+548>>2]=0,_=y(-c),a=y(y(y(W*_)-y(k*h))+y(j*l)),_=y(y(w*h)+y(y(j*_)-y(W*l))),p=y(y(y(j*h)+y(w*c))+y(k*l)),l=y(y(k*c)+y(y(w*y(-l))-y(W*h))),m[e+544>>2]=y(j*a)+y(y(y(W*_)-y(k*p))-y(w*l)),m[e+540>>2]=y(k*l)+y(y(y(W*a)-y(w*p))-y(j*_)),m[e+536>>2]=y(w*_)+y(y(y(W*l)-y(j*p))-y(k*a))}else d[e+512>>2]=0}else{if(Oe=m[i+52>>2],we=m[i+56>>2],z=m[e+412>>2],T=m[e+416>>2],L=m[e+420>>2],Fe=m[t+52>>2],Be=m[t+56>>2],B=m[e+348>>2],R=m[e+352>>2],G=m[e+356>>2],c=m[i+20>>2],_=m[i+24>>2],p=m[t+20>>2],I=m[t+24>>2],H=m[e+308>>2],Y=m[e+324>>2],Q=m[e+340>>2],q=m[e+316>>2],K=m[e+332>>2],Z=m[e+304>>2],M=m[t+36>>2],$=m[e+320>>2],g=m[t+40>>2],oe=m[e+336>>2],ae=m[e+372>>2],le=m[e+388>>2],ce=m[e+404>>2],he=m[e+368>>2],me=m[e+384>>2],ge=m[e+400>>2],h=m[e+568>>2],w=m[e+564>>2],a=m[e+560>>2],j=m[i+36>>2],be=m[e+380>>2],W=m[i+40>>2],ye=m[e+396>>2],Ne=m[i+48>>2],k=m[i+8>>2],P=m[i+4>>2],D=m[i>>2],Le=m[t+48>>2],S=m[t+8>>2],F=m[t>>2],V=m[t+4>>2],E=m[i+16>>2],N=m[t+16>>2],ve=m[e+300>>2],b=m[t+32>>2],l=m[e+556>>2],f=m[i+32>>2],Ae=m[e+364>>2],d[o+76>>2]=0,d[o+60>>2]=0,d[o+44>>2]=0,_e=y(y(y(H*b)+y(Y*M))+y(Q*g)),U=y(y(2)/y(y(y(y(l*l)+y(a*a))+y(w*w))+y(h*h))),J=y(l*U),ee=y(l*J),X=y(a*U),te=y(a*X),Ce=y(y(1)-y(ee+te)),de=y(y(y(ae*f)+y(le*j))+y(ce*W)),U=y(w*U),ie=y(l*U),ne=y(h*X),Se=y(ie+ne),ue=y(y(y(Ae*f)+y(be*j))+y(ye*W)),re=y(a*U),se=y(h*J),xe=y(re-se),a=y(y(y(he*f)+y(me*j))+y(ge*W)),J=y(y(Ce*de)+y(y(Se*ue)+y(xe*a))),pe=y(y(y(ve*b)+y(q*M))+y(K*g)),Te=y(ie-ne),w=y(w*U),Ee=y(y(1)-y(te+w)),X=y(l*X),U=y(h*U),Re=y(X+U),l=y(y(Te*de)+y(y(Ee*ue)+y(Re*a))),h=y(y(y(Z*b)+y($*M))+y(oe*g)),Pe=y(re+se),Ie=y(X-U),Me=y(y(1)-y(ee+w)),w=y(y(Pe*de)+y(y(Ie*ue)+y(Me*a))),m[o+56>>2]=y(_e*J)+y(y(pe*l)+y(h*w)),U=y(y(y(H*N)+y(Y*p))+y(Q*I)),X=y(y(y(ve*N)+y(q*p))+y(K*I)),ee=y(y(y(Z*N)+y($*p))+y(oe*I)),m[o+52>>2]=y(U*J)+y(y(X*l)+y(ee*w)),te=y(y(y(ae*E)+y(le*c))+y(ce*_)),ie=y(y(y(Ae*E)+y(be*c))+y(ye*_)),ne=y(y(y(he*E)+y(me*c))+y(ge*_)),re=y(y(Ce*te)+y(y(Se*ie)+y(xe*ne))),se=y(y(Te*te)+y(y(Ee*ie)+y(Re*ne))),fe=y(y(Pe*te)+y(y(Ie*ie)+y(Me*ne))),m[o+40>>2]=y(_e*re)+y(y(pe*se)+y(h*fe)),m[o+36>>2]=y(U*re)+y(y(X*se)+y(ee*fe)),N=y(-y(Fe+y(y(y(N*B)+y(p*R))+y(I*G)))),p=y(y(y(F*H)+y(V*Y))+y(S*Q)),H=y(Le+y(y(y(F*B)+y(V*R))+y(S*G))),g=y(Be+y(y(y(b*B)+y(M*R))+y(g*G))),b=y(y(y(U*N)-y(p*H))-y(_e*g)),I=y(y(y(ve*F)+y(q*V))+y(K*S)),B=y(y(y(X*N)-y(I*H))-y(pe*g)),M=y(y(y(F*Z)+y(V*$))+y(S*oe)),S=y(y(y(ee*N)-y(M*H))-y(h*g)),m[o+72>>2]=y(y(b*J)+y(y(B*l)+y(S*w)))+y(y(y(de*y(0))+y(y(ue*y(0))+y(a*y(0))))+y(we+y(y(y(f*z)+y(j*T))+y(W*L)))),m[o+68>>2]=y(y(b*re)+y(y(B*se)+y(S*fe)))+y(y(y(te*y(0))+y(y(ie*y(0))+y(ne*y(0))))+y(Oe+y(y(y(E*z)+y(c*T))+y(_*L)))),d[o+28>>2]=0,m[o+48>>2]=y(p*J)+y(y(I*l)+y(M*w)),m[o+32>>2]=y(p*re)+y(y(I*se)+y(M*fe)),l=y(y(y(Ae*D)+y(be*P))+y(ye*k)),a=y(y(y(D*he)+y(P*me))+y(k*ge)),c=y(y(y(D*ae)+y(P*le))+y(k*ce)),_=y(y(y(Se*l)+y(xe*a))+y(Ce*c)),g=y(y(y(Ee*l)+y(Re*a))+y(Te*c)),f=h,h=y(y(y(Ie*l)+y(Me*a))+y(Pe*c)),m[o+24>>2]=y(_e*_)+y(y(pe*g)+y(f*h)),m[o+20>>2]=y(U*_)+y(y(X*g)+y(ee*h)),m[o+16>>2]=y(p*_)+y(y(I*g)+y(M*h)),m[o+64>>2]=y(y(b*_)+y(y(B*g)+y(S*h)))+y(y(y(y(l*y(0))+y(a*y(0)))+y(c*y(0)))+y(Ne+y(y(y(D*z)+y(P*T))+y(k*L)))),st(o+16|0,o),l=m[o>>2],h=m[o+4>>2],a=m[o+8>>2],c=y(y(y(l*l)+y(h*h))+y(a*a)),y(v(c))>2]=0,c=y(y(1)/y(x(c))),m[e+468>>2]=c*a,m[e+464>>2]=c*h,m[e+460>>2]=c*l,l=Ki(y(A(y(C(m[o+12>>2],y(-1))),y(1)))),l=y(l+l),m[e+504>>2]=l,y(v(l))>2],D=t,(W=d[n>>2])&&(D=d[W+12>>2]),G=d[D+96>>2],E=d[t+96>>2],g=d[i+96>>2]-E|0,A=d[(W||B)+12>>2],R=d[t+92>>2],C=d[A+92>>2]-R|0,T=i,h=d[i+92>>2]-R|0,L=d[A+96>>2]-E|0,P=id(_=i=b(g,C)-b(h,L)|0,u=i>>31,i=g,k=i>>31),U=w,x=d[t+88>>2],S=d[A+88>>2]-x|0,y=d[T+88>>2]-x|0,A=id(p=t=b(S,h)-b(C,y)|0,f=t>>31,t=y,I=t>>31),C=id(o=P-A|0,a=U-(w+(P>>>0>>0)|0)|0,P=Y=d[D+92>>2],P>>31),U=w,A=id(p,f,P=h,z=P>>31),X=w,M=C,v=C=b(t,L)-b(i,S)|0,i=id(C,m=C>>31,i,k),A=id(l=A-i|0,X=X-(w+(A>>>0>>0)|0)|0,i=D=d[D+88>>2],i>>31),C=w+U|0,C=(i=M+A|0)>>>0>>0?C+1|0:C,t=id(t,I,v,m),A=w,M=i,i=id(P,z,_,u),i=id(z=t-i|0,c=A-(w+(t>>>0>>0)|0)|0,G,G>>31),A=w+C|0,P=t=M+i|0,i=t>>>0>>0?A+1|0:A,t=id(_,u,x,x>>31),A=w,E=id(p,f,E,E>>31),A=w+A|0,A=(t=E+t|0)>>>0>>0?A+1|0:A,E=id(v,m,R,R>>31),A=w+A|0,j=t=E+t|0,I=t>>>0>>0?A+1|0:A,T=B?d[B+12>>2]:T,L=d[T+96>>2],k=d[T+92>>2],U=d[T+88>>2],t=B,W&&(t=B,d[W+12>>2])){t=d[d[W+8>>2]+4>>2],x=d[t+12>>2],T=id(R=E=d[(A=x)+92>>2],E>>=31,v,m),C=w,M=T,V=A=d[A+88>>2],T=id(A,N=A>>31,_,u),C=w+C|0,C=(A=M+T|0)>>>0>>0?C+1|0:C,S=A,M=A=d[x+96>>2],T=id(A,F=A>>31,p,f),A=w+C|0;e:if(!((0|(A=(x=S+T|0)>>>0>>0?A+1|0:A))<(0|I)||(0|A)<=(0|I)&&!(x>>>0>=j>>>0))){for(T=t+12|0,H=d[e+100>>2];;){if((0|H)==d[t+20>>2])break e;if(A=id(R,E,o,a),R=w,E=(x=id(V,N,l,X))+A|0,A=w+R|0,A=E>>>0>>0?A+1|0:A,R=id(M,F,z,c),C=w+A|0,(0|(A=C=(E=R+E|0)>>>0>>0?C+1|0:C))<(0|i)||(0|A)<=(0|i)&&!(E>>>0>P>>>0))break e;if(d[n>>2]=t,i=d[T>>2],G=d[i+96>>2],Y=d[i+92>>2],D=d[i+88>>2],!i)break;if(T=(t=d[d[t+8>>2]+4>>2])+12|0,P=E,i=A,C=d[t+12>>2],x=id(R=E=d[(A=C)+92>>2],E>>=31,v,m),S=w,V=A=d[A+88>>2],M=id(A,N=A>>31,_,u),A=w+S|0,A=(x=M+x|0)>>>0>>0?A+1|0:A,S=x,M=x=d[C+96>>2],x=S+(C=id(x,F=x>>31,p,f))|0,S=w+A|0,(0|(S=x>>>0>>0?S+1|0:S))<(0|I)||(0|S)<=(0|I)&&!(x>>>0>=j>>>0))break e}P=E,i=A}t=d[r>>2]}A=id(o,a,k,k>>31),E=w,R=id(l,X,U,U>>31),C=w+E|0,C=(A=R+A|0)>>>0>>0?C+1|0:C,E=(R=id(z,c,L,L>>31))+A|0,A=w+C|0,A=E>>>0>>0?A+1|0:A,R=E,E=A;e:if(t){if(d[t+12>>2]&&(T=d[d[t+8>>2]>>2],x=d[T+12>>2],V=C=d[(A=x)+92>>2],C=id(C,N=C>>31,v,m),S=w,Q=C,M=A=d[A+88>>2],C=id(A,F=A>>31,_,u),S=w+S|0,S=(A=Q+C|0)>>>0>>0?S+1|0:S,Q=A,C=A=d[x+96>>2],q=id(A,H=A>>31,p,f),A=w+S|0,!((0|(A=(x=Q+q|0)>>>0>>0?A+1|0:A))<(0|I)||(0|A)<=(0|I)&&!(x>>>0>=j>>>0)))){for(q=T+12|0,K=d[e+100>>2];;){if((0|K)==d[(x=T)+20>>2])break e;if(A=id(V,N,o,a),S=w,T=(V=id(M,F,l,X))+A|0,A=w+S|0,A=T>>>0>>0?A+1|0:A,C=id(z,c,C,H),S=w+A|0,S=(T=C+T|0)>>>0>>0?S+1|0:S,C=T,(0|(A=S))<(0|E)||(0|A)<=(0|E)&&!(C>>>0>R>>>0))break e;if(d[r>>2]=x,t=d[q>>2],L=d[t+96>>2],k=d[t+92>>2],U=d[t+88>>2],!t)break;if(q=(T=d[d[x+8>>2]>>2])+12|0,R=C,E=A,t=x,C=d[T+12>>2],V=x=d[(A=C)+92>>2],x=id(x,N=x>>31,v,m),S=w,M=A=d[A+88>>2],H=id(A,F=A>>31,_,u),A=w+S|0,A=(x=H+x|0)>>>0>>0?A+1|0:A,Q=x,S=id(C=x=d[C+96>>2],H=C>>31,p,f),A=w+A|0,(0|(A=(x=Q+S|0)>>>0>>0?A+1|0:A))<(0|I)||(0|A)<=(0|I)&&!(x>>>0>=j>>>0))break e}t=x,R=C,E=A}}else t=0;e:{if(i=E-((R>>>0

>>0)+i|0)|0,P=R-P|0,(0|i)>0||(0|i)>=0&&!(P>>>0<1))for(;;){E=t=I=(b(k-Y|0,h)+b(U-D|0,y)|0)+b(L-G|0,g)|0,V=t>>31;t:if(!(!(N=d[n>>2])|!d[N+12>>2]||(M=d[d[N>>2]+8>>2],d[M+20>>2]<=d[e+100>>2]))){t=d[M+12>>2],A=(R=d[t+92>>2])-Y|0,C=(x=d[t+88>>2])-D|0,t=(T=d[t+96>>2])-G|0,B=(b(A,h)+b(C,y)|0)+b(t,g)|0,A=id(o,a,A,A>>31),S=w,C=(F=id(l,X,C,C>>31))+A|0,A=w+S|0,A=C>>>0>>0?A+1|0:A,S=C,C=id(z,c,t,t>>31),A=w+A|0,A=(t=S+C|0)>>>0>>0?A+1|0:A,C=t,S=A;i:{if(!(A|t)){if((0|B)<0)break i;break t}if((0|S)>-1||(0|S)>=-1&&!(C>>>0<=4294967295))break t;if(F=(t=B)>>31,A=s,(0|t)>=1?(d[s+24>>2]=t,d[s+28>>2]=F,d[s+40>>2]=1,t=-1):(0|B)<=-1?(d[s+40>>2]=-1,d[s+24>>2]=0-t,d[s+28>>2]=0-((0>>0)+F|0),t=1):(d[s+24>>2]=0,d[s+28>>2]=0,d[s+40>>2]=0,t=0),d[A+40>>2]=t,d[s+32>>2]=0-C,d[s+36>>2]=0-((0>>0)+S|0),(0|I)>=1?(d[s>>2]=E,d[s+4>>2]=V,d[s+16>>2]=1,C=-1):(0|I)<=-1?(d[s+16>>2]=-1,t=E,d[s>>2]=0-t,d[s+4>>2]=0-((0>>0)+V|0),C=1):(d[s>>2]=0,d[s+4>>2]=0,d[s+16>>2]=0,C=0),B=s,t=P,S=A=i,(0|A)>0||(0|A)>=0&&!(t>>>0<=0)||(t=0,S=0,(0|i)>-1||(0|i)>=-1&&!(P>>>0<=4294967295)||(d[s+16>>2]=C,t=0-(A=P)|0,S=0-((0>>0)+i|0)|0)),A=S,d[B+8>>2]=t,d[B+12>>2]=A,(0|bi(s+24|0,s))<=-1)break t}d[n>>2]=(0|N)==(0|W)?0:M,t=id(o,a,t=k-R|0,t>>31),i=w,t=(A=t)+(P=id(l,X,t=U-x|0,t>>31))|0,A=w+i|0,A=t>>>0

>>0?A+1|0:A,C=t,i=id(z,c,t=L-T|0,t>>31),A=w+A|0,P=t=C+i|0,i=t>>>0>>0?A+1|0:A,D=x,Y=R,G=T;continue}if(!(t=d[r>>2])|!d[t+12>>2])break e;if(N=d[d[t+8>>2]>>2],d[N+20>>2]<=d[e+100>>2])break e;if(t=d[N+12>>2],T=A=x=(R=d[t+92>>2])-k|0,A=id(A,B=A>>31,v,m),C=w,S=A,M=A=U=(k=d[t+88>>2])-U|0,A=S+(j=id(A,F=A>>31,_,u))|0,S=w+C|0,S=A>>>0>>0?S+1|0:S,C=A,j=t=L=(A=d[t+96>>2])-L|0,(0|C)!=(0-(t=id(p,f,t,H=t>>31))|0)|(0-(w+(0>>0)|0)|0)!=(0|S))break e;if(t=id(o,a,t=R-Y|0,t>>31),R=w,t=(C=t)+(k=id(l,X,t=k-D|0,t>>31))|0,C=w+R|0,C=t>>>0>>0?C+1|0:C,S=t,R=id(z,c,t=A-G|0,t>>31),A=w+C|0,A=(t=S+R|0)>>>0>>0?A+1|0:A,R=t,t=A,(0|A)<0||(0|A)<=0&&!(R>>>0>=1))break e;x=(b(x,h)+b(U,y)|0)+b(L,g)|0,A=id(T,B,o,a),B=w,T=(C=id(M,F,l,X))+A|0,A=w+B|0,A=T>>>0>>0?A+1|0:A,B=id(z,c,j,H),A=w+A|0,B=A=(T=B+T|0)>>>0>>0?A+1|0:A;t:{if(!(A|T)){if((0|x)<0)break t;break e}if((0|B)>-1||(0|B)>=-1&&!(T>>>0<=4294967295))break e;if(L=(A=x)>>31,C=s,(0|A)>=1?(d[s+24>>2]=A,d[s+28>>2]=L,d[s+40>>2]=1,A=-1):(0|x)<=-1?(d[s+40>>2]=-1,d[s+24>>2]=0-A,d[s+28>>2]=0-((0>>0)+L|0),A=1):(d[s+24>>2]=0,d[s+28>>2]=0,d[s+40>>2]=0,A=0),d[C+40>>2]=A,d[s+32>>2]=0-T,d[s+36>>2]=0-((0>>0)+B|0),(0|I)>=1?(d[s>>2]=E,d[s+4>>2]=V,d[s+16>>2]=1,T=-1):(0|I)<=-1?(d[s+16>>2]=-1,d[s>>2]=0-E,d[s+4>>2]=0-((0>>0)+V|0),T=1):(d[s>>2]=0,d[s+4>>2]=0,d[s+16>>2]=0,T=0),x=s,M=s,E=i,C=A=P,(0|i)>0||(0|i)>=0&&!(A>>>0<=0)||(E=0,C=0,(0|i)>-1||(0|i)>=-1&&!(P>>>0<=4294967295)||(d[s+16>>2]=T,E=0-((0

>>0)+i|0)|0,C=0-P|0)),d[M+8>>2]=C,d[x+12>>2]=E,(0|bi(s+24|0,s))<=0)break e}d[r>>2]=N,i=d[N+12>>2],L=d[i+96>>2],k=d[i+92>>2],U=d[i+88>>2],P=R,i=t}if(!((0|i)>-1||(0|i)>=-1&&!(P>>>0<=4294967295)))for(;;){R=A=V=(b(k-Y|0,h)+b(U-D|0,y)|0)+b(L-G|0,g)|0,N=A>>31;t:if(!(!t|!d[t+12>>2]||(M=d[d[t+4>>2]+8>>2],d[M+20>>2]<=d[e+100>>2]))){A=d[M+12>>2],S=(E=d[A+92>>2])-k|0,I=(x=d[A+88>>2])-U|0,W=(T=d[A+96>>2])-L|0,C=(b(S,h)+b(I,y)|0)+b(W,g)|0,A=id(o,a,S,S>>31),F=w,S=(I=id(l,X,I,I>>31))+A|0,A=w+F|0,A=S>>>0>>0?A+1|0:A,I=id(z,c,W,W>>31),A=w+A|0,I=A=(S=I+S|0)>>>0>>0?A+1|0:A;i:{if(!(A|S)){if((0|C)>0)break i;break t}if((0|I)>-1||(0|I)>=-1&&!(S>>>0<=4294967295))break t;if(F=(A=C)>>31,j=s,(0|A)>=1?(d[s+24>>2]=A,d[s+28>>2]=F,d[s+40>>2]=1,A=-1):(0|C)<=-1?(d[s+40>>2]=-1,d[s+24>>2]=0-A,d[s+28>>2]=0-((0>>0)+F|0),A=1):(d[s+24>>2]=0,d[s+28>>2]=0,d[s+40>>2]=0,A=0),d[j+40>>2]=A,d[s+32>>2]=0-S,d[s+36>>2]=0-((0>>0)+I|0),(0|V)>=1?(d[s>>2]=R,d[s+4>>2]=N,d[s+16>>2]=1,I=-1):(0|V)<=-1?(d[s+16>>2]=-1,A=R,d[s>>2]=0-A,d[s+4>>2]=0-((0>>0)+N|0),I=1):(d[s>>2]=0,d[s+4>>2]=0,d[s+16>>2]=0,I=0),S=s,A=P,C=i,(0|i)>0||(0|i)>=0&&!(A>>>0<=0)||(A=0,C=0,(0|i)>-1||(0|i)>=-1&&!(P>>>0<=4294967295)||(d[s+16>>2]=I,A=0-(C=P)|0,C=0-((0>>0)+i|0)|0)),d[S+8>>2]=A,d[S+12>>2]=C,(0|bi(s+24|0,s))>=1)break t}t=(0|t)==(0|B)?0:M,d[r>>2]=t,i=id(o,a,i=E-Y|0,i>>31),P=w,i=(A=i)+(R=id(l,X,i=x-D|0,i>>31))|0,A=w+P|0,A=i>>>0>>0?A+1|0:A,C=i,P=id(z,c,i=T-G|0,i>>31),A=w+A|0,A=(i=C+P|0)>>>0

>>0?A+1|0:A,P=i,i=A,U=x,k=E,L=T;continue}if(!(t=d[n>>2])|!d[t+12>>2])break e;if(I=d[d[t+8>>2]+4>>2],d[I+20>>2]<=d[e+100>>2])break e;if(t=d[I+12>>2],C=A=T=(E=d[t+92>>2])-Y|0,A=id(A,Y=A>>31,v,m),x=w,S=A,M=A=D=(W=d[t+88>>2])-D|0,A=S+(j=id(A,F=A>>31,_,u))|0,S=w+x|0,S=A>>>0>>0?S+1|0:S,j=t=G=(x=d[t+96>>2])-G|0,(0-(t=id(p,f,t,H=t>>31))|0)!=(0|A)|(0-(w+(0>>0)|0)|0)!=(0|S))break e;if(t=id(o,a,t=k-E|0,t>>31),A=w,S=t,E=id(l,X,t=U-W|0,t>>31),A=w+A|0,A=(t=S+E|0)>>>0>>0?A+1|0:A,S=t,E=id(z,c,t=L-x|0,t>>31),A=w+A|0,x=t=S+E|0,E=A=t>>>0>>0?A+1|0:A,(0|A)>-1||(0|A)>=-1&&!(t>>>0<=4294967295))break e;if(D=(b(T,h)+b(D,y)|0)+b(G,g)|0,t=id(C,Y,o,a),A=w,T=id(M,F,l,X),C=w+A|0,C=(t=T+t|0)>>>0>>0?C+1|0:C,T=id(z,c,j,H),A=w+C|0,A=(t=T+t|0)>>>0>>0?A+1|0:A,T=t,C=A,A|t){if((0|C)>-1||(0|C)>=-1&&!(T>>>0<=4294967295))break e;if(G=(t=D)>>31,A=s,(0|t)>=1?(d[s+24>>2]=t,d[s+28>>2]=G,d[s+40>>2]=1,t=-1):(0|D)<=-1?(d[s+40>>2]=-1,d[s+24>>2]=0-t,d[s+28>>2]=0-((0>>0)+G|0),t=1):(d[s+24>>2]=0,d[s+28>>2]=0,d[s+40>>2]=0,t=0),d[A+40>>2]=t,d[s+32>>2]=0-T,d[s+36>>2]=0-((0>>0)+C|0),(0|V)>=1?(d[s>>2]=R,d[s+4>>2]=N,d[s+16>>2]=1,D=-1):(0|V)<=-1?(d[s+16>>2]=-1,d[s>>2]=0-R,d[s+4>>2]=0-((0>>0)+N|0),D=1):(d[s>>2]=0,d[s+4>>2]=0,d[s+16>>2]=0,D=0),R=s,T=s,C=t=P,(0|(A=i))>0||(0|A)>=0&&!(t>>>0<=0)||(A=0,C=0,(0|i)>-1||(0|i)>=-1&&!(P>>>0<=4294967295)||(d[s+16>>2]=D,A=0-((0

>>0)+i|0)|0,C=0-P|0)),d[T+8>>2]=C,d[R+12>>2]=A,(0|bi(s+24|0,s))>=0)break e}else if((0|D)<=0)break e;d[n>>2]=I,i=d[I+12>>2],G=d[i+96>>2],Y=d[i+92>>2],t=d[r>>2],D=d[i+88>>2],P=x,i=E}}O=s+48|0}function U(e,t,i){var n,o,a,l,c,h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),A=0,C=0,S=y(0),T=y(0),E=y(0),R=y(0),P=0,I=0,M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=0,j=0,W=0,z=0,H=y(0),X=0,Y=0,Q=y(0),q=y(0),K=0,$=0,J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0),se=0,oe=0;if(O=n=O-96|0,o=d[t+744>>2],l=ci(e,a=d[t+740>>2],m[i+12>>2]),c=ci(e,o,m[i+12>>2]),I=(C=d[e+16>>2])+b(l,244)|0,(m[I+128>>2]!=y(0)|m[I+132>>2]!=y(0)|m[136+(C+b(l,244)|0)>>2]!=y(0)|m[128+(C+b(c,244)|0)>>2]!=y(0)||(I=C+b(c,244)|0,m[I+132>>2]!=y(0)||m[I+136>>2]!=y(0)))&&!((0|(P=d[t+748>>2]))<1))for(se=j=C+b(c,244)|0,oe=W=C+b(l,244)|0,K=1;;){if(A=b($,184)+t|0,m[A+84>>2]<=m[t+756>>2]){if(z=A+4|0,P=I=d[e+28>>2],(0|I)==d[e+32>>2]&&(P=I,!((0|I)>=(0|(G=I?I<<1:1))))){if(P=0,C=I,X=0,G&&(d[7717]=d[7717]+1,X=0|r[d[6606]](b(G,152),16),C=d[e+28>>2]),(0|C)>=1)for(;Mi((Y=b(P,152))+X|0,d[e+36>>2]+Y|0,152),(0|C)!=(0|(P=P+1|0)););(C=d[e+36>>2])&&(u[e+40|0]&&C&&(d[7718]=d[7718]+1,r[d[6607]](C)),d[e+36>>2]=0),d[e+36>>2]=X,s[e+40|0]=1,d[e+32>>2]=G,P=d[e+28>>2]}d[e+28>>2]=P+1,C=d[a+236>>2],P=d[o+236>>2],X=d[e+36>>2]+b(I,152)|0,d[X+148>>2]=c,d[X+144>>2]=l,d[X+132>>2]=z,H=m[A+52>>2],M=m[A+56>>2],g=m[A+60>>2],p=m[a+52>>2],_=m[a+56>>2],h=m[a+60>>2],d[n+92>>2]=0,E=y(g-h),m[n+88>>2]=E,R=y(M-_),m[n+84>>2]=R,f=y(H-p),m[n+80>>2]=f,H=m[A+36>>2],M=m[A+40>>2],g=m[A+44>>2],p=m[o+52>>2],_=m[o+56>>2],h=m[o+60>>2],d[n+76>>2]=0,Q=y(g-h),m[n+72>>2]=Q,M=y(M-_),m[n+68>>2]=M,g=y(H-p),m[n+64>>2]=g,J=y(0),ee=y(0),te=y(0),ie=y(0),d[W+240>>2]&&(p=y(m[W+192>>2]+m[W+224>>2]),_=y(m[W+196>>2]+m[W+228>>2]),ie=y(y(m[W+184>>2]+m[W+216>>2])+y(y(R*p)-y(f*_))),h=y(m[W+200>>2]+m[oe+232>>2]),te=y(y(m[W+180>>2]+m[W+212>>2])+y(y(f*h)-y(E*p))),ee=y(y(m[W+176>>2]+m[W+208>>2])+y(y(E*_)-y(R*h)))),ne=y(0),re=y(0),d[j+240>>2]&&(p=y(m[j+192>>2]+m[j+224>>2]),_=y(m[j+196>>2]+m[j+228>>2]),re=y(y(m[j+184>>2]+m[j+216>>2])+y(y(M*p)-y(g*_))),h=y(m[j+200>>2]+m[se+232>>2]),ne=y(y(m[j+180>>2]+m[j+212>>2])+y(y(g*h)-y(Q*p))),J=y(y(m[j+176>>2]+m[j+208>>2])+y(y(Q*_)-y(M*h)))),Q=m[A+76>>2],H=m[(Y=A+68|0)>>2],M=m[A+72>>2],Z(e,X,l,c,z,i,n+60|0,n+80|0,n- -64|0),d[X+140>>2]=d[e+68>>2],h=y(0),S=y(0),T=y(0),D=y(0),2&C&&(D=m[336+(C=C<<30>>31&a)>>2],S=m[C+328>>2],T=m[C+332>>2]),w=y(0),F=y(0),2&P&&(F=m[336+(C=P<<30>>31&o)>>2],w=m[C+332>>2],h=m[C+328>>2]),d[n+52>>2]=0,g=y(F-D),m[n+48>>2]=g,p=y(w-T),m[n+44>>2]=p,_=y(h-S),m[n+40>>2]=_;e:if(!(m[A+92>>2]>y(0)^1|(0|K)<1))if((h=y(x(y(y(y(_*_)+y(p*p))+y(g*g)))))>m[i+80>>2]){if(h=y(y(1)/h),S=y(g*h),m[n+48>>2]=S,T=y(p*h),m[n+44>>2]=T,h=y(_*h),m[n+40>>2]=h,2&u[a+180|0]&&(g=m[a+172>>2],B=m[a+44>>2],N=m[a+12>>2],L=m[a+28>>2],p=m[a+164>>2],k=m[a+36>>2],V=m[a+4>>2],U=m[a+20>>2],_=m[a+168>>2],E=m[a+40>>2],R=m[a+8>>2],f=m[a+24>>2],d[n+52>>2]=0,p=y(p*y(y(y(h*V)+y(T*U))+y(S*k))),_=y(_*y(y(y(h*R)+y(T*f))+y(S*E))),h=y(g*y(y(y(h*N)+y(T*L))+y(S*B))),S=y(y(y(k*p)+y(E*_))+y(B*h)),m[n+48>>2]=S,T=y(y(y(U*p)+y(f*_))+y(L*h)),m[n+44>>2]=T,h=y(y(y(V*p)+y(R*_))+y(N*h)),m[n+40>>2]=h),2&u[o+180|0]&&(g=m[o+172>>2],B=m[o+44>>2],N=m[o+12>>2],L=m[o+28>>2],p=m[o+164>>2],k=m[o+36>>2],V=m[o+4>>2],U=m[o+20>>2],_=m[o+168>>2],E=m[o+40>>2],R=m[o+8>>2],f=m[o+24>>2],d[n+52>>2]=0,p=y(p*y(y(y(V*h)+y(U*T))+y(k*S))),_=y(_*y(y(y(h*R)+y(T*f))+y(S*E))),h=y(g*y(y(y(h*N)+y(T*L))+y(S*B))),S=y(y(y(k*p)+y(E*_))+y(B*h)),m[n+48>>2]=S,T=y(y(y(U*p)+y(f*_))+y(L*h)),m[n+44>>2]=T,h=y(y(y(V*p)+y(R*_))+y(N*h)),m[n+40>>2]=h),K=0,!(+y(x(y(y(y(h*h)+y(T*T))+y(S*S))))>.001))break e;_r(e,n+40|0,l,c,I,z)}else _r(e,Y,l,c,I,z),P=n,g=m[A+76>>2],y(v(g))>y(.7071067690849304)?(h=m[A+72>>2],d[n+24>>2]=0,f=h,h=y(y(g*g)+y(h*h)),_=y(y(1)/y(x(h))),T=y(f*_),m[n+32>>2]=T,S=y(_*y(-g)),m[n+28>>2]=S,w=y(h*_),m[n+8>>2]=w,h=m[Y>>2],F=y(T*y(-h)),m[n+12>>2]=F,D=y(0),h=y(h*S)):(h=m[Y>>2],p=m[A+72>>2],d[n+32>>2]=0,f=h,h=y(y(h*h)+y(p*p)),_=y(y(1)/y(x(h))),S=y(f*_),m[n+28>>2]=S,D=y(_*y(-p)),m[n+24>>2]=D,F=y(g*D),m[n+12>>2]=F,w=y(S*y(-g)),m[n+8>>2]=w,T=y(0),h=y(h*_)),m[P+16>>2]=h,(P=2&d[a+180>>2])&&(g=m[a+172>>2],B=m[a+44>>2],N=m[a+12>>2],L=m[a+28>>2],p=m[a+164>>2],f=m[a+36>>2],k=m[a+4>>2],V=m[a+20>>2],_=m[a+168>>2],U=m[a+40>>2],E=m[a+8>>2],R=m[a+24>>2],d[n+36>>2]=0,q=f,f=y(p*y(y(y(k*D)+y(V*S))+y(f*T))),p=y(_*y(y(y(D*E)+y(S*R))+y(T*U))),_=y(g*y(y(y(D*N)+y(S*L))+y(T*B))),T=y(y(y(q*f)+y(U*p))+y(B*_)),m[n+32>>2]=T,S=y(y(y(V*f)+y(R*p))+y(L*_)),m[n+28>>2]=S,D=y(y(y(k*f)+y(E*p))+y(N*_)),m[n+24>>2]=D),(C=2&d[o+180>>2])&&(g=m[o+172>>2],B=m[o+44>>2],N=m[o+12>>2],L=m[o+28>>2],p=m[o+164>>2],f=m[o+36>>2],k=m[o+4>>2],V=m[o+20>>2],_=m[o+168>>2],U=m[o+40>>2],E=m[o+8>>2],R=m[o+24>>2],d[n+36>>2]=0,q=f,f=y(p*y(y(y(k*D)+y(V*S))+y(f*T))),p=y(_*y(y(y(D*E)+y(S*R))+y(T*U))),_=y(g*y(y(y(D*N)+y(S*L))+y(T*B))),T=y(y(y(q*f)+y(U*p))+y(B*_)),m[n+32>>2]=T,S=y(y(y(V*f)+y(R*p))+y(L*_)),m[n+28>>2]=S,D=y(y(y(k*f)+y(E*p))+y(N*_)),m[n+24>>2]=D),P&&(g=m[a+172>>2],B=m[a+44>>2],N=m[a+12>>2],L=m[a+28>>2],p=m[a+164>>2],f=m[a+36>>2],k=m[a+4>>2],V=m[a+20>>2],_=m[a+168>>2],U=m[a+40>>2],E=m[a+8>>2],R=m[a+24>>2],d[n+20>>2]=0,q=f,f=y(p*y(y(y(k*w)+y(V*F))+y(h*f))),p=y(_*y(y(y(w*E)+y(F*R))+y(h*U))),_=y(g*y(y(y(w*N)+y(F*L))+y(h*B))),h=y(y(y(q*f)+y(U*p))+y(B*_)),m[n+16>>2]=h,F=y(y(y(V*f)+y(R*p))+y(L*_)),m[n+12>>2]=F,w=y(y(y(k*f)+y(E*p))+y(N*_)),m[n+8>>2]=w),C&&(g=m[o+172>>2],B=m[o+44>>2],N=m[o+12>>2],L=m[o+28>>2],p=m[o+164>>2],f=m[o+36>>2],k=m[o+4>>2],V=m[o+20>>2],_=m[o+168>>2],U=m[o+40>>2],E=m[o+8>>2],R=m[o+24>>2],d[n+20>>2]=0,q=f,f=y(p*y(y(y(k*w)+y(V*F))+y(f*h))),p=y(_*y(y(y(w*E)+y(F*R))+y(h*U))),_=y(g*y(y(y(w*N)+y(F*L))+y(h*B))),h=y(y(y(q*f)+y(U*p))+y(B*_)),m[n+16>>2]=h,F=y(y(y(V*f)+y(R*p))+y(L*_)),m[n+12>>2]=F,w=y(y(y(k*f)+y(E*p))+y(N*_)),m[n+8>>2]=w),+y(x(y(y(y(D*D)+y(S*S))+y(T*T))))>.001&&_r(e,n+24|0,l,c,I,z),+y(x(y(y(y(w*w)+y(F*F))+y(h*h))))>.001&&_r(e,n+8|0,l,c,I,z),K=0;e:if(u[A+120|0]&&32&u[i+64|0])or(e,A+156|0,l,c,I,z,n+80|0,n- -64|0,h=m[n+60>>2],m[A+136>>2],m[A+144>>2]),16&u[i+64|0]&&or(e,A+172|0,l,c,I,z,n+80|0,n- -64|0,h,m[A+140>>2],m[A+148>>2]);else{if(f=m[Y>>2],E=m[A+72>>2],R=m[A+76>>2],d[A+168>>2]=0,p=y(ee-J),_=y(te-ne),h=y(ie-re),H=y(y(y(p*H)+y(_*M))+y(h*Q)),M=y(h-y(R*H)),m[A+164>>2]=M,g=y(_-y(H*E)),m[A+160>>2]=g,G=A+156|0,_=y(p-y(H*f)),m[G>>2]=_,!(64&u[i+64|0])&&(h=y(y(y(_*_)+y(g*g))+y(M*M)))>y(1.1920928955078125e-7)){if(h=y(y(1)/y(x(h))),m[G>>2]=_*h,m[A+160>>2]=g*h,m[A+164>>2]=M*h,$n(a,G),$n(o,G),or(e,G,l,c,I,z,n+80|0,n- -64|0,h=m[n+60>>2],y(0),y(0)),!(16&u[i+64|0]))break e;f=m[A+160>>2],Q=m[A+72>>2],H=m[Y>>2],p=m[A+164>>2],M=m[G>>2],_=m[A+76>>2],d[A+184>>2]=0,g=y(y(f*_)-y(p*Q)),p=y(y(p*H)-y(_*M)),_=y(y(Q*M)-y(f*H)),M=y(y(1)/y(x(y(y(y(g*g)+y(p*p))+y(_*_))))),m[A+180>>2]=_*M,m[A+176>>2]=p*M,m[(C=A+172|0)>>2]=g*M,$n(a,C),$n(o,C),or(e,C,l,c,I,z,n+80|0,n- -64|0,h,y(0),y(0));break e}if(C=P=A+172|0,y(v(R))>y(.7071067690849304)?(d[G>>2]=0,p=y(y(E*E)+y(R*R)),g=y(y(1)/y(x(p))),_=y(g*y(-R)),m[A+160>>2]=_,h=y(E*g),m[A+164>>2]=h,S=y(f*_),T=y(h*y(-f)),f=y(p*g)):(p=y(y(f*f)+y(E*E)),g=y(y(1)/y(x(p))),_=y(g*y(-E)),m[G>>2]=_,h=y(f*g),m[A+160>>2]=h,d[A+164>>2]=0,S=y(p*g),T=y(R*_),f=y(h*y(-R))),m[C>>2]=f,m[A+180>>2]=S,m[A+176>>2]=T,$n(a,G),$n(o,G),or(e,G,l,c,I,z,n+80|0,n- -64|0,h=m[n+60>>2],y(0),y(0)),16&(C=d[i+64>>2])&&($n(a,P),$n(o,P),or(e,P,l,c,I,z,n+80|0,n- -64|0,h,y(0),y(0)),C=d[i+64>>2]),80!=(80&C))break e;s[A+120|0]=1}$e(e,X,l,c,z,i),P=d[t+748>>2]}if(!((0|($=$+1|0))<(0|P)))break}O=n+96|0}function G(e,t,i,n){var o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=0,f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=0,D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=0,V=y(0),U=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0);O=o=O-704|0,d[4+(a=o+624|0)>>2]=35,d[a+8>>2]=0,d[a>>2]=13316,d[a+44>>2]=1025758986,d[a+20>>2]=1065353216,d[a+24>>2]=0,d[a+12>>2]=1065353216,d[a+16>>2]=1065353216,d[a>>2]=13444,d[o+668>>2]=0,d[o+652>>2]=0,d[o+628>>2]=8,d[o+624>>2]=11556,a=d[i+12>>2];e:if(p=d[i+4>>2],(0|(M=d[p+4>>2]))<=19)d[o+616>>2]=0,d[o+620>>2]=0,d[o+448>>2]=6896,d[o+612>>2]=d[n+4>>2],s[o+420|0]=0,d[o+396>>2]=953267991,d[12+(M=o+680|0)>>2]=p,d[M+8>>2]=o+624,d[M+4>>2]=o+88,d[M>>2]=6304,d[12+(k=o+72|0)>>2]=p,d[k+8>>2]=o+624,d[k+4>>2]=o+88,d[k>>2]=7148,p=8&d[n+16>>2]?k:M,r[d[d[p>>2]+8>>2]](p,e,t,a,a,o+448|0)&&(c=m[o+580>>2],_=m[o+584>>2],l=m[o+588>>2],(h=y(y(y(c*c)+y(_*_))+y(l*l)))>y(9999999747378752e-20)&&(g=m[o+612>>2])>2]&&(f=l,l=y(y(1)/y(x(h))),m[o+588>>2]=f*l,m[o+584>>2]=_*l,m[o+580>>2]=c*l,e=d[i+8>>2],d[o+44>>2]=0,d[o+40>>2]=e,e=d[o+592>>2],d[o+56>>2]=d[o+588>>2],d[o+60>>2]=e,e=d[o+584>>2],d[o+48>>2]=d[o+580>>2],d[o+52>>2]=e,m[o+64>>2]=g,y(r[d[d[n>>2]+12>>2]](n,o+40|0,1))));else if(M+-21>>>0<=8){switch(C=m[a+20>>2],S=m[a+36>>2],T=m[a+24>>2],E=m[a+52>>2],l=m[a+56>>2],u=m[a+40>>2],f=m[a+32>>2],v=m[a+16>>2],A=m[a>>2],R=m[a+4>>2],c=m[a+48>>2],P=m[a+8>>2],h=m[e+52>>2],g=m[e+56>>2],_=m[e+48>>2],d[o+460>>2]=0,E=y(-E),F=y(T*E),B=y(u*l),I=y(y(F-y(P*c))-B),N=y(T*h),L=y(u*g),m[o+456>>2]=I+y(y(y(P*_)+N)+L),V=y(C*E),U=y(S*l),D=y(y(V-y(R*c))-U),W=y(C*h),z=y(S*g),m[o+452>>2]=D+y(y(y(R*_)+W)+z),H=y(f*l),X=y(y(y(v*E)-y(A*c))-H),Y=y(f*g),m[o+448>>2]=X+y(y(y(A*_)+y(v*h))+Y),g=m[t+52>>2],w=m[t+56>>2],l=m[t+48>>2],d[o+52>>2]=0,j=I,Q=y(P*l),P=y(T*g),I=y(u*w),m[o+48>>2]=j+y(y(Q+P)+I),j=D,u=y(R*l),R=y(C*g),D=y(S*w),m[o+44>>2]=j+y(y(u+R)+D),f=y(f*w),m[o+40>>2]=X+y(y(y(A*l)+y(v*g))+f),d[p+4>>2]+-21|0){case 0:e=d[i+8>>2],Ls(o+88|0,o+448|0,o+40|0,d[n+16>>2]),d[o+140>>2]=p,d[o+136>>2]=e,d[o+132>>2]=n,d[o+88>>2]=7868,e=d[a+12>>2],d[o+152>>2]=d[a+8>>2],d[o+156>>2]=e,e=d[a+4>>2],d[o+144>>2]=d[a>>2],d[o+148>>2]=e,e=d[a+28>>2],d[o+168>>2]=d[a+24>>2],d[o+172>>2]=e,e=d[a+20>>2],d[o+160>>2]=d[a+16>>2],d[o+164>>2]=e,e=d[a+44>>2],d[o+184>>2]=d[a+40>>2],d[o+188>>2]=e,e=d[a+36>>2],d[o+176>>2]=d[a+32>>2],d[o+180>>2]=e,e=d[a+60>>2],d[o+200>>2]=d[a+56>>2],d[o+204>>2]=e,e=d[a+52>>2],d[o+192>>2]=d[a+48>>2],d[o+196>>2]=e,d[o+128>>2]=d[n+4>>2],function(e,t,i,n){var r,s;O=r=O-16|0,s=d[e+48>>2],d[r+8>>2]=t,d[r+4>>2]=s,d[r>>2]=11848,Ks(d[e+52>>2],r,i,n),O=r+16|0}(p,o+88|0,o+448|0,o+40|0);break e;case 4:e=d[i+8>>2],Ls(o+88|0,o+448|0,o+40|0,d[n+16>>2]),d[o+140>>2]=p,d[o+136>>2]=e,d[o+132>>2]=n,d[o+88>>2]=7868,e=d[a+12>>2],d[o+152>>2]=d[a+8>>2],d[o+156>>2]=e,e=d[a+4>>2],d[o+144>>2]=d[a>>2],d[o+148>>2]=e,e=d[a+28>>2],d[o+168>>2]=d[a+24>>2],d[o+172>>2]=e,e=d[a+20>>2],d[o+160>>2]=d[a+16>>2],d[o+164>>2]=e,e=d[a+44>>2],d[o+184>>2]=d[a+40>>2],d[o+188>>2]=e,e=d[a+36>>2],d[o+176>>2]=d[a+32>>2],d[o+180>>2]=e,e=d[a+60>>2],d[o+200>>2]=d[a+56>>2],d[o+204>>2]=e,e=d[a+52>>2],d[o+192>>2]=d[a+48>>2],d[o+196>>2]=e,d[o+128>>2]=d[n+4>>2],r[d[d[p>>2]+144>>2]](p,o+88|0,o+448|0,o+40|0);break e}C=m[a+16>>2],S=m[a>>2],T=m[a+4>>2],u=m[a+8>>2],d[o+692>>2]=0,v=y(y(F-y(u*c))-B),m[o+688>>2]=y(y(y(_*u)+N)+L)+v,A=y(y(V-y(T*c))-U),m[o+684>>2]=y(y(y(_*T)+W)+z)+A,c=y(y(y(C*E)-y(S*c))-H),m[o+680>>2]=y(y(y(_*S)+y(h*C))+Y)+c,d[o+84>>2]=0,m[o+80>>2]=y(y(y(l*u)+P)+I)+v,m[o+76>>2]=y(y(y(l*T)+R)+D)+A,m[o+72>>2]=y(y(y(l*S)+y(g*C))+f)+c,e=d[i+8>>2],Ls(o+88|0,o+680|0,o+72|0,d[n+16>>2]),d[o+140>>2]=p,d[o+136>>2]=e,d[o+132>>2]=n,d[o+88>>2]=8052,e=d[a+12>>2],d[o+152>>2]=d[a+8>>2],d[o+156>>2]=e,e=d[a+4>>2],d[o+144>>2]=d[a>>2],d[o+148>>2]=e,e=d[a+28>>2],d[o+168>>2]=d[a+24>>2],d[o+172>>2]=e,e=d[a+20>>2],d[o+160>>2]=d[a+16>>2],d[o+164>>2]=e,e=d[a+44>>2],d[o+184>>2]=d[a+40>>2],d[o+188>>2]=e,e=d[a+36>>2],d[o+176>>2]=d[a+32>>2],d[o+180>>2]=e,e=d[a+60>>2],d[o+200>>2]=d[a+56>>2],d[o+204>>2]=e,e=d[a+52>>2],d[o+192>>2]=d[a+48>>2],d[o+196>>2]=e,d[o+128>>2]=d[n+4>>2],e=d[o+692>>2],d[o+32>>2]=d[o+688>>2],d[o+36>>2]=e,e=d[o+684>>2],d[o+24>>2]=d[o+680>>2],d[o+28>>2]=e,(c=m[o+72>>2])>2]&&(m[o+24>>2]=c),(_=m[o+76>>2])>2]&&(m[o+28>>2]=_),(l=m[o+80>>2])>2]&&(m[o+32>>2]=l),(h=m[o+84>>2])>2]&&(m[o+36>>2]=h),e=d[o+692>>2],d[o+16>>2]=d[o+688>>2],d[o+20>>2]=e,e=d[o+684>>2],d[o+8>>2]=d[o+680>>2],d[o+12>>2]=e,m[o+8>>2]>2]=c),m[o+12>>2]<_&&(m[o+12>>2]=_),m[o+16>>2]>2]=l),m[o+20>>2]>2]=h),r[d[d[p>>2]+64>>2]](p,o+88|0,o+24|0,o+8|0)}else if(31==(0|M))if(M=d[p- -64>>2],i=d[i+8>>2],d[o+64>>2]=n,d[o+60>>2]=t,d[o+56>>2]=e,d[o+52>>2]=a,d[o+48>>2]=p,d[o+44>>2]=i,d[o+40>>2]=8240,M)c=m[a+20>>2],_=m[a+36>>2],l=m[a+24>>2],h=m[a+52>>2],v=m[e+52>>2],g=m[a+40>>2],C=m[a+56>>2],A=m[e+56>>2],R=m[a>>2],S=m[a+16>>2],T=m[a+32>>2],P=m[a+4>>2],f=m[a+8>>2],u=m[a+48>>2],E=m[e+48>>2],d[o+100>>2]=0,I=f,f=y(E-u),v=y(v-h),A=y(A-C),m[o+96>>2]=y(y(I*f)+y(l*v))+y(g*A),m[o+92>>2]=y(y(f*P)+y(v*c))+y(A*_),m[o+88>>2]=y(y(f*R)+y(v*S))+y(A*T),f=m[t+52>>2],v=m[t+56>>2],A=m[a>>2],R=m[a+4>>2],P=m[a+8>>2],E=m[t+48>>2],d[o+460>>2]=0,u=y(E-u),I=l,l=y(f-h),h=y(v-C),m[o+456>>2]=y(y(P*u)+y(I*l))+y(g*h),m[o+452>>2]=y(y(u*R)+y(l*c))+y(h*_),m[o+448>>2]=y(y(u*A)+y(l*S))+y(h*T),At(d[M>>2],o+88|0,o+448|0,o+40|0);else if(!((0|(t=d[p+16>>2]))<1))for(i=0;;){if(e=d[p+24>>2]+b(i,80)|0,n=d[e+64>>2],f=m[e+56>>2],v=m[e+48>>2],A=m[e+52>>2],R=m[e+32>>2],P=m[e>>2],E=m[e+16>>2],w=m[e+36>>2],F=m[e+4>>2],B=m[e+20>>2],I=m[e+40>>2],N=m[e+8>>2],L=m[e+24>>2],V=m[a+52>>2],U=m[a+56>>2],c=m[a+24>>2],_=m[a+20>>2],l=m[a+40>>2],h=m[a+36>>2],D=m[a+48>>2],g=m[a+8>>2],C=m[a>>2],S=m[a+4>>2],T=m[a+16>>2],u=m[a+32>>2],d[o+148>>2]=0,d[o+132>>2]=0,d[o+116>>2]=0,d[o+100>>2]=0,m[o+128>>2]=y(y(N*u)+y(L*h))+y(I*l),m[o+124>>2]=y(y(F*u)+y(B*h))+y(w*l),m[o+120>>2]=y(y(P*u)+y(E*h))+y(R*l),m[o+112>>2]=y(y(N*T)+y(L*_))+y(I*c),m[o+108>>2]=y(y(F*T)+y(B*_))+y(w*c),m[o+104>>2]=y(y(P*T)+y(E*_))+y(R*c),m[o+96>>2]=y(y(C*N)+y(S*L))+y(g*I),m[o+92>>2]=y(y(C*F)+y(S*B))+y(g*w),m[o+88>>2]=y(y(P*C)+y(E*S))+y(R*g),m[o+144>>2]=U+y(y(y(u*v)+y(h*A))+y(l*f)),m[o+140>>2]=V+y(y(y(T*v)+y(_*A))+y(c*f)),m[o+136>>2]=D+y(y(y(C*v)+y(S*A))+y(g*f)),d[o+700>>2]=i,d[o+696>>2]=-1,d[o+688>>2]=d[o+44>>2],d[o+684>>2]=n,d[o+680>>2]=0,d[o+692>>2]=o+88,d[o+460>>2]=-65535,d[o+464>>2]=0,d[o+452>>2]=1065353216,d[o+456>>2]=0,d[o+472>>2]=i,d[o+448>>2]=8444,e=d[o+64>>2],d[o+468>>2]=e,d[o+452>>2]=d[e+4>>2],d[o+464>>2]=d[e+16>>2],G(d[o+56>>2],d[o+60>>2],o+680|0,o+448|0),(0|t)==(0|(i=i+1|0)))break e;a=d[o+52>>2],p=d[o+48>>2]}O=o+704|0}function j(e,t,i,n,o,a){var l,c,h,_=y(0),u=0,p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=0,U=y(0),G=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=0;O=l=O-640|0,c=d[n+12>>2],h=d[n+4>>2];e:if((0|(u=d[h+4>>2]))<=19)m[l+636>>2]=a,d[l+632>>2]=0,d[l+464>>2]=6896,d[l+628>>2]=d[o+4>>2],s[l+436|0]=0,d[l+412>>2]=953267991,d[l+16>>2]=4440,d[20+(u=l+80|0)>>2]=0,d[u+16>>2]=h,d[u+12>>2]=e,d[u+8>>2]=l+16,d[u+4>>2]=l+104,d[u>>2]=7260,r[d[d[u>>2]+8>>2]](u,t,i,c,c,l+464|0)&&(a=m[l+596>>2],p=m[l+600>>2],_=m[l+604>>2],(f=y(y(y(a*a)+y(p*p))+y(_*_)))>y(9999999747378752e-20)&&(g=m[l+628>>2])>2]&&(v=_,_=y(y(1)/y(x(f))),m[l+604>>2]=v*_,m[l+600>>2]=p*_,m[l+596>>2]=a*_,e=d[n+8>>2],d[l+36>>2]=0,d[l+32>>2]=e,e=d[l+608>>2],d[l+48>>2]=d[l+604>>2],d[l+52>>2]=e,e=d[l+596>>2],t=d[l+600>>2],n=d[l+624>>2],d[(i=l- -64|0)>>2]=d[l+620>>2],d[i+4>>2]=n,d[l+40>>2]=e,d[l+44>>2]=t,e=d[l+616>>2],d[l+56>>2]=d[l+612>>2],d[l+60>>2]=e,m[l+72>>2]=g,y(r[d[d[o>>2]+12>>2]](o,l+32|0,1))));else if((V=u+-21|0)>>>0<=8){switch(0|V){case 0:p=m[c+20>>2],_=m[c+36>>2],f=m[c+24>>2],R=m[c+52>>2],A=m[c+56>>2],g=m[c+40>>2],v=m[c+32>>2],P=m[c+16>>2],E=m[c>>2],C=m[c+4>>2],S=m[c+48>>2],I=m[c+8>>2],T=m[t+52>>2],D=m[t+56>>2],w=m[t+48>>2],d[l+44>>2]=0,R=y(-R),F=y(y(y(f*R)-y(I*S))-y(g*A)),m[l+40>>2]=F+y(y(y(I*w)+y(f*T))+y(g*D)),M=y(y(y(p*R)-y(C*S))-y(_*A)),m[l+36>>2]=M+y(y(y(C*w)+y(p*T))+y(_*D)),R=y(y(y(P*R)-y(E*S))-y(v*A)),m[l+32>>2]=R+y(y(y(E*w)+y(P*T))+y(v*D)),A=m[i+52>>2],S=m[i+56>>2],T=m[i+48>>2],d[l+92>>2]=0,m[l+88>>2]=F+y(y(y(I*T)+y(f*A))+y(g*S)),m[l+84>>2]=M+y(y(y(C*T)+y(p*A))+y(_*S)),m[l+80>>2]=R+y(y(y(E*T)+y(P*A))+y(v*S)),A=m[i+20>>2],S=m[i+36>>2],T=m[i+24>>2],D=m[i+40>>2],w=m[i+32>>2],R=m[i>>2],F=m[i+16>>2],M=m[i+4>>2],B=m[i+8>>2],d[l+508>>2]=0,d[l+512>>2]=0,d[l+492>>2]=0,d[l+516>>2]=0,d[l+520>>2]=0,d[l+524>>2]=0,m[l+504>>2]=y(y(I*B)+y(f*T))+y(g*D),m[l+500>>2]=y(y(I*M)+y(f*A))+y(g*S),m[l+488>>2]=y(y(C*B)+y(p*T))+y(_*D),m[l+484>>2]=y(y(C*M)+y(p*A))+y(_*S),d[l+476>>2]=0,m[l+496>>2]=y(y(I*R)+y(f*F))+y(g*w),m[l+480>>2]=y(y(C*R)+y(p*F))+y(_*w),m[l+472>>2]=y(y(E*B)+y(P*T))+y(v*D),m[l+468>>2]=y(y(E*M)+y(P*A))+y(v*S),m[l+464>>2]=y(y(E*R)+y(P*F))+y(v*w),n=d[n+8>>2],hi(l+104|0,e,t,i,c,y(r[d[d[h>>2]+48>>2]](h))),d[l+324>>2]=h,d[l+320>>2]=n,d[l+104>>2]=8616,d[l+316>>2]=o,t=d[o+4>>2],m[l+312>>2]=a,d[l+304>>2]=t,r[d[d[e>>2]+8>>2]](e,l+464|0,l+16|0,l),function(e,t,i,n,r,s){var o,a;O=o=O-16|0,a=d[e+48>>2],d[o+8>>2]=t,d[o+4>>2]=a,d[o>>2]=12016,Oh(d[e+52>>2],o,i,n,r,s),O=o+16|0}(h,l+104|0,l+32|0,l+80|0,l+16|0,l);break e;case 7:m[l+276>>2]=a,d[l+272>>2]=0,d[l+104>>2]=6896,d[l+268>>2]=d[o+4>>2],d[20+(u=l+32|0)>>2]=h,d[u+16>>2]=0,d[u+12>>2]=e,d[u+4>>2]=0,d[u+8>>2]=0,d[u>>2]=7260,r[d[d[u>>2]+8>>2]](u,t,i,c,c,l+104|0)&&(a=m[l+236>>2],p=m[l+240>>2],_=m[l+244>>2],(f=y(y(y(a*a)+y(p*p))+y(_*_)))>y(9999999747378752e-20)&&(g=m[l+268>>2])>2]&&(v=_,_=y(y(1)/y(x(f))),m[l+244>>2]=v*_,m[l+240>>2]=p*_,m[l+236>>2]=a*_,e=d[n+8>>2],d[l+468>>2]=0,d[l+464>>2]=e,e=d[l+248>>2],d[l+480>>2]=d[l+244>>2],d[l+484>>2]=e,e=d[l+236>>2],t=d[l+240>>2],i=d[l+264>>2],d[l+496>>2]=d[l+260>>2],d[l+500>>2]=i,d[l+472>>2]=e,d[l+476>>2]=t,e=d[l+256>>2],d[l+488>>2]=d[l+252>>2],d[l+492>>2]=e,m[l+504>>2]=g,y(r[d[d[o>>2]+12>>2]](o,l+464|0,1))));break e}D=m[i+52>>2],w=m[i+56>>2],X=m[c+52>>2],_=m[c+56>>2],P=m[t+52>>2],R=m[t+56>>2],g=m[c+20>>2],v=m[c+36>>2],C=m[c+24>>2],I=m[c+40>>2],F=m[i+48>>2],M=m[c+48>>2],B=m[t+48>>2],f=m[c+32>>2],E=m[c>>2],A=m[c+16>>2],S=m[c+4>>2],T=m[c+8>>2],p=m[i+20>>2],N=m[i+36>>2],L=m[i+24>>2],k=m[i+40>>2],U=m[i+32>>2],G=m[i>>2],W=m[i+16>>2],z=m[i+4>>2],H=m[i+8>>2],d[l+508>>2]=0,d[l+512>>2]=0,d[l+492>>2]=0,d[l+516>>2]=0,d[l+520>>2]=0,d[l+524>>2]=0,m[l+504>>2]=y(y(T*H)+y(C*L))+y(I*k),m[l+500>>2]=y(y(T*z)+y(C*p))+y(I*N),m[l+488>>2]=y(y(S*H)+y(g*L))+y(v*k),m[l+484>>2]=y(y(S*z)+y(g*p))+y(v*N),d[l+476>>2]=0,m[l+496>>2]=y(y(T*G)+y(C*W))+y(I*U),m[l+480>>2]=y(y(S*G)+y(g*W))+y(v*U),m[l+472>>2]=y(y(E*H)+y(A*L))+y(f*k),m[l+468>>2]=y(y(E*z)+y(A*p))+y(f*N),m[l+464>>2]=y(y(E*G)+y(A*W))+y(f*U),n=d[n+8>>2],hi(l+104|0,e,t,i,c,y(r[d[d[h>>2]+48>>2]](h))),d[l+324>>2]=h,d[l+320>>2]=n,d[l+104>>2]=8828,d[l+316>>2]=o,t=d[o+4>>2],m[l+312>>2]=a,d[l+304>>2]=t,r[d[d[e>>2]+8>>2]](e,l+464|0,l+32|0,l+80|0),d[l+28>>2]=0,N=y(-X),L=y(y(y(C*N)-y(T*M))-y(I*_)),a=y(L+y(y(y(T*B)+y(C*P))+y(I*R))),m[l+24>>2]=a,k=y(y(y(g*N)-y(S*M))-y(v*_)),p=y(k+y(y(y(S*B)+y(g*P))+y(v*R))),m[l+20>>2]=p,M=y(y(y(A*N)-y(E*M))-y(f*_)),_=y(M+y(y(y(E*B)+y(A*P))+y(f*R))),m[l+16>>2]=_,P=_,(f=y(M+y(y(y(E*F)+y(A*D))+y(f*w))))<_&&(m[l+16>>2]=f,P=f),E=p,(g=y(k+y(y(y(S*F)+y(g*D))+y(v*w))))>2]=g,E=g),(v=y(L+y(y(y(T*F)+y(C*D))+y(I*w))))<(C=a)&&(m[l+24>>2]=v,C=v),d[l+12>>2]=0,m[l+8>>2]=a,m[l+4>>2]=p,m[l>>2]=_,_>2]=f,_=f),p>2]=g,p=g),a>2]=v,a=v),m[l+16>>2]=m[l+32>>2]+P,m[l+20>>2]=m[l+36>>2]+E,m[l+24>>2]=m[l+40>>2]+C,m[l>>2]=m[l+80>>2]+_,m[l+4>>2]=m[l+84>>2]+p,m[l+8>>2]=m[l+88>>2]+a,r[d[d[h>>2]+64>>2]](h,l+104|0,l+16|0,l)}else if(31==(0|u)){if(yr(7797),d[h+16>>2]>=1)for(V=0;u=d[h+24>>2]+b(V,80)|0,Y=d[u+64>>2],A=m[u+56>>2],S=m[u+48>>2],T=m[u+52>>2],D=m[u+32>>2],w=m[u>>2],R=m[u+16>>2],F=m[u+36>>2],M=m[u+4>>2],B=m[u+20>>2],N=m[u+40>>2],L=m[u+8>>2],k=m[u+24>>2],U=m[c+48>>2],G=m[c+52>>2],W=m[c+56>>2],p=m[c+8>>2],_=m[c>>2],f=m[c+4>>2],g=m[c+24>>2],v=m[c+16>>2],P=m[c+20>>2],E=m[c+40>>2],C=m[c+32>>2],I=m[c+36>>2],d[l+164>>2]=0,d[l+148>>2]=0,d[l+132>>2]=0,d[l+116>>2]=0,m[l+144>>2]=y(y(L*C)+y(k*I))+y(N*E),m[l+140>>2]=y(y(M*C)+y(B*I))+y(F*E),m[l+136>>2]=y(y(w*C)+y(R*I))+y(D*E),m[l+128>>2]=y(y(L*v)+y(k*P))+y(N*g),m[l+124>>2]=y(y(M*v)+y(B*P))+y(F*g),m[l+120>>2]=y(y(w*v)+y(R*P))+y(D*g),m[l+112>>2]=y(y(L*_)+y(k*f))+y(N*p),m[l+108>>2]=y(y(M*_)+y(B*f))+y(F*p),m[l+104>>2]=y(y(w*_)+y(R*f))+y(D*p),m[l+160>>2]=W+y(y(y(S*C)+y(T*I))+y(A*E)),m[l+156>>2]=G+y(y(y(S*v)+y(T*P))+y(A*g)),m[l+152>>2]=U+y(y(y(S*_)+y(T*f))+y(A*p)),d[l+40>>2]=-65535,d[l+48>>2]=V,d[l+32>>2]=9044,d[l+44>>2]=o,d[l+36>>2]=d[o+4>>2],u=d[n+8>>2],d[l+484>>2]=V,d[l+480>>2]=-1,d[l+472>>2]=u,d[l+468>>2]=Y,d[l+464>>2]=n,d[l+476>>2]=l+104,j(e,t,i,l+464|0,l+32|0,a),(0|(V=V+1|0))>2];);As()}O=l+640|0}function W(e,t,i,n,s,o){var a,l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),A=0,C=0,S=y(0),T=0,E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=0,N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=0,te=y(0),ie=y(0),ne=y(0),re=y(0),se=y(0),oe=y(0),ae=y(0);O=a=O-112|0,d[6993]=d[6993]+1,S=m[i+52>>2],te=m[i+20>>2],ie=m[i+24>>2],f=m[n+52>>2],l=m[n+20>>2],h=m[n+24>>2],c=m[i+56>>2],W=m[i+36>>2],k=m[e+68>>2],V=m[i+40>>2],D=m[e+72>>2],_=m[n+56>>2],p=m[n+36>>2],w=m[t+68>>2],Q=m[n+40>>2],g=m[t+72>>2],q=m[i+48>>2],F=m[i+8>>2],K=m[i>>2],Z=m[i+4>>2],$=m[n+48>>2],J=m[n+8>>2],z=m[n>>2],H=m[n+4>>2],E=m[i+16>>2],X=m[n+16>>2],R=m[i+32>>2],I=m[e+64>>2],Y=m[n+32>>2],M=m[t+64>>2],d[a+28>>2]=0,U=y(y(c+y(y(y(I*R)+y(k*W))+y(D*V)))-y(_+y(y(y(M*Y)+y(w*p))+y(g*Q)))),m[a+24>>2]=U,G=y(y(S+y(y(y(I*E)+y(k*te))+y(D*ie)))-y(f+y(y(y(M*X)+y(w*l))+y(g*h)))),m[a+20>>2]=G,j=y(y(q+y(y(y(I*K)+y(k*Z))+y(D*F)))-y($+y(y(y(M*z)+y(w*H))+y(g*J)))),m[a+16>>2]=j,_=y(34028234663852886e22);e:{t:{i:{n:{r:{s:if(!((0|(B=d[e+28>>2]))<1))for(;;){if(A=d[e+36>>2]+b(C,36)|0,g=m[A+28>>2],I=m[A+24>>2],M=m[A+20>>2],h=m[i>>2],c=m[i+4>>2],d[a+12>>2]=0,S=y(y(y(M*R)+y(I*W))+y(g*V)),m[a+8>>2]=S,f=y(y(y(M*E)+y(I*te))+y(g*ie)),m[a+4>>2]=f,c=y(y(y(M*h)+y(I*c))+y(g*F)),m[a>>2]=c,y(y(y(c*j)+y(f*G))+y(S*U))>2]=-S,m[a+4>>2]=-f,m[a>>2]=-c),d[6991]=d[6991]+1,!u[26409]||_n(i,n,a+16|0,a,e,t,_)){if(T=0,d[6992]=d[6992]+1,Vi(e,i,a,a+108|0,a+104|0,a+80|0,a- -64|0),Vi(t,n,a,a+100|0,a+96|0,a+48|0,a+32|0),(S=m[a+104>>2])<(c=m[a+100>>2])||(f=m[a+96>>2])<(h=m[a+108>>2])||(l=(c=y(S-c))<(l=y(f-h))?c:l,T=1),!T)break r;l<_&&(A=d[a+4>>2],d[s>>2]=d[a>>2],d[s+4>>2]=A,A=d[a+12>>2],d[s+8>>2]=d[a+8>>2],d[s+12>>2]=A,_=l)}if((0|B)==(0|(C=C+1|0)))break s;V=m[i+40>>2],W=m[i+36>>2],R=m[i+32>>2],ie=m[i+24>>2],te=m[i+20>>2],E=m[i+16>>2],F=m[i+8>>2]}if((0|(B=d[t+28>>2]))>=1)for(C=0;;){if(A=d[t+36>>2]+b(C,36)|0,D=m[A+28>>2],w=m[A+20>>2],F=m[A+24>>2],E=m[n+8>>2],R=m[n>>2],g=m[n+4>>2],I=m[n+24>>2],M=m[n+16>>2],S=m[n+20>>2],f=m[n+40>>2],h=m[n+32>>2],c=m[n+36>>2],d[a+12>>2]=0,f=y(y(y(w*h)+y(F*c))+y(D*f)),m[a+8>>2]=f,h=y(y(y(w*M)+y(F*S))+y(D*I)),m[a+4>>2]=h,c=y(y(y(w*R)+y(F*g))+y(D*E)),m[a>>2]=c,y(y(y(c*j)+y(h*G))+y(f*U))>2]=-f,m[a+4>>2]=-h,m[a>>2]=-c),d[6991]=d[6991]+1,!u[26409]||_n(i,n,a+16|0,a,e,t,_)){if(T=0,d[6992]=d[6992]+1,Vi(e,i,a,a+108|0,a+104|0,a+80|0,a- -64|0),Vi(t,n,a,a+100|0,a+96|0,a+48|0,a+32|0),(S=m[a+104>>2])<(c=m[a+100>>2])||(f=m[a+96>>2])<(h=m[a+108>>2])||(l=(c=y(S-c))<(l=y(f-h))?c:l,T=1),!T)break r;l<_&&(A=d[a+4>>2],d[s>>2]=d[a>>2],d[s+4>>2]=A,A=d[a+12>>2],d[s+8>>2]=d[a+8>>2],d[s+12>>2]=A,_=l)}if((0|B)==(0|(C=C+1|0)))break}if((0|(C=d[e+48>>2]))>=1)break n;B=-1,A=-1;break i}n=0;break e}for(T=d[t+48>>2],A=-1,B=-1;;){if((0|T)>=1){for(C=d[e+56>>2]+(ee<<4)|0,h=m[C>>2],c=m[C+4>>2],l=m[C+8>>2],I=y(y(y(h*m[i+32>>2])+y(c*m[i+36>>2]))+y(l*m[i+40>>2])),M=y(y(y(h*m[i+16>>2])+y(c*m[i+20>>2]))+y(l*m[i+24>>2])),S=y(y(y(h*m[i>>2])+y(c*m[i+4>>2]))+y(l*m[i+8>>2])),C=0;;){if(T=d[t+56>>2]+(C<<4)|0,k=m[T+8>>2],V=m[T>>2],D=m[T+4>>2],w=m[n+40>>2],F=m[n+32>>2],E=m[n+36>>2],R=m[n+24>>2],g=m[n+16>>2],f=m[n+20>>2],h=m[n+8>>2],c=m[n>>2],l=m[n+4>>2],d[a+12>>2]=0,f=y(y(y(V*g)+y(D*f))+y(k*R)),h=y(y(y(V*c)+y(D*l))+y(k*h)),l=y(y(S*f)-y(M*h)),m[a+8>>2]=l,c=y(y(y(V*F)+y(D*E))+y(k*w)),g=y(y(I*h)-y(S*c)),m[a+4>>2]=g,E=y(y(M*c)-y(I*f)),m[a>>2]=E,(!(+y(v(l))>1e-6^1)||+y(v(E))>1e-6|+y(v(g))>1e-6)&&(W=l,l=y(y(1)/y(x(y(y(l*l)+y(y(E*E)+y(g*g)))))),R=y(W*l),m[a+8>>2]=R,g=y(g*l),m[a+4>>2]=g,l=y(E*l),m[a>>2]=l,y(y(y(l*j)+y(g*G))+y(U*R))>2]=-R,m[a+4>>2]=-g,m[a>>2]=-l),d[6991]=d[6991]+1,!u[26409]||_n(i,n,a+16|0,a,e,t,_))){if(T=0,d[6992]=d[6992]+1,Vi(e,i,a,a+108|0,a+104|0,a+80|0,a- -64|0),Vi(t,n,a,a+100|0,a+96|0,a+48|0,a+32|0),(E=m[a+104>>2])<(R=m[a+100>>2])||(g=m[a+96>>2])<(l=m[a+108>>2])||((p=y(E-R))<(l=y(g-l))?(T=1,Z=m[a+56>>2],$=m[a+52>>2],J=m[a+48>>2],Q=m[a+72>>2],q=m[a+68>>2],K=m[a+64>>2]):(T=1,Z=m[a+40>>2],$=m[a+36>>2],J=m[a+32>>2],Q=m[a+88>>2],q=m[a+84>>2],K=m[a+80>>2],p=l)),!T)break t;p<_&&(A=d[a+4>>2],d[s>>2]=d[a>>2],d[s+4>>2]=A,A=d[a+12>>2],d[s+8>>2]=d[a+8>>2],d[s+12>>2]=A,se=J,oe=$,ae=Z,P=K,N=q,L=Q,z=h,H=f,X=c,Y=S,ne=M,re=I,B=ee,A=C,_=p)}if(!((0|(C=C+1|0))<(0|(T=d[t+48>>2]))))break}C=d[e+48>>2]}if(!((0|(ee=ee+1|0))<(0|C)))break}}if(!((A|B)<0)){c=y(se-P),P=y(oe-N),L=y(ae-L),p=y(y(y(c*z)+y(P*H))+y(L*X)),N=y(y(y(c*Y)+y(P*ne))+y(L*re)),_=y(0),h=y(y(y(z*Y)+y(H*ne))+y(X*re)),(l=y(y(1)-y(h*h)))!=y(0)&&(_=y(-1.0000000150474662e30),(l=y(y(N-y(p*h))/l))y(1.0000000150474662e30)&&(_=y(1.0000000150474662e30))));i:if((p=y(y(h*_)-p))y(1.0000000150474662e30))){p=y(-1.0000000150474662e30),_=l;break i}p=y(-1.0000000150474662e30)}else p>y(1.0000000150474662e30)&&(_=y(-1.0000000150474662e30),p=y(1.0000000150474662e30),(l=y(N+y(h*y(1.0000000150474662e30))))y(1.0000000150474662e30)&&(_=y(1.0000000150474662e30))));d[a+92>>2]=0,N=y(X*p),f=y(N+y(L-y(re*_))),m[a+88>>2]=f,L=y(H*p),P=y(L+y(P-y(ne*_))),m[a+84>>2]=P,l=y(z*p),h=y(l+y(c-y(Y*_))),m[a+80>>2]=h,(_=y(y(f*f)+y(y(h*h)+y(P*P))))>y(1.1920928955078125e-7)&&(_=y(x(_)),p=y(y(1)/_),c=y(f*p),m[a+88>>2]=c,P=y(P*p),m[a+84>>2]=P,p=y(h*p),m[a+80>>2]=p,y(y(y(p*j)+y(P*G))+y(c*U))>2]=-c,m[a+84>>2]=-P,m[a+80>>2]=-p),d[a+76>>2]=0,m[a+72>>2]=ae+N,m[a+68>>2]=oe+L,m[a+64>>2]=se+l,r[d[d[o>>2]+16>>2]](o,a+80|0,a- -64|0,y(-_)))}if(n=1,p=m[s>>2],l=m[s+4>>2],_=m[s+8>>2],!(y(y(y(j*p)+y(G*l))+y(U*_))>2]=0,m[s+8>>2]=-_,m[s+4>>2]=-l,m[s>>2]=-p;break e}n=0}return O=a+112|0,n}function z(e,t,i,n){t|=0,i|=0,n|=0;var o,a=0,l=0,c=0,h=0,f=0,m=0,g=0;d[168+(e|=0)>>2]=d[e+152>>2],s[t+80|0]=1,s[t+60|0]=0,d[t+52>>2]=282,d[t>>2]=17612,d[t+76>>2]=0,s[t+100|0]=1,d[t+68>>2]=0,d[t+72>>2]=0,d[t+96>>2]=0,s[t+120|0]=1,d[t+88>>2]=0,d[t+92>>2]=0,d[t+116>>2]=0,s[t+140|0]=1,d[t+108>>2]=0,d[t+112>>2]=0,d[t+136>>2]=0,s[t+164|0]=1,d[t+144>>2]=0,d[t+128>>2]=0,d[t+132>>2]=0,d[t+160>>2]=0,d[t+152>>2]=0,d[t+156>>2]=0,d[t+168>>2]=0,d[t+28>>2]=2139095039,d[t+32>>2]=0,d[t+20>>2]=2139095039,d[t+24>>2]=2139095039,d[t+12>>2]=-8388609,d[t+16>>2]=0,d[t+4>>2]=-8388609,d[t+8>>2]=-8388609,c=d[e+56>>2],i=t,n?(d[t+56>>2]=c<<8&16711680|c<<24|c>>>8&65280|c>>>24,s[t+4|0]=u[e+7|0],s[t+5|0]=u[e+6|0],s[t+6|0]=u[e+5|0],s[t+7|0]=u[e+4|0],s[t+8|0]=u[e+11|0],s[t+9|0]=u[e+10|0],s[t+10|0]=u[e+9|0],s[t+11|0]=u[e+8|0],s[t+12|0]=u[e+15|0],s[t+13|0]=u[e+14|0],s[t+14|0]=u[e+13|0],s[t+15|0]=u[e+12|0],s[t+16|0]=u[e+19|0],s[t+17|0]=u[e+18|0],s[t+18|0]=u[e+17|0],s[t+19|0]=u[e+16|0],s[t+20|0]=u[e+23|0],s[t+21|0]=u[e+22|0],s[t+22|0]=u[e+21|0],s[t+23|0]=u[e+20|0],s[t+24|0]=u[e+27|0],s[t+25|0]=u[e+26|0],s[t+26|0]=u[e+25|0],s[t+27|0]=u[e+24|0],s[t+28|0]=u[e+31|0],s[t+29|0]=u[e+30|0],s[t+30|0]=u[e+29|0],s[t+31|0]=u[e+28|0],s[t+32|0]=u[e+35|0],s[t+33|0]=u[e+34|0],s[t+34|0]=u[e+33|0],s[t+35|0]=u[e+32|0],s[t+36|0]=u[e+39|0],s[t+37|0]=u[e+38|0],s[t+38|0]=u[e+37|0],s[t+39|0]=u[e+36|0],s[t+40|0]=u[e+43|0],s[t+41|0]=u[e+42|0],s[t+42|0]=u[e+41|0],s[t+43|0]=u[e+40|0],s[t+44|0]=u[e+47|0],s[t+45|0]=u[e+46|0],s[t+46|0]=u[e+45|0],s[t+47|0]=u[e+44|0],s[t+48|0]=u[e+51|0],s[t+49|0]=u[e+50|0],s[t+50|0]=u[e+49|0],s[t+51|0]=u[e+48|0],c=d[e+144>>2],d[t+144>>2]=c<<24|c<<8&16711680|c>>>8&65280|c>>>24,c=(c=d[e+168>>2])<<24|c<<8&16711680|c>>>8&65280|c>>>24):(d[t+56>>2]=c,c=d[e+16>>2],d[t+12>>2]=d[e+12>>2],d[t+16>>2]=c,c=d[e+8>>2],d[t+4>>2]=d[e+4>>2],d[t+8>>2]=c,c=d[e+32>>2],d[t+28>>2]=d[e+28>>2],d[t+32>>2]=c,c=d[e+24>>2],d[t+20>>2]=d[e+20>>2],d[t+24>>2]=c,c=d[e+48>>2],d[t+44>>2]=d[e+44>>2],d[t+48>>2]=c,c=d[e+40>>2],d[t+36>>2]=d[e+36>>2],d[t+40>>2]=c,d[t+144>>2]=d[e+144>>2],c=d[e+168>>2]),d[i+168>>2]=c,s[t+60|0]=u[e+60|0],c=t+172|0,o=d[e+56>>2];e:if(u[e+60|0]){(i=d[t+136>>2])&&(u[t+140|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[t+136>>2]=0),d[t+136>>2]=c,s[t+140|0]=0,d[t+132>>2]=o,d[t+128>>2]=o;t:if(n){if(!((0|o)<1))for(h=d[e+136>>2];a=(i=f<<4)+c|0,i=p[(l=i+h|0)>>1],_[a>>1]=(i<<24|i<<8&16711680)>>>16,i=p[l+2>>1],_[a+2>>1]=(i<<24|i<<8&16711680)>>>16,i=p[l+4>>1],_[a+4>>1]=(i<<24|i<<8&16711680)>>>16,i=p[l+6>>1],_[a+6>>1]=(i<<24|i<<8&16711680)>>>16,i=p[l+8>>1],_[a+8>>1]=(i<<24|i<<8&16711680)>>>16,i=p[l+10>>1],_[a+10>>1]=(i<<24|i<<8&16711680)>>>16,i=d[l+12>>2],d[a+12>>2]=i<<24|i<<8&16711680|i>>>8&65280|i>>>24,(0|o)!=(0|(f=f+1|0)););}else{if((0|o)<1)break t;for(h=d[e+136>>2];l=(i=f<<4)+c|0,i=i+h|0,_[l>>1]=p[i>>1],_[l+2>>1]=p[i+2>>1],_[l+4>>1]=p[i+4>>1],_[l+6>>1]=p[i+6>>1],_[l+8>>1]=p[i+8>>1],_[l+10>>1]=p[i+10>>1],d[l+12>>2]=d[i+12>>2],(0|o)!=(0|(f=f+1|0)););}l=t+128|0,a=o<<4}else{(i=d[t+96>>2])&&(u[t+100|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[t+96>>2]=0),l=t+88|0,d[t+96>>2]=c,s[t+100|0]=0,d[t+92>>2]=o,d[t+88>>2]=o;t:{i:{if(n){if((0|o)<1)break i;for(m=d[e+96>>2],i=c;a=(h=g<<6)+i|0,i=h+m|0,s[0|a]=u[i+3|0],s[a+1|0]=u[i+2|0],s[a+2|0]=u[i+1|0],s[a+3|0]=u[0|i],s[a+4|0]=u[i+7|0],s[a+5|0]=u[i+6|0],s[a+6|0]=u[i+5|0],s[a+7|0]=u[i+4|0],s[a+8|0]=u[i+11|0],s[a+9|0]=u[i+10|0],s[a+10|0]=u[i+9|0],s[a+11|0]=u[i+8|0],s[a+12|0]=u[i+15|0],s[a+13|0]=u[i+14|0],s[a+14|0]=u[i+13|0],s[a+15|0]=u[i+12|0],a=h+d[t+96>>2]|0,i=h+d[e+96>>2]|0,s[a+16|0]=u[i+19|0],s[a+17|0]=u[i+18|0],s[a+18|0]=u[i+17|0],s[a+19|0]=u[i+16|0],s[a+20|0]=u[i+23|0],s[a+21|0]=u[i+22|0],s[a+22|0]=u[i+21|0],s[a+23|0]=u[i+20|0],s[a+24|0]=u[i+27|0],s[a+25|0]=u[i+26|0],s[a+26|0]=u[i+25|0],s[a+27|0]=u[i+24|0],s[a+28|0]=u[i+31|0],s[a+29|0]=u[i+30|0],s[a+30|0]=u[i+29|0],s[a+31|0]=u[i+28|0],a=h+(i=d[t+96>>2])|0,m=d[e+96>>2],f=d[32+(h=h+m|0)>>2],d[a+32>>2]=f<<24|f<<8&16711680|f>>>8&65280|f>>>24,f=d[h+36>>2],d[a+36>>2]=f<<24|f<<8&16711680|f>>>8&65280|f>>>24,h=d[h+40>>2],d[a+40>>2]=h<<24|h<<8&16711680|h>>>8&65280|h>>>24,(0|o)!=(0|(g=g+1|0)););}else{if((0|o)<1)break i;for(g=d[e+96>>2],i=c;a=(m=f<<6)+i|0,i=d[4+(h=m+g|0)>>2],d[a>>2]=d[h>>2],d[a+4>>2]=i,i=d[h+12>>2],d[a+8>>2]=d[h+8>>2],d[a+12>>2]=i,h=m+d[e+96>>2]|0,i=d[h+20>>2],a=m+d[t+96>>2]|0,d[a+16>>2]=d[h+16>>2],d[a+20>>2]=i,i=d[h+28>>2],d[a+24>>2]=d[h+24>>2],d[a+28>>2]=i,a=m+(i=d[t+96>>2])|0,h=m+(g=d[e+96>>2])|0,d[a+32>>2]=d[h+32>>2],d[a+36>>2]=d[h+36>>2],d[a+40>>2]=d[h+40>>2],(0|o)!=(0|(f=f+1|0)););}if(h=a=o<<6,i)break t;break e}i=c,h=o<<6}a=h,u[t+100|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[t+96>>2]=0}d[l>>2]=0,d[l+4>>2]=0,s[l+5|0]=0,s[l+6|0]=0,s[l+7|0]=0,s[l+8|0]=0,s[l+9|0]=0,s[l+10|0]=0,s[l+11|0]=0,s[l+12|0]=0,l=d[e+168>>2],(i=d[t+160>>2])&&(u[t+164|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[t+160>>2]=0),h=a+c|0,d[t+160>>2]=h,s[t+164|0]=0,d[t+156>>2]=l,d[t+152>>2]=l,c=d[e+168>>2];e:if(n){if(!((0|c)<1))for(i=d[e+160>>2],n=0;a=(e=n<<5)+h|0,e=p[(l=e+i|0)>>1],_[a>>1]=(e<<24|e<<8&16711680)>>>16,e=p[l+2>>1],_[a+2>>1]=(e<<24|e<<8&16711680)>>>16,e=p[l+4>>1],_[a+4>>1]=(e<<24|e<<8&16711680)>>>16,e=p[l+6>>1],_[a+6>>1]=(e<<24|e<<8&16711680)>>>16,e=p[l+8>>1],_[a+8>>1]=(e<<24|e<<8&16711680)>>>16,e=p[l+10>>1],_[a+10>>1]=(e<<24|e<<8&16711680)>>>16,e=d[l+12>>2],d[a+12>>2]=e<<24|e<<8&16711680|e>>>8&65280|e>>>24,e=d[l+16>>2],d[a+16>>2]=e<<24|e<<8&16711680|e>>>8&65280|e>>>24,(0|c)!=(0|(n=n+1|0)););}else{if((0|c)<1)break e;for(c=d[e+160>>2],n=0;l=(i=n<<5)+h|0,i=i+c|0,_[l>>1]=p[i>>1],_[l+2>>1]=p[i+2>>1],_[l+4>>1]=p[i+4>>1],_[l+6>>1]=p[i+6>>1],_[l+8>>1]=p[i+8>>1],_[l+10>>1]=p[i+10>>1],d[l+12>>2]=d[i+12>>2],i=d[i+16>>2],d[l+28>>2]=0,d[l+20>>2]=0,d[l+24>>2]=0,d[l+16>>2]=i,(0|(n=n+1|0))>2];);}return d[t>>2]=0,s[t+157|0]=0,s[t+158|0]=0,s[t+159|0]=0,s[t+160|0]=0,s[t+161|0]=0,s[t+162|0]=0,s[t+163|0]=0,s[t+164|0]=0,d[t+152>>2]=0,d[t+156>>2]=0,1}function H(e,t,i){var n,o=0,a=0,l=0,c=0,h=0,_=0,p=0,f=0,m=0,g=0,y=0,v=0,A=0,C=0;O=n=O-144|0;e:if((0|i)<=0)(t=d[e+12>>2])&&(u[e+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+12>>2]=0),d[e+12>>2]=0,s[e+16|0]=1,d[e+4>>2]=0,d[e+8>>2]=0,(t=d[e+32>>2])&&(u[e+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+32>>2]=0),d[e+32>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0,(t=d[e+52>>2])&&(u[e+56|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+52>>2]=0),d[e+52>>2]=0,s[e+56|0]=1,d[e+44>>2]=0,d[e+48>>2]=0;else{if(s[n+112|0]=1,d[n+88>>2]=0,d[n+92>>2]=256,d[n+72>>2]=0,d[n+76>>2]=256,d[n+56>>2]=0,d[n+60>>2]=256,d[n+108>>2]=0,d[n+100>>2]=0,d[n+104>>2]=0,d[n+80>>2]=0,d[n+84>>2]=0,d[n+64>>2]=0,d[n+68>>2]=0,d[n+48>>2]=0,d[n+52>>2]=0,se(n+16|0,t,i),(0|(i=d[e+4>>2]))<=-1)for(d[e+8>>2]<=-1&&((t=d[e+12>>2])&&(u[e+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+12>>2]=0),s[e+16|0]=1,d[e+8>>2]=0,d[e+12>>2]=0);t=d[n+4>>2],o=d[e+12>>2]+(i<<4)|0,d[o>>2]=d[n>>2],d[o+4>>2]=t,t=d[n+12>>2],d[o+8>>2]=d[n+8>>2],d[o+12>>2]=t,o=(t=i+1|0)>>>0>=i>>>0,i=t,o;);if(d[e+4>>2]=0,d[n+8>>2]=0,d[n>>2]=0,d[n+4>>2]=0,(0|(i=d[e+24>>2]))<=-1)for(d[e+28>>2]<=-1&&((t=d[e+32>>2])&&(u[e+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+32>>2]=0),d[e+28>>2]=0,d[e+32>>2]=0,s[e+36|0]=1);t=d[n+4>>2],o=d[e+32>>2]+b(i,12)|0,d[o>>2]=d[n>>2],d[o+4>>2]=t,d[o+8>>2]=d[n+8>>2],o=(t=i+1|0)>>>0>=i>>>0,i=t,o;);if(d[e+24>>2]=0,(0|(i=d[e+44>>2]))<=-1&&(t=d[e+52>>2],d[e+48>>2]<=-1&&(!t|!u[e+56|0]||t&&(d[7718]=d[7718]+1,r[d[6607]](t)),s[e+56|0]=1,d[e+48>>2]=0,d[e+52>>2]=0,t=0),Mn((o=t)+(t=i<<2)|0,0,0-t|0)),d[e+44>>2]=0,t=d[n+140>>2],!(d[t+104>>2]>-1)){for(d[t+104>>2]=0,d[7717]=d[7717]+1,p=0|r[d[6606]](4,16),d[p>>2]=t,i=0,_=1,m=1;;){if(C=i,Nn(n,n+16|0,l=d[(i<<2)+p>>2]),(0|(a=d[e+4>>2]))==d[e+8>>2]&&!((0|a)>=(0|(A=a?a<<1:1)))){if(i=0,o=0,A&&(d[7717]=d[7717]+1,o=0|r[d[6606]](A<<4,16),a=d[e+4>>2]),(0|a)>=1)for(;h=(t=i<<4)+o|0,c=t+d[e+12>>2]|0,t=d[c+4>>2],d[h>>2]=d[c>>2],d[h+4>>2]=t,t=d[c+12>>2],d[h+8>>2]=d[c+8>>2],d[h+12>>2]=t,(0|a)!=(0|(i=i+1|0)););(t=d[e+12>>2])&&(u[e+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+12>>2]=0),d[e+12>>2]=o,s[e+16|0]=1,d[e+8>>2]=A,a=d[e+4>>2]}if(t=d[n+4>>2],i=d[e+12>>2]+(a<<4)|0,d[i>>2]=d[n>>2],d[i+4>>2]=t,t=d[n+12>>2],d[i+8>>2]=d[n+8>>2],d[i+12>>2]=t,d[e+4>>2]=d[e+4>>2]+1,h=-1,v=-1,t=A=d[l+8>>2]){for(;;){if((0|(i=d[t+20>>2]))<=-1){if(a=d[e+24>>2],d[n+8>>2]=0,d[n>>2]=0,d[n+4>>2]=0,(0|(i=a))==d[e+28>>2]&&!((0|a)>=(0|(f=i?i<<1:1)))){if(i=0,o=a,l=0,f&&(d[7717]=d[7717]+1,l=0|r[d[6606]](b(f,12),16),o=d[e+24>>2]),(0|o)>=1)for(;g=(c=b(i,12))+d[e+32>>2]|0,y=l+c|0,c=d[g+4>>2],d[y>>2]=d[g>>2],d[y+4>>2]=c,d[y+8>>2]=d[g+8>>2],(0|o)!=(0|(i=i+1|0)););(i=d[e+32>>2])&&(u[e+36|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+32>>2]=0),d[e+32>>2]=l,s[e+36|0]=1,d[e+28>>2]=f,i=d[e+24>>2]}if(o=d[e+32>>2]+b(i,12)|0,i=d[n+4>>2],d[o>>2]=d[n>>2],d[o+4>>2]=i,d[o+8>>2]=d[n+8>>2],o=d[e+24>>2]+1|0,d[e+24>>2]=o,d[n+8>>2]=0,d[n>>2]=0,d[n+4>>2]=0,d[e+28>>2]==(0|o)&&!((0|o)>=(0|(f=o?o<<1:1)))){if(i=0,l=0,f&&(d[7717]=d[7717]+1,l=0|r[d[6606]](b(f,12),16),o=d[e+24>>2]),(0|o)>=1)for(;g=(c=b(i,12))+d[e+32>>2]|0,y=l+c|0,c=d[g+4>>2],d[y>>2]=d[g>>2],d[y+4>>2]=c,d[y+8>>2]=d[g+8>>2],(0|o)!=(0|(i=i+1|0)););(i=d[e+32>>2])&&(u[e+36|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+32>>2]=0),d[e+32>>2]=l,s[e+36|0]=1,d[e+28>>2]=f,o=d[e+24>>2]}if(i=d[n+4>>2],o=d[e+32>>2]+b(o,12)|0,d[o>>2]=d[n>>2],d[o+4>>2]=i,d[o+8>>2]=d[n+8>>2],d[e+24>>2]=d[e+24>>2]+1,f=d[e+32>>2],d[t+20>>2]=a,c=a+1|0,d[d[t+8>>2]+20>>2]=c,g=b(a,12)+f|0,d[g+16>>2]=-1,d[g+4>>2]=1,y=d[t+12>>2],(0|(i=d[y+104>>2]))>-1)o=_,_=i;else{d[y+104>>2]=_;t:if((0|_)!=(0|m)||(0|m)>=(0|(l=m?m<<1:1)))a=p,l=m;else{i=0,a=0,l&&(d[7717]=d[7717]+1,a=0|r[d[6606]](l<<2,16));i:{if((0|m)>=1)for(;;)if(d[(o=i<<2)+a>>2]=d[o+p>>2],(0|m)==(0|(i=i+1|0)))break i;if(!p)break t}p&&(d[7718]=d[7718]+1,r[d[6607]](p))}d[(_<<2)+a>>2]=y,o=_+1|0,p=a,m=l}d[g+8>>2]=_,d[8+(b(c,12)+f|0)>>2]=C,_=o,i=d[t+20>>2]}if(o=i,(0|h)>=0&&(d[d[e+32>>2]+b(i,12)>>2]=h-i,o=v),h=i,v=o,(0|A)==(0|(t=d[t>>2])))break}d[d[e+32>>2]+b(v,12)>>2]=h-v}if(!((0|(i=C+1|0))<(0|_)))break}for(_=0;;){if(t=l=d[d[(_<<2)+p>>2]+8>>2])for(;;){if((0|(i=d[t+20>>2]))>=0){if((0|(a=d[e+44>>2]))==d[e+48>>2]&&!((0|a)>=(0|(h=a?a<<1:1)))){i=0,o=0,h&&(d[7717]=d[7717]+1,o=0|r[d[6606]](h<<2,16),a=d[e+44>>2]),v=d[e+52>>2];t:{i:{if((0|a)>=1)for(;;)if(d[(m=i<<2)+o>>2]=d[m+v>>2],(0|a)==(0|(i=i+1|0)))break i;if(!v)break t}u[e+56|0]&&(i=v)&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+52>>2]=0,a=d[e+44>>2]}d[e+52>>2]=o,s[e+56|0]=1,d[e+48>>2]=h,i=d[t+20>>2]}for(d[d[e+52>>2]+(a<<2)>>2]=i,d[e+44>>2]=d[e+44>>2]+1,i=t;d[i+20>>2]=-1,(0|(i=d[d[i+8>>2]+4>>2]))!=(0|t););}if((0|l)==(0|(t=d[t>>2])))break}if(t=(0|_)==(0|C),_=_+1|0,t)break}p&&p&&(d[7718]=d[7718]+1,r[d[6607]](p))}for((e=d[n+108>>2])&&(u[n+112|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[n+108>>2]=0),d[n+108>>2]=0,s[n+112|0]=1,d[n+100>>2]=0,d[n+104>>2]=0;t=d[n+80>>2];)d[n+80>>2]=d[t+8>>2],(e=d[t>>2])&&(d[7718]=d[7718]+1,r[d[6607]](e)),t&&(d[7718]=d[7718]+1,r[d[6607]](t));for(;t=d[n+64>>2];)d[n+64>>2]=d[t+8>>2],(e=d[t>>2])&&(d[7718]=d[7718]+1,r[d[6607]](e)),t&&(d[7718]=d[7718]+1,r[d[6607]](t));for(;;){if(!(t=d[n+48>>2]))break e;d[n+48>>2]=d[t+8>>2],(e=d[t>>2])&&(d[7718]=d[7718]+1,r[d[6607]](e)),t&&(d[7718]=d[7718]+1,r[d[6607]](t))}}O=n+144|0}function X(e){var t,i=0,n=0,r=y(0),o=y(0),a=0,l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=0,x=y(0),T=y(0),E=y(0),R=0,P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=0,B=0,N=0,L=0,k=0,V=0,U=0,G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=0,Y=y(0);if(O=t=O-192|0,yr(21072),(0|(n=d[e+1112>>2]))>=1)for(V=e+1048|0,N=t+144|4,X=d[5759],Y=m[5758];;){if(i=d[d[e+1120>>2]+(L<<2)>>2],B=d[i+24>>2]){if(d[t+184>>2]=0,d[t+188>>2]=0,d[t+176>>2]=0,d[t+180>>2]=0,d[t+168>>2]=0,d[t+172>>2]=0,d[t+160>>2]=0,d[t+164>>2]=0,d[N+8>>2]=0,d[N>>2]=0,d[N+4>>2]=0,d[t+184>>2]=966609233,d[t+164>>2]=961656599,d[t+144>>2]=953267991,R=(0|(S=d[i+24>>2]))<1)o=y(0),h=y(0),r=y(0);else for(F=d[i+32>>2],k=d[i+12>>2],r=y(0),n=0,h=y(0),o=y(0);a=d[F+(U=n<<2)>>2],_=m[k+U>>2],o=y(o+y(m[a+8>>2]*_)),r=y(r+y(_*m[a+16>>2])),h=y(h+y(_*m[a+12>>2])),(0|S)!=(0|(n=n+1|0)););if(d[i+240>>2]=0,p=r,r=m[i+128>>2],c=y(p*r),m[i+236>>2]=c,p=y(h*r),m[i+232>>2]=p,f=y(o*r),m[i+228>>2]=f,!R)for(F=d[i+52>>2],k=d[i+32>>2],n=0,o=y(9999999747378752e-20),h=y(.00019999999494757503),r=y(0),_=y(.00029999998514540493),g=y(0);R=d[k+(n<<2)>>2],v=m[R+16>>2],b=m[R+12>>2],A=m[8+(a=F+(n<<4)|0)>>2],C=m[a+4>>2],l=y(m[R+8>>2]-f),o=y(y(l*m[a>>2])+o),m[t+144>>2]=o,m[t+148>>2]=y(l*C)+m[t+148>>2],m[t+152>>2]=y(l*A)+m[t+152>>2],A=m[a+8>>2],C=m[a>>2],l=y(b-p),h=y(y(l*m[a+4>>2])+h),m[t+164>>2]=h,m[t+160>>2]=y(l*C)+m[t+160>>2],m[t+168>>2]=y(l*A)+m[t+168>>2],b=m[a>>2],A=m[a+4>>2],l=y(v-c),_=y(y(l*m[a+8>>2])+_),m[t+184>>2]=_,r=y(y(l*A)+r),m[t+180>>2]=r,g=y(y(l*b)+g),m[t+176>>2]=g,(0|S)!=(0|(n=n+1|0)););if(1&s[30644]||mc(30644)&&(d[7660]=X,m[7659]=Y,uh(30644)),ne(t+144|0,t+96|0,t+48|0),n=d[i+240>>2],d[i+116>>2]=d[i+236>>2],d[i+120>>2]=n,n=d[i+232>>2],d[i+108>>2]=d[i+228>>2],d[i+112>>2]=n,n=d[t+108>>2],d[i+68>>2]=d[t+104>>2],d[i+72>>2]=n,n=d[t+100>>2],d[i+60>>2]=d[t+96>>2],d[i+64>>2]=n,n=d[t+124>>2],d[i+84>>2]=d[t+120>>2],d[i+88>>2]=n,n=d[t+116>>2],d[i+76>>2]=d[t+112>>2],d[i+80>>2]=n,n=d[t+132>>2],d[i+92>>2]=d[t+128>>2],d[i+96>>2]=n,n=d[t+140>>2],d[i+100>>2]=d[t+136>>2],d[i+104>>2]=n,r=m[i+68>>2],o=m[i- -64>>2],h=m[i+84>>2],_=m[i+76>>2],g=m[i+80>>2],v=m[i+172>>2],b=m[i+140>>2],A=m[i+156>>2],C=m[i+148>>2],M=m[i+164>>2],l=m[i+100>>2],D=m[i+168>>2],c=m[i+92>>2],T=m[i+136>>2],p=m[i+96>>2],P=m[i+152>>2],f=m[i+60>>2],I=m[i+132>>2],d[i+316>>2]=0,d[i+320>>2]=0,d[i+224>>2]=0,d[i+208>>2]=0,d[i+192>>2]=0,d[i+324>>2]=0,d[i+328>>2]=0,d[i+332>>2]=0,d[i+336>>2]=0,d[i+340>>2]=0,d[i+344>>2]=0,x=y(y(y(I*c)+y(C*p))+y(M*l)),E=y(y(y(T*c)+y(P*p))+y(D*l)),w=y(y(y(b*c)+y(A*p))+y(v*l)),G=y(y(y(c*x)+y(p*E))+y(l*w)),m[i+220>>2]=G,j=y(y(y(_*x)+y(E*g))+y(w*h)),m[i+216>>2]=j,W=y(y(y(f*x)+y(E*o))+y(w*r)),m[i+212>>2]=W,x=y(y(y(I*_)+y(C*g))+y(M*h)),E=y(y(y(T*_)+y(P*g))+y(D*h)),w=y(y(y(b*_)+y(A*g))+y(v*h)),z=y(y(y(c*x)+y(p*E))+y(l*w)),m[i+204>>2]=z,H=y(y(y(x*_)+y(E*g))+y(w*h)),m[i+200>>2]=H,x=y(y(y(x*f)+y(E*o))+y(w*r)),m[i+196>>2]=x,E=c,c=y(y(y(I*f)+y(C*o))+y(M*r)),C=p,p=y(y(y(f*T)+y(o*P))+y(r*D)),T=l,l=y(y(y(f*b)+y(o*A))+y(r*v)),v=y(y(y(E*c)+y(C*p))+y(T*l)),m[i+188>>2]=v,b=y(y(y(c*_)+y(p*g))+y(l*h)),m[i+184>>2]=b,A=y(y(y(c*f)+y(p*o))+y(l*r)),m[i+180>>2]=A,(0|B)<1)r=y(0),_=y(0),g=y(0),o=y(0),h=y(0),l=y(0);else for(S=d[i+32>>2],C=m[i+236>>2],M=m[i+232>>2],D=m[i+228>>2],R=d[i+12>>2],n=0,r=y(0),_=y(0),g=y(0),o=y(0),h=y(0),l=y(0);a=d[(F=n<<2)+S>>2],T=m[a+44>>2],f=m[a+48>>2],c=m[R+F>>2],p=y(m[a+40>>2]*c),l=y(p+l),m[i+316>>2]=l,f=y(c*f),o=y(f+o),m[i+324>>2]=o,c=y(c*T),h=y(c+h),m[i+320>>2]=h,T=m[a+16>>2],P=y(m[a+8>>2]-D),I=y(m[a+12>>2]-M),r=y(y(y(c*P)-y(p*I))+r),m[i+340>>2]=r,E=p,p=y(T-C),_=y(y(y(E*p)-y(f*P))+_),m[i+336>>2]=_,g=y(g+y(y(f*I)-y(c*p))),m[i+332>>2]=g,(0|B)!=(0|(n=n+1|0)););d[i+328>>2]=0,d[i+344>>2]=0,d[i+244>>2]=0,d[i+248>>2]=0,d[i+260>>2]=0,d[i+264>>2]=0,d[i+268>>2]=0,d[i+272>>2]=0,d[i+252>>2]=0,d[i+256>>2]=0,d[i+292>>2]=0,d[i+296>>2]=0,d[i+300>>2]=0,d[i+304>>2]=0,c=m[i+128>>2],p=y(c*o),o=y(y(1)-m[i+356>>2]),m[i+324>>2]=p*o,m[i+320>>2]=y(c*h)*o,m[i+316>>2]=y(l*c)*o,o=y(y(1)-m[i+360>>2]),m[i+340>>2]=o*y(y(y(g*W)+y(_*j))+y(r*G)),m[i+336>>2]=y(y(y(g*x)+y(_*H))+y(r*z))*o,m[i+332>>2]=y(y(y(A*g)+y(b*_))+y(v*r))*o,d[i+284>>2]=0,d[i+288>>2]=0,d[i+276>>2]=0,d[i+280>>2]=0,d[i+308>>2]=0,d[i+312>>2]=0;e:if(!((r=m[i+364>>2])>y(0)^1|d[i+24>>2]<1))for(n=0;;){if(a=d[d[i+32>>2]+(n<<2)>>2],g=m[a+8>>2],l=m[a+12>>2],c=m[a+16>>2],S=d[i+52>>2]+(n<<4)|0,o=m[S+8>>2],h=m[S>>2],_=m[S+4>>2],p=m[i+108>>2],f=m[i+68>>2],v=m[i+60>>2],b=m[i+64>>2],A=m[i+112>>2],C=m[i+84>>2],M=m[i+76>>2],D=m[i+80>>2],T=m[i+116>>2],P=m[i+100>>2],I=m[i+92>>2],x=m[i+96>>2],d[a+20>>2]=0,m[a+16>>2]=c+y(r*y(y(T+y(y(y(h*I)+y(_*x))+y(o*P)))-c)),m[a+12>>2]=l+y(r*y(y(A+y(y(y(h*M)+y(_*D))+y(o*C)))-l)),m[a+8>>2]=g+y(r*y(y(p+y(y(y(h*v)+y(_*b))+y(o*f)))-g)),(0|(n=n+1|0))>=d[i+24>>2])break e;r=m[i+364>>2]}if(u[i+377|0]){if(n=1,S=d[i+32>>2],a=d[S>>2],_=r=m[a+8>>2],o=g=m[a+12>>2],l=h=m[a+16>>2],p=c=m[a+20>>2],(0|B)>1)for(;a=d[S+(n<<2)>>2],r=r<(f=m[a+8>>2])?f:r,_=f<_?f:_,c=c<(f=m[a+20>>2])?f:c,h=h<(v=m[a+16>>2])?v:h,g=g<(b=m[a+12>>2])?b:g,p=f>2]=c,m[t+40>>2]=h,m[t+36>>2]=g,m[t+32>>2]=r,m[t+28>>2]=p,m[t+24>>2]=l,m[t+20>>2]=o,m[t+16>>2]=_,(n=d[i+348>>2])?(o=m[i+316>>2],h=m[i+320>>2],_=m[i+324>>2],r=m[e+452>>2],d[t+12>>2]=0,m[t+8>>2]=y(r*_)*y(3),m[t+4>>2]=y(r*h)*y(3),m[t>>2]=y(o*r)*y(3),zi(V,n,t+16|0,t,m[e+464>>2])):d[i+348>>2]=br(V,t+16|0,i)}n=d[e+1112>>2]}if(!((0|(L=L+1|0))<(0|n)))break}As(),O=t+192|0}function Y(e,t){var i,n=0,o=0,a=0,l=y(0),c=y(0),h=0,_=y(0),p=0,f=y(0),g=y(0),v=y(0),A=y(0),C=0,S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0);if(O=i=O-144|0,u[e+924|0]&&(s[e+924|0]=0,Ir(e),Is(n=e+988|0),16&u[e+388|0]&&(Is(n),!(d[e+752>>2]<1))))for(;Ui(i+8|0,h=d[e+760>>2]+b(a,44)|0,y(0)),d[h+40>>2]=br(n,i+8|0,h),(0|(a=a+1|0))>2];);if(t=y(m[e+368>>2]*t),m[e+452>>2]=t,m[e+460>>2]=t*y(3),m[e+456>>2]=y(1)/t,a=d[e+192>>2],t=y(r[d[d[a>>2]+48>>2]](a)),m[e+464>>2]=t,m[e+468>>2]=t*y(.25),(0|(h=d[e+712>>2]))>=1)for(t=m[e+452>>2],a=d[e+684>>2],l=y(t*m[a+48>>2]),c=y(t*m[a+44>>2]),t=y(m[a+40>>2]*t),o=d[e+720>>2],a=0;n=o+b(a,104)|0,m[n+88>>2]>y(0)&&(m[n+40>>2]=t+m[n+40>>2],m[n+44>>2]=c+m[n+44>>2],m[n+48>>2]=l+m[n+48>>2]),(0|h)!=(0|(a=a+1|0)););if(an(e),(0|(o=d[e+712>>2]))>=1)for(a=0;n=d[e+720>>2]+b(a,104)|0,h=d[n+12>>2],p=d[n+8>>2],d[n+24>>2]=p,d[n+28>>2]=h,h=d[n+20>>2],d[n+32>>2]=d[n+16>>2],d[n+36>>2]=h,c=m[e+452>>2],t=y(m[d[e+684>>2]+12>>2]/c),l=y(-t),_=m[n+88>>2],f=y(y(m[n+56>>2]*_)*c),f=y(((f=f>t?t:f)>2]),m[n+40>>2]=f,g=y(c*y(_*m[n+60>>2])),g=y(((g=g>t?t:g)>2]),m[n+44>>2]=g,c=y(c*y(_*m[(h=n- -64|0)>>2])),l=y(((t=c>t?t:c)>2]),m[n+48>>2]=l,t=m[e+452>>2],m[n+8>>2]=y(f*t)+m[n+8>>2],m[n+12>>2]=y(g*t)+m[n+12>>2],m[n+16>>2]=y(l*t)+m[n+16>>2],d[h>>2]=0,d[h+4>>2]=0,d[n+56>>2]=0,d[n+60>>2]=0,(0|o)!=(0|(a=a+1|0)););X(e);e:if(a=d[e+928>>2]){if(n=d[e+192>>2],t=y(r[d[d[n>>2]+48>>2]](n)),l=m[a>>2],c=m[a+4>>2],_=m[a+8>>2],d[e+904>>2]=0,m[e+900>>2]=_-t,m[e+896>>2]=c-t,m[e+892>>2]=l-t,l=m[a+20>>2],c=m[a+24>>2],_=m[a+16>>2],d[e+920>>2]=0,m[e+916>>2]=t+c,m[e+912>>2]=t+l,m[(a=e+908|0)>>2]=t+_,!(n=d[e+188>>2]))break e;h=d[e+684>>2],o=d[h+32>>2],r[d[d[o>>2]+16>>2]](o,n,e+892|0,a,d[h+36>>2])}else d[e+892>>2]=0,d[e+896>>2]=0,d[e+916>>2]=0,d[e+920>>2]=0,d[e+908>>2]=0,d[e+912>>2]=0,d[e+900>>2]=0,d[e+904>>2]=0;if((0|(h=d[e+712>>2]))>=1)for(o=e+928|0,a=0;n=d[e+720>>2]+b(a,104)|0,l=m[n+12>>2],c=m[n+16>>2],_=m[n+8>>2],t=m[e+464>>2],d[i+140>>2]=0,m[i+128>>2]=t+_,d[i+124>>2]=0,m[i+112>>2]=_-t,m[i+136>>2]=t+c,m[i+132>>2]=t+l,m[i+120>>2]=c-t,m[i+116>>2]=l-t,p=d[n+96>>2],l=m[n+40>>2],c=m[n+44>>2],_=m[n+48>>2],t=m[e+460>>2],d[i+20>>2]=0,m[i+16>>2]=t*_,m[i+12>>2]=t*c,m[i+8>>2]=l*t,zi(o,p,i+112|0,i+8|0,m[e+468>>2]),(0|h)!=(0|(a=a+1|0)););if(h=e+988|0,!(!d[e+988>>2]|d[e+752>>2]<1))for(a=0;n=d[e+760>>2]+b(a,44)|0,o=d[n+16>>2],l=m[o+40>>2],p=d[n+8>>2],c=m[p+40>>2],C=d[n+12>>2],_=m[C+40>>2],f=m[o+44>>2],g=m[p+44>>2],S=m[C+44>>2],x=m[o+48>>2],T=m[p+48>>2],E=m[C+48>>2],Ui(i+8|0,n,m[e+464>>2]),o=d[i+36>>2],d[i+136>>2]=d[i+32>>2],d[i+140>>2]=o,o=d[i+28>>2],d[i+128>>2]=d[i+24>>2],d[i+132>>2]=o,o=d[i+20>>2],d[i+120>>2]=d[i+16>>2],d[i+124>>2]=o,o=d[i+12>>2],d[i+112>>2]=d[i+8>>2],d[i+116>>2]=o,n=d[n+40>>2],t=m[e+460>>2],d[i+20>>2]=0,m[i+16>>2]=t*y(y(x+y(T+E))*y(.3333333432674408)),m[i+12>>2]=t*y(y(f+y(g+S))*y(.3333333432674408)),m[i+8>>2]=t*y(y(l+y(c+_))*y(.3333333432674408)),zi(h,n,i+112|0,i+8|0,m[e+468>>2]),(0|(a=a+1|0))>2];);if(function(e){var t,i=y(0),n=0,r=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=0,S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=0,I=y(0),M=y(0),D=0,w=0,F=0,B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=0;if(O=t=O-144|0,u[e+473|0]){if(!(P=(0|(D=d[e+712>>2]))<1))for(w=d[e+512>>2],F=d[e+720>>2];C=F+b(n,104)|0,o=m[w+(n<<2)>>2],i=y(i+y(m[C+8>>2]*o)),p=y(p+y(o*m[C+16>>2])),f=y(f+y(o*m[C+12>>2])),(0|D)!=(0|(n=n+1|0)););if(d[e+532>>2]=0,m[e+528>>2]=p,m[e+524>>2]=f,m[e+520>>2]=i,d[t+136>>2]=0,d[t+140>>2]=0,d[t+120>>2]=0,d[t+124>>2]=0,d[t+108>>2]=0,d[t+112>>2]=0,d[t+116>>2]=0,d[t+116>>2]=880803840,d[t+136>>2]=884998144,d[t+128>>2]=0,d[t+132>>2]=0,d[t+100>>2]=0,d[t+104>>2]=0,d[t+96>>2]=872415232,!P)for(w=d[e+492>>2],F=d[e+720>>2],z=d[e+512>>2],o=m[t+120>>2],h=y(1.1920928955078125e-7),a=y(2.384185791015625e-7),l=y(3.5762786865234375e-7),_=m[t+112>>2],c=m[t+104>>2],g=m[t+100>>2],C=0;P=F+b(C,104)|0,v=m[P+16>>2],x=m[P+12>>2],T=m[(n=w+(C<<4)|0)>>2],E=m[n+4>>2],A=m[(C<<2)+z>>2],r=y(y(m[P+8>>2]-i)*A),c=y(y(r*m[n+8>>2])+c),m[t+104>>2]=c,g=y(y(r*E)+g),m[t+100>>2]=g,h=y(y(r*T)+h),m[t+96>>2]=h,T=m[n>>2],E=m[n+4>>2],r=y(A*y(x-f)),o=y(y(r*m[n+8>>2])+o),m[t+120>>2]=o,a=y(y(r*E)+a),m[t+116>>2]=a,_=y(y(r*T)+_),m[t+112>>2]=_,r=m[n>>2],x=m[n+4>>2],A=y(A*y(v-p)),l=y(y(A*m[n+8>>2])+l),m[t+136>>2]=l,I=y(y(A*x)+I),m[t+132>>2]=I,M=y(y(A*r)+M),m[t+128>>2]=M,(0|D)!=(0|(C=C+1|0)););1&s[30644]||mc(30644)&&(i=m[5758],d[7660]=d[5759],m[7659]=i,uh(30644)),ne(t+96|0,t+48|0,t),n=d[t+60>>2],d[e+544>>2]=d[t+56>>2],d[e+548>>2]=n,n=d[t+52>>2],d[e+536>>2]=d[t+48>>2],d[e+540>>2]=n,n=d[t+76>>2],d[e+560>>2]=d[t+72>>2],d[e+564>>2]=n,n=d[t+68>>2],d[e+552>>2]=d[t+64>>2],d[e+556>>2]=n,n=d[t+84>>2],d[e+568>>2]=d[t+80>>2],d[e+572>>2]=n,n=d[t+92>>2],d[e+576>>2]=d[t+88>>2],d[e+580>>2]=n,i=m[e+640>>2],p=m[e+632>>2],f=m[e+636>>2],o=m[e+656>>2],h=m[e+648>>2],a=m[e+652>>2],l=m[e+672>>2],_=m[e+664>>2],c=m[e+668>>2],g=m[t+88>>2],A=m[t+84>>2],r=m[t+56>>2],v=m[t+120>>2],x=m[t+72>>2],T=m[t+68>>2],E=m[t+128>>2],I=m[t+96>>2],M=m[t+112>>2],B=m[t+132>>2],N=m[t+100>>2],L=m[t+116>>2],k=m[t+136>>2],V=m[t+80>>2],U=m[t+104>>2],G=m[t+48>>2],j=m[t+52>>2],W=m[t+64>>2],d[e+628>>2]=0,d[e+612>>2]=0,d[e+596>>2]=0,S=y(y(y(G*_)+y(j*c))+y(r*l)),R=y(y(y(W*_)+y(T*c))+y(x*l)),c=y(y(y(V*_)+y(A*c))+y(g*l)),l=y(y(y(U*S)+y(v*R))+y(k*c)),m[e+624>>2]=l,_=y(y(y(S*N)+y(R*L))+y(c*B)),m[e+620>>2]=_,c=y(y(y(I*S)+y(M*R))+y(c*E)),m[e+616>>2]=c,S=y(y(y(G*h)+y(j*a))+y(r*o)),R=y(y(y(W*h)+y(T*a))+y(x*o)),a=y(y(y(V*h)+y(A*a))+y(g*o)),o=y(y(y(U*S)+y(v*R))+y(k*a)),m[e+608>>2]=o,h=y(y(y(S*N)+y(R*L))+y(a*B)),m[e+604>>2]=h,a=y(y(y(S*I)+y(R*M))+y(a*E)),m[e+600>>2]=a,r=y(y(y(G*p)+y(j*f))+y(r*i)),S=v,v=y(y(y(W*p)+y(T*f))+y(x*i)),i=y(y(y(V*p)+y(A*f))+y(g*i)),p=y(y(y(U*r)+y(S*v))+y(k*i)),m[e+592>>2]=p,f=y(y(y(r*N)+y(v*L))+y(i*B)),m[e+588>>2]=f,g=y(y(y(r*I)+y(v*M))+y(i*E)),m[e+584>>2]=g,(i=m[e+364>>2])>y(1)&&(d[e+628>>2]=0,d[e+612>>2]=0,d[e+596>>2]=0,v=l,i=(l=y(y(1)/y(y(p*y(y(_*a)-y(h*c)))+y(y(g*y(y(h*l)-y(o*_)))+y(f*y(y(o*c)-y(l*a)))))))i?i:l,m[e+624>>2]=v*i,m[e+620>>2]=_*i,m[e+616>>2]=c*i,m[e+608>>2]=o*i,m[e+604>>2]=h*i,m[e+600>>2]=a*i,m[e+592>>2]=p*i,m[e+588>>2]=f*i,m[e+584>>2]=g*i)}O=t+144|0}(e),!(!u[e+473|0]|m[e+320>>2]>y(0)^1||(0|(p=d[e+712>>2]))<1))for(f=m[e+576>>2],g=m[e+572>>2],S=m[e+568>>2],x=m[e+560>>2],T=m[e+556>>2],E=m[e+552>>2],P=m[e+544>>2],I=m[e+540>>2],M=m[e+536>>2],a=0;n=d[e+720>>2]+b(a,104)|0,m[n+88>>2]>y(0)&&(o=d[e+492>>2]+(a<<4)|0,t=m[o+8>>2],l=m[o>>2],c=m[o+4>>2],D=m[e+520>>2],v=m[e+524>>2],_=m[e+320>>2],A=m[e+528>>2],d[n+20>>2]=0,R=m[n+16>>2],m[n+16>>2]=R+y(_*y(y(A+y(y(y(S*l)+y(g*c))+y(f*t)))-R)),A=m[n+12>>2],m[n+12>>2]=A+y(_*y(y(v+y(y(y(E*l)+y(T*c))+y(x*t)))-A)),v=m[n+8>>2],m[n+8>>2]=v+y(_*y(y(D+y(y(y(M*l)+y(I*c))+y(P*t)))-v))),(0|p)!=(0|(a=a+1|0)););if(Mn(i+8|0,0,104),(0|(a=d[e+812>>2]))<=-1)for(d[e+816>>2]<=-1&&((n=d[e+820>>2])&&(u[e+824|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+820>>2]=0),d[e+816>>2]=0,d[e+820>>2]=0,s[e+824|0]=1);p=d[i+12>>2],n=d[e+820>>2]+b(a,104)|0,d[n>>2]=d[i+8>>2],d[n+4>>2]=p,d[n+24>>2]=d[i+32>>2],o=d[i+28>>2],d[n+16>>2]=d[i+24>>2],d[n+20>>2]=o,o=d[i+20>>2],d[n+8>>2]=d[i+16>>2],d[n+12>>2]=o,o=d[i+48>>2],d[n+36>>2]=d[i+44>>2],d[n+40>>2]=o,o=d[i+40>>2],d[n+28>>2]=d[i+36>>2],d[n+32>>2]=o,o=d[i+64>>2],d[n+52>>2]=d[i+60>>2],d[n+56>>2]=o,o=d[i+56>>2],d[n+44>>2]=d[i+52>>2],d[n+48>>2]=o,o=d[i+72>>2],d[n+60>>2]=d[i+68>>2],d[n+64>>2]=o,o=d[i+80>>2],d[n+68>>2]=d[i+76>>2],d[n+72>>2]=o,o=d[i+88>>2],d[n+76>>2]=d[i+84>>2],d[n+80>>2]=o,o=d[i+96>>2],d[n+84>>2]=d[i+92>>2],d[n+88>>2]=o,o=d[i+104>>2],d[n+92>>2]=d[i+100>>2],d[n+96>>2]=o,d[n+100>>2]=d[i+108>>2],o=(n=a+1|0)>>>0>=a>>>0,a=n,o;);if(d[e+812>>2]=0,d[i+56>>2]=0,d[i+60>>2]=0,d[i+48>>2]=0,d[i+52>>2]=0,d[i+40>>2]=0,d[i+44>>2]=0,d[i+32>>2]=0,d[i+36>>2]=0,d[i+24>>2]=0,d[i+28>>2]=0,d[i+16>>2]=0,d[i+20>>2]=0,d[i+8>>2]=0,d[i+12>>2]=0,(0|(a=d[e+832>>2]))<=-1)for(d[e+836>>2]<=-1&&((n=d[e+840>>2])&&(u[e+844|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+840>>2]=0),d[e+836>>2]=0,d[e+840>>2]=0,s[e+844|0]=1);p=d[i+12>>2],n=d[e+840>>2]+b(a,56)|0,d[n>>2]=d[i+8>>2],d[n+4>>2]=p,o=d[i+60>>2],d[n+48>>2]=d[i+56>>2],d[n+52>>2]=o,o=d[i+52>>2],d[n+40>>2]=d[i+48>>2],d[n+44>>2]=o,o=d[i+44>>2],d[n+32>>2]=d[i+40>>2],d[n+36>>2]=o,o=d[i+36>>2],d[n+24>>2]=d[i+32>>2],d[n+28>>2]=o,o=d[i+28>>2],d[n+16>>2]=d[i+24>>2],d[n+20>>2]=o,o=d[i+20>>2],d[n+8>>2]=d[i+16>>2],d[n+12>>2]=o,o=(n=a+1|0)>>>0>=a>>>0,a=n,o;);d[e+832>>2]=0,ei(e+928|0,1),ei(h,1),ei(e+1048|0,1),O=i+144|0}function Q(e,t,i){var n,r=y(0),s=0,o=y(0),a=y(0),l=y(0),c=y(0),h=0,_=0,u=0,p=0,f=y(0),g=y(0),v=0,A=0,C=0,S=y(0),T=y(0),E=y(0),R=y(0),P=0,I=0,M=0,D=0,w=0;O=n=O-96|0,d[e+376>>2]=0,d[e+364>>2]=4,d[e+368>>2]=0,h=e+316|0,d[e+360>>2]=h,d[e+356>>2]=e+284,d[e+352>>2]=e+252,d[e+348>>2]=e+220,s=d[t+4>>2],d[e>>2]=d[t>>2],d[e+4>>2]=s,s=d[t+20>>2],d[e+16>>2]=d[t+16>>2],d[e+20>>2]=s,s=d[t+12>>2],d[e+8>>2]=d[t+8>>2],d[e+12>>2]=s,s=d[t+36>>2],d[e+32>>2]=d[t+32>>2],d[e+36>>2]=s,s=d[t+28>>2],d[e+24>>2]=d[t+24>>2],d[e+28>>2]=s,s=d[t+52>>2],d[e+48>>2]=d[t+48>>2],d[e+52>>2]=s,s=d[t+44>>2],d[e+40>>2]=d[t+40>>2],d[e+44>>2]=s,p=d[4+(u=t- -64|0)>>2],d[(s=e- -64|0)>>2]=d[u>>2],d[s+4>>2]=p,s=d[t+60>>2],d[e+56>>2]=d[t+56>>2],d[e+60>>2]=s,s=d[t+84>>2],d[e+80>>2]=d[t+80>>2],d[e+84>>2]=s,s=d[t+76>>2],d[e+72>>2]=d[t+72>>2],d[e+76>>2]=s,s=d[t+100>>2],d[e+96>>2]=d[t+96>>2],d[e+100>>2]=s,s=d[t+92>>2],d[e+88>>2]=d[t+88>>2],d[e+92>>2]=s,s=d[t+108>>2],d[e+104>>2]=d[t+104>>2],d[e+108>>2]=s,s=d[t+116>>2],d[e+112>>2]=d[t+112>>2],d[e+116>>2]=s,s=d[t+124>>2],t=d[t+120>>2],d[e+180>>2]=0,d[e+144>>2]=0,d[e+120>>2]=t,d[e+124>>2]=s,t=d[i+12>>2],d[e+136>>2]=d[i+8>>2],d[e+140>>2]=t,t=d[i+4>>2],d[e+128>>2]=d[i>>2],d[e+132>>2]=t,s=e+128|0,r=m[e+128>>2],l=m[e+132>>2],a=m[e+136>>2],(f=y(y(y(r*r)+y(l*l))+y(a*a)))>y(0)?(m[n+40>>2]=-a,m[n+36>>2]=-l,m[n+32>>2]=-r):(d[n+40>>2]=0,d[n+32>>2]=1065353216,d[n+36>>2]=0),d[n+44>>2]=0,d[e+364>>2]=3,d[e+164>>2]=0,d[e+180>>2]=1,d[e+148>>2]=h,er(e,n+32|0,h),d[e+164>>2]=1065353216,t=d[e+148>>2],i=d[t+20>>2],d[s>>2]=d[t+16>>2],d[s+4>>2]=i,i=d[t+28>>2],d[s+8>>2]=d[t+24>>2],d[s+12>>2]=i,i=d[t+28>>2],d[n+88>>2]=d[t+24>>2],d[n+92>>2]=i,i=d[t+20>>2],d[n+80>>2]=d[t+16>>2],d[n+84>>2]=i,i=d[t+28>>2],d[n+72>>2]=d[t+24>>2],d[n+76>>2]=i,i=d[t+20>>2],d[n+64>>2]=d[t+16>>2],d[n+68>>2]=i,i=d[t+28>>2],d[n+56>>2]=d[t+24>>2],d[n+60>>2]=i,i=d[t+20>>2],d[n+48>>2]=d[t+16>>2],d[n+52>>2]=i,i=d[t+28>>2],d[n+40>>2]=d[t+24>>2],d[n+44>>2]=i,i=d[t+20>>2],d[n+32>>2]=d[t+16>>2],d[n+36>>2]=i,r=m[e+136>>2],l=m[e+132>>2],a=m[e+128>>2],h=d[e+368>>2];e:{t:{i:{for(;;){if((g=y(x(y(y(y(a*a)+y(l*l))+y(r*r)))))>2]=1;break i}if(d[n+28>>2]=0,m[n+24>>2]=-r,m[n+20>>2]=-l,m[n+16>>2]=-a,u=148+(i=b(h,36)+e|0)|0,t=d[i+180>>2],d[16+(p=u+(t<<2)|0)>>2]=0,_=d[e+364>>2]+-1|0,d[e+364>>2]=_,v=p,p=d[348+((_<<2)+e|0)>>2],d[v>>2]=p,d[i+180>>2]=t+1,er(e,n+16|0,p),_=d[i+180>>2],t=d[(u+(_<<2)|0)-4>>2],r=m[t+16>>2],l=y(r-m[n+32>>2]),o=y(l*l),l=m[t+20>>2],a=y(l-m[n+36>>2]),c=y(o+y(a*a)),a=m[t+24>>2],o=y(a-m[n+40>>2]),!(y(c+y(o*o))>2]),c=y(o*o),o=y(l-m[n+52>>2]),c=y(c+y(o*o)),o=y(a-m[n+56>>2]),y(c+y(o*o))>2]),c=y(o*o),o=y(l-m[n+68>>2]),c=y(c+y(o*o)),o=y(a-m[n+72>>2]),y(c+y(o*o))>2]),c=y(o*o),o=y(l-m[n+84>>2]),c=y(c+y(o*o)),o=y(a-m[n+88>>2]),y(c+y(o*o))>2],d[8+(p=(n+32|0)+((P=P+1&3)<<4)|0)>>2]=d[t+24>>2],d[p+12>>2]=C,v=d[t+20>>2],d[p>>2]=d[t+16>>2],d[p+4>>2]=v,r=y(y(y(y(m[e+128>>2]*r)+y(m[e+132>>2]*l))+y(m[e+136>>2]*a))/g),y(y(g-(S=r>S?r:S))+y(g*y(-9999999747378752e-20)))<=y(0)){h=d[e+368>>2],i=b(h,36)+e|0,t=d[i+180>>2]+-1|0,d[i+180>>2]=t,t=d[148+(i+(t<<2)|0)>>2],i=d[e+364>>2],d[e+364>>2]=i+1,d[348+((i<<2)+e|0)>>2]=t;break i}d[n+12>>2]=0;n:{r:{s:{o:switch(_+-2|0){case 0:if(t=d[i+152>>2],T=m[t+16>>2],u=d[u>>2],f=m[u+16>>2],g=y(T-f),E=m[t+20>>2],l=m[u+20>>2],o=y(E-l),R=m[t+24>>2],a=m[u+24>>2],c=y(R-a),!((r=y(y(y(g*g)+y(o*o))+y(c*c)))>y(0)))break r;if((r=y(y(-y(y(y(f*g)+y(l*o))+y(a*c)))/r))>=y(1)){d[n+16>>2]=0,d[n+20>>2]=1065353216,d[n+12>>2]=2,f=y(y(y(T*T)+y(E*E))+y(R*R));break s}if(r<=y(0)){d[n+16>>2]=1065353216,d[n+20>>2]=0,d[n+12>>2]=1,f=y(y(y(f*f)+y(l*l))+y(a*a));break s}d[n+12>>2]=3,m[n+20>>2]=r,m[n+16>>2]=y(1)-r,a=y(a+y(c*r)),f=y(f+y(g*r)),r=y(l+y(o*r)),f=y(y(a*a)+y(y(f*f)+y(r*r)));break s;case 1:f=tt(d[u>>2]+16|0,d[i+152>>2]+16|0,d[i+156>>2]+16|0,n+16|0,n+12|0);break s;case 2:break o;default:break s}f=We(d[u>>2]+16|0,d[i+152>>2]+16|0,d[i+156>>2]+16|0,d[i+160>>2]+16|0,n+16|0,n+12|0)}if(f>=y(0)){if(t=0,v=b(h=1-h|0,36)+e|0,d[(u=v)+180>>2]=0,d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=0,d[s+4>>2]=0,d[e+368>>2]=h,r=y(0),p=d[n+12>>2],l=y(0),a=y(0),!(C=d[i+180>>2]))break n;for(;_=d[148+(I=(A=t<<2)+i|0)>>2],p>>>t&1?(M=d[u+180>>2],d[148+(D=(M<<2)+v|0)>>2]=_,r=m[(_=A+(n+16|0)|0)>>2],_=d[_>>2],d[u+180>>2]=M+1,d[D+164>>2]=_,_=d[I+148>>2],g=m[_+24>>2],l=m[_+20>>2],a=y(y(m[_+16>>2]*r)+m[e+128>>2]),m[e+128>>2]=a,l=y(y(l*r)+m[e+132>>2]),m[e+132>>2]=l,r=y(y(g*r)+m[e+136>>2]),m[e+136>>2]=r):(A=d[e+364>>2],d[e+364>>2]=A+1,d[348+((A<<2)+e|0)>>2]=_),(0|C)!=(0|(t=t+1|0)););break n}}h=d[e+368>>2],i=b(h,36)+e|0,t=d[i+180>>2]+-1|0,d[i+180>>2]=t,t=d[148+(i+(t<<2)|0)>>2],i=d[e+364>>2],d[e+364>>2]=i+1,d[348+((i<<2)+e|0)>>2]=t;break i}if(15==(0|p)&&(d[e+376>>2]=1),127==(0|w)){t=2,d[e+376>>2]=2,d[e+372>>2]=148+(b(h,36)+e|0);break e}if(w=w+1|0,!(t=d[e+376>>2]))continue;break t}break}h=d[e+368>>2],i=b(h,36)+e|0,t=d[i+180>>2]+-1|0,d[i+180>>2]=t,t=d[148+(i+(t<<2)|0)>>2],i=d[e+364>>2],d[e+364>>2]=i+1,d[348+((i<<2)+e|0)>>2]=t}t=d[e+376>>2]}d[e+372>>2]=148+(b(h,36)+e|0);t:switch(0|t){case 0:r=m[e+128>>2],o=y(r*r),r=m[e+132>>2],o=y(o+y(r*r)),r=m[e+136>>2],m[e+144>>2]=x(y(o+y(r*r))),t=0;break e;case 1:break t;default:break e}d[e+144>>2]=0,t=1}return O=n+96|0,t}function q(e){var t,i=0,n=0,o=0,a=y(0),h=y(0),g=0,A=y(0),C=y(0),S=y(0),T=0,E=y(0),R=0,P=y(0),I=y(0),M=0,D=y(0),w=0,F=0,B=0,N=y(0),L=0,k=y(0),V=0,U=0,G=0,j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0);if(O=t=O-96|0,s[t+52|0]=1,d[t+48>>2]=0,s[t+72|0]=1,d[t+40>>2]=0,d[t+44>>2]=0,d[t+68>>2]=0,s[t+92|0]=1,d[t+60>>2]=0,d[t+64>>2]=0,d[t+88>>2]=0,d[t+80>>2]=0,d[t+84>>2]=0,d[t+28>>2]=0,s[t+32|0]=1,d[t+20>>2]=0,d[t+24>>2]=0,d[e+72>>2]=0,d[e+76>>2]=0,d[e+64>>2]=0,d[e+68>>2]=0,!((0|(n=d[e+28>>2]))<1)){for(;;){if(i=d[e+36>>2],V=b(T,36),(0|(U=d[4+(i+V|0)>>2]))>=1){for(w=0;;){n=d[12+(i+V|0)>>2],i=d[n+(w<<2)>>2],g=d[n+(((B=(0|U)==(0|(w=w+1|0)))?0:w)<<2)>>2],_[t+10>>1]=g,_[t+8>>1]=i,F=0,(0|(o=g<<16>>16))>(0|(n=i<<16>>16))&&(_[t+10>>1]=i,_[t+8>>1]=g,o=i,n=g);e:if(!((i=(g=o<<16)+(R=n<<16>>16)&d[t+64>>2]+-1)>>>0>=f[t+20>>2])&&-1!=(0|(i=d[d[t+28>>2]+(i<<2)>>2]))){for(M=d[t+48>>2],L=d[t+88>>2];;){if(p[2+(G=(i<<=2)+L|0)>>1]!=(65535&o)||p[G>>1]!=(65535&n)){if(-1!=(0|(i=d[i+M>>2])))continue;break e}break}F=i+d[t+68>>2]|0}n=(o=d[e+16>>2])+(g>>16<<4)|0,o=o+(R<<4)|0,a=y(m[n+8>>2]-m[o+8>>2]),h=y(m[n>>2]-m[o>>2]),A=y(m[n+4>>2]-m[o+4>>2]),S=y(y(1)/y(x(y(y(y(h*h)+y(A*A))+y(a*a))))),a=y(a*S),A=y(A*S),h=y(h*S);e:{if((0|(n=d[e+48>>2]))>=1)for(g=d[e+56>>2],i=0;;){if(S=m[8+(o=g+(i<<4)|0)>>2],P=m[o>>2],E=m[o+4>>2],(+y(v(y(S-a)))>1e-6^1?!(+y(v(y(P-h)))>1e-6|+y(v(y(E-A)))>1e-6):0)|(+y(v(y(a+S)))>1e-6^1?!(+y(v(y(h+P)))>1e-6|+y(v(y(A+E)))>1e-6):0))break e;if(!((0|(i=i+1|0))<(0|n)))break}if(d[e+52>>2]==(0|n)&&!((0|n)>=(0|(o=n?n<<1:1)))){if(i=0,g=0,o&&(d[7717]=d[7717]+1,g=0|r[d[6606]](o<<4,16),n=d[e+48>>2]),(0|n)>=1)for(;M=(R=i<<4)+g|0,R=R+d[e+56>>2]|0,G=d[R+4>>2],d[M>>2]=d[R>>2],d[M+4>>2]=G,L=d[R+12>>2],d[M+8>>2]=d[R+8>>2],d[M+12>>2]=L,(0|n)!=(0|(i=i+1|0)););(n=d[e+56>>2])&&(u[e+60|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+56>>2]=0),d[e+56>>2]=g,s[e+60|0]=1,d[e+52>>2]=o,n=d[e+48>>2]}n=d[e+56>>2]+(n<<4)|0,d[n+12>>2]=0,m[n+8>>2]=a,m[n+4>>2]=A,m[n>>2]=h,d[e+48>>2]=d[e+48>>2]+1}if(F?_[F+2>>1]=T:(_[t>>1]=T,_[t+2>>1]=65535,Pt(t+16|0,t+8|0,t)),B)break;i=d[e+36>>2]}n=d[e+28>>2]}if(!((0|(T=T+1|0))<(0|n)))break}if(g=0,!((0|n)<1))for(g=(0|n)>0,o=d[e+16>>2],V=d[e+36>>2],T=0;;){if(i=V+b(T,36)|0,(0|(w=d[i+4>>2]))>=3)for(U=w+-1|0,F=d[i+12>>2],L=R=o+(d[F>>2]<<4)|0,h=m[e+72>>2],S=m[e+68>>2],E=m[e+64>>2],i=1;B=o+(d[F+(i<<2)>>2]<<4)|0,a=m[B+8>>2],M=o+(d[F+((0|(i=i+1|0))%(0|w)<<2)>>2]<<4)|0,A=m[M+8>>2],P=m[R>>2],j=m[B>>2],W=y(P-j),C=m[R+4>>2],z=m[M+4>>2],k=y(C-z),H=m[B+4>>2],D=y(C-H),X=m[M>>2],Y=y(P-X),N=y(y(W*k)-y(D*Y)),K=D,D=m[L+8>>2],Q=y(D-A),q=y(D-a),k=y(y(K*Q)-y(q*k)),A=y(y(y(D+a)+A)*y(.3333333432674408)),a=y(y(q*Y)-y(W*Q)),a=y(y(x(y(y(N*N)+y(y(k*k)+y(a*a)))))*y(.5)),h=y(h+y(A*a)),m[e+72>>2]=h,S=y(S+y(y(y(z+y(C+H))*y(.3333333432674408))*a)),m[e+68>>2]=S,E=y(E+y(y(y(X+y(P+j))*y(.3333333432674408))*a)),m[e+64>>2]=E,I=y(I+a),(0|i)!=(0|U););if((0|(T=T+1|0))==(0|n))break}}if(d[e+96>>2]=2139095039,a=y(y(1)/I),S=y(a*m[e+64>>2]),m[e+64>>2]=S,E=y(a*m[e+68>>2]),m[e+68>>2]=E,I=y(a*m[e+72>>2]),m[e+72>>2]=I,a=y(34028234663852886e22),A=y(34028234663852886e22),g)for(g=d[e+36>>2],o=0;i=g+b(o,36)|0,(h=y(v(y(m[i+32>>2]+y(y(y(S*m[i+20>>2])+y(E*m[i+24>>2]))+y(I*m[i+28>>2]))))))>2]=h,A=h),(0|(o=o+1|0))!=(0|n););if((0|(o=d[e+8>>2]))<1)P=y(-34028234663852886e22),h=y(34028234663852886e22),S=y(-34028234663852886e22),E=y(-34028234663852886e22),I=y(34028234663852886e22);else for(g=d[e+16>>2],E=y(-34028234663852886e22),i=0,I=y(34028234663852886e22),S=y(-34028234663852886e22),P=y(-34028234663852886e22),h=y(34028234663852886e22);E=(C=m[8+(n=g+(i<<4)|0)>>2])>E?C:E,h=C>2])>S?C:S,a=C>2])>P?C:P,I=C>2]=0,C=y(E-h),m[e+124>>2]=C,N=y(S-a),m[e+120>>2]=N,D=y(P-I),m[e+116>>2]=D,d[e+112>>2]=0,m[e+108>>2]=h+E,m[e+104>>2]=a+S,m[e+100>>2]=P+I,h=m[(g=(o=(n=D>2],a=y(A/y(1.7320507764816284)),m[e+84>>2]=a,m[e+88>>2]=a,m[e+80>>2]=a,o=o+(e+80|0)|0,A=y(m[g>>2]*y(.5)),m[o>>2]=A,h=y(y(y(h*y(.5))-a)*y(.0009765625));e:{t:{for(;;){if(Ri(e))break t;if(A=y(A-h),m[o>>2]=A,1024==(0|(i=i+1|0)))break}m[e+84>>2]=a,m[e+88>>2]=a,m[e+80>>2]=a;break e}if(g=d[(i=(o=e+80|0)+((1<<(n=1<>2],o=d[(n=T=o+(n<<2)|0)>>2],h=y(y(m[e+96>>2]-a)*y(.0009765625)),m[n>>2]=h+m[n>>2],a=y(h+m[i>>2]),m[i>>2]=a,Ri(e)){for(n=0;;){if(A=a,1024==(0|(n=n+1|0)))break e;if(o=d[T>>2],m[T>>2]=h+m[T>>2],a=y(h+m[i>>2]),m[i>>2]=a,!Ri(e))break}l(A),g=c(0)}d[T>>2]=o,d[i>>2]=g}(e=d[t+88>>2])&&(u[t+92|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[t+88>>2]=0),d[t+88>>2]=0,s[t+92|0]=1,d[t+80>>2]=0,d[t+84>>2]=0,(e=d[t+68>>2])&&(u[t+72|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[t+68>>2]=0),d[t+68>>2]=0,s[t+72|0]=1,d[t+60>>2]=0,d[t+64>>2]=0,(e=d[t+48>>2])&&(u[t+52|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[t+48>>2]=0),d[t+48>>2]=0,s[t+52|0]=1,d[t+40>>2]=0,d[t+44>>2]=0,(e=d[t+28>>2])&&(u[t+32|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[t+28>>2]=0),O=t+96|0}function K(e,t,i){var n,o=0,a=0,l=0,c=0,h=0,_=y(0),p=0,f=0,g=0,A=y(0),C=y(0),S=0,T=0,E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0);O=n=O-32|0,C=m[i+8>>2],y(v(C))>y(.7071067690849304)?(A=m[i+4>>2],_=y(y(1)/y(x(y(y(C*C)+y(A*A))))),P=y(A*_),E=y(_*y(-C)),_=y(0)):(C=m[i>>2],A=m[i+4>>2],_=y(y(1)/y(x(y(y(C*C)+y(A*A))))),E=y(C*_),_=y(_*y(-A)));e:if((0|(c=d[e+4>>2]))>=2){for(o=d[e+12>>2];h=b(f,24),y(y(y(_*m[(a=h+o|0)>>2])+y(E*m[a+4>>2]))+y(P*m[a+8>>2]))>2])+y(E*m[o+4>>2]))+y(P*m[o+8>>2]))&&(l=d[o+20>>2],d[n+24>>2]=d[o+16>>2],d[n+28>>2]=l,l=d[o+12>>2],d[n+16>>2]=d[o+8>>2],d[n+20>>2]=l,l=d[o+4>>2],d[n+8>>2]=d[o>>2],d[n+12>>2]=l,l=d[a+4>>2],d[o>>2]=d[a>>2],d[o+4>>2]=l,l=d[a+12>>2],d[o+8>>2]=d[a+8>>2],d[o+12>>2]=l,l=d[a+20>>2],d[o+16>>2]=d[a+16>>2],d[o+20>>2]=l,a=d[n+12>>2],l=h+d[e+12>>2]|0,d[(o=l)>>2]=d[n+8>>2],d[o+4>>2]=a,a=d[n+28>>2],d[o+16>>2]=d[n+24>>2],d[o+20>>2]=a,a=d[n+20>>2],d[o+8>>2]=d[n+16>>2],d[o+12>>2]=a,c=d[e+4>>2],o=d[e+12>>2]),(0|(f=f+1|0))<(0|c););if(d[o+16>>2]=-246811958,(0|c)>=2)for(D=m[o+8>>2],C=m[o+4>>2],A=m[o>>2],f=1;a=b(f,24)+o|0,I=y(m[a+4>>2]-C),M=y(m[a>>2]-A),R=y(m[a+8>>2]-D),m[a+16>>2]=y(y(y(y(_*I)-y(E*M))*m[i+8>>2])+y(y(m[i>>2]*y(y(E*R)-y(P*I)))+y(m[i+4>>2]*y(y(P*M)-y(_*R)))))/y(x(y(y(y(M*M)+y(I*I))+y(R*R)))),(0|(f=f+1|0))!=(0|c););if(a=d[o+12>>2],d[n+16>>2]=d[o+8>>2],d[n+20>>2]=a,a=d[o+4>>2],d[n+8>>2]=d[o>>2],d[n+12>>2]=a,Zt(e,n+8|0,1,c+-1|0),a=d[e+12>>2],(0|(c=d[t+4>>2]))==d[t+8>>2]&&!((0|c)>=(0|(g=c?c<<1:1)))){if(o=0,g&&(d[7717]=d[7717]+1,S=0|r[d[6606]](b(g,24),16),c=d[t+4>>2]),(0|c)>=1)for(;h=T=(l=b(o,24))+S|0,p=l+d[t+12>>2]|0,l=d[p+4>>2],d[h>>2]=d[p>>2],d[h+4>>2]=l,l=d[p+20>>2],d[h+16>>2]=d[p+16>>2],d[h+20>>2]=l,l=d[p+12>>2],d[h+8>>2]=d[p+8>>2],d[h+12>>2]=l,(0|c)!=(0|(o=o+1|0)););(o=d[t+12>>2])&&(u[t+16|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[t+12>>2]=0),d[t+12>>2]=S,s[t+16|0]=1,d[t+8>>2]=g,c=d[t+4>>2]}if(o=d[a+4>>2],h=d[t+12>>2]+b(c,24)|0,d[(l=h)>>2]=d[a>>2],d[l+4>>2]=o,o=d[a+20>>2],d[l+16>>2]=d[a+16>>2],d[l+20>>2]=o,o=d[a+12>>2],d[l+8>>2]=d[a+8>>2],d[l+12>>2]=o,c=d[t+4>>2]+1|0,d[t+4>>2]=c,a=d[e+12>>2],d[t+8>>2]==(0|c)&&!((0|c)>=(0|(g=c?c<<1:1)))){if(o=0,S=0,g&&(d[7717]=d[7717]+1,S=0|r[d[6606]](b(g,24),16),c=d[t+4>>2]),(0|c)>=1)for(;h=T=(l=b(o,24))+S|0,p=l+d[t+12>>2]|0,l=d[p+4>>2],d[h>>2]=d[p>>2],d[h+4>>2]=l,l=d[p+20>>2],d[h+16>>2]=d[p+16>>2],d[h+20>>2]=l,l=d[p+12>>2],d[h+8>>2]=d[p+8>>2],d[h+12>>2]=l,(0|c)!=(0|(o=o+1|0)););(o=d[t+12>>2])&&(u[t+16|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[t+12>>2]=0),d[t+12>>2]=S,s[t+16|0]=1,d[t+8>>2]=g,c=d[t+4>>2]}if(o=d[a+28>>2],h=d[t+12>>2]+b(c,24)|0,d[(l=h)>>2]=d[a+24>>2],d[l+4>>2]=o,o=d[a+44>>2],d[l+16>>2]=d[a+40>>2],d[l+20>>2]=o,o=d[a+36>>2],d[l+8>>2]=d[a+32>>2],d[l+12>>2]=o,a=d[t+4>>2]+1|0,d[t+4>>2]=a,2==(0|(o=d[e+4>>2])))break e;for(S=2;;){if((0|a)>=2){for(l=d[e+12>>2]+b(S,24)|0,w=m[l+8>>2],F=m[l+4>>2],E=m[l>>2],P=m[i+8>>2],I=m[i+4>>2],M=m[i>>2],c=d[t+12>>2],o=a;;){if(a=b(o,24)+c|0,A=m[(h=a+-48|0)>>2],R=y(A-m[(a=a+-24|0)>>2]),_=m[h+4>>2],D=y(_-F),_=y(_-m[a+4>>2]),C=y(A-E),B=y(y(y(R*D)-y(_*C))*P),N=_,_=m[h+8>>2],A=y(_-w),_=y(_-m[a+8>>2]),y(B+y(y(M*y(y(N*A)-y(_*D)))+y(I*y(y(_*C)-y(R*A)))))>y(0)){if(d[t+8>>2]==(0|o)&&!((0|o)>=(0|(T=o<<1)))){if(d[7717]=d[7717]+1,c=0|r[d[6606]](b(o,48),16),o=0,(0|(g=d[t+4>>2]))>=1)for(;h=p=(a=b(o,24))+c|0,f=a+d[t+12>>2]|0,a=d[f+4>>2],d[h>>2]=d[f>>2],d[h+4>>2]=a,a=d[f+20>>2],d[h+16>>2]=d[f+16>>2],d[h+20>>2]=a,a=d[f+12>>2],d[h+8>>2]=d[f+8>>2],d[h+12>>2]=a,(0|g)!=(0|(o=o+1|0)););(a=d[t+12>>2])&&(u[t+16|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[t+12>>2]=0),d[t+12>>2]=c,s[t+16|0]=1,d[t+8>>2]=T,o=d[t+4>>2]}a=d[l+4>>2],h=b(o,24)+c|0,d[(o=h)>>2]=d[l>>2],d[o+4>>2]=a,a=d[l+20>>2],d[o+16>>2]=d[l+16>>2],d[o+20>>2]=a,a=d[l+12>>2],d[o+8>>2]=d[l+8>>2],d[o+12>>2]=a,a=d[t+4>>2]+1|0,d[t+4>>2]=a}else if(a=o+-1|0,d[t+4>>2]=a,h=(0|o)>2,o=a,h)continue;break}o=d[e+4>>2]}if((0|(S=S+1|0))==(0|o))break}}else if(1==(0|c))for(c=d[t+4>>2];;){if(a=d[e+12>>2],d[t+8>>2]==(0|c)&&!((0|c)>=(0|(g=c?c<<1:1)))){if(o=0,i=0,g&&(d[7717]=d[7717]+1,i=0|r[d[6606]](b(g,24),16),c=d[t+4>>2]),(0|c)>=1)for(;h=T=(l=b(o,24))+i|0,p=l+d[t+12>>2]|0,l=d[p+4>>2],d[h>>2]=d[p>>2],d[h+4>>2]=l,l=d[p+20>>2],d[h+16>>2]=d[p+16>>2],d[h+20>>2]=l,l=d[p+12>>2],d[h+8>>2]=d[p+8>>2],d[h+12>>2]=l,(0|c)!=(0|(o=o+1|0)););(o=d[t+12>>2])&&(u[t+16|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[t+12>>2]=0),d[t+12>>2]=i,s[t+16|0]=1,d[t+8>>2]=g,c=d[t+4>>2]}if(i=d[a+4>>2],l=d[t+12>>2]+b(c,24)|0,d[(o=l)>>2]=d[a>>2],d[o+4>>2]=i,i=d[a+20>>2],d[o+16>>2]=d[a+16>>2],d[o+20>>2]=i,i=d[a+12>>2],d[o+8>>2]=d[a+8>>2],d[o+12>>2]=i,c=d[t+4>>2]+1|0,d[t+4>>2]=c,!((0|(f=f+1|0))>2]))break}O=n+32|0}function Z(e,t,i,n,r,s,o,a,l){var c,h,_,p,f,g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=y(0);p=(_=d[e+16>>2])+b(n,244)|0,c=d[p+240>>2],f=b(i,244)+_|0,h=d[f+240>>2],d[o>>2]=1065353216,g=m[r+68>>2],v=m[a>>2],A=m[a+4>>2],C=m[r+64>>2],T=y(y(g*v)-y(A*C)),S=m[a+8>>2],R=y(S*C),C=m[r+72>>2],E=y(R-y(C*v)),P=y(y(A*C)-y(S*g)),g=y(0),v=y(0),A=y(0),h&&(A=y(y(y(y(P*m[h+296>>2])+y(E*m[h+300>>2]))+y(T*m[h+304>>2]))*m[h+552>>2]),v=y(y(y(y(P*m[h+280>>2])+y(E*m[h+284>>2]))+y(T*m[h+288>>2]))*m[h+548>>2]),g=y(y(y(y(P*m[h+264>>2])+y(E*m[h+268>>2]))+y(T*m[h+272>>2]))*m[h+544>>2])),m[t+64>>2]=g,d[t+76>>2]=0,m[t+72>>2]=A,m[t+68>>2]=v,C=m[r+68>>2],S=m[l>>2],I=m[l+4>>2],D=m[r+64>>2],O=y(y(C*S)-y(I*D)),R=m[l+8>>2],M=m[r+72>>2],D=y(y(R*D)-y(M*S)),I=y(y(I*M)-y(R*C)),C=y(0),S=y(0),c&&(x=y(-D),S=y(y(y(y(m[c+300>>2]*x)-y(I*m[c+296>>2]))-y(O*m[c+304>>2]))*m[c+552>>2]),C=y(y(y(y(m[c+284>>2]*x)-y(I*m[c+280>>2]))-y(O*m[c+288>>2]))*m[c+548>>2]),x=y(y(y(y(m[c+268>>2]*x)-y(I*m[c+264>>2]))-y(O*m[c+272>>2]))*m[c+544>>2])),m[t+80>>2]=x,d[t+92>>2]=0,m[t+88>>2]=S,m[t+84>>2]=C,e=t,w=m[o>>2],h?(M=m[a+8>>2],F=m[a+4>>2],B=y(y(y(v*M)-y(A*F))*m[r+64>>2]),R=A,A=m[a>>2],v=y(m[h+344>>2]+y(y(B+y(y(y(R*A)-y(M*g))*m[r+68>>2]))+y(y(y(F*g)-y(v*A))*m[r+72>>2])))):v=y(0),R=v,c?(v=m[l+4>>2],A=m[l+8>>2],g=y(y(y(S*v)-y(C*A))*m[r+64>>2]),M=y(x*A),A=m[l>>2],v=y(m[c+344>>2]+y(y(g+y(y(M-y(S*A))*m[r+68>>2]))+y(y(y(C*A)-y(x*v))*m[r+72>>2])))):v=y(0),m[e+108>>2]=w/y(R+v),h?(o=d[4+(e=r- -64|0)>>2],d[t+16>>2]=d[e>>2],d[t+20>>2]=o,o=d[e+12>>2],d[t+24>>2]=d[e+8>>2],d[t+28>>2]=o,d[t+12>>2]=0,m[t+8>>2]=T,m[t+4>>2]=E,m[t>>2]=P):(d[t>>2]=0,d[t+4>>2]=0,d[t+24>>2]=0,d[t+28>>2]=0,d[t+16>>2]=0,d[t+20>>2]=0,d[t+8>>2]=0,d[t+12>>2]=0),c?(g=m[r+64>>2],v=m[r+68>>2],A=m[r+72>>2],d[t+60>>2]=0,d[t+44>>2]=0,m[t+40>>2]=-O,m[t+36>>2]=-D,m[t+32>>2]=-I,m[t+56>>2]=-A,m[t+52>>2]=-v,m[t+48>>2]=-g):(d[t+32>>2]=0,d[t+36>>2]=0,d[t+56>>2]=0,d[t+60>>2]=0,d[t+48>>2]=0,d[t+52>>2]=0,d[t+40>>2]=0,d[t+44>>2]=0),M=m[s+56>>2],F=m[r+80>>2],x=y(0),g=y(0),v=y(0),A=y(0),h&&(g=m[a+4>>2],v=m[h+328>>2],C=m[h+332>>2],S=m[a>>2],A=y(y(y(g*v)-y(C*S))+m[h+320>>2]),T=m[h+336>>2],R=y(T*S),S=m[a+8>>2],v=y(m[h+316>>2]+y(R-y(S*v))),g=y(y(y(C*S)-y(T*g))+m[h+312>>2])),C=y(0),S=y(0),c&&(x=m[l+4>>2],C=m[c+328>>2],T=m[c+332>>2],E=m[l>>2],S=y(y(y(x*C)-y(T*E))+m[c+320>>2]),P=m[c+336>>2],R=y(P*E),E=m[l+8>>2],C=y(m[c+316>>2]+y(R-y(E*C))),x=y(y(y(T*E)-y(P*x))+m[c+312>>2])),T=m[r+72>>2],E=m[r+64>>2],P=m[r+68>>2],d[t+104>>2]=d[r+84>>2],x=y(-y(y(y(E*y(g-x))+y(P*y(v-C)))+y(T*y(A-S)))),w=m[r+92>>2];e:if(4&u[s+64|0]){if(g=y(m[r+120>>2]*m[s+60>>2]),m[t+100>>2]=g,!h|!d[f+240>>2]||(v=m[h+356>>2],A=m[t+24>>2],C=m[h+352>>2],S=m[t+20>>2],e=b(i,244)+_|0,m[e+64>>2]=y(m[e+112>>2]*y(g*y(y(m[t+16>>2]*m[e+128>>2])*m[h+348>>2])))+m[e+64>>2],m[e+68>>2]=y(y(g*y(C*y(S*m[e+132>>2])))*m[e+116>>2])+m[e+68>>2],m[e+72>>2]=y(y(g*y(v*y(A*m[e+136>>2])))*m[e+120>>2])+m[e+72>>2],v=m[t+72>>2],A=m[t+68>>2],m[e+80>>2]=y(y(g*m[e+96>>2])*m[t+64>>2])+m[e+80>>2],C=m[e+104>>2],m[e+84>>2]=y(A*y(g*m[e+100>>2]))+m[e+84>>2],m[e+88>>2]=y(v*y(g*C))+m[e+88>>2]),!c|!d[p+240>>2])break e;v=m[c+356>>2],A=m[t+56>>2],C=m[c+352>>2],S=m[t+52>>2],T=m[t+88>>2],E=m[t+84>>2],P=m[t+80>>2],e=b(n,244)+_|0,g=y(-m[t+100>>2]),m[e+64>>2]=m[e+64>>2]-y(m[e+112>>2]*y(y(y(m[e+128>>2]*m[t+48>>2])*m[c+348>>2])*g)),m[e+68>>2]=m[e+68>>2]-y(y(y(C*y(S*m[e+132>>2]))*g)*m[e+116>>2]),m[e+72>>2]=m[e+72>>2]-y(y(y(v*y(A*m[e+136>>2]))*g)*m[e+120>>2]),m[e+80>>2]=m[e+80>>2]-y(P*y(m[e+96>>2]*g)),v=m[e+104>>2],m[e+84>>2]=m[e+84>>2]-y(E*y(m[e+100>>2]*g)),m[e+88>>2]=m[e+88>>2]-y(T*y(v*g))}else d[t+100>>2]=0;d[t+96>>2]=0,g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),d[f+240>>2]&&(e=b(i,244)+_|0,E=m[e+224>>2],C=m[e+208>>2],S=m[e+232>>2],T=m[e+228>>2],A=m[e+212>>2],v=m[e+216>>2]),P=y(0),O=y(0),I=y(0),D=y(0),R=y(0),d[p+240>>2]&&(e=b(n,244)+_|0,R=m[e+224>>2],I=m[e+232>>2],D=m[e+228>>2],O=m[e+216>>2],P=m[e+212>>2],g=m[e+208>>2]),w=(x=y(w*x))<=y(0)?y(0):x,e=b(i,244)+_|0,v=y(y(y(y(y(C+m[e+176>>2])*m[t+16>>2])+y(y(A+m[e+180>>2])*m[t+20>>2]))+y(y(v+m[e+184>>2])*m[t+24>>2]))+y(y(y(y(E+m[e+192>>2])*m[t>>2])+y(y(T+m[e+196>>2])*m[t+4>>2]))+y(y(S+m[e+200>>2])*m[t+8>>2]))),e=b(n,244)+_|0,g=y(v+y(y(y(y(y(g+m[e+176>>2])*m[t+48>>2])+y(y(P+m[e+180>>2])*m[t+52>>2]))+y(y(O+m[e+184>>2])*m[t+56>>2]))+y(y(y(y(R+m[e+192>>2])*m[t+32>>2])+y(y(D+m[e+196>>2])*m[t+36>>2]))+y(y(I+m[e+200>>2])*m[t+40>>2])))),e=s+36|0,!(i=d[s+44>>2])|!!((x=y(F+M))>m[s+48>>2])&&(e=s+32|0),g=y(w-g),v=y(0),x>y(0)?g=y(g-y(x/m[s+12>>2])):v=y(y(m[e>>2]*y(-x))/m[s+12>>2]),A=m[t+108>>2],g=y(g*A),v=y(v*A),e=t,x>m[s+48>>2]^1&&i||(g=y(v+g),v=y(0)),m[e+128>>2]=v,m[t+112>>2]=g,d[t+124>>2]=1343554297,d[t+116>>2]=0,d[t+120>>2]=0}function $(e,t,i,n,o,a,l,c){var h=y(0),_=y(0),p=y(0),f=0,g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=0,E=0,R=y(0),P=0,I=y(0),M=y(0),D=y(0),O=y(0),w=0,F=0,B=0,N=y(0);if(!t)return 0;for((0|(E=d[e+24>>2]))<=-1&&(f=d[e+32>>2],d[e+28>>2]<=-1&&(!f|!u[e+36|0]||f&&(d[7718]=d[7718]+1,r[d[6607]](f)),s[e+36|0]=1,d[e+28>>2]=0,d[e+32>>2]=0,f=0),Mn((T=f)+(f=E<<2)|0,0,0-f|0)),d[e+24>>2]=0,d[o>>2]=0,d[c+8>>2]=1065353216,d[c>>2]=1065353216,d[c+4>>2]=1065353216,E=t>>>0>1?t:1,b=y(34028234663852886e22),S=y(-34028234663852886e22),x=y(-34028234663852886e22),A=y(34028234663852886e22),C=y(-34028234663852886e22),_=y(34028234663852886e22),f=i;(h=m[f>>2])<_&&(_=h,h=m[f>>2]),g=h,T=h>C,(h=m[f+4>>2])>2]),C=T?g:C,x=h>x?h:x,(h=m[f+8>>2])>2]),S=h>S?h:S,f=n+f|0,(0|E)!=(0|(P=P+1|0)););if(h=y(S-b),S=y(b+y(h*y(.5))),g=y(x-A),x=y(A+y(g*y(.5))),b=_,_=y(C-_),C=y(b+y(_*y(.5))),t>>>0<3|_y(9.999999974752427e-7)&&_y(9.999999974752427e-7)&&gy(9.999999974752427e-7)&&h>2]=h,_=y(x+b),m[a+116>>2]=_,g=y(C-A),m[a+112>>2]=g,m[a+104>>2]=h,m[a+100>>2]=_,A=y(C+A),m[a+96>>2]=A,m[a+88>>2]=h,b=y(x-b),m[a+84>>2]=b,m[a+80>>2]=A,m[a+72>>2]=h,m[a+68>>2]=b,m[a+64>>2]=g,l=y(S-l),m[a+56>>2]=l,m[a+52>>2]=_,m[a+48>>2]=g,m[a+40>>2]=l,m[a+36>>2]=_,m[a+32>>2]=A,m[a+24>>2]=l,m[a+20>>2]=b,m[a+16>>2]=A,m[a+8>>2]=l,m[a+4>>2]=b,m[a>>2]=g,d[o>>2]=8,1;for(m[c+8>>2]=h,m[c+4>>2]=g,m[c>>2]=_,p=y(y(1)/h),S=y(p*S),I=y(y(1)/g),g=y(I*x),x=y(y(1)/_),_=y(x*C),c=0;;){h=y(p*m[i+8>>2]),b=y(I*m[i+4>>2]),A=y(x*m[i>>2]),f=0;e:{if(c){E=(P=d[o>>2])>>>0>1?P:1;t:{for(;;){if(C=m[(T=(f<<4)+a|0)>>2],y(v(y(C-A)))>2],y(v(y(R-b)))>2],y(v(y(D-h)))y(R+y(C*C))))break t;m[T>>2]=A,m[T+4>>2]=b,m[T+8>>2]=h;break t}if(c=P,(0|E)==(0|(f=f+1|0)))break}f=E}if((0|c)!=(0|f))break e}m[8+(c=(f<<4)+a|0)>>2]=h,m[c+4>>2]=b,m[c>>2]=A,d[o>>2]=f+1}if((0|(c=d[e+24>>2]))==d[e+28>>2]&&!((0|c)>=(0|(T=c?c<<1:1)))){P=0,w=0,T&&(d[7717]=d[7717]+1,w=0|r[d[6606]](T<<2,16),c=d[e+24>>2]),E=d[e+32>>2];e:{t:{if((0|c)>=1)for(;;)if(d[(F=P<<2)+w>>2]=d[E+F>>2],(0|(P=P+1|0))==(0|c))break t;if(!E)break e}u[e+36|0]&&E&&(d[7718]=d[7718]+1,r[d[6607]](E)),d[e+32>>2]=0,c=d[e+24>>2]}d[e+32>>2]=w,s[e+36|0]=1,d[e+28>>2]=T}if(i=i+n|0,d[d[e+32>>2]+(c<<2)>>2]=f,d[e+24>>2]=d[e+24>>2]+1,c=d[o>>2],(0|(B=B+1|0))==(0|t))break}if(_=y(-34028234663852886e22),l=y(34028234663852886e22),c){for(f=0,b=y(34028234663852886e22),I=y(-34028234663852886e22),A=y(34028234663852886e22),R=y(-34028234663852886e22),S=y(-34028234663852886e22),x=y(34028234663852886e22),C=y(-34028234663852886e22),g=y(34028234663852886e22),h=y(-34028234663852886e22),D=y(34028234663852886e22);S=(t=(p=m[8+(e=(f<<4)+a|0)>>2])>S)?p:S,_=t?p:_,x=(t=p>2])>C)?p:C,I=t?p:I,g=(t=p>2])>h)?p:h,R=e?p:R,D=(e=p>>0<3}else b=y(34028234663852886e22),I=y(-34028234663852886e22),A=y(34028234663852886e22),R=y(-34028234663852886e22),e=1;return _=y(_-l),S=y(I-b),((x=y(R-A))=y(9.999999974752427e-7)&&x=y(9.999999974752427e-7)&&S=y(9.999999974752427e-7)&&_>2]=l,b=y(I+g),m[a+116>>2]=b,A=y(R-C),m[a+112>>2]=A,m[a+104>>2]=l,m[a+100>>2]=b,_=y(R+C),m[a+96>>2]=_,m[a+88>>2]=l,g=y(I-g),m[a+84>>2]=g,m[a+80>>2]=_,m[a+72>>2]=l,m[a+68>>2]=g,m[a+64>>2]=A,l=y(p-h),m[a+56>>2]=l,m[a+52>>2]=b,m[a+48>>2]=A,m[a+40>>2]=l,m[a+36>>2]=b,m[a+32>>2]=_,m[a+24>>2]=l,m[a+20>>2]=g,m[a+16>>2]=_,m[a+8>>2]=l,m[a+4>>2]=g,m[a>>2]=A,d[o>>2]=8),1}function J(e,t,i,n){var s,o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=0,I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=0,N=y(0),L=0,k=0,V=0,U=0;O=s=O-672|0,d[4+(o=s+456|0)>>2]=35,d[o+8>>2]=0,d[o>>2]=13316,d[o+44>>2]=1025758986,d[o+20>>2]=1065353216,d[o+24>>2]=0,d[o+12>>2]=1065353216,d[o+16>>2]=1065353216,d[o>>2]=13444,m[s+500>>2]=0,m[s+484>>2]=0,d[s+456>>2]=11556,d[s+460>>2]=8,d[s+404>>2]=0,d[s+408>>2]=0,d[s+416>>2]=0,d[s+420>>2]=0,d[s+412>>2]=1065353216,d[s+432>>2]=1065353216,d[s+436>>2]=0,d[s+396>>2]=0,d[s+400>>2]=0,d[s+392>>2]=1065353216,d[s+424>>2]=0,d[s+428>>2]=0,o=d[e+12>>2],d[s+448>>2]=d[e+8>>2],d[s+452>>2]=o,o=d[e+4>>2],d[s+440>>2]=d[e>>2],d[s+444>>2]=o,d[n+32>>2]=0,d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=0,d[n+20>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,d[n>>2]=0,d[n+4>>2]=0,d[s+512>>2]=t,d[s+516>>2]=s+456,a=m[i+36>>2],c=m[i+20>>2],l=m[i+40>>2],h=m[i+24>>2],v=m[i+32>>2],A=m[i>>2],g=m[i+16>>2],u=m[i+4>>2],_=m[i+8>>2],d[s+564>>2]=0,d[s+548>>2]=0,d[s+532>>2]=0,p=y(_*y(0)),C=y(h*y(0)),E=y(l+y(p+C)),m[s+560>>2]=E,b=y(u*y(0)),S=y(c*y(0)),M=y(a+y(b+S)),m[s+556>>2]=M,T=y(A*y(0)),R=y(g*y(0)),N=y(v+y(T+R)),m[s+552>>2]=N,D=y(p+h),p=y(l*y(0)),D=y(D+p),m[s+544>>2]=D,w=y(b+c),b=y(a*y(0)),w=y(w+b),m[s+540>>2]=w,F=y(T+g),T=y(v*y(0)),F=y(F+T),m[s+536>>2]=F,p=y(y(_+C)+p),m[s+528>>2]=p,C=y(y(u+S)+b),m[s+524>>2]=C,b=y(y(A+R)+T),m[s+520>>2]=b,S=m[i+52>>2],T=m[i+56>>2],R=m[i+48>>2],d[s+636>>2]=0,d[s+628>>2]=0,d[s+612>>2]=0,m[s+608>>2]=E,m[s+604>>2]=D,m[s+600>>2]=p,d[s+596>>2]=0,m[s+592>>2]=M,m[s+588>>2]=w,m[s+584>>2]=C,d[s+580>>2]=0,m[s+576>>2]=N,m[s+572>>2]=F,p=_,_=y(m[s+440>>2]-R),C=h,h=y(m[s+444>>2]-S),S=l,l=y(m[s+448>>2]-T),m[s+624>>2]=y(y(p*_)+y(C*h))+y(S*l),m[s+620>>2]=y(y(_*u)+y(h*c))+y(l*a),m[s+616>>2]=y(y(_*A)+y(h*g))+y(l*v),d[s+632>>2]=98,m[s+568>>2]=b,d[s+144>>2]=0,d[s+148>>2]=0,d[s+136>>2]=0,d[s+140>>2]=0,d[s+372>>2]=0,d[s+376>>2]=0,d[s+384>>2]=2,d[s+152>>2]=0,d[s+664>>2]=1065353216,d[s+668>>2]=0,d[s+656>>2]=1065353216,d[s+660>>2]=1065353216,a=y(34028234663852886e22);e:{t:switch(0|Q(s+8|0,s+512|0,s+656|0)){case 0:if(a=y(0),l=y(0),h=y(0),v=y(0),A=y(0),o=d[s+380>>2],d[o+32>>2])for(e=0;c=m[16+(P=(L=e<<2)+o|0)>>2],o=d[s+632>>2],B=s+656|0,k=d[s+636>>2],U=V=d[s+512>>2]+(k>>1)|0,P=d[P>>2],1&k&&(o=d[o+d[V>>2]>>2]),r[o](B,U,P),B=d[s+636>>2],P=d[s+516>>2]+(B>>1)|0,p=y(c*m[s+664>>2]),C=y(c*m[s+660>>2]),E=y(c*m[s+656>>2]),o=d[d[s+380>>2]+L>>2],g=m[o+8>>2],u=m[o>>2],_=y(-m[o+4>>2]),o=d[s+632>>2],o=1&B?d[d[P>>2]+o>>2]:o,A=y(A+p),v=y(v+C),h=y(h+E),d[s+652>>2]=0,m[s+648>>2]=y(y(m[s+556>>2]*_)-y(u*m[s+552>>2]))-y(g*m[s+560>>2]),m[s+644>>2]=y(y(m[s+540>>2]*_)-y(u*m[s+536>>2]))-y(g*m[s+544>>2]),m[s+640>>2]=y(y(m[s+524>>2]*_)-y(u*m[s+520>>2]))-y(g*m[s+528>>2]),r[o](s+656|0,P,s+640|0),g=m[s+656>>2],u=m[s+660>>2],_=m[s+664>>2],l=y(l+y(c*y(y(y(y(g*m[s+600>>2])+y(u*m[s+604>>2]))+y(_*m[s+608>>2]))+m[s+624>>2]))),a=y(a+y(c*y(y(y(y(g*m[s+584>>2])+y(u*m[s+588>>2]))+y(_*m[s+592>>2]))+m[s+620>>2]))),I=y(I+y(c*y(y(y(y(g*m[s+568>>2])+y(u*m[s+572>>2]))+y(_*m[s+576>>2]))+m[s+616>>2]))),e=e+1|0,o=d[s+380>>2],e>>>0>2];);c=m[i+48>>2],g=m[i+8>>2],u=m[i>>2],_=m[i+4>>2],p=m[i+52>>2],C=m[i+24>>2],E=m[i+16>>2],b=m[i+20>>2],S=m[i+56>>2],M=m[i+40>>2],T=m[i+32>>2],R=m[i+36>>2],d[n+16>>2]=0,S=y(S+y(y(y(h*T)+y(v*R))+y(A*M))),m[n+12>>2]=S,p=y(p+y(y(y(h*E)+y(v*b))+y(A*C))),m[n+8>>2]=p,c=y(c+y(y(y(h*u)+y(v*_))+y(A*g))),m[n+4>>2]=c,h=m[i+48>>2],v=m[i+8>>2],A=m[i>>2],g=m[i+4>>2],u=m[i+52>>2],_=m[i+24>>2],C=m[i+16>>2],E=m[i+20>>2],b=m[i+56>>2],M=m[i+40>>2],T=m[i+32>>2],R=m[i+36>>2],d[n+32>>2]=0,b=y(b+y(y(y(I*T)+y(a*R))+y(l*M))),m[n+28>>2]=b,u=y(u+y(y(y(I*C)+y(a*E))+y(l*_))),m[n+24>>2]=u,a=y(h+y(y(y(I*A)+y(a*g))+y(l*v))),m[n+20>>2]=a,v=Co(t),A=Co(s+456|0),d[n+48>>2]=0,c=y(a-c),l=y(u-p),h=y(b-S),I=y(x(y(y(y(c*c)+y(l*l))+y(h*h)))),a=y(y(1)/I),h=y(h*a),m[n+44>>2]=h,l=y(l*a),m[n+40>>2]=l,c=y(c*a),m[n+36>>2]=c,a=y(v+A),m[n+4>>2]=y(a*c)+m[n+4>>2],m[n+8>>2]=y(a*l)+m[n+8>>2],m[n+12>>2]=y(a*h)+m[n+12>>2],a=y(I-a);break e;case 1:break t;default:break e}_e(t,i,s+456|0,s+392|0,s+136|0,n,1)&&(a=y(m[n+4>>2]-m[n+20>>2]),c=y(m[n+8>>2]-m[n+24>>2]),l=y(m[n+12>>2]-m[n+28>>2]),(h=y(x(y(y(y(a*a)+y(c*c))+y(l*l)))))>=y(1.1920928955078125e-7)&&(d[n+48>>2]=0,_=l,l=y(y(1)/h),m[n+44>>2]=_*l,m[n+40>>2]=c*l,m[n+36>>2]=a*l),a=y(-h))}return O=s+672|0,a}function ee(e,t,i,n,s,o){e|=0,t|=0,i|=0,n|=0,s|=0,o|=0;var a,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=0,A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=0,V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),ie=y(0),ne=0,re=0;O=a=O-96|0,Qs(d[e+4>>2]),Q=m[n+40>>2],q=m[n+36>>2],K=m[n+24>>2],Z=m[n+20>>2],V=m[t+20>>2],U=m[t+36>>2],G=m[t+24>>2],P=m[t+52>>2],c=m[i+52>>2],I=m[n+52>>2],u=m[s+52>>2],j=m[t+40>>2],M=m[t+56>>2],p=m[i+56>>2],D=m[n+56>>2],l=m[s+56>>2],$=m[n+32>>2],J=m[n+16>>2],ee=m[n+8>>2],te=m[n+4>>2],ie=m[n>>2],W=m[t>>2],z=m[t+16>>2],H=m[t+32>>2],X=m[t+4>>2],Y=m[t+8>>2],w=m[t+48>>2],h=m[i+48>>2],F=m[n+48>>2],_=m[s+48>>2],v=d[e+8>>2],d[a+60>>2]=0,E=y(y(c-P)-y(u-I)),c=y(-E),A=y(y(h-w)-y(_-F)),C=y(y(p-M)-y(l-D)),m[a+56>>2]=y(y(G*c)-y(Y*A))-y(j*C),m[a+52>>2]=y(y(V*c)-y(A*X))-y(C*U),m[a+48>>2]=y(y(z*c)-y(A*W))-y(C*H),r[d[d[v>>2]+64>>2]](a+80|0,v,a+48|0),l=m[t+52>>2],h=m[t+24>>2],_=m[t+20>>2],c=m[t+56>>2],p=m[t+40>>2],u=m[t+36>>2],f=m[t+48>>2],g=m[t+8>>2],b=m[t>>2],T=m[t+4>>2],R=m[t+16>>2],S=m[t+32>>2],d[a+76>>2]=0,B=c,c=m[a+80>>2],N=u,u=m[a+84>>2],L=p,p=m[a+88>>2],m[a+72>>2]=B+y(y(y(S*c)+y(N*u))+y(L*p)),m[a+68>>2]=l+y(y(y(c*R)+y(u*_))+y(p*h)),m[a+64>>2]=f+y(y(y(c*b)+y(u*T))+y(p*g)),v=d[e+12>>2],c=m[n+20>>2],u=m[n+36>>2],p=m[n+24>>2],l=m[n+40>>2],h=m[n>>2],_=m[n+16>>2],f=m[n+32>>2],g=m[n+4>>2],b=m[n+8>>2],d[a+28>>2]=0,m[a+24>>2]=y(y(A*b)+y(E*p))+y(C*l),m[a+20>>2]=y(y(A*g)+y(E*c))+y(C*u),m[a+16>>2]=y(y(A*h)+y(E*_))+y(C*f),r[d[d[v>>2]+64>>2]](a+32|0,v,a+16|0),l=m[n+52>>2],h=m[n+24>>2],_=m[n+20>>2],c=m[n+56>>2],p=m[n+40>>2],u=m[n+36>>2],f=m[n+16>>2],g=m[n+48>>2],b=m[n+8>>2],T=m[n>>2],R=m[n+4>>2],S=m[n+32>>2],d[a+60>>2]=0,d[a+92>>2]=0,B=c,c=m[a+32>>2],N=u,u=m[a+36>>2],L=p,p=m[a+40>>2],S=y(B+y(y(y(S*c)+y(N*u))+y(L*p))),m[a+56>>2]=S,g=y(g+y(y(y(c*T)+y(u*R))+y(p*b))),m[a+48>>2]=g,c=y(l+y(y(y(c*f)+y(u*_))+y(p*h))),m[a+52>>2]=c,l=y(m[a+68>>2]-c),m[a+84>>2]=l,h=y(m[a+64>>2]-g),m[a+80>>2]=h,_=y(m[a+72>>2]-S),m[a+88>>2]=_,c=y(0),u=y(0),p=y(0),f=y(0);e:{t:if(y(y(y(h*h)+y(l*l))+y(_*_))>y(9999999747378752e-20))for(v=32;;){if(!v)break t;if(k=d[e+8>>2],d[a+12>>2]=0,l=y(-m[a+84>>2]),h=m[a+80>>2],_=m[a+88>>2],m[a+8>>2]=y(y(G*l)-y(Y*h))-y(j*_),m[a+4>>2]=y(y(V*l)-y(X*h))-y(U*_),m[a>>2]=y(y(z*l)-y(W*h))-y(H*_),r[d[d[k>>2]+64>>2]](a+16|0,k,a),d[a+76>>2]=0,l=m[a+16>>2],h=m[a+20>>2],_=m[a+24>>2],m[a+72>>2]=M+y(y(y(H*l)+y(U*h))+y(j*_)),m[a+68>>2]=P+y(y(y(z*l)+y(V*h))+y(G*_)),m[a+64>>2]=w+y(y(y(W*l)+y(X*h))+y(Y*_)),k=d[e+12>>2],d[a+12>>2]=0,l=m[a+80>>2],h=m[a+84>>2],_=m[a+88>>2],m[a+8>>2]=y(y(ee*l)+y(K*h))+y(Q*_),m[a+4>>2]=y(y(te*l)+y(Z*h))+y(q*_),m[a>>2]=y(y(ie*l)+y(J*h))+y($*_),r[d[d[k>>2]+64>>2]](a+16|0,k,a),d[a+60>>2]=0,d[a+44>>2]=0,l=m[a+16>>2],h=m[a+20>>2],_=m[a+24>>2],g=y(D+y(y(y($*l)+y(q*h))+y(Q*_))),m[a+56>>2]=g,g=y(m[a+72>>2]-g),m[a+40>>2]=g,b=y(I+y(y(y(J*l)+y(Z*h))+y(K*_))),m[a+52>>2]=b,b=y(m[a+68>>2]-b),m[a+36>>2]=b,l=y(F+y(y(y(ie*l)+y(te*h))+y(ee*_))),m[a+48>>2]=l,T=y(m[a+64>>2]-l),m[a+32>>2]=T,f>y(1))break e;if(l=m[a+80>>2],h=m[a+84>>2],_=m[a+88>>2],(R=y(y(y(T*l)+y(b*h))+y(g*_)))>y(0)){if((c=y(y(y(A*l)+y(E*h))+y(C*_)))>=y(-14210854715202004e-30))break e;u=m[t+48>>2],p=m[i+48>>2],P=m[t+52>>2],w=m[i+52>>2],M=m[t+56>>2],S=m[i+56>>2],F=m[n+48>>2],B=m[s+48>>2],I=m[n+52>>2],N=m[s+52>>2],D=m[n+56>>2],L=m[s+56>>2],d[a+44>>2]=0,m[a+40>>2]=g,m[a+36>>2]=b,m[a+32>>2]=T,f=y(f-y(R/c)),c=y(y(1)-f),D=y(y(D*c)+y(f*L)),I=y(y(c*I)+y(f*N)),F=y(y(c*F)+y(f*B)),M=y(y(c*M)+y(f*S)),P=y(y(c*P)+y(f*w)),w=y(y(c*u)+y(f*p)),ne=d[a+92>>2],u=h,p=_,c=l}if(Vr(d[e+4>>2],a+32|0)||xr(d[e+4>>2],a+32|0,a- -64|0,a+48|0),!qa(d[e+4>>2],a+80|0))break t;if(v=v+-1|0,l=m[a+80>>2],h=y(l*l),l=m[a+84>>2],h=y(h+y(l*l)),l=m[a+88>>2],!(y(h+y(l*l))>y(9999999747378752e-20)))break}m[o+164>>2]=f,(l=y(y(y(c*c)+y(u*u))+y(p*p)))>=y(14210854715202004e-30)?(d[o+144>>2]=ne,h=p,p=y(y(1)/y(x(l))),f=y(h*p),m[o+140>>2]=f,u=y(u*p),m[o+136>>2]=u,c=y(c*p),m[o+132>>2]=c):(d[o+132>>2]=0,d[o+136>>2]=0,d[o+140>>2]=0,d[o+144>>2]=0,f=y(0),u=y(0),c=y(0)),y(y(y(A*c)+y(E*u))+y(C*f))>=y(-m[o+172>>2])||(io(d[e+4>>2],a+16|0,a),e=d[a+12>>2],d[o+156>>2]=d[a+8>>2],d[o+160>>2]=e,e=d[a+4>>2],d[o+148>>2]=d[a>>2],d[o+152>>2]=e,re=1)}return O=a+96|0,0|re}function te(e,t,i){var n,r,s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0);n=u[e+180|0],u[e+48|0]&&!n?(M=m[i+52>>2],D=m[i+56>>2],g=m[e+164>>2],b=m[e+168>>2],v=m[e+172>>2],s=m[i+20>>2],o=m[i+24>>2],A=m[e+132>>2],P=m[e+148>>2],C=m[e+120>>2],S=m[e+136>>2],x=m[e+152>>2],I=m[e+124>>2],a=m[i+36>>2],T=m[e+140>>2],_=m[i+40>>2],E=m[e+156>>2],O=m[i+48>>2],c=m[i+8>>2],l=m[i>>2],h=m[i+4>>2],p=m[i+16>>2],R=m[e+116>>2],f=m[i+32>>2],d[e+884>>2]=0,d[e+868>>2]=0,d[e+852>>2]=0,d[e+836>>2]=0,m[e+864>>2]=y(y(I*f)+y(T*a))+y(E*_),m[e+860>>2]=y(y(C*f)+y(S*a))+y(x*_),m[e+856>>2]=y(y(R*f)+y(A*a))+y(P*_),m[e+848>>2]=y(y(I*p)+y(T*s))+y(E*o),m[e+844>>2]=y(y(C*p)+y(S*s))+y(x*o),m[e+840>>2]=y(y(R*p)+y(A*s))+y(P*o),m[e+832>>2]=y(y(l*I)+y(h*T))+y(c*E),m[e+828>>2]=y(y(l*C)+y(h*S))+y(c*x),m[e+824>>2]=y(y(R*l)+y(A*h))+y(P*c),m[e+880>>2]=D+y(y(y(f*g)+y(a*b))+y(_*v)),m[e+876>>2]=M+y(y(y(p*g)+y(s*b))+y(o*v)),m[e+872>>2]=O+y(y(y(l*g)+y(h*b))+y(c*v)),s=m[t+16>>2],h=m[e+100>>2],o=m[t+20>>2],p=m[e+104>>2],a=m[t+24>>2],f=m[e+108>>2],g=y(y(y(s*h)+y(o*p))+y(a*f)),b=m[e+60>>2],_=m[t+32>>2],v=m[e+76>>2],c=m[t+36>>2],A=m[e+92>>2],l=m[t+40>>2],P=y(y(y(b*_)+y(v*c))+y(A*l)),C=m[e+56>>2],S=m[e+72>>2],x=m[e+88>>2],I=y(y(y(C*_)+y(S*c))+y(x*l)),T=m[e+52>>2],E=m[e+68>>2],R=m[e+84>>2],M=y(y(y(T*_)+y(E*c))+y(R*l)),D=y(y(y(b*s)+y(v*o))+y(A*a)),O=y(y(y(C*s)+y(S*o))+y(x*a)),w=y(y(y(T*s)+y(E*o))+y(R*a)),l=y(l*f),_=y(y(_*h)+y(c*p)),s=m[t>>2],o=m[t+4>>2],a=m[t+8>>2],h=y(y(y(s*h)+y(o*p))+y(a*f)),p=y(y(y(s*b)+y(o*v))+y(a*A)),c=y(y(y(s*C)+y(o*S))+y(a*x)),i=t,s=y(y(y(T*s)+y(E*o))+y(R*a))):(M=m[t+52>>2],D=m[t+56>>2],g=m[e+100>>2],b=m[e+104>>2],v=m[e+108>>2],s=m[t+20>>2],o=m[t+24>>2],A=m[e+68>>2],P=m[e+84>>2],C=m[e+56>>2],S=m[e+72>>2],x=m[e+88>>2],I=m[e+60>>2],a=m[t+36>>2],T=m[e+76>>2],_=m[t+40>>2],E=m[e+92>>2],O=m[t+48>>2],c=m[t+8>>2],l=m[t>>2],h=m[t+4>>2],p=m[t+16>>2],R=m[e+52>>2],f=m[t+32>>2],d[e+884>>2]=0,d[e+868>>2]=0,d[e+852>>2]=0,d[e+836>>2]=0,m[e+864>>2]=y(y(I*f)+y(T*a))+y(E*_),m[e+860>>2]=y(y(C*f)+y(S*a))+y(x*_),m[e+856>>2]=y(y(R*f)+y(A*a))+y(P*_),m[e+848>>2]=y(y(I*p)+y(T*s))+y(E*o),m[e+844>>2]=y(y(C*p)+y(S*s))+y(x*o),m[e+840>>2]=y(y(R*p)+y(A*s))+y(P*o),m[e+832>>2]=y(y(l*I)+y(h*T))+y(c*E),m[e+828>>2]=y(y(l*C)+y(h*S))+y(c*x),m[e+824>>2]=y(y(R*l)+y(A*h))+y(P*c),m[e+880>>2]=D+y(y(y(f*g)+y(a*b))+y(_*v)),m[e+876>>2]=M+y(y(y(p*g)+y(s*b))+y(o*v)),m[e+872>>2]=O+y(y(y(l*g)+y(h*b))+y(c*v)),s=m[i+16>>2],h=m[e+164>>2],o=m[i+20>>2],p=m[e+168>>2],a=m[i+24>>2],f=m[e+172>>2],g=y(y(y(s*h)+y(o*p))+y(a*f)),b=m[e+124>>2],_=m[i+32>>2],v=m[e+140>>2],c=m[i+36>>2],A=m[e+156>>2],l=m[i+40>>2],P=y(y(y(b*_)+y(v*c))+y(A*l)),C=m[e+120>>2],S=m[e+136>>2],x=m[e+152>>2],I=y(y(y(C*_)+y(S*c))+y(x*l)),T=m[e+116>>2],E=m[e+132>>2],R=m[e+148>>2],M=y(y(y(T*_)+y(E*c))+y(R*l)),D=y(y(y(b*s)+y(v*o))+y(A*a)),O=y(y(y(C*s)+y(S*o))+y(x*a)),w=y(y(y(T*s)+y(E*o))+y(R*a)),l=y(l*f),_=y(y(_*h)+y(c*p)),s=m[i>>2],o=m[i+4>>2],a=m[i+8>>2],h=y(y(y(s*h)+y(o*p))+y(a*f)),p=y(y(y(s*b)+y(o*v))+y(a*A)),c=y(y(y(s*C)+y(o*S))+y(a*x)),s=y(y(y(T*s)+y(E*o))+y(R*a))),o=m[i+56>>2],a=m[i+52>>2],m[e+936>>2]=m[i+48>>2]+h,d[e+932>>2]=0,m[e+928>>2]=P,m[e+924>>2]=I,m[e+920>>2]=M,d[e+916>>2]=0,m[e+912>>2]=D,m[e+908>>2]=O,m[e+904>>2]=w,d[e+900>>2]=0,m[e+896>>2]=p,m[e+892>>2]=c,m[e+888>>2]=s,d[e+948>>2]=0,m[e+940>>2]=g+a,m[e+944>>2]=o+y(_+l),t=d[e+876>>2],d[e+968>>2]=d[e+872>>2],d[e+972>>2]=t,t=d[e+884>>2],d[e+976>>2]=d[e+880>>2],d[e+980>>2]=t,t=d[e+948>>2],d[e+992>>2]=d[e+944>>2],d[e+996>>2]=t,t=d[e+940>>2],d[e+984>>2]=d[e+936>>2],d[e+988>>2]=t,a=m[e+840>>2],t=d[e+840>>2],o=m[e+856>>2],i=d[e+856>>2],_=m[e+824>>2],r=d[e+824>>2],d[e+964>>2]=0,d[e+960>>2]=i,d[e+956>>2]=t,d[e+952>>2]=r,t=e,u[e+48|0]||n?(c=m[e+976>>2],l=y(m[e+992>>2]-c),f=m[e+972>>2],h=y(m[e+988>>2]-f),g=m[e+968>>2],s=y(m[e+984>>2]-g)):(c=m[e+976>>2],l=y(c-m[e+992>>2]),f=m[e+972>>2],h=y(f-m[e+988>>2]),g=m[e+968>>2],s=y(g-m[e+984>>2])),m[t+1016>>2]=s,d[e+1028>>2]=0,m[e+1024>>2]=l,m[e+1020>>2]=h,d[e+1012>>2]=0,p=y(y(y(s*_)+y(h*a))+y(l*o)),m[e+1032>>2]=p,m[e+1008>>2]=c+y(p*o),m[e+1004>>2]=f+y(p*a),m[e+1e3>>2]=g+y(p*_),m[e+1036>>2]=y(y(s*m[e+828>>2])+y(h*m[e+844>>2]))+y(l*m[e+860>>2]),m[e+1040>>2]=y(y(s*m[e+832>>2])+y(h*m[e+848>>2]))+y(l*m[e+864>>2])}function ie(e,t,i){var n,o=0,a=0,l=0,c=0,h=0,_=0,p=0,g=0,v=0,A=0,C=0,S=0,T=0,E=y(0),R=y(0),P=y(0);if(O=n=O-80|0,d[n+68>>2]=0,c=1,s[n+72|0]=1,d[n+60>>2]=0,d[n+64>>2]=0,d[n+48>>2]=0,d[n+52>>2]=0,d[n+40>>2]=0,d[n+44>>2]=0,o=e,(0|(g=(l=d[t+4>>2])>>>0>8?l:8))>=1){for(d[7717]=d[7717]+1,A=0|r[d[6606]](g<<4,16);l=d[n+28>>2],d[(_=(h<<4)+A|0)>>2]=d[n+24>>2],d[_+4>>2]=l,l=d[n+36>>2],d[_+8>>2]=d[n+32>>2],d[_+12>>2]=l,(0|g)!=(0|(h=h+1|0)););l=d[t+4>>2]}if($(o,l,d[t+8>>2],d[t+12>>2],n+20|0,A,m[t+16>>2],n+24|0)){if(l=d[n+20>>2])for(E=m[n+32>>2],R=m[n+28>>2],P=m[n+24>>2];m[(o=(a<<4)+A|0)>>2]=P*m[o>>2],m[o+4>>2]=R*m[o+4>>2],m[o+8>>2]=E*m[o+8>>2],(0|l)!=(0|(a=a+1|0)););if(function(e,t,i,n,o,a){var l=0,c=0,h=0,_=0,p=0,f=0,g=0,b=0;if(!function(e,t,i,n){var o,a=0,l=0,c=0,h=0,_=0,p=y(0),f=y(0),g=y(0),b=0,v=y(0),A=y(0),C=y(0),S=0,T=y(0),E=0,R=y(0),P=0,I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=0,L=y(0),k=y(0),V=y(0),U=y(0);if(O=o=O-80|0,!((0|i)<4)){for(T=m[t+8>>2],R=m[t+4>>2],g=m[t>>2],d[7717]=d[7717]+1,c=i<<2,E=0|r[d[6606]](c,16),d[o+60>>2]=0,d[7717]=d[7717]+1,c=0|r[d[6606]](c,16),d[o+68>>2]=c,s[o+72|0]=1,d[o+64>>2]=i,_=E,A=T,v=R,D=g,S=h=i;;){if((0|a)==(0|h))if((0|h)>=(0|(P=h?h<<1:1)))l=c;else{a=0,l=0,P&&(d[7717]=d[7717]+1,l=0|r[d[6606]](P<<2,16));e:{t:{if((0|h)>=1)for(;;)if(d[(N=a<<2)+l>>2]=d[c+N>>2],(0|h)==(0|(a=a+1|0)))break t;if(!c)break e}c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[o+68>>2]=0,h=d[o+60>>2]}d[o+68>>2]=l,s[o+72|0]=1,d[o+64>>2]=P}else l=c,h=a;if(d[(h<<2)+l>>2]=1,d[o+60>>2]=d[o+60>>2]+1,(0|b)==(0|S))if(b>>>0>=(S=b?b<<1:1)>>>0)S=b;else{a=0,d[7717]=d[7717]+1,E=0|r[d[6606]](S<<2,16);e:{t:{if(b)for(;;)if(d[(c=a<<2)+E>>2]=d[c+_>>2],(0|b)==(0|(a=a+1|0)))break t;if(!_){S=1;break e}}_&&(d[7718]=d[7718]+1,r[d[6607]](_))}_=E}if(d[(b<<2)+_>>2]=0,A=A<(f=m[8+(c=(b<<4)+t|0)>>2])?f:A,v=v<(p=m[c+4>>2])?p:v,D=D<(C=m[c>>2])?C:D,T=f>2],a=d[o+60>>2],c=l}if(function(e,t,i,n){var r,s,o,a,l,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=0,g=0,b=y(0),v=y(0),A=y(0),C=y(0),S=0,T=y(0),E=0,R=y(0),P=y(0),I=y(0);O=r=O+-64|0,d[r+24>>2]=1065353216,d[r+28>>2]=0,d[r+16>>2]=1008981770,d[r+20>>2]=1017370378,o=it(t,i,r+16|0,n),d[r+12>>2]=0,m[r+8>>2]=-m[r+24>>2],m[r+4>>2]=-m[r+20>>2],m[r>>2]=-m[r+16>>2],a=it(t,i,r,n),A=m[(s=(o<<4)+t|0)>>2],_=m[(l=(a<<4)+t|0)>>2],u=m[s+4>>2],p=m[l+4>>2],h=m[s+8>>2],c=m[l+8>>2],d[r+28>>2]=0,T=y(h-c),m[r+24>>2]=T,b=y(u-p),m[r+20>>2]=b,_=y(A-_),m[r+16>>2]=_,(0|o)!=(0|a)&&T!=y(0)|b!=y(0)|_!=y(0)?(d[r+60>>2]=0,d[r+44>>2]=0,u=y(y(b*y(-.019999999552965164))-_),m[r+56>>2]=u,h=y(_*y(0)),c=y(T*y(.019999999552965164)),p=y(h+c),m[r+52>>2]=p,v=y(b+y(_*y(-.019999999552965164))),m[r+40>>2]=v,A=y(h-T),m[r+36>>2]=A,C=c,c=y(b*y(0)),_=y(C-c),m[r+32>>2]=_,h=y(T-c),m[r+48>>2]=h,E=r+48|0,f=r+32|0,S=r,(c=y(x(y(y(y(_*_)+y(A*A))+y(v*v)))))>y(x(y(y(y(h*h)+y(p*p))+y(u*u))))?(c=y(y(1)/c),m[r+36>>2]=A*c,m[r+32>>2]=_*c,C=y(v*c)):(g=d[E+4>>2],d[f>>2]=d[E>>2],d[f+4>>2]=g,g=d[E+12>>2],d[f+8>>2]=d[E+8>>2],d[f+12>>2]=g,p=m[r+32>>2],h=m[r+36>>2],c=m[r+40>>2],u=y(y(1)/y(x(y(y(y(p*p)+y(h*h))+y(c*c))))),m[r+36>>2]=h*u,m[r+32>>2]=p*u,C=y(c*u)),m[S+40>>2]=C,(0|(f=it(t,i,f,n)))!=(0|a)&&(0|o)!=(0|f)||(d[r+12>>2]=0,m[r+8>>2]=-m[r+40>>2],m[r+4>>2]=-m[r+36>>2],m[r>>2]=-m[r+32>>2],f=it(t,i,r,n)),(0|f)!=(0|a)&&(0|f)!=(0|o)?(A=m[4+(S=(f<<4)+t|0)>>2],_=m[S+8>>2],u=m[S>>2],p=m[s+4>>2],h=m[s+8>>2],c=m[s>>2],d[r+44>>2]=0,d[r+60>>2]=0,b=y(u-c),m[r+32>>2]=b,v=m[r+24>>2],_=y(_-h),m[r+40>>2]=_,u=m[r+16>>2],h=m[r+20>>2],c=y(A-p),m[r+36>>2]=c,p=y(y(h*b)-y(c*u)),h=y(y(c*v)-y(_*h)),c=y(y(_*u)-y(v*b)),u=y(y(1)/y(x(y(y(p*p)+y(y(h*h)+y(c*c)))))),m[r+56>>2]=p*u,m[r+52>>2]=c*u,m[r+48>>2]=h*u,((0|(g=it(t,i,E,n)))==(0|a)||(0|f)==(0|g)|(0|g)==(0|o))&&(d[r+12>>2]=0,m[r+8>>2]=-m[r+56>>2],m[r+4>>2]=-m[r+52>>2],m[r>>2]=-m[r+48>>2],g=it(t,i,r,n)),(0|g)==(0|a)||(0|f)==(0|g)|(0|g)==(0|o)?(d[e>>2]=-1,d[e+4>>2]=-1,d[e+8>>2]=-1,d[e+12>>2]=-1):(_=m[8+(t=(g<<4)+t|0)>>2],T=m[t>>2],b=m[t+4>>2],v=m[l+4>>2],u=m[S+4>>2],R=m[s+4>>2],A=m[l+8>>2],p=m[S>>2],c=m[l>>2],P=m[s>>2],h=m[S+8>>2],I=m[s+8>>2],d[e+4>>2]=a,d[e>>2]=o,C=y(_-I),_=y(c-P),u=y(u-R),c=y(v-R),p=y(p-P),v=y(C*y(y(_*u)-y(c*p))),h=y(h-I),C=y(c*h),c=y(A-I),t=y(v+y(y(y(T-P)*y(C-y(c*u)))+y(y(b-R)*y(y(c*p)-y(_*h)))))>2]=t?f:g,d[e+8>>2]=t?g:f)):(d[e>>2]=-1,d[e+4>>2]=-1,d[e+8>>2]=-1,d[e+12>>2]=-1)):(d[e>>2]=-1,d[e+4>>2]=-1,d[e+8>>2]=-1,d[e+12>>2]=-1),O=r- -64|0}(o+40|0,t,i,o+56|0),a=0,-1!=(0|(c=d[o+40>>2]))){if(l=d[o+52>>2],f=m[(_=(l<<4)+t|0)>>2],a=d[o+48>>2],p=m[(b=(a<<4)+t|0)>>2],h=d[o+44>>2],C=m[(S=(h<<4)+t|0)>>2],I=m[(P=(c<<4)+t|0)>>2],w=m[_+4>>2],F=m[b+4>>2],B=m[S+4>>2],M=m[P+4>>2],L=m[_+8>>2],k=m[b+8>>2],V=m[S+8>>2],U=m[P+8>>2],d[o+36>>2]=0,m[o+32>>2]=y(L+y(k+y(U+V)))*y(.25),m[o+28>>2]=y(w+y(F+y(M+B)))*y(.25),m[o+24>>2]=y(f+y(p+y(I+C)))*y(.25),_=Kn(e,a,l,h),d[_+12>>2]=2,d[_+16>>2]=3,d[_+20>>2]=1,_=Kn(e,l,a,c),d[_+12>>2]=3,d[_+16>>2]=2,d[_+20>>2]=0,_=Kn(e,c,h,l),d[_+12>>2]=0,d[_+16>>2]=1,d[_+20>>2]=3,c=Kn(e,h,c,a),d[c+12>>2]=1,d[c+16>>2]=0,d[c+20>>2]=2,d[(l<<2)+E>>2]=1,d[(d[o+48>>2]<<2)+E>>2]=1,d[(d[o+44>>2]<<2)+E>>2]=1,d[(d[o+40>>2]<<2)+E>>2]=1,(0|(a=d[e+4>>2]))>=1)for(b=0;c=d[d[e+12>>2]+(b<<2)>>2],l=(d[c+4>>2]<<4)+t|0,f=m[l>>2],a=(d[c>>2]<<4)+t|0,C=y(f-m[a>>2]),h=(d[c+8>>2]<<4)+t|0,p=m[l+4>>2],I=y(m[h+4>>2]-p),p=y(p-m[a+4>>2]),w=y(m[h>>2]-f),f=y(y(C*I)-y(p*w)),M=p,p=m[l+8>>2],F=y(m[h+8>>2]-p),B=y(p-m[a+8>>2]),p=y(y(M*F)-y(B*I)),C=y(y(B*w)-y(C*F)),(I=y(x(y(y(f*f)+y(y(p*p)+y(C*C))))))!=y(0)?(M=f,f=y(y(1)/I),m[o+16>>2]=M*f,m[o+12>>2]=C*f,m[o+8>>2]=p*f):(d[o+16>>2]=0,d[o+8>>2]=1065353216,d[o+12>>2]=0),d[o+20>>2]=0,l=it(t,i,o+8|0,o+56|0),d[c+28>>2]=l,h=c,l=(l<<4)+t|0,c=(d[c>>2]<<4)+t|0,m[h+32>>2]=y(y(y(m[l>>2]-m[c>>2])*m[o+8>>2])+y(y(m[l+4>>2]-m[c+4>>2])*m[o+12>>2]))+y(y(m[l+8>>2]-m[c+8>>2])*m[o+16>>2]),(0|(b=b+1|0))<(0|(a=d[e+4>>2])););e:if(!((0|(c=n?n+-4|0:999999996))<1))for(g=y(D-g),R=y(v-R),T=y(A-T),T=y(y(x(y(y(y(g*g)+y(R*R))+y(T*T))))*y(.0010000000474974513)),R=y(T*y(.009999999776482582)),D=y(y(T*T)*y(.10000000149011612));;){for(_=(0|a)>1?a:1,h=d[e+12>>2],n=0,a=0;!(l=d[(a<<2)+h>>2])|m[n+32>>2]>2]^1&&n||(n=l),(0|_)!=(0|(a=a+1|0)););if(!n|m[n+32>>2]>T^1)break e;l=d[n+28>>2],d[(l<<2)+E>>2]=1;t:if(a=d[e+4>>2]){for(_=(l<<4)+t|0;(n=d[((a=a+-1|0)<<2)+h>>2])&&(d[o+16>>2]=d[n+8>>2],h=d[n+4>>2],d[o+8>>2]=d[n>>2],d[o+12>>2]=h,sr(t,o+8|0,_,R)&&Ve(e,n,l)),a;)h=d[e+12>>2];if(b=h=d[e+4>>2],h){for(;;){i:{if(P=d[e+12>>2],n=d[P+((b=b+-1|0)<<2)>>2]){if((0|l)!=d[n+8>>2]&&!((0|l)==d[n>>2]|(0|l)==d[n+4>>2]))break i;d[o+16>>2]=d[n+8>>2],a=d[n+4>>2],d[o+8>>2]=d[n>>2],d[o+12>>2]=a,(sr(t,o+8|0,o+24|0,R)||(a=(d[o+12>>2]<<4)+t|0,g=m[a>>2],_=(d[o+8>>2]<<4)+t|0,A=y(g-m[_>>2]),S=(d[o+16>>2]<<4)+t|0,v=m[a+4>>2],f=y(m[S+4>>2]-v),v=y(v-m[_+4>>2]),g=y(m[S>>2]-g),p=y(y(A*f)-y(v*g)),C=y(p*p),M=v,v=m[a+8>>2],p=y(m[S+8>>2]-v),v=y(v-m[_+8>>2]),f=y(y(M*p)-y(v*f)),g=y(y(v*g)-y(A*p)),y(x(y(C+y(y(f*f)+y(g*g)))))>2]<<2)>>2],l),b=h=d[e+4>>2])}if(b)continue}break}if(h)for(;;){if(h=h+-1|0,n=d[d[e+12>>2]+(h<<2)>>2]){if(d[n+28>>2]>-1)break t;l=(d[n+4>>2]<<4)+t|0,g=m[l>>2],a=(d[n>>2]<<4)+t|0,v=y(g-m[a>>2]),_=(d[n+8>>2]<<4)+t|0,A=m[l+4>>2],f=y(m[_+4>>2]-A),A=y(A-m[a+4>>2]),p=y(m[_>>2]-g),g=y(y(v*f)-y(A*p)),M=A,A=m[l+8>>2],C=y(m[_+8>>2]-A),I=y(A-m[a+8>>2]),A=y(y(M*C)-y(I*f)),v=y(y(I*p)-y(v*C)),(f=y(x(y(y(g*g)+y(y(A*A)+y(v*v))))))!=y(0)?(p=g,g=y(y(1)/f),m[o+16>>2]=p*g,m[o+12>>2]=v*g,m[o+8>>2]=A*g):(d[o+16>>2]=0,d[o+8>>2]=1065353216,d[o+12>>2]=0),d[o+20>>2]=0,l=it(t,i,o+8|0,o+56|0),d[n+28>>2]=l,d[(l<<2)+E>>2]?d[n+28>>2]=-1:(b=n,l=(l<<4)+t|0,n=(d[n>>2]<<4)+t|0,m[b+32>>2]=y(y(y(m[l>>2]-m[n>>2])*m[o+8>>2])+y(y(m[l+4>>2]-m[n+4>>2])*m[o+12>>2]))+y(y(m[l+8>>2]-m[n+8>>2])*m[o+16>>2]))}if(!h)break}}}if((0|c)<2)break e;c=c+-1|0,a=d[e+4>>2]}a=1}(e=d[o+68>>2])&&(u[o+72|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[o+68>>2]=0),E&&E&&(d[7718]=d[7718]+1,r[d[6607]](E))}return O=o+80|0,a}(e,t,i,a))return 0;if((0|(t=d[e+4>>2]))<1)i=0;else for(i=0;;){if(l=d[(g=b<<2)+d[e+12>>2]>>2]){e:if((0|c)!=(0|_)||(0|c)>=(0|(h=c?c<<1:1)))h=c,a=i;else{t=0,a=0,h&&(d[7717]=d[7717]+1,a=0|r[d[6606]](h<<2,16));t:{if((0|c)>=1)for(;;)if(d[(p=t<<2)+a>>2]=d[i+p>>2],(0|c)==(0|(t=t+1|0)))break t;if(!i)break e}i&&(d[7718]=d[7718]+1,r[d[6607]](i))}d[(_<<2)+a>>2]=d[l>>2],i=d[d[e+12>>2]+g>>2];e:if((0|(c=_+1|0))!=(0|h)||(0|h)>=(0|(p=h?h<<1:1)))p=h,l=a;else{t=0,l=0,p&&(d[7717]=d[7717]+1,l=0|r[d[6606]](p<<2,16));t:{if((0|h)<=0){if(a)break t;break e}for(;d[(f=t<<2)+l>>2]=d[a+f>>2],(0|h)!=(0|(t=t+1|0)););}a&&(d[7718]=d[7718]+1,r[d[6607]](a))}d[(c<<2)+l>>2]=d[i+4>>2],a=d[d[e+12>>2]+g>>2];e:if((0|(h=_+2|0))!=(0|p)||(0|p)>=(0|(c=p?p<<1:1)))c=p,i=l;else{t=0,i=0,c&&(d[7717]=d[7717]+1,i=0|r[d[6606]](c<<2,16));t:{if((0|p)<=0){if(l)break t;break e}for(;d[(f=t<<2)+i>>2]=d[l+f>>2],(0|p)!=(0|(t=t+1|0)););}l&&(d[7718]=d[7718]+1,r[d[6607]](l))}d[(h<<2)+i>>2]=d[a+8>>2],a=d[e+12>>2],t=d[a+g>>2],d[(d[t+24>>2]<<2)+a>>2]=0,t&&(d[7718]=d[7718]+1,r[d[6607]](t)),_=_+3|0,t=d[e+4>>2]}if(!((0|(b=b+1|0))<(0|t)))break}if(d[o>>2]=(0|_)/3,(0|_)>(0|(o=d[n+4>>2]))){if(d[n+8>>2]>=(0|_))l=d[n+12>>2];else{t=0,c=o,l=0,_&&(d[7717]=d[7717]+1,l=0|r[d[6606]](_<<2,16),c=d[n+4>>2]),a=d[n+12>>2];e:{t:{if((0|c)>=1)for(;;)if(d[(h=t<<2)+l>>2]=d[a+h>>2],(0|c)==(0|(t=t+1|0)))break t;if(!a)break e}u[n+16|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a))}d[n+12>>2]=l,s[n+16|0]=1,d[n+8>>2]=_}Mn((o<<2)+l|0,0,_-o<<2)}if(d[n+4>>2]=_,(0|_)>=1)for(n=d[n+12>>2],t=0;d[(o=t<<2)+n>>2]=d[i+o>>2],(0|_)!=(0|(t=t+1|0)););if((0|(t=d[e+4>>2]))<=-1)for(d[e+8>>2]<=-1&&((n=d[e+12>>2])&&(u[e+16|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+12>>2]=0),s[e+16|0]=1,d[e+8>>2]=0,d[e+12>>2]=0);d[d[e+12>>2]+(t<<2)>>2]=0,o=(n=t+1|0)>>>0>=t>>>0,t=n,o;);return d[e+4>>2]=0,i&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),1}(e,A,l,n+56|0,n+4|0,d[t+20>>2])){if(d[n+52>>2]=A,v=d[n+4>>2],d[n+48>>2]=v,C=b(v,3),d[n+44>>2]=C,d[n+40>>2]=l,(0|l)>=1)for(h=0,d[7717]=d[7717]+1,S=0|r[d[6606]](l<<4,16);a=d[n+8>>2],d[(o=(h<<4)+S|0)>>2]=d[n+4>>2],d[o+4>>2]=a,a=d[n+16>>2],d[o+8>>2]=d[n+12>>2],d[o+12>>2]=a,(0|l)!=(0|(h=h+1|0)););!function(e,t,i,n,s,o,a){var l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0;if(!((0|(l=d[e+24>>2]))<1||(d[7717]=d[7717]+1,l<<=2,l=Mn(u=0|r[d[6606]](l,16),0,l),d[e+24>>2]<1)))for(h=d[e+32>>2];d[(_=c<<2)+l>>2]=d[h+_>>2],(0|(c=c+1|0))>2];);l=i<<2;e:{t:{i:{if((0|i)>=1){if(d[7717]=d[7717]+1,i=Mn(Mn(_=0|r[d[6606]](l,16),0,l),0,l),d[s>>2]=0,(0|a)>0)break i;if(!i)break e;break t}if(_=0,d[s>>2]=Mn(0,0,l),(0|a)<1)break e}for(i=0;;){if(p=d[(l=(i<<2)+o|0)>>2],h=d[(m=(p<<2)+_|0)>>2])d[l>>2]=h+-1;else{if(d[l>>2]=d[s>>2],l=d[s>>2],c=(p<<4)+t|0,d[(h=(l<<4)+n|0)>>2]=d[c>>2],d[h+4>>2]=d[c+4>>2],d[h+8>>2]=d[c+8>>2],c=0,h=s,(0|(f=d[e+24>>2]))>0){for(;(0|p)==d[(l=c<<2)+u>>2]&&(d[l+d[e+32>>2]>>2]=d[s>>2],f=d[e+24>>2]),(0|(c=c+1|0))<(0|f););l=d[s>>2]}l=l+1|0,d[h>>2]=l,d[m>>2]=l}if((0|a)==(0|(i=i+1|0)))break}}_&&(d[7718]=d[7718]+1,r[d[6607]](_))}u&&u&&(d[7718]=d[7718]+1,r[d[6607]](u))}(e,A,l,S,n+20|0,h=d[n+68>>2],C);e:{t:{i:{n:{if(1&s[0|t]){if(s[0|i]=0,p=d[n+20>>2],d[i+4>>2]=p,(0|(a=d[i+12>>2]))<(0|p)){if(d[i+16>>2]<(0|p)){if(p?(d[7717]=d[7717]+1,e=0|r[d[6606]](p<<4,16),o=d[i+12>>2]):(e=0,o=a),(0|o)>=1)for(c=0;_=(l=c<<4)+e|0,T=l+d[i+20>>2]|0,l=d[T+4>>2],d[_>>2]=d[T>>2],d[_+4>>2]=l,l=d[T+12>>2],d[_+8>>2]=d[T+8>>2],d[_+12>>2]=l,(0|o)!=(0|(c=c+1|0)););(c=d[i+20>>2])&&(u[i+24|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[i+20>>2]=0),d[i+20>>2]=e,d[i+16>>2]=p,s[i+24|0]=1}for(;e=d[n+8>>2],o=d[i+20>>2]+(a<<4)|0,d[o>>2]=d[n+4>>2],d[o+4>>2]=e,e=d[n+16>>2],d[o+8>>2]=d[n+12>>2],d[o+12>>2]=e,(0|p)!=(0|(a=a+1|0)););}if(d[i+12>>2]=p,d[i+32>>2]=C,d[i+28>>2]=v,(0|(o=d[i+40>>2]))>=(0|C))break t;if(d[i+44>>2]>=(0|C)){e=d[i+48>>2];break i}if(a=0,c=o,e=0,v&&(d[7717]=d[7717]+1,e=0|r[d[6606]](b(v,12),16),c=d[i+40>>2]),g=d[i+48>>2],(0|c)>=1)for(;;)if(d[(l=a<<2)+e>>2]=d[l+g>>2],(0|c)==(0|(a=a+1|0)))break n;if(g)break n;d[i+48>>2]=e,d[i+44>>2]=C,s[i+52|0]=1;break i}if(s[0|i]=1,p=d[n+20>>2],d[i+4>>2]=p,(0|(a=d[i+12>>2]))<(0|p)){if(d[i+16>>2]<(0|p)){if(p?(d[7717]=d[7717]+1,T=0|r[d[6606]](p<<4,16),e=d[i+12>>2]):e=a,(0|e)>=1)for(c=0;l=g=(o=c<<4)+T|0,_=o+d[i+20>>2]|0,o=d[_+4>>2],d[l>>2]=d[_>>2],d[l+4>>2]=o,o=d[_+12>>2],d[l+8>>2]=d[_+8>>2],d[l+12>>2]=o,(0|e)!=(0|(c=c+1|0)););(e=d[i+20>>2])&&(u[i+24|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+20>>2]=0),d[i+20>>2]=T,d[i+16>>2]=p,s[i+24|0]=1}for(;e=d[n+8>>2],o=d[i+20>>2]+(a<<4)|0,d[o>>2]=d[n+4>>2],d[o+4>>2]=e,e=d[n+16>>2],d[o+8>>2]=d[n+12>>2],d[o+12>>2]=e,(0|p)!=(0|(a=a+1|0)););}if(d[i+12>>2]=p,_=v<<2,d[i+32>>2]=_,d[i+28>>2]=v,(0|_)>(0|(o=d[i+40>>2]))){r:if(d[i+44>>2]>=(0|_))e=d[i+48>>2];else{a=0,c=o,e=0,_&&(d[7717]=d[7717]+1,e=0|r[d[6606]](v<<4,16),c=d[i+40>>2]),g=d[i+48>>2];s:{if((0|c)>=1)for(;;)if(d[(l=a<<2)+e>>2]=d[l+g>>2],(0|c)==(0|(a=a+1|0)))break s;if(!g){d[i+48>>2]=e,d[i+44>>2]=_,s[i+52|0]=1;break r}}u[i+52|0]&&g&&(d[7718]=d[7718]+1,r[d[6607]](g)),d[i+48>>2]=e,s[i+52|0]=1,d[i+44>>2]=_}Mn((o<<2)+e|0,0,_-o<<2)}if(d[i+40>>2]=_,Mi(d[i+20>>2],S,d[n+20>>2]<<4),!v)break e;for(a=d[i+48>>2],c=0;d[a>>2]=3,i=a,2&u[0|t]?(d[a+4>>2]=d[h+8>>2],d[a+8>>2]=d[h+4>>2],e=h):(d[a+4>>2]=d[h>>2],d[a+8>>2]=d[h+4>>2],e=h+8|0),d[i+12>>2]=d[e>>2],h=h+12|0,a=a+16|0,(c=c+1|0)>>>0>2];);break e}u[i+52|0]&&g&&(d[7718]=d[7718]+1,r[d[6607]](g)),d[i+48>>2]=e,s[i+52|0]=1,d[i+44>>2]=C}Mn((c=e)+(e=o<<2)|0,0,b(v,12)-e|0)}if(d[i+40>>2]=C,Mi(d[i+20>>2],S,d[n+20>>2]<<4),2&u[0|t]){if(!v)break e;for(a=d[i+48>>2],c=0;d[a>>2]=d[h+8>>2],d[a+4>>2]=d[h+4>>2],d[a+8>>2]=d[h>>2],h=h+12|0,a=a+12|0,(c=c+1|0)>>>0>2];);}else Mi(d[i+48>>2],h,b(v,12))}d[n+60>>2]&&((e=d[n+68>>2])&&(u[n+72|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[n+68>>2]=0),d[n+68>>2]=0,s[n+72|0]=1,d[n+60>>2]=0,d[n+64>>2]=0),c=0,d[n+52>>2]=0,d[n+40>>2]=0,d[n+44>>2]=0,S&&S&&(d[7718]=d[7718]+1,r[d[6607]](S))}}return A&&A&&(d[7718]=d[7718]+1,r[d[6607]](A)),(e=d[n+68>>2])&&(u[n+72|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[n+68>>2]=0),O=n+80|0,c}function ne(e,t,i){var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=0,P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=0;R=d[e+4>>2],d[t>>2]=d[e>>2],d[t+4>>2]=R,R=d[e+12>>2],d[t+8>>2]=d[e+8>>2],d[t+12>>2]=R,R=d[e+28>>2],d[t+24>>2]=d[e+24>>2],d[t+28>>2]=R,R=d[e+20>>2],d[t+16>>2]=d[e+16>>2],d[t+20>>2]=R,R=d[e+36>>2],d[t+32>>2]=d[e+32>>2],d[t+36>>2]=R,R=d[e+44>>2],d[t+40>>2]=d[e+40>>2],d[t+44>>2]=R,r=m[e+8>>2],s=m[e+20>>2],_=m[e+40>>2],o=m[e+24>>2],l=m[e+36>>2],c=m[e+4>>2],u=m[e+32>>2],p=m[e+16>>2],a=m[e>>2],d[i+44>>2]=0,d[i+28>>2]=0,d[i+12>>2]=0,h=y(y(s*_)-y(o*l)),g=y(y(o*u)-y(_*p)),b=y(y(l*p)-y(s*u)),n=y(y(1)/y(y(y(a*h)+y(c*g))+y(r*b))),A=y(y(y(l*r)-y(_*c))*n),m[i+4>>2]=A,C=y(y(y(o*c)-y(s*r))*n),m[i+8>>2]=C,g=y(g*n),m[i+16>>2]=g,S=y(y(y(_*a)-y(u*r))*n),m[i+20>>2]=S,x=y(y(y(p*r)-y(o*a))*n),m[i+24>>2]=x,b=y(b*n),m[i+32>>2]=b,T=y(y(y(u*c)-y(l*a))*n),m[i+36>>2]=T,E=y(y(y(s*a)-y(p*c))*n),m[i+40>>2]=E,h=y(h*n),m[i>>2]=h;e:{t:if(d[7660])for(;;){if(n=y(v(h)),r=y(v(g)),c=y(v(b)),a=y(y(n+r)+c),s=y(v(A)),_=y(v(S)),o=y(v(T)),a=a>(l=y(y(s+_)+o))?a:l,l=y(v(C)),u=y(v(x)),p=y(v(E)),I=y(y(l+u)+p),n=(n=y(y(n+s)+l))>(r=y(y(r+_)+u))?n:r,r=y(y(c+o)+p),(r=y((a>I?a:I)*(n>r?n:r)))>2],s=y(v(I)),c=m[t+16>>2],o=y(v(c)),a=m[t+32>>2],p=y(v(a)),n=y(y(s+o)+p),M=m[t+4>>2],O=y(v(M)),u=m[t+20>>2],w=y(v(u)),_=m[t+36>>2],F=y(v(_)),B=n>(l=y(y(O+w)+F))?n:l,D=m[t+8>>2],N=y(v(D)),l=m[t+24>>2],L=y(v(l)),n=m[t+40>>2],k=y(v(n)),B=B>(P=y(y(N+L)+k))?B:P,s=(s=y(y(s+O)+N))>(o=y(y(o+w)+L))?s:o,o=y(y(p+F)+k),(s=y(B*(s>o?s:o)))>2]=0,d[t+28>>2]=0,d[t+12>>2]=0,P=n,r=le(y(r/s),y(.25)),n=y(r+y(-2)),r=y(y(1)/r),O=y(y(y(P*n)+y(r*E))*y(.5)),s=y(P+O),m[t+40>>2]=s,w=y(y(y(_*n)+y(r*x))*y(.5)),_=y(_+w),m[t+36>>2]=_,F=y(y(y(a*n)+y(r*C))*y(.5)),o=y(a+F),m[t+32>>2]=o,N=y(y(y(l*n)+y(r*T))*y(.5)),l=y(l+N),m[t+24>>2]=l,L=y(y(y(u*n)+y(r*S))*y(.5)),u=y(u+L),m[t+20>>2]=u,k=y(y(y(c*n)+y(r*A))*y(.5)),p=y(c+k),m[t+16>>2]=p,P=D,D=y(y(y(D*n)+y(r*b))*y(.5)),c=y(P+D),m[t+8>>2]=c,P=M,M=y(y(y(M*n)+y(r*g))*y(.5)),a=y(P+M),m[t+4>>2]=a,P=I,I=y(y(y(I*n)+y(r*h))*y(.5)),r=y(P+I),m[t>>2]=r,d[i+44>>2]=0,d[i+28>>2]=0,d[i+12>>2]=0,A=y(y(p*_)-y(u*o)),h=y(y(u*s)-y(l*_)),C=y(y(l*o)-y(p*s)),n=y(y(1)/y(y(c*A)+y(y(r*h)+y(a*C)))),E=y(y(y(r*u)-y(a*p))*n),m[i+40>>2]=E,T=y(y(y(a*o)-y(r*_))*n),m[i+36>>2]=T,b=y(A*n),m[i+32>>2]=b,x=y(y(y(c*p)-y(r*l))*n),m[i+24>>2]=x,S=y(y(y(r*s)-y(c*o))*n),m[i+20>>2]=S,g=y(C*n),m[i+16>>2]=g,C=y(y(y(a*l)-y(c*u))*n),m[i+8>>2]=C,A=y(y(y(c*_)-y(a*s))*n),m[i+4>>2]=A,h=y(h*n),m[i>>2]=h,((n=(n=y(y(y(v(I))+y(v(k)))+y(v(F))))>(r=y(y(y(v(M))+y(v(L)))+y(v(w))))?n:r)>(r=y(y(y(v(D))+y(v(N)))+y(v(O))))?n:r)<=y(B*m[7659]))break e;if(!((V=V+1|0)>>>0>2],r=m[t+20>>2],c=m[t+40>>2],a=m[t+24>>2],s=m[t+4>>2],_=m[e+36>>2],o=m[e+20>>2],l=m[e+4>>2],u=m[e+40>>2],p=m[e+24>>2],A=m[e+8>>2],C=m[t+8>>2],g=m[e+32>>2],S=m[t+32>>2],x=m[e>>2],b=m[t>>2],T=m[e+16>>2],E=m[t+16>>2],d[i+44>>2]=0,d[i+28>>2]=0,d[i+12>>2]=0,h=y(y(y(b*x)+y(E*T))+y(S*g)),m[i>>2]=y(h+h)*y(.5),h=y(y(y(C*A)+y(a*p))+y(c*u)),m[i+40>>2]=y(h+h)*y(.5),h=y(y(y(y(y(s*A)+y(r*p))+y(n*u))+y(y(y(C*l)+y(a*o))+y(c*_)))*y(.5)),m[i+36>>2]=h,c=y(y(y(y(y(b*A)+y(E*p))+y(S*u))+y(y(y(C*x)+y(a*T))+y(c*g)))*y(.5)),m[i+32>>2]=c,m[i+24>>2]=h,a=y(y(y(s*l)+y(r*o))+y(n*_)),m[i+20>>2]=y(a+a)*y(.5),n=y(y(y(y(y(b*l)+y(E*o))+y(S*_))+y(y(y(s*x)+y(r*T))+y(n*g)))*y(.5)),m[i+16>>2]=n,m[i+8>>2]=c,void(m[i+4>>2]=n)}n=m[t+32>>2],r=m[t>>2],c=m[t+16>>2],a=m[e+32>>2],s=m[e>>2],_=m[e+16>>2],o=m[t+36>>2],l=m[t+4>>2],u=m[t+20>>2],p=m[e+36>>2],A=m[e+4>>2],C=m[e+20>>2],g=m[e+40>>2],S=m[t+40>>2],x=m[e+8>>2],b=m[t+8>>2],T=m[e+24>>2],E=m[t+24>>2],d[i+44>>2]=0,d[i+28>>2]=0,d[i+12>>2]=0,h=y(y(y(b*x)+y(E*T))+y(S*g)),m[i+40>>2]=y(h+h)*y(.5),h=y(y(y(y(y(l*x)+y(u*T))+y(o*g))+y(y(y(b*A)+y(E*C))+y(S*p)))*y(.5)),m[i+36>>2]=h,g=y(y(y(y(y(r*x)+y(c*T))+y(n*g))+y(y(y(b*s)+y(E*_))+y(S*a)))*y(.5)),m[i+32>>2]=g,m[i+24>>2]=h,S=y(y(y(l*A)+y(u*C))+y(o*p)),m[i+20>>2]=y(S+S)*y(.5),o=y(y(y(y(y(r*A)+y(c*C))+y(n*p))+y(y(y(l*s)+y(u*_))+y(o*a)))*y(.5)),m[i+16>>2]=o,m[i+8>>2]=g,m[i+4>>2]=o,n=y(y(y(r*s)+y(c*_))+y(n*a)),m[i>>2]=y(n+n)*y(.5)}function re(e,t,i){var n,r=0,o=y(0),a=0,l=y(0),c=0,h=0,_=0,p=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=0,S=y(0),T=y(0),E=0,R=0,P=y(0),I=y(0);O=n=O-16|0;e:{if(h=d[t+372>>2],!(f[h+32>>2]<2)&&de(t)){if(a=d[e+9280>>2]){for(r=d[e+9292>>2],_=d[e+9284>>2];(c=d[a+48>>2])&&(d[c+44>>2]=d[a+44>>2]),(c=d[a+44>>2])&&(d[c+48>>2]=d[a+48>>2]),d[e+9280>>2]==(0|a)&&(d[e+9280>>2]=d[a+48>>2]),d[a+44>>2]=0,d[a+48>>2]=d[e+9288>>2],(c=d[e+9288>>2])&&(d[c+44>>2]=a),_=_+-1|0,d[e+9288>>2]=a,r=r+1|0,a=d[e+9280>>2];);d[e+9292>>2]=r,d[e+9284>>2]=_}if(d[e+9276>>2]=0,d[e>>2]=0,r=d[h>>2],_=d[h+12>>2],o=m[_+16>>2],A=y(m[r+16>>2]-o),a=d[h+4>>2],l=m[_+20>>2],g=y(m[a+20>>2]-l),c=d[h+8>>2],p=m[_+24>>2],b=y(m[c+24>>2]-p),v=y(m[r+20>>2]-l),S=y(m[a+24>>2]-p),T=y(m[c+16>>2]-o),p=y(m[r+24>>2]-p),o=y(m[a+16>>2]-o),l=y(m[c+20>>2]-l),y(y(y(y(A*g)*b)+y(y(y(y(y(v*S)*T)+y(y(p*o)*l))-y(y(A*S)*l))-y(y(v*o)*b)))-y(y(p*g)*T))>2]=r,d[h>>2]=a,_=d[h+16>>2],d[h+16>>2]=d[h+20>>2],d[h+20>>2]=_,_=r):(_=a,a=r),_=Wt(e,a,_,c,1),c=Wt(e,d[h+4>>2],d[h>>2],d[h+12>>2],1),C=Wt(e,d[h+8>>2],d[h+4>>2],d[h+12>>2],1),E=Wt(e,d[h>>2],d[h+8>>2],d[h+12>>2],1),4==d[e+9284>>2]){if(r=d[e+9280>>2],o=m[r+16>>2],a=d[r+48>>2]){for(o=y(o*o);l=m[a+16>>2],r=(i=(l=y(l*l))>2];);o=m[r+16>>2]}for(i=d[r+28>>2],h=d[r+24>>2],R=d[r+20>>2],g=m[r+12>>2],A=m[r+8>>2],p=m[r+4>>2],l=m[r>>2],d[_+32>>2]=c,s[_+52|0]=0,d[c+32>>2]=_,s[c+52|0]=0,d[_+36>>2]=C,s[_+53|0]=0,d[C+32>>2]=_,s[C+52|0]=1,d[_+40>>2]=E,s[_+54|0]=0,d[E+32>>2]=_,s[E+52|0]=2,d[c+36>>2]=E,s[c+53|0]=2,d[E+40>>2]=c,s[E+54|0]=1,d[c+40>>2]=C,s[c+54|0]=1,d[C+36>>2]=c,s[C+53|0]=258,s[C+54|0]=1,d[C+40>>2]=E,d[E+36>>2]=C,s[E+53|0]=2,d[e>>2]=0,_=0;;){t:{i:{if(!((c=d[e+9276>>2])>>>0<=63)){d[e>>2]=6;break t}if(a=0,d[n+8>>2]=0,d[n>>2]=0,d[n+4>>2]=0,d[e+9276>>2]=c+1,_=_+1|0,s[r+55|0]=_,er(t,r,C=60+(c=(c<<5)+e|0)|0),!(y(y(y(y(m[r>>2]*m[c+76>>2])+y(m[r+4>>2]*m[c+80>>2]))+y(m[r+8>>2]*m[c+84>>2]))-m[r+16>>2])>y(9999999747378752e-20))){d[e>>2]=7;break t}for(;;){if(!(c=Zi(e,_,C,d[32+((a<<2)+r|0)>>2],u[52+(r+a|0)|0],n)))break i;if(E=a>>>0<2,a=a+1|0,!E)break}}if(c&f[n+8>>2]>2){if(i=d[n>>2],a=d[n+4>>2],d[i+36>>2]=a,s[i+53|0]=2,d[a+40>>2]=i,s[a+54|0]=1,(i=d[r+48>>2])&&(d[i+44>>2]=d[r+44>>2]),(i=d[r+44>>2])&&(d[i+48>>2]=d[r+48>>2]),d[e+9280>>2]==(0|r)&&(d[e+9280>>2]=d[r+48>>2]),d[e+9284>>2]=d[e+9284>>2]+-1,d[r+44>>2]=0,d[r+48>>2]=d[e+9288>>2],(i=d[e+9288>>2])&&(d[i+44>>2]=r),d[e+9288>>2]=r,d[e+9292>>2]=d[e+9292>>2]+1,r=d[e+9280>>2],o=m[r+16>>2],a=d[r+48>>2]){for(o=y(o*o);l=m[a+16>>2],r=(i=(l=y(l*l))>2];);o=m[r+16>>2]}if(i=d[r+28>>2],h=d[r+24>>2],R=d[r+20>>2],g=m[r+12>>2],A=m[r+8>>2],p=m[r+4>>2],l=m[r>>2],255!=(0|_))continue}else d[e>>2]=4}break}m[e+56>>2]=o,m[e+40>>2]=l,d[e+4>>2]=R,m[e+52>>2]=g,m[e+48>>2]=A,m[e+44>>2]=p,d[e+36>>2]=3,d[e+12>>2]=i,d[e+8>>2]=h,l=y(l*o),g=y(m[h+16>>2]-l),p=y(p*o),b=y(m[i+20>>2]-p),v=y(m[h+20>>2]-p),S=y(m[i+16>>2]-l),T=y(y(g*b)-y(v*S)),o=y(A*o),A=y(m[i+24>>2]-o),P=y(v*A),v=y(m[h+24>>2]-o),b=y(P-y(v*b)),A=y(y(v*S)-y(g*A)),A=y(x(y(y(T*T)+y(y(b*b)+y(A*A))))),m[e+20>>2]=A,g=y(m[i+16>>2]-l),b=y(m[R+20>>2]-p),v=y(m[i+20>>2]-p),S=y(m[R+16>>2]-l),T=y(y(g*b)-y(v*S)),I=y(T*T),P=v,v=y(m[R+24>>2]-o),T=y(m[i+24>>2]-o),b=y(y(P*v)-y(T*b)),g=y(y(T*S)-y(g*v)),g=y(x(y(I+y(y(b*b)+y(g*g))))),m[e+24>>2]=g,b=y(m[R+16>>2]-l),v=y(m[h+20>>2]-p),p=y(m[R+20>>2]-p),l=y(m[h+16>>2]-l),S=y(y(b*v)-y(p*l)),P=p,p=y(m[h+24>>2]-o),o=y(m[R+24>>2]-o),v=y(y(P*p)-y(o*v)),o=y(y(o*l)-y(b*p)),l=y(x(y(y(S*S)+y(y(v*v)+y(o*o))))),o=y(l+y(A+g)),m[e+28>>2]=l/o,m[e+24>>2]=g/o,m[e+20>>2]=A/o,e=d[e>>2];break e}}d[e>>2]=8,o=m[i>>2],l=m[i+4>>2],p=m[i+8>>2],d[e+52>>2]=0,A=y(-p),m[e+48>>2]=A,g=y(-l),m[e+44>>2]=g,b=y(-o),m[e+40>>2]=b,(o=y(x(y(y(y(o*o)+y(l*l))+y(p*p)))))>y(0)?(o=y(y(1)/o),m[e+48>>2]=o*A,m[e+44>>2]=o*g,m[e+40>>2]=o*b):(d[e+48>>2]=0,d[e+40>>2]=1065353216,d[e+44>>2]=0),d[e+52>>2]=0,d[e+56>>2]=0,d[e+36>>2]=1,t=d[h>>2],d[e+20>>2]=1065353216,d[e+4>>2]=t,e=8}return O=n+16|0,e}function se(e,t,i){var n,o=0,l=0,c=0,_=0,p=y(0),f=y(0),g=y(0),A=0,C=0,S=0,x=0,T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=0,w=0,F=0;if(O=n=O-48|0,_=-246811958,c=1900671690,(0|i)>0)for(o=t,S=1900671690,A=1900671690,l=-246811958,C=-246811958;x=d[o+8>>2],p=m[o+8>>2],a(0,_),_=h()>2],f=m[o+4>>2],a(0,l),l=h()>2],g=m[o>>2],a(0,C),C=h()>2]=o,(0|o)==(0|(c=_?(1^c)<<1:l?1:2))&&(c=(o+1>>>0)%3|0),d[e+104>>2]=c,d[e+12>>2]=0,d[e+28>>2]=0,l=(3^o)-c|0,d[e+108>>2]=l,m[e+24>>2]=y(R+P)*y(.5),m[e+20>>2]=y(T+E)*y(.5),m[e+16>>2]=y(I+M)*y(.5),f=y((o=(0|o)==((l+1|0)%3|0))?f*y(9788566967472434e-20):f*y(-9788566967472434e-20)),m[e+8>>2]=f,p=y(o?p*y(9788566967472434e-20):p*y(-9788566967472434e-20)),m[e+4>>2]=p,g=y(o?g*y(9788566967472434e-20):g*y(-9788566967472434e-20)),m[e>>2]=g,d[n+36>>2]=0,s[n+40|0]=1,d[n+28>>2]=0,d[n+32>>2]=0,(0|i)>=1){if(d[7717]=d[7717]+1,o=0|r[d[6606]](i<<4,16),d[n+36>>2]=o,_=1,s[n+40|0]=1,d[n+32>>2]=i,l=d[n+20>>2],d[o+8>>2]=d[n+16>>2],d[o+12>>2]=l,l=d[n+12>>2],d[o>>2]=d[n+8>>2],d[o+4>>2]=l,1!=(0|i))for(;l=d[n+12>>2],o=d[n+36>>2]+(_<<4)|0,d[o>>2]=d[n+8>>2],d[o+4>>2]=l,l=d[n+20>>2],d[o+8>>2]=d[n+16>>2],d[o+12>>2]=l,(0|(_=_+1|0))!=(0|i););if(d[n+28>>2]=i,!((0|i)<1)){for(f=f!=y(0)?y(y(1)/f):f,T=p!=y(0)?y(y(1)/p):p,g=g!=y(0)?y(y(1)/g):g,A=(n+8|0)+(d[e+104>>2]<<2)|0,C=(n+8|0)+(d[e+112>>2]<<2)|0,S=(n+8|0)+(d[e+108>>2]<<2)|0,E=m[e+24>>2],R=m[e+20>>2],P=m[e+16>>2],x=d[n+36>>2],c=0;p=m[t>>2],I=m[t+4>>2],M=m[t+8>>2],d[n+20>>2]=0,m[n+16>>2]=f*y(M-E),m[n+12>>2]=T*y(I-R),m[n+8>>2]=g*y(p-P),_=o=x+(c<<4)|0,p=m[S>>2],l=y(v(p))>2]=l,_=o,p=m[C>>2],l=y(v(p))>2]=l,p=m[A>>2],d[o+12>>2]=c,_=y(v(p))>2]=_,t=t+16|0,(0|(c=c+1|0))!=(0|i););(0|i)<2||Qi(n+24|0,n+8|0,0,i+-1|0)}}else d[n+28>>2]=i;if(d[e+44>>2]=i,d[e+40>>2]=0,d[e+36>>2]=d[e+32>>2],(0|(t=d[e+84>>2]))<(0|i)){if(d[e+88>>2]<(0|i)){if(i?(d[7717]=d[7717]+1,C=0|r[d[6606]](i<<2,16),o=d[e+84>>2]):(C=0,o=t),(0|o)>=1)for(_=0;d[(l=_<<2)+C>>2]=d[l+d[e+92>>2]>>2],(0|o)!=(0|(_=_+1|0)););(o=d[e+92>>2])&&(u[e+96|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+92>>2]=0),d[e+92>>2]=C,d[e+88>>2]=i,s[e+96|0]=1}for(;d[d[e+92>>2]+(t<<2)>>2]=0,(0|i)!=(0|(t=t+1|0)););}if(d[e+84>>2]=i,(0|i)>=1)for(A=0;;){if(!((l=d[e+40>>2])||((c=d[e+36>>2])?d[e+36>>2]=d[c+8>>2]:(d[7717]=d[7717]+1,c=0|r[d[6606]](12,16),t=d[e+44>>2],d[c+8>>2]=0,d[c+4>>2]=t,d[7717]=d[7717]+1,d[c>>2]=r[d[6606]](b(t,112),16),d[c+8>>2]=d[e+32>>2],d[e+32>>2]=c),t=0,_=l=d[c>>2],(0|(o=d[c+4>>2]))<1)))for(;c=_,_=_+112|0,t=t+1|0,d[c>>2]=(0|t)<(0|o)?_:0,(0|t)!=(0|o););if(d[e+40>>2]=d[l>>2],d[l+8>>2]=0,d[l+12>>2]=0,d[l+16>>2]=0,d[l>>2]=0,d[l+4>>2]=0,d[l+104>>2]=-1,d[l+8>>2]=0,t=d[n+36>>2]+(A<<4)|0,o=d[t+4>>2],d[l+88>>2]=d[t>>2],d[l+92>>2]=o,o=d[t+12>>2],d[l+96>>2]=d[t+8>>2],d[l+100>>2]=o,d[l+104>>2]=-1,d[d[e+92>>2]+(A<<2)>>2]=l,(0|(A=A+1|0))==(0|i))break}(t=d[n+36>>2])&&(u[n+40|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[n+36>>2]=0),d[n+36>>2]=0,s[n+40|0]=1,d[n+28>>2]=0,d[n+32>>2]=0,d[e+100>>2]=-3,d[e+56>>2]=0,d[e+60>>2]=b(i,6),d[e+116>>2]=0,d[e+120>>2]=0,d[e+52>>2]=d[e+48>>2],d[n+16>>2]=0,d[n+20>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,li(e,0,i,n+8|0),d[e+124>>2]=d[n+8>>2],(e=d[n+36>>2])&&(u[n+40|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[n+36>>2]=0),O=n+48|0}function oe(e,t,i,n,o){var a,l=0,c=0,h=0,f=0,g=0,b=0;if(O=a=O-112|0,s[e+60|0]=i,i){if(function(e,t,i){var n=y(0),r=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0);r=m[t>>2],a=m[t+4>>2],l=m[t+8>>2],d[e+16>>2]=0,o=y(l-y(1)),m[e+12>>2]=o,a=y(a-y(1)),m[e+8>>2]=a,r=y(r-y(1)),m[e+4>>2]=r,l=m[i>>2],c=m[i+4>>2],h=m[i+8>>2],s[e+60|0]=1,d[e+48>>2]=0,d[e+32>>2]=0,h=y(h+y(1)),m[e+28>>2]=h,c=y(c+y(1)),m[e+24>>2]=c,l=y(l+y(1)),m[e+20>>2]=l,p=y(y(65533)/y(h-o)),m[e+44>>2]=p,_=y(y(65533)/y(c-a)),m[e+40>>2]=_,f=y(y(65533)/y(l-r)),m[e+36>>2]=f,t=(n=y(y(o-o)*p))=y(0)?~~n>>>0:0,g=y((65534&t)>>>0),u=n=a,t=(n=y(y(n-n)*_))=y(0)?~~n>>>0:0,b=y(u+y(y((65534&t)>>>0)/_)),u=n=r,t=(n=y(y(n-n)*f))=y(0)?~~n>>>0:0,!((n=y(y(u+y(y((65534&t)>>>0)/f))-y(1)))>2]=n,r=n),!((n=y(b-y(1)))>2]=n,a=n),!((n=y(y(o+y(g/p))-y(1)))>2]=n,o=n),t=(n=y(y(p*y(h-o))+y(1)))=y(0)?~~n>>>0:0,g=y((1|t)>>>0),u=n=a,t=(n=y(y(_*y(c-n))+y(1)))=y(0)?~~n>>>0:0,b=y(u+y(y((1|t)>>>0)/_)),u=n=l,_=r,t=(n=y(y(f*y(n-r))+y(1)))=y(0)?~~n>>>0:0,!(u<(n=y(y(_+y(y((1|t)>>>0)/f))+y(1))))||(m[e+20>>2]=n,l=n),!(c<(n=y(b+y(1))))||(m[e+24>>2]=n,c=n),!(h<(n=y(y(o+y(g/p))+y(1))))||(m[e+28>>2]=n,h=n),d[e+48>>2]=0,m[e+44>>2]=y(65533)/y(h-o),m[e+40>>2]=y(65533)/y(c-a),m[e+36>>2]=y(65533)/y(l-r)}(e,n,o),d[a+96>>2]=e,d[a+92>>2]=e+104,d[a+88>>2]=15236,r[d[d[t>>2]+8>>2]](t,a+88|0,e+4|0,e+20|0),o=d[e+108>>2],d[a+16>>2]=0,d[a+20>>2]=0,d[a+8>>2]=0,d[a+12>>2]=0,(0|(i=d[e+128>>2]))<(0|(l=o<<1))){if(d[e+132>>2]<(0|l)){if(o?(d[7717]=d[7717]+1,f=0|r[d[6606]](o<<5,16),n=d[e+128>>2]):n=i,(0|n)>=1)for(t=0;h=g=(c=t<<4)+f|0,c=c+d[e+136>>2]|0,b=d[c+4>>2],d[h>>2]=d[c>>2],d[h+4>>2]=b,h=d[c+12>>2],d[g+8>>2]=d[c+8>>2],d[g+12>>2]=h,(0|n)!=(0|(t=t+1|0)););(t=d[e+136>>2])&&(u[e+140|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+136>>2]=0),d[e+136>>2]=f,d[e+132>>2]=l,s[e+140|0]=1}for(;f=d[a+12>>2],t=d[e+136>>2]+(i<<4)|0,d[t>>2]=d[a+8>>2],d[t+4>>2]=f,n=d[a+20>>2],d[t+8>>2]=d[a+16>>2],d[t+12>>2]=n,(0|l)!=(0|(i=i+1|0)););}d[e+128>>2]=l}else{if(d[a+104>>2]=15368,d[a+108>>2]=e- -64,d[a+96>>2]=-581039253,d[a+100>>2]=0,d[a+88>>2]=-581039253,d[a+92>>2]=-581039253,d[a+80>>2]=1566444395,d[a+84>>2]=0,d[a+72>>2]=1566444395,d[a+76>>2]=1566444395,r[d[d[t>>2]+8>>2]](t,a+104|0,a+88|0,a+72|0),o=d[e+68>>2],d[(t=a- -64|0)>>2]=0,d[t+4>>2]=0,d[a+56>>2]=0,d[a+60>>2]=0,d[a+48>>2]=0,d[a+52>>2]=0,d[a+40>>2]=0,d[a+44>>2]=0,d[a+32>>2]=0,d[a+36>>2]=0,d[a+24>>2]=0,d[a+28>>2]=0,d[a+16>>2]=0,d[a+20>>2]=0,d[a+8>>2]=0,d[a+12>>2]=0,(0|(t=d[e+88>>2]))<(0|(c=o<<1))){if(d[e+92>>2]<(0|c)){if(o?(d[7717]=d[7717]+1,f=0|r[d[6606]](o<<7,16),i=d[e+88>>2]):i=t,(0|i)>=1)for(;l=(n=g<<6)+f|0,n=n+d[e+96>>2]|0,b=d[n+4>>2],d[l>>2]=d[n>>2],d[l+4>>2]=b,h=d[n+60>>2],d[l+56>>2]=d[n+56>>2],d[l+60>>2]=h,h=d[n+52>>2],d[l+48>>2]=d[n+48>>2],d[l+52>>2]=h,h=d[n+44>>2],d[l+40>>2]=d[n+40>>2],d[l+44>>2]=h,h=d[n+36>>2],d[l+32>>2]=d[n+32>>2],d[l+36>>2]=h,h=d[n+28>>2],d[l+24>>2]=d[n+24>>2],d[l+28>>2]=h,h=d[n+20>>2],d[l+16>>2]=d[n+16>>2],d[l+20>>2]=h,h=d[n+12>>2],d[l+8>>2]=d[n+8>>2],d[l+12>>2]=h,(0|i)!=(0|(g=g+1|0)););(i=d[e+96>>2])&&(u[e+100|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+96>>2]=0),d[e+96>>2]=f,d[e+92>>2]=c,s[e+100|0]=1}for(;l=d[a+12>>2],i=d[e+96>>2]+(t<<6)|0,d[i>>2]=d[a+8>>2],d[i+4>>2]=l,l=d[4+(n=a- -64|0)>>2],d[i+56>>2]=d[n>>2],d[i+60>>2]=l,n=d[a+60>>2],d[i+48>>2]=d[a+56>>2],d[i+52>>2]=n,n=d[a+52>>2],d[i+40>>2]=d[a+48>>2],d[i+44>>2]=n,n=d[a+44>>2],d[i+32>>2]=d[a+40>>2],d[i+36>>2]=n,n=d[a+36>>2],d[i+24>>2]=d[a+32>>2],d[i+28>>2]=n,n=d[a+28>>2],d[i+16>>2]=d[a+24>>2],d[i+20>>2]=n,n=d[a+20>>2],d[i+8>>2]=d[a+16>>2],d[i+12>>2]=n,(0|c)!=(0|(t=t+1|0)););}d[e+88>>2]=c}if(d[e+56>>2]=0,Be(e,0,o),!(d[e+152>>2]|!u[e+60|0])){if(t=e,d[e+156>>2])o=d[e+160>>2],i=1;else{if(d[7717]=d[7717]+1,o=0|r[d[6606]](32,16),(0|(f=d[e+152>>2]))>=1)for(n=0;l=(i=n<<5)+o|0,i=i+d[e+160>>2]|0,g=d[i+4>>2],d[l>>2]=d[i>>2],d[l+4>>2]=g,c=d[i+28>>2],d[l+24>>2]=d[i+24>>2],d[l+28>>2]=c,c=d[i+20>>2],d[l+16>>2]=d[i+16>>2],d[l+20>>2]=c,c=d[i+12>>2],d[l+8>>2]=d[i+8>>2],d[l+12>>2]=c,(0|f)!=(0|(n=n+1|0)););(i=d[e+160>>2])&&(u[e+164|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+160>>2]=0),d[e+160>>2]=o,d[e+156>>2]=1,s[e+164|0]=1,i=d[e+152>>2]+1|0}d[t+152>>2]=i,t=d[a+36>>2],d[o+24>>2]=d[a+32>>2],d[o+28>>2]=t,t=d[a+28>>2],d[o+16>>2]=d[a+24>>2],d[o+20>>2]=t,t=d[a+20>>2],d[o+8>>2]=d[a+16>>2],d[o+12>>2]=t,t=d[a+12>>2],d[o>>2]=d[a+8>>2],d[o+4>>2]=t,t=d[e+160>>2],i=d[e+136>>2],_[t>>1]=p[i>>1],_[t+2>>1]=p[i+2>>1],_[t+4>>1]=p[i+4>>1],_[t+6>>1]=p[i+6>>1],_[t+8>>1]=p[i+8>>1],n=p[i+10>>1],d[t+12>>2]=0,_[t+10>>1]=n,n=t,t=d[i+12>>2],d[n+16>>2]=(0|t)>-1?1:0-t|0}d[e+168>>2]=d[e+152>>2],(t=d[e+116>>2])&&(u[e+120|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+116>>2]=0),d[e+116>>2]=0,s[e+120|0]=1,d[e+108>>2]=0,d[e+112>>2]=0,(t=d[e+76>>2])&&(u[e+80|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+76>>2]=0),d[e+76>>2]=0,s[e+80|0]=1,d[e+68>>2]=0,d[e+72>>2]=0,O=a+112|0}function ae(e,t,i,n,s,o){var a,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=0,S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=0,N=0,L=y(0),k=y(0),V=y(0),U=y(0),G=0;if(O=a=O-544|0,d[o>>2]=0,d[o+4>>2]=0,d[o+32>>2]=0,d[o+24>>2]=0,d[o+28>>2]=0,d[o+16>>2]=0,d[o+20>>2]=0,d[o+8>>2]=0,d[o+12>>2]=0,d[a+388>>2]=i,d[a+384>>2]=e,h=m[n+20>>2],_=m[n+36>>2],u=m[t+20>>2],p=m[t+36>>2],g=m[n+24>>2],l=m[t+24>>2],c=m[n+40>>2],b=m[t+40>>2],v=m[n+32>>2],A=m[n>>2],S=m[n+16>>2],T=m[n+4>>2],E=m[t+32>>2],P=m[t>>2],I=m[t+16>>2],M=m[t+4>>2],R=m[n+8>>2],D=m[t+8>>2],d[a+436>>2]=0,d[a+420>>2]=0,d[a+404>>2]=0,w=y(y(y(D*R)+y(l*g))+y(b*c)),m[a+432>>2]=w,F=y(y(y(M*R)+y(u*g))+y(p*c)),m[a+428>>2]=F,g=y(y(y(P*R)+y(I*g))+y(E*c)),m[a+424>>2]=g,c=y(y(y(D*T)+y(l*h))+y(b*_)),m[a+416>>2]=c,R=y(y(y(M*T)+y(u*h))+y(p*_)),m[a+412>>2]=R,h=y(y(y(P*T)+y(I*h))+y(E*_)),m[a+408>>2]=h,_=y(y(y(A*D)+y(S*l))+y(v*b)),m[a+400>>2]=_,u=y(y(y(A*M)+y(S*u))+y(v*p)),m[a+396>>2]=u,p=y(y(y(A*P)+y(S*I))+y(v*E)),m[a+392>>2]=p,l=m[t+20>>2],b=m[t+36>>2],v=m[t+24>>2],A=m[t+52>>2],S=m[n+52>>2],T=m[t+40>>2],E=m[t+56>>2],P=m[n+56>>2],I=m[t>>2],M=m[t+16>>2],D=m[t+32>>2],L=m[t+4>>2],k=m[t+8>>2],V=m[t+48>>2],U=m[n+48>>2],d[a+508>>2]=0,d[a+500>>2]=0,d[a+484>>2]=0,m[a+480>>2]=w,m[a+476>>2]=c,m[a+472>>2]=_,d[a+468>>2]=0,m[a+464>>2]=F,m[a+460>>2]=R,m[a+456>>2]=u,d[a+452>>2]=0,m[a+448>>2]=g,m[a+444>>2]=h,h=y(U-V),_=y(S-A),u=y(P-E),m[a+496>>2]=y(y(k*h)+y(v*_))+y(T*u),m[a+492>>2]=y(y(h*L)+y(_*l))+y(u*b),m[a+488>>2]=y(y(h*I)+y(_*M))+y(u*D),d[a+504>>2]=98,m[a+440>>2]=p,d[a+136>>2]=0,d[a+140>>2]=0,d[a+128>>2]=0,d[a+132>>2]=0,d[a+364>>2]=0,d[a+368>>2]=0,d[a+376>>2]=2,d[a+144>>2]=0,e=Q(a,a+384|0,s))d[o>>2]=1==(0|e)?1:2;else{if(C=d[a+372>>2],d[C+32>>2])for(l=y(0),n=0,g=y(0),p=y(0),u=y(0),_=y(0),h=y(0);c=m[16+(s=(i=n<<2)+C|0)>>2],e=d[a+504>>2],C=a+528|0,B=d[a+508>>2],G=N=d[a+384>>2]+(B>>1)|0,s=d[s>>2],1&B&&(e=d[e+d[N>>2]>>2]),r[e](C,G,s),s=d[a+508>>2],e=d[a+388>>2]+(s>>1)|0,S=y(c*m[a+536>>2]),T=y(c*m[a+532>>2]),E=y(c*m[a+528>>2]),i=d[i+d[a+372>>2]>>2],b=m[i+8>>2],v=m[i>>2],A=y(-m[i+4>>2]),C=d[a+504>>2],C=1&s?d[d[e>>2]+C>>2]:C,l=y(l+S),g=y(g+T),p=y(p+E),d[a+524>>2]=0,m[a+520>>2]=y(y(m[a+428>>2]*A)-y(v*m[a+424>>2]))-y(b*m[a+432>>2]),m[a+516>>2]=y(y(m[a+412>>2]*A)-y(v*m[a+408>>2]))-y(b*m[a+416>>2]),m[a+512>>2]=y(y(m[a+396>>2]*A)-y(v*m[a+392>>2]))-y(b*m[a+400>>2]),r[C](a+528|0,e,a+512|0),b=m[a+528>>2],v=m[a+532>>2],A=m[a+536>>2],u=y(u+y(c*y(y(y(y(b*m[a+472>>2])+y(v*m[a+476>>2]))+y(A*m[a+480>>2]))+m[a+496>>2]))),_=y(_+y(c*y(y(y(y(b*m[a+456>>2])+y(v*m[a+460>>2]))+y(A*m[a+464>>2]))+m[a+492>>2]))),h=y(h+y(c*y(y(y(y(b*m[a+440>>2])+y(v*m[a+444>>2]))+y(A*m[a+448>>2]))+m[a+488>>2]))),n=n+1|0,C=d[a+372>>2],n>>>0>2];);else h=y(0),_=y(0),u=y(0),p=y(0),g=y(0),l=y(0);c=m[t+48>>2],b=m[t+8>>2],v=m[t>>2],A=m[t+4>>2],S=m[t+52>>2],T=m[t+24>>2],E=m[t+16>>2],P=m[t+20>>2],I=m[t+56>>2],M=m[t+40>>2],R=m[t+32>>2],D=m[t+36>>2],d[o+16>>2]=0,m[o+12>>2]=I+y(y(y(p*R)+y(g*D))+y(l*M)),m[o+8>>2]=S+y(y(y(p*E)+y(g*P))+y(l*T)),m[o+4>>2]=c+y(y(y(p*v)+y(g*A))+y(l*b)),b=m[t+48>>2],v=m[t+8>>2],A=m[t>>2],S=m[t+4>>2],T=m[t+52>>2],E=m[t+24>>2],P=m[t+16>>2],I=m[t+20>>2],M=m[t+56>>2],R=m[t+40>>2],D=m[t+32>>2],w=m[t+36>>2],p=y(p-h),g=y(g-_),l=y(l-u),c=y(x(y(y(y(p*p)+y(g*g))+y(l*l)))),m[o+52>>2]=c,d[o+48>>2]=0,d[o+32>>2]=0,F=l,l=c>y(9999999747378752e-20)?y(y(1)/c):y(1),m[o+44>>2]=F*l,m[o+40>>2]=g*l,m[o+36>>2]=p*l,m[o+28>>2]=M+y(y(y(h*D)+y(_*w))+y(u*R)),m[o+24>>2]=T+y(y(y(h*P)+y(_*I))+y(u*E)),m[o+20>>2]=b+y(y(y(h*A)+y(_*S))+y(u*v)),C=1}return O=a+544|0,C}function le(e,t){var i=y(0),n=0,r=0,s=0,o=y(0),_=0,d=0,u=y(0),p=y(0),f=y(0),g=0,b=y(0),A=0,C=y(0),S=y(0),T=y(0),E=y(0);o=y(1);e:{t:{l(e);i:if(1065353216!=(0|(_=c(0)))&&(l(t),n=2147483647&(d=c(0)))){if(r=2147483647&_,!(n>>>0<2139095041&&r>>>0<=2139095040))return y(e+t);g=0,(0|_)>-1||(g=2,n>>>0>1266679807||(g=0,n>>>0<1065353216||(g=0,(0|n)==(A=n>>>(s=150-(n>>>23|0)|0)|0)<>>0>=1065353217?(0|d)>-1?t:y(0):y((0|d)>-1?0:-t)}return(0|d)>-1?e:y(y(1)/e)}if(1073741824==(0|d))return y(e*e);if(!(1056964608!=(0|d)|(0|_)<0))return y(x(e));if(i=y(v(e)),!r||1065353216==(1073741823&_)){if(o=(0|d)<0?y(y(1)/i):i,(0|_)>-1)break i;return s|r+-1065353216?1==(0|s)?y(-o):o:(e=y(o-o),y(e/e))}n:if(!((0|_)>-1)){r:switch(0|s){case 0:return e=y(e-e),y(e/e);case 1:break r;default:break n}o=y(-1)}if(n>>>0>=1291845633){if(r>>>0<=1065353207)return y((0|d)<0?y(o*y(1.0000000150474662e30))*y(1.0000000150474662e30):y(o*y(1.0000000031710769e-30))*y(1.0000000031710769e-30));if(r>>>0>=1065353224)return y((0|d)>0?y(o*y(1.0000000150474662e30))*y(1.0000000150474662e30):y(o*y(1.0000000031710769e-30))*y(1.0000000031710769e-30));e=y(i+y(-1)),i=y(e*y(1.44268798828125)),u=y(y(e*y(7052607543300837e-21))+y(y(y(e*e)*y(y(.5)-y(e*y(y(e*y(-.25))+y(.3333333432674408)))))*y(-1.4426950216293335))),a(0,-4096&(l(y(i+u)),c(0))),e=h(),b=y(e-i)}else s=1065353216|(_=8388607&(r=(n=r>>>0<8388608)?(l(y(i*y(16777216))),c(0)):r)),n=(r>>23)+(n?-151:-127)|0,r=0,_>>>0<1885298||(_>>>0<6140887?r=1:(s=s+-8388608|0,n=n+1|0)),b=m[25968+(_=r<<2)>>2],a(0,s),u=h(),p=m[_+25952>>2],f=y(u-p),C=y(y(1)/y(p+u)),a(0,-4096&(l(i=y(f*C)),c(0))),e=h(),S=y(e*e),T=e,E=f,a(0,4194304+((s>>1&-536875008|536870912)+(r<<21)|0)|0),f=h(),u=y(C*y(y(E-y(e*f))-y(e*y(u-y(f-p))))),f=y(y(i+e)*u),e=y(i*i),p=y(f+y(y(e*e)*y(y(e*y(y(e*y(y(e*y(y(e*y(y(e*y(.20697501301765442))+y(.23066075146198273)))+y(.2727281153202057)))+y(.3333333432674408)))+y(.4285714328289032)))+y(.6000000238418579)))),a(0,-4096&(l(y(y(S+y(3))+p)),c(0))),e=h(),f=y(T*e),i=y(y(u*e)+y(i*y(p-y(y(e+y(-3))-S)))),a(0,-4096&(l(y(f+i)),c(0))),e=h(),p=y(e*y(.9619140625)),u=y(m[_+25960>>2]+y(y(y(i-y(e-f))*y(.9617967009544373))+y(e*y(-.00011736857413779944)))),i=y(0|n),a(0,-4096&(l(y(y(b+y(p+u))+i)),c(0))),e=h(),b=y(y(y(e-i)-b)-p);if(a(0,-4096&d),p=h(),i=y(e*p),e=y(y(y(u-b)*t)+y(y(t-p)*e)),l(t=y(i+e)),(0|(s=c(0)))>=1124073473)break t;r=1124073472;n:{r:{if(1124073472==(0|s)){if(!(y(e+y(4.299566569443414e-8))>y(t-i)))break r;break t}if(r=2147483647&s,!(e<=y(t-i)^1|-1021968384!=(0|s))|r>>>0>=1125515265)break e;if(n=0,r>>>0<1056964609)break n}n=(8388607&(d=(8388608>>>(r>>>23|0)-126|0)+s|0)|8388608)>>>150-(r=d>>>23&255)|0,n=(0|s)<0?0-n|0:n,i=y(i-(a(0,d&-8388608>>r+-127),h())),l(y(e+i)),s=c(0)}a(0,-32768&s),t=h(),u=y(t*y(.693145751953125)),i=y(y(t*y(14286065379565116e-22))+y(y(e-y(t-i))*y(.6931471824645996))),e=y(u+i),t=y(e*e),t=y(e-y(t*y(y(t*y(y(t*y(y(t*y(y(t*y(4.138136944220605e-8))+y(-16533901998627698e-22)))+y(661375597701408e-19)))+y(-.0027777778450399637)))+y(.1666666716337204)))),f=y(y(e*t)/y(t+y(-2))),t=y(i-y(e-u)),(0|(s=0|(l(e=y(y(e-y(f-y(t+y(e*t))))+y(1))),c(0)+(n<<23))))<=8388607?e=function(e,t){n:if((0|t)>=128){if(e=y(e*y(17014118346046923e22)),(0|t)<255){t=t+-127|0;break n}e=y(e*y(17014118346046923e22)),t=((0|t)<381?t:381)+-254|0}else(0|t)>-127||(e=y(e*y(11754943508222875e-54)),(0|t)>-253?t=t+126|0:(e=y(e*y(11754943508222875e-54)),t=((0|t)>-378?t:-378)+252|0));return y(e*(a(0,1065353216+(t<<23)|0),h()))}(e,n):(a(0,s),e=h()),o=y(o*e)}return o}return y(y(o*y(1.0000000150474662e30))*y(1.0000000150474662e30))}return y(y(o*y(1.0000000031710769e-30))*y(1.0000000031710769e-30))}function ce(e){var t,i=y(0),n=y(0),r=y(0),o=0,a=y(0),l=y(0),c=0,h=y(0),_=y(0),p=y(0),f=y(0),g=0,b=y(0),v=y(0),A=0,C=y(0),S=y(0),x=y(0),T=y(0),E=y(0);O=t=O-16|0;e:if(u[e+356|0]){s[e+356|0]=0,s[e+352|0]=0,d[e+344>>2]=0,d[e+348>>2]=0,d[e+336>>2]=0,d[e+340>>2]=0,c=-16&u[0|(g=e+332|0)],s[0|g]=c,A=e+316|0;t:{i:switch(d[e>>2]-1|0){case 0:o=d[e+168>>2],d[e+260>>2]=d[e+164>>2],d[e+264>>2]=o,o=d[e+88>>2],d[e+244>>2]=d[e+84>>2],d[e+248>>2]=o,o=d[e+176>>2],d[e+268>>2]=d[e+172>>2],d[e+272>>2]=o,o=d[e+96>>2],d[e+252>>2]=d[e+92>>2],d[e+256>>2]=o,s[e+352|0]=0,d[e+288>>2]=0,m[e+280>>2]=m[e+248>>2]-m[e+264>>2],m[e+276>>2]=m[e+244>>2]-m[e+260>>2],m[e+284>>2]=m[e+252>>2]-m[e+268>>2],d[e+344>>2]=0,d[e+348>>2]=0,d[e+336>>2]=1065353216,d[e+340>>2]=0,s[e+332|0]=c,o=1;break t;case 1:if(l=m[e+4>>2],n=y(m[e+20>>2]-l),h=m[e+8>>2],r=y(m[e+24>>2]-h),_=m[e+12>>2],a=y(m[e+28>>2]-_),o=1,(l=y(y(y(y(y(0)-l)*n)+y(y(y(0)-h)*r))+y(y(y(0)-_)*a)))>y(0)&&(l<(i=y(y(y(n*n)+y(r*r))+y(a*a)))?(i=y(l/i),o=3):(i=y(1),o=2)),d[e+344>>2]=0,d[e+348>>2]=0,m[e+340>>2]=i,m[e+336>>2]=y(1)-i,s[e+332|0]=o|c,o=0,d[e+256>>2]=0,n=m[e+92>>2],l=y(n+y(i*y(m[e+108>>2]-n))),m[e+252>>2]=l,n=m[e+88>>2],h=y(n+y(i*y(m[e+104>>2]-n))),m[e+248>>2]=h,n=m[e+84>>2],_=y(n+y(i*y(m[e+100>>2]-n))),m[e+244>>2]=_,p=m[e+180>>2],f=m[e+184>>2],n=m[e+168>>2],b=m[e+188>>2],r=m[e+172>>2],a=m[e+164>>2],d[e+288>>2]=0,r=y(r+y(i*y(b-r))),m[e+284>>2]=l-r,n=y(n+y(i*y(f-n))),m[e+280>>2]=h-n,i=y(a+y(i*y(p-a))),m[e+276>>2]=_-i,d[e+272>>2]=0,m[e+268>>2]=r,m[e+264>>2]=n,m[e+260>>2]=i,Dt(e,e+332|0),m[e+336>>2]>=y(0)^1|m[e+340>>2]>=y(0)^1|m[e+344>>2]>=y(0)^1)break t;o=m[e+348>>2]>=y(0);break t;case 2:if(d[(c=t)+8>>2]=0,d[c+12>>2]=0,d[c>>2]=0,d[c+4>>2]=0,ct(c,e+4|0,e+20|0,e+36|0,A),d[e+256>>2]=0,i=m[e+336>>2],n=m[e+340>>2],r=m[e+344>>2],a=y(y(y(i*m[e+92>>2])+y(n*m[e+108>>2]))+y(r*m[e+124>>2])),m[e+252>>2]=a,l=y(y(y(i*m[e+88>>2])+y(n*m[e+104>>2]))+y(r*m[e+120>>2])),m[e+248>>2]=l,h=y(y(y(i*m[e+84>>2])+y(n*m[e+100>>2]))+y(r*m[e+116>>2])),m[e+244>>2]=h,_=m[e+180>>2],p=m[e+196>>2],f=m[e+168>>2],b=m[e+184>>2],C=m[e+200>>2],S=m[e+172>>2],x=m[e+188>>2],T=m[e+204>>2],E=m[e+164>>2],d[e+288>>2]=0,v=a,a=y(y(y(i*S)+y(n*x))+y(r*T)),m[e+284>>2]=v-a,v=l,l=y(y(y(i*f)+y(n*b))+y(r*C)),m[e+280>>2]=v-l,i=y(y(y(i*E)+y(n*_))+y(r*p)),m[e+276>>2]=h-i,d[e+272>>2]=0,m[e+268>>2]=a,m[e+264>>2]=l,m[e+260>>2]=i,Dt(e,g),m[e+336>>2]>=y(0)^1|m[e+340>>2]>=y(0)^1|m[e+344>>2]>=y(0)^1)break t;o=m[e+348>>2]>=y(0);break t;case 3:break i;default:break t}if(d[(c=t)+8>>2]=0,d[c+12>>2]=0,d[c>>2]=0,d[c+4>>2]=0,function(e,t,i,n,r,o){var a,l,c,h,_=y(0),p=y(0),f=y(0),g=y(0),b=0,v=y(0),A=y(0),C=y(0),S=0,x=y(0),T=y(0),E=0,R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0);return O=a=O-48|0,s[a+24|0]=0,b=d[e+12>>2],d[o+8>>2]=d[e+8>>2],d[o+12>>2]=b,b=d[e+4>>2],d[o>>2]=d[e>>2],d[o+4>>2]=b,s[o+16|0]=15|u[o+16|0],X=m[e+8>>2],R=m[t+8>>2],j=y(X-R),P=m[i+8>>2],I=y(P-R),Y=m[n>>2],M=m[t>>2],D=y(Y-M),G=m[r+4>>2],w=m[t+4>>2],F=y(G-w),B=m[n+4>>2],N=y(B-w),v=m[r>>2],L=y(v-M),A=y(y(D*F)-y(N*L)),k=m[i>>2],V=y(k-M),Q=m[r+8>>2],C=y(Q-R),f=m[n+8>>2],g=y(f-R),_=y(y(N*C)-y(g*F)),U=m[i+4>>2],x=y(U-w),p=y(y(g*L)-y(D*C)),T=y(y(I*A)+y(y(V*_)+y(x*p))),q=m[e>>2],W=y(q-M),K=m[e+4>>2],z=y(K-w),l=y(T*T)>2],_=y(v-m[e>>2]),p=y(_*_),A=m[a+12>>2],_=y(A-m[e+4>>2]),p=y(p+y(_*_)),f=m[a+16>>2],_=y(f-m[e+8>>2]),_=y(p+y(_*_)),p=y(34028234663852886e22),_>2]=d[a+20>>2],m[o+8>>2]=f,m[o+4>>2]=A,m[o>>2]=v,b=u[a+24|0],s[o+16|0]=1&b|240&u[o+16|0]|2&b|4&b,E=d[a+36>>2],S=d[a+32>>2],b=d[a+28>>2],d[o+32>>2]=0,d[o+28>>2]=E,d[o+20>>2]=b,d[o+24>>2]=S,p=_)),l&&(ct(e,t,n,r,a+8|0),v=m[a+8>>2],_=y(v-m[e>>2]),g=y(_*_),A=m[a+12>>2],_=y(A-m[e+4>>2]),g=y(g+y(_*_)),f=m[a+16>>2],_=y(f-m[e+8>>2]),(_=y(g+y(_*_)))>2]=d[a+20>>2],m[o+8>>2]=f,m[o+4>>2]=A,m[o>>2]=v,S=(b=u[a+24|0])<<1,s[o+16|0]=8&S|4&S|1&b|240&u[o+16|0],E=d[a+36>>2],S=d[a+32>>2],b=d[a+28>>2],d[o+24>>2]=0,d[o+28>>2]=S,d[o+32>>2]=E,d[o+20>>2]=b,p=_)),h&&(ct(e,t,r,i,a+8|0),v=m[a+8>>2],_=y(v-m[e>>2]),g=y(_*_),A=m[a+12>>2],_=y(A-m[e+4>>2]),g=y(g+y(_*_)),f=m[a+16>>2],_=y(f-m[e+8>>2]),(_=y(g+y(_*_)))>2]=d[a+20>>2],m[o+8>>2]=f,m[o+4>>2]=A,m[o>>2]=v,t=u[a+24|0],s[o+16|0]=1&t|240&u[o+16|0]|t>>>1&2|t<<2&8,b=d[a+36>>2],t=d[a+28>>2],d[o+32>>2]=d[a+32>>2],d[o+28>>2]=0,d[o+24>>2]=b,d[o+20>>2]=t,p=_)),c?(ct(e,i,r,n,a+8|0),E=1,v=m[a+8>>2],_=y(v-m[e>>2]),g=y(_*_),A=m[a+12>>2],_=y(A-m[e+4>>2]),g=y(g+y(_*_)),f=m[a+16>>2],_=y(f-m[e+8>>2]),y(g+y(_*_))>2]=d[a+20>>2],m[o+8>>2]=f,m[o+4>>2]=A,m[o>>2]=v,e=u[a+24|0],s[o+16|0]=4&e|240&u[o+16|0]|e<<1&2|e<<2&8,t=d[a+36>>2],e=d[a+28>>2],d[o+32>>2]=d[a+32>>2],d[o+28>>2]=t,d[o+24>>2]=e,d[o+20>>2]=0)):E=1),O=a+48|0,E}(c,e+4|0,e+20|0,e+36|0,e+52|0,A)){if(d[e+256>>2]=0,i=m[e+336>>2],n=m[e+340>>2],r=m[e+344>>2],a=m[e+348>>2],l=y(y(y(y(i*m[e+92>>2])+y(n*m[e+108>>2]))+y(r*m[e+124>>2]))+y(a*m[e+140>>2])),m[e+252>>2]=l,h=y(y(y(y(i*m[e+88>>2])+y(n*m[e+104>>2]))+y(r*m[e+120>>2]))+y(a*m[e+136>>2])),m[e+248>>2]=h,_=y(y(y(y(i*m[e+84>>2])+y(n*m[e+100>>2]))+y(r*m[e+116>>2]))+y(a*m[e+132>>2])),m[e+244>>2]=_,d[e+288>>2]=0,d[e+272>>2]=0,p=y(y(y(y(i*m[e+164>>2])+y(n*m[e+180>>2]))+y(r*m[e+196>>2]))+y(a*m[e+212>>2])),m[e+260>>2]=p,f=y(y(y(y(i*m[e+168>>2])+y(n*m[e+184>>2]))+y(r*m[e+200>>2]))+y(a*m[e+216>>2])),m[e+264>>2]=f,i=y(y(y(y(i*m[e+172>>2])+y(n*m[e+188>>2]))+y(r*m[e+204>>2]))+y(a*m[e+220>>2])),m[e+268>>2]=i,m[e+276>>2]=_-p,m[e+280>>2]=h-f,m[e+284>>2]=l-i,Dt(e,e+332|0),m[e+336>>2]>=y(0)^1|m[e+340>>2]>=y(0)^1|m[e+344>>2]>=y(0)^1)break t;o=m[e+348>>2]>=y(0)}else if(!u[e+352|0]){d[e+276>>2]=0,d[e+280>>2]=0,o=1,s[e+312|0]=1,d[e+284>>2]=0,d[e+288>>2]=0;break e}}s[e+312|0]=o}else o=u[e+312|0];return O=t+16|0,0!=(0|o)}function he(e,t,i,n,r){var o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=0,I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=0,U=y(0),G=y(0),j=y(0),W=y(0);if(O=o=O-48|0,m[t+52>>2]>2]){P=d[t+48>>2],C=m[t+44>>2],_=m[t+40>>2],u=m[t+36>>2],a=qi(i),p=y(m[t+12>>2]-m[a+56>>2]),f=y(m[t+8>>2]-m[a+52>>2]),c=m[a+48>>2],l=m[t+4>>2],a=qi(n),g=y(l-c),l=y(y(1)/y(x(y(y(y(u*u)+y(_*_))+y(C*C))))),M=y(C*l),D=y(_*l),w=y(u*l),b=y(m[t+28>>2]-m[a+56>>2]),v=y(m[t+24>>2]-m[a+52>>2]),A=y(m[t+20>>2]-m[a+48>>2]);e:{t:{if(!(a=d[i+4>>2])){if(a=d[i>>2])break t;l=y(0);break e}h=m[a+328>>2],c=m[a+332>>2],S=y(y(f*h)-y(g*c)),l=m[a+336>>2],T=y(y(g*l)-y(p*h)),h=y(y(p*c)-y(f*l)),E=m[a+316>>2],R=m[a+312>>2],l=m[a+320>>2];break e}h=m[a+332>>2],c=m[a+336>>2],S=y(y(f*h)-y(g*c)),l=m[a+340>>2],T=y(y(g*l)-y(p*h)),h=y(y(p*c)-y(f*l)),E=m[a+320>>2],R=m[a+316>>2],l=m[a+324>>2]}U=y(l+S),G=y(E+T),j=y(R+h);e:{t:{if(!(a=d[n+4>>2])){if(a=d[n>>2])break t;T=y(0),S=y(0),E=y(0),R=y(0),F=y(0);break e}h=m[a+328>>2],c=m[a+332>>2],R=y(y(v*h)-y(A*c)),l=m[a+336>>2],E=y(y(A*l)-y(b*h)),k=y(y(b*c)-y(v*l)),T=m[a+316>>2],S=m[a+312>>2],F=m[a+320>>2];break e}h=m[a+332>>2],c=m[a+336>>2],R=y(y(v*h)-y(A*c)),l=m[a+340>>2],E=y(y(A*l)-y(b*h)),k=y(y(b*c)-y(v*l)),T=m[a+320>>2],S=m[a+316>>2],F=m[a+324>>2]}W=m[e+12>>2],I=m[t+52>>2],t=d[i+4>>2],d[r+4>>2]=d[i>>2],d[r+8>>2]=t,d[r+12>>2]=d[i+8>>2],a=d[n+4>>2],d[(t=r)+16>>2]=d[n>>2],d[t+20>>2]=a,d[t+24>>2]=d[n+8>>2],a=qi(i),B=m[a+36>>2],N=m[a+20>>2],L=m[a+40>>2],C=m[a+24>>2],_=m[a+4>>2],u=m[a+8>>2],h=m[a+32>>2],c=m[a>>2],l=m[a+16>>2],d[t+40>>2]=0,m[t+28>>2]=y(y(g*c)+y(f*l))+y(p*h),m[t+36>>2]=y(y(g*u)+y(f*C))+y(p*L),m[t+32>>2]=y(y(g*_)+y(f*N))+y(p*B),a=qi(n),B=m[a+36>>2],N=m[a+20>>2],L=m[a+40>>2],C=m[a+24>>2],_=m[a+4>>2],u=m[a+8>>2],h=m[a+32>>2],c=m[a>>2],l=m[a+16>>2],d[t+192>>2]=0,m[t+188>>2]=b,m[t+184>>2]=v,m[(V=t+180|0)>>2]=A,d[t+176>>2]=0,m[t+172>>2]=p,m[t+168>>2]=f,m[t+164>>2]=g,d[t+56>>2]=0,d[t+156>>2]=0,d[t+160>>2]=0,d[t+60>>2]=1065353216,d[t+64>>2]=1065353216,d[t+208>>2]=P,m[t+204>>2]=M,m[t+200>>2]=D,m[t+196>>2]=w,d[t+84>>2]=0,I=y(I-W),m[t+80>>2]=M*I,m[t+76>>2]=D*I,m[t+72>>2]=w*I,d[t+68>>2]=1065353216,m[t+44>>2]=y(y(A*c)+y(v*l))+y(b*h),m[t+52>>2]=y(y(A*u)+y(v*C))+y(b*L),m[t+48>>2]=y(y(A*_)+y(v*N))+y(b*B),s[t+152|0]=0,h=y(j-y(S+k)),c=y(G-y(T+E)),l=y(U-y(F+R)),_=y(y(y(w*h)+y(D*c))+y(M*l)),u=m[e+16>>2],l=y(l-y(M*_)),p=y(l*l),l=y(h-y(w*_)),h=y(l*l),l=y(c-y(D*_)),m[t+212>>2]=y(p+y(h+y(l*l)))>2])e=e+344|0;else{if(e=d[i>>2],c=y(0),!e)break e;e=e+128|0}c=m[e>>2]}1&s[30696]||mc(30696)&&(d[7672]=0,d[7673]=0,d[7670]=0,d[7671]=0,d[7668]=0,d[7669]=0,d[7666]=0,d[7667]=0,d[7664]=0,d[7665]=0,d[7662]=0,d[7663]=0,uh(30696)),P=(e=d[i>>2])?e+180|0:30648,i=(a=d[i+4>>2])+264|0;e:{if(e=d[n+4>>2])e=e+344|0;else{if(e=d[n>>2],l=y(0),!e)break e;e=e+128|0}l=m[e>>2]}t=r+164|0,e=a?i:P,a=1,1&s[30696]||mc(30696)&&(d[7672]=0,d[7673]=0,d[7670]=0,d[7671]=0,d[7668]=0,d[7669]=0,d[7666]=0,d[7667]=0,d[7664]=0,d[7665]=0,d[7662]=0,d[7663]=0,uh(30696)),i=e,P=t,t=d[n+4>>2],e=d[n>>2],function(e,t,i,n,r,s,o){var a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0);f=m[i+40>>2],g=m[i+24>>2],b=m[i+36>>2],h=m[i+20>>2],v=m[s+40>>2],T=m[s+24>>2],A=m[s+36>>2],C=m[s+20>>2],a=m[n+4>>2],S=m[i+8>>2],x=m[i+4>>2],I=m[i+32>>2],l=m[n>>2],M=m[i>>2],_=m[n+8>>2],D=m[i+16>>2],c=m[o+4>>2],O=m[s+8>>2],w=m[s+4>>2],F=m[s+32>>2],u=m[o>>2],B=m[s>>2],p=m[o+8>>2],N=m[s+16>>2],d[e+44>>2]=0,d[e+28>>2]=0,d[e+12>>2]=0,L=y(y(y(_*x)+y(h*y(0)))-y(l*b)),k=y(y(y(_*M)+y(D*y(0)))-y(l*I)),V=y(y(y(_*S)+y(g*y(0)))-y(l*f)),U=y(y(y(p*w)+y(C*y(0)))-y(u*A)),G=y(y(y(p*B)+y(N*y(0)))-y(u*F)),j=y(y(y(p*O)+y(T*y(0)))-y(u*v)),P=y(y(t-y(y(y(L*y(0))-y(_*k))+y(l*V)))+y(r-y(y(y(U*y(0))-y(p*G))+y(u*j)))),W=y(y(y(M*y(0))-y(_*D))+y(a*I)),z=y(y(y(x*y(0))-y(_*h))+y(a*b)),H=y(y(y(S*y(0))-y(_*g))+y(a*f)),X=y(y(y(B*y(0))-y(p*N))+y(c*F)),Y=y(y(y(w*y(0))-y(p*C))+y(c*A)),Q=y(y(y(O*y(0))-y(p*T))+y(c*v)),E=y(y(t-y(y(y(W*y(0))+y(_*z))-y(a*H)))+y(r-y(y(y(X*y(0))+y(p*Y))-y(c*Q)))),R=y(y(y(0)-y(y(y(a*W)-y(l*z))+y(H*y(0))))+y(y(0)-y(y(y(c*X)-y(u*Y))+y(Q*y(0))))),h=y(y(y(l*h)-y(a*x))+y(b*y(0))),x=y(y(y(l*D)-y(a*M))+y(I*y(0))),S=y(y(y(l*g)-y(a*S))+y(f*y(0))),A=y(y(y(u*C)-y(c*w))+y(A*y(0))),C=y(y(y(u*N)-y(c*B))+y(F*y(0))),v=y(y(y(u*T)-y(c*O))+y(v*y(0))),f=y(y(y(0)-y(y(y(h*y(0))-y(_*x))+y(l*S)))+y(y(0)-y(y(y(A*y(0))-y(p*C))+y(u*v)))),g=y(y(y(y(a*V)-y(y(k*y(0))+y(_*L)))+y(0))+y(y(y(c*j)-y(y(G*y(0))+y(p*U)))+y(0))),b=y(y(y(y(a*S)-y(y(x*y(0))+y(_*h)))+y(0))+y(y(y(c*v)-y(y(C*y(0))+y(p*A)))+y(0))),T=y(y(f*g)-y(P*b)),h=y(y(t-y(y(y(a*x)-y(l*h))+y(S*y(0))))+y(r-y(y(y(c*C)-y(u*A))+y(v*y(0))))),a=y(y(y(0)-y(y(y(a*k)-y(l*L))+y(V*y(0))))+y(y(0)-y(y(y(c*G)-y(u*U))+y(j*y(0))))),c=y(y(P*h)-y(a*f)),r=y(y(y(0)-y(y(y(z*y(0))-y(_*W))+y(l*H)))+y(y(0)-y(y(y(Y*y(0))-y(p*X))+y(u*Q)))),l=y(y(a*b)-y(h*g)),t=y(y(1)/y(y(R*T)+y(y(E*c)+y(r*l)))),m[e+40>>2]=y(y(P*E)-y(g*r))*t,m[e+36>>2]=y(y(b*r)-y(f*E))*t,m[e+32>>2]=T*t,m[e+24>>2]=y(y(g*R)-y(a*E))*t,m[e+20>>2]=y(y(h*E)-y(b*R))*t,m[e+16>>2]=l*t,m[e+8>>2]=y(y(a*r)-y(P*R))*t,m[e+4>>2]=y(y(f*R)-y(h*r))*t,m[e>>2]=c*t}(o,c,i,P,l,t?t+264|0:e?e+180|0:30648,V),t=d[(e=o)+12>>2],d[r+112>>2]=d[e+8>>2],d[r+116>>2]=t,t=d[e+4>>2],d[r+104>>2]=d[e>>2],d[r+108>>2]=t,t=d[e+20>>2],d[r+120>>2]=d[e+16>>2],d[r+124>>2]=t,t=d[e+28>>2],d[r+128>>2]=d[e+24>>2],d[r+132>>2]=t,t=d[e+36>>2],d[r+136>>2]=d[e+32>>2],d[r+140>>2]=t,t=d[e+44>>2],d[r+144>>2]=d[e+40>>2],d[r+148>>2]=t}return O=o+48|0,a}function _e(e,t,i,n,s,o,a){var l,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=0,B=y(0),N=0,L=y(0),k=y(0),V=y(0),U=y(0),G=0;O=l=O-9824|0,d[o>>2]=0,d[o+4>>2]=0,d[o+32>>2]=0,d[o+24>>2]=0,d[o+28>>2]=0,d[o+16>>2]=0,d[o+20>>2]=0,d[o+8>>2]=0,d[o+12>>2]=0,d[l+9700>>2]=i,d[l+9696>>2]=e,c=m[n+20>>2],h=m[n+36>>2],_=m[t+20>>2],u=m[t+36>>2],p=m[n+24>>2],v=m[t+24>>2],g=m[n+40>>2],A=m[t+40>>2],C=m[n+32>>2],S=m[n>>2],x=m[n+16>>2],T=m[n+4>>2],E=m[t+32>>2],R=m[t>>2],P=m[t+16>>2],M=m[t+4>>2],I=m[n+8>>2],D=m[t+8>>2],d[l+9748>>2]=0,d[l+9732>>2]=0,d[l+9716>>2]=0,w=y(y(y(D*I)+y(v*p))+y(A*g)),m[l+9744>>2]=w,B=y(y(y(M*I)+y(_*p))+y(u*g)),m[l+9740>>2]=B,p=y(y(y(R*I)+y(P*p))+y(E*g)),m[l+9736>>2]=p,g=y(y(y(D*T)+y(v*c))+y(A*h)),m[l+9728>>2]=g,I=y(y(y(M*T)+y(_*c))+y(u*h)),m[l+9724>>2]=I,c=y(y(y(R*T)+y(P*c))+y(E*h)),m[l+9720>>2]=c,h=y(y(y(S*D)+y(x*v))+y(C*A)),m[l+9712>>2]=h,_=y(y(y(S*M)+y(x*_))+y(C*u)),m[l+9708>>2]=_,u=y(y(y(S*R)+y(x*P))+y(C*E)),m[l+9704>>2]=u,v=m[t+20>>2],A=m[t+36>>2],C=m[t+24>>2],S=m[t+52>>2],x=m[n+52>>2],T=m[t+40>>2],E=m[t+56>>2],R=m[n+56>>2],P=m[t>>2],M=m[t+16>>2],D=m[t+32>>2],L=m[t+4>>2],k=m[t+8>>2],V=m[t+48>>2],U=m[n+48>>2],d[l+9820>>2]=0,d[l+9812>>2]=0,d[l+9796>>2]=0,m[l+9792>>2]=w,m[l+9788>>2]=g,m[l+9784>>2]=h,d[l+9780>>2]=0,m[l+9776>>2]=B,m[l+9772>>2]=I,m[l+9768>>2]=_,d[l+9764>>2]=0,m[l+9760>>2]=p,m[l+9756>>2]=c,c=y(U-V),h=y(x-S),_=y(R-E),m[l+9808>>2]=y(y(k*c)+y(C*h))+y(T*_),m[l+9804>>2]=y(y(c*L)+y(h*v))+y(_*A),m[l+9800>>2]=y(y(c*P)+y(h*M))+y(_*D),d[l+9816>>2]=a?99:98,m[l+9752>>2]=u,d[(e=l+9448|0)>>2]=0,d[e+4>>2]=0,d[l+9440>>2]=0,d[l+9444>>2]=0,d[l+9676>>2]=0,d[l+9680>>2]=0,d[l+9688>>2]=2,d[l+9456>>2]=0,c=m[s>>2],h=m[s+4>>2],_=m[s+8>>2],d[l+28>>2]=0,m[l+24>>2]=-_,m[l+20>>2]=-h,m[l+16>>2]=-c;e:{t:{i:switch(Q(l+9312|0,l+9696|0,l+16|0)+-1|0){case 0:for(d[(e=l+9304|0)>>2]=0,d[e+4>>2]=0,d[(e=l- -64|0)>>2]=0,d[e+4>>2]=0,d[l+72>>2]=0,d[l+9296>>2]=0,d[l+9300>>2]=0,d[l+9292>>2]=0,d[l+16>>2]=9,d[l+56>>2]=0,d[l+60>>2]=0,n=0;e=7128+(b(0-n|0,56)+l|0)|0,d[e+2152>>2]=0,i=d[l+9304>>2],d[e+2156>>2]=i,e=e+2108|0,i&&(d[i+44>>2]=e),d[l+9304>>2]=e,128!=(0|(n=n+1|0)););if(d[l+9308>>2]=128,c=m[s>>2],h=m[s+4>>2],_=m[s+8>>2],d[l+12>>2]=0,m[l+8>>2]=-_,m[l+4>>2]=-h,m[l>>2]=-c,9!=(0|re(l+16|0,l+9312|0,l))){if(!d[l+52>>2]){c=y(0),h=y(0),_=y(0);break t}for(_=y(0),n=0,h=y(0),c=y(0);e=d[l+9816>>2],i=l,s=d[l+9820>>2],F=a=d[l+9696>>2]+(s>>1)|0,G=d[4+(N=(l+16|0)+(n<<2)|0)>>2],1&s&&(e=d[e+d[a>>2]>>2]),r[e](i,F,G),u=m[N+20>>2],_=y(_+y(u*m[l+8>>2])),h=y(h+y(u*m[l+4>>2])),c=y(c+y(m[l>>2]*u)),(n=n+1|0)>>>0>2];);break t}d[o>>2]=3;break e;case 1:break i;default:break e}d[o>>2]=2;break e}F=1,d[o>>2]=1,u=m[t+48>>2],p=m[t+8>>2],v=m[t>>2],g=m[t+4>>2],A=m[t+52>>2],C=m[t+24>>2],S=m[t+16>>2],x=m[t+20>>2],T=m[t+56>>2],E=m[t+40>>2],R=m[t+32>>2],P=m[t+36>>2],d[o+16>>2]=0,m[o+12>>2]=T+y(y(y(c*R)+y(h*P))+y(_*E)),m[o+8>>2]=A+y(y(y(c*S)+y(h*x))+y(_*C)),m[o+4>>2]=u+y(y(y(c*v)+y(h*g))+y(_*p)),A=m[t+48>>2],C=m[t+8>>2],S=m[t>>2],x=m[t+4>>2],T=m[t+52>>2],E=m[t+24>>2],R=m[t+16>>2],P=m[t+20>>2],M=m[t+56>>2],I=m[t+40>>2],D=m[t+32>>2],w=m[t+36>>2],p=m[l+60>>2],v=m[l- -64>>2],g=m[l+56>>2],u=m[l+72>>2],d[o+48>>2]=0,d[o+32>>2]=0,m[o+52>>2]=-u,m[o+44>>2]=-v,m[o+40>>2]=-p,m[o+36>>2]=-g,c=y(c-y(g*u)),h=y(h-y(u*p)),_=y(_-y(u*v)),m[o+28>>2]=M+y(y(y(D*c)+y(w*h))+y(I*_)),m[o+24>>2]=T+y(y(y(c*R)+y(h*P))+y(_*E)),m[o+20>>2]=A+y(y(y(c*S)+y(h*x))+y(_*C))}return O=l+9824|0,F}function de(e){var t,i=0,n=0,r=0,s=0,o=y(0),a=y(0),l=y(0),c=y(0),h=0,_=y(0),u=y(0),p=y(0),f=0,g=y(0),b=y(0);O=t=O-48|0;e:{t:{i:{n:{r:{s:{o:switch(n=d[e+372>>2],d[n+32>>2]+-1|0){case 3:break n;case 2:break r;case 1:break s;case 0:break o;default:break i}for(r=d[e+364>>2],i=1;;){if(d[t+40>>2]=0,d[t+44>>2]=0,d[t+32>>2]=0,d[t+36>>2]=0,d[(t+32|0)+(s<<2)>>2]=1065353216,d[16+(h=(i<<2)+n|0)>>2]=0,r=r+-1|0,d[e+364>>2]=r,r=d[348+((r<<2)+e|0)>>2],d[h>>2]=r,d[n+32>>2]=i+1,er(e,t+32|0,r),de(e))break t;if(n=d[e+372>>2],i=d[n+32>>2]+-1|0,d[n+32>>2]=i,r=d[e+364>>2],i=d[n+(i<<2)>>2],d[348+((r<<2)+e|0)>>2]=i,n=d[e+372>>2],d[t+28>>2]=0,m[t+24>>2]=-m[t+40>>2],m[t+20>>2]=-m[t+36>>2],m[t+16>>2]=-m[t+32>>2],h=d[n+32>>2],d[16+(f=n+(h<<2)|0)>>2]=0,d[e+364>>2]=r,d[f>>2]=i,d[n+32>>2]=h+1,er(e,t+16|0,i),de(e))break t;if(n=d[e+372>>2],i=d[n+32>>2]+-1|0,d[n+32>>2]=i,n=d[n+(i<<2)>>2],r=(i=d[e+364>>2])+1|0,d[e+364>>2]=r,d[348+((i<<2)+e|0)>>2]=n,3==(0|(s=s+1|0)))break i;n=d[e+372>>2],i=d[n+32>>2]}}for(i=d[n+4>>2],n=d[n>>2],o=y(m[i+24>>2]-m[n+24>>2]),l=y(m[i+20>>2]-m[n+20>>2]),a=y(m[i+16>>2]-m[n+16>>2]),n=0;;){if(d[t+40>>2]=0,d[t+44>>2]=0,d[t+32>>2]=0,d[t+36>>2]=0,d[(t+32|0)+(n<<2)>>2]=1065353216,d[t+28>>2]=0,c=m[t+32>>2],_=m[t+40>>2],u=y(y(o*c)-y(a*_)),m[t+20>>2]=u,p=m[t+36>>2],_=y(y(l*_)-y(o*p)),m[t+16>>2]=_,c=y(y(a*p)-y(l*c)),m[t+24>>2]=c,y(y(c*c)+y(y(_*_)+y(u*u)))>y(0)){if(i=d[e+372>>2],r=d[i+32>>2],d[16+(s=(r<<2)+i|0)>>2]=0,h=d[e+364>>2]+-1|0,d[e+364>>2]=h,f=s,s=d[348+((h<<2)+e|0)>>2],d[f>>2]=s,d[i+32>>2]=r+1,er(e,t+16|0,s),de(e))break t;if(i=d[e+372>>2],r=d[i+32>>2]+-1|0,d[i+32>>2]=r,s=d[e+364>>2],r=d[i+(r<<2)>>2],d[348+((s<<2)+e|0)>>2]=r,i=d[e+372>>2],d[t+12>>2]=0,m[t+8>>2]=-m[t+24>>2],m[t+4>>2]=-m[t+20>>2],m[t>>2]=-m[t+16>>2],h=d[i+32>>2],d[16+(f=i+(h<<2)|0)>>2]=0,d[e+364>>2]=s,d[f>>2]=r,d[i+32>>2]=h+1,er(e,t,r),de(e))break t;i=d[e+372>>2],r=d[i+32>>2]+-1|0,d[i+32>>2]=r,i=d[i+(r<<2)>>2],r=d[e+364>>2],d[e+364>>2]=r+1,d[348+((r<<2)+e|0)>>2]=i}if(3==(0|(n=n+1|0)))break}break i}if(i=d[n+4>>2],u=m[i+20>>2],r=d[n+8>>2],_=m[r+24>>2],s=d[n>>2],o=m[s+24>>2],c=m[i+24>>2],p=m[r+20>>2],l=m[s+20>>2],g=m[r+16>>2],a=m[s+16>>2],b=m[i+16>>2],d[t+44>>2]=0,u=y(u-l),_=y(_-o),c=y(c-o),p=y(p-l),o=y(y(u*_)-y(c*p)),m[t+32>>2]=o,l=c,c=y(g-a),a=y(b-a),l=y(y(l*c)-y(a*_)),m[t+36>>2]=l,a=y(y(a*p)-y(u*c)),m[t+40>>2]=a,!(y(y(a*a)+y(y(o*o)+y(l*l)))>y(0)))break i;if(d[n+28>>2]=0,i=d[e+364>>2]+-1|0,d[e+364>>2]=i,i=d[348+((i<<2)+e|0)>>2],d[n+32>>2]=4,d[n+12>>2]=i,er(e,t+32|0,i),de(e))break t;if(n=d[e+372>>2],i=d[n+32>>2]+-1|0,d[n+32>>2]=i,r=d[e+364>>2],i=d[n+(i<<2)>>2],d[348+((r<<2)+e|0)>>2]=i,n=d[e+372>>2],d[t+28>>2]=0,m[t+24>>2]=-m[t+40>>2],m[t+20>>2]=-m[t+36>>2],m[t+16>>2]=-m[t+32>>2],s=d[n+32>>2],d[16+(h=n+(s<<2)|0)>>2]=0,d[e+364>>2]=r,d[h>>2]=i,d[n+32>>2]=s+1,er(e,t+16|0,i),i=1,de(e))break e;n=d[e+372>>2],i=d[n+32>>2]+-1|0,d[n+32>>2]=i,n=d[n+(i<<2)>>2],i=d[e+364>>2],d[e+364>>2]=i+1,d[348+((i<<2)+e|0)>>2]=n,i=0;break e}if(e=d[n>>2],r=d[n+12>>2],o=m[r+16>>2],u=y(m[e+16>>2]-o),s=d[n+4>>2],l=m[r+20>>2],_=y(m[s+20>>2]-l),n=d[n+8>>2],a=m[r+24>>2],c=y(m[n+24>>2]-a),p=y(m[e+20>>2]-l),g=y(m[s+24>>2]-a),b=y(m[n+16>>2]-o),a=y(m[e+24>>2]-a),o=y(m[s+16>>2]-o),l=y(m[n+20>>2]-l),i=1,(o=y(y(y(y(u*_)*c)+y(y(y(y(y(p*g)*b)+y(y(a*o)*l))-y(y(u*g)*l))-y(y(p*o)*c)))-y(y(a*_)*b)))!=y(0)&o==o)break e}i=0;break e}i=1}return O=t+48|0,i}function ue(e){var t,i=0,n=0,s=0,o=y(0),a=0,l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0);if(O=t=O+-64|0,vt(e,0),(0|(l=d[e+732>>2]))>=1)for(;i=d[e+740>>2]+b(n,52)|0,s=d[i+8>>2],h=m[s+28>>2],a=d[i+12>>2],_=m[a+28>>2],c=m[s+32>>2],u=m[a+32>>2],o=m[s+24>>2],p=m[a+24>>2],d[i+48>>2]=0,o=y(p-o),m[i+36>>2]=o,c=y(u-c),m[i+44>>2]=c,h=y(_-h),m[i+40>>2]=h,m[i+32>>2]=y(1)/y(m[i+24>>2]*y(y(y(o*o)+y(h*h))+y(c*c))),(0|l)!=(0|(n=n+1|0)););if((0|(a=d[e+792>>2]))>=1)for(s=0;i=d[e+800>>2]+b(s,96)|0,n=d[i+20>>2],_=m[n+12>>2],u=m[n+8>>2],p=m[n+4>>2],f=m[n+28>>2],g=m[n+20>>2],v=m[n+24>>2],o=m[i+12>>2],A=m[n+44>>2],c=m[i+4>>2],C=m[n+36>>2],h=m[i+8>>2],S=m[n+40>>2],d[t+60>>2]=0,m[t+56>>2]=y(y(c*C)+y(h*S))+y(o*A),m[t+52>>2]=y(y(c*g)+y(h*v))+y(o*f),m[t+48>>2]=y(y(p*c)+y(u*h))+y(_*o),Rt(t,m[e+452>>2],m[d[i>>2]+88>>2],m[n+344>>2],n+264|0,t+48|0),l=d[(n=t)+12>>2],d[i+36>>2]=d[n+8>>2],d[i+40>>2]=l,l=d[n+4>>2],d[i+28>>2]=d[n>>2],d[i+32>>2]=l,l=d[n+28>>2],d[i+52>>2]=d[n+24>>2],d[i+56>>2]=l,l=d[n+20>>2],d[i+44>>2]=d[n+16>>2],d[i+48>>2]=l,l=d[n+44>>2],d[i+68>>2]=d[n+40>>2],d[i+72>>2]=l,l=d[n+36>>2],d[i+60>>2]=d[n+32>>2],d[i+64>>2]=l,l=d[n+60>>2],d[i+84>>2]=d[n+56>>2],d[i+88>>2]=l,l=d[n+52>>2],d[i+76>>2]=d[n+48>>2],d[i+80>>2]=l,m[i+92>>2]=m[e+452>>2]*m[d[i>>2]+88>>2],Eh(d[i+20>>2],0),(0|a)!=(0|(s=s+1|0)););if(!((0|(a=d[e+372>>2]))<1)){for(n=d[e+396>>2],s=0;;){if(i=0,(0|n)>0){for(;r[d[d[e+404>>2]+(i<<2)>>2]?0:833](e,y(1)),(0|(i=i+1|0))<(0|(n=d[e+396>>2])););a=d[e+372>>2]}if(!((0|(s=s+1|0))<(0|a)))break}if(!((0|(s=d[e+712>>2]))<1))for(n=0;o=m[e+452>>2],i=d[e+720>>2]+b(n,104)|0,d[i+20>>2]=0,m[i+8>>2]=y(o*m[i+40>>2])+m[i+24>>2],m[i+16>>2]=y(o*m[i+48>>2])+m[i+32>>2],m[i+12>>2]=y(o*m[i+44>>2])+m[i+28>>2],(0|s)!=(0|(n=n+1|0)););}if(!((0|(i=d[e+376>>2]))<1)){for(n=d[e+416>>2],s=0;;){if((0|n)>0){for(o=y(y(0|s)/y(0|i)),i=0;r[d[22176+(d[d[e+424>>2]+(i<<2)>>2]<<2)>>2]](e,y(1),o),(0|(i=i+1|0))<(0|(n=d[e+416>>2])););i=d[e+376>>2]}if(!((0|(s=s+1|0))<(0|i)))break}if(!((0|(s=d[e+712>>2]))<1))for(o=y(m[e+456>>2]*y(y(1)-m[e+296>>2])),n=0;i=d[e+720>>2]+b(n,104)|0,d[i+52>>2]=0,d[i+56>>2]=0,d[i+60>>2]=0,d[i+64>>2]=0,d[i+68>>2]=0,m[i+40>>2]=o*y(m[i+8>>2]-m[i+24>>2]),m[i+48>>2]=o*y(m[i+16>>2]-m[i+32>>2]),m[i+44>>2]=o*y(m[i+12>>2]-m[i+28>>2]),(0|s)!=(0|(n=n+1|0)););}if(!((0|(a=d[e+380>>2]))<1)){o=m[e+456>>2],c=m[e+292>>2];e:{if((0|(s=d[e+712>>2]))>=1){for(n=0;i=d[e+720>>2]+b(n,104)|0,a=d[i+12>>2],d[i+24>>2]=d[i+8>>2],d[i+28>>2]=a,a=d[i+20>>2],d[i+32>>2]=d[i+16>>2],d[i+36>>2]=a,(0|s)!=(0|(n=n+1|0)););if((0|(a=d[e+380>>2]))<1)break e}for(n=d[e+436>>2],s=0;;){if(i=0,(0|n)>0){for(;r[d[22176+(d[d[e+444>>2]+(i<<2)>>2]<<2)>>2]](e,y(1),y(0)),(0|(i=i+1|0))<(0|(n=d[e+436>>2])););a=d[e+380>>2]}if(!((0|(s=s+1|0))<(0|a)))break}}if(!((0|(s=d[e+712>>2]))<1))for(o=y(c*o),a=d[e+720>>2],n=0;i=a+b(n,104)|0,m[i+40>>2]=y(o*y(m[i+8>>2]-m[i+24>>2]))+m[i+40>>2],m[i+44>>2]=y(o*y(m[i+12>>2]-m[i+28>>2]))+m[i+44>>2],m[i+48>>2]=y(o*y(m[i+16>>2]-m[i+32>>2]))+m[i+48>>2],(0|s)!=(0|(n=n+1|0)););}!function(e){var t,i=y(0),n=0,r=y(0),s=y(0),o=y(0),a=y(0),l=0,c=0,h=y(0),_=y(0),u=0,p=0,f=0;if((0|(t=d[e+1112>>2]))>=1)for(p=d[e+1120>>2];;){if(e=d[(c<<2)+p>>2],m[e+352>>2]>y(0)&&!((0|(u=d[e+24>>2]))<1))for(f=d[e+32>>2],l=0;n=d[(l<<2)+f>>2],m[n+88>>2]>y(0)&&(o=m[e+336>>2],r=y(m[n+32>>2]-m[e+236>>2]),i=y(m[n+28>>2]-m[e+232>>2]),a=m[e+340>>2],h=y(m[e+316>>2]+y(y(o*r)-y(i*a))),s=y(m[n+24>>2]-m[e+228>>2]),_=r,r=m[e+332>>2],a=y(m[e+320>>2]+y(y(s*a)-y(_*r))),s=y(y(y(i*r)-y(s*o))+m[e+324>>2]),o=m[n+40>>2],r=m[n+44>>2],i=m[n+48>>2],y(y(y(h*h)+y(a*a))+y(s*s))<=y(y(y(o*o)+y(r*r))+y(i*i))&&(_=i,s=y(s-i),i=m[e+352>>2],m[n+48>>2]=_+y(s*i),m[n+44>>2]=r+y(i*y(a-r)),m[n+40>>2]=o+y(i*y(h-o)))),(0|u)!=(0|(l=l+1|0)););if((0|t)==(0|(c=c+1|0)))break}}(e),vt(e,1),O=t- -64|0}function pe(e,t,i){e|=0,t|=0,i|=0;var n,s=y(0),o=y(0),a=y(0),h=y(0),_=y(0),u=0,p=y(0),f=0,g=y(0),b=0,v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0);O=n=O-48|0;e:{switch(d[t+4>>2]){case 8:d[e>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0;break e;case 0:s=m[t+28>>2],o=m[t+32>>2],a=m[t+36>>2],h=m[i>>2],_=m[i+4>>2],p=m[i+8>>2],d[e+12>>2]=0,m[e+8>>2]=p>=y(0)?a:y(-a),m[e+4>>2]=_>=y(0)?o:y(-o),m[e>>2]=h>=y(0)?s:y(-s);break e;case 1:s=m[i>>2],o=m[i+4>>2],a=m[i+8>>2],h=y(y(y(s*m[t+72>>2])+y(o*m[t+76>>2]))+y(a*m[t+80>>2])),_=y(y(y(s*m[t+88>>2])+y(o*m[t+92>>2]))+y(a*m[t+96>>2])),s=y(y(y(s*m[t+56>>2])+y(o*m[t+60>>2]))+y(a*m[t- -64>>2])),i=d[4+(t=(t+56|0)+((s>2],u=d[t>>2],t=d[t+8>>2],d[e+12>>2]=0,d[e+8>>2]=t,d[e>>2]=u,d[e+4>>2]=i;break e;case 13:u=d[t+40>>2],d[n+40>>2]=d[t+36>>2],d[n+44>>2]=u,u=d[t+32>>2],d[n+32>>2]=d[t+28>>2],d[n+36>>2]=u,d[n+16>>2]=d[i>>2],o=m[i+4>>2],d[n+20>>2]=d[i+4>>2],s=m[i+8>>2],i=d[i+8>>2],d[n+28>>2]=0,d[n+24>>2]=i,i=1,u=2;t:{i:{n:switch((t=d[t+52>>2])+-1|0){case 1:break i;case 0:break n;default:break t}i=0,f=1;break t}s=o,i=0,f=2,u=1}o=m[(n+32|0)+(t<<2)>>2],a=m[((t=i<<2)|n+32)>>2],h=m[(t|n+16)>>2],(_=y(x(y(y(h*h)+y(s*s)))))==y(0)?(m[(i<<2|n)>>2]=a,m[(t=f<<2)+n>>2]=m[t+(n+16|0)>>2]>2]=0,i=4|n,t=n+8|0):(a=y(a/_),m[(i<<2|n)>>2]=h*a,m[(t=f<<2)+n>>2]=m[t+(n+16|0)>>2]>2]=s*a,i=4|n,t=n+8|0),d[e>>2]=d[n>>2],d[e+4>>2]=d[i>>2],t=d[t>>2],d[e+12>>2]=0,d[e+8>>2]=t;break e;case 10:f=t+28|0,u=d[t+52>>2],p=m[f+(b=u<<2)>>2],h=m[f+((u+2|0)%3<<2)>>2],o=m[i>>2],s=m[i+4>>2],a=m[i+8>>2],(_=y(y(y(o*o)+y(s*s))+y(a*a)))>2]=0,d[n+44>>2]=0,d[n+32>>2]=0,d[n+36>>2]=0,m[b+(n+32|0)>>2]=p,a=y(-0xde0b6b000000000),i=0,f=0,b=0,S=y(h*_),g=m[t+44>>2],T=y(_*g),C=y(y(S+m[n+40>>2])-T),A=y(h*o),E=y(o*g),v=y(y(A+m[n+32>>2])-E),R=y(h*s),g=y(s*g),P=y(y(R+m[n+36>>2])-g),(h=y(y(_*C)+y(y(o*v)+y(s*P))))>y(-0xde0b6b000000000)&&(l(C),b=c(0),l(P),f=c(0),a=h,l(v),i=c(0)),d[n+40>>2]=0,d[n+44>>2]=0,d[n+32>>2]=0,d[n+36>>2]=0,m[(n+32|0)+(u<<2)>>2]=-p,h=m[n+40>>2],p=m[n+32>>2],C=m[n+36>>2],d[e+12>>2]=0,v=o,o=y(y(A+p)-E),p=s,s=y(y(R+C)-g),h=y(y(S+h)-T),t=y(y(y(v*o)+y(p*s))+y(_*h))>a,d[e+8>>2]=t?(l(h),c(0)):b,d[e+4>>2]=t?(l(s),c(0)):f,d[e>>2]=t?(l(o),c(0)):i;break e;case 5:if(o=m[t+12>>2],a=m[t+20>>2],h=m[t+16>>2],f=d[t+92>>2],u=-1,(0|(b=d[t+96>>2]))>=1)for(_=y(m[i>>2]*o),p=y(m[i+8>>2]*a),A=y(m[i+4>>2]*h),t=0,s=y(-34028234663852886e22);s=(i=(g=y(y(y(_*m[(i=f+(t<<4)|0)>>2])+y(A*m[i+4>>2]))+y(p*m[i+8>>2])))>s)?g:s,u=i?t:u,(0|b)!=(0|(t=t+1|0)););s=m[(t=f+(u<<4)|0)>>2],_=m[t+4>>2],p=m[t+8>>2],d[e+12>>2]=0,m[e+8>>2]=a*p,m[e+4>>2]=h*_,m[e>>2]=o*s;break e;case 4:if(o=m[t+12>>2],a=m[t+20>>2],h=m[t+16>>2],f=d[t+104>>2],u=-1,(0|(b=d[t+96>>2]))>=1)for(_=y(m[i>>2]*o),p=y(m[i+8>>2]*a),A=y(m[i+4>>2]*h),t=0,s=y(-34028234663852886e22);s=(i=(g=y(y(y(_*m[(i=f+(t<<4)|0)>>2])+y(A*m[i+4>>2]))+y(p*m[i+8>>2])))>s)?g:s,u=i?t:u,(0|b)!=(0|(t=t+1|0)););s=m[(t=f+(u<<4)|0)>>2],_=m[t+4>>2],p=m[t+8>>2],d[e+12>>2]=0,m[e+8>>2]=a*p,m[e+4>>2]=h*_,m[e>>2]=o*s;break e}r[d[d[t>>2]+68>>2]](e,t,i)}O=n+48|0}function fe(e){var t=0,i=0;if(d[(e|=0)>>2]=20956,(t=d[e+192>>2])&&r[d[d[t>>2]+4>>2]](t),d[e+1112>>2]>=1)for(;gn(e,0),d[e+1112>>2]>0;);if(d[e+872>>2]>=1)for(t=0;(i=d[d[e+880>>2]+(t<<2)>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),(0|(t=t+1|0))>2];);if(d[e+852>>2]>=1)for(t=0;(i=d[d[e+860>>2]+(t<<2)>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),(0|(t=t+1|0))>2];);return(t=d[e+1244>>2])&&(u[e+1248|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+1244>>2]=0),d[e+1244>>2]=0,s[e+1248|0]=1,d[(t=e+1236|0)>>2]=0,d[t+4>>2]=0,(t=d[e+1140>>2])&&(u[e+1144|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+1140>>2]=0),d[e+1140>>2]=0,s[e+1144|0]=1,d[(t=e+1132|0)>>2]=0,d[t+4>>2]=0,(t=d[e+1120>>2])&&(u[e+1124|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+1120>>2]=0),d[e+1120>>2]=0,d[e+1112>>2]=0,d[e+1116>>2]=0,s[e+1124|0]=1,ar(e+1048|0),ar(e+988|0),ar(e+928|0),(t=d[e+880>>2])&&(u[e+884|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+880>>2]=0),d[e+880>>2]=0,d[e+872>>2]=0,d[e+876>>2]=0,s[e+884|0]=1,(t=d[e+860>>2])&&(u[e+864|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+860>>2]=0),d[e+860>>2]=0,d[e+852>>2]=0,d[e+856>>2]=0,s[e+864|0]=1,(t=d[e+840>>2])&&(u[e+844|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+840>>2]=0),d[e+840>>2]=0,s[e+844|0]=1,d[e+832>>2]=0,d[e+836>>2]=0,(t=d[e+820>>2])&&(u[e+824|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+820>>2]=0),d[e+820>>2]=0,s[e+824|0]=1,d[e+812>>2]=0,d[e+816>>2]=0,(t=d[e+800>>2])&&(u[e+804|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+800>>2]=0),d[e+800>>2]=0,s[e+804|0]=1,d[e+792>>2]=0,d[e+796>>2]=0,(t=d[e+780>>2])&&(u[e+784|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+780>>2]=0),d[e+780>>2]=0,s[e+784|0]=1,d[e+772>>2]=0,d[e+776>>2]=0,(t=d[e+760>>2])&&(u[e+764|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+760>>2]=0),d[e+760>>2]=0,s[e+764|0]=1,d[e+752>>2]=0,d[e+756>>2]=0,(t=d[e+740>>2])&&(u[e+744|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+740>>2]=0),d[e+740>>2]=0,s[e+744|0]=1,d[e+732>>2]=0,d[e+736>>2]=0,(t=d[e+720>>2])&&(u[e+724|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+720>>2]=0),d[e+720>>2]=0,s[e+724|0]=1,d[e+712>>2]=0,d[e+716>>2]=0,(t=d[e+700>>2])&&(u[e+704|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+700>>2]=0),d[e+700>>2]=0,s[e+704|0]=1,d[e+692>>2]=0,d[e+696>>2]=0,(t=d[e+512>>2])&&(u[e+516|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+512>>2]=0),d[e+512>>2]=0,s[e+516|0]=1,d[e+504>>2]=0,d[e+508>>2]=0,(t=d[e+492>>2])&&(u[e+496|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+492>>2]=0),d[e+492>>2]=0,s[e+496|0]=1,d[e+484>>2]=0,d[e+488>>2]=0,(t=d[e+444>>2])&&(u[e+448|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+444>>2]=0),d[e+444>>2]=0,s[e+448|0]=1,d[e+436>>2]=0,d[e+440>>2]=0,(t=d[e+424>>2])&&(u[e+428|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+424>>2]=0),d[e+424>>2]=0,s[e+428|0]=1,d[e+416>>2]=0,d[e+420>>2]=0,(t=d[e+404>>2])&&(u[e+408|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+404>>2]=0),d[e+404>>2]=0,s[e+408|0]=1,d[e+396>>2]=0,d[e+400>>2]=0,(t=d[e+276>>2])&&(u[e+280|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+276>>2]=0),d[e+276>>2]=0,s[e+280|0]=1,d[e+268>>2]=0,d[e+272>>2]=0,d[e>>2]=3948,0|e}function me(e,t,i,n,r,s,o,a,l,c,h,_,p){var f,g,v,A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=0,P=0,I=y(0),M=y(0),D=y(0),w=0,F=y(0),B=y(0),N=y(0),L=y(0),k=0,V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=0,X=0,Y=0,Q=y(0),q=y(0);O=f=O-16|0,R=d[l+24>>2],v=u[t+44|0];e:if((g=d[t+56>>2])||v){H=d[(_?20:16)+l>>2],k=d[(_?12:8)+l>>2],w=b(c,R),d[k+(P=w<<2)>>2]=d[h>>2],d[(R=(X=w+1|0)<<2)+k>>2]=d[h+4>>2],d[k+(c=(Y=w+2|0)<<2)>>2]=d[h+8>>2],m[P+H>>2]=-m[h>>2],m[R+H>>2]=-m[h+4>>2],m[c+H>>2]=-m[h+8>>2],_||(u[e+1301|0]?(x=m[e+1112>>2],G=m[i+52>>2],I=m[e+1116>>2],L=m[i+56>>2],E=m[e+1120>>2],j=m[e+1176>>2],W=m[n+52>>2],z=m[e+1180>>2],M=m[n+56>>2],T=m[e+1184>>2],V=m[e+1276>>2],U=m[e+1272>>2],D=m[t+48>>2],S=m[t+52>>2],C=m[i+48>>2],F=m[h>>2],A=m[n+48>>2],B=m[h+4>>2],N=m[h+8>>2],d[f+12>>2]=0,x=y(x-C),I=y(I-G),E=y(E-L),Q=y(y(y(F*x)+y(B*I))+y(N*E)),C=y(F*Q),L=y(S-D),j=y(j-A),W=y(z-W),z=y(T-M),S=y(y(y(F*j)+y(B*W))+y(N*z)),M=y(F*S),q=y(y(C+y(F*L))-M),A=y(B*Q),T=y(B*S),G=y(y(A+y(B*L))-T),x=y(y(x-C)+y(U*q)),C=y(y(I-A)+y(U*G)),D=y(y(B*x)-y(F*C)),m[f+8>>2]=D,A=y(N*Q),S=y(N*S),L=y(y(A+y(N*L))-S),A=y(y(E-A)+y(U*L)),I=y(y(F*A)-y(N*x)),m[f+4>>2]=I,E=y(y(N*C)-y(B*A)),m[f>>2]=E,x=y(y(j-M)-y(V*q)),C=y(y(W-T)-y(V*G)),M=y(y(B*x)-y(F*C)),A=y(y(z-S)-y(V*L)),T=y(y(F*A)-y(N*x)),S=y(y(N*C)-y(B*A)),!u[e+1280|0]|p||(m[f+8>>2]=U*D,m[f+4>>2]=U*I,m[f>>2]=U*E,M=y(V*M),T=y(V*T),S=y(V*S)),e=d[f+4>>2],n=(i=w<<2)+d[l+12>>2]|0,d[n>>2]=d[f>>2],d[n+4>>2]=e,d[n+8>>2]=d[f+8>>2],e=d[l+20>>2],m[e+i>>2]=-S,m[e+(X<<2)>>2]=-T,m[e+(Y<<2)>>2]=-M):(S=m[(P=e+1176|0)>>2],I=m[i+48>>2],D=m[h>>2],k=d[l+12>>2],R=w<<2,E=y(m[(p=e+1180|0)>>2]-m[i+52>>2]),x=m[h+8>>2],A=y(m[(c=e+1184|0)>>2]-m[i+56>>2]),C=m[h+4>>2],m[k+R>>2]=y(E*x)-y(A*C),i=X<<2,T=y(A*D),A=y(S-I),m[i+k>>2]=T-y(x*A),m[(e=Y<<2)+k>>2]=y(A*C)-y(E*D),S=m[P>>2],I=m[n+48>>2],D=m[h>>2],P=R,R=d[l+20>>2],E=y(m[p>>2]-m[n+52>>2]),x=m[h+8>>2],A=y(m[c>>2]-m[n+56>>2]),C=m[h+4>>2],m[P+R>>2]=-y(y(E*x)-y(A*C)),T=y(A*D),A=y(S-I),m[i+R>>2]=-y(T-y(x*A)),m[e+R>>2]=-y(y(A*C)-y(E*D))));t:{i:{if(g){if(C=m[t+4>>2],A=m[t>>2],n=d[l+28>>2]+(w<<2)|0,d[n>>2]=0,!v|A==C||(d[d[l+32>>2]+(w<<2)>>2]=d[t+28>>2]),C=y(m[l>>2]*m[t+32>>2]),A=m[t+48>>2],_)break i;A=y(y(C*A)+m[n>>2]);break t}if(d[(i=w<<2)+d[l+28>>2]>>2]=0,P=1,!v)break e;d[i+d[l+32>>2]>>2]=d[t+28>>2],A=m[t+8>>2],A=Os(m[t+52>>2],m[t>>2],m[t+4>>2],_?A:y(-A),y(m[l>>2]*m[t+32>>2])),e=i+d[l+28>>2]|0,m[e>>2]=y(A*m[t+8>>2])+m[e>>2],m[i+d[l+36>>2]>>2]=-m[t+12>>2],d[i+d[l+40>>2]>>2]=d[t+12>>2];break e}A=y(m[n>>2]-y(C*A))}if(m[n>>2]=A,d[(i=w<<2)+d[l+32>>2]>>2]=d[t+36>>2],m[t>>2]!=m[t+4>>2]){if(P=1,e=1==(0|g),m[i+d[l+36>>2]>>2]=y(e?0:-34028234663852886e22),m[i+d[l+40>>2]>>2]=y(e?34028234663852886e22:0),(x=m[t+40>>2])>y(0))if(_?(C=m[h+8>>2],M=y(m[o+8>>2]*C),S=m[h>>2],T=m[h+4>>2],A=y(y(m[o>>2]*S)+y(m[o+4>>2]*T))):(C=m[h+8>>2],M=y(m[r+8>>2]*C),a=s,S=m[h>>2],T=m[h+4>>2],A=y(y(m[r>>2]*S)+y(m[r+4>>2]*T))),A=y(y(A+M)-y(y(y(S*m[a>>2])+y(T*m[a+4>>2]))+y(C*m[a+8>>2]))),1!=(0|g))A>y(0)&&(A=y(A*y(-x)))>2]&&(m[n>>2]=A);else{if(!(Am[n>>2]))break e;m[n>>2]=A}}else d[i+d[l+36>>2]>>2]=-8388609,d[i+d[l+40>>2]>>2]=2139095039,P=1}return O=f+16|0,P}function ge(e,t,i,n,o,a,l){var c,h=0,_=0,p=0,f=y(0),g=0,v=y(0),A=y(0),C=y(0),S=y(0),x=0,T=0,E=y(0),R=y(0),P=y(0),I=y(0),M=0,D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=0,j=0,W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0);if(O=c=O+-64|0,d[c+52>>2]=0,d[c+44>>2]=0,d[c+48>>2]=0,s[c+56|0]=1,(0|(h=d[n+4>>2]))>=1){if(d[7717]=d[7717]+1,x=0|r[d[6606]](h<<4,16),(0|(M=d[c+44>>2]))>=1)for(;g=(_=p<<4)+x|0,_=_+d[c+52>>2]|0,T=d[_+4>>2],d[g>>2]=d[_>>2],d[g+4>>2]=T,G=d[_+12>>2],d[g+8>>2]=d[_+8>>2],d[g+12>>2]=G,(0|M)!=(0|(p=p+1|0)););(_=d[c+52>>2])&&(u[c+56|0]&&_&&(d[7718]=d[7718]+1,r[d[6607]](_)),d[c+52>>2]=0),d[c+52>>2]=x,s[c+56|0]=1,d[c+48>>2]=h}if(!((0|(x=d[t+28>>2]))<1)){for(E=m[i+40>>2],D=m[i+36>>2],C=m[i+24>>2],w=m[i+20>>2],g=d[t+36>>2],R=m[e+8>>2],F=m[e+4>>2],P=m[e>>2],B=m[i+32>>2],N=m[i+16>>2],L=m[i+8>>2],k=m[i+4>>2],I=m[i>>2],p=0,A=y(34028234663852886e22),h=-1;_=g+b(p,36)|0,v=m[_+20>>2],f=m[_+24>>2],S=m[_+28>>2],A=(_=(v=y(y(y(y(y(y(v*I)+y(f*k))+y(S*L))*P)+y(y(y(y(v*N)+y(f*w))+y(S*C))*F))+y(y(y(y(v*B)+y(f*D))+y(S*E))*R)))>2]+b(h,36)|0,(0|(G=d[g+4>>2]))<1)_=n;else for(h=c+40|0,p=0;;){if(_=h,M=(0|(x=p+1|0))==(0|G),j=d[t+16>>2],T=d[g+12>>2],h=j+(d[T+((M?0:x)<<2)>>2]<<4)|0,V=m[h+8>>2],I=m[h>>2],U=m[h+4>>2],h=j+(d[(p<<2)+T>>2]<<4)|0,A=m[h+8>>2],v=m[h>>2],f=m[h+4>>2],Q=m[i+56>>2],q=m[i+52>>2],K=m[i+48>>2],S=m[i+40>>2],E=m[i+32>>2],D=m[i+36>>2],C=m[g+28>>2],w=m[i+8>>2],R=m[g+20>>2],F=m[i>>2],P=m[g+24>>2],B=m[i+4>>2],N=m[i+24>>2],L=m[i+16>>2],k=m[i+20>>2],d[c+36>>2]=0,I=y(v-I),U=y(f-U),V=y(A-V),W=y(y(y(F*I)+y(B*U))+y(w*V)),z=y(y(y(L*R)+y(k*P))+y(N*C)),H=y(y(y(I*L)+y(U*k))+y(V*N)),X=y(y(y(F*R)+y(B*P))+y(w*C)),Y=y(y(W*z)-y(H*X)),m[c+32>>2]=-Y,C=y(y(y(E*R)+y(D*P))+y(S*C)),R=y(y(y(I*E)+y(U*D))+y(V*S)),P=y(y(H*C)-y(R*z)),m[c+24>>2]=-P,C=y(-y(y(R*X)-y(W*C))),m[c+28>>2]=C,Ee(h=n,_,c+24|0,y(-y(y(y(y(q+y(y(y(v*L)+y(f*k))+y(A*N)))*C)-y(P*y(K+y(y(y(v*F)+y(f*B))+y(A*w)))))-y(Y*y(Q+y(y(y(v*E)+y(f*D))+y(A*S))))))),(0|(p=d[h+4>>2]))<=-1)for(d[h+8>>2]<=-1&&((n=d[h+12>>2])&&(u[h+16|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[h+12>>2]=0),s[h+16|0]=1,d[h+8>>2]=0,d[h+12>>2]=0);j=d[c+12>>2],n=d[h+12>>2]+(p<<4)|0,d[n>>2]=d[c+8>>2],d[n+4>>2]=j,T=d[c+20>>2],d[n+8>>2]=d[c+16>>2],d[n+12>>2]=T,T=(n=p+1|0)>>>0>=p>>>0,p=n,T;);if(d[h+4>>2]=0,p=x,n=_,M)break}if(!((0|(h=d[_+4>>2]))<1))for(A=m[g+20>>2],v=m[g+24>>2],f=m[g+28>>2],S=y(y(y(A*m[i>>2])+y(v*m[i+4>>2]))+y(f*m[i+8>>2])),E=y(y(y(A*m[i+16>>2])+y(v*m[i+20>>2]))+y(f*m[i+24>>2])),A=y(y(y(A*m[i+32>>2])+y(v*m[i+36>>2]))+y(f*m[i+40>>2])),v=y(m[g+32>>2]-y(y(y(S*m[i+48>>2])+y(E*m[i+52>>2]))+y(A*m[i+56>>2]))),i=0;t=d[_+12>>2]+(i<<4)|0,(f=(f=y(v+y(y(y(S*m[t>>2])+y(E*m[t+4>>2]))+y(A*m[t+8>>2]))))<=o?o:f)<=a&&(n=d[t+12>>2],d[c+32>>2]=d[t+8>>2],d[c+36>>2]=n,n=d[t+4>>2],d[c+24>>2]=d[t>>2],d[c+28>>2]=n,r[d[d[l>>2]+16>>2]](l,e,c+24|0,f),h=d[_+4>>2]),(0|(i=i+1|0))<(0|h););}}(e=d[c+52>>2])&&(u[c+56|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[c+52>>2]=0),O=c- -64|0}function be(e,t,i,n){var s,o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=0,w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=0,U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=0,J=0,ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0),se=y(0);O=s=O-240|0,d[e+16>>2]?(Qs(d[e+4>>2]),o=d[e+12>>2],D=d[o+4>>2],V=d[e+16>>2],$=o,J=d[V+4>>2],w=y(r[d[d[o>>2]+48>>2]](o)),o=d[e+16>>2],e=Ms(s+160|0,$,V,D,J,w,y(r[d[d[o>>2]+48>>2]](o)),d[e+4>>2],d[e+8>>2]),d[s+152>>2]=1566444395,o=d[t+12>>2],d[s+32>>2]=d[t+8>>2],d[s+36>>2]=o,o=d[t+4>>2],d[s+24>>2]=d[t>>2],d[s+28>>2]=o,o=d[t+28>>2],d[s+48>>2]=d[t+24>>2],d[s+52>>2]=o,o=d[t+20>>2],d[s+40>>2]=d[t+16>>2],d[s+44>>2]=o,D=d[t+44>>2],d[(o=s- -64|0)>>2]=d[t+40>>2],d[o+4>>2]=D,o=d[t+36>>2],d[s+56>>2]=d[t+32>>2],d[s+60>>2]=o,o=d[t+60>>2],d[s+80>>2]=d[t+56>>2],d[s+84>>2]=o,o=d[t+52>>2],d[s+72>>2]=d[t+48>>2],d[s+76>>2]=o,t=d[i+12>>2],d[s+96>>2]=d[i+8>>2],d[s+100>>2]=t,t=d[i+4>>2],d[s+88>>2]=d[i>>2],d[s+92>>2]=t,t=d[i+20>>2],d[s+104>>2]=d[i+16>>2],d[s+108>>2]=t,t=d[i+28>>2],d[s+112>>2]=d[i+24>>2],d[s+116>>2]=t,t=d[i+44>>2],d[s+128>>2]=d[i+40>>2],d[s+132>>2]=t,t=d[i+36>>2],d[s+120>>2]=d[i+32>>2],d[s+124>>2]=t,t=d[i+52>>2],d[s+136>>2]=d[i+48>>2],d[s+140>>2]=t,t=d[i+60>>2],d[s+144>>2]=d[i+56>>2],d[s+148>>2]=t,j_(e,s+24|0,n,0)):(ee=m[i+52>>2],F=m[i+56>>2],B=m[t+52>>2],N=m[t+56>>2],h=m[t+20>>2],_=m[t+36>>2],c=m[i+20>>2],u=m[i+36>>2],a=m[i+24>>2],p=m[t+24>>2],l=m[i+40>>2],v=m[t+40>>2],L=m[i+48>>2],k=m[t+48>>2],o=d[e+12>>2],A=m[t+32>>2],C=m[t>>2],S=m[t+16>>2],x=m[t+4>>2],g=m[i+32>>2],f=m[i+16>>2],P=m[i>>2],I=m[i+4>>2],M=m[i+8>>2],T=m[t+8>>2],e=d[e+20>>2],b=m[e+52>>2],E=m[e+56>>2],R=m[e+48>>2],d[s+172>>2]=0,U=y(y(y(T*I)+y(p*c))+y(v*u)),b=y(-b),G=y(y(y(T*P)+y(p*f))+y(v*g)),j=y(y(y(T*M)+y(p*a))+y(v*l)),m[s+168>>2]=y(y(U*b)-y(R*G))-y(E*j),W=y(y(y(x*I)+y(h*c))+y(_*u)),z=y(y(y(x*P)+y(h*f))+y(_*g)),H=y(y(y(x*M)+y(h*a))+y(_*l)),m[s+164>>2]=y(y(W*b)-y(R*z))-y(E*H),X=y(y(y(C*I)+y(S*c))+y(A*u)),Y=y(y(y(C*P)+y(S*f))+y(A*g)),Q=y(y(y(C*M)+y(S*a))+y(A*l)),m[s+160>>2]=y(y(X*b)-y(R*Y))-y(E*Q),r[d[d[o>>2]+64>>2]](s+24|0,o,s+160|0),h=m[e+52>>2],_=m[e+56>>2],te=m[e+64>>2],p=m[e+48>>2],v=m[s+24>>2],A=m[s+28>>2],C=m[s+32>>2],ie=m[i+52>>2],S=m[i+24>>2],x=m[i+20>>2],ne=m[i+56>>2],T=m[i+40>>2],E=m[i+36>>2],re=m[i+48>>2],R=m[i+8>>2],b=m[i>>2],q=m[i+4>>2],K=m[i+16>>2],Z=m[i+32>>2],d[s+172>>2]=0,se=y(y(y(k*P)+y(B*f))+y(N*g)),w=f,f=y(-ee),g=y(y(se+y(y(y(w*f)-y(P*L))-y(g*F)))+y(y(y(Y*v)+y(z*A))+y(G*C))),l=y(y(y(y(y(k*M)+y(B*a))+y(N*l))+y(y(y(a*f)-y(M*L))-y(l*F)))+y(y(y(Q*v)+y(H*A))+y(j*C))),a=y(y(y(y(y(k*I)+y(B*c))+y(N*u))+y(y(y(c*f)-y(I*L))-y(u*F)))+y(y(y(X*v)+y(W*A))+y(U*C))),c=y(y(y(_*l)+y(y(p*g)+y(h*a)))-te),u=y(g-y(p*c)),a=y(a-y(h*c)),l=y(l-y(_*c)),m[s+168>>2]=ne+y(y(y(Z*u)+y(E*a))+y(T*l)),m[s+164>>2]=ie+y(y(y(u*K)+y(a*x))+y(l*S)),m[s+160>>2]=re+y(y(R*l)+y(y(b*u)+y(q*a))),d[s+20>>2]=0,m[s+16>>2]=y(y(p*Z)+y(h*E))+y(_*T),m[s+12>>2]=y(y(p*K)+y(h*x))+y(_*S),m[s+8>>2]=y(y(b*p)+y(q*h))+y(R*_),r[d[d[n>>2]+16>>2]](n,s+8|0,s+160|0,c)),O=s+240|0}function ye(e,t,i,n,s){var o,a,l,c,h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0),se=y(0);O=o=O-48|0,c=u[e+16|0],a=d[(l=c?i:n)+12>>2],$=m[a+56>>2],H=m[a+52>>2],J=m[a+48>>2],i=d[(n=c?n:i)+12>>2],ee=m[i+56>>2],te=m[i+52>>2],ie=m[i+48>>2],n=d[n+4>>2],C=m[a+40>>2],f=m[a+8>>2],g=m[a+24>>2],b=m[a+36>>2],x=m[a+4>>2],R=m[a+20>>2],T=m[a+32>>2],M=m[i+40>>2],D=m[i+32>>2],w=m[i+36>>2],P=m[a>>2],F=m[i+8>>2],B=m[i>>2],N=m[i+4>>2],I=m[a+16>>2],V=m[i+24>>2],U=m[i+16>>2],G=m[i+20>>2],p=m[t+12>>2],A=m[t+8>>2],h=m[t>>2],_=m[t+4>>2],i=d[l+4>>2],j=m[i+56>>2],ne=m[i+52>>2],W=m[i+48>>2],d[o+28>>2]=0,S=y(y(2)/y(y(y(y(h*h)+y(_*_))+y(A*A))+y(p*p))),v=y(A*S),X=y(h*v),L=y(_*S),Y=y(p*L),k=y(X+Y),Q=y(_*v),E=y(h*S),q=y(p*E),S=y(Q-q),K=y(h*E),Z=y(_*L),_=y(y(1)-y(K+Z)),E=y(y(y(D*k)+y(w*S))+y(M*_)),z=y(y(y(B*k)+y(N*S))+y(F*_)),_=y(y(y(U*k)+y(G*S))+y(V*_)),S=y(-ne),m[o+24>>2]=y(y(y(y(b*E)+y(y(x*z)+y(R*_)))*S)-y(W*y(y(T*E)+y(y(P*z)+y(I*_)))))-y(j*y(y(C*E)+y(y(f*z)+y(g*_)))),_=y(Q+q),L=y(h*L),k=y(p*v),h=y(L-k),E=y(A*v),p=y(y(1)-y(K+E)),A=y(y(M*_)+y(y(D*h)+y(w*p))),v=y(y(F*_)+y(y(B*h)+y(N*p))),h=y(y(V*_)+y(y(U*h)+y(G*p))),m[o+20>>2]=y(y(y(y(b*A)+y(y(x*v)+y(R*h)))*S)-y(W*y(y(T*A)+y(y(P*v)+y(I*h)))))-y(j*y(y(C*A)+y(y(f*v)+y(g*h)))),h=y(X-Y),p=y(L+k),_=y(y(1)-y(Z+E)),A=y(y(M*h)+y(y(w*p)+y(D*_))),v=y(y(F*h)+y(y(N*p)+y(B*_))),h=y(y(V*h)+y(y(G*p)+y(U*_))),m[o+16>>2]=y(y(y(y(b*A)+y(y(x*v)+y(R*h)))*S)-y(W*y(y(T*A)+y(y(P*v)+y(I*h)))))-y(j*y(y(C*A)+y(y(f*v)+y(g*h)))),r[d[d[n>>2]+64>>2]](o+32|0,n,o+16|0),t=d[l+12>>2],S=m[t+48>>2],L=m[t+32>>2],k=m[t+16>>2],E=m[t+8>>2],z=m[t+4>>2],ne=m[t>>2],X=m[t+56>>2],Y=m[t+52>>2],Q=m[t+40>>2],q=m[t+36>>2],K=m[t+24>>2],Z=m[t+20>>2],re=m[i+64>>2],A=m[i+56>>2],j=m[i+48>>2],W=m[i+52>>2],h=m[o+40>>2],p=m[o+32>>2],_=m[o+36>>2],se=m[d[e+12>>2]+752>>2],d[s+4>>2]=d[e+12>>2],v=y(-H),H=y(y(y(y(y(ie*f)+y(te*g))+y(ee*C))+y(y(y(g*v)-y(f*J))-y(C*$)))+y(y(y(p*y(y(y(B*f)+y(U*g))+y(D*C)))+y(_*y(y(y(N*f)+y(G*g))+y(w*C))))+y(h*y(y(y(F*f)+y(V*g))+y(M*C))))),T=y(y(y(y(y(ie*P)+y(te*I))+y(ee*T))+y(y(y(I*v)-y(P*J))-y(T*$)))+y(y(y(p*y(y(y(B*P)+y(U*I))+y(D*T)))+y(_*y(y(y(N*P)+y(G*I))+y(w*T))))+y(h*y(y(y(F*P)+y(V*I))+y(M*T))))),x=y(y(y(y(y(ie*x)+y(te*R))+y(ee*b))+y(y(y(R*v)-y(x*J))-y(b*$)))+y(y(y(p*y(y(y(B*x)+y(U*R))+y(D*b)))+y(_*y(y(y(N*x)+y(G*R))+y(w*b))))+y(h*y(y(y(F*x)+y(V*R))+y(M*b))))),(C=y(y(y(A*H)+y(y(j*T)+y(W*x)))-re))>2],R=m[e+24>>2],P=m[e+20>>2],I=m[e+40>>2],M=m[e+36>>2],D=m[e+16>>2],w=m[e+32>>2],f=m[i+56>>2],F=m[e+8>>2],g=m[i+48>>2],B=m[e>>2],b=m[i+52>>2],N=m[e+4>>2],d[o+28>>2]=0,m[o+16>>2]=y(y(B*g)+y(N*b))+y(F*f),m[o+24>>2]=y(y(g*w)+y(b*M))+y(f*I),m[o+20>>2]=y(y(g*D)+y(b*P))+y(f*R),d[o+12>>2]=0,f=y(T-y(j*C)),g=y(x-y(W*C)),b=y(H-y(A*C)),m[o+8>>2]=y(y(y(f*L)+y(g*q))+y(b*Q))+X,m[o+4>>2]=y(y(y(f*k)+y(g*Z))+y(b*K))+Y,m[o>>2]=y(y(E*b)+y(y(ne*f)+y(z*g)))+S,r[d[d[s>>2]+16>>2]](s,o+16|0,o,C)),O=o+48|0}function ve(e){var t=0,i=0,n=0,r=0,s=0,o=0,a=0;e:if(e|=0){s=(n=e+-8|0)+(e=-8&(i=d[e+-4>>2]))|0;t:if(!(1&i)){if(!(3&i))break e;if((n=n-(i=d[n>>2])|0)>>>0>2])))return d[7726]=e,d[s+4>>2]=-2&i,d[n+4>>2]=1|e,void(d[e+n>>2]=e)}else{if(i>>>0<=255){if(r=d[n+8>>2],i=i>>>3|0,(0|(t=d[n+12>>2]))==(0|r)){d[7724]=d[7724]&a_(i);break t}d[r+12>>2]=t,d[t+8>>2]=r;break t}if(a=d[n+24>>2],(0|n)==(0|(i=d[n+12>>2])))if((t=d[(r=n+20|0)>>2])||(t=d[(r=n+16|0)>>2])){for(;o=r,(t=d[(r=(i=t)+20|0)>>2])||(r=i+16|0,t=d[i+16>>2]););d[o>>2]=0}else i=0;else t=d[n+8>>2],d[t+12>>2]=i,d[i+8>>2]=t;if(!a)break t;r=d[n+28>>2];i:{if(d[(t=31200+(r<<2)|0)>>2]==(0|n)){if(d[t>>2]=i,i)break i;d[7725]=d[7725]&a_(r);break t}if(d[a+(d[a+16>>2]==(0|n)?16:20)>>2]=i,!i)break t}if(d[i+24>>2]=a,(t=d[n+16>>2])&&(d[i+16>>2]=t,d[t+24>>2]=i),!(t=d[n+20>>2]))break t;d[i+20>>2]=t,d[t+24>>2]=i}}if(!(s>>>0<=n>>>0)&&1&(i=d[s+4>>2])){t:{if(!(2&i)){if(d[7730]==(0|s)){if(d[7730]=n,e=d[7727]+e|0,d[7727]=e,d[n+4>>2]=1|e,d[7729]!=(0|n))break e;return d[7726]=0,void(d[7729]=0)}if(d[7729]==(0|s))return d[7729]=n,e=d[7726]+e|0,d[7726]=e,d[n+4>>2]=1|e,void(d[e+n>>2]=e);e=(-8&i)+e|0;i:if(i>>>0<=255){if(i=i>>>3|0,(0|(t=d[s+8>>2]))==(0|(r=d[s+12>>2]))){d[7724]=d[7724]&a_(i);break i}d[t+12>>2]=r,d[r+8>>2]=t}else{if(a=d[s+24>>2],(0|s)==(0|(i=d[s+12>>2])))if((t=d[(r=s+20|0)>>2])||(t=d[(r=s+16|0)>>2])){for(;o=r,(t=d[(r=(i=t)+20|0)>>2])||(r=i+16|0,t=d[i+16>>2]););d[o>>2]=0}else i=0;else t=d[s+8>>2],d[t+12>>2]=i,d[i+8>>2]=t;if(a){r=d[s+28>>2];n:{if(d[(t=31200+(r<<2)|0)>>2]==(0|s)){if(d[t>>2]=i,i)break n;d[7725]=d[7725]&a_(r);break i}if(d[a+(d[a+16>>2]==(0|s)?16:20)>>2]=i,!i)break i}d[i+24>>2]=a,(t=d[s+16>>2])&&(d[i+16>>2]=t,d[t+24>>2]=i),(t=d[s+20>>2])&&(d[i+20>>2]=t,d[t+24>>2]=i)}}if(d[n+4>>2]=1|e,d[e+n>>2]=e,d[7729]!=(0|n))break t;return void(d[7726]=e)}d[s+4>>2]=-2&i,d[n+4>>2]=1|e,d[e+n>>2]=e}if(e>>>0<=255)return i=30936+((e=e>>>3|0)<<3)|0,(t=d[7724])&(e=1<>2]:(d[7724]=e|t,e=i),d[i+8>>2]=n,d[e+12>>2]=n,d[n+12>>2]=i,void(d[n+8>>2]=e);d[n+16>>2]=0,d[n+20>>2]=0,t=0,(r=e>>>8|0)&&(t=31,e>>>0>16777215||(t=(i=r)<<(r=r+1048320>>>16&8),t=28+((t=((t<<=a=t+520192>>>16&4)<<(o=t+245760>>>16&2)>>>15|0)-(o|r|a)|0)<<1|e>>>t+21&1)|0)),d[(s=n)+28>>2]=t,o=31200+(t<<2)|0;t:{i:{if((r=d[7725])&(i=1<>>1|0)|0),i=d[o>>2];;){if(t=i,(-8&d[i+4>>2])==(0|e))break i;if(i=r>>>29|0,r<<=1,!(i=d[16+(o=t+(4&i)|0)>>2]))break}d[o+16>>2]=n,d[n+24>>2]=t}else d[7725]=i|r,d[o>>2]=n,d[n+24>>2]=o;d[n+12>>2]=n,d[n+8>>2]=n;break t}e=d[t+8>>2],d[e+12>>2]=n,d[t+8>>2]=n,d[n+24>>2]=0,d[n+12>>2]=t,d[n+8>>2]=e}if(e=d[7732]+-1|0,d[7732]=e,!e){for(n=31352;n=(e=d[n>>2])+8|0,e;);d[7732]=-1}}}}function Ae(e,t,i,n,s,o){var a,l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0);O=a=O-400|0,yr(7817),l=d[i+12>>2],d[a+344>>2]=d[i+8>>2],d[a+348>>2]=l,l=d[i+4>>2],d[a+336>>2]=d[i>>2],d[a+340>>2]=l,l=d[i+28>>2],d[a+360>>2]=d[i+24>>2],d[a+364>>2]=l,l=d[i+20>>2],d[a+352>>2]=d[i+16>>2],d[a+356>>2]=l,l=d[i+44>>2],d[a+376>>2]=d[i+40>>2],d[a+380>>2]=l,l=d[i+36>>2],d[a+368>>2]=d[i+32>>2],d[a+372>>2]=l,l=d[i+60>>2],d[a+392>>2]=d[i+56>>2],d[a+396>>2]=l,l=d[i+52>>2],d[a+384>>2]=d[i+48>>2],d[a+388>>2]=l,l=d[n+12>>2],d[a+280>>2]=d[n+8>>2],d[a+284>>2]=l,l=d[n+4>>2],d[a+272>>2]=d[n>>2],d[a+276>>2]=l,l=d[n+28>>2],d[a+296>>2]=d[n+24>>2],d[a+300>>2]=l,l=d[n+20>>2],d[a+288>>2]=d[n+16>>2],d[a+292>>2]=l,l=d[n+44>>2],d[a+312>>2]=d[n+40>>2],d[a+316>>2]=l,l=d[n+36>>2],d[a+304>>2]=d[n+32>>2],d[a+308>>2]=l,l=d[n+60>>2],d[a+328>>2]=d[n+56>>2],d[a+332>>2]=l,l=d[n+52>>2],d[a+320>>2]=d[n+48>>2],d[a+324>>2]=l,kt(a+336|0,a+272|0,a+8|0,a+256|0),d[a+236>>2]=0,c=m[a+256>>2],m[a+232>>2]=c*m[a+16>>2],m[a+228>>2]=c*m[a+12>>2],m[a+224>>2]=c*m[a+8>>2],d[a+216>>2]=0,d[a+220>>2]=0,d[a+208>>2]=0,d[a+212>>2]=0,d[(l=a- -64|0)>>2]=0,d[l+4>>2]=0,d[a+56>>2]=0,d[a+60>>2]=0,st(a+336|0,a+256|0),d[a+52>>2]=0,d[a+36>>2]=0,c=m[a+256>>2],h=m[a+260>>2],_=m[a+264>>2],f=m[a+268>>2],p=y(y(2)/y(y(y(y(c*c)+y(h*h))+y(_*_))+y(f*f))),b=y(_*p),u=y(h*b),g=y(c*p),v=y(f*g),m[a+44>>2]=u+v,m[a+32>>2]=u-v,u=y(c*g),g=h,h=y(h*p),p=y(g*h),m[a+48>>2]=y(1)-y(u+p),_=y(_*b),m[a+28>>2]=y(1)-y(u+_),d[a+20>>2]=0,u=y(c*b),g=y(f*h),m[a+40>>2]=u-g,c=y(c*h),h=y(f*b),m[a+24>>2]=c+h,m[a+16>>2]=u+g,m[a+12>>2]=c-h,m[a+8>>2]=y(1)-y(p+_),dn(t,a+8|0,a+208|0,a+224|0,a+256|0,a+240|0),d[a+8>>2]=9368,l=d[i+12>>2],d[a+52>>2]=d[i+8>>2],d[a+56>>2]=l,l=d[i+4>>2],d[a+44>>2]=d[i>>2],d[a+48>>2]=l,l=d[i+28>>2],d[a+68>>2]=d[i+24>>2],d[a+72>>2]=l,l=d[i+20>>2],d[a+60>>2]=d[i+16>>2],d[a+64>>2]=l,l=d[i+44>>2],d[a+84>>2]=d[i+40>>2],d[a+88>>2]=l,l=d[i+36>>2],d[a+76>>2]=d[i+32>>2],d[a+80>>2]=l,l=d[i+60>>2],d[a+100>>2]=d[i+56>>2],d[a+104>>2]=l,l=d[i+52>>2],d[a+92>>2]=d[i+48>>2],d[a+96>>2]=l,i=d[n+12>>2],d[a+116>>2]=d[n+8>>2],d[a+120>>2]=i,i=d[n+4>>2],d[a+108>>2]=d[n>>2],d[a+112>>2]=i,i=d[n+20>>2],d[a+124>>2]=d[n+16>>2],d[a+128>>2]=i,i=d[n+28>>2],d[a+132>>2]=d[n+24>>2],d[a+136>>2]=i,i=d[n+44>>2],d[a+148>>2]=d[n+40>>2],d[a+152>>2]=i,i=d[n+36>>2],d[a+140>>2]=d[n+32>>2],d[a+144>>2]=i,i=d[n+52>>2],d[a+156>>2]=d[n+48>>2],d[a+160>>2]=i,i=d[n+60>>2],d[a+164>>2]=d[n+56>>2],d[a+168>>2]=i,d[a+192>>2]=s,m[a+196>>2]=o,d[a+200>>2]=t,d[a+188>>2]=e,o=y(m[a+156>>2]-m[a+92>>2]),c=y(m[a+160>>2]-m[a+96>>2]),h=y(m[a+164>>2]-m[a+100>>2]),f=y(y(1)/y(x(y(y(y(o*o)+y(c*c))+y(h*h))))),b=(_=y(h*f))==y(0)?y(0xde0b6b000000000):y(y(1)/_),m[a+20>>2]=b,u=(p=y(c*f))==y(0)?y(0xde0b6b000000000):y(y(1)/p),m[a+16>>2]=u,d[a+36>>2]=b>2]=u>2]=y(h*_)+y(y(g*o)+y(c*p)),o=o==y(0)?y(0xde0b6b000000000):y(y(1)/o),m[a+12>>2]=o,d[a+28>>2]=o>2],r[d[d[e>>2]+24>>2]](e,a+384|0,a+320|0,a+8|0,a+256|0,a+240|0),As(),O=a+400|0}function Ce(e,t,i,n,o){var a,l,c,h=0,_=y(0),p=y(0),f=0,g=y(0),v=y(0),A=y(0),C=0,S=0;if(O=a=O-112|0,kn(e),s[e+280|0]=1,d[e>>2]=20956,d[e+276>>2]=0,s[e+408|0]=1,d[e+284>>2]=0,d[e+268>>2]=0,d[e+272>>2]=0,d[e+404>>2]=0,s[e+428|0]=1,d[e+396>>2]=0,d[e+400>>2]=0,d[e+424>>2]=0,s[e+448|0]=1,d[e+416>>2]=0,d[e+420>>2]=0,d[e+444>>2]=0,s[e+496|0]=1,d[e+436>>2]=0,d[e+440>>2]=0,d[e+492>>2]=0,d[e+484>>2]=0,d[e+488>>2]=0,s[e+516|0]=1,d[e+512>>2]=0,s[e+704|0]=1,d[e+684>>2]=t,d[e+504>>2]=0,d[e+508>>2]=0,d[e+700>>2]=0,d[e+692>>2]=0,d[e+696>>2]=0,s[e+724|0]=1,d[e+720>>2]=0,d[e+712>>2]=0,d[e+716>>2]=0,s[e+744|0]=1,d[e+740>>2]=0,d[e+732>>2]=0,d[e+736>>2]=0,s[e+764|0]=1,d[e+760>>2]=0,d[e+752>>2]=0,d[e+756>>2]=0,s[e+784|0]=1,d[e+780>>2]=0,d[e+772>>2]=0,d[e+776>>2]=0,s[e+804|0]=1,s[e+824|0]=1,d[e+800>>2]=0,d[e+792>>2]=0,d[e+796>>2]=0,s[e+844|0]=1,d[e+820>>2]=0,d[e+812>>2]=0,d[e+816>>2]=0,s[e+864|0]=1,d[e+840>>2]=0,d[e+832>>2]=0,d[e+836>>2]=0,s[e+884|0]=1,d[e+860>>2]=0,d[e+852>>2]=0,d[e+856>>2]=0,d[e+880>>2]=0,d[e+872>>2]=0,d[e+876>>2]=0,c=ko(e+928|0),ko(e+988|0),ko(e+1048|0),d[e+1120>>2]=0,s[e+1124|0]=1,s[e+1144|0]=1,d[(t=e+1112|0)>>2]=0,d[t+4>>2]=0,d[e+1140>>2]=0,s[e+1248|0]=1,d[(t=e+1132|0)>>2]=0,d[t+4>>2]=0,d[e+1244>>2]=0,d[(t=e+1236|0)>>2]=0,d[t+4>>2]=0,gt(e),l=mn(e),d[(t=l)+12>>2]=1065353216,d[t+16>>2]=1,d[t+4>>2]=1065353216,d[t+8>>2]=1065353216,t=d[e+192>>2],_=y(r[d[d[t>>2]+48>>2]](t)),Mn(a+8|0,0,100),(0|(t=d[e+712>>2]))<(0|i)){if(d[e+716>>2]<(0|i)){if(h=t,i&&(d[7717]=d[7717]+1,C=0|r[d[6606]](b(i,104),16),h=d[e+712>>2]),(0|h)>=1)for(;Mi((S=b(f,104))+C|0,d[e+720>>2]+S|0,104),(0|(f=f+1|0))!=(0|h););(h=d[e+720>>2])&&(u[e+724|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+720>>2]=0),d[e+720>>2]=C,s[e+724|0]=1,d[e+716>>2]=i}for(;h=d[e+720>>2]+b(t,104)|0,d[h>>2]=0,Mi(h+4|0,a+8|0,100),(0|i)!=(0|(t=t+1|0)););}if(d[e+712>>2]=i,(0|i)>=1)for(f=0;h=Mn(d[e+720>>2]+b(f,104)|0,0,104),g=y(0),v=y(0),A=y(0),p=y(0),t=0,n&&(p=m[n+12>>2],A=m[n+8>>2],g=m[n+4>>2],v=m[n>>2],t=n+16|0),m[h+8>>2]=v,m[h+12>>2]=g,m[h+20>>2]=p,m[h+16>>2]=A,n=d[h+12>>2],d[h+24>>2]=d[h+8>>2],d[h+28>>2]=n,n=d[h+20>>2],d[h+32>>2]=d[h+16>>2],d[h+36>>2]=n,o?(p=m[o>>2],o=o+4|0):(p=y(1),o=0),m[h+88>>2]=p>y(0)?y(y(1)/p):y(0),d[a+36>>2]=0,m[a+32>>2]=_+A,m[a+28>>2]=_+g,m[a+24>>2]=_+v,d[a+20>>2]=0,m[a+16>>2]=A-_,m[a+12>>2]=g-_,m[a+8>>2]=v-_,d[h+96>>2]=br(c,a+8|0,h),d[h+4>>2]=l,n=t,(0|(f=f+1|0))!=(0|i););t=e+892|0;e:if(i=d[e+928>>2]){if(n=d[e+192>>2],_=y(r[d[d[n>>2]+48>>2]](n)),p=m[i>>2],g=m[i+4>>2],v=m[i+8>>2],d[e+904>>2]=0,m[e+900>>2]=v-_,m[e+896>>2]=g-_,m[e+892>>2]=p-_,p=m[i+20>>2],g=m[i+24>>2],v=m[i+16>>2],d[e+920>>2]=0,m[e+916>>2]=_+g,m[e+912>>2]=_+p,m[(i=e+908|0)>>2]=_+v,!(n=d[e+188>>2]))break e;o=d[e+684>>2],h=d[o+32>>2],r[d[d[h>>2]+16>>2]](h,n,t,i,d[o+36>>2])}else d[t>>2]=0,d[t+4>>2]=0,d[t+24>>2]=0,d[t+28>>2]=0,d[t+16>>2]=0,d[t+20>>2]=0,d[t+8>>2]=0,d[t+12>>2]=0;return O=a+112|0,e}function Se(e,t,i,n){var r,o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0);Ao(e,6,Hs(),t),d[e>>2]=18896,a=d[i+12>>2],d[e+120>>2]=d[i+8>>2],d[e+124>>2]=a,a=d[i+4>>2],d[e+112>>2]=d[i>>2],d[e+116>>2]=a,a=d[i+28>>2],d[e+136>>2]=d[i+24>>2],d[e+140>>2]=a,a=d[i+20>>2],d[e+128>>2]=d[i+16>>2],d[e+132>>2]=a,a=d[i+44>>2],d[e+152>>2]=d[i+40>>2],d[e+156>>2]=a,a=d[i+36>>2],d[e+144>>2]=d[i+32>>2],d[e+148>>2]=a,a=d[i+56>>2],r=d[i+60>>2],o=d[i+48>>2],i=d[i+52>>2],d[e+784>>2]=0,d[e+776>>2]=0,d[e+780>>2]=0,d[e+768>>2]=0,d[e+772>>2]=0,d[e+756>>2]=1045220557,d[e+760>>2]=1045220557,d[e+764>>2]=1045220557,d[e+740>>2]=0,d[e+744>>2]=0,d[e+748>>2]=0,d[e+752>>2]=0,d[e+720>>2]=0,d[e+724>>2]=0,d[e+712>>2]=0,d[e+716>>2]=0,d[e+704>>2]=0,d[e+708>>2]=0,d[e+696>>2]=0,d[e+700>>2]=0,d[e+688>>2]=0,d[e+692>>2]=0,d[e+680>>2]=0,d[e+684>>2]=0,d[e+168>>2]=a,d[e+172>>2]=r,d[e+160>>2]=o,d[e+164>>2]=i,d[e+728>>2]=1060320051,d[e+732>>2]=1065353216,d[e+736>>2]=1056964608,s[e+790|0]=0,s[e+788|0]=0,s[e+789|0]=0,d[e+792>>2]=0,d[e+796>>2]=0,d[e+800>>2]=0,d[e+808>>2]=0,d[e+812>>2]=0,d[e+816>>2]=0,d[e+876>>2]=0,d[e+880>>2]=1036831949,d[e+884>>2]=1133903872,d[e+868>>2]=1065353216,d[e+872>>2]=-1082130432,d[e+896>>2]=0,d[e+900>>2]=1045220557,d[e+904>>2]=0,d[e+908>>2]=0,d[e+924>>2]=0,d[e+928>>2]=0,d[e+888>>2]=1065353216,d[e+892>>2]=1056964608,d[e+916>>2]=0,d[e+992>>2]=0,s[e+912|0]=0,d[e+940>>2]=0,d[e+944>>2]=1036831949,d[e+948>>2]=1133903872,d[e+968>>2]=0,d[e+972>>2]=0,d[e+960>>2]=0,d[e+964>>2]=1045220557,d[e+932>>2]=1065353216,d[e+936>>2]=-1082130432,d[e+952>>2]=1065353216,d[e+956>>2]=1056964608,d[e+988>>2]=0,d[e+980>>2]=0,s[e+976|0]=0,d[e+1004>>2]=0,d[e+1008>>2]=1036831949,d[e+1012>>2]=1133903872,d[(i=e+1032|0)>>2]=0,d[i+4>>2]=0,d[(i=e+1024|0)>>2]=0,d[i+4>>2]=1045220557,d[e+996>>2]=1065353216,d[e+1e3>>2]=-1082130432,d[e+1016>>2]=1065353216,d[e+1020>>2]=1056964608,d[(i=e+1052|0)>>2]=0,d[i+4>>2]=0,d[e+1044>>2]=0,s[e+1040|0]=0,s[e+1301|0]=1,s[e+1308|0]=0,d[e+1304>>2]=0,s[e+1300|0]=n,O=m[t+52>>2],w=m[t+56>>2],F=m[t+60>>2],v=m[e+168>>2],A=m[e+160>>2],C=m[e+164>>2],l=m[t+8>>2],c=m[t+12>>2],h=m[t+28>>2],_=m[t+20>>2],u=m[t+24>>2],S=m[e+128>>2],x=m[e+144>>2],T=m[e+148>>2],E=m[e+116>>2],R=m[e+132>>2],p=m[t+44>>2],P=m[e+152>>2],f=m[t+36>>2],I=m[e+120>>2],g=m[t+40>>2],M=m[e+136>>2],b=m[t+4>>2],D=m[e+112>>2],d[e+108>>2]=0,d[e+92>>2]=0,d[e+76>>2]=0,d[e+60>>2]=0,m[e+88>>2]=y(y(I*f)+y(M*g))+y(P*p),m[e+84>>2]=y(y(E*f)+y(R*g))+y(T*p),m[e+80>>2]=y(y(D*f)+y(S*g))+y(x*p),m[e+72>>2]=y(y(I*_)+y(M*u))+y(P*h),m[e+68>>2]=y(y(E*_)+y(R*u))+y(T*h),m[e- -64>>2]=y(y(D*_)+y(S*u))+y(x*h),m[e+56>>2]=y(y(b*I)+y(l*M))+y(c*P),m[e+52>>2]=y(y(b*E)+y(l*R))+y(c*T),m[e+48>>2]=y(y(D*b)+y(S*l))+y(x*c),m[e+104>>2]=F+y(y(y(f*A)+y(g*C))+y(p*v)),m[e+100>>2]=w+y(y(y(_*A)+y(u*C))+y(h*v)),m[e+96>>2]=O+y(y(y(b*A)+y(l*C))+y(c*v)),nt(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0)}function xe(e,t,i,n,o,l){e|=0,t|=0,i|=0,n|=0,o|=0,l|=0;var c,_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=0,S=0,T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=0,F=0,B=0,N=0;O=c=O-304|0,_=m[t+52>>2],g=m[i+52>>2],p=m[t+56>>2],b=m[i+56>>2],v=m[t+48>>2],f=m[i+48>>2],d[c+300>>2]=0,p=y(b-p),m[c+296>>2]=p,I=y(g-_),m[c+292>>2]=I,M=y(f-v),m[c+288>>2]=M,kt(t,i,c+112|0,c+48|0),d[c+284>>2]=0,_=m[c+48>>2],g=y(_*m[c+120>>2]),m[c+280>>2]=g,b=y(_*m[c+116>>2]),m[c+276>>2]=b,v=y(_*m[c+112>>2]),m[c+272>>2]=v,_=m[n+52>>2],f=m[o+52>>2],A=m[n+56>>2],T=m[o+56>>2],E=m[n+48>>2],P=m[o+48>>2],d[c+268>>2]=0,T=y(T-A),m[c+264>>2]=T,D=y(f-_),m[c+260>>2]=D,E=y(P-E),m[c+256>>2]=E,kt(n,o,c+112|0,c+48|0),d[c+252>>2]=0,_=m[c+48>>2],f=y(_*m[c+120>>2]),m[c+248>>2]=f,A=y(_*m[c+116>>2]),m[c+244>>2]=A,_=y(_*m[c+112>>2]),m[c+240>>2]=_,i=d[e+12>>2],R=y(r[d[d[i>>2]+16>>2]](i)),P=y(0),(i=d[e+16>>2])&&(P=y(r[d[d[i>>2]+16>>2]](i)),p=m[c+296>>2],T=m[c+264>>2],I=m[c+292>>2],D=m[c+260>>2],M=m[c+288>>2],E=m[c+256>>2],f=m[c+248>>2],A=m[c+244>>2],g=m[c+280>>2],b=m[c+276>>2],v=m[c+272>>2],_=m[c+240>>2]),f=y(y(R*y(x(y(y(y(v*v)+y(b*b))+y(g*g)))))+y(P*y(x(y(y(y(_*_)+y(A*A))+y(f*f)))))),g=y(E-M),b=y(D-I),v=y(T-p);e:if(y(f+y(x(y(y(y(g*g)+y(b*b))+y(v*v)))))!=y(0)&&(s[c+216|0]=0,d[c+212>>2]=1566444395,d[c+176>>2]=7200,be(e,t,n,c+176|0),i=d[c+208>>2],d[c+232>>2]=d[c+204>>2],d[c+236>>2]=i,i=d[c+200>>2],d[c+224>>2]=d[c+196>>2],d[c+228>>2]=i,u[c+216|0]&&(i=d[c+180>>2],w=d[c+184>>2],F=d[c+188>>2],!(y(f+y(y(y(g*m[c+180>>2])+y(b*m[c+184>>2]))+y(v*m[c+188>>2])))<=y(1.1920928955078125e-7))))){S=1,_=y(0);t:{if(p=y(m[c+212>>2]+m[l+172>>2]),R=m[c+192>>2],p>y(.0010000000474974513)){for(B=c+20|0,N=c+160|0,o=0;;){if((C=d[l+168>>2])&&(d[c+120>>2]=1065353216,d[c+124>>2]=0,d[c+112>>2]=1065353216,d[c+116>>2]=1065353216,r[d[d[C>>2]+20>>2]](C,c+224|0,y(.20000000298023224),c+112|0)),(A=y(f+y(y(y(g*(a(0,i),h()))+y(b*(a(0,w),h())))+y(v*(a(0,F),h())))))<=y(1.1920928955078125e-7)){S=0;break e}if((p=y(_+y(p/A)))<=_){S=0;break e}if(p>y(1)){S=0;break e}if(p>2])&&(d[c+8>>2]=0,d[c+12>>2]=0,d[c>>2]=1065353216,d[c+4>>2]=0,r[d[d[i>>2]+20>>2]](i,N,y(.20000000298023224),c)),r[d[d[l>>2]>>2]](l,p),s[c+40|0]=0,d[c+36>>2]=1566444395,d[c>>2]=7200,be(e,c+112|0,c+48|0,c),!u[c+40|0])break t;if(A=m[l+172>>2],C=d[(i=B)+12>>2],d[c+232>>2]=d[i+8>>2],d[c+236>>2]=C,C=d[i+4>>2],d[c+224>>2]=d[i>>2],d[c+228>>2]=C,C=o+1|0,o>>>0>63){r[d[d[l>>2]+8>>2]](l,-2,C),S=0;break e}if(i=d[c+4>>2],w=d[c+8>>2],F=d[c+12>>2],o=C,_=p,!((p=y(m[c+36>>2]+A))>y(.0010000000474974513)))break}R=m[c+16>>2]}p=R,d[l+132>>2]=i,m[l+164>>2]=_,m[l+144>>2]=p,d[l+140>>2]=F,d[l+136>>2]=w,e=d[c+228>>2],d[l+148>>2]=d[c+224>>2],d[l+152>>2]=e,e=d[c+236>>2],d[l+156>>2]=d[c+232>>2],d[l+160>>2]=e;break e}r[d[d[l>>2]+8>>2]](l,-1,o),S=0}return O=c+304|0,0|S}function Te(e,t){var i,n=0,o=y(0),a=y(0),l=0,c=y(0),h=y(0);O=i=O-16|0,d[e+312>>2]=0,d[e+316>>2]=0,d[e+236>>2]=2,d[e+544>>2]=1065353216,d[e+548>>2]=1065353216,d[e+348>>2]=1065353216,d[e+352>>2]=1065353216,d[e+412>>2]=0,d[e+416>>2]=0,d[e+320>>2]=0,d[e+324>>2]=0,d[e+328>>2]=0,d[e+332>>2]=0,d[e+336>>2]=0,d[e+340>>2]=0,d[e+552>>2]=1065353216,d[e+556>>2]=0,d[e+360>>2]=0,d[e+364>>2]=0,d[e+356>>2]=1065353216,d[e+368>>2]=0,d[e+372>>2]=0,d[e+376>>2]=0,d[e+380>>2]=0,d[e+384>>2]=0,d[e+388>>2]=0,d[e+392>>2]=0,d[e+420>>2]=0,d[e+424>>2]=0,d[e+428>>2]=0,d[e+432>>2]=0,d[e+436>>2]=0,d[e+440>>2]=0,o=m[t+96>>2],a=m[t+92>>2],m[i+12>>2]=a,m[i+8>>2]=o,d[i+4>>2]=0,d[i>>2]=1065353216,d[e+444>>2]=d[(ay(1)?i:i+12|0)>>2],d[i+4>>2]=0,d[i>>2]=1065353216,d[e+448>>2]=d[(oy(1)?i:i+8|0)>>2],d[e+472>>2]=d[t+112>>2],d[e+476>>2]=d[t+116>>2],l=d[t+4>>2],d[e+608>>2]=0,d[e+612>>2]=0,d[e+480>>2]=l,s[e+452|0]=u[t+120|0],d[e+456>>2]=d[t+124>>2],d[e+460>>2]=d[t+128>>2],d[e+464>>2]=d[t+132>>2],d[e+468>>2]=d[t+136>>2],l?(n=e+4|0,r[d[d[l>>2]+8>>2]](l,n)):(n=d[t+12>>2],d[e+4>>2]=d[t+8>>2],d[e+8>>2]=n,n=d[t+20>>2],d[e+12>>2]=d[t+16>>2],d[e+16>>2]=n,n=d[t+36>>2],d[e+28>>2]=d[t+32>>2],d[e+32>>2]=n,n=d[t+28>>2],d[e+20>>2]=d[t+24>>2],d[e+24>>2]=n,n=d[t+44>>2],d[e+36>>2]=d[t+40>>2],d[e+40>>2]=n,n=d[t+52>>2],d[e+44>>2]=d[t+48>>2],d[e+48>>2]=n,l=d[4+(n=t- -64|0)>>2],d[e+60>>2]=d[n>>2],d[e+64>>2]=l,n=d[t+60>>2],d[e+52>>2]=d[t+56>>2],d[e+56>>2]=n,n=e+4|0),l=d[n+4>>2],d[e+68>>2]=d[n>>2],d[e+72>>2]=l,l=d[n+12>>2],d[e+76>>2]=d[n+8>>2],d[e+80>>2]=l,n=d[e+32>>2],d[e+92>>2]=d[e+28>>2],d[e+96>>2]=n,n=d[e+24>>2],d[e+84>>2]=d[e+20>>2],d[e+88>>2]=n,n=d[e+40>>2],d[e+100>>2]=d[e+36>>2],d[e+104>>2]=n,n=d[e+48>>2],d[e+108>>2]=d[e+44>>2],d[e+112>>2]=n,n=d[e+56>>2],d[e+116>>2]=d[e+52>>2],d[e+120>>2]=n,n=d[e+64>>2],d[e+124>>2]=d[e+60>>2],d[e+128>>2]=n,d[e+132>>2]=0,d[e+136>>2]=0,d[e+140>>2]=0,d[e+144>>2]=0,d[e+148>>2]=0,d[e+152>>2]=0,d[e+156>>2]=0,d[e+160>>2]=0,d[e+224>>2]=d[t+100>>2],d[e+232>>2]=d[t+104>>2],d[e+228>>2]=d[t+108>>2],r[d[d[e>>2]+12>>2]](e,d[t+72>>2]),n=d[7311],d[7311]=n+1,d[e+508>>2]=n,o=y(0),n=d[e+204>>2],(a=m[t>>2])!=y(0)?(d[e+204>>2]=-2&n,o=y(y(1)/a)):d[e+204>>2]=1|n,m[e+344>>2]=o,d[e+376>>2]=0,m[e+364>>2]=a*m[e+380>>2],m[e+372>>2]=a*m[e+388>>2],m[e+368>>2]=a*m[e+384>>2],a=m[t+84>>2],c=m[t+80>>2],h=m[t+76>>2],m[e+560>>2]=o*m[e+348>>2],m[e+564>>2]=o*m[e+352>>2],m[e+568>>2]=o*m[e+356>>2],d[e+572>>2]=0,d[e+408>>2]=0,m[e+396>>2]=h!=y(0)?y(y(1)/h):y(0),m[e+400>>2]=c!=y(0)?y(y(1)/c):y(0),m[e+404>>2]=a!=y(0)?y(y(1)/a):y(0),Tn(e),d[e+512>>2]=0,d[e+516>>2]=0,d[e+504>>2]=0,d[e+520>>2]=0,d[e+524>>2]=0,d[e+528>>2]=0,d[e+532>>2]=0,d[e+536>>2]=0,d[e+540>>2]=0,d[e+572>>2]=0,d[e+576>>2]=0,d[e+580>>2]=0,d[e+584>>2]=0,d[e+588>>2]=0,d[e+592>>2]=0,d[e+596>>2]=0,d[e+600>>2]=0,d[e+604>>2]=0,o=m[e+344>>2],m[e+568>>2]=o*m[e+356>>2],m[e+564>>2]=o*m[e+352>>2],m[e+560>>2]=o*m[e+348>>2],O=i+16|0}function Ee(e,t,i,n){var o=0,a=0,l=0,c=0,h=y(0),_=0,p=0,f=0,g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=0,T=y(0),E=0,R=y(0),P=y(0),I=y(0),M=0;e:if(!((0|(E=d[e+4>>2]))<2))for(l=d[e+12>>2],v=m[(o=(l+(E<<4)|0)-16|0)>>2],R=m[i>>2],g=m[o+4>>2],P=m[i+4>>2],b=m[o+8>>2],I=m[i+8>>2],h=y(y(y(y(v*R)+y(g*P))+y(b*I))+n);;){A=m[(o=(M<<4)+l|0)>>2],C=m[o+4>>2],S=m[o+8>>2],T=y(y(y(y(A*R)+y(C*P))+y(S*I))+n),x=d[o+12>>2];t:{i:if(h>2]))==d[t+8>>2]&&!((0|o)>=(0|(_=o?o<<1:1)))){if(l=0,p=0,_&&(d[7717]=d[7717]+1,p=0|r[d[6606]](_<<4,16),o=d[t+4>>2]),(0|o)>=1)for(;c=(a=l<<4)+p|0,a=a+d[t+12>>2]|0,f=d[a+4>>2],d[c>>2]=d[a>>2],d[c+4>>2]=f,f=d[a+12>>2],d[c+8>>2]=d[a+8>>2],d[c+12>>2]=f,(0|(l=l+1|0))!=(0|o););(o=d[t+12>>2])&&(u[t+16|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[t+12>>2]=0),d[t+12>>2]=p,s[t+16|0]=1,d[t+8>>2]=_,o=d[t+4>>2]}o=d[t+12>>2]+(o<<4)|0,d[o+12>>2]=x,m[o+8>>2]=S,m[o+4>>2]=C,m[o>>2]=A;break i}if(h=y(h/y(h-T)),b=y(b+y(y(S-b)*h)),g=y(g+y(y(C-g)*h)),h=y(v+y(y(A-v)*h)),(0|(o=d[t+4>>2]))==d[t+8>>2]&&!((0|o)>=(0|(p=o?o<<1:1)))){if(l=0,_=0,p&&(d[7717]=d[7717]+1,_=0|r[d[6606]](p<<4,16),o=d[t+4>>2]),(0|o)>=1)for(;c=x=(a=l<<4)+_|0,a=a+d[t+12>>2]|0,f=d[a+4>>2],d[c>>2]=d[a>>2],d[c+4>>2]=f,c=d[a+12>>2],d[x+8>>2]=d[a+8>>2],d[x+12>>2]=c,(0|(l=l+1|0))!=(0|o););(o=d[t+12>>2])&&(u[t+16|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[t+12>>2]=0),d[t+12>>2]=_,s[t+16|0]=1,d[t+8>>2]=p,o=d[t+4>>2]}o=d[t+12>>2]+(o<<4)|0,d[o+12>>2]=0,m[o+8>>2]=b,m[o+4>>2]=g,m[o>>2]=h}else{if(!(T>2]))==d[t+8>>2]&&!((0|o)>=(0|(_=o?o<<1:1)))){if(l=0,p=0,_&&(d[7717]=d[7717]+1,p=0|r[d[6606]](_<<4,16),o=d[t+4>>2]),(0|o)>=1)for(;c=(a=l<<4)+p|0,a=a+d[t+12>>2]|0,f=d[a+4>>2],d[c>>2]=d[a>>2],d[c+4>>2]=f,f=d[a+12>>2],d[c+8>>2]=d[a+8>>2],d[c+12>>2]=f,(0|(l=l+1|0))!=(0|o););(o=d[t+12>>2])&&(u[t+16|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[t+12>>2]=0),d[t+12>>2]=p,s[t+16|0]=1,d[t+8>>2]=_,o=d[t+4>>2]}if(o=d[t+12>>2]+(o<<4)|0,d[o+12>>2]=0,m[o+8>>2]=b,m[o+4>>2]=g,m[o>>2]=h,o=d[t+4>>2]+1|0,d[t+4>>2]=o,d[t+8>>2]==(0|o)&&!((0|o)>=(0|(_=o?o<<1:1)))){if(l=0,p=0,_&&(d[7717]=d[7717]+1,p=0|r[d[6606]](_<<4,16),o=d[t+4>>2]),(0|o)>=1)for(;c=(a=l<<4)+p|0,a=a+d[t+12>>2]|0,f=d[a+4>>2],d[c>>2]=d[a>>2],d[c+4>>2]=f,f=d[a+12>>2],d[c+8>>2]=d[a+8>>2],d[c+12>>2]=f,(0|(l=l+1|0))!=(0|o););(o=d[t+12>>2])&&(u[t+16|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[t+12>>2]=0),d[t+12>>2]=p,s[t+16|0]=1,d[t+8>>2]=_,o=d[t+4>>2]}o=d[t+12>>2]+(o<<4)|0,d[o+12>>2]=x,m[o+8>>2]=S,m[o+4>>2]=C,m[o>>2]=A}d[t+4>>2]=d[t+4>>2]+1}if((0|(M=M+1|0))==(0|E))break e;I=m[i+8>>2],P=m[i+4>>2],R=m[i>>2],l=d[e+12>>2],h=T,b=S,g=C,v=A}}function Re(e,t,i,n,r,s,o,a,l,c,h){var _,u,p,f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0);p=d[e+16>>2],_=d[240+(p+b(r,244)|0)>>2],u=d[240+(b(n,244)+p|0)>>2],d[t+148>>2]=r,d[t+144>>2]=n,s=d[s+84>>2],d[t+132>>2]=0,d[t+104>>2]=s,d[t+96>>2]=0,d[t+100>>2]=0,u?(e=d[i+4>>2],d[t+16>>2]=d[i>>2],d[t+20>>2]=e,e=d[i+12>>2],d[t+24>>2]=d[i+8>>2],d[t+28>>2]=e,v=m[o+8>>2],f=m[o>>2],g=m[o+4>>2],d[t+12>>2]=0,L=m[t+20>>2],k=m[t+16>>2],O=y(y(f*L)-y(g*k)),m[t+8>>2]=O,V=m[t+24>>2],w=y(y(v*k)-y(f*V)),m[t+4>>2]=w,F=y(y(g*V)-y(v*L)),m[t>>2]=F,v=m[u+552>>2],f=m[u+304>>2],g=m[u+296>>2],A=m[u+300>>2],S=m[u+548>>2],C=m[u+288>>2],R=m[u+280>>2],x=m[u+284>>2],T=m[u+272>>2],E=m[u+268>>2],B=m[u+544>>2],M=m[u+264>>2],d[t+76>>2]=0,T=y(B*y(y(y(F*M)+y(w*E))+y(O*T))),m[t+64>>2]=T,S=y(S*y(y(y(F*R)+y(w*x))+y(O*C))),m[t+68>>2]=S,C=y(v*y(y(y(F*g)+y(w*A))+y(O*f))),m[t+72>>2]=C):(d[t+64>>2]=0,d[t+68>>2]=0,d[t>>2]=0,d[t+4>>2]=0,d[t+72>>2]=0,d[t+76>>2]=0,d[t+8>>2]=0,d[t+12>>2]=0,d[t+16>>2]=0,d[t+20>>2]=0,d[t+24>>2]=0,d[t+28>>2]=0),_?(v=m[i>>2],f=m[i+4>>2],g=m[i+8>>2],d[t+60>>2]=0,B=y(-g),m[t+56>>2]=B,U=y(-f),m[t+52>>2]=U,G=y(-v),m[t+48>>2]=G,A=m[a+8>>2],E=m[a+4>>2],x=m[a>>2],d[t+44>>2]=0,R=y(y(v*E)-y(f*x)),m[t+40>>2]=R,x=y(y(g*x)-y(v*A)),m[t+36>>2]=x,E=y(y(f*A)-y(g*E)),m[t+32>>2]=E,v=m[_+272>>2],A=m[_+268>>2],g=m[_+548>>2],M=m[_+288>>2],I=m[_+280>>2],P=m[_+284>>2],f=m[_+552>>2],D=m[_+304>>2],N=m[_+296>>2],j=m[_+300>>2],W=m[_+544>>2],z=m[_+264>>2],d[t+92>>2]=0,f=y(f*y(y(y(E*N)+y(x*j))+y(R*D))),m[t+88>>2]=f,g=y(g*y(y(y(E*I)+y(x*P))+y(R*M))),m[t+84>>2]=g,A=y(W*y(y(y(E*z)+y(x*A))+y(R*v))),m[t+80>>2]=A):(d[t+80>>2]=0,d[t+84>>2]=0,d[t+32>>2]=0,d[t+36>>2]=0,d[t+88>>2]=0,d[t+92>>2]=0,d[t+40>>2]=0,d[t+44>>2]=0,d[t+48>>2]=0,d[t+52>>2]=0,d[t+56>>2]=0,d[t+60>>2]=0,R=y(0),x=y(0),E=y(0),B=y(0),f=y(0),g=y(0),A=y(0)),M=y(0),e=t,v=l,u?(l=m[o+8>>2],I=m[o+4>>2],D=y(y(y(S*l)-y(C*I))*m[i>>2]),P=C,C=m[o>>2],l=y(m[u+344>>2]+y(y(D+y(y(y(P*C)-y(l*T))*m[i+4>>2]))+y(y(y(I*T)-y(S*C))*m[i+8>>2])))):l=y(0),_?(T=m[a+4>>2],S=m[a+8>>2],P=y(y(y(f*T)-y(g*S))*m[i>>2]),C=f,f=m[a>>2],f=y(m[_+344>>2]+y(y(P+y(y(y(A*S)-y(C*f))*m[i+4>>2]))+y(y(y(g*f)-y(A*T))*m[i+8>>2])))):f=y(0),N=y(v/y(l+f)),m[e+108>>2]=N,v=y(0),T=y(0),S=y(0),C=y(0),f=y(0),g=y(0),u&&(e=b(n,244)+p|0,S=y(m[e+176>>2]+m[e+208>>2]),g=m[e+192>>2],C=m[e+200>>2],T=y(m[e+180>>2]+m[e+212>>2]),f=m[e+196>>2],v=y(m[e+184>>2]+m[e+216>>2])),A=y(0),l=y(0),I=y(0),P=y(0),D=y(0),_&&(e=b(r,244)+p|0,M=y(m[e+176>>2]+m[e+208>>2]),A=y(m[e+180>>2]+m[e+212>>2]),D=m[e+192>>2],I=m[e+200>>2],P=m[e+196>>2],l=y(m[e+184>>2]+m[e+216>>2])),d[t+124>>2]=s,m[t+116>>2]=h,d[t+120>>2]=-2147483648^s,m[t+112>>2]=N*y(c-y(y(y(y(y(S*k)+y(T*L))+y(v*V))+y(y(y(g*F)+y(f*w))+y(C*O)))+y(y(y(y(M*G)+y(A*U))+y(l*B))+y(y(y(D*E)+y(P*x))+y(I*R)))))}function Pe(e,t,i,n,o,l){e|=0,t|=0,i|=0,n|=0,o|=0,l|=0;var c,_,p=0,f=y(0),g=y(0),b=0,v=y(0),A=0,C=y(0),S=y(0),x=y(0),T=0,E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0);O=c=O-288|0,Qs(d[e+4>>2]),f=m[t+52>>2],g=m[i+52>>2],v=m[n+52>>2],C=m[o+52>>2],S=m[t+56>>2],x=m[i+56>>2],E=m[n+56>>2],R=m[o+56>>2],P=m[t+48>>2],I=m[i+48>>2],M=m[n+48>>2],D=m[o+48>>2],s[c+264|0]=0,d[c+260>>2]=1566444395,d[c+224>>2]=7200,_=us(c+144|0,d[e+8>>2],d[e+12>>2],d[e+4>>2],0),d[c+136>>2]=1566444395,p=d[(e=t)+12>>2],d[c+16>>2]=d[e+8>>2],d[c+20>>2]=p,p=d[e+4>>2],d[c+8>>2]=d[e>>2],d[c+12>>2]=p,p=d[e+28>>2],d[c+32>>2]=d[e+24>>2],d[c+36>>2]=p,p=d[e+20>>2],d[c+24>>2]=d[e+16>>2],d[c+28>>2]=p,p=d[e+44>>2],d[c+48>>2]=d[e+40>>2],d[c+52>>2]=p,p=d[e+36>>2],d[c+40>>2]=d[e+32>>2],d[c+44>>2]=p,A=d[e+60>>2],d[(p=c- -64|0)>>2]=d[e+56>>2],d[p+4>>2]=A,p=d[e+52>>2],d[c+56>>2]=d[e+48>>2],d[c+60>>2]=p,p=d[(e=n)+12>>2],d[c+80>>2]=d[e+8>>2],d[c+84>>2]=p,p=d[e+4>>2],d[c+72>>2]=d[e>>2],d[c+76>>2]=p,p=d[e+20>>2],d[c+88>>2]=d[e+16>>2],d[c+92>>2]=p,p=d[e+28>>2],d[c+96>>2]=d[e+24>>2],d[c+100>>2]=p,p=d[e+44>>2],d[c+112>>2]=d[e+40>>2],d[c+116>>2]=p,p=d[e+36>>2],d[c+104>>2]=d[e+32>>2],d[c+108>>2]=p,p=d[e+52>>2],d[c+120>>2]=d[e+48>>2],d[c+124>>2]=p,p=d[e+60>>2],d[c+128>>2]=d[e+56>>2],d[c+132>>2]=p,j_(_,c+8|0,c+224|0,0),e=d[c+256>>2],d[c+280>>2]=d[c+252>>2],d[c+284>>2]=e,e=d[c+248>>2],d[c+272>>2]=d[c+244>>2],d[c+276>>2]=e,b=0;e:if(u[c+264|0]){S=y(y(x-S)-y(R-E)),C=y(y(g-f)-y(C-v)),x=y(y(I-P)-y(D-M)),A=d[c+232>>2],p=d[c+236>>2],T=d[c+228>>2];t:{if((v=m[c+260>>2])>y(.0010000000474974513)){for(e=0,g=y(0);;){if(b=0,32==(0|e))break e;if(b=0,(f=y(g-y(v/y(y(S*(a(0,p),h()))+y(y(C*(a(0,A),h()))+y(x*(a(0,T),h())))))))<=g)break e;if(b=0,f>y(1))break e;if(b=0,f>2]>>2]](l,f),g=y(y(1)-f),m[c+56>>2]=y(g*m[t+48>>2])+y(f*m[i+48>>2]),m[c+60>>2]=y(g*m[t+52>>2])+y(f*m[i+52>>2]),m[c+64>>2]=y(g*m[t+56>>2])+y(f*m[i+56>>2]),m[c+120>>2]=y(g*m[n+48>>2])+y(f*m[o+48>>2]),m[c+124>>2]=y(g*m[n+52>>2])+y(f*m[o+52>>2]),m[c+128>>2]=y(g*m[n+56>>2])+y(f*m[o+56>>2]),j_(_,c+8|0,c+224|0,0),b=0,!u[c+264|0])break e;if((v=m[c+260>>2])>2]=f,e=d[c+228>>2],t=d[c+232>>2],i=d[c+240>>2],d[l+140>>2]=d[c+236>>2],d[l+144>>2]=i,d[l+132>>2]=e,d[l+136>>2]=t,e=d[c+256>>2],d[l+156>>2]=d[c+252>>2],d[l+160>>2]=e,e=d[c+248>>2],d[l+148>>2]=d[c+244>>2],d[l+152>>2]=e;break t}if(e=e+1|0,p=d[c+256>>2],d[c+280>>2]=d[c+252>>2],d[c+284>>2]=p,p=d[c+248>>2],d[c+272>>2]=d[c+244>>2],d[c+276>>2]=p,T=d[c+228>>2],A=d[c+232>>2],p=d[c+236>>2],g=f,!(v>y(.0010000000474974513)))break}g=m[c+240>>2]}else f=y(0),g=m[c+240>>2];if(b=0,y(y(S*(a(0,p),h()))+y(y(C*(a(0,A),h()))+y(x*(a(0,T),h()))))>=y(-m[l+172>>2]))break e;d[l+132>>2]=T,m[l+164>>2]=f,m[l+144>>2]=g,d[l+140>>2]=p,d[l+136>>2]=A,e=d[c+276>>2],d[l+148>>2]=d[c+272>>2],d[l+152>>2]=e,e=d[c+284>>2],d[l+156>>2]=d[c+280>>2],d[l+160>>2]=e}b=1}return O=c+288|0,0|b}function Ie(e,t){var i,n=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=0,_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=0,F=y(0),B=y(0),N=y(0);if(O=i=O+-64|0,u[e+473|0]&&(h=d[e+532>>2],d[i+24>>2]=d[e+528>>2],d[i+28>>2]=h,h=d[e+524>>2],d[i+16>>2]=d[e+520>>2],d[i+20>>2]=h,s=m[e+576>>2],o=m[e+568>>2],a=m[e+572>>2],n=m[e+544>>2],l=m[e+536>>2],_=m[e+540>>2],p=m[e+624>>2],f=m[e+592>>2],g=m[e+608>>2],c=m[e+620>>2],v=m[e+588>>2],A=m[e+604>>2],T=m[e+616>>2],b=m[e+560>>2],E=m[e+584>>2],C=m[e+552>>2],R=m[e+600>>2],S=m[e+556>>2],d[i+60>>2]=0,P=y(y(y(E*l)+y(R*_))+y(T*n)),I=y(y(y(l*v)+y(_*A))+y(n*c)),F=y(I*y(0)),_=y(y(y(l*f)+y(_*g))+y(n*p)),B=y(_*y(0)),n=y(y(P+F)+B),M=y(y(y(f*C)+y(g*S))+y(p*b)),N=y(M*y(0)),D=y(y(y(E*C)+y(R*S))+y(T*b)),b=y(y(y(v*C)+y(A*S))+y(c*b)),C=y(b*y(0)),l=y(N+y(D+C)),p=y(y(y(f*o)+y(g*a))+y(p*s)),S=y(p*y(0)),f=y(y(y(E*o)+y(R*a))+y(T*s)),g=y(y(y(v*o)+y(A*a))+y(c*s)),c=y(g*y(0)),o=y(S+y(f+c)),s=y(y(1)/y(x(y(y(y(n*n)+y(l*l))+y(o*o))))),m[i+56>>2]=m[i+24>>2]+y(y(o*s)*y(10)),m[i+52>>2]=m[i+20>>2]+y(y(l*s)*y(10)),m[i+48>>2]=m[i+16>>2]+y(y(n*s)*y(10)),d[i+40>>2]=0,d[i+44>>2]=0,d[i+32>>2]=1065353216,d[i+36>>2]=0,r[d[d[t>>2]+8>>2]](t,i+16|0,i+48|0,i+32|0),d[i+60>>2]=0,l=y(P*y(0)),o=y(y(l+I)+B),v=y(D*y(0)),a=y(N+y(b+v)),A=y(f*y(0)),n=y(S+y(g+A)),s=y(y(1)/y(x(y(y(y(o*o)+y(a*a))+y(n*n))))),m[i+56>>2]=y(y(n*s)*y(10))+m[i+24>>2],m[i+52>>2]=y(y(a*s)*y(10))+m[i+20>>2],m[i+48>>2]=y(y(o*s)*y(10))+m[i+16>>2],d[i+40>>2]=0,d[i+44>>2]=0,d[i+32>>2]=0,d[i+36>>2]=1065353216,r[d[d[t>>2]+8>>2]](t,i+16|0,i+48|0,i+32|0),d[i+60>>2]=0,o=y(y(l+F)+_),a=y(M+y(v+C)),n=y(p+y(A+c)),s=y(y(1)/y(x(y(y(y(o*o)+y(a*a))+y(n*n))))),m[i+56>>2]=y(y(n*s)*y(10))+m[i+24>>2],m[i+52>>2]=y(y(a*s)*y(10))+m[i+20>>2],m[i+48>>2]=y(y(o*s)*y(10))+m[i+16>>2],d[i+40>>2]=1065353216,d[i+44>>2]=0,d[i+32>>2]=0,d[i+36>>2]=0,r[d[d[t>>2]+8>>2]](t,i+16|0,i+48|0,i+32|0),!(d[e+484>>2]<1)))for(;h=d[e+492>>2]+(w<<4)|0,a=m[h+8>>2],n=m[h>>2],l=m[h+4>>2],c=m[i+16>>2],o=m[i+20>>2],s=m[i+24>>2],d[i+8>>2]=1065353216,d[i+12>>2]=0,d[i>>2]=1065353216,d[i+4>>2]=0,d[i+60>>2]=0,s=y(s+y(y(y(f*n)+y(g*l))+y(p*a))),m[i+56>>2]=s,o=y(o+y(y(y(D*n)+y(b*l))+y(M*a))),m[i+52>>2]=o,a=y(c+y(y(y(P*n)+y(I*l))+y(_*a))),m[i+48>>2]=a+y(-.10000000149011612),d[i+44>>2]=0,n=y(s+y(0)),m[i+40>>2]=n,l=y(o+y(0)),m[i+36>>2]=l,m[i+32>>2]=a+y(.10000000149011612),r[d[d[t>>2]+8>>2]](t,i+48|0,i+32|0,i),d[i+60>>2]=0,m[i+56>>2]=s,m[i+52>>2]=o+y(-.10000000149011612),m[i+48>>2]=a,d[i+44>>2]=0,m[i+40>>2]=n,m[i+36>>2]=o+y(.10000000149011612),n=y(a+y(0)),m[i+32>>2]=n,r[d[d[t>>2]+8>>2]](t,i+48|0,i+32|0,i),d[i+60>>2]=0,m[i+56>>2]=s+y(-.10000000149011612),m[i+52>>2]=o,m[i+48>>2]=a,d[i+44>>2]=0,m[i+40>>2]=s+y(.10000000149011612),m[i+36>>2]=l,m[i+32>>2]=n,r[d[d[t>>2]+8>>2]](t,i+48|0,i+32|0,i),(0|(w=w+1|0))>2];);O=i- -64|0}function Me(){1&s[27952]||mc(27952)&&(d[6906]=1062847606,d[6907]=0,d[6904]=1042701022,d[6905]=1056964440,d[6902]=1062847606,d[6903]=0,d[6900]=-1093024784,d[6901]=1050556081,d[6898]=1062847606,d[6899]=0,d[6896]=-1093024784,d[6897]=-1096927567,d[6894]=1062847606,d[6895]=0,d[6892]=1042701022,d[6893]=-1090519208,d[6890]=1062847572,d[6891]=0,d[6888]=1057396286,d[6889]=0,d[6886]=1057396386,d[6887]=0,d[6884]=1060121912,d[6885]=1056964507,d[6882]=1057396420,d[6883]=0,d[6880]=-1098475836,d[6881]=1062148969,d[6878]=1057396386,d[6879]=0,d[6876]=-1084636143,d[6877]=0,d[6874]=1057396420,d[6875]=0,d[6872]=-1098475836,d[6873]=-1085334679,d[6870]=1057396386,d[6871]=0,d[6868]=1060121912,d[6869]=-1090519141,d[6866]=-2147483648,d[6867]=0,d[6864]=1058437413,d[6865]=1062149053,d[6862]=-2147483648,d[6863]=0,d[6860]=-2147483648,d[6861]=1065353216,d[6858]=-2147483648,d[6859]=0,d[6856]=-1089046235,d[6857]=1062149053,d[6854]=-2147483648,d[6855]=0,d[6852]=-1082951543,d[6853]=1050556148,d[6850]=-2147483648,d[6851]=0,d[6848]=-1082951543,d[6849]=-1096927500,d[6846]=0,d[6847]=0,d[6844]=-1089046235,d[6845]=-1085334595,d[6842]=0,d[6843]=0,d[6840]=0,d[6841]=-1082130432,d[6838]=0,d[6839]=0,d[6836]=1058437413,d[6837]=-1085334595,d[6834]=0,d[6835]=0,d[6832]=1064532105,d[6833]=-1096927500,d[6830]=0,d[6831]=0,d[6828]=1064532105,d[6829]=1050556148,d[6826]=-1090087228,d[6827]=0,d[6824]=1049007812,d[6825]=1062148969,d[6822]=-1090087262,d[6823]=0,d[6820]=-1087361736,d[6821]=1056964507,d[6818]=-1084636042,d[6819]=0,d[6816]=-1104782626,d[6817]=1056964440,d[6814]=-1090087262,d[6815]=0,d[6812]=-1087361736,d[6813]=-1090519141,d[6810]=-1084636076,d[6811]=0,d[6808]=-1090087362,d[6809]=-2147483648,d[6806]=-1090087262,d[6807]=0,d[6804]=1062847505,d[6805]=-2147483648,d[6802]=-1084636042,d[6803]=0,d[6800]=1054458864,d[6801]=1050556081,d[6798]=-1090087228,d[6799]=0,d[6796]=1049007812,d[6797]=-1085334679,d[6794]=-1084636042,d[6795]=0,d[6792]=-1104782626,d[6793]=-1090519208,d[6790]=-1084636042,d[6791]=0,d[6788]=1054458864,d[6789]=-1096927567,d[6786]=1065353216,d[6787]=0,d[6784]=-2147483648,d[6785]=0,d[6782]=1055193471,d[6783]=0,d[6780]=1063581978,d[6781]=0,d[6778]=1055193572,d[6779]=0,d[6776]=1049461434,d[6777]=1062847522,d[6774]=1055193572,d[6775]=0,d[6772]=-1086767520,d[6773]=1057396202,d[6770]=1055193572,d[6771]=0,d[6768]=-1086767520,d[6769]=-1090087446,d[6766]=1055193605,d[6767]=0,d[6764]=1049461434,d[6765]=-1084636126,d[6762]=-1092290076,d[6763]=0,d[6760]=1060716128,d[6761]=1057396202,d[6758]=-1092290043,d[6759]=0,d[6756]=-1098022214,d[6757]=1062847522,d[6754]=-1092290177,d[6755]=0,d[6752]=-1083901670,d[6753]=-2147483648,d[6750]=-1092290076,d[6751]=0,d[6748]=-1098022214,d[6749]=-1084636126,d[6746]=-1092290076,d[6747]=0,d[6744]=1060716128,d[6745]=-1090087446,d[6742]=-1082130432,d[6743]=0,d[6740]=0,d[6741]=-2147483648,uh(27952))}function De(){1&s[28992]||mc(28992)&&(d[7166]=1062847606,d[7167]=0,d[7164]=1042701022,d[7165]=1056964440,d[7162]=1062847606,d[7163]=0,d[7160]=-1093024784,d[7161]=1050556081,d[7158]=1062847606,d[7159]=0,d[7156]=-1093024784,d[7157]=-1096927567,d[7154]=1062847606,d[7155]=0,d[7152]=1042701022,d[7153]=-1090519208,d[7150]=1062847572,d[7151]=0,d[7148]=1057396286,d[7149]=0,d[7146]=1057396386,d[7147]=0,d[7144]=1060121912,d[7145]=1056964507,d[7142]=1057396420,d[7143]=0,d[7140]=-1098475836,d[7141]=1062148969,d[7138]=1057396386,d[7139]=0,d[7136]=-1084636143,d[7137]=0,d[7134]=1057396420,d[7135]=0,d[7132]=-1098475836,d[7133]=-1085334679,d[7130]=1057396386,d[7131]=0,d[7128]=1060121912,d[7129]=-1090519141,d[7126]=-2147483648,d[7127]=0,d[7124]=1058437413,d[7125]=1062149053,d[7122]=-2147483648,d[7123]=0,d[7120]=-2147483648,d[7121]=1065353216,d[7118]=-2147483648,d[7119]=0,d[7116]=-1089046235,d[7117]=1062149053,d[7114]=-2147483648,d[7115]=0,d[7112]=-1082951543,d[7113]=1050556148,d[7110]=-2147483648,d[7111]=0,d[7108]=-1082951543,d[7109]=-1096927500,d[7106]=0,d[7107]=0,d[7104]=-1089046235,d[7105]=-1085334595,d[7102]=0,d[7103]=0,d[7100]=0,d[7101]=-1082130432,d[7098]=0,d[7099]=0,d[7096]=1058437413,d[7097]=-1085334595,d[7094]=0,d[7095]=0,d[7092]=1064532105,d[7093]=-1096927500,d[7090]=0,d[7091]=0,d[7088]=1064532105,d[7089]=1050556148,d[7086]=-1090087228,d[7087]=0,d[7084]=1049007812,d[7085]=1062148969,d[7082]=-1090087262,d[7083]=0,d[7080]=-1087361736,d[7081]=1056964507,d[7078]=-1084636042,d[7079]=0,d[7076]=-1104782626,d[7077]=1056964440,d[7074]=-1090087262,d[7075]=0,d[7072]=-1087361736,d[7073]=-1090519141,d[7070]=-1084636076,d[7071]=0,d[7068]=-1090087362,d[7069]=-2147483648,d[7066]=-1090087262,d[7067]=0,d[7064]=1062847505,d[7065]=-2147483648,d[7062]=-1084636042,d[7063]=0,d[7060]=1054458864,d[7061]=1050556081,d[7058]=-1090087228,d[7059]=0,d[7056]=1049007812,d[7057]=-1085334679,d[7054]=-1084636042,d[7055]=0,d[7052]=-1104782626,d[7053]=-1090519208,d[7050]=-1084636042,d[7051]=0,d[7048]=1054458864,d[7049]=-1096927567,d[7046]=1065353216,d[7047]=0,d[7044]=-2147483648,d[7045]=0,d[7042]=1055193471,d[7043]=0,d[7040]=1063581978,d[7041]=0,d[7038]=1055193572,d[7039]=0,d[7036]=1049461434,d[7037]=1062847522,d[7034]=1055193572,d[7035]=0,d[7032]=-1086767520,d[7033]=1057396202,d[7030]=1055193572,d[7031]=0,d[7028]=-1086767520,d[7029]=-1090087446,d[7026]=1055193605,d[7027]=0,d[7024]=1049461434,d[7025]=-1084636126,d[7022]=-1092290076,d[7023]=0,d[7020]=1060716128,d[7021]=1057396202,d[7018]=-1092290043,d[7019]=0,d[7016]=-1098022214,d[7017]=1062847522,d[7014]=-1092290177,d[7015]=0,d[7012]=-1083901670,d[7013]=-2147483648,d[7010]=-1092290076,d[7011]=0,d[7008]=-1098022214,d[7009]=-1084636126,d[7006]=-1092290076,d[7007]=0,d[7004]=1060716128,d[7005]=-1090087446,d[7002]=-1082130432,d[7003]=0,d[7e3]=0,d[7001]=-2147483648,uh(28992))}function Oe(e,t,i,n,r){var s,o,a,l,c=y(0),h=0,_=y(0),u=y(0),p=0,f=0,g=0,b=0,A=y(0),C=y(0),S=y(0),T=y(0),E=0,R=y(0),P=0,I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=0,B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0);A=y(y(1)/m[e+20>>2]),h=(_=y(y(m[t>>2]*A)/y(3)))>2])/y(3)))>2])/y(3)))>>5&134215680^p<<16,R=c=u,u=y(y(1)-c),t=y(v(u))>>11)|0,P=F=d[e+12>>2],b=(t=t^o>>>5&134215680^t<<16)>>>11|0,R=c=_,_=y(y(1)-c),f=y(v(_))>>5&134215680^t<<16)+(65535&i)+(t>>>11)|0)^i>>>5&134215680^t<<16)>>>11|0)+t|0,t=((t^=t<<3)>>>5|0)+t|0,t=((t^=t<<4)>>>17|0)+t|0,l=((t^=t<<25)>>>6|0)+t|0,E=d[e+4>>2],t=d[(P=((l>>>0)%(E>>>0)<<2)+P|0)>>2],d[e+40>>2]=d[e+40>>2]+1,b=d[e+36>>2]+1|0,d[e+36>>2]=b,T=y(y(c-y(0|f))*y(3)),f=y(v(T))>2]|(0|s)!=d[t+256>>2]|(0|o)!=d[t+260>>2]|d[t+264>>2]!=(0|a))&&d[t+276>>2]==(0|i))break e;if(t=d[t+280>>2],b=b+1|0,d[e+36>>2]=b,!t)break}if(t=d[e+28>>2],d[e+28>>2]=t+1,(0|t)>=d[e+32>>2]){b=0,d[7689]=d[7689]+1;t:if(!((0|E)<1))for(;;){if(t=d[(h=(b<<2)+F|0)>>2],d[h>>2]=0,t)for(;h=d[t+280>>2],ve(t),t=h;);if((0|E)==(0|(b=b+1|0)))break t;F=d[e+12>>2]}d[e+36>>2]=1,d[e+40>>2]=1,d[e+28>>2]=0,d[e+20>>2]=1048576e3,d[e+24>>2]=0}h=Mn(t=ic(284),0,284),d[h+280>>2]=d[P>>2],d[P>>2]=h,d[h+272>>2]=l,d[h+276>>2]=i,d[h+264>>2]=a,d[h+260>>2]=o,d[h+256>>2]=s,pt(e,h)}return d[t+268>>2]=d[e+24>>2],M=m[(e=(h=(g<<6)+t|0)+(t=p<<4)|0)+(g=4+(p=f<<2)|0)>>2],D=m[e+p>>2],c=y(M-D),N=m[(e=(i=h- -64|0)+t|0)+g>>2],L=m[e+p>>2],_=y(c+y(C*y(y(N-L)-c))),O=m[(e=(t=t+16|0)+h|0)+g>>2],w=m[e+p>>2],c=y(O-w),k=m[(e=t+i|0)+g>>2],V=m[e+p>>2],R=c=y(_+y(I*y(y(c+y(C*y(y(k-V)-c)))-_))),G=y(c*c),U=y(L-D),A=y(V-w),c=y(U+y(I*y(A-U))),S=y(N-M),u=y(k-O),T=y(c+y(B*y(y(S+y(I*y(u-S)))-c))),c=y(w-D),_=y(c+y(C*y(y(V-L)-c))),c=y(O-M),_=y(_+y(B*y(y(c+y(C*y(y(k-N)-c)))-_))),c=y(y(1)/y(x(y(G+y(y(T*T)+y(_*_)))))),m[n+8>>2]=R*c,m[n+4>>2]=_*c,m[n>>2]=T*c,c=y(D+y(C*U)),_=y(c+y(I*y(y(w+y(C*A))-c))),c=y(M+y(C*S)),y(y(_+y(B*y(y(c+y(I*y(y(O+y(C*u))-c)))-_)))-r)}function we(e,t,i){var n=y(0),r=y(0),s=y(0),o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=0,A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=0,P=0,I=0,M=0,D=y(0);D=m[e+452>>2];e:if(E=m[e+304>>2],(!((T=m[e+300>>2])>y(0)^1)||E>y(0))&&!((0|(M=d[e+288>>2]))<4)&&(v=(R=d[e+760>>2])+b(i,44)|0,o=d[v+8>>2],g=m[o+40>>2],P=d[v+12>>2],I=d[v+16>>2],r=y(y(y(y(g+m[P+40>>2])+m[I+40>>2])*y(.3333333432674408))-m[t>>2]),c=m[o+44>>2],u=y(y(y(y(c+m[P+44>>2])+m[I+44>>2])*y(.3333333432674408))-m[t+4>>2]),p=m[o+48>>2],a=y(y(y(y(p+m[P+48>>2])+m[I+48>>2])*y(.3333333432674408))-m[t+8>>2]),(A=y(y(y(r*r)+y(u*u))+y(a*a)))>y(1.1920928955078125e-7))){l=m[d[e+684>>2]>>2],C=y(x(A)),n=y(y(1)/C),_=y(a*n),s=y(u*n),n=y(r*n),h=m[v+20>>2],f=m[v+28>>2],S=m[v+24>>2];t:switch(M+-4|0){case 1:for(c=y(y(y(r*h)+y(u*S))+y(a*f))>2]*y(.5)),l=y(p*y(y(A*y(y(T*y(.5))*c))*f)),S=y(l*y(-_)),A=y(l*y(-s)),T=y(l*y(-n)),g=y(0),h=y(0),l=y(0),p>y(0)&&(l=y(0),p>2])>y(0)&&(n=m[e+452>>2],r=y(y(c*s)*n),a=y(r*r),r=y(y(_*s)*n),s=y(y(p*s)*n),(s=y(a+y(y(r*r)+y(s*s))))>y(0)&&(n=m[o+40>>2],a=y(n*n),n=m[o+44>>2],a=y(a+y(n*n)),n=m[o+48>>2],s>=(n=y(a+y(n*n)))&&(s=y(y(y(x(n))/y(x(s)))*y(.800000011920929)),c=y(c*s),p=y(p*s),_=y(_*s))),m[o+56>>2]=l+y(_+m[o+56>>2]),m[(v=o- -64|0)>>2]=h+y(c+m[v>>2]),m[o+60>>2]=g+y(p+m[o+60>>2])),3==(0|(t=t+1|0)))break e;o=d[8+(i+(t<<2)|0)>>2]}case 0:case 2:break t;default:break e}if(C=a,a=y(y(y(r*h)+y(u*S))+y(a*f))y(0))for(t=b(i,44)+R|0,l=y(y(A*y(r*y(-m[t+36>>2])))*l),r=y(T*l),u=y(E*l),l=y(y(y(_*r)+y(y(f*u)+y(0)))*y(.3333333432674408)),_=y(y(y(n*r)+y(y(h*u)+y(0)))*y(.3333333432674408)),s=y(y(y(s*r)+y(y(a*u)+y(0)))*y(.3333333432674408)),n=y(y(1)/y(x(y(y(l*l)+y(y(_*_)+y(s*s)))))),r=y(l*n),u=y(s*n),a=y(_*n),e=0;;){if(n=y(D*m[o+88>>2]),h=y(l*n),C=y(h*h),h=y(_*n),f=y(h*h),h=y(s*n),y(C+y(f+y(h*h)))>y(y(y(g*g)+y(c*c))+y(p*p))?(n=y(y(1)/n),c=y(y(r*p)+y(y(a*g)+y(u*c))),m[o+56>>2]=m[o+56>>2]-y(n*y(a*c)),m[o+60>>2]=m[o+60>>2]-y(n*y(u*c)),m[(i=o- -64|0)>>2]=m[i>>2]-y(n*y(r*c))):(m[o+56>>2]=_+m[o+56>>2],m[o+60>>2]=s+m[o+60>>2],m[(i=o- -64|0)>>2]=l+m[i>>2]),3==(0|(e=e+1|0)))break e;o=d[8+(t+(e<<2)|0)>>2],g=m[o+40>>2],p=m[o+48>>2],c=m[o+44>>2]}}}function Fe(e,t,i){var n=0,o=0,a=0,l=0,c=y(0),h=0,_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=0;e:{if(u[e+165|0]){if(!(!i|(0|(n=d[e+88>>2]))<1))for(a=d[e+96>>2],p=m[e+168>>2],f=m[t+8>>2],g=m[t+4>>2],b=m[t>>2],i=0;;){if(c=y(m[(o=a+(i<<4)|0)>>2]-b),_=y(c*c),c=y(m[o+4>>2]-g),_=y(_+y(c*c)),c=y(m[o+8>>2]-f),y(_+y(c*c))<=p)break e;if(!((0|(i=i+1|0))<(0|n)))break}if(i=d[e+32>>2],d[i+12>>2]=d[i+12>>2]+1,d[e+92>>2]==(0|n)&&!((0|n)>=(0|(o=n?n<<1:1)))){if(o&&(d[7717]=d[7717]+1,l=0|r[d[6606]](o<<4,16),n=d[e+88>>2]),(0|n)>=1)for(i=0;h=(a=i<<4)+l|0,a=a+d[e+96>>2]|0,v=d[a+4>>2],d[h>>2]=d[a>>2],d[h+4>>2]=v,v=d[a+12>>2],d[h+8>>2]=d[a+8>>2],d[h+12>>2]=v,(0|n)!=(0|(i=i+1|0)););(i=d[e+96>>2])&&(u[e+100|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+96>>2]=0),d[e+96>>2]=l,d[e+92>>2]=o,s[e+100|0]=1,n=d[e+88>>2]}return i=d[e+96>>2]+(n<<4)|0,n=d[t+4>>2],d[i>>2]=d[t>>2],d[i+4>>2]=n,n=d[t+12>>2],d[i+8>>2]=d[t+8>>2],d[i+12>>2]=n,t=d[e+88>>2],d[e+88>>2]=t+1,d[d[e+32>>2]+16>>2]=d[e+96>>2],t}t:if(!(!i|(0|(n=d[e+108>>2]))<1)){for(a=d[e+116>>2],p=m[e+168>>2],f=m[t+8>>2],g=m[t+4>>2],b=m[t>>2],i=0;;){if(c=y(m[(o=a+(i<<2)|0)>>2]-b),_=y(c*c),c=y(m[o+4>>2]-g),_=y(_+y(c*c)),c=y(m[o+8>>2]-f),!(y(_+y(c*c))<=p)){if((0|(i=i+3|0))<(0|n))continue;break t}break}return(i>>>0)/3|0}if((0|(o=d[e+112>>2]))==(0|n))if((0|n)>=(0|(o=n?n<<1:1)))o=n;else{i=0,o&&(d[7717]=d[7717]+1,l=0|r[d[6606]](o<<2,16),n=d[e+108>>2]),a=d[e+116>>2];t:{i:{if((0|n)>=1)for(;;)if(d[(h=i<<2)+l>>2]=d[a+h>>2],(0|n)==(0|(i=i+1|0)))break i;if(!a)break t}u[e+120|0]&&(a&&(d[7718]=d[7718]+1,r[d[6607]](a)),n=d[e+108>>2]),d[e+116>>2]=0}d[e+116>>2]=l,d[e+112>>2]=o,s[e+120|0]=1}if(l=d[e+116>>2],d[l+(n<<2)>>2]=d[t>>2],i=n+1|0,d[e+108>>2]=i,(0|i)==(0|o))if((0|o)>=(0|(a=o?o<<1:1)))n=l,a=o;else{i=0,n=0,a&&(d[7717]=d[7717]+1,n=0|r[d[6606]](a<<2,16),o=d[e+108>>2],l=d[e+116>>2]);t:{i:{if((0|o)>=1)for(;;)if(d[(h=i<<2)+n>>2]=d[l+h>>2],(0|o)==(0|(i=i+1|0)))break i;if(!l)break t}u[e+120|0]&&(l&&(d[7718]=d[7718]+1,r[d[6607]](l)),o=d[e+108>>2]),d[e+116>>2]=0}d[e+116>>2]=n,d[e+112>>2]=a,s[e+120|0]=1}else n=l,a=o,o=i;if(d[(o<<2)+n>>2]=d[t+4>>2],i=o+1|0,d[e+108>>2]=i,(0|i)==(0|a))if((0|a)>=(0|(o=a?a<<1:1)))l=n;else{i=0,l=0,o&&(d[7717]=d[7717]+1,l=0|r[d[6606]](o<<2,16),a=d[e+108>>2],n=d[e+116>>2]);t:{i:{if((0|a)>=1)for(;;)if(d[(h=i<<2)+l>>2]=d[n+h>>2],(0|a)==(0|(i=i+1|0)))break i;if(!n)break t}u[e+120|0]&&(n&&(d[7718]=d[7718]+1,r[d[6607]](n)),a=d[e+108>>2]),d[e+116>>2]=0}d[e+116>>2]=l,d[e+112>>2]=o,s[e+120|0]=1}else l=n,a=i;d[(a<<2)+l>>2]=d[t+8>>2],t=a+1|0,d[e+108>>2]=t,e=d[e+32>>2],d[e+16>>2]=l,d[e+12>>2]=d[e+12>>2]+1,i=((0|t)/3|0)-1|0}return i}function Be(e,t,i){var n,r,s=0,o=0,a=0,l=y(0),c=y(0),h=y(0),f=0,g=0,b=y(0),v=y(0),A=y(0),C=0,S=0,x=y(0),T=0;if(O=n=O-32|0,r=d[e+56>>2],1!=(i-t|0)){if(S=function(e,t,i,n){var r,s=0,o=0,a=0,l=0,c=0,h=0,_=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=0,E=y(0),R=y(0),P=y(0),I=0;if(d[24+(r=O-96|0)>>2]=0,d[r+28>>2]=0,d[r+16>>2]=0,d[r+20>>2]=0,!(s=(0|i)<=(0|t))){for(T=u[e+60|0],h=t;T?(a=d[e+116>>2]+(h<<4)|0,A=m[e+44>>2],f=m[e+12>>2],g=y(y(y(p[a+4>>1])/A)+f),b=m[e+40>>2],E=m[e+8>>2],_=y(y(y(p[a+2>>1])/b)+E),R=m[e+36>>2],P=m[e+4>>2],v=y(y(y(p[a>>1])/R)+P),A=y(y(y(p[a+10>>1])/A)+f),f=y(y(y(p[a+8>>1])/b)+E),b=y(y(y(p[a+6>>1])/R)+P)):(a=d[e+76>>2]+(h<<6)|0,g=m[a+8>>2],_=m[a+4>>2],v=m[a>>2],A=m[a+24>>2],f=m[a+20>>2],b=m[a+16>>2]),C=y(y(y(A+g)*y(.5))+C),S=y(y(y(f+_)*y(.5))+S),x=y(y(y(b+v)*y(.5))+x),(0|(h=h+1|0))!=(0|i););m[r+24>>2]=C,m[r+20>>2]=S,m[r+16>>2]=x}if(T=i-t|0,_=y(y(1)/y(0|T)),m[r+24>>2]=_*C,m[r+20>>2]=_*S,m[r+16>>2]=_*x,a=t,!s)for(A=m[(n<<=2)+(r+16|0)>>2],I=n+r|0,a=h=t;(s=u[e+60|0])?(n=d[e+116>>2]+(h<<4)|0,_=m[e+44>>2],v=m[e+12>>2],C=y(y(y(p[n+4>>1])/_)+v),g=m[e+40>>2],f=m[e+8>>2],S=y(y(y(p[n+2>>1])/g)+f),b=m[e+36>>2],E=m[e+4>>2],x=y(y(y(p[n>>1])/b)+E),_=y(y(y(p[n+10>>1])/_)+v),v=y(y(y(p[n+8>>1])/g)+f),g=y(y(y(p[n+6>>1])/b)+E)):(n=d[e+76>>2]+(h<<6)|0,C=m[n+8>>2],S=m[n+4>>2],x=m[n>>2],_=m[n+24>>2],v=m[n+20>>2],g=m[n+16>>2]),d[r+12>>2]=0,m[r+8>>2]=y(_+C)*y(.5),m[r+4>>2]=y(v+S)*y(.5),m[r>>2]=y(g+x)*y(.5),m[I>>2]>A&&(s?(c=d[e+116>>2],l=d[4+(o=8+(n=s=c+(h<<4)|0)|0)>>2],d[r+40>>2]=d[o>>2],d[r+44>>2]=l,o=d[n+4>>2],d[r+32>>2]=d[n>>2],d[r+36>>2]=o,o=d[4+(s=(s=c)+(c=a<<4)|0)>>2],d[n>>2]=d[s>>2],d[n+4>>2]=o,o=d[s+12>>2],d[n+8>>2]=d[s+8>>2],d[n+12>>2]=o,n=c+d[e+116>>2]|0,c=d[r+36>>2],d[n>>2]=d[r+32>>2],d[n+4>>2]=c,s=d[r+44>>2],d[n+8>>2]=d[r+40>>2],d[n+12>>2]=s):(s=d[e+76>>2],o=d[4+(c=56+(n=s+(h<<6)|0)|0)>>2],d[r+88>>2]=d[c>>2],d[r+92>>2]=o,c=d[n+52>>2],d[r+80>>2]=d[n+48>>2],d[r+84>>2]=c,c=d[n+44>>2],d[r+72>>2]=d[n+40>>2],d[r+76>>2]=c,l=d[n+36>>2],d[(o=c=r- -64|0)>>2]=d[n+32>>2],d[o+4>>2]=l,o=d[n+28>>2],d[r+56>>2]=d[n+24>>2],d[r+60>>2]=o,o=d[n+20>>2],d[r+48>>2]=d[n+16>>2],d[r+52>>2]=o,o=d[n+12>>2],d[r+40>>2]=d[n+8>>2],d[r+44>>2]=o,o=d[n+4>>2],d[r+32>>2]=d[n>>2],d[r+36>>2]=o,l=d[4+(s=s+(o=a<<6)|0)>>2],d[n>>2]=d[s>>2],d[n+4>>2]=l,l=d[s+12>>2],d[n+8>>2]=d[s+8>>2],d[n+12>>2]=l,l=d[s+20>>2],d[n+16>>2]=d[s+16>>2],d[n+20>>2]=l,l=d[s+28>>2],d[n+24>>2]=d[s+24>>2],d[n+28>>2]=l,l=d[s+36>>2],d[n+32>>2]=d[s+32>>2],d[n+36>>2]=l,l=d[s+44>>2],d[n+40>>2]=d[s+40>>2],d[n+44>>2]=l,l=d[s+52>>2],d[n+48>>2]=d[s+48>>2],d[n+52>>2]=l,l=d[s+60>>2],d[n+56>>2]=d[s+56>>2],d[n+60>>2]=l,n=d[e+76>>2]+o|0,o=d[r+36>>2],d[n>>2]=d[r+32>>2],d[n+4>>2]=o,s=d[r+44>>2],d[n+8>>2]=d[r+40>>2],d[n+12>>2]=s,s=d[r+52>>2],d[n+16>>2]=d[r+48>>2],d[n+20>>2]=s,s=d[r+60>>2],d[n+24>>2]=d[r+56>>2],d[n+28>>2]=s,s=d[c+4>>2],d[n+32>>2]=d[c>>2],d[n+36>>2]=s,s=d[r+76>>2],d[n+40>>2]=d[r+72>>2],d[n+44>>2]=s,s=d[r+84>>2],d[n+48>>2]=d[r+80>>2],d[n+52>>2]=s,s=d[r+92>>2],d[n+56>>2]=d[r+88>>2],d[n+60>>2]=s),a=a+1|0),(0|(h=h+1|0))!=(0|i););return n=e=(T>>1)+t|0,(0|a)<=((e=(0|T)/3|0)+t|0)||(0|a)>=((-1^e)+i|0)?n:a}(e,t,i,function(e,t,i){var n,r=0,s=y(0),o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=0,R=y(0);n=i-t|0;e:{t:{if((0|i)<=(0|t))_=y(0|n);else{for(E=u[e+60|0],r=t;E?(o=d[e+116>>2]+(r<<4)|0,c=m[e+44>>2],h=m[e+12>>2],s=y(y(y(p[o+4>>1])/c)+h),_=m[e+40>>2],g=m[e+8>>2],f=y(y(y(p[o+2>>1])/_)+g),C=m[e+36>>2],S=m[e+4>>2],v=y(y(y(p[o>>1])/C)+S),c=y(y(y(p[o+10>>1])/c)+h),h=y(y(y(p[o+8>>1])/_)+g),_=y(y(y(p[o+6>>1])/C)+S)):(o=d[e+76>>2]+(r<<6)|0,s=m[o+8>>2],f=m[o+4>>2],v=m[o>>2],c=m[o+24>>2],h=m[o+20>>2],_=m[o+16>>2]),a=y(a+y(y(c+s)*y(.5))),l=y(l+y(y(h+f)*y(.5))),A=y(A+y(y(_+v)*y(.5))),(0|(r=r+1|0))!=(0|i););if(_=y(0|n),s=y(0),(0|i)>(0|t))break t}a=y(0),l=y(0);break e}for(s=y(y(1)/_),C=y(s*a),S=y(s*l),R=y(s*A),l=y(0),o=u[e+60|0],a=y(0),s=y(0);o?(r=d[e+116>>2]+(t<<4)|0,c=m[e+44>>2],h=m[e+12>>2],A=y(y(y(p[r+4>>1])/c)+h),g=m[e+40>>2],b=m[e+8>>2],f=y(y(y(p[r+2>>1])/g)+b),x=m[e+36>>2],T=m[e+4>>2],v=y(y(y(p[r>>1])/x)+T),c=y(y(y(p[r+10>>1])/c)+h),h=y(y(y(p[r+8>>1])/g)+b),g=y(y(y(p[r+6>>1])/x)+T)):(r=d[e+76>>2]+(t<<6)|0,A=m[r+8>>2],f=m[r+4>>2],v=m[r>>2],c=m[r+24>>2],h=m[r+20>>2],g=m[r+16>>2]),b=l,l=y(y(y(c+A)*y(.5))-C),l=y(b+y(l*l)),b=a,a=y(y(y(h+f)*y(.5))-S),a=y(b+y(a*a)),b=s,s=y(y(y(g+v)*y(.5))-R),s=y(b+y(s*s)),(0|i)!=(0|(t=t+1|0)););}return f=y(y(1)/y(_+y(-1))),a=y(f*a),l=y(f*l),(s=y(f*s))>2],u[e+60|0]?(c=m[e+40>>2],h=m[e+8>>2],b=m[e+24>>2],v=m[e+44>>2],A=m[e+12>>2],x=m[e+28>>2],s=o=d[e+136>>2]+(g<<4)|0,a=(l=y(y(m[e+20>>2]-m[e+4>>2])*m[e+36>>2]))=y(0)?~~l>>>0:0,_[s>>1]=65534&a,s=o,a=(l=y(y(x-A)*v))=y(0)?~~l>>>0:0,_[s+4>>1]=65534&a,s=(l=y(y(b-h)*c))=y(0)?~~l>>>0:0,_[o+2>>1]=65534&s):(f=d[e+24>>2],o=d[e+96>>2]+(g<<6)|0,d[o>>2]=d[e+20>>2],d[o+4>>2]=f,s=d[e+32>>2],d[o+8>>2]=d[e+28>>2],d[o+12>>2]=s),o=d[e+56>>2],u[e+60|0]?(b=m[e+40>>2],l=m[e+8>>2],v=m[e+44>>2],c=m[e+12>>2],s=o=d[e+136>>2]+(o<<4)|0,h=m[e+4>>2],a=(h=y(y(y(h-h)*m[e+36>>2])+y(1)))=y(0)?~~h>>>0:0,_[s+6>>1]=1|a,s=o,a=(c=y(y(y(c-c)*v)+y(1)))=y(0)?~~c>>>0:0,_[s+10>>1]=1|a,s=(l=y(y(y(l-l)*b)+y(1)))=y(0)?~~l>>>0:0,_[o+8>>1]=1|s):(f=d[e+8>>2],o=d[e+96>>2]+(o<<6)|0,d[o+16>>2]=d[e+4>>2],d[o+20>>2]=f,s=d[e+16>>2],d[o+24>>2]=d[e+12>>2],d[o+28>>2]=s),f=d[e+56>>2],(0|i)>(0|t))for(o=t;u[e+60|0]?(s=d[e+116>>2]+(o<<4)|0,a=p[s+4>>1],C=p[s+2>>1],T=p[s>>1],l=m[e+44>>2],c=m[e+40>>2],h=m[e+36>>2],d[n+28>>2]=0,b=m[e+4>>2],m[n+16>>2]=y(y(T>>>0)/h)+b,v=m[e+8>>2],m[n+20>>2]=y(y(C>>>0)/c)+v,A=m[e+12>>2],m[n+24>>2]=y(y(a>>>0)/l)+A,a=p[s+6>>1],C=p[s+8>>1],s=p[s+10>>1],d[n+12>>2]=0,m[n+8>>2]=A+y(y(s>>>0)/l),m[n+4>>2]=v+y(y(C>>>0)/c),m[n>>2]=b+y(y(a>>>0)/h)):(s=d[e+76>>2]+(o<<6)|0,a=d[s+12>>2],d[n+24>>2]=d[s+8>>2],d[n+28>>2]=a,a=d[s+4>>2],d[n+16>>2]=d[s>>2],d[n+20>>2]=a,a=d[s+28>>2],d[n+8>>2]=d[s+24>>2],d[n+12>>2]=a,a=d[s+20>>2],d[n>>2]=d[s+16>>2],d[n+4>>2]=a),Qt(e,f,n+16|0,n),f=d[e+56>>2],(0|(o=o+1|0))!=(0|i););s=f+1|0,d[e+56>>2]=s,Be(e,t,S),f=d[e+56>>2],Be(e,S,i),!(o=u[e+60|0])|(0|(t=d[e+56>>2]-r|0))<129||(qe(e,s,f),o=u[e+60|0]),255&o?d[12+(d[e+136>>2]+(g<<4)|0)>>2]=0-t:d[32+(d[e+96>>2]+(g<<6)|0)>>2]=t}else u[e+60|0]?(t=d[e+116>>2]+(t<<4)|0,g=d[(s=t)+4>>2],i=d[e+136>>2]+(r<<4)|0,d[(o=i)>>2]=d[s>>2],d[o+4>>2]=g):(t=d[e+76>>2]+(t<<6)|0,g=d[(o=t)+4>>2],i=d[e+96>>2]+(r<<6)|0,d[(s=i)>>2]=d[o>>2],d[s+4>>2]=g,s=d[o+60>>2],d[i+56>>2]=d[o+56>>2],d[i+60>>2]=s,s=d[o+52>>2],d[i+48>>2]=d[o+48>>2],d[i+52>>2]=s,s=d[o+44>>2],d[i+40>>2]=d[o+40>>2],d[i+44>>2]=s,s=d[o+36>>2],d[i+32>>2]=d[o+32>>2],d[i+36>>2]=s,s=d[o+28>>2],d[i+24>>2]=d[o+24>>2],d[i+28>>2]=s,s=d[o+20>>2],d[i+16>>2]=d[o+16>>2],d[i+20>>2]=s),o=d[t+12>>2],d[i+8>>2]=d[t+8>>2],d[i+12>>2]=o,d[e+56>>2]=d[e+56>>2]+1;O=n+32|0}function Ne(e,t,i,n,s,o,a){var l,c=y(0),h=y(0),_=0,u=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=0,E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=0,F=0,B=0,N=0,L=0,k=0,V=0,U=0,G=0,j=0,W=0,z=0,H=0,X=0,Y=0,Q=0,q=0,K=0,Z=0;if(O=l=O-32|0,P=m[i+4>>2],I=m[n+4>>2],M=m[i>>2],D=m[n>>2],g=m[e+28>>2],E=m[e+12>>2],A=m[n+8>>2],C=m[i+8>>2],c=(c=y((A>2]))>2],w=(c=y(y((g=y(0)?~~c>>>0:0,b=m[e+24>>2],R=m[e+8>>2],c=(c=y((I>2]))>2],F=(c=y(y((b=y(0)?~~c>>>0:0,f=m[e+20>>2],v=m[e+4>>2],c=(c=y((D>2]))>2],B=(c=y(y((f=y(0)?~~c>>>0:0,c=y((C>2]),T=(c=y(y(y((g<(c=c=y(0)?~~c>>>0:0,c=y((P>2]),_=(c=y(y(y((b<(c=c=y(0)?~~c>>>0:0,c=y((M>2]),n=(c=y(y(y((f<(c=c=y(0)?~~c>>>0:0,0<(0|a))for(f=y(D-M),S=y(I-P),h=y(A-C),c=y(y(1)/y(x(y(y(y(f*f)+y(S*S))+y(h*h))))),u=y(h*c),g=y(h*u),h=y(f*c),c=y(S*c),S=y(g+y(y(f*h)+y(S*c))),U=65534&w,G=65534&F,j=65534&B,W=1|T,z=1|_,H=1|n,n=d[e+136>>2],X=((T=(v=u==y(0)?y(0xde0b6b000000000):y(y(1)/u))>2],_=0;e:{t:{i:{n:if(!(j>>>0>p[n+6>>1]||H>>>0<(V=p[n>>1])>>>0|U>>>0>p[n+10>>1]||W>>>0<(w=p[n+4>>1])>>>0|G>>>0>p[n+8>>1]||z>>>0<(F=p[n+2>>1])>>>0)){if(g=m[e+12>>2],b=m[e+44>>2],f=m[e+8>>2],u=m[e+40>>2],h=m[e+4>>2],c=m[e+36>>2],d[l+12>>2]=0,B=p[n+10>>1],T=p[n+8>>1],_=p[n+6>>1],d[l+28>>2]=0,m[l>>2]=y(h+y(y(V>>>0)/c))-m[o>>2],m[l+4>>2]=y(f+y(y(F>>>0)/u))-m[o+4>>2],m[l+8>>2]=y(g+y(y(w>>>0)/b))-m[o+8>>2],m[l+16>>2]=y(h+y(y(_>>>0)/c))-m[s>>2],m[l+20>>2]=y(f+y(y(T>>>0)/u))-m[s+4>>2],m[l+24>>2]=y(g+y(y(B>>>0)/b))-m[s+8>>2],h=m[i+4>>2],g=y(A*y(m[Y>>2]-h)),c=m[i>>2],!(g>(u=y(C*y(m[Z>>2]-c)))||(b=y(C*y(m[K>>2]-c)))>(h=y(A*y(m[q>>2]-h)))||(c=m[i+8>>2],(f=y(v*y(m[X>>2]-c)))>(u=hb?g:b)>(c=y(v*y(m[Q>>2]-c)))))){if(!(_=(f>h?f:h)y(0))|(0|k)<0)break n;_=d[n+12>>2],r[d[d[t>>2]+8>>2]](t,_>>21,2097151&_);break i}_=0}if(!((0|k)>-1||_))break t}N=N+1|0,n=n+16|0;break e}N=N-(_=d[n+12>>2])|0,n=n-(_<<4)|0}if(L=L+1|0,!((0|N)<(0|a)))break}d[7309]<(0|L)&&(d[7309]=L),O=l+32|0}function Le(e,t,i){var n,r,s,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0;for(n=t+12|0,r=i+12|0,s=d[e+12>>2];;){e=u+2|0,o=d[(((255&(u=u+1|0))>>>0)%3<<2)+t>>2],c=d[i+4>>2];e:{t:if((0|(a=d[(((255&e)>>>0)%3<<2)+t>>2]))!=(0|(h=d[i>>2]))||(e=2,(0|o)!=(0|c))){if((0|o)!=(0|h)||(l=2,(0|a)!=(0|c))){if(_=d[i+8>>2],(0|a)==(0|c)&&(e=0,(0|o)==(0|_)))break t;if((0|o)!=(0|c)||(l=0,(0|a)!=(0|_))){if((0|a)==(0|_)&&(e=1,(0|o)==(0|h)))break t;if(e=26440,(0|o)!=(0|_))break e;if(l=1,(0|a)!=(0|h))break e}}e=(l<<2)+r|0;break e}e=(e<<2)+r|0}l=d[t+4>>2],p=d[e>>2];e:{t:if((0|(h=d[t>>2]))!=(0|o)||(e=2,(0|a)!=(0|l))){if((0|a)!=(0|h)||(e=2,(0|o)!=(0|l))){if(_=d[t+8>>2],(0|o)==(0|l)&&(e=0,(0|a)==(0|_)))break t;if((0|a)!=(0|l)||(e=0,(0|o)!=(0|_))){if((0|o)==(0|_)&&(e=1,(0|a)==(0|h)))break t;if(c=26440,(0|a)!=(0|_))break e;if(e=1,(0|o)!=(0|h))break e}}c=(e<<2)+n|0;break e}c=(e<<2)+n|0}l=2,c=d[(d[c>>2]<<2)+s>>2],e=d[c+4>>2];e:{t:if(h=d[c>>2],(0|e)!=(0|o)||(0|h)!=(0|a)){if((0|e)!=(0|a)||(0|o)!=(0|h)){if(_=d[c+8>>2],(0|e)==(0|a)&&(l=0,(0|o)==(0|_)))break t;if((0|e)!=(0|o)||(l=0,(0|a)!=(0|_))){if((0|a)==(0|_)&&(l=1,(0|o)==(0|h)))break t;if(e=26440,(0|o)!=(0|_))break e;if(l=1,(0|a)!=(0|h))break e}}e=12+(c+(l<<2)|0)|0;break e}e=12+(c+(l<<2)|0)|0}d[e>>2]=p,c=d[t+4>>2];e:{t:if((0|(h=d[t>>2]))!=(0|o)||(e=2,(0|a)!=(0|c))){if((0|a)!=(0|h)||(l=2,(0|o)!=(0|c))){if(_=d[t+8>>2],(0|o)==(0|c)&&(e=0,(0|a)==(0|_)))break t;if((0|a)!=(0|c)||(l=0,(0|o)!=(0|_))){if((0|o)==(0|_)&&(e=1,(0|a)==(0|h)))break t;if(e=26440,(0|a)!=(0|_))break e;if(l=1,(0|o)!=(0|h))break e}}e=(l<<2)+n|0;break e}e=(e<<2)+n|0}l=d[i+4>>2],p=d[e>>2];e:{t:if((0|(h=d[i>>2]))!=(0|a)||(e=2,(0|o)!=(0|l))){if((0|o)!=(0|h)||(e=2,(0|a)!=(0|l))){if(_=d[i+8>>2],(0|a)==(0|l)&&(e=0,(0|o)==(0|_)))break t;if((0|o)!=(0|l)||(e=0,(0|a)!=(0|_))){if((0|a)==(0|_)&&(e=1,(0|o)==(0|h)))break t;if(c=26440,(0|o)!=(0|_))break e;if(e=1,(0|a)!=(0|h))break e}}c=(e<<2)+r|0;break e}c=(e<<2)+r|0}l=2,c=d[(d[c>>2]<<2)+s>>2],e=d[c+4>>2];e:{t:if(h=d[c>>2],(0|e)!=(0|a)||(0|h)!=(0|o)){if((0|e)!=(0|o)||(0|a)!=(0|h)){if(_=d[c+8>>2],(0|e)==(0|o)&&(l=0,(0|a)==(0|_)))break t;if((0|e)!=(0|a)||(l=0,(0|o)!=(0|_))){if((0|o)==(0|_)&&(l=1,(0|a)==(0|h)))break t;if(e=26440,(0|a)!=(0|_))break e;if(l=1,(0|o)!=(0|h))break e}}e=12+(c+(l<<2)|0)|0;break e}e=12+(c+(l<<2)|0)|0}if(d[e>>2]=p,3==(0|u))break}}function ke(e,t){var i,n=0,o=0,a=y(0),l=y(0),c=0,h=0,_=0,p=y(0),f=y(0),g=y(0),v=0,A=0,C=0,S=0,x=0;if(O=i=O-96|0,n=d[e+12>>2],r[d[d[n>>2]+8>>2]](n,d[e+8>>2]+4|0,i+80|0,i- -64|0),n=d[t+68>>2],r[d[d[n>>2]+16>>2]](n,d[d[e+8>>2]+188>>2],i+80|0,i- -64|0,d[t+24>>2]),n=d[t+24>>2],r[d[d[n>>2]+32>>2]](n,d[d[e+8>>2]+284>>2],t+28|0,n),t=d[e+8>>2],n=d[t+56>>2],d[e+92>>2]=d[t+52>>2],d[e+96>>2]=n,n=d[t+64>>2],d[e+100>>2]=d[t+60>>2],d[e+104>>2]=n,t=d[t+284>>2],(0|r[d[d[t>>2]+36>>2]](t))>=1)for(A=e+128|0;;){if((0|(t=d[e+132>>2]))<=-1)for(d[e+136>>2]<=-1&&((n=d[e+140>>2])&&(u[e+144|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+140>>2]=0),s[e+144|0]=1,d[e+136>>2]=0,d[e+140>>2]=0);d[d[e+140>>2]+(t<<2)>>2]=0,o=(n=t+1|0)>>>0>=t>>>0,t=n,o;);if(d[e+132>>2]=0,t=d[d[e+8>>2]+284>>2],t=d[12+(0|r[d[d[t>>2]+28>>2]](t))>>2]+(h<<4)|0,n=d[d[t+4>>2]>>2],o=d[d[t>>2]>>2],!((4&u[o+204|0]?o:0)|(4&u[n+204|0]?n:0)||((t=d[t+8>>2])&&r[d[d[t>>2]+16>>2]](t,A),(0|(v=d[e+132>>2]))<1)))for(C=d[e+8>>2],S=d[e+140>>2],n=0;;){if(o=d[(n<<2)+S>>2],(0|(_=d[o+748>>2]))>0)for(a=d[o+740>>2]==(0|C)?y(-1):y(1),c=0;t=o+b(c,184)|0,(l=m[t+84>>2])>2],f=m[t+72>>2],g=m[t+76>>2],d[e+164>>2]=0,m[e+160>>2]=a*g,m[e+156>>2]=a*f,m[e+152>>2]=a*p,_=d[o+748>>2],p=l),f=m[t+76>>2],g=m[t+72>>2],m[e+92>>2]=y(y(l*y(a*m[t+68>>2]))*y(.20000000298023224))+m[e+92>>2],m[e+96>>2]=y(y(l*y(a*g))*y(.20000000298023224))+m[e+96>>2],m[e+100>>2]=y(y(l*y(a*f))*y(.20000000298023224))+m[e+100>>2],x=1),(0|(c=c+1|0))<(0|_););if((0|v)==(0|(n=n+1|0)))break}if(h=h+1|0,t=d[d[e+8>>2]+284>>2],!((0|h)<(0|r[d[d[t>>2]+36>>2]](t))))break}return t=d[e+8>>2],n=d[t+16>>2],d[i+8>>2]=d[t+12>>2],d[i+12>>2]=n,n=d[t+8>>2],d[i>>2]=d[t+4>>2],d[i+4>>2]=n,n=d[t+32>>2],d[i+24>>2]=d[t+28>>2],d[i+28>>2]=n,n=d[t+24>>2],d[i+16>>2]=d[t+20>>2],d[i+20>>2]=n,n=d[t+48>>2],d[i+40>>2]=d[t+44>>2],d[i+44>>2]=n,n=d[t+40>>2],d[i+32>>2]=d[t+36>>2],d[i+36>>2]=n,n=d[e+104>>2],d[i+56>>2]=d[e+100>>2],d[i+60>>2]=n,n=d[e+96>>2],d[i+48>>2]=d[e+92>>2],d[i+52>>2]=n,d[t+260>>2]=d[t+260>>2]+1,e=d[i+12>>2],d[t+12>>2]=d[i+8>>2],d[t+16>>2]=e,e=d[i+4>>2],d[t+4>>2]=d[i>>2],d[t+8>>2]=e,e=d[i+28>>2],d[t+28>>2]=d[i+24>>2],d[t+32>>2]=e,e=d[i+20>>2],d[t+20>>2]=d[i+16>>2],d[t+24>>2]=e,e=d[i+36>>2],d[t+36>>2]=d[i+32>>2],d[t+40>>2]=e,e=d[i+44>>2],d[t+44>>2]=d[i+40>>2],d[t+48>>2]=e,e=d[i+52>>2],d[t+52>>2]=d[i+48>>2],d[t+56>>2]=e,e=d[i+60>>2],d[t+60>>2]=d[i+56>>2],d[t+64>>2]=e,O=i+96|0,x}function Ve(e,t,i){var n,s,o,a,l,c=0,h=0,_=0,u=0,p=0,f=0,m=0,g=0;n=d[t>>2],m=d[e+4>>2],o=Kn(e,i,s=d[t+4>>2],_=d[t+8>>2]),c=2,h=d[t+12>>2],a=m+2|0,d[o+20>>2]=a,l=m+1|0,d[o+16>>2]=l,d[o+12>>2]=h,p=d[d[e+12>>2]+(d[t+12>>2]<<2)>>2],h=d[p+4>>2];e:{t:if(f=d[p>>2],(0|h)!=(0|_)||(0|f)!=(0|s)){if((0|h)!=(0|s)||(0|_)!=(0|f)){if(u=d[p+8>>2],(0|h)==(0|s)&&(c=0,(0|_)==(0|u)))break t;if((0|h)!=(0|_)||(c=0,(0|u)!=(0|s))){if((0|u)==(0|s)&&(c=1,(0|_)==(0|f)))break t;if(h=26440,(0|_)!=(0|u))break e;if(c=1,(0|s)!=(0|f))break e}}h=12+(p+(c<<2)|0)|0;break e}h=12+(p+(c<<2)|0)|0}d[h>>2]=m,p=Kn(e,i,_,n),h=d[t+16>>2],d[p+20>>2]=m,d[p+16>>2]=a,d[p+12>>2]=h,h=2,u=d[d[e+12>>2]+(d[t+16>>2]<<2)>>2],c=d[u+4>>2];e:{t:if(g=d[u>>2],(0|c)!=(0|n)||(0|g)!=(0|_)){if((0|c)!=(0|_)||(0|n)!=(0|g)){if(f=d[u+8>>2],(0|c)==(0|_)&&(h=0,(0|n)==(0|f)))break t;if((0|c)!=(0|n)||(h=0,(0|_)!=(0|f))){if((0|_)==(0|f)&&(h=1,(0|n)==(0|g)))break t;if(c=26440,(0|n)!=(0|f))break e;if(h=1,(0|_)!=(0|g))break e}}c=12+(u+(h<<2)|0)|0;break e}c=12+(u+(h<<2)|0)|0}d[c>>2]=l,_=Kn(e,i,n,s),h=d[t+20>>2],d[_+20>>2]=l,d[_+16>>2]=m,d[_+12>>2]=h,c=2,h=d[e+12>>2],m=d[h+(d[t+20>>2]<<2)>>2],u=d[m+4>>2];e:{t:if(g=d[m>>2],(0|u)!=(0|s)||(0|g)!=(0|n)){if((0|u)!=(0|n)||(0|s)!=(0|g)){if(f=d[m+8>>2],(0|u)==(0|n)&&(c=0,(0|s)==(0|f)))break t;if((0|u)!=(0|s)||(c=0,(0|n)!=(0|f))){if((0|n)==(0|f)&&(c=1,(0|s)==(0|g)))break t;if(u=26440,(0|s)!=(0|f))break e;if(c=1,(0|n)!=(0|g))break e}}u=12+(m+(c<<2)|0)|0;break e}u=12+(m+(c<<2)|0)|0}d[u>>2]=a,c=d[(d[o+12>>2]<<2)+h>>2],(d[c+8>>2]==(0|i)||d[c>>2]==(0|i)|d[c+4>>2]==(0|i))&&(Le(e,o,c),d[d[e+12>>2]+(d[o+24>>2]<<2)>>2]=0,o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[d[e+12>>2]+(d[c+24>>2]<<2)>>2]=0,c&&(d[7718]=d[7718]+1,r[d[6607]](c)),h=d[e+12>>2]),c=d[(d[p+12>>2]<<2)+h>>2],(d[c+8>>2]==(0|i)||d[c>>2]==(0|i)|d[c+4>>2]==(0|i))&&(Le(e,p,c),d[d[e+12>>2]+(d[p+24>>2]<<2)>>2]=0,p&&(d[7718]=d[7718]+1,r[d[6607]](p)),d[d[e+12>>2]+(d[c+24>>2]<<2)>>2]=0,c&&(d[7718]=d[7718]+1,r[d[6607]](c)),h=d[e+12>>2]),c=d[(d[_+12>>2]<<2)+h>>2],(d[c+8>>2]==(0|i)||d[c>>2]==(0|i)|d[c+4>>2]==(0|i))&&(Le(e,_,c),d[d[e+12>>2]+(d[_+24>>2]<<2)>>2]=0,_&&(d[7718]=d[7718]+1,r[d[6607]](_)),d[d[e+12>>2]+(d[c+24>>2]<<2)>>2]=0,c&&(d[7718]=d[7718]+1,r[d[6607]](c)),h=d[e+12>>2]),d[(d[t+24>>2]<<2)+h>>2]=0,t&&(d[7718]=d[7718]+1,r[d[6607]](t))}function Ue(e){e|=0;var t,i=0,n=y(0),s=0,o=0,a=0,l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=0,g=0,v=0;if(O=t=O-80|0,r[d[d[e>>2]+20>>2]](e)&&(i=0|r[d[d[e>>2]+20>>2]](e),8&r[d[d[i>>2]+48>>2]](i)&&(i=d[e+24>>2],a=0|r[d[d[i>>2]+36>>2]](i),d[t+72>>2]=0,d[t+76>>2]=0,d[t+64>>2]=1065353216,d[t+68>>2]=1065353216,!((0|a)<=0))))for(;;){if(i=0,o=d[e+24>>2],f=0|r[d[d[o>>2]+40>>2]](o,s),(0|(g=d[f+748>>2]))>0)for(;v=0|r[d[d[e>>2]+20>>2]](e),o=b(i,184)+f|0,r[d[d[v>>2]+32>>2]](v,o+36|0,o+68|0,m[o+84>>2],d[o+152>>2],t- -64|0),(0|g)!=(0|(i=i+1|0)););if((0|a)==(0|(s=s+1|0)))break}if(r[d[d[e>>2]+20>>2]](e)&&(i=0|r[d[d[e>>2]+20>>2]](e),!(!(3&r[d[d[i>>2]+48>>2]](i))|d[e+8>>2]<1)))for(a=0;;){if(s=d[d[e+16>>2]+(a<<2)>>2],!(32&u[s+204|0])){if(r[d[d[e>>2]+20>>2]](e)&&(i=0|r[d[d[e>>2]+20>>2]](e),1&r[d[d[i>>2]+48>>2]](i))){d[t+72>>2]=1065353216,d[t+76>>2]=0,d[t+64>>2]=1065353216,d[t+68>>2]=1065353216;e:{t:{switch(d[s+216>>2]+-1|0){case 0:i=1065353216,d[t+64>>2]=1065353216,o=1065353216;break e;case 1:d[t+64>>2]=0,i=1065353216,o=0;break e;case 2:d[t+64>>2]=0,i=1065353216,o=1065353216;break e;case 4:d[t+64>>2]=1065353216,i=1065353216;break t}d[t+64>>2]=1065353216,i=0}o=0}d[t+76>>2]=0,d[t+72>>2]=o,d[t+68>>2]=i,r[d[d[e>>2]+28>>2]](e,s+4|0,d[s+192>>2],t- -64|0)}(i=d[e+72>>2])&&2&r[d[d[i>>2]+48>>2]](i)&&(d[t+40>>2]=0,d[t+44>>2]=0,d[t+32>>2]=1065353216,d[t+36>>2]=0,i=d[s+192>>2],r[d[d[i>>2]+8>>2]](i,s+4|0,t- -64|0,t+48|0),n=m[6601],m[t+64>>2]=m[t+64>>2]-n,m[t+68>>2]=m[t+68>>2]-n,m[t+72>>2]=m[t+72>>2]-n,m[t+48>>2]=n+m[t+48>>2],m[t+52>>2]=n+m[t+52>>2],m[t+56>>2]=n+m[t+56>>2],3&u[s+204|0]|!u[e+44|0]|2!=d[s+236>>2]||(i=d[s+192>>2],r[d[d[i>>2]+8>>2]](i,s+68|0,t+16|0,t),l=y(m[t+16>>2]-n),m[t+16>>2]=l,c=y(m[t+20>>2]-n),m[t+20>>2]=c,h=y(m[t+24>>2]-n),m[t+24>>2]=h,_=y(n+m[t>>2]),m[t>>2]=_,p=y(n+m[t+4>>2]),m[t+4>>2]=p,n=y(n+m[t+8>>2]),m[t+8>>2]=n,l>2]&&(m[t+64>>2]=l),c>2]&&(m[t+68>>2]=c),h>2]&&(m[t+72>>2]=h),(l=m[t+28>>2])>2]&&(m[t+76>>2]=l),m[t+48>>2]<_&&(m[t+48>>2]=_),m[t+52>>2]>2]=p),m[t+56>>2]>2]=n),n=m[t+12>>2],m[t+60>>2]>2]=n)),i=d[e+72>>2],r[d[d[i>>2]+52>>2]](i,t- -64|0,t+48|0,t+32|0))}if(!((0|(a=a+1|0))>2]))break}O=t+80|0}function Ge(e,t,i,n,r,s){var o,a,h,_,u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=0,M=y(0),D=0,O=0,w=0,F=y(0),B=y(0),N=y(0),L=y(0),k=y(0);d[t+48>>2]=-2147483648,d[t+52>>2]=-2147483648,d[t+16>>2]=0,d[t+20>>2]=0,d[t+56>>2]=-2147483648,d[t+60>>2]=0,d[t+24>>2]=0,d[t+28>>2]=0,a=d[e+16>>2],e=d[240+(a+b(n,244)|0)>>2],o=d[240+(b(r,244)+a|0)>>2],d[t+148>>2]=r,d[t+144>>2]=n,h=d[s+88>>2],d[t+132>>2]=0,d[t+104>>2]=h,d[t+96>>2]=0,d[t+100>>2]=0,u=m[i>>2],R=m[i+4>>2],f=m[i+8>>2],d[t+12>>2]=0,m[t+8>>2]=-f,p=y(-R),m[t+4>>2]=p,P=y(-u),m[t>>2]=P,s=0,_=t,e?(l(y(y(y(y(m[e+300>>2]*p)-y(u*m[e+296>>2]))-y(f*m[e+304>>2]))*m[e+552>>2])),D=c(0),l(y(y(y(y(m[e+284>>2]*p)-y(u*m[e+280>>2]))-y(f*m[e+288>>2]))*m[e+548>>2])),O=c(0),l(y(y(y(y(m[e+268>>2]*p)-y(u*m[e+264>>2]))-y(f*m[e+272>>2]))*m[e+544>>2])),I=c(0)):I=0,d[_+64>>2]=I,d[t+76>>2]=0,d[t+72>>2]=D,d[t+68>>2]=O,g=m[i>>2],v=m[i+4>>2],A=m[i+8>>2],d[t+44>>2]=d[i+12>>2],m[t+40>>2]=A,m[t+36>>2]=v,m[t+32>>2]=g,i=0,o&&(l(y(y(y(y(g*m[o+296>>2])+y(v*m[o+300>>2]))+y(A*m[o+304>>2]))*m[o+552>>2])),s=c(0),l(y(y(y(y(g*m[o+264>>2])+y(v*m[o+268>>2]))+y(A*m[o+272>>2]))*m[o+544>>2])),w=c(0),l(y(y(y(y(g*m[o+280>>2])+y(v*m[o+284>>2]))+y(A*m[o+288>>2]))*m[o+548>>2])),i=c(0)),d[t+80>>2]=w,d[t+92>>2]=0,d[t+88>>2]=s,d[t+84>>2]=i,i=t,e?(S=y(y(y(m[e+268>>2]*p)-y(u*m[e+264>>2]))-y(f*m[e+272>>2])),x=y(y(y(m[e+300>>2]*p)-y(u*m[e+296>>2]))-y(f*m[e+304>>2])),C=y(y(y(m[e+284>>2]*p)-y(u*m[e+280>>2]))-y(f*m[e+288>>2]))):C=y(0),p=y(y(y(y(C*p)-y(u*S))-y(f*x))+y(0)),o?(T=y(y(y(g*m[o+296>>2])+y(v*m[o+300>>2]))+y(A*m[o+304>>2])),E=y(y(y(g*m[o+280>>2])+y(v*m[o+284>>2]))+y(A*m[o+288>>2])),u=y(y(y(m[o+264>>2]*g)+y(m[o+268>>2]*v))+y(m[o+272>>2]*A))):u=y(0),C=y(y(1)/y(p+y(y(y(u*g)+y(E*v))+y(T*A)))),m[i+108>>2]=C,u=y(0),p=y(0),S=y(0),x=y(0),e&&(e=b(n,244)+a|0,u=y(y(m[e+176>>2]+m[e+208>>2])*y(0)),F=y(y(m[e+184>>2]+m[e+216>>2])*y(0)),x=m[e+192>>2],S=m[e+200>>2],B=m[e+196>>2],p=y(y(m[e+180>>2]+m[e+212>>2])*y(0))),o?(e=b(r,244)+a|0,T=y(y(m[e+176>>2]+m[e+208>>2])*y(-0)),N=m[e+192>>2],L=m[e+200>>2],k=m[e+196>>2],M=y(y(m[e+180>>2]+m[e+212>>2])*y(-0)),E=y(y(m[e+184>>2]+m[e+216>>2])*y(-0))):(T=y(-0),M=y(-0),E=y(-0)),d[t+124>>2]=h,m[t+116>>2]=0,d[t+120>>2]=-2147483648^h,m[t+112>>2]=C*y(y(0)-y(y(y(y(u+p)+F)+y(y(y(x*P)-y(R*B))-y(f*S)))+y(y(y(T+M)+E)+y(y(A*L)+y(y(v*k)+y(g*N))))))}function je(e,t){var i,n=0,s=0,o=y(0),a=y(0),l=y(0),c=y(0),h=0,_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=0,E=y(0),R=y(0),P=y(0),I=y(0),M=y(0);if(O=i=O-32|0,n=d[e+192>>2],c=y(r[d[d[n>>2]+48>>2]](n)),(0|(h=d[e+712>>2]))>=1)for(T=e+928|0;_=m[t+48>>2],u=m[t+8>>2],p=m[t+4>>2],f=m[t>>2],g=m[t+52>>2],v=m[t+24>>2],A=m[t+20>>2],C=m[t+16>>2],o=m[t+56>>2],a=m[t+40>>2],l=m[t+36>>2],S=m[t+32>>2],n=d[e+720>>2]+b(s,104)|0,d[n+20>>2]=0,E=o,o=m[n+8>>2],R=l,l=m[n+12>>2],x=a,a=m[n+16>>2],S=y(E+y(y(y(S*o)+y(R*l))+y(x*a))),m[n+16>>2]=S,g=y(g+y(y(y(o*C)+y(l*A))+y(a*v))),m[n+12>>2]=g,_=y(_+y(y(y(o*f)+y(l*p))+y(a*u))),m[n+8>>2]=_,u=m[t+48>>2],p=m[t+8>>2],f=m[t>>2],v=m[t+4>>2],A=m[t+52>>2],C=m[t+24>>2],x=m[t+16>>2],P=m[t+20>>2],o=m[t+56>>2],a=m[t+40>>2],l=m[t+32>>2],I=m[t+36>>2],d[n+36>>2]=0,E=o,o=m[n+24>>2],M=y(l*o),l=m[n+28>>2],R=a,a=m[n+32>>2],m[n+32>>2]=E+y(y(M+y(I*l))+y(R*a)),m[n+28>>2]=A+y(y(y(o*x)+y(l*P))+y(a*C)),m[n+24>>2]=u+y(y(y(o*f)+y(l*v))+y(a*p)),o=m[n+80>>2],l=m[n+72>>2],a=m[n+76>>2],u=m[t+8>>2],p=m[t>>2],f=m[t+4>>2],v=m[t+24>>2],A=m[t+16>>2],C=m[t+20>>2],x=m[t+40>>2],P=m[t+32>>2],I=m[t+36>>2],d[n+84>>2]=0,m[n+80>>2]=y(y(l*P)+y(a*I))+y(o*x),m[n+76>>2]=y(y(l*A)+y(a*C))+y(o*v),m[n+72>>2]=y(y(p*l)+y(f*a))+y(u*o),d[i+28>>2]=0,m[i+24>>2]=c+S,m[i+20>>2]=c+g,m[i+16>>2]=c+_,d[i+12>>2]=0,m[i+8>>2]=S-c,m[i+4>>2]=g-c,m[i>>2]=_-c,Qr(T,d[n+96>>2],i),(0|h)!=(0|(s=s+1|0)););yi(e);e:if(n=d[e+928>>2]){if(s=d[e+192>>2],c=y(r[d[d[s>>2]+48>>2]](s)),o=m[n>>2],l=m[n+4>>2],a=m[n+8>>2],d[e+904>>2]=0,m[e+900>>2]=a-c,m[e+896>>2]=l-c,m[e+892>>2]=o-c,o=m[n+20>>2],l=m[n+24>>2],a=m[n+16>>2],d[e+920>>2]=0,m[e+916>>2]=c+l,m[e+912>>2]=c+o,m[(n=e+908|0)>>2]=c+a,!(s=d[e+188>>2]))break e;h=d[e+684>>2],T=d[h+32>>2],r[d[d[T>>2]+16>>2]](T,s,e+892|0,n,d[h+36>>2])}else d[e+892>>2]=0,d[e+896>>2]=0,d[e+916>>2]=0,d[e+920>>2]=0,d[e+908>>2]=0,d[e+912>>2]=0,d[e+900>>2]=0,d[e+904>>2]=0;Ir(e),s=d[t+12>>2],d[(n=e+1156|0)>>2]=d[t+8>>2],d[n+4>>2]=s,n=d[t+4>>2],d[e+1148>>2]=d[t>>2],d[e+1152>>2]=n,s=d[t+28>>2],d[(n=e+1172|0)>>2]=d[t+24>>2],d[n+4>>2]=s,s=d[t+20>>2],d[(n=e+1164|0)>>2]=d[t+16>>2],d[n+4>>2]=s,s=d[t+36>>2],d[(n=e+1180|0)>>2]=d[t+32>>2],d[n+4>>2]=s,s=d[t+44>>2],d[(n=e+1188|0)>>2]=d[t+40>>2],d[n+4>>2]=s,s=d[t+60>>2],d[(n=e+1204|0)>>2]=d[t+56>>2],d[n+4>>2]=s,n=d[t+52>>2],d[(e=e+1196|0)>>2]=d[t+48>>2],d[e+4>>2]=n,O=i+32|0}function We(e,t,i,n,r,s){var o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=0,C=0,S=0,x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=0,D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=0;if(O=o=O-96|0,d[o+92>>2]=n,d[o+88>>2]=i,d[o+84>>2]=t,d[o+80>>2]=e,a=m[n>>2],c=m[e>>2],l=m[n+4>>2],x=m[e+4>>2],u=m[n+8>>2],T=m[e+8>>2],d[o+44>>2]=0,p=y(T-u),m[o+40>>2]=p,f=y(x-l),m[o+36>>2]=f,b=y(c-a),m[o+32>>2]=b,E=m[t>>2],R=m[t+4>>2],w=m[t+8>>2],d[o+60>>2]=0,g=y(w-u),m[o+56>>2]=g,P=y(R-l),m[o+52>>2]=P,I=y(E-a),m[o+48>>2]=I,v=m[i>>2],h=m[i+4>>2],D=m[i+8>>2],d[o+76>>2]=0,F=y(D-u),m[o+72>>2]=F,B=y(h-l),m[o+68>>2]=B,N=y(v-a),m[o+64>>2]=N,_=y(-1),!((g=y(y(y(y(b*P)*F)+y(y(y(y(y(f*g)*N)+y(y(p*I)*B))-y(y(b*g)*B))-y(y(f*I)*F)))-y(y(p*P)*N)))==y(0)|g!=g)&&(P=y(x-R),I=y(E-v),E=y(c-E),R=y(R-h),v=y(T*y(y(P*I)-y(E*R))),h=c,c=y(T-w),T=y(w-D),y(g*y(v+y(y(h*y(y(c*R)-y(P*T)))+y(x*y(y(E*T)-y(c*I))))))<=y(0))){for(d[o+24>>2]=0,d[o+16>>2]=0,d[o+20>>2]=0,d[o+12>>2]=0;C=d[4396+(A=M<<2)>>2],c=m[8+(S=(o+32|0)+(C<<4)|0)>>2],x=m[S+4>>2],h=y(y(y(f*c)-y(p*x))*a),a=m[S>>2],y(g*y(y(h+y(l*y(y(p*a)-y(c*b))))+y(y(y(x*b)-y(f*a))*u)))>y(0)&&(S=C<<2,(a=tt(d[A+(o+80|0)>>2],d[S+(o+80|0)>>2],n,o+16|0,o+12|0))<_^1&&!(_>2],d[s>>2]=((L&C<<30>>31)+(C<<1&8)|0)+(0-(1&C)&1<>2]=d[o+16>>2],d[r+S>>2]=d[o+20>>2],d[(d[S+4396>>2]<<2)+r>>2]=0,d[r+12>>2]=d[o+24>>2],_=a)),3!=(0|(M=M+1|0));)b=m[(A=(o+32|0)+(M<<4)|0)>>2],p=m[A+8>>2],f=m[A+4>>2],u=m[n+8>>2],l=m[n+4>>2],a=m[n>>2];_>2]=15,_=m[i+4>>2],a=m[t+8>>2],l=m[n>>2],u=m[i+8>>2],p=m[t>>2],f=m[n+4>>2],v=y(y(y(_*a)*l)+y(y(u*p)*f)),h=a,a=m[i>>2],c=y(_*p),_=m[n+8>>2],c=y(y(v-y(f*y(h*a)))-y(c*_)),h=_,_=m[t+4>>2],_=y(y(y(c+y(h*y(a*_)))-y(l*y(u*_)))/g),m[r>>2]=_,a=m[e+4>>2],l=m[i+8>>2],u=m[n>>2],p=m[e+8>>2],f=m[i>>2],b=m[n+4>>2],v=y(y(y(a*l)*u)+y(y(p*f)*b)),h=l,l=m[e>>2],c=y(a*f),a=m[n+8>>2],c=y(y(v-y(b*y(h*l)))-y(c*a)),h=a,a=m[i+4>>2],a=y(y(y(c+y(h*y(l*a)))-y(u*y(p*a)))/g),m[r+4>>2]=a,l=m[t+4>>2],u=m[e+8>>2],p=m[n>>2],f=m[t+8>>2],b=m[e>>2],c=m[n+4>>2],D=y(y(y(l*u)*p)+y(y(f*b)*c)),h=u,u=m[t>>2],v=y(l*b),l=m[n+8>>2],c=y(y(D-y(c*y(h*u)))-y(v*l)),h=l,l=m[e+4>>2],g=y(y(y(c+y(h*y(u*l)))-y(p*y(f*l)))/g),m[r+8>>2]=g,m[r+12>>2]=y(1)-y(y(_+a)+g),_=y(0))}return O=o+96|0,_}function ze(e,t,i,n,r,o){Ao(e,6,t,i),d[e>>2]=18896,t=d[n+12>>2],d[e+56>>2]=d[n+8>>2],d[e+60>>2]=t,t=d[n+4>>2],d[e+48>>2]=d[n>>2],d[e+52>>2]=t,t=d[n+28>>2],d[e+72>>2]=d[n+24>>2],d[e+76>>2]=t,i=d[n+20>>2],d[(t=e- -64|0)>>2]=d[n+16>>2],d[t+4>>2]=i,t=d[n+44>>2],d[e+88>>2]=d[n+40>>2],d[e+92>>2]=t,t=d[n+36>>2],d[e+80>>2]=d[n+32>>2],d[e+84>>2]=t,t=d[n+60>>2],d[e+104>>2]=d[n+56>>2],d[e+108>>2]=t,t=d[n+52>>2],d[e+96>>2]=d[n+48>>2],d[e+100>>2]=t,t=d[r+12>>2],d[e+120>>2]=d[r+8>>2],d[e+124>>2]=t,t=d[r+4>>2],d[e+112>>2]=d[r>>2],d[e+116>>2]=t,t=d[r+20>>2],d[e+128>>2]=d[r+16>>2],d[e+132>>2]=t,t=d[r+28>>2],d[e+136>>2]=d[r+24>>2],d[e+140>>2]=t,t=d[r+36>>2],d[e+144>>2]=d[r+32>>2],d[e+148>>2]=t,t=d[r+44>>2],d[e+152>>2]=d[r+40>>2],d[e+156>>2]=t,t=d[r+52>>2],d[e+160>>2]=d[r+48>>2],d[e+164>>2]=t,t=d[r+60>>2],d[e+168>>2]=d[r+56>>2],d[e+172>>2]=t,d[e+680>>2]=0,d[e+684>>2]=0,d[e+688>>2]=0,d[e+692>>2]=0,d[e+696>>2]=0,d[e+700>>2]=0,d[e+704>>2]=0,d[e+708>>2]=0,d[e+712>>2]=0,d[e+716>>2]=0,d[e+720>>2]=0,d[e+724>>2]=0,d[e+740>>2]=0,d[e+744>>2]=0,d[e+748>>2]=0,d[e+752>>2]=0,d[e+756>>2]=1045220557,d[e+760>>2]=1045220557,d[e+764>>2]=1045220557,d[e+784>>2]=0,d[e+776>>2]=0,d[e+780>>2]=0,d[e+768>>2]=0,d[e+772>>2]=0,d[e+736>>2]=1056964608,d[e+728>>2]=1060320051,d[e+732>>2]=1065353216,s[e+790|0]=0,s[e+788|0]=0,s[e+789|0]=0,d[e+800>>2]=0,d[e+792>>2]=0,d[e+796>>2]=0,d[e+816>>2]=0,d[e+808>>2]=0,d[e+812>>2]=0,d[e+928>>2]=0,d[e+884>>2]=1133903872,d[e+876>>2]=0,d[e+880>>2]=1036831949,d[e+904>>2]=0,d[e+908>>2]=0,d[e+896>>2]=0,d[e+900>>2]=1045220557,d[e+868>>2]=1065353216,d[e+872>>2]=-1082130432,d[e+924>>2]=0,d[e+888>>2]=1065353216,d[e+892>>2]=1056964608,d[e+916>>2]=0,d[e+992>>2]=0,s[e+912|0]=0,d[e+948>>2]=1133903872,d[e+940>>2]=0,d[e+944>>2]=1036831949,d[e+968>>2]=0,d[e+972>>2]=0,d[e+960>>2]=0,d[e+964>>2]=1045220557,d[e+932>>2]=1065353216,d[e+936>>2]=-1082130432,d[e+988>>2]=0,d[e+952>>2]=1065353216,d[e+956>>2]=1056964608,d[e+980>>2]=0,d[e+1056>>2]=0,s[e+976|0]=0,d[e+1012>>2]=1133903872,d[e+1004>>2]=0,d[e+1008>>2]=1036831949,d[(t=e+1032|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1024|0)>>2]=0,d[t+4>>2]=1045220557,d[e+996>>2]=1065353216,d[e+1e3>>2]=-1082130432,d[e+1052>>2]=0,d[e+1016>>2]=1065353216,d[e+1020>>2]=1056964608,d[e+1044>>2]=0,s[e+1308|0]=0,d[e+1304>>2]=0,s[e+1301|0]=1,s[e+1300|0]=o,s[e+1040|0]=0,nt(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0)}function He(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0);O=n=O-144|0,d[n+108>>2]=0,o=m[t+80>>2],l=m[t+96>>2],g=m[t+120>>2],M=m[t+56>>2],T=m[t+112>>2],E=m[t+116>>2],D=m[t+52>>2],c=m[t+68>>2],b=m[t+84>>2],v=m[t+100>>2],a=m[t+20>>2],p=m[t+36>>2],A=m[t+72>>2],h=m[t+88>>2],f=m[t+24>>2],_=m[t+104>>2],C=m[t+40>>2],u=m[t+64>>2],S=m[t+32>>2],x=m[t>>2],R=m[t+16>>2],w=m[t+48>>2],P=m[t+4>>2],I=m[t+8>>2],d[n+100>>2]=0,d[n+84>>2]=0,d[n+68>>2]=0,m[n+80>>2]=y(y(I*A)+y(f*h))+y(C*_),m[n+76>>2]=y(y(P*A)+y(a*h))+y(p*_),m[n- -64>>2]=y(y(I*c)+y(f*b))+y(C*v),m[n+60>>2]=y(y(P*c)+y(a*b))+y(p*v),T=y(w-T),E=y(D-E),g=y(M-g),m[n+96>>2]=y(y(A*T)+y(h*E))+y(_*g),m[n+92>>2]=y(y(T*c)+y(E*b))+y(g*v),d[n+52>>2]=0,m[n+72>>2]=y(y(x*A)+y(R*h))+y(S*_),m[n+56>>2]=y(y(x*c)+y(R*b))+y(S*v),m[n+48>>2]=y(y(u*I)+y(o*f))+y(l*C),m[n+44>>2]=y(y(u*P)+y(o*a))+y(l*p),m[n+40>>2]=y(y(u*x)+y(o*R))+y(l*S),m[n+88>>2]=y(y(T*u)+y(E*o))+y(g*l),yt(e,n+88|0,n+128|0,n+112|0,n+108|0,m[e+12>>2])&&(s?(b=m[t+72>>2],v=m[t+64>>2],A=m[t+68>>2],h=m[t+88>>2],_=m[t+80>>2],u=m[t+84>>2],a=m[t+104>>2],p=m[t+96>>2],f=m[t+100>>2],o=m[n+120>>2],l=m[n+112>>2],c=m[n+116>>2],d[n+36>>2]=0,C=y(y(y(l*p)+y(c*f))+y(o*a)),m[n+32>>2]=-C,S=y(y(y(l*_)+y(c*u))+y(o*h)),m[n+28>>2]=-S,x=y(y(y(v*l)+y(A*c))+y(b*o)),m[n+24>>2]=-x,R=m[t+112>>2],P=m[t+116>>2],o=m[t+120>>2],d[n+20>>2]=0,l=m[n+128>>2],c=m[n+132>>2],g=a,a=m[n+136>>2],g=y(o+y(y(y(p*l)+y(f*c))+y(g*a))),o=m[n+108>>2],m[n+16>>2]=g+y(C*o),m[n+12>>2]=y(P+y(y(y(l*_)+y(c*u))+y(a*h)))+y(S*o),m[n+8>>2]=y(R+y(y(y(l*v)+y(c*A))+y(a*b)))+y(x*o),r[d[d[i>>2]+16>>2]](i,n+24|0,n+8|0,o)):(o=m[t+72>>2],l=m[t+64>>2],c=m[t+68>>2],b=m[t+88>>2],v=m[t+80>>2],A=m[t+84>>2],h=m[t+104>>2],_=m[t+96>>2],u=m[t+100>>2],d[n+36>>2]=0,a=m[n+112>>2],p=m[n+116>>2],f=m[n+120>>2],m[n+32>>2]=y(y(_*a)+y(u*p))+y(h*f),m[n+28>>2]=y(y(a*v)+y(p*A))+y(f*b),m[n+24>>2]=y(y(l*a)+y(c*p))+y(o*f),a=m[t+112>>2],p=m[t+116>>2],f=m[t+120>>2],d[n+20>>2]=0,g=_,_=m[n+128>>2],C=u,u=m[n+132>>2],S=h,h=m[n+136>>2],m[n+16>>2]=f+y(y(y(g*_)+y(C*u))+y(S*h)),m[n+12>>2]=p+y(y(y(_*v)+y(u*A))+y(h*b)),m[n+8>>2]=a+y(y(y(_*l)+y(u*c))+y(h*o)),r[d[d[i>>2]+16>>2]](i,n+24|0,n+8|0,m[n+108>>2]))),O=n+144|0}function Xe(e,t){var i=y(0),n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=0,S=y(0),T=y(0);b=d[t+12>>2],d[e+564>>2]=d[t+8>>2],d[e+568>>2]=b,b=d[t+4>>2],d[e+556>>2]=d[t>>2],d[e+560>>2]=b,c=y(-0),_=y(1),n=m[e+564>>2],i=m[e+568>>2],s=y(i*y(0)),o=m[e+556>>2],a=y(o*y(0)),r=y(y(n+s)-a),l=m[e+560>>2],h=y(y(s+a)-l),s=y(l*y(0)),a=y(n*y(0)),g=y(y(y(-o)-s)-a),s=y(y(i+s)-a),a=y(y(o*r)+y(y(y(i*h)-y(n*g))-y(l*s))),p=y(y(n*s)+y(y(y(i*r)-y(l*g))-y(o*h))),r=y(y(l*h)+y(y(y(i*s)-y(o*g))-y(n*r))),(h=y(y(a*y(0))+y(y(p*y(0))+r)))>2])>=y(.05000000074505806)&&(i=m[e+448>>2])>=y(.05000000074505806)&&(n=Ki(y(A(y(C(f,y(-1))),y(1)))),(n=y(n+n))>y(1.1920928955078125e-7)&&(s=y(y(1)/y(x(y(y(u*u)+y(y(c*c)+y(_*_)))))),a=y(u*s),p=y(c*s),s=y(_*s),y(v(s))>y(1.1920928955078125e-7)&&(T=y(y(a*a)/y(s*s)),o=y(x(y(y(T+y(1))/y(y(T/y(o*o))+y(y(1)/y(i*i)))))))),y(v(n))>y(1.1920928955078125e-7)&&(n>o?n=o:n<(i=y(-o))&&(n=i),i=y(n*y(.5)),n=y(An(i)/y(x(y(y(y(p*p)+y(s*s))+y(a*a))))),u=y(a*n),_=y(s*n),c=y(p*n),f=yn(i))),o=y(r*l),n=y(h*l),p=y(S*l),r=y(g*l),(h=m[e+452>>2])>=y(.05000000074505806)&&(l=r,a=p,s=n,i=Ki(y(A(y(C(o,y(-1))),y(1)))),(i=y(i+i))>y(3.1415927410125732)&&(s=y(-n),a=y(-p),l=y(-r),i=Ki(y(A(y(C(y(-o),y(-1))),y(1)))),i=y(i+i)),i>y(1.1920928955078125e-7)&&(g=y(y(1)/y(x(y(y(y(l*l)+y(a*a))+y(s*s))))),s=y(s*g),l=y(l*g),a=y(a*g)),y(v(i))>y(1.1920928955078125e-7)&&(i>h?i=h:i<(n=y(-h))&&(i=n),o=y(i*y(.5)),i=y(An(o)/y(x(y(y(s*s)+y(y(a*a)+y(l*l)))))),n=y(s*i),p=y(a*i),r=y(l*i),o=yn(o))),m[e+568>>2]=y(y(y(f*o)-y(c*r))-y(_*p))-y(u*n),m[e+564>>2]=y(y(c*p)+y(y(f*n)+y(u*o)))-y(_*r),m[e+560>>2]=y(y(u*r)+y(y(f*p)+y(_*o)))-y(c*n),m[e+556>>2]=y(y(_*n)+y(y(f*r)+y(c*o)))-y(u*p)}function Ye(e,t,i,n,s,o){var a,l=0,c=0,h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=0,S=0;if(O=a=O-272|0,c=d[(l=i)+12>>2],d[a+216>>2]=d[l+8>>2],d[a+220>>2]=c,c=d[l+4>>2],d[a+208>>2]=d[l>>2],d[a+212>>2]=c,c=d[l+28>>2],d[a+232>>2]=d[l+24>>2],d[a+236>>2]=c,c=d[l+20>>2],d[a+224>>2]=d[l+16>>2],d[a+228>>2]=c,c=d[l+44>>2],d[a+248>>2]=d[l+40>>2],d[a+252>>2]=c,c=d[l+36>>2],d[a+240>>2]=d[l+32>>2],d[a+244>>2]=c,c=d[l+60>>2],d[a+264>>2]=d[l+56>>2],d[a+268>>2]=c,c=d[l+52>>2],d[a+256>>2]=d[l+48>>2],d[a+260>>2]=c,c=d[(l=n)+12>>2],d[a+152>>2]=d[l+8>>2],d[a+156>>2]=c,c=d[l+4>>2],d[a+144>>2]=d[l>>2],d[a+148>>2]=c,c=d[l+28>>2],d[a+168>>2]=d[l+24>>2],d[a+172>>2]=c,c=d[l+20>>2],d[a+160>>2]=d[l+16>>2],d[a+164>>2]=c,c=d[l+44>>2],d[a+184>>2]=d[l+40>>2],d[a+188>>2]=c,c=d[l+36>>2],d[a+176>>2]=d[l+32>>2],d[a+180>>2]=c,c=d[l+60>>2],d[a+200>>2]=d[l+56>>2],d[a+204>>2]=c,c=d[l+52>>2],d[a+192>>2]=d[l+48>>2],d[a+196>>2]=c,d[a+108>>2]=0,m[a+104>>2]=m[a+200>>2]-m[a+264>>2],m[a+100>>2]=m[a+196>>2]-m[a+260>>2],m[a+96>>2]=m[a+192>>2]-m[a+256>>2],kt(a+208|0,a+144|0,a+16|0,a+128|0),d[a+92>>2]=0,h=m[a+128>>2],m[a+88>>2]=h*m[a+24>>2],m[a+84>>2]=h*m[a+20>>2],m[a+80>>2]=h*m[a+16>>2],d[a+72>>2]=0,d[a+76>>2]=0,d[(l=a- -64|0)>>2]=0,d[l+4>>2]=0,st(a+208|0,a+128|0),d[a+60>>2]=0,d[a+44>>2]=0,h=m[a+128>>2],_=m[a+132>>2],p=m[a+136>>2],b=m[a+140>>2],g=y(y(2)/y(y(y(y(h*h)+y(_*_))+y(p*p))+y(b*b))),v=y(p*g),u=y(_*v),f=y(h*g),A=y(b*f),m[a+52>>2]=u+A,m[a+40>>2]=u-A,u=y(h*f),f=_,_=y(_*g),g=y(f*_),m[a+56>>2]=y(1)-y(u+g),p=y(p*v),m[a+36>>2]=y(1)-y(u+p),d[a+28>>2]=0,u=y(h*v),f=y(b*_),m[a+48>>2]=u-f,h=y(h*_),_=y(b*v),m[a+32>>2]=h+_,m[a+24>>2]=u+f,m[a+20>>2]=h-_,m[a+16>>2]=y(1)-y(g+p),dn(t,a+16|0,a+96|0,a+80|0,a+128|0,a+112|0),d[e+268>>2]>=1)for(l=n+48|0,c=i+48|0,n=0;i=d[d[e+276>>2]+(n<<2)>>2],r[d[d[s>>2]+8>>2]](s,d[i+188>>2])&&(C=d[i+192>>2],S=i+4|0,r[d[d[C>>2]+8>>2]](C,S,a+16|0,a+96|0),d[a+28>>2]=0,d[a+108>>2]=0,m[a+24>>2]=m[a+24>>2]+m[a+136>>2],m[a+20>>2]=m[a+20>>2]+m[a+132>>2],m[a+16>>2]=m[a+16>>2]+m[a+128>>2],m[a+96>>2]=m[a+96>>2]+m[a+112>>2],m[a+100>>2]=m[a+100>>2]+m[a+116>>2],m[a+104>>2]=m[a+104>>2]+m[a+120>>2],d[a+12>>2]=1065353216,mt(c,l,a+16|0,a+96|0,a+12|0,a+80|0)&&Fa(t,a+208|0,a+144|0,i,d[i+192>>2],S,s,o)),(0|(n=n+1|0))>2];);O=a+272|0}function Qe(e,t,i,n,o,a,l,c,h,_){var u=0,p=0,f=y(0),g=y(0),v=0,A=y(0),C=y(0),S=0,x=y(0),T=0,E=0,R=y(0),P=y(0),I=y(0),M=0,D=y(0),O=0;if(!((0|a)<2|(0|l)<2)){for(R=y(a+-1|0),P=y(l+-1|0),d[7717]=d[7717]+1,v=b(a,l),S=0|r[d[6606]]((0|v)!=(268435455&v)?-1:v<<4,16),E=ic((0|v)!=(1073741823&v)?-1:v<<2);;){for(C=m[t+8>>2],f=y(y(0|u)/P),C=y(C+y(f*y(m[n+8>>2]-C))),x=m[i+8>>2],x=y(y(x+y(f*y(m[o+8>>2]-x)))-C),g=m[i+4>>2],A=y(g+y(f*y(m[o+4>>2]-g))),g=m[t+4>>2],g=y(g+y(f*y(m[n+4>>2]-g))),D=y(A-g),A=m[i>>2],I=y(A+y(f*y(m[o>>2]-A))),A=m[t>>2],A=y(A+y(f*y(m[n>>2]-A))),I=y(I-A),O=b(a,u),p=0;d[12+(T=S+((M=p+O|0)<<4)|0)>>2]=0,f=y(y(0|p)/R),m[T+8>>2]=C+y(x*f),m[T+4>>2]=g+y(D*f),m[T>>2]=A+y(I*f),d[E+(M<<2)>>2]=1065353216,(0|(p=p+1|0))!=(0|a););if((0|(u=u+1|0))==(0|l))break}for(d[7717]=d[7717]+1,u=Ce(0|r[d[6606]](1252,16),e,v,S,E),1&c&&(m[d[u+720>>2]+88>>2]=0,s[u+924|0]=1),2&c&&(m[88+(d[u+720>>2]+b(a+-1|0,104)|0)>>2]=0,s[u+924|0]=1),4&c&&(m[88+(d[u+720>>2]+b(b(l+-1|0,a),104)|0)>>2]=0,s[u+924|0]=1),8&c&&(m[88+(d[u+720>>2]+b((b(l+-1|0,a)+a|0)-1|0,104)|0)>>2]=0,s[u+924|0]=1),16&c&&(m[88+(d[u+720>>2]+b((a+-1|0)/2|0,104)|0)>>2]=0,s[u+924|0]=1),32&c&&(m[88+(d[u+720>>2]+b(b((l+-1|0)/2|0,a),104)|0)>>2]=0,s[u+924|0]=1),64&c&&(m[88+(d[u+720>>2]+b((b((l+-1|0)/2|0,a)+a|0)-1|0,104)|0)>>2]=0,s[u+924|0]=1),128&c&&(m[88+(d[u+720>>2]+b(b(l+-1|0,a)+((a+-1|0)/2|0)|0,104)|0)>>2]=0,s[u+924|0]=1),256&c&&(m[88+(d[u+720>>2]+b(b((l+-1|0)/2|0,a)+((a+-1|0)/2|0)|0,104)|0)>>2]=0,s[u+924|0]=1),S&&S&&(d[7718]=d[7718]+1,r[d[6607]](S)),ve(E),v=l+-1|0,R=y(y(1)/y(0|v)),P=y(y(1)/y(a+-1|0)),p=0,n=0;;){if(e=p+1|0,(0|a)>=1)for(S=b(e,a),E=b(a,p),f=y(R*y(v-p|0)),C=y(R*y(v+(-1^p)|0)),p=0;;){t=p,i=p+S|0,o=p+E|0;e:{t:{i:{if((0|(p=p+1|0))<(0|a)){if(Lh(u,o,T=p+E|0,0,0),(0|e)>=(0|l))break e;if(Lh(u,o,i,0,0),lr(u,o,i,c=p+S|0,0),!_)break i;i=(n<<2)+_|0,x=y(P*y(0|t)),m[i>>2]=x,m[i+20>>2]=C,g=y(P*y(0|p)),m[i+16>>2]=g,m[i+12>>2]=C,m[i+8>>2]=x,m[i+4>>2]=f,lr(u,c,T,o,0),m[i+44>>2]=f,m[i+40>>2]=x,m[i+36>>2]=f,m[i+32>>2]=g,m[i+28>>2]=C,m[i+24>>2]=g;break t}if((0|e)>=(0|l))break e;Lh(u,o,i,0,0);break e}lr(u,c,T,o,0)}h&&Lh(u,o,c,0,0),n=n+12|0}if((0|a)==(0|p))break}if((0|(p=e))==(0|l))break}}return u}function qe(e,t,i){var n,o,a,l,c=0,h=0,f=0,m=0,g=0,b=0,y=0,v=0;if(O=n=O-32|0,o=d[e+136>>2],a=(0|(c=d[12+(o+(i<<4)|0)>>2]))>-1?1:0-c|0,(0|(l=(0|(c=d[12+((t<<4)+o|0)>>2]))>-1?1:0-c|0))<=128){if((0|(c=f=d[e+152>>2]))==d[e+156>>2]&&!((0|(c=f))>=(0|(b=c?c<<1:1)))){if(b?(d[7717]=d[7717]+1,c=0|r[d[6606]](b<<5,16),m=d[e+152>>2]):(c=0,m=f),(0|m)>=1)for(;g=(h=y<<5)+c|0,h=h+d[e+160>>2]|0,v=d[h+4>>2],d[g>>2]=d[h>>2],d[g+4>>2]=v,v=d[h+28>>2],d[g+24>>2]=d[h+24>>2],d[g+28>>2]=v,v=d[h+20>>2],d[g+16>>2]=d[h+16>>2],d[g+20>>2]=v,v=d[h+12>>2],d[g+8>>2]=d[h+8>>2],d[g+12>>2]=v,(0|m)!=(0|(y=y+1|0)););(m=d[e+160>>2])&&(u[e+164|0]&&m&&(d[7718]=d[7718]+1,r[d[6607]](m)),d[e+160>>2]=0),d[e+160>>2]=c,d[e+156>>2]=b,s[e+164|0]=1,c=d[e+152>>2]}d[e+152>>2]=c+1,h=d[(c=n)+4>>2],f=(m=f<<5)+d[e+160>>2]|0,d[f>>2]=d[c>>2],d[f+4>>2]=h,h=d[c+28>>2],d[f+24>>2]=d[c+24>>2],d[f+28>>2]=h,h=d[c+20>>2],d[f+16>>2]=d[c+16>>2],d[f+20>>2]=h,h=d[c+12>>2],d[f+8>>2]=d[c+8>>2],d[f+12>>2]=h,c=m+d[e+160>>2]|0,f=(t<<4)+o|0,_[c>>1]=p[f>>1],_[c+2>>1]=p[f+2>>1],_[c+4>>1]=p[f+4>>1],_[c+6>>1]=p[f+6>>1],_[c+8>>1]=p[f+8>>1],f=p[f+10>>1],d[c+16>>2]=l,d[c+12>>2]=t,_[c+10>>1]=f}if((0|a)<=128){if((0|(c=f=d[e+152>>2]))==d[e+156>>2]&&!((0|(c=f))>=(0|(g=c?c<<1:1)))){if(g?(d[7717]=d[7717]+1,t=0|r[d[6606]](g<<5,16),c=d[e+152>>2]):(t=0,c=f),(0|c)>=1)for(y=0;m=(h=y<<5)+t|0,h=h+d[e+160>>2]|0,b=d[h+4>>2],d[m>>2]=d[h>>2],d[m+4>>2]=b,b=d[h+28>>2],d[m+24>>2]=d[h+24>>2],d[m+28>>2]=b,b=d[h+20>>2],d[m+16>>2]=d[h+16>>2],d[m+20>>2]=b,b=d[h+12>>2],d[m+8>>2]=d[h+8>>2],d[m+12>>2]=b,(0|c)!=(0|(y=y+1|0)););(c=d[e+160>>2])&&(u[e+164|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[e+160>>2]=0),d[e+160>>2]=t,d[e+156>>2]=g,s[e+164|0]=1,c=d[e+152>>2]}d[e+152>>2]=c+1,h=d[(t=n)+4>>2],c=(f<<=5)+d[e+160>>2]|0,d[c>>2]=d[t>>2],d[c+4>>2]=h,m=d[t+28>>2],d[c+24>>2]=d[t+24>>2],d[c+28>>2]=m,m=d[t+20>>2],d[c+16>>2]=d[t+16>>2],d[c+20>>2]=m,m=d[t+12>>2],d[c+8>>2]=d[t+8>>2],d[c+12>>2]=m,t=f+d[e+160>>2]|0,c=(i<<4)+o|0,_[t>>1]=p[c>>1],_[t+2>>1]=p[c+2>>1],_[t+4>>1]=p[c+4>>1],_[t+6>>1]=p[c+6>>1],_[t+8>>1]=p[c+8>>1],c=p[c+10>>1],d[t+16>>2]=a,d[t+12>>2]=i,_[t+10>>1]=c}d[e+168>>2]=d[e+152>>2],O=n+32|0}function Ke(e,t,i){var n,r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=0,g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0);A=m[e+300>>2],R=m[e+452>>2],((P=m[e+304>>2])>y(0)||(f=0,A>y(0)))&&(f=d[e+288>>2]<4),n=d[e+720>>2];e:if(!(!f|(E=m[88+(n+b(i,104)|0)>>2])>y(0)^1)&&(f=b(i,104)+n|0,C=m[f+40>>2],a=y(C-m[t>>2]),S=m[f+44>>2],c=y(S-m[t+4>>2]),T=m[f+48>>2],l=y(T-m[t+8>>2]),(v=y(y(y(a*a)+y(c*c))+y(l*l)))>y(1.1920928955078125e-7))){r=m[d[e+684>>2]>>2],D=y(x(v)),o=y(y(1)/D),s=y(l*o),u=y(c*o),o=y(a*o),h=m[f+72>>2],_=m[f+80>>2],p=m[f+76>>2];t:switch(d[e+288>>2]){case 2:return a=y(y(y(a*h)+y(c*p))+y(l*_))>2]*y(.5)),h=y(a*y(l*A)),c=y(h*y(-s)),l=y(h*y(-u)),h=y(h*y(-o)),a>y(0)?(_=y(0),p=y(0),a=(s=y(y(y(C*C)+y(S*S))+y(T*T)))^1|r>y(0)^1||(r=y(y(y(x(s))/y(x(r)))*y(.800000011920929)),c=y(c*r),h=y(h*r),l=y(l*r)),e=b(i,104)+n|0,m[e+56>>2]=O+y(h+m[e+56>>2]),m[(t=e- -64|0)>>2]=p+y(c+m[t>>2]),void(m[e+60>>2]=_+y(l+m[e+60>>2]));case 0:case 1:case 3:break t;default:break e}if(g=l,l=y(y(y(a*h)+y(c*p))+y(l*_))y(0)){if(a=y(R*E),e=b(i,104)+n|0,r=y(y(y(v*y(c*m[e+92>>2]))*y(-.5))*r),c=y(A*r),l=y(P*r),r=y(y(s*c)+y(y(_*l)+y(0))),s=y(a*r),g=y(s*s),s=y(y(o*c)+y(y(h*l)+y(0))),o=y(a*s),h=y(o*o),u=y(y(u*c)+y(y(p*l)+y(0))),o=y(a*u),y(g+y(h+y(o*o)))>y(y(y(C*C)+y(S*S))+y(T*T)))return o=y(y(1)/a),l=s,s=y(y(1)/y(x(y(y(r*r)+y(y(s*s)+y(u*u)))))),a=y(l*s),c=y(r*s),s=y(u*s),r=y(y(T*c)+y(y(C*a)+y(S*s))),m[e+56>>2]=m[e+56>>2]-y(o*y(a*r)),m[e+60>>2]=m[e+60>>2]-y(o*y(s*r)),void(m[(e=e- -64|0)>>2]=m[e>>2]-y(o*y(c*r)));m[e+56>>2]=s+m[e+56>>2],m[e+60>>2]=u+m[e+60>>2],m[(e=e- -64|0)>>2]=r+m[e>>2]}}}function Ze(e,t,i,n,r,o,a,h){var _=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0);Ao(e,4,t,i),d[e+748>>2]=0,s[e+740|0]=h,d[e+736>>2]=16777216,s[e+716|0]=0,d[e+708>>2]=0,d[e+712>>2]=0,d[e+704>>2]=1065353216,d[e+696>>2]=1063675494,d[e+700>>2]=1050253722,d[e+688>>2]=0,d[e+692>>2]=-1082130432,d[e>>2]=19668,i=d[n+12>>2],d[e+608>>2]=d[n+8>>2],d[e+612>>2]=i,i=d[n+4>>2],d[e+600>>2]=d[n>>2],d[e+604>>2]=i,f=m[t+4>>2],_=m[o>>2],g=m[t+20>>2],u=m[o+4>>2],b=m[t+36>>2],p=m[o+8>>2],(A=y(y(y(f*_)+y(g*u))+y(b*p)))>=y(.9999998807907104)?(n=d[t+40>>2],i=d[t+8>>2],b=y(-m[t+44>>2]),g=y(-m[t+28>>2]),A=y(-m[t+12>>2]),t=d[t+24>>2]):A<=y(-.9999998807907104)?(n=d[t+40>>2],i=d[t+8>>2],b=m[t+44>>2],g=m[t+28>>2],A=m[t+12>>2],t=d[t+24>>2]):(S=y(y(b*u)-y(g*p)),T=y(y(f*p)-y(b*_)),b=y(y(u*S)-y(_*T)),C=_,_=y(y(g*_)-y(f*u)),g=y(y(C*_)-y(p*S)),A=y(y(p*T)-y(u*_)),l(_),n=c(0),l(S),i=c(0),l(T),t=c(0)),m[e+552>>2]=A,d[e+556>>2]=i,i=d[o>>2],d[e+572>>2]=t,m[e+568>>2]=g,d[e+564>>2]=0,d[e+560>>2]=i,t=d[o+4>>2],d[e+588>>2]=n,m[e+584>>2]=b,d[e+580>>2]=0,d[e+576>>2]=t,t=d[o+8>>2],d[e+596>>2]=0,d[e+592>>2]=t,S=m[a+8>>2],f=m[o+8>>2],_=m[o+4>>2],T=m[a+4>>2],R=m[a>>2],p=m[o>>2];e:if((u=y(y(S*f)+y(y(_*T)+y(R*p))))y(.7071067690849304)){C=_,_=y(y(1)/y(x(y(y(_*_)+y(f*f))))),u=y(C*_),p=y(_*y(-f)),f=y(0),_=y(0);break e}u=y(y(1)/y(x(y(y(_*_)+y(p*p))))),p=y(p*u),f=y(u*y(-_)),u=y(0),_=y(0)}else u=y(u+y(1)),E=y(x(y(u+u))),C=y(y(1)/E),u=y(y(y(T*p)-y(_*R))*C),p=y(y(y(f*R)-y(S*p))*C),f=y(y(y(_*S)-y(f*T))*C),_=y(E*y(.5));t=d[r+4>>2],d[e+664>>2]=d[r>>2],d[e+668>>2]=t,t=d[r+12>>2],d[e+672>>2]=d[r+8>>2],d[e+676>>2]=t,C=y(y(y(b*_)+y(g*f))-y(A*p)),E=y(y(y(A*_)+y(b*p))-y(g*u)),P=y(y(y(A*y(-f))-y(g*p))-y(b*u)),b=y(y(y(g*_)+y(A*u))-y(b*f)),g=y(y(p*C)+y(y(y(_*E)-y(f*P))-y(u*b))),m[e+616>>2]=g,A=y(y(f*b)+y(y(y(_*C)-y(u*P))-y(p*E))),_=y(y(u*E)+y(y(y(_*b)-y(p*P))-y(f*C))),m[e+620>>2]=y(T*A)-y(S*_),t=d[a>>2],m[e+632>>2]=_,m[e+636>>2]=y(S*g)-y(R*A),d[e+628>>2]=0,d[e+624>>2]=t,t=d[a+4>>2],m[e+652>>2]=y(R*_)-y(T*g),m[e+648>>2]=A,d[e+644>>2]=0,d[e+640>>2]=t,t=d[a+8>>2],m[e+732>>2]=y(h?-1:1),d[e+660>>2]=0,d[e+656>>2]=t}function $e(e,t,i,n,r,s){var o,a,l,c=y(0),h=y(0),_=0,u=y(0),p=y(0),f=0,g=0,v=0,A=y(0),C=y(0),S=y(0),x=y(0),T=y(0);o=d[e+76>>2],a=d[t+140>>2];e:{if(4&(l=d[s+64>>2])){if(v=d[e+16>>2],t=d[240+(v+b(n,244)|0)>>2],g=d[240+(b(i,244)+v|0)>>2],_=b(a,152)+o|0,c=y(m[r+124>>2]*m[s+60>>2]),m[_+100>>2]=c,g&&(u=m[g+356>>2],p=m[_+24>>2],A=m[g+352>>2],C=m[_+20>>2],e=b(i,244)+v|0,h=m[g+344>>2],m[e+64>>2]=y(y(c*y(y(h*m[_+16>>2])*m[g+348>>2]))*m[e+112>>2])+m[e+64>>2],m[e+68>>2]=y(y(c*y(A*y(h*C)))*m[e+116>>2])+m[e+68>>2],m[e+72>>2]=y(y(c*y(u*y(h*p)))*m[e+120>>2])+m[e+72>>2],h=m[_+72>>2],u=m[_+68>>2],m[e+80>>2]=y(y(c*m[e+96>>2])*m[_+64>>2])+m[e+80>>2],p=m[e+104>>2],m[e+84>>2]=y(u*y(c*m[e+100>>2]))+m[e+84>>2],m[e+88>>2]=y(h*y(c*p))+m[e+88>>2]),t&&(f=b(a,152)+o|0,u=m[f+88>>2],p=m[f+84>>2],A=m[f+80>>2],C=m[t+356>>2],S=m[f+56>>2],x=m[t+352>>2],T=m[f+52>>2],e=b(n,244)+v|0,h=m[t+344>>2],c=m[_+100>>2],m[e+64>>2]=m[e+64>>2]+y(y(y(y(h*m[f+48>>2])*m[t+348>>2])*c)*m[e+112>>2]),m[e+68>>2]=m[e+68>>2]+y(y(c*y(x*y(h*T)))*m[e+116>>2]),m[e+72>>2]=m[e+72>>2]+y(y(c*y(C*y(h*S)))*m[e+120>>2]),m[e+80>>2]=m[e+80>>2]+y(A*y(c*m[e+96>>2])),h=m[e+104>>2],m[e+84>>2]=m[e+84>>2]+y(p*y(c*m[e+100>>2])),m[e+88>>2]=m[e+88>>2]+y(u*y(h*c))),!(16&l))break e;if(_=b(f=a+1|0,152)+o|0,c=y(m[r+128>>2]*m[s+60>>2]),m[_+100>>2]=c,g&&(u=m[_+24>>2],p=m[_+20>>2],e=b(i,244)+v|0,h=m[g+344>>2],m[e+64>>2]=y(y(c*y(h*m[_+16>>2]))*m[e+112>>2])+m[e+64>>2],m[e+68>>2]=y(y(c*y(h*p))*m[e+116>>2])+m[e+68>>2],m[e+72>>2]=y(y(c*y(h*u))*m[e+120>>2])+m[e+72>>2],h=m[_+72>>2],u=m[_+68>>2],m[e+80>>2]=y(y(c*m[e+96>>2])*m[_+64>>2])+m[e+80>>2],p=m[e+104>>2],m[e+84>>2]=y(u*y(c*m[e+100>>2]))+m[e+84>>2],m[e+88>>2]=y(h*y(c*p))+m[e+88>>2]),!t)break e;return i=b(f,152)+o|0,u=m[i+88>>2],p=m[i+84>>2],A=m[i+56>>2],C=m[i+52>>2],S=m[i+48>>2],h=m[t+344>>2],e=b(n,244)+v|0,c=m[_+100>>2],m[e+80>>2]=m[e+80>>2]+y(m[i+80>>2]*y(m[e+96>>2]*c)),m[e+64>>2]=m[e+64>>2]+y(y(c*y(h*S))*m[e+112>>2]),m[e+68>>2]=m[e+68>>2]+y(y(c*y(h*C))*m[e+116>>2]),m[e+72>>2]=m[e+72>>2]+y(y(c*y(h*A))*m[e+120>>2]),h=m[e+104>>2],m[e+84>>2]=m[e+84>>2]+y(p*y(c*m[e+100>>2])),void(m[e+88>>2]=m[e+88>>2]+y(u*y(h*c)))}e=b(a,152)+o|0,d[e+100>>2]=0,16&l&&(d[e+252>>2]=0)}}function Je(e,t,i){var n,s,o=0,a=y(0),l=y(0),c=0,h=y(0),f=y(0),g=y(0),b=y(0),v=y(0);for(O=n=O-240|0,h=m[i>>2],a=m[i+4>>2],l=m[i+8>>2],d[e+124>>2]=0,m[e+120>>2]=l+m[e+100>>2],m[e+116>>2]=a+m[e+96>>2],m[e+112>>2]=h+m[e+92>>2],d[n+132>>2]=1065353216,d[(i=n)+136>>2]=0,d[i+140>>2]=0,d[i+124>>2]=0,d[i+128>>2]=0,d[i+152>>2]=1065353216,d[i+236>>2]=0,d[i+228>>2]=0,d[i+232>>2]=0,d[i+216>>2]=1065353216,d[i+220>>2]=0,d[i+224>>2]=0,d[i+172>>2]=0,d[i+164>>2]=0,d[i+168>>2]=0,d[i+156>>2]=0,d[i+160>>2]=0,d[i+196>>2]=1065353216,d[i+200>>2]=0,d[i+204>>2]=0,d[i+188>>2]=0,d[i+192>>2]=0,d[i+144>>2]=0,d[i+148>>2]=0,d[i+112>>2]=1065353216,d[i+116>>2]=0,d[i+120>>2]=0,d[i+208>>2]=0,d[i+212>>2]=0,d[i+180>>2]=0,d[i+184>>2]=0,d[i+176>>2]=1065353216,s=i+52|0,i=10,h=y(1);;){e:if(i){o=d[e+96>>2],d[n+224>>2]=d[e+92>>2],d[n+228>>2]=o,o=d[e+104>>2],d[n+232>>2]=d[e+100>>2],d[n+236>>2]=o,o=d[e+124>>2],d[n+168>>2]=d[e+120>>2],d[n+172>>2]=o,c=d[e+116>>2],d[(o=n)+160>>2]=d[e+112>>2],d[o+164>>2]=c,a=m[e+92>>2],l=m[e+112>>2],f=m[e+96>>2],g=m[e+116>>2],b=m[e+100>>2],v=m[e+120>>2],c=d[e+8>>2],d[o+84>>2]=0,d[o+12>>2]=1065353216,d[o+44>>2]=0,d[o+48>>2]=0,d[o+36>>2]=0,d[o+40>>2]=0,d[o+28>>2]=0,d[o+32>>2]=0,d[o+20>>2]=0,d[o+24>>2]=0,d[o+104>>2]=0,d[o+108>>2]=0,m[o+100>>2]=b-v,m[o+96>>2]=f-g,m[o+92>>2]=a-l,d[o+88>>2]=c,d[o+8>>2]=20308,c=d[c+188>>2],_[o+16>>1]=p[c+4>>1],_[o+18>>1]=p[c+6>>1],o=d[e+12>>2],a=y(r[d[d[o>>2]+48>>2]](o)),o=d[e+12>>2],r[d[d[o>>2]+44>>2]](o,y(a+m[e+56>>2])),u[e+170|0]?Ye(d[e+8>>2],d[e+12>>2],n+176|0,n+112|0,n+8|0,m[t+56>>2]):Ae(t,d[e+12>>2],n+176|0,n+112|0,n+8|0,m[t+56>>2]),o=d[e+12>>2],r[d[d[o>>2]+44>>2]](o,a);t:{if((g=m[n+12>>2])>2]-m[e+92>>2]),l=y(m[e+116>>2]-m[e+96>>2]),f=y(m[e+120>>2]-m[e+100>>2]),!((b=y(y(y(a*a)+y(l*l))+y(f*f)))>y(1.1920928955078125e-7)))break e;if(v=a,a=y(y(1)/y(x(b))),!(y(y(y(y(v*a)*m[e+76>>2])+y(y(l*a)*m[e+80>>2]))+y(y(f*a)*m[e+84>>2]))<=y(0)))break t;break e}o=d[e+116>>2],d[e+92>>2]=d[e+112>>2],d[e+96>>2]=o,o=d[e+124>>2],d[e+100>>2]=d[e+120>>2],d[e+104>>2]=o}if(i=i+-1|0,(h=y(h-g))>y(.009999999776482582))continue}break}O=n+240|0}function et(e,t){var i,n=0,o=0,a=0,l=0,c=0;if(d[e>>2]=5228,d[7717]=d[7717]+1,n=0|r[d[6606]](360,16),d[n+308>>2]=953267991,s[n+332|0]=240&u[n+332|0],d[e+24>>2]=n,a=d[t+20>>2],d[7717]=d[7717]+1,n=0|r[d[6606]](4,16),d[n>>2]=a?4440:4648,d[e+28>>2]=n,d[7717]=d[7717]+1,o=0|r[d[6606]](24,16),a=d[e+24>>2],n=d[e+28>>2],d[o+16>>2]=0,d[o+20>>2]=3,d[o>>2]=9788,s[o+4|0]=0,d[o+12>>2]=a,d[o+8>>2]=n,d[e+32>>2]=o,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=5344,s[n+4|0]=0,d[e+36>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=5468,s[n+4|0]=0,d[e+40>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=5560,s[n+4|0]=0,d[e+44>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=5640,s[n+4|0]=0,d[e+48>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=5728,s[n+4|0]=0,d[e+52>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=5812,s[n+4|0]=0,d[e+56>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=5880,s[n+4|0]=0,d[e+60>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=5964,s[n+4|0]=0,d[e+76>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=5964,d[e+80>>2]=n,s[n+4|0]=1,d[7717]=d[7717]+1,n=0|r[d[6606]](8,16),d[n>>2]=6048,s[n+4|0]=0,d[e+72>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](16,16),d[n+8>>2]=1,d[n+12>>2]=0,d[n>>2]=6124,s[n+4|0]=0,d[e+88>>2]=n,d[7717]=d[7717]+1,n=0|r[d[6606]](16,16),d[n+8>>2]=1,d[n+12>>2]=0,d[n>>2]=6124,d[e+84>>2]=n,s[n+4|0]=1,i=d[t+16>>2],n=d[t>>2])d[e+8>>2]=n,s[e+12|0]=0;else{if(s[e+12|0]=1,d[7717]=d[7717]+1,c=0|r[d[6606]](20,16),n=d[t+8>>2],d[c+4>>2]=n,d[c>>2]=772,d[7717]=d[7717]+1,a=0|r[d[6606]](b(n,772),16),d[c+12>>2]=a,d[c+16>>2]=a,n=d[c+4>>2],d[c+8>>2]=n,l=n+-1|0)for(o=d[c>>2];n=o+a|0,d[a>>2]=n,a=n,l=l+-1|0;);else n=a;d[n>>2]=0,d[e+8>>2]=c}if(n=d[t+4>>2])return d[e+16>>2]=n,void(s[e+20|0]=0);if(s[e+20|0]=1,d[7717]=d[7717]+1,o=0|r[d[6606]](20,16),n=d[t+12>>2],d[o+4>>2]=n,t=(0|i)>80?i:80,d[o>>2]=t,d[7717]=d[7717]+1,a=0|r[d[6606]](b(t,n),16),d[o+12>>2]=a,d[o+16>>2]=a,t=d[o+4>>2],d[o+8>>2]=t,l=t+-1|0)for(t=d[o>>2];n=t+a|0,d[a>>2]=n,a=n,l=l+-1|0;);else n=a;d[n>>2]=0,d[e+16>>2]=o}function tt(e,t,i,n,r){var s,o=y(0),a=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=0,A=y(0),C=y(0),S=y(0),T=y(0),E=0,R=y(0),P=y(0),I=0,M=y(0),D=y(0),w=y(0),F=y(0),B=0,N=y(0),L=y(0),k=y(0),V=0,U=0,G=0,j=0;if(d[60+(s=O+-64|0)>>2]=i,d[s+56>>2]=t,d[s+52>>2]=e,o=m[t>>2],_=m[e>>2],f=m[t+4>>2],h=m[e+4>>2],b=m[t+8>>2],p=m[e+8>>2],d[s+12>>2]=0,a=y(p-b),m[s+8>>2]=a,g=y(h-f),m[s+4>>2]=g,u=y(_-o),m[s>>2]=u,C=m[i>>2],S=m[i+4>>2],T=m[i+8>>2],d[s+44>>2]=0,d[s+28>>2]=0,M=y(T-p),m[s+40>>2]=M,D=y(S-h),m[s+36>>2]=D,T=y(b-T),m[s+24>>2]=T,R=y(f-S),m[s+20>>2]=R,w=y(C-_),m[s+32>>2]=w,P=y(o-C),m[s+16>>2]=P,f=y(-1),b=y(y(u*R)-y(g*P)),C=y(y(g*T)-y(a*R)),S=y(y(a*P)-y(u*T)),!((F=y(y(b*b)+y(y(C*C)+y(S*S))))>y(0)))return y(-1);for(;y(y(y(_*y(y(b*g)-y(S*a)))+y(h*y(y(C*a)-y(b*u))))+y(y(y(S*u)-y(C*g))*p))>y(0)?(j=d[4384+(G=E<<2)>>2],B=d[(v=j<<2)+(s+52|0)>>2],N=m[B>>2],a=y(N-_),L=m[B+4>>2],g=y(L-h),k=m[B+8>>2],u=y(k-p),o=y(y(y(a*a)+y(g*g))+y(u*u)),A=y(-1),o>y(0)&&((o=y(y(-y(y(y(_*a)+y(h*g))+y(p*u)))/o))>=y(1)?(V=1065353216,U=0,I=2,A=y(y(y(N*N)+y(L*L))+y(k*k))):o<=y(0)?(V=0,U=1065353216,I=1,A=y(y(y(_*_)+y(h*h))+y(p*p))):(l(y(y(1)-o)),U=c(0),l(o),V=c(0),I=3,p=y(p+y(u*o)),_=y(_+y(a*o)),o=y(h+y(g*o)),A=y(y(p*p)+y(y(_*_)+y(o*o))))),!!((o=A)>2]=(0-(1&I)&1<>31),d[n+G>>2]=U,d[n+v>>2]=V,d[(d[v+4384>>2]<<2)+n>>2]=0):o=f):o=f,3!=(0|(E=E+1|0));)u=m[(v=(E<<4)+s|0)>>2],a=m[v+8>>2],g=m[v+4>>2],v=d[(s+52|0)+(E<<2)>>2],p=m[v+8>>2],h=m[v+4>>2],_=m[v>>2],f=o;return o>2],f=m[e>>2],_=m[e+4>>2],d[r>>2]=7,_=y(y(y(y(C*f)+y(S*_))+y(b*o))/F),o=y(S*_),h=y(m[t+4>>2]-o),f=y(C*_),p=y(m[t>>2]-f),a=y(y(P*h)-y(R*p)),A=y(a*a),_=y(b*_),a=y(m[t+8>>2]-_),h=y(y(R*a)-y(T*h)),u=y(h*h),h=y(y(T*p)-y(P*a)),A=y(x(y(A+y(u+y(h*h))))),h=y(x(F)),p=y(A/h),m[n>>2]=p,a=y(m[i+4>>2]-o),g=y(m[i>>2]-f),u=y(y(w*a)-y(D*g)),A=y(u*u),u=y(m[i+8>>2]-_),a=y(y(D*u)-y(M*a)),b=y(a*a),a=y(y(M*g)-y(w*u)),h=y(y(x(y(A+y(b+y(a*a)))))/h),m[n+4>>2]=h,m[n+8>>2]=y(1)-y(p+h),o=y(y(_*_)+y(y(f*f)+y(o*o)))),o}function it(e,t,i,n){var r,s,o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=0,p=y(0),f=y(0),g=y(0),b=y(0),v=0,A=0,C=y(0),S=y(0),T=y(0),E=y(0),R=0,P=y(0),I=0,M=0,D=y(0);C=m[i+4>>2],S=m[i+8>>2],h=y(S*y(0)),p=y(C-h),b=m[i>>2],f=y(h-b),_=y(b*y(0)),a=y(C*y(0)),l=y(_-a),T=y(x(y(y(y(p*p)+y(f*f))+y(l*l)))),g=y(y(1)/T),c=y(b-a),a=y(a-S),_=y(h-_),E=y(x(y(y(c*c)+y(y(a*a)+y(_*_))))),h=y(y(1)/E),p=y((o=T>E)?p*g:a*h),f=y(o?f*g:_*h),_=y(y(C*p)-y(b*f)),g=y(o?l*g:c*h),T=y(y(b*g)-y(S*p)),E=y(y(S*f)-y(C*g)),r=d[n+12>>2],s=(0|t)<1;e:{for(;;){if(u=-1,!s)for(h=m[i+8>>2],a=m[i+4>>2],l=m[i>>2],o=0;d[(o<<2)+r>>2]&&(-1==(0|u)||(c=y(y(y(l*m[(n=(o<<4)+e|0)>>2])+y(a*m[n+4>>2]))+y(h*m[n+8>>2])))>y(y(y(l*m[(n=(u<<4)+e|0)>>2])+y(a*m[n+4>>2]))+y(h*m[n+8>>2])))&&(u=o),(0|(o=o+1|0))!=(0|t););if(v=-1,o=0,3==d[(I=(u<<2)+r|0)>>2])break e;t:{for(;;){if(R=v,M=o,h=y(0|o),a=yn(l=y(h*y(.01745329238474369))),l=An(l),v=-1,!s)for(c=y(S+y(y(y(g*l)+y(_*a))*y(.02500000037252903))),P=y(C+y(y(y(f*l)+y(T*a))*y(.02500000037252903))),a=y(b+y(y(y(p*l)+y(E*a))*y(.02500000037252903))),o=0;d[(o<<2)+r>>2]&&(-1==(0|v)||(l=y(y(y(a*m[(n=(o<<4)+e|0)>>2])+y(P*m[n+4>>2]))+y(c*m[n+8>>2])))>y(y(y(a*m[(n=(v<<4)+e|0)>>2])+y(P*m[n+4>>2]))+y(c*m[n+8>>2])))&&(v=o),(0|(o=o+1|0))!=(0|t););if((0|u)==(0|v)&&(0|u)==(0|R))break t;if(!(-1==(0|R)|(0|v)==(0|R))&&(a=y(h+y(-40)))<=h)for(;;){if(l=yn(c=y(a*y(.01745329238474369))),c=An(c),n=-1,!s)for(P=y(S+y(y(y(g*c)+y(_*l))*y(.02500000037252903))),D=y(C+y(y(y(f*c)+y(T*l))*y(.02500000037252903))),l=y(b+y(y(y(p*c)+y(E*l))*y(.02500000037252903))),o=0;d[(o<<2)+r>>2]&&(-1==(0|n)||(c=y(y(y(l*m[(A=(o<<4)+e|0)>>2])+y(D*m[A+4>>2]))+y(P*m[A+8>>2])))>y(y(y(l*m[(A=(n<<4)+e|0)>>2])+y(D*m[A+4>>2]))+y(P*m[A+8>>2])))&&(n=o),(0|(o=o+1|0))!=(0|t););if((0|n)==(0|u)&&(0|u)==(0|R))break t;if(R=n,!((a=y(a+y(5)))<=h))break}if(o=M+45|0,!(M>>>0<316))break}d[I>>2]=0;continue}break}d[I>>2]=3}return u}function nt(e,t,i){var n=y(0),r=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0);M=m[t+52>>2],D=m[t+56>>2],f=m[e+96>>2],g=m[e+100>>2],b=m[e+104>>2],n=m[t+20>>2],r=m[t+24>>2],v=m[e- -64>>2],A=m[e+80>>2],C=m[e+52>>2],S=m[e+68>>2],x=m[e+84>>2],T=m[e+56>>2],o=m[t+36>>2],E=m[e+72>>2],a=m[t+40>>2],R=m[e+88>>2],I=m[t+48>>2],l=m[t+8>>2],c=m[t>>2],h=m[t+4>>2],_=m[t+16>>2],P=m[e+48>>2],p=m[t+32>>2],d[e+1124>>2]=0,d[e+1108>>2]=0,d[e+1092>>2]=0,d[e+1076>>2]=0,m[e+1104>>2]=y(y(T*p)+y(E*o))+y(R*a),m[e+1100>>2]=y(y(C*p)+y(S*o))+y(x*a),m[e+1096>>2]=y(y(P*p)+y(v*o))+y(A*a),m[e+1088>>2]=y(y(T*_)+y(E*n))+y(R*r),m[e+1084>>2]=y(y(C*_)+y(S*n))+y(x*r),m[e+1080>>2]=y(y(P*_)+y(v*n))+y(A*r),m[e+1072>>2]=y(y(c*T)+y(h*E))+y(l*R),m[e+1068>>2]=y(y(c*C)+y(h*S))+y(l*x),m[e+1064>>2]=y(y(P*c)+y(v*h))+y(A*l),m[e+1120>>2]=D+y(y(y(p*f)+y(o*g))+y(a*b)),m[e+1116>>2]=M+y(y(y(_*f)+y(n*g))+y(r*b)),m[e+1112>>2]=I+y(y(y(c*f)+y(h*g))+y(l*b)),M=m[i+52>>2],D=m[i+56>>2],f=m[e+160>>2],g=m[e+164>>2],b=m[e+168>>2],n=m[i+20>>2],r=m[i+24>>2],v=m[e+128>>2],A=m[e+144>>2],C=m[e+116>>2],S=m[e+132>>2],x=m[e+148>>2],T=m[e+120>>2],E=m[e+136>>2],o=m[i+36>>2],R=m[e+152>>2],a=m[i+40>>2],I=m[i+48>>2],l=m[i+8>>2],c=m[i>>2],h=m[i+4>>2],_=m[i+16>>2],P=m[e+112>>2],p=m[i+32>>2],d[e+1188>>2]=0,d[e+1172>>2]=0,d[e+1156>>2]=0,d[e+1140>>2]=0,m[e+1168>>2]=y(y(T*p)+y(E*o))+y(R*a),m[e+1164>>2]=y(y(C*p)+y(S*o))+y(x*a),m[e+1160>>2]=y(y(P*p)+y(v*o))+y(A*a),m[e+1152>>2]=y(y(T*_)+y(E*n))+y(R*r),m[e+1148>>2]=y(y(C*_)+y(S*n))+y(x*r),m[e+1144>>2]=y(y(P*_)+y(v*n))+y(A*r),m[e+1136>>2]=y(y(c*T)+y(h*E))+y(l*R),m[e+1132>>2]=y(y(c*C)+y(h*S))+y(l*x),m[e+1128>>2]=y(y(P*c)+y(v*h))+y(A*l),m[e+1184>>2]=D+y(y(y(p*f)+y(o*g))+y(a*b)),m[e+1180>>2]=M+y(y(y(_*f)+y(n*g))+y(r*b)),m[e+1176>>2]=I+y(y(y(c*f)+y(h*g))+y(l*b)),function(e){var t,i=y(0),n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0);d[e+1268>>2]=0,a=m[e+1084>>2],l=m[e+1104>>2],c=m[e+1088>>2],h=m[e+1100>>2],b=y(y(a*l)-y(c*h)),n=m[e+1064>>2],r=m[e+1068>>2],_=m[e+1096>>2],u=m[e+1080>>2],v=y(y(c*_)-y(l*u)),s=y(y(h*u)-y(a*_)),o=m[e+1072>>2],i=y(y(1)/y(y(y(b*n)+y(r*v))+y(s*o))),p=y(m[e+1184>>2]-m[e+1120>>2]),f=y(m[e+1176>>2]-m[e+1112>>2]),g=y(m[e+1180>>2]-m[e+1116>>2]),s=y(y(p*y(y(y(a*n)-y(u*r))*i))+y(y(f*y(s*i))+y(g*y(y(y(_*r)-y(h*n))*i)))),m[e+1264>>2]=s,n=y(y(p*y(y(y(u*o)-y(c*n))*i))+y(y(f*y(v*i))+y(g*y(y(y(l*n)-y(_*o))*i)))),m[e+1260>>2]=n,i=y(y(p*y(y(y(c*r)-y(a*o))*i))+y(y(f*y(b*i))+y(g*y(y(y(h*o)-y(l*r))*i)))),m[e+1256>>2]=i,m[e+840>>2]=i;e:{if(!((r=m[e+680>>2])>(o=m[e+696>>2]))){if(r>i){d[e+856>>2]=2,i=y(i-r);break e}if(o>2]=1,i=y(i-o);break e}}d[e+856>>2]=0,i=y(0)}m[e+844>>2]=n,m[e+824>>2]=i;e:{if(!((i=m[e+684>>2])>(r=m[e+700>>2])))t:{if(!(i>n)){if(!(r>2]=1,i=y(n-r);break e}d[e+860>>2]=2,i=y(n-i);break e}d[e+860>>2]=0,i=y(0)}m[e+848>>2]=s,m[e+828>>2]=i,t=e;e:{if(!((i=m[e+688>>2])>(n=m[e+704>>2])))t:{if(!(i>s)){if(!(n>2]=1,i=y(s-n);break e}d[e+864>>2]=2,i=y(s-i);break e}d[e+864>>2]=0,i=y(0)}m[t+832>>2]=i}(e),xt(e),u[e+1301|0]&&(r=m[d[e+28>>2]+344>>2],n=m[d[e+32>>2]+344>>2],s[e+1280|0]=ry(0)?y(I/n):y(.5),m[e+1272>>2]=n,m[e+1276>>2]=y(1)-n)}function rt(e){var t,i=0,n=0,r=0,s=0,o=0,a=0;if(t=O+-64|0,a=243703,(0|(o=d[e+732>>2]))>=1)for(;n=(r=d[e+740>>2])+b(s,52)|0,d[t+56>>2]=d[n+48>>2],i=d[n+44>>2],d[t+48>>2]=d[n+40>>2],d[t+52>>2]=i,i=d[n+36>>2],d[t+40>>2]=d[n+32>>2],d[t+44>>2]=i,i=d[n+28>>2],d[t+32>>2]=d[n+24>>2],d[t+36>>2]=i,i=d[n+20>>2],d[t+24>>2]=d[n+16>>2],d[t+28>>2]=i,i=d[n+12>>2],d[t+16>>2]=d[n+8>>2],d[t+20>>2]=i,i=d[n+4>>2],d[t+8>>2]=d[n>>2],d[t+12>>2]=i,a=b(a,1664525)+1013904223|0,i=r+b((a>>>0)%(o>>>0)|0,52)|0,r=d[i+4>>2],d[n>>2]=d[i>>2],d[n+4>>2]=r,d[n+48>>2]=d[i+48>>2],r=d[i+44>>2],d[n+40>>2]=d[i+40>>2],d[n+44>>2]=r,r=d[i+36>>2],d[n+32>>2]=d[i+32>>2],d[n+36>>2]=r,r=d[i+28>>2],d[n+24>>2]=d[i+24>>2],d[n+28>>2]=r,r=d[i+20>>2],d[n+16>>2]=d[i+16>>2],d[n+20>>2]=r,r=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=r,d[i+48>>2]=d[t+56>>2],n=d[t+52>>2],d[i+40>>2]=d[t+48>>2],d[i+44>>2]=n,n=d[t+44>>2],d[i+32>>2]=d[t+40>>2],d[i+36>>2]=n,n=d[t+36>>2],d[i+24>>2]=d[t+32>>2],d[i+28>>2]=n,n=d[t+28>>2],d[i+16>>2]=d[t+24>>2],d[i+20>>2]=n,n=d[t+20>>2],d[i+8>>2]=d[t+16>>2],d[i+12>>2]=n,n=d[t+12>>2],d[i>>2]=d[t+8>>2],d[i+4>>2]=n,(0|o)!=(0|(s=s+1|0)););if((0|(o=d[e+752>>2]))>=1)for(s=0;n=(r=d[e+760>>2])+b(s,44)|0,d[t+48>>2]=d[n+40>>2],i=d[n+36>>2],d[t+40>>2]=d[n+32>>2],d[t+44>>2]=i,i=d[n+28>>2],d[t+32>>2]=d[n+24>>2],d[t+36>>2]=i,i=d[n+20>>2],d[t+24>>2]=d[n+16>>2],d[t+28>>2]=i,i=d[n+12>>2],d[t+16>>2]=d[n+8>>2],d[t+20>>2]=i,i=d[n+4>>2],d[t+8>>2]=d[n>>2],d[t+12>>2]=i,a=b(a,1664525)+1013904223|0,i=r+b((a>>>0)%(o>>>0)|0,44)|0,r=d[i+4>>2],d[n>>2]=d[i>>2],d[n+4>>2]=r,d[n+40>>2]=d[i+40>>2],r=d[i+36>>2],d[n+32>>2]=d[i+32>>2],d[n+36>>2]=r,r=d[i+28>>2],d[n+24>>2]=d[i+24>>2],d[n+28>>2]=r,r=d[i+20>>2],d[n+16>>2]=d[i+16>>2],d[n+20>>2]=r,r=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=r,d[i+40>>2]=d[t+48>>2],n=d[t+44>>2],d[i+32>>2]=d[t+40>>2],d[i+36>>2]=n,n=d[t+36>>2],d[i+24>>2]=d[t+32>>2],d[i+28>>2]=n,n=d[t+28>>2],d[i+16>>2]=d[t+24>>2],d[i+20>>2]=n,n=d[t+20>>2],d[i+8>>2]=d[t+16>>2],d[i+12>>2]=n,n=d[t+12>>2],d[i>>2]=d[t+8>>2],d[i+4>>2]=n,(0|o)!=(0|(s=s+1|0)););}function st(e,t){var i,n=0,r=y(0);O=i=O+-64|0,d[i+60>>2]=e,d[i+56>>2]=t,e=O-16|0,t=d[i+60>>2],d[e+12>>2]=t,r=m[d[e+12>>2]>>2],d[12+(e=O-16|0)>>2]=t+16,r=y(r+m[d[e+12>>2]+4>>2]),d[12+(e=O-16|0)>>2]=t+32,m[i+52>>2]=r+m[d[e+12>>2]+8>>2],m[i+52>>2]>y(0)?(m[12+(e=O-16|0)>>2]=m[i+52>>2]+y(1),m[i+28>>2]=x(m[e+12>>2]),m[i+44>>2]=m[i+28>>2]*y(.5),m[i+28>>2]=y(.5)/m[i+28>>2],d[12+(e=O-16|0)>>2]=t+32,r=m[d[e+12>>2]+4>>2],d[12+(e=O-16|0)>>2]=t+16,m[i+32>>2]=y(r-m[d[e+12>>2]+8>>2])*m[i+28>>2],d[12+(e=O-16|0)>>2]=t,r=m[d[e+12>>2]+8>>2],d[12+(e=O-16|0)>>2]=t+32,m[i+36>>2]=y(r-m[d[e+12>>2]>>2])*m[i+28>>2],d[12+(e=O-16|0)>>2]=t+16,r=m[d[e+12>>2]>>2],d[12+(e=O-16|0)>>2]=t,m[i+40>>2]=y(r-m[d[e+12>>2]+4>>2])*m[i+28>>2]):(e=i,d[12+(n=O-16|0)>>2]=t,r=m[d[n+12>>2]>>2],d[12+(n=O-16|0)>>2]=t+16,r>2]+4>>2]?(d[12+(n=O-16|0)>>2]=t+16,r=m[d[n+12>>2]+4>>2],d[12+(n=O-16|0)>>2]=t+32,n=r>2]+8>>2]?2:1):(d[12+(n=O-16|0)>>2]=t,r=m[d[n+12>>2]>>2],d[12+(n=O-16|0)>>2]=t+32,n=r>2]+8>>2]?2:0),d[e+24>>2]=n,d[i+20>>2]=(d[i+24>>2]+1|0)%3,d[i+16>>2]=(d[i+24>>2]+2|0)%3,d[12+(e=O-16|0)>>2]=t+(d[i+24>>2]<<4),r=m[d[e+12>>2]+(d[i+24>>2]<<2)>>2],d[12+(e=O-16|0)>>2]=t+(d[i+20>>2]<<4),r=y(r-m[d[e+12>>2]+(d[i+20>>2]<<2)>>2]),d[12+(e=O-16|0)>>2]=t+(d[i+16>>2]<<4),m[12+(n=O-16|0)>>2]=y(r-m[d[e+12>>2]+(d[i+16>>2]<<2)>>2])+y(1),m[i+12>>2]=x(m[n+12>>2]),m[(e=i+32|0)+(d[i+24>>2]<<2)>>2]=m[i+12>>2]*y(.5),m[i+12>>2]=y(.5)/m[i+12>>2],d[12+(n=O-16|0)>>2]=t+(d[i+16>>2]<<4),r=m[d[n+12>>2]+(d[i+20>>2]<<2)>>2],d[12+(n=O-16|0)>>2]=t+(d[i+20>>2]<<4),m[i+44>>2]=y(r-m[d[n+12>>2]+(d[i+16>>2]<<2)>>2])*m[i+12>>2],d[12+(n=O-16|0)>>2]=t+(d[i+20>>2]<<4),r=m[d[n+12>>2]+(d[i+24>>2]<<2)>>2],d[12+(n=O-16|0)>>2]=t+(d[i+24>>2]<<4),m[e+(d[i+20>>2]<<2)>>2]=y(r+m[d[n+12>>2]+(d[i+20>>2]<<2)>>2])*m[i+12>>2],d[12+(n=O-16|0)>>2]=t+(d[i+16>>2]<<4),r=m[d[n+12>>2]+(d[i+24>>2]<<2)>>2],d[12+(n=O-16|0)>>2]=t+(d[i+24>>2]<<4),m[e+(d[i+16>>2]<<2)>>2]=y(r+m[d[n+12>>2]+(d[i+16>>2]<<2)>>2])*m[i+12>>2]),e=i+32|0,eo(d[i+56>>2],e,e+4|0,e+8|0,e+12|0),O=i- -64|0}function ot(e,t,i){var n=0,o=0,a=y(0),l=y(0),c=y(0),h=0,_=0,u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0);if(!((0|(n=d[e+748>>2]))<1)){for(;f=m[t+48>>2],C=m[t+8>>2],S=m[t>>2],x=m[t+4>>2],g=m[t+52>>2],T=m[t+24>>2],u=m[t+16>>2],E=m[t+20>>2],a=m[t+56>>2],l=m[t+40>>2],c=m[t+32>>2],v=m[t+36>>2],o=b(h=n+-1|0,184)+e|0,d[o- -64>>2]=0,R=a,a=m[o+4>>2],P=y(c*a),c=m[o+8>>2],p=l,l=m[o+12>>2],v=y(R+y(y(P+y(v*c))+y(p*l))),m[o+60>>2]=v,g=y(g+y(y(y(a*u)+y(c*E))+y(l*T))),m[o+56>>2]=g,f=y(f+y(y(y(a*S)+y(c*x))+y(l*C))),m[o+52>>2]=f,C=m[i+56>>2],S=m[i+40>>2],x=m[i+32>>2],T=m[i+36>>2],u=m[i+52>>2],E=m[i+24>>2],I=m[i+16>>2],M=m[i+20>>2],a=m[i+48>>2],l=m[i+8>>2],c=m[i>>2],A=m[i+4>>2],d[o+48>>2]=0,R=a,a=m[o+20>>2],P=y(c*a),c=m[o+24>>2],p=l,l=m[o+28>>2],A=y(R+y(y(P+y(A*c))+y(p*l))),m[o+36>>2]=A,u=y(u+y(y(y(a*I)+y(c*M))+y(l*E))),m[o+40>>2]=u,a=y(C+y(y(y(a*x)+y(c*T))+y(l*S))),m[o+44>>2]=a,m[o+84>>2]=y(y(y(f-A)*m[o+68>>2])+y(y(g-u)*m[o+72>>2]))+y(y(v-a)*m[o+76>>2]),d[o+152>>2]=d[o+152>>2]+1,o=(0|n)>1,n=h,o;);if(!((0|(i=d[e+748>>2]))<1))for(;o=4+(n=b(i=(t=i)+-1|0,184)+e|0)|0,(a=m[n+84>>2])<=(c=m[e+752>>2])?(l=y(m[n+36>>2]-y(m[n+52>>2]-y(m[n+68>>2]*a))),p=y(l*l),l=y(m[n+40>>2]-y(m[n+56>>2]-y(a*m[n+72>>2]))),a=y(m[n+44>>2]-y(m[n+60>>2]-y(a*m[n+76>>2]))),y(y(p+y(l*l))+y(a*a))>y(c*c)?((h=d[n+116>>2])&&(_=d[6734])&&(r[_](h),d[n+116>>2]=0),n=(_=d[e+748>>2])+-1|0,h=e,(0|t)!=(0|_)&&(Mi(o,4+(n=b(n,184)+e|0)|0,184),d[n+124>>2]=0,d[n+116>>2]=0,d[n+152>>2]=0,d[n+128>>2]=0,d[n+132>>2]=0,s[n+120|0]=0,n=d[e+748>>2]+-1|0),d[h+748>>2]=n):(n=d[6735])&&r[n](o,d[e+740>>2],d[e+744>>2])):((h=d[n+116>>2])&&(_=d[6734])&&(r[_](h),d[n+116>>2]=0),n=(_=d[e+748>>2])+-1|0,h=e,(0|t)!=(0|_)&&(Mi(o,4+(n=b(n,184)+e|0)|0,184),d[n+124>>2]=0,d[n+116>>2]=0,d[n+152>>2]=0,d[n+128>>2]=0,d[n+132>>2]=0,s[n+120|0]=0,n=d[e+748>>2]+-1|0),d[h+748>>2]=n),(0|t)>1;);}}function at(e,t,i){var n=0,o=0,a=0,l=0,c=0,h=0,_=0,p=0,f=0,m=0,g=0;if(yr(17892),(0|(n=d[e+28>>2]))<=-1)for(d[e+32>>2]<=-1&&((a=d[e+36>>2])&&(u[e+40|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[e+36>>2]=0),d[e+32>>2]=0,d[e+36>>2]=0,s[e+40|0]=1);d[d[e+36>>2]+(n<<2)>>2]=0,o=(a=n+1|0)>>>0>=n>>>0,n=a,o;);if(d[e+28>>2]=0,function(e){var t,i,n=0,r=0,s=0,o=0,a=0,l=0;if(O=i=O-16|0,!((0|(t=d[e+4>>2]))<=0)){for(o=d[e+12>>2];;){if(l=a=(r<<3)+o|0,(0|(n=r))!=(0|(s=d[a>>2])))for(;n=(s<<3)+o|0,d[l>>2]=d[n>>2],(0|(n=d[n>>2]))!=(0|(s=d[(l=(n<<3)+o|0)>>2])););if(d[a>>2]=n,(0|t)==(0|(r=r+1|0)))break}(0|t)<2||Sr(e,i+8|0,0,t+-1|0)}O=i+16|0}(e+4|0),(0|(_=d[e+8>>2]))>=1)for(a=0;;){for(h=(l=(0|_)>(0|(n=(o=a)+1|0))?_:n)+-1|0,c=d[e+16>>2],f=d[c+(o<<3)>>2];;){if((0|(a=(n=a)+1|0))>=(0|_))n=h,a=l;else if(d[(a<<3)+c>>2]==(0|f))continue;break}e:if(!(m=(0|o)>(0|n))){for(h=(0|n)>(0|o)?n:o,g=d[i+16>>2],l=1,n=o;p=d[(d[4+((n<<3)+c|0)>>2]<<2)+g>>2],d[p+208>>2]==(0|f)&&(l&=4!=(0|(p=d[p+216>>2]))&1!=(0|p)),p=(0|n)!=(0|h),n=n+1|0,p;);if(!l){if(m)break e;for(;;){if(n=d[d[i+16>>2]+(d[4+((o<<3)+c|0)>>2]<<2)>>2],d[n+208>>2]!=(0|f)|2!=d[n+216>>2]||(4!=(-2&d[n+216>>2])&&(d[n+216>>2]=3),d[n+220>>2]=0),(0|o)==(0|h))break e;o=o+1|0,c=d[e+16>>2]}}if(!m)for(;;){if(n=d[d[i+16>>2]+(d[4+((o<<3)+c|0)>>2]<<2)>>2],d[n+208>>2]==(0|f)&&4!=(-2&d[n+216>>2])&&(d[n+216>>2]=2),(0|o)==(0|h))break e;o=o+1|0,c=d[e+16>>2]}}if(!((0|a)<(0|_)))break}if((0|(c=0|r[d[d[t>>2]+36>>2]](t)))>=1)for(a=0;;){if(h=0|r[d[d[t>>2]+40>>2]](t,a),i=d[h+744>>2],n=d[h+740>>2],(!(!i|2==d[i+216>>2])||2!=d[n+216>>2]&&n)&&(!(2&(o=d[n+204>>2]))|4&o|2==d[n+216>>2]||Eh(i,0),!(2&(o=d[i+204>>2]))|4&o|2==d[i+216>>2]||Eh(n,0),u[e+64|0]&&r[d[d[t>>2]+28>>2]](t,n,i))){if((0|(o=d[e+28>>2]))==d[e+32>>2]&&!((0|o)>=(0|(i=o?o<<1:1)))){if(n=0,l=0,i&&(d[7717]=d[7717]+1,l=0|r[d[6606]](i<<2,16),o=d[e+28>>2]),(0|o)>=1)for(;d[(_=n<<2)+l>>2]=d[_+d[e+36>>2]>>2],(0|o)!=(0|(n=n+1|0)););(n=d[e+36>>2])&&(u[e+40|0]&&(n&&(d[7718]=d[7718]+1,r[d[6607]](n)),o=d[e+28>>2]),d[e+36>>2]=0),d[e+36>>2]=l,s[e+40|0]=1,d[e+32>>2]=i}d[d[e+36>>2]+(o<<2)>>2]=h,d[e+28>>2]=o+1}if((0|c)==(0|(a=a+1|0)))break}As()}function lt(e,t,i){var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0);oi(e,e=d[e+144>>2]+b(t,284)|0,i),d[e+136>>2]=0,d[e+120>>2]=0,d[e+104>>2]=0,S=m[e+68>>2],T=m[e+72>>2],E=m[e+76>>2],c=An(u=y(m[e+236>>2]*y(-.5))),s=yn(u),D=m[e+56>>2],u=m[e+52>>2],h=m[e+60>>2],o=y(c/y(x(y(y(E*E)+y(y(T*T)+y(S*S)))))),c=y(T*o),p=y(E*o),o=y(S*o),n=y(y(2)/y(y(s*s)+y(y(p*p)+y(y(o*o)+y(c*c))))),R=y(p*n),v=y(c*R),A=y(o*n),f=y(s*A),B=y(v+f),l=y(m[e+232>>2]*y(.5)),r=y(An(l)/y(x(y(y(y(u*u)+y(D*D))+y(h*h))))),a=y(r*y(-u)),l=yn(l),P=y(r*y(-h)),w=y(-D),r=y(r*w),g=y(y(2)/y(y(l*l)+y(y(P*P)+y(y(a*a)+y(r*r))))),_=y(a*g),L=y(a*_),O=y(r*g),k=y(r*O),I=y(y(1)-y(L+k)),g=y(P*g),V=y(a*g),U=y(l*O),M=y(V-U),n=y(c*n),C=y(o*n),F=y(s*R),N=y(C-F),G=y(r*g),j=y(l*_),r=y(G+j),_=y(o*A),W=y(p*R),p=y(y(1)-y(_+W)),A=y(y(B*I)+y(y(M*N)+y(r*p))),z=y(o*R),s=y(s*n),o=y(z-s),R=y(C+F),C=y(c*n),c=y(y(1)-y(C+W)),n=y(y(o*I)+y(y(r*R)+y(M*c))),F=M,M=y(z+s),s=r,r=y(v-f),f=I,I=y(y(1)-y(_+C)),v=y(y(y(F*M)+y(s*r))+y(f*I)),m[e+132>>2]=y(y(A*w)-y(u*n))-y(h*v),f=y(y(D*S)-y(u*T)),_=y(y(h*T)-y(D*E)),C=y(y(u*E)-y(h*S)),s=y(y(1)/y(x(y(y(f*f)+y(y(_*_)+y(C*C)))))),f=y(f*s),_=y(_*s),s=y(C*s),m[e+128>>2]=y(f*v)+y(y(_*n)+y(s*A)),m[e+124>>2]=y(E*v)+y(y(S*n)+y(T*A)),n=y(G-j),O=y(a*O),A=y(l*g),a=y(O+A),v=y(P*g),l=y(y(1)-y(L+v)),P=y(y(n*B)+y(y(a*N)+y(l*p))),g=y(y(n*o)+y(y(R*l)+y(a*c))),a=y(y(y(a*M)+y(r*l))+y(n*I)),m[e+116>>2]=y(y(P*w)-y(u*g))-y(h*a),m[e+112>>2]=y(f*a)+y(y(_*g)+y(s*P)),m[e+108>>2]=y(E*a)+y(y(S*g)+y(T*P)),a=y(V+U),l=y(y(1)-y(k+v)),n=y(O-A),p=y(y(a*B)+y(y(l*N)+y(n*p))),c=y(y(a*o)+y(y(n*R)+y(l*c))),o=y(y(y(l*M)+y(n*r))+y(a*I)),m[e+100>>2]=y(y(p*w)-y(u*c))-y(h*o),m[e+96>>2]=y(f*o)+y(y(_*c)+y(s*p)),m[e+92>>2]=y(E*o)+y(y(S*c)+y(T*p)),d[e+152>>2]=0,r=h,h=m[e+32>>2],m[e+148>>2]=y(r*h)+m[e+44>>2],m[e+144>>2]=y(D*h)+m[e+40>>2],m[e+140>>2]=m[e+36>>2]+y(u*h)}function ct(e,t,i,n,r){var o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0);o=-16&u[r+16|0],s[r+16|0]=o,O=m[n>>2],f=m[t>>2],C=y(O-f),p=m[e>>2],a=y(p-f),w=m[n+4>>2],g=m[t+4>>2],S=y(w-g),h=m[e+4>>2],l=y(h-g),F=m[n+8>>2],b=m[t+8>>2],x=y(F-b),v=m[e+8>>2],c=y(v-b),_=y(y(y(C*a)+y(S*l))+y(x*c)),e=r,P=m[i>>2],T=y(P-f),I=m[i+4>>2],E=y(I-g),M=m[i+8>>2],R=y(M-b),(l=y(y(y(T*a)+y(E*l))+y(R*c)))<=y(0)^1|_<=y(0)^1?(a=y(p-P),c=y(h-I),A=y(v-M),D=y(y(y(C*a)+y(S*c))+y(x*A)),(c=y(y(y(T*a)+y(E*c))+y(R*A)))>=y(0)^1|D<=c^1?(A=y(y(l*D)-y(c*_)),c<=y(0)^1|l>=y(0)^1||(a=y(0),!(A<=y(0)))?(a=y(p-O),h=y(h-w),v=y(v-F),p=y(y(y(T*a)+y(E*h))+y(R*v)),(a=y(y(y(C*a)+y(S*h))+y(x*v)))>=y(0)^1|p<=a^1?(h=y(y(p*_)-y(l*a)),a<=y(0)^1|_>=y(0)^1||(l=y(0),!(h<=y(0)))?(_=y(y(c*a)-y(p*D)))<=y(0)&&(l=y(D-c))>=y(0)&&(a=y(p-a))>=y(0)?(d[r+12>>2]=0,s[r+16|0]=6|o,a=y(l/y(l+a)),m[r+8>>2]=M+y(y(F-M)*a),m[r+4>>2]=I+y(y(w-I)*a),m[r>>2]=P+y(y(O-P)*a),l=y(y(1)-a),c=y(0)):(d[r+12>>2]=0,s[r+16|0]=7|o,l=y(y(1)/y(A+y(_+h))),a=y(A*l),l=y(h*l),m[r+8>>2]=y(x*a)+y(b+y(R*l)),m[r+4>>2]=y(S*a)+y(g+y(E*l)),m[r>>2]=y(C*a)+y(f+y(T*l)),c=y(y(y(1)-l)-a)):(d[r+12>>2]=0,s[r+16|0]=5|o,a=y(_/y(_-a)),m[r+8>>2]=b+y(x*a),m[r+4>>2]=g+y(S*a),m[r>>2]=f+y(C*a),c=y(y(1)-a))):(t=d[n+4>>2],d[r>>2]=d[n>>2],d[r+4>>2]=t,t=d[n+12>>2],d[r+8>>2]=d[n+8>>2],d[r+12>>2]=t,s[r+16|0]=4|o,a=y(1),l=y(0),c=y(0))):(d[r+12>>2]=0,s[r+16|0]=3|o,l=y(l/y(l-c)),m[r+8>>2]=b+y(R*l),m[r+4>>2]=g+y(E*l),m[r>>2]=f+y(T*l),c=y(y(1)-l))):(t=d[i+4>>2],d[r>>2]=d[i>>2],d[r+4>>2]=t,t=d[i+12>>2],d[r+8>>2]=d[i+8>>2],d[r+12>>2]=t,s[r+16|0]=2|o,l=y(1),a=y(0),c=y(0))):(i=d[t+4>>2],d[r>>2]=d[t>>2],d[r+4>>2]=i,i=d[t+12>>2],d[r+8>>2]=d[t+8>>2],d[r+12>>2]=i,s[r+16|0]=1|o,l=y(0),a=y(0),c=y(1)),m[e+20>>2]=c,d[r+32>>2]=0,m[r+28>>2]=a,m[r+24>>2]=l}function ht(e,t,i,n,s,o){var a,l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=0,C=y(0),S=y(0),T=y(0),E=0,R=y(0),P=0,I=0,M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=0,k=0,V=0,U=0,G=0,j=0;O=a=O-32|0;e:if(!(d[e+56>>2]<1))for(_=m[n+8>>2],h=m[i+8>>2],S=f=y(_-h),c=m[n>>2],g=m[i>>2],u=y(c-g),b=m[n+4>>2],v=m[i+4>>2],p=y(b-v),C=y(y(1)/y(x(y(y(y(u*u)+y(p*p))+y(f*f))))),f=y(f*C),T=u,u=y(u*C),R=p,p=y(p*C),R=y(y(S*f)+y(y(T*u)+y(R*p))),C=m[o+8>>2],M=y((h<_?_:h)+C),S=m[o+4>>2],D=y((v>2],w=y((g>2],F=y(h+_),h=m[s+4>>2],B=y((b>2],N=y(g+c),n=d[e+96>>2],L=((l=(g=f==y(0)?y(0xde0b6b000000000):y(y(1)/f))>2],d[a>>2]=d[n>>2],d[a+4>>2]=l,l=d[n+12>>2],d[a+8>>2]=d[n+8>>2],d[a+12>>2]=l,l=d[n+28>>2],d[a+24>>2]=d[n+24>>2],d[a+28>>2]=l,l=d[n+20>>2],d[a+16>>2]=d[n+16>>2],d[a+20>>2]=l,m[a>>2]=m[a>>2]-T,m[a+4>>2]=m[a+4>>2]-S,m[a+16>>2]=m[a+16>>2]-c,m[a+20>>2]=m[a+20>>2]-h,m[a+8>>2]=m[a+8>>2]-C,m[a+24>>2]=m[a+24>>2]-_,l=0,N>m[n+16>>2]||(l=0,w>2]||(l=1)),A=0,A=M>2]|F>m[n+24>>2]?A:l;t:{i:{n:{r:{if(!(D>2]|B>m[n+20>>2]|1^A||(u=m[i+4>>2],_=y(b*y(m[k>>2]-u)),c=m[i>>2],_>(h=y(v*y(m[j>>2]-c)))||(c=y(v*y(m[G>>2]-c)))>(u=y(b*y(m[U>>2]-u)))||(f=m[i+8>>2],(p=y(g*y(m[L>>2]-f)))>(h=uc?_:c)>(c=y(g*y(m[V>>2]-f))))))){if(A=-1==(0|(I=d[n+32>>2])),1!=(0|(l=(p>_?p:_)y(0)))|-1!=(0|I))break r;r[d[d[t>>2]+8>>2]](t,d[n+36>>2],d[n+40>>2]);break n}A=-1==d[n+32>>2],l=0}if(!A&&!l)break i}E=E+1|0,n=n- -64|0;break t}E=(l=d[n+32>>2])+E|0,n=(l<<6)+n|0}if(P=P+1|0,(0|E)>=d[e+56>>2])break e;_=m[s+8>>2],h=m[s+4>>2],c=m[s>>2],C=m[o+8>>2],S=m[o+4>>2],T=m[o>>2]}d[7309]<(0|P)&&(d[7309]=P),O=a+32|0}function _t(e,t){var i,n=0,o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=0,f=y(0),g=y(0),b=y(0),A=0,C=0,S=0,x=0,T=0,E=0,R=0,P=0,I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=0,N=0,L=0;if((0|(i=d[e+4>>2]))>=1)for(;;){e:if(!((0|(x=(n=x)+1|0))>=(0|i)))for(N=T=(o=d[e+12>>2])+(n<<4)|0,n=x;;){t:if(!((0|(E=n+1|0))>=(0|i)))for(L=R=(n<<4)+o|0,P=E;;){l=m[4+(n=(P<<4)+o|0)>>2],c=m[R>>2],f=m[R+4>>2],g=m[n>>2],b=y(y(l*c)-y(f*g)),h=m[n+8>>2],I=m[R+8>>2],M=y(y(f*h)-y(I*l)),D=y(y(I*g)-y(h*c));i:if(y(y(b*b)+y(y(M*M)+y(D*D)))>y(9999999747378752e-20)&&(a=m[T+4>>2],_=m[T>>2],O=y(y(g*a)-y(l*_)),w=l,l=m[T+8>>2],F=y(y(w*l)-y(h*a)),g=y(y(h*_)-y(g*l)),y(y(O*O)+y(y(F*F)+y(g*g)))>y(9999999747378752e-20)&&(h=y(y(f*_)-y(c*a)),f=y(y(I*a)-y(f*l)),c=y(y(c*l)-y(I*_)),y(y(h*h)+y(y(f*f)+y(c*c)))>y(9999999747378752e-20)&&(a=y(y(l*b)+y(y(a*D)+y(M*_))),y(v(a))>y(9.999999974752427e-7))))){if(a=y(y(-1)/a),_=m[n+12>>2],l=m[N+12>>2],w=y(b*l),b=m[L+12>>2],h=y(a*y(y(h*_)+y(w+y(O*b)))),c=y(a*y(y(c*_)+y(y(D*l)+y(g*b)))),a=y(a*y(y(f*_)+y(y(M*l)+y(F*b)))),n=0,(0|(C=d[e+4>>2]))>0)for(;;){if(y(y(m[12+(p=(n<<4)+o|0)>>2]+y(y(y(a*m[p>>2])+y(c*m[p+4>>2]))+y(h*m[p+8>>2])))+y(-.009999999776482582))>y(0))break i;if((0|C)==(0|(n=n+1|0)))break}if((0|(o=d[t+4>>2]))==d[t+8>>2]&&!((0|o)>=(0|(p=o?o<<1:1)))){if(n=0,C=0,p&&(d[7717]=d[7717]+1,C=0|r[d[6606]](p<<4,16),o=d[t+4>>2]),(0|o)>=1)for(;S=(A=n<<4)+C|0,A=A+d[t+12>>2]|0,B=d[A+4>>2],d[S>>2]=d[A>>2],d[S+4>>2]=B,B=d[A+12>>2],d[S+8>>2]=d[A+8>>2],d[S+12>>2]=B,(0|o)!=(0|(n=n+1|0)););(n=d[t+12>>2])&&(u[t+16|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[t+12>>2]=0),d[t+12>>2]=C,s[t+16|0]=1,d[t+8>>2]=p,o=d[t+4>>2]}n=d[t+12>>2]+(o<<4)|0,d[n+12>>2]=0,m[n+8>>2]=h,m[n+4>>2]=c,m[n>>2]=a,d[t+4>>2]=d[t+4>>2]+1}if((0|(P=P+1|0))>=(0|i))break t;o=d[e+12>>2]}if((0|i)==(0|E))break e;o=d[e+12>>2],n=E}if((0|i)==(0|x))break}}function dt(e,t,i){var n,s,o=0,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0);O=n=O-160|0,a=d[e+4>>2],o=d[a+12>>2],F=m[o+52>>2],B=m[o+56>>2],l=m[o+24>>2],c=m[o+20>>2],h=m[o+40>>2],_=m[o+36>>2],N=m[o+48>>2],u=m[o+8>>2],p=m[o>>2],f=m[o+4>>2],g=m[o+16>>2],v=m[o+32>>2],o=d[d[a+4>>2]+24>>2]+b(i,80)|0,A=m[o+32>>2],C=m[o>>2],S=m[o+16>>2],x=m[o+56>>2],T=m[o+52>>2],E=m[o+48>>2],R=m[o+36>>2],P=m[o+20>>2],I=m[o+4>>2],M=m[o+40>>2],D=m[o+24>>2],w=m[o+8>>2],a=0,d[n+156>>2]=0,d[n+140>>2]=0,d[n+124>>2]=0,m[n+136>>2]=y(y(v*w)+y(_*D))+y(h*M),m[n+132>>2]=y(y(v*I)+y(_*P))+y(h*R),m[n+120>>2]=y(y(g*w)+y(c*D))+y(l*M),m[n+116>>2]=y(y(g*I)+y(c*P))+y(l*R),m[n+152>>2]=B+y(y(y(v*E)+y(_*T))+y(h*x)),m[n+148>>2]=F+y(y(y(g*E)+y(c*T))+y(l*x)),d[n+108>>2]=0,m[n+128>>2]=y(y(v*C)+y(_*S))+y(h*A),m[n+112>>2]=y(y(g*C)+y(c*S))+y(l*A),m[n+96>>2]=y(y(p*C)+y(f*S))+y(u*A),m[n+104>>2]=y(y(p*w)+y(f*D))+y(u*M),m[n+100>>2]=y(y(p*I)+y(f*P))+y(u*R),m[n+144>>2]=N+y(y(y(p*E)+y(f*T))+y(u*x)),r[d[d[t>>2]+8>>2]](t,n+96|0,n+80|0,n- -64|0),o=d[e+8>>2],s=d[o+4>>2],r[d[d[s>>2]+8>>2]](s,d[o+12>>2],n+48|0,n+32|0),(o=d[6995])&&!r[o](d[d[e+8>>2]+4>>2],t)||(a=m[n+64>>2]>2]|m[n+80>>2]>m[n+32>>2]?a:1,o=0,o=m[n+72>>2]>2]|m[n+88>>2]>m[n+40>>2]?o:a,m[n+68>>2]>2]|m[n+84>>2]>m[n+36>>2]|1^o||(o=d[e+4>>2],a=d[o+8>>2],d[n+24>>2]=-1,d[n+16>>2]=a,d[n+12>>2]=t,d[n+8>>2]=o,d[n+28>>2]=i,d[n+20>>2]=n+96,d[(t=i<<2)+d[e+24>>2]>>2]||(o=d[e+12>>2],o=0|r[d[d[o>>2]+8>>2]](o,n+8|0,d[e+8>>2],d[e+28>>2]),d[t+d[e+24>>2]>>2]=o,o=d[e+4>>2]),a=d[e+20>>2],t=d[a+8>>2],d[t+8>>2]!=d[o+8>>2]?(t=d[a+12>>2],d[a+12>>2]=n+8,r[d[d[a>>2]+12>>2]](a,-1,i)):(d[a+8>>2]=n+8,r[d[d[a>>2]+8>>2]](a,-1,i)),i=d[d[e+24>>2]+(i<<2)>>2],r[d[d[i>>2]+8>>2]](i,n+8|0,d[e+8>>2],d[e+16>>2],d[e+20>>2]),i=d[e+20>>2],d[(d[d[i+8>>2]+8>>2]==d[d[e+4>>2]+8>>2]?8:12)+i>>2]=t)),O=n+160|0}function ut(e,t,i,n){var o=0,a=0,l=0,c=0,h=0,_=0,p=0,f=0,g=0,b=0;if(!(!t|!i)){if(!(d[e+24>>2]>127|d[e+28>>2]>127)){if(d[7717]=d[7717]+1,o=0|r[d[6606]](1024,16),(0|(h=d[e+24>>2]))>=1)for(;c=(a=l<<3)+o|0,a=a+d[e+32>>2]|0,_=d[a+4>>2],d[c>>2]=d[a>>2],d[c+4>>2]=_,(0|h)!=(0|(l=l+1|0)););(h=d[e+32>>2])&&(u[e+36|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+32>>2]=0),d[e+32>>2]=o,d[e+28>>2]=128,s[e+36|0]=1}for(d[e+24>>2]=128,o=d[e+32>>2],d[o+4>>2]=i,d[o>>2]=t,t=124,o=1;;){if(i=d[e+32>>2],h=o,c=d[4+(a=i+(_=(o=o+-1|0)<<3)|0)>>2],a=d[a>>2],(0|o)>(0|t)){if(!((0|(l=d[e+24>>2]))>=(0|(t=l<<1))|d[e+28>>2]>=(0|t))){if(l){if(d[7717]=d[7717]+1,i=0|r[d[6606]](l<<4,16),l=0,!((0|(f=d[e+24>>2]))<1))for(;g=(p=l<<3)+i|0,p=d[e+32>>2]+p|0,b=d[p+4>>2],d[g>>2]=d[p>>2],d[g+4>>2]=b,(0|f)!=(0|(l=l+1|0)););}else i=0;(l=d[e+32>>2])&&(u[e+36|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+32>>2]=0),d[e+32>>2]=i,s[e+36|0]=1,d[e+28>>2]=t}d[e+24>>2]=t,t=t+-4|0}e:if((0|a)!=(0|c)){if(!(m[a>>2]<=m[c+16>>2]^1|m[a+16>>2]>=m[c>>2]^1|m[a+4>>2]<=m[c+20>>2]^1|m[a+20>>2]>=m[c+4>>2]^1||m[a+8>>2]<=m[c+24>>2]^1|m[a+24>>2]>=m[c+8>>2]^1))if(l=d[c+40>>2],d[a+40>>2]){if(o=d[a+36>>2],l){d[4+(i=i+_|0)>>2]=d[c+36>>2],d[i>>2]=o,o=d[a+40>>2],l=(i=h<<3)+d[e+32>>2]|0,d[l+4>>2]=d[c+36>>2],d[l>>2]=o,o=d[a+36>>2],l=i+d[e+32>>2]|0,d[l+12>>2]=d[c+40>>2],d[l+8>>2]=o,o=d[a+40>>2],i=i+d[e+32>>2]|0,d[i+20>>2]=d[c+40>>2],d[i+16>>2]=o,o=h+3|0;break e}d[4+(i=i+_|0)>>2]=c,d[i>>2]=o,i=d[a+40>>2],o=d[e+32>>2]+(h<<3)|0,d[o+4>>2]=c,d[o>>2]=i,o=h+1|0}else l?(d[4+(i=i+_|0)>>2]=d[c+36>>2],d[i>>2]=a,i=d[e+32>>2]+(h<<3)|0,d[i+4>>2]=d[c+40>>2],d[i>>2]=a,o=h+1|0):r[d[d[n>>2]+8>>2]](n,a,c)}else{if(!d[a+40>>2])break e;i=i+_|0,o=d[a+36>>2],d[i+4>>2]=o,d[i>>2]=o,o=(i=h<<3)+d[e+32>>2]|0,c=d[a+40>>2],d[o+4>>2]=c,d[o>>2]=c,o=d[a+40>>2],i=i+d[e+32>>2]|0,d[i+8>>2]=d[a+36>>2],d[i+12>>2]=o,o=h+2|0}if(!o)break}}}function pt(e,t){var i,n,r,s,o,a=y(0),l=0,c=0,h=y(0),_=0,u=y(0),p=y(0),f=0,g=y(0),b=y(0),v=y(0);for(O=i=O-144|0,a=m[e+20>>2],h=y(y(y(d[t+256>>2])*y(3))*a),b=y(a*y(y(d[t+264>>2])*y(3))),v=y(a*y(y(d[t+260>>2])*y(3))),r=i+104|0,s=i+80|4,o=n=i+124|0;;){for(u=y(b+y(a*y(0|_))),c=0;d[i+20>>2]=0,m[i+16>>2]=u,m[i+8>>2]=h+y(a*y(0)),p=y(v+y(a*y(0|c))),m[i+12>>2]=p,l=d[t+276>>2],d[i+80>>2]=1065353216,d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=0,d[s+4>>2]=0,d[i+100>>2]=1065353216,d[r+8>>2]=0,d[r+12>>2]=0,d[r>>2]=0,d[r+4>>2]=0,d[i+120>>2]=1065353216,d[o+16>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,d[n>>2]=0,d[n+4>>2]=0,d[l+4>>2]>19?a=y(0):(a=J(i+8|0,l,i+80|0,i+24|0),l=d[t+276>>2]),m[(f=((c<<4)+t|0)+(_<<2)|0)>>2]=a,a=m[e+20>>2],d[i+20>>2]=0,m[i+16>>2]=u,m[i+12>>2]=p,m[i+8>>2]=h+a,d[i+80>>2]=1065353216,d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=0,d[s+4>>2]=0,d[i+100>>2]=1065353216,d[r+8>>2]=0,d[r+12>>2]=0,d[r>>2]=0,d[r+4>>2]=0,d[i+120>>2]=1065353216,d[o+16>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,d[n>>2]=0,d[n+4>>2]=0,d[l+4>>2]<=19&&(g=J(i+8|0,l,i+80|0,i+24|0),l=d[t+276>>2]),m[f- -64>>2]=g,a=m[e+20>>2],d[i+20>>2]=0,m[i+16>>2]=u,m[i+12>>2]=p,m[i+8>>2]=h+y(a+a),d[i+80>>2]=1065353216,d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=0,d[s+4>>2]=0,d[i+100>>2]=1065353216,d[r+8>>2]=0,d[r+12>>2]=0,d[r>>2]=0,d[r+4>>2]=0,d[i+120>>2]=1065353216,d[o+16>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,d[n>>2]=0,d[n+4>>2]=0,g=y(0),d[l+4>>2]>19?a=y(0):(a=J(i+8|0,l,i+80|0,i+24|0),l=d[t+276>>2]),m[f+128>>2]=a,a=m[e+20>>2],d[i+20>>2]=0,m[i+16>>2]=u,m[i+12>>2]=p,m[i+8>>2]=h+y(a*y(3)),d[i+80>>2]=1065353216,d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=0,d[s+4>>2]=0,d[i+100>>2]=1065353216,d[r+8>>2]=0,d[r+12>>2]=0,d[r>>2]=0,d[r+4>>2]=0,d[i+120>>2]=1065353216,d[o+16>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,d[n>>2]=0,d[n+4>>2]=0,a=d[l+4>>2]<=19?J(i+8|0,l,i+80|0,i+24|0):y(0),m[f+192>>2]=a,4!=(0|(c=c+1|0));)a=m[e+20>>2];if(4==(0|(_=_+1|0)))break;a=m[e+20>>2]}O=i+144|0}function ft(e,t,i,n,o,a,l,c){var h,_=y(0),p=y(0),f=y(0),g=0,v=0,A=y(0),C=0,S=0,T=0,E=0,R=y(0),P=0,I=0,M=0,D=0,w=y(0),F=y(0),B=0,N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=0;if(O=h=O-48|0,_=m[e+8>>2],p=m[e>>2],f=m[e+4>>2],d[h+44>>2]=d[e+12>>2],A=_,_=y(y(1)/y(x(y(y(y(p*p)+y(f*f))+y(_*_))))),R=y(A*_),m[h+40>>2]=R,w=y(f*_),m[h+36>>2]=w,F=y(p*_),m[h+32>>2]=F,g=d[i+36>>2],(0|(C=d[i+28>>2]))<1)T=-1;else for(N=m[o+40>>2],L=m[o+36>>2],k=m[o+24>>2],V=m[o+20>>2],U=m[o+32>>2],G=m[o+16>>2],j=m[o+8>>2],W=m[o+4>>2],z=m[o>>2],e=0,_=y(-34028234663852886e22),T=-1;v=g+b(e,36)|0,p=m[v+20>>2],f=m[v+24>>2],A=m[v+28>>2],_=(v=(p=y(y(y(F*y(y(y(p*z)+y(f*W))+y(A*j)))+y(w*y(y(y(p*G)+y(f*V))+y(A*k))))+y(R*y(y(y(p*U)+y(f*L))+y(A*N)))))>_)?p:_,T=v?e:T,(0|C)!=(0|(e=e+1|0)););d[h+20>>2]=0,d[h+12>>2]=0,d[h+16>>2]=0,s[h+24|0]=1;e:if(!((0|(B=d[4+(g+b(T,36)|0)>>2]))<1))for(H=g+b(T,36)|0,g=0,C=0;;){if(e=d[i+16>>2]+(d[d[H+12>>2]+(I<<2)>>2]<<4)|0,_=m[e>>2],p=m[e+4>>2],f=m[e+8>>2],A=y(y(y(y(_*m[o+32>>2])+y(p*m[o+36>>2]))+y(f*m[o+40>>2]))+m[o+56>>2]),R=y(y(y(y(_*m[o+16>>2])+y(p*m[o+20>>2]))+y(f*m[o+24>>2]))+m[o+52>>2]),_=y(y(y(y(_*m[o>>2])+y(p*m[o+4>>2]))+y(f*m[o+8>>2]))+m[o+48>>2]),(0|g)==(0|C)&&!((0|g)>=(0|(P=g?g<<1:1)))){e=0,M=0,P&&(d[7717]=d[7717]+1,M=0|r[d[6606]](P<<4,16)),v=d[h+20>>2];t:{i:{if((0|g)>=1)for(;;)if(E=(S=e<<4)+M|0,D=d[4+(S=v+S|0)>>2],d[E>>2]=d[S>>2],d[E+4>>2]=D,D=d[S+12>>2],d[E+8>>2]=d[S+8>>2],d[E+12>>2]=D,(0|g)==(0|(e=e+1|0)))break i;if(!v)break t}u[h+24|0]&&v&&(d[7718]=d[7718]+1,r[d[6607]](v)),d[h+20>>2]=0}d[h+20>>2]=M,s[h+24|0]=1,d[h+16>>2]=P}if(e=d[h+20>>2]+(C<<4)|0,d[e+12>>2]=0,m[e+8>>2]=A,m[e+4>>2]=R,m[e>>2]=_,C=d[h+12>>2]+1|0,d[h+12>>2]=C,(0|B)==(0|(I=I+1|0)))break e;g=d[h+16>>2]}(0|T)>-1&&ge(h+32|0,t,n,h+8|0,a,l,c),(e=d[h+20>>2])&&(u[h+24|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[h+20>>2]=0),O=h+48|0}function mt(e,t,i,n,r,s){var o,a,l,c,h,_,u,p,f,g,b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0);if(o=O-16|0,A=m[n>>2],b=m[i>>2],C=y(y(A+b)*y(.5)),v=y(m[t>>2]-C),A=y(A-b),a=v>(M=y(A*y(.5))),l=v<(A=y(A*y(-.5))),b=m[n+4>>2],S=m[i+4>>2],x=y(y(b+S)*y(.5)),R=y(m[t+4>>2]-x),b=y(b-S),c=R<(T=y(b*y(-.5))),h=R>(S=y(b*y(.5))),b=m[n+8>>2],E=m[i+8>>2],I=y(y(b+E)*y(.5)),P=y(m[t+8>>2]-I),b=y(b-E),!((t=l|a<<3|c<<1|h<<4|(n=P<(D=y(b*y(-.5))))<<2|(P>(E=y(b*y(.5))))<<5)&(g=(_=(C=y(m[e>>2]-C))M)<<3|(u=(x=y(m[e+4>>2]-x))S)<<4|(f=(T=y(m[e+8>>2]-I))E)<<5))){A=m[r>>2],d[o+8>>2]=0,d[o+12>>2]=0,d[o>>2]=0,d[o+4>>2]=0,I=y(v-C),b=y(-C),e=4|o;e:if(_){if(!((v=y(y(b-M)/I))>=y(0))){v=y(0);break e}d[e>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[o>>2]=1065353216}else v=y(0),l&&(b=y(y(b-M)/I))>2]=0,d[o+12>>2]=0,d[o>>2]=0,d[o+4>>2]=0,d[o+4>>2]=1065353216;break e}c&&(b=y(y(b-S)/R))>2]=0,d[o+12>>2]=0,d[o+8>>2]=1065353216,d[o>>2]=0,d[o+4>>2]=0;break e}n&&(v=y(y(v-E)/P))>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[o>>2]=-1082130432;break e}a&&(b=y(y(M-C)/I))>2]=0,d[o+12>>2]=0,d[o>>2]=0,d[o+4>>2]=0,d[o+4>>2]=-1082130432;break e}h&&(v=y(y(S-x)/R))>2]=0,d[o+12>>2]=0,d[o+8>>2]=-1082130432,d[o>>2]=0,d[o+4>>2]=0;break e}32&t&&(b=y(y(E-T)/P))>2]=b,e=d[o+12>>2],d[s+8>>2]=d[o+8>>2],d[s+12>>2]=e,e=d[o+4>>2],d[s>>2]=d[o>>2],d[s+4>>2]=e,1}return 0}function gt(e){var t=0;d[e+288>>2]=0,d[e+292>>2]=1065353216,d[e+236>>2]=8,_[e+472>>1]=0,d[e+296>>2]=0,d[e+300>>2]=0,d[e+304>>2]=0,d[e+308>>2]=0,d[e+312>>2]=0,d[e+476>>2]=0,d[e+388>>2]=1,d[e+380>>2]=0,d[e+384>>2]=4,d[e+372>>2]=0,d[e+376>>2]=1,d[e+364>>2]=1065353216,d[e+368>>2]=1065353216,d[e+356>>2]=1056964608,d[e+360>>2]=1056964608,d[e+348>>2]=1056964608,d[e+352>>2]=1056964608,d[e+340>>2]=1036831949,d[e+344>>2]=1065353216,d[e+332>>2]=1065353216,d[e+336>>2]=1060320051,d[e+324>>2]=1065353216,d[e+328>>2]=1036831949,d[e+316>>2]=1045220557,d[e+320>>2]=0,d[e+528>>2]=0,d[e+532>>2]=0,d[e+520>>2]=0,d[e+524>>2]=0,d[e+540>>2]=0,d[e+544>>2]=0,d[e+536>>2]=1065353216,d[e+548>>2]=0,d[e+552>>2]=0,d[e+560>>2]=0,d[e+564>>2]=0,d[e+556>>2]=1065353216,d[e+568>>2]=0,d[e+572>>2]=0,d[e+584>>2]=1065353216,d[e+576>>2]=1065353216,d[e+580>>2]=0,d[e+588>>2]=0,d[e+592>>2]=0,d[e+596>>2]=0,d[e+600>>2]=0,d[e+608>>2]=0,d[e+612>>2]=0,d[e+604>>2]=1065353216,d[e+616>>2]=0,d[e+620>>2]=0,s[e+924|0]=1,d[e+624>>2]=1065353216,d[e+628>>2]=0,d[e+888>>2]=0,d[e+680>>2]=0,d[e+916>>2]=0,d[e+920>>2]=0,d[e+908>>2]=0,d[e+912>>2]=0,d[e+900>>2]=0,d[e+904>>2]=0,d[e+892>>2]=0,d[e+896>>2]=0,d[e+16>>2]=0,d[e+20>>2]=0,d[e+4>>2]=1065353216,d[e+8>>2]=0,d[e+12>>2]=0,d[e+36>>2]=0,d[e+40>>2]=0,d[e+24>>2]=1065353216,d[e+28>>2]=0,d[e+32>>2]=0,d[e- -64>>2]=0,d[e+44>>2]=1065353216,d[e+56>>2]=0,d[e+60>>2]=0,d[e+48>>2]=0,d[e+52>>2]=0,function(e){var t,i,n=0,o=0,a=0,l=0,c=0;if((n=d[e+404>>2])&&(u[e+408|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+404>>2]=0),d[e+404>>2]=0,s[e+408|0]=1,d[e+396>>2]=0,d[e+400>>2]=0,(n=d[e+424>>2])&&(u[e+428|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+424>>2]=0),d[e+424>>2]=0,s[e+428|0]=1,i=t=e,d[t+416>>2]=0,d[t+420>>2]=0,(e=d[t+444>>2])&&(u[t+448|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[t+444>>2]=0),d[t+444>>2]=0,s[t+448|0]=1,d[t+436>>2]=0,d[t+440>>2]=0,(0|(e=d[t+416>>2]))==(0|(o=d[t+420>>2])))if((0|e)>=(0|(o=e?e<<1:1)))o=e;else{o&&(d[7717]=d[7717]+1,l=0|r[d[6606]](o<<2,16),e=d[t+416>>2]),n=d[t+424>>2];e:{t:{if((0|e)>=1)for(;;)if(d[(c=a<<2)+l>>2]=d[n+c>>2],(0|(a=a+1|0))==(0|e))break t;if(!n)break e}u[t+428|0]&&(n&&(d[7718]=d[7718]+1,r[d[6607]](n)),e=d[t+416>>2]),d[t+424>>2]=0}d[t+424>>2]=l,s[t+428|0]=1,d[t+420>>2]=o}if(n=d[t+424>>2],d[n+(e<<2)>>2]=1,a=e+1|0,d[t+416>>2]=a,(0|o)==(0|a))if((0|o)>=(0|(l=o?o<<1:1)))e=n,l=o;else{a=0,e=0,l&&(d[7717]=d[7717]+1,e=0|r[d[6606]](l<<2,16),o=d[t+416>>2],n=d[t+424>>2]);e:{t:{if((0|o)>=1)for(;;)if(d[(c=a<<2)+e>>2]=d[n+c>>2],(0|(a=a+1|0))==(0|o))break t;if(!n)break e}u[t+428|0]&&(n&&(d[7718]=d[7718]+1,r[d[6607]](n)),o=d[t+416>>2]),d[t+424>>2]=0}d[t+424>>2]=e,s[t+428|0]=1,d[t+420>>2]=l}else e=n,l=o,o=a;if(d[(o<<2)+e>>2]=2,o=o+1|0,d[t+416>>2]=o,(0|o)==(0|l))if((0|l)>=(0|(a=l?l<<1:1)))n=e,a=l;else{o=0,n=0,a&&(d[7717]=d[7717]+1,n=0|r[d[6606]](a<<2,16),l=d[t+416>>2],e=d[t+424>>2]);e:{t:{if((0|l)>=1)for(;;)if(d[(c=o<<2)+n>>2]=d[e+c>>2],(0|l)==(0|(o=o+1|0)))break t;if(!e)break e}u[t+428|0]&&(e&&(d[7718]=d[7718]+1,r[d[6607]](e)),l=d[t+416>>2]),d[t+424>>2]=0}d[t+424>>2]=n,s[t+428|0]=1,d[t+420>>2]=a}else n=e,a=l,l=o;if(d[(l<<2)+n>>2]=3,e=l+1|0,d[t+416>>2]=e,(0|e)==(0|a))if((0|a)>=(0|(e=a?a<<1:1)))l=n;else{o=0,l=0,e&&(d[7717]=d[7717]+1,l=0|r[d[6606]](e<<2,16),a=d[t+416>>2],n=d[t+424>>2]);e:{t:{if((0|a)>=1)for(;;)if(d[(c=o<<2)+l>>2]=d[n+c>>2],(0|a)==(0|(o=o+1|0)))break t;if(!n)break e}u[t+428|0]&&(n&&(d[7718]=d[7718]+1,r[d[6607]](n)),a=d[t+416>>2]),d[t+424>>2]=0}d[t+424>>2]=l,s[t+428|0]=1,d[t+420>>2]=e}else l=n,a=e;d[(a<<2)+l>>2]=0,d[i+416>>2]=a+1}(e),d[7717]=d[7717]+1,t=0|r[d[6606]](20,16),d[t+4>>2]=35,d[t+8>>2]=0,d[t+12>>2]=0,d[t>>2]=14720,d[t+16>>2]=e,d[t+4>>2]=32,d[t>>2]=21516,d[e+192>>2]=t,d[t+12>>2]=1048576e3,d[(t=e+1152|0)>>2]=0,d[t+4>>2]=0,d[e+1148>>2]=1065353216,d[(t=e+1160|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1172|0)>>2]=0,d[t+4>>2]=0,d[e+1168>>2]=1065353216,d[(t=e+1180|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1192|0)>>2]=0,d[t+4>>2]=0,d[e+1188>>2]=1065353216,d[(t=e+1200|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1208|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1216|0)>>2]=0,d[t+4>>2]=0,d[(e=e+1224|0)>>2]=0,d[e+4>>2]=1065353216}function bt(e,t,i,n,o,a,l,c,h){var _,p=0,f=0,g=y(0),b=0,v=0,A=0,C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=0,P=0,I=y(0),M=0;if(O=_=O-32|0,t){if((0|(p=d[e+44>>2]))<=127){if(d[e+48>>2]<=127){if(d[7717]=d[7717]+1,b=0|r[d[6606]](512,16),(0|(A=d[e+44>>2]))>=1)for(;d[(f=v<<2)+b>>2]=d[f+d[e+52>>2]>>2],(0|A)!=(0|(v=v+1|0)););(v=d[e+52>>2])&&(u[e+56|0]&&v&&(d[7718]=d[7718]+1,r[d[6607]](v)),d[e+52>>2]=0),d[e+52>>2]=b,d[e+48>>2]=128,s[e+56|0]=1}for(;d[d[e+52>>2]+(p<<2)>>2]=0,128!=(0|(p=p+1|0)););}for(d[e+44>>2]=128,d[d[e+52>>2]>>2]=t,p=126,v=1;;){if(A=d[e+52>>2],b=d[A+(P=(t=v+-1|0)<<2)>>2],C=m[b>>2],S=m[b+4>>2],g=m[b+8>>2],x=m[c>>2],T=m[c+4>>2],E=m[c+8>>2],d[_+12>>2]=0,m[_+8>>2]=g-E,m[_+4>>2]=S-T,m[_>>2]=C-x,C=m[b+16>>2],S=m[b+20>>2],g=m[b+24>>2],x=m[l>>2],T=m[l+4>>2],E=m[l+8>>2],d[_+28>>2]=0,m[_+24>>2]=g-E,m[_+20>>2]=S-T,m[_+16>>2]=C-x,f=d[o+4>>2],x=m[i+4>>2],T=m[n+4>>2],C=y(y(m[4+((f<<4)+_|0)>>2]-x)*T),g=m[n>>2],R=d[o>>2],E=m[i>>2],!(C>(S=y(g*y(m[(1-R<<4)+_>>2]-E)))||(g=y(y(m[(R<<4)+_>>2]-E)*g))>(x=y(T*y(m[4+((1-f<<4)+_|0)>>2]-x)))||(f=d[o+8>>2],E=m[i+8>>2],I=m[n+8>>2],(T=y(y(m[8+((f<<4)+_|0)>>2]-E)*I))>(S=xg?C:g)>(g=y(I*y(m[8+((1-f<<4)+_|0)>>2]-E)))|(T>C?T:C)y(0)^1)))if(d[b+40>>2]){if((0|t)>(0|p)){if((0|(p=d[e+44>>2]))<(0|(f=p<<1))){if(d[e+48>>2]<(0|f)){if(p){if(d[7717]=d[7717]+1,A=0|r[d[6606]](p<<3,16),t=0,!((0|(R=d[e+44>>2]))<1))for(;d[(M=t<<2)+A>>2]=d[d[e+52>>2]+M>>2],(0|R)!=(0|(t=t+1|0)););}else A=0;(t=d[e+52>>2])&&(u[e+56|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+52>>2]=0),d[e+52>>2]=A,s[e+56|0]=1,d[e+48>>2]=f}for(;d[(p<<2)+A>>2]=0,A=d[e+52>>2],(0|f)!=(0|(p=p+1|0)););}d[e+44>>2]=f,p=f+-2|0}d[A+P>>2]=d[b+36>>2],d[d[e+52>>2]+(v<<2)>>2]=d[b+40>>2],t=v+1|0}else r[d[d[h>>2]+12>>2]](h,b);if(v=t,!t)break}}O=_+32|0}function yt(e,t,i,n,s,o){var a,l=y(0),c=0,h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=0,C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=0,I=y(0),M=y(0),D=y(0),w=y(0),F=0;O=a=O-32|0,c=d[e+4>>2],R=y(m[c+28>>2]*m[c+12>>2]),l=y(R+o),h=m[t+8>>2],c=d[e+8>>2],o=m[c- -64>>2],S=y(h-o),_=m[c+56>>2],v=y(m[c+72>>2]-_),b=m[c+60>>2],f=y(m[c+92>>2]-b),u=y(m[c+76>>2]-b),g=y(m[c+88>>2]-_),C=p=y(y(v*f)-y(u*g)),T=y(p*p),p=y(m[c+96>>2]-o),E=y(u*p),u=y(m[c+80>>2]-o),o=y(E-y(u*f)),u=y(y(u*g)-y(v*p)),g=y(y(1)/y(x(y(T+y(y(o*o)+y(u*u)))))),p=y(C*g),f=m[t>>2],v=y(o*g),o=y(y(f-_)*v),_=m[t+4>>2],C=y(_-b),b=y(u*g),(o=y(y(S*p)+y(o+y(C*b))))>2],d[a+24>>2]=d[t+8>>2],d[a+28>>2]=P,P=d[t+4>>2],d[a+16>>2]=d[t>>2],d[a+20>>2]=P,d[a+12>>2]=0,m[a+8>>2]=p,m[a+4>>2]=b,m[a>>2]=v,function(e,t,i){var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),d=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0);return h=m[e+40>>2],l=m[e+24>>2],u=y(h-l),_=m[i+8>>2],f=m[e+32>>2],r=m[e+16>>2],a=y(f-r),s=m[t+4>>2],g=m[e+36>>2],c=m[e+20>>2],o=y(g-c),d=m[t>>2],p=y(y(_-l)*y(y(a*s)-y(o*d))),b=m[i>>2],n=o,o=m[t+8>>2],v=m[i+4>>2],u=y(p+y(y(y(b-r)*y(y(n*o)-y(u*s)))+y(y(v-c)*y(y(u*d)-y(a*o))))),n=l,l=m[e+8>>2],a=y(n-l),n=r,r=m[e>>2],p=y(n-r),n=c,c=m[e+4>>2],n=y(n-c),a=y(y(y(_-l)*y(y(p*s)-y(n*d)))+y(y(y(b-r)*y(y(n*o)-y(a*s)))+y(y(v-c)*y(y(a*d)-y(p*o))))),e=1,n=y(_-h),_=y(r-f),r=y(c-g),h=y(l-h),s=y(y(n*y(y(_*s)-y(r*d)))+y(y(y(b-f)*y(y(r*o)-y(h*s)))+y(y(v-g)*y(y(h*d)-y(_*o))))),u>y(0)&&!(s>y(0)^1|a>y(0)^1)||(e=a<=y(0)&u<=y(0)&s<=y(0)),e}(c+56|0,a,a+16|0))I=y(h-y(o*p)),M=y(_-y(o*b)),D=y(f-y(o*v)),C=y(l*l);else{if((0|r[d[d[c>>2]+100>>2]](c))<1)break e;for(C=y(l*l),c=0;A=d[e+8>>2],r[d[d[A>>2]+104>>2]](A,c,a+16|0,a),l=y(0),S=m[a+16>>2],o=y(m[t>>2]-S),f=y(m[a>>2]-S),T=m[a+20>>2],_=y(m[t+4>>2]-T),u=y(m[a+4>>2]-T),E=m[a+24>>2],h=y(m[t+8>>2]-E),g=y(m[a+8>>2]-E),(w=y(y(y(o*f)+y(_*u))+y(h*g)))>y(0)&&(w<(l=y(y(y(f*f)+y(u*u))+y(g*g)))?(l=y(w/l),h=y(h-y(g*l)),_=y(_-y(u*l)),o=y(o-y(f*l))):(h=y(h-g),_=y(_-u),o=y(o-f),l=y(1))),y(y(y(o*o)+y(_*_))+y(h*h))>2],(0|c)<(0|r[d[d[A>>2]+100>>2]](A)););if(A=0,!F)break e;h=m[t+8>>2],_=m[t+4>>2],f=m[t>>2]}o=y(f-D),_=y(_-M),h=y(h-I),(l=y(y(y(o*o)+y(_*_))+y(h*h)))y(1.1920928955078125e-7)?(d[n+12>>2]=0,p=h,l=y(x(l)),h=y(y(1)/l),m[n+8>>2]=p*h,m[n+4>>2]=_*h,m[n>>2]=o*h,R=y(R-l)):(d[n+12>>2]=0,m[n+8>>2]=p,m[n+4>>2]=b,m[n>>2]=v),d[i+12>>2]=0,m[i+8>>2]=I,m[i+4>>2]=M,m[i>>2]=D,m[s>>2]=-R,A=1)}return O=a+32|0,A}function vt(e,t){var i,n,s=0,o=0,a=y(0),l=0,c=0,h=0,_=0,u=y(0),p=y(0),f=0,g=y(0),v=0,A=y(0),C=0,S=0,x=y(0),T=y(0),E=0,R=0,P=y(0),I=y(0),M=y(0),D=0,O=0,w=0,F=y(0);yr(21087),(0|(i=d[e+712>>2]))<1||(d[7717]=d[7717]+1,s=i<<4,Mn(c=0|r[d[6606]](s,16),0,s),(0|(s=d[e+712>>2]))<1||(d[7717]=d[7717]+1,s<<=2,Mn(h=0|r[d[6606]](s,16),0,s))),n=d[e+1112>>2];e:{if(t){if((0|n)<1)break e;for(_=d[e+1120>>2];s=d[_+(o<<2)>>2],(l=d[s+312>>2])&&(a=y(y(1)/y(0|l)),m[s+276>>2]=a*m[s+276>>2],m[s+280>>2]=a*m[s+280>>2],m[s+284>>2]=a*m[s+284>>2],m[s+292>>2]=a*m[s+292>>2],m[s+296>>2]=a*m[s+296>>2],m[s+300>>2]=a*m[s+300>>2]),(0|n)!=(0|(o=o+1|0)););}if(!((0|n)<1))for(E=d[e+1120>>2],_=0,R=t?312:308;;){if(s=d[(_<<2)+E>>2],!(d[s+R>>2]<1||(0|(v=d[s+24>>2]))<1))for(a=m[e+452>>2],u=y(a*m[8+(o=t?s+292|0:s+260|0)>>2]),p=y(a*m[o+4>>2]),A=y(a*m[o>>2]),P=y(a*m[8+(o=t?s+276|0:s+244|0)>>2]),I=y(a*m[o+4>>2]),M=y(m[o>>2]*a),D=d[s+32>>2],O=d[s+12>>2],w=d[e+720>>2],l=0;f=d[(C=l<<2)+D>>2],g=m[f+8>>2],F=m[s+228>>2],o=((S=(f-w|0)/104|0)<<4)+c|0,a=m[O+C>>2],x=y(m[f+16>>2]-m[s+236>>2]),T=y(m[f+12>>2]-m[s+232>>2]),m[o>>2]=m[o>>2]+y(a*y(M+y(y(p*x)-y(u*T)))),g=y(g-F),m[o+4>>2]=m[o+4>>2]+y(a*y(I+y(y(u*g)-y(A*x)))),m[o+8>>2]=y(a*y(P+y(y(A*T)-y(p*g))))+m[o+8>>2],m[(o=(S<<2)+h|0)>>2]=a+m[o>>2],(0|v)!=(0|(l=l+1|0)););if((0|n)==(0|(_=_+1|0)))break}}e:{if((0|i)>=1)for(t=0;(a=m[(t<<2)+h>>2])>y(0)&&(u=m[8+(o=(t<<4)+c|0)>>2],p=m[o+4>>2],s=d[e+720>>2]+b(t,104)|0,a=y(y(1)/a),m[s+8>>2]=y(a*m[o>>2])+m[s+8>>2],m[s+12>>2]=y(a*p)+m[s+12>>2],m[s+16>>2]=y(a*u)+m[s+16>>2]),(0|i)!=(0|(t=t+1|0)););else if(!h)break e;h&&(d[7718]=d[7718]+1,r[d[6607]](h))}c&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),As()}function At(e,t,i,n){var s,o=0,a=y(0),l=y(0),c=y(0),h=0,_=y(0),u=y(0),p=0,f=y(0),g=y(0),b=0,v=0,A=0,C=y(0),S=0,T=y(0),E=y(0),R=0,P=0,I=0,M=0,D=0,w=0;if(O=s=O-32|0,e){for(a=m[t+8>>2],l=m[i+8>>2],_=m[t>>2],f=m[i>>2],c=m[t+4>>2],g=m[i+4>>2],d[7717]=d[7717]+1,Mn(4+(i=0|r[d[6606]](512,16))|0,0,508),d[i>>2]=e,C=u=y(l-a),a=y(f-_),l=y(g-c),_=y(y(1)/y(x(y(y(y(a*a)+y(l*l))+y(u*u))))),u=y(u*_),c=a,a=y(a*_),f=l,l=y(l*_),E=y(y(C*u)+y(y(c*a)+y(f*l))),R=((e=(u=u==y(0)?y(0xde0b6b000000000):y(y(1)/u))>2],h=d[p+4>>2],d[s>>2]=d[p>>2],d[s+4>>2]=h,h=d[p+12>>2],d[s+8>>2]=d[p+8>>2],d[s+12>>2]=h,h=d[p+28>>2],d[s+24>>2]=d[p+24>>2],d[s+28>>2]=h,h=d[p+20>>2],d[s+16>>2]=d[p+16>>2],d[s+20>>2]=h;e:{t:{i:{n:{r:{s:{if(g=m[t+4>>2],_=y(l*y(m[P>>2]-g)),c=m[t>>2],!(_>(f=y(a*y(m[w>>2]-c)))||(c=y(a*y(m[D>>2]-c)))>(g=y(l*y(m[M>>2]-g)))||(T=m[t+8>>2],(C=y(u*y(m[R>>2]-T)))>(f=gc?_:c)>(c=y(u*y(m[I>>2]-T)))|(C>_?C:_)y(0)^1))){if(d[p+40>>2]){if((0|o)<=(0|v)){o=i;break t}if((0|b)>=(0|(h=b<<1))){o=i;break i}if((0|A)>=(0|h)){o=i;break n}if(!b){o=0;break s}if(v=0,d[7717]=d[7717]+1,o=0|r[d[6606]](b<<3,16),(0|b)<1)break s;for(;d[(A=v<<2)+o>>2]=d[i+A>>2],(0|(v=v+1|0))!=(0|b););break r}r[d[d[n>>2]+12>>2]](n,p)}e=o;break e}if(A=h,!i)break n}i&&(d[7718]=d[7718]+1,r[d[6607]](i)),A=h}Mn((i=b<<2)+o|0,0,i)}v=h+-2|0,i=o,b=h}d[o+S>>2]=d[p+36>>2],d[(e<<2)+o>>2]=d[p+40>>2],e=e+1|0}if(!e)break}i&&i&&(d[7718]=d[7718]+1,r[d[6607]](i))}O=s+32|0}function Ct(e,t,i,n){var o,a,l=0,c=0,h=0,_=0,p=0,f=0,m=0,g=0,b=0,y=0,v=0;if(O=a=O-16|0,at(e,t,i),o=d[e+8>>2],yr(17920),u[e+64|0]){if((0|(f=d[e+28>>2]))>=2&&On(e+24|0,a+8|0,0,f+-1|0),!((0|o)<1))for(_=1;;){t=d[e+16>>2],b=d[t+(p<<3)>>2],y=1;e:if(!((0|p)>=(0|o)))for(;;){if(g=d[d[i+16>>2]+(d[4+((p<<3)+t|0)>>2]<<2)>>2],(0|(l=d[e+48>>2]))==d[e+52>>2]&&!((0|l)>=(0|(h=l?l<<1:1)))){if(t=0,c=0,h&&(d[7717]=d[7717]+1,c=0|r[d[6606]](h<<2,16),l=d[e+48>>2]),(0|l)>=1)for(;d[(v=t<<2)+c>>2]=d[v+d[e+56>>2]>>2],(0|l)!=(0|(t=t+1|0)););(t=d[e+56>>2])&&(u[e+60|0]&&(t&&(d[7718]=d[7718]+1,r[d[6607]](t)),l=d[e+48>>2]),d[e+56>>2]=0),d[e+56>>2]=c,s[e+60|0]=1,d[e+52>>2]=h}if(d[d[e+56>>2]+(l<<2)>>2]=g,d[e+48>>2]=l+1,y&=2==(0|(t=d[g+216>>2]))|5==(0|t),(0|o)==(0|(p=p+1|0))){p=o;break e}if(t=d[e+16>>2],d[t+(p<<3)>>2]!=(0|b))break}if(c=0,t=0,!((0|m)>=(0|f))&&(g=d[e+36>>2],t=d[(h=g+(m<<2)|0)>>2],(0|(l=d[d[t+740>>2]+208>>2]))<=-1&&(l=d[d[t+744>>2]+208>>2]),t=0,(0|l)==(0|b))){for(l=(0|f)>(0|(t=m+1|0))?f:t,_=m;;){if((0|(_=_+1|0))>=(0|f))_=l;else if(c=d[(_<<2)+g>>2],(0|(t=d[d[c+740>>2]+208>>2]))<=-1&&(t=d[d[c+744>>2]+208>>2]),(0|t)==(0|b))continue;break}c=_-m|0,t=h}if(y||r[d[d[n>>2]+8>>2]](n,d[e+56>>2],d[e+48>>2],t,c,b),(0|(t=d[e+48>>2]))<=-1)for(d[e+52>>2]<=-1&&((l=d[e+56>>2])&&(u[e+60|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+56>>2]=0),s[e+60|0]=1,d[e+52>>2]=0,d[e+56>>2]=0);d[d[e+56>>2]+(t<<2)>>2]=0,h=(l=t+1|0)>>>0>=t>>>0,t=l,h;);if(m=c?_:m,d[e+48>>2]=0,!((0|p)<(0|o)))break}}else e=0|r[d[d[t>>2]+44>>2]](t),t=0|r[d[d[t>>2]+36>>2]](t),r[d[d[n>>2]+8>>2]](n,d[i+16>>2],d[i+8>>2],e,t,-1);As(),O=a+16|0}function St(e,t){var i,n,r,s=0,o=0,a=0,l=0;O=i=O-80|0,d[e+68>>2]=d[e+68>>2]+1,(s=d[e+64>>2])&&ec(s,d[76+(d[e+24>>2]+b(t,80)|0)>>2]),a=d[e+16>>2],n=b(t,80),l=d[e+24>>2],r=d[4+(o=8+(s=n+l|0)|0)>>2],d[i+8>>2]=d[o>>2],d[i+12>>2]=r,o=d[s+4>>2],d[i>>2]=d[s>>2],d[i+4>>2]=o,o=d[s+28>>2],d[i+24>>2]=d[s+24>>2],d[i+28>>2]=o,o=d[s+20>>2],d[i+16>>2]=d[s+16>>2],d[i+20>>2]=o,o=d[s+44>>2],d[i+40>>2]=d[s+40>>2],d[i+44>>2]=o,o=d[s+36>>2],d[i+32>>2]=d[s+32>>2],d[i+36>>2]=o,o=d[s+60>>2],d[i+56>>2]=d[s+56>>2],d[i+60>>2]=o,o=d[s+52>>2],d[i+48>>2]=d[s+48>>2],d[i+52>>2]=o,o=d[s+76>>2],d[i+72>>2]=d[s+72>>2],d[i+76>>2]=o,o=d[s+68>>2],d[i+64>>2]=d[s+64>>2],d[i+68>>2]=o,o=l,l=b(a,80)+-80|0,o=d[4+(a=o+l|0)>>2],d[s>>2]=d[a>>2],d[s+4>>2]=o,o=d[a+12>>2],d[s+8>>2]=d[a+8>>2],d[s+12>>2]=o,o=d[a+20>>2],d[s+16>>2]=d[a+16>>2],d[s+20>>2]=o,o=d[a+28>>2],d[s+24>>2]=d[a+24>>2],d[s+28>>2]=o,o=d[a+44>>2],d[s+40>>2]=d[a+40>>2],d[s+44>>2]=o,o=d[a+36>>2],d[s+32>>2]=d[a+32>>2],d[s+36>>2]=o,o=d[a+52>>2],d[s+48>>2]=d[a+48>>2],d[s+52>>2]=o,o=d[a+60>>2],d[s+56>>2]=d[a+56>>2],d[s+60>>2]=o,o=d[a+76>>2],d[s+72>>2]=d[a+72>>2],d[s+76>>2]=o,o=d[a+68>>2],d[s+64>>2]=d[a+64>>2],d[s+68>>2]=o,s=l+d[e+24>>2]|0,l=d[i+4>>2],d[s>>2]=d[i>>2],d[s+4>>2]=l,a=d[i+12>>2],d[s+8>>2]=d[i+8>>2],d[s+12>>2]=a,a=d[i+20>>2],d[s+16>>2]=d[i+16>>2],d[s+20>>2]=a,a=d[i+28>>2],d[s+24>>2]=d[i+24>>2],d[s+28>>2]=a,a=d[i+36>>2],d[s+32>>2]=d[i+32>>2],d[s+36>>2]=a,a=d[i+44>>2],d[s+40>>2]=d[i+40>>2],d[s+44>>2]=a,a=d[i+52>>2],d[s+48>>2]=d[i+48>>2],d[s+52>>2]=a,a=d[i+60>>2],d[s+56>>2]=d[i+56>>2],d[s+60>>2]=a,a=d[i+68>>2],d[s+64>>2]=d[i+64>>2],d[s+68>>2]=a,a=d[i+76>>2],d[s+72>>2]=d[i+72>>2],d[s+76>>2]=a,d[e+64>>2]&&(d[d[76+(d[e+24>>2]+n|0)>>2]+36>>2]=t),d[e+16>>2]=d[e+16>>2]+-1,O=i+80|0}function xt(e){var t,i,n,r,s,o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0);O=t=O-48|0,C=m[(i=e+1160|0)>>2],S=m[(n=e+1144|0)>>2],T=m[e+1164>>2],E=m[e+1132>>2],R=m[e+1148>>2],P=m[e+1168>>2],I=m[e+1136>>2],M=m[e+1152>>2],h=m[(r=e+1072|0)>>2],g=m[e+1084>>2],c=m[e+1100>>2],_=m[e+1068>>2],u=m[e+1096>>2],b=m[(s=e+1088|0)>>2],p=m[e+1080>>2],f=m[(o=e+1104|0)>>2],D=m[e+1128>>2],a=m[e+1064>>2],d[t+44>>2]=0,d[t+28>>2]=0,B=y(y(g*f)-y(b*c)),v=y(y(b*u)-y(f*p)),A=y(y(c*p)-y(g*u)),l=y(y(1)/y(y(y(a*B)+y(_*v))+y(A*h))),A=y(A*l),w=y(y(y(u*_)-y(c*a))*l),F=y(y(y(g*a)-y(p*_))*l),m[t+40>>2]=y(y(I*A)+y(M*w))+y(P*F),m[t+36>>2]=y(y(E*A)+y(w*R))+y(F*T),v=y(v*l),u=y(y(y(f*a)-y(u*h))*l),a=y(y(y(p*h)-y(b*a))*l),m[t+24>>2]=y(y(I*v)+y(M*u))+y(P*a),m[t+20>>2]=y(y(E*v)+y(u*R))+y(a*T),d[t+12>>2]=0,m[t+32>>2]=y(C*F)+y(y(D*A)+y(S*w)),m[t+16>>2]=y(C*a)+y(y(D*v)+y(S*u)),a=y(B*l),c=y(y(y(c*h)-y(f*_))*l),l=y(y(y(b*_)-y(g*h))*l),m[t+8>>2]=y(y(I*a)+y(M*c))+y(P*l),m[t+4>>2]=y(y(a*E)+y(c*R))+y(l*T),m[t>>2]=y(C*l)+y(y(D*a)+y(S*c)),rs(t,e+1192|0),d[e+1236>>2]=0,d[e+1252>>2]=0,d[e+1220>>2]=0,a=m[n>>2],g=m[r>>2],c=m[e+1128>>2],u=m[s>>2],l=y(y(a*g)-y(c*u)),b=m[o>>2],p=m[i>>2],h=y(y(c*b)-y(p*g)),_=y(y(p*u)-y(a*b)),f=y(y(1)/y(x(y(y(l*l)+y(y(h*h)+y(_*_)))))),m[e+1232>>2]=l*f,m[e+1228>>2]=h*f,m[e+1224>>2]=_*f,f=y(y(a*l)-y(p*h)),p=y(y(p*_)-y(c*l)),c=y(y(c*h)-y(a*_)),a=y(y(1)/y(x(y(y(y(f*f)+y(p*p))+y(c*c))))),m[e+1248>>2]=c*a,m[e+1244>>2]=p*a,m[e+1240>>2]=f*a,a=y(y(b*h)-y(u*l)),c=y(y(g*l)-y(b*_)),h=y(y(u*_)-y(g*h)),l=y(y(1)/y(x(y(y(y(a*a)+y(c*c))+y(h*h))))),m[e+1216>>2]=h*l,m[e+1212>>2]=c*l,m[e+1208>>2]=a*l,O=t+48|0}function Tt(e,t,i){var n=0,s=y(0),o=y(0),a=y(0),l=0;if(!d[e>>2])return d[e>>2]=i,void(d[i+32>>2]=0);if(n=d[t+40>>2])for(o=y(m[i>>2]+m[i+16>>2]),s=y(m[i+8>>2]+m[i+24>>2]),a=y(m[i+4>>2]+m[i+20>>2]);l=t+36|0,t=d[t+36>>2],t=d[l+((y(y(y(v(y(o-y(m[t>>2]+m[t+16>>2]))))+y(v(y(a-y(m[t+4>>2]+m[t+20>>2])))))+y(v(y(s-y(m[t+8>>2]+m[t+24>>2])))))>2]+m[n+16>>2]))))+y(v(y(a-y(m[n+4>>2]+m[n+20>>2])))))+y(v(y(s-y(m[n+8>>2]+m[n+24>>2])))))^1)<<2)>>2],n=d[t+40>>2];);l=d[t+32>>2],(n=d[e+4>>2])?d[e+4>>2]=0:(d[7717]=d[7717]+1,n=0|r[d[6606]](44,16),d[n>>2]=0,d[n+4>>2]=0,d[n+40>>2]=0,d[n+32>>2]=0,d[n+36>>2]=0,d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=0,d[n+20>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0),d[n+36>>2]=0,d[n+40>>2]=0,d[n+32>>2]=l,o=m[i>>2],s=m[t>>2],m[n>>2]=o>2],s=m[t+16>>2],m[n+16>>2]=o>s?o:s,o=m[i+4>>2],s=m[t+4>>2],m[n+4>>2]=o>2],s=m[t+20>>2],m[n+20>>2]=o>s?o:s,o=m[i+8>>2],s=m[t+8>>2],m[n+8>>2]=o>2],s=m[t+24>>2],m[n+24>>2]=o>s?o:s;e:if(l)for(d[36+(((d[d[t+32>>2]+40>>2]==(0|t))<<2)+l|0)>>2]=n,d[n+36>>2]=t,d[t+32>>2]=n,d[n+40>>2]=i,d[i+32>>2]=n,o=m[n>>2];;){if(e=n,!(m[(n=l)>>2]<=o^1|m[n+4>>2]<=m[e+4>>2]^1|m[n+8>>2]<=m[e+8>>2]^1|m[n+16>>2]>=m[e+16>>2]^1)&&m[n+20>>2]>=m[e+20>>2]&&m[n+24>>2]>=m[e+24>>2])break e;if(e=d[n+36>>2],o=m[e>>2],t=d[n+40>>2],o=o<(s=m[t>>2])?o:s,m[n>>2]=o,s=m[e+16>>2],a=m[t+16>>2],m[n+16>>2]=s>a?s:a,s=m[e+4>>2],a=m[t+4>>2],m[n+4>>2]=s>2],a=m[t+20>>2],m[n+20>>2]=s>a?s:a,s=m[e+8>>2],a=m[t+8>>2],m[n+8>>2]=s>2],a=m[t+24>>2],m[n+24>>2]=s>a?s:a,!(l=d[n+32>>2]))break}else d[n+36>>2]=t,d[t+32>>2]=n,d[n+40>>2]=i,d[i+32>>2]=n,d[e>>2]=n}function Et(e,t){var i=0,n=0,o=0,a=0,l=0,c=0,h=0;if((0|(a=d[e+4>>2]))==d[e+8>>2]&&!((0|a)>=(0|(l=a?a<<1:1)))){if(l&&(d[7717]=d[7717]+1,h=0|r[d[6606]](b(l,104),16),a=d[e+4>>2]),(0|a)>=1)for(;n=(i=b(c,104))+h|0,i=i+d[e+12>>2]|0,o=d[i+4>>2],d[n>>2]=d[i>>2],d[n+4>>2]=o,d[n+24>>2]=d[i+24>>2],o=d[i+20>>2],d[n+16>>2]=d[i+16>>2],d[n+20>>2]=o,o=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=o,o=d[i+40>>2],d[n+36>>2]=d[i+36>>2],d[n+40>>2]=o,o=d[i+32>>2],d[n+28>>2]=d[i+28>>2],d[n+32>>2]=o,o=d[i+56>>2],d[n+52>>2]=d[i+52>>2],d[n+56>>2]=o,o=d[i+48>>2],d[n+44>>2]=d[i+44>>2],d[n+48>>2]=o,o=d[i+64>>2],d[n+60>>2]=d[i+60>>2],d[n+64>>2]=o,o=d[i+72>>2],d[n+68>>2]=d[i+68>>2],d[n+72>>2]=o,o=d[i+80>>2],d[n+76>>2]=d[i+76>>2],d[n+80>>2]=o,o=d[i+88>>2],d[n+84>>2]=d[i+84>>2],d[n+88>>2]=o,o=d[i+96>>2],d[n+92>>2]=d[i+92>>2],d[n+96>>2]=o,d[n+100>>2]=d[i+100>>2],(0|(c=c+1|0))!=(0|a););(i=d[e+12>>2])&&(u[e+16|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+12>>2]=0),d[e+12>>2]=h,s[e+16|0]=1,d[e+8>>2]=l,a=d[e+4>>2]}i=d[e+12>>2]+b(a,104)|0,a=d[t+4>>2],d[i>>2]=d[t>>2],d[i+4>>2]=a,d[i+24>>2]=d[t+24>>2],n=d[t+20>>2],d[i+16>>2]=d[t+16>>2],d[i+20>>2]=n,n=d[t+12>>2],d[i+8>>2]=d[t+8>>2],d[i+12>>2]=n,n=d[t+40>>2],d[i+36>>2]=d[t+36>>2],d[i+40>>2]=n,n=d[t+32>>2],d[i+28>>2]=d[t+28>>2],d[i+32>>2]=n,n=d[t+56>>2],d[i+52>>2]=d[t+52>>2],d[i+56>>2]=n,n=d[t+48>>2],d[i+44>>2]=d[t+44>>2],d[i+48>>2]=n,n=d[t+72>>2],d[i+68>>2]=d[t+68>>2],d[i+72>>2]=n,n=d[t+64>>2],d[i+60>>2]=d[t+60>>2],d[i+64>>2]=n,n=d[t+80>>2],d[i+76>>2]=d[t+76>>2],d[i+80>>2]=n,n=d[t+88>>2],d[i+84>>2]=d[t+84>>2],d[i+88>>2]=n,n=d[t+96>>2],d[i+92>>2]=d[t+92>>2],d[i+96>>2]=n,d[i+100>>2]=d[t+100>>2],d[e+4>>2]=d[e+4>>2]+1}function Rt(e,t,i,n,r,s){var o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0);_=m[r+40>>2],u=m[r+24>>2],c=m[r+36>>2],h=m[r+20>>2],o=m[s+4>>2],f=m[r+8>>2],v=m[r+4>>2],A=m[r+32>>2],a=m[s>>2],C=m[r>>2],l=m[s+8>>2],x=m[r+16>>2],d[e+44>>2]=0,d[e+28>>2]=0,d[e+12>>2]=0,T=y(y(y(l*v)+y(h*y(0)))-y(a*c)),E=y(y(y(l*C)+y(x*y(0)))-y(a*A)),R=y(y(y(l*f)+y(u*y(0)))-y(a*_)),b=y(y(n-y(y(y(T*y(0))-y(l*E))+y(a*R)))+i),P=y(y(y(C*y(0))-y(l*x))+y(o*A)),I=y(y(y(v*y(0))-y(l*h))+y(o*c)),M=y(y(y(f*y(0))-y(l*u))+y(o*_)),p=y(y(n-y(y(y(P*y(0))+y(l*I))-y(o*M)))+i),g=y(y(y(0)-y(y(y(o*P)-y(a*I))+y(M*y(0))))+y(0)),S=y(y(y(o*R)-y(y(E*y(0))+y(l*T)))+y(0)),c=y(y(y(a*h)-y(o*v))+y(c*y(0))),h=y(y(y(a*x)-y(o*C))+y(A*y(0))),f=y(y(y(a*u)-y(o*f))+y(_*y(0))),_=y(y(y(0)-y(y(y(c*y(0))-y(l*h))+y(a*f)))+y(0)),u=y(y(y(o*f)-y(y(h*y(0))+y(l*c)))+y(0)),v=y(y(S*_)-y(u*b)),c=y(y(n-y(y(y(o*h)-y(a*c))+y(f*y(0))))+i),o=y(y(y(0)-y(y(y(o*E)-y(a*T))+y(R*y(0))))+y(0)),h=y(y(b*c)-y(o*_)),n=y(y(y(0)-y(y(y(I*y(0))-y(l*P))+y(a*M)))+y(0)),a=y(y(u*o)-y(S*c)),i=y(y(1)/y(y(g*v)+y(y(p*h)+y(n*a)))),t=y(y(1)/t),l=y(y(y(b*p)-y(S*n))*i),b=y(y(y(o*n)-y(b*g))*i),f=y(b*y(0)),o=y(y(y(S*g)-y(o*p))*i),A=y(o*y(0)),m[e+40>>2]=y(t*l)+y(f+A),C=y(y(y(u*n)-y(_*p))*i),n=y(y(y(_*g)-y(c*n))*i),_=y(n*y(0)),p=y(y(y(c*p)-y(u*g))*i),g=y(p*y(0)),m[e+36>>2]=y(t*C)+y(_+g),u=y(v*i),c=y(h*i),h=y(c*y(0)),i=y(a*i),a=y(i*y(0)),m[e+32>>2]=y(t*u)+y(h+a),l=y(l*y(0)),m[e+24>>2]=l+y(f+y(t*o)),o=y(C*y(0)),m[e+20>>2]=o+y(_+y(t*p)),p=y(u*y(0)),m[e+16>>2]=p+y(h+y(t*i)),m[e+8>>2]=l+y(y(t*b)+A),m[e+4>>2]=o+y(y(t*n)+g),m[e>>2]=p+y(y(t*c)+a)}function Pt(e,t,i){var n=0,o=0,a=0,l=0,c=0,h=0,m=0,g=0,b=0;e:{if(!((b=(o=_[t>>1])+((h=p[t+2>>1])<<16)&(m=d[e+48>>2])+-1)>>>0>=f[e+4>>2])&&-1!=(0|(n=d[d[e+12>>2]+(b<<2)>>2])))for(g=d[e+72>>2],c=65535&o;;){if((0|h)==p[2+(o=(a=n<<2)+g|0)>>1]&&(0|c)==p[o>>1])break e;if(-1==(0|(n=d[a+d[e+32>>2]>>2])))break}if((0|m)==(0|(n=g=d[e+44>>2]))&&!((0|(n=m))>=(0|(h=n?n<<1:1)))){if(h?(d[7717]=d[7717]+1,l=0|r[d[6606]](h<<2,16),n=d[e+44>>2]):n=m,(0|(o=n))>=1)for(n=0;c=(a=n<<2)+l|0,a=a+d[e+52>>2]|0,a=p[a>>1]|p[a+2>>1]<<16,_[c>>1]=a,_[c+2>>1]=a>>>16,(0|o)!=(0|(n=n+1|0)););(o=d[e+52>>2])&&(u[e+56|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+52>>2]=0),d[e+52>>2]=l,d[e+48>>2]=h,s[e+56|0]=1,n=d[e+44>>2]}if(o=d[e+52>>2]+(n<<2)|0,i=p[i>>1]|p[i+2>>1]<<16,_[o>>1]=i,_[o+2>>1]=i>>>16,d[e+44>>2]=d[e+44>>2]+1,(0|(l=d[e- -64>>2]))==d[e+68>>2]&&!((0|l)>=(0|(c=l?l<<1:1)))){if(c?(d[7717]=d[7717]+1,a=0|r[d[6606]](c<<2,16),l=d[e+64>>2]):a=0,(0|l)>=1)for(n=0;o=(i=n<<2)+a|0,i=i+d[e+72>>2]|0,i=p[i>>1]|p[i+2>>1]<<16,_[o>>1]=i,_[o+2>>1]=i>>>16,(0|l)!=(0|(n=n+1|0)););(i=d[e+72>>2])&&(u[e+76|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+72>>2]=0),d[e+72>>2]=a,d[e+68>>2]=c,s[e+76|0]=1,l=d[e+64>>2]}return o=d[e+72>>2]+(l<<2)|0,i=p[t>>1]|p[t+2>>1]<<16,_[o>>1]=i,_[o+2>>1]=i>>>16,d[e+64>>2]=d[e+64>>2]+1,(0|m)>2]&&(function(e){var t,i=0,n=0,o=0,a=0,l=0,c=0,h=0,f=0;if(!((0|(t=d[e+4>>2]))>=(0|(n=d[e+48>>2])))){if(d[e+8>>2]>=(0|n))a=d[e+12>>2];else{i=t,n&&(d[7717]=d[7717]+1,a=0|r[d[6606]](n<<2,16),i=d[e+4>>2]),c=d[e+12>>2];t:{i:{if((0|i)>=1)for(;;)if(d[(l=o<<2)+a>>2]=d[c+l>>2],(0|(o=o+1|0))==(0|i))break i;if(!c)break t}u[e+16|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c))}d[e+12>>2]=a,s[e+16|0]=1,d[e+8>>2]=n}if(Mn((i=t<<2)+a|0,0,(l=n<<2)-i|0),d[e+4>>2]=n,(0|(c=d[e+24>>2]))<(0|n)){t:if(d[e+28>>2]>=(0|n))a=d[e+32>>2];else{o=0,i=c,a=0,n&&(d[7717]=d[7717]+1,a=0|r[d[6606]](l,16),i=d[e+24>>2]),h=d[e+32>>2];i:{if((0|i)>=1)for(;;)if(d[(f=o<<2)+a>>2]=d[h+f>>2],(0|(o=o+1|0))==(0|i))break i;if(!h){d[e+32>>2]=a,d[e+28>>2]=n,s[e+36|0]=1;break t}}u[e+36|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+32>>2]=a,s[e+36|0]=1,d[e+28>>2]=n}Mn((i=c<<2)+a|0,0,l-i|0)}if(d[e+24>>2]=n,(0|n)>=1&&(Mn(d[e+12>>2],255,l),Mn(d[e+32>>2],255,l)),!((0|t)<1))for(c=d[e+32>>2],n=d[e+72>>2],a=d[e+12>>2],o=0;i=a+(((p[2+(i=(l=o<<2)+n|0)>>1]<<16)+_[i>>1]&d[e+48>>2]+-1)<<2)|0,d[c+l>>2]=d[i>>2],d[i>>2]=o,(0|t)!=(0|(o=o+1|0)););}}(e),b=_[t>>1]+(p[t+2>>1]<<16)&d[e+48>>2]+-1),t=d[e+32>>2]+(g<<2)|0,e=d[e+12>>2]+(b<<2)|0,d[t>>2]=d[e>>2],void(d[e>>2]=g)}t=d[e+52>>2]+(n<<2)|0,e=p[i>>1]|p[i+2>>1]<<16,_[t>>1]=e,_[t+2>>1]=e>>>16}function It(e,t,i,n,r,s,o){var a,l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0,g=0,b=0,y=0,v=0;if(O=a=O-48|0,l=d[i+8>>2])for(m=l;;){if(d[m+20>>2]>d[e+100>>2]){l=d[m+12>>2],u=d[l+92>>2],p=d[l+96>>2],h=d[i+88>>2],_=d[l+88>>2],c=d[i+92>>2],l=d[i+96>>2],d[a+44>>2]=-1,f=p-l|0,d[a+40>>2]=f,c=u-c|0,d[a+36>>2]=c,l=_-h|0,d[a+32>>2]=l,h=id(p=c,b=c>>31,d[(c=r)+8>>2],d[c+12>>2]),_=w,u=h,h=l,c=u+(l=id(l,y=l>>31,d[c>>2],d[c+4>>2]))|0,u=w+_|0,u=c>>>0>>0?u+1|0:u,f=(l=id(_=f,v=_>>31,d[r+16>>2],d[r+20>>2]))+c|0,c=w+u|0,c=f>>>0>>0?c+1|0:c,l=f,u=id(d[(f=s)+8>>2],d[f+12>>2],p,b),p=w,h=id(d[f>>2],d[f+4>>2],h,y),p=w+p|0,p=(f=h+u|0)>>>0>>0?p+1|0:p,_=id(d[s+16>>2],d[s+20>>2],_,v),u=w+p|0,u=(h=_+f|0)>>>0<_>>>0?u+1|0:u,_=h,(0|(h=u))>0||(0|h)>=0&&!(_>>>0<1)?(d[a+8>>2]=_,d[a+12>>2]=h,d[a+24>>2]=1,p=-1,_=0):(0|h)<-1||(0|h)<=-1&&!(_>>>0>4294967295)?(d[a+24>>2]=-1,d[a+8>>2]=0-_,d[a+12>>2]=0-((0<_>>>0)+h|0),p=1,_=0):(d[a+8>>2]=0,d[a+12>>2]=0,p=0,d[a+24>>2]=0,_=1);e:{t:{i:{if(h=a,f=a,(0|c)<0||(0|c)<=0&&!(l>>>0>0)){if((0|c)>-1||(0|c)>=-1&&!(l>>>0<=4294967295))break i;d[a+24>>2]=p,c=0-((0>>0)+c|0)|0,l=0-l|0}d[f+16>>2]=l,d[h+20>>2]=c;break t}if(d[a+16>>2]=0,d[a+20>>2]=0,_)break e}g?(0|(l=bi(a+8|0,o)))<=-1?(l=d[a+12>>2],d[o>>2]=d[a+8>>2],d[o+4>>2]=l,d[o+16>>2]=d[a+24>>2],l=d[a+20>>2],d[o+8>>2]=d[a+16>>2],d[o+12>>2]=l,g=m):l||(g=2!=(0|xn(g,m,n,a+32|0))^t?m:g):(l=d[a+12>>2],d[o>>2]=d[a+8>>2],d[o+4>>2]=l,d[o+16>>2]=d[a+24>>2],l=d[a+20>>2],d[o+8>>2]=d[a+16>>2],d[o+12>>2]=l,g=m)}l=d[i+8>>2]}if((0|(m=d[m>>2]))==(0|l))break}return O=a+48|0,g}function Mt(e,t,i){e|=0,i|=0;var n,s=0;return d[16+(t|=0)>>2]=d[e+4>>2],d[t+20>>2]=d[e+8>>2],d[t+24>>2]=d[e+12>>2],d[t+28>>2]=d[e+16>>2],d[t+32>>2]=d[e+20>>2],d[t+36>>2]=d[e+24>>2],d[t+40>>2]=d[e+28>>2],d[t+44>>2]=d[e+32>>2],d[t+48>>2]=d[e+36>>2],d[t+52>>2]=d[e+40>>2],d[t+56>>2]=d[e+44>>2],d[t+60>>2]=d[e+48>>2],d[t+64>>2]=d[e+52>>2],d[t+68>>2]=d[e+56>>2],d[t+72>>2]=d[e+60>>2],d[t+76>>2]=d[e- -64>>2],d[t+80>>2]=d[e+68>>2],d[t+84>>2]=d[e+72>>2],d[t+88>>2]=d[e+76>>2],d[t+92>>2]=d[e+80>>2],d[t+96>>2]=d[e+84>>2],d[t+100>>2]=d[e+88>>2],d[t+104>>2]=d[e+92>>2],d[t+108>>2]=d[e+96>>2],d[t+112>>2]=d[e+100>>2],d[t+116>>2]=d[e+104>>2],d[t+120>>2]=d[e+108>>2],d[t+124>>2]=d[e+112>>2],d[t+128>>2]=d[e+116>>2],d[t+132>>2]=d[e+120>>2],d[t+136>>2]=d[e+124>>2],d[t+140>>2]=d[e+128>>2],d[t+144>>2]=d[e+132>>2],d[t+148>>2]=d[e+136>>2],d[t+152>>2]=d[e+140>>2],d[t+156>>2]=d[e+144>>2],d[t+160>>2]=d[e+148>>2],d[t+164>>2]=d[e+152>>2],d[t+168>>2]=d[e+156>>2],d[t+172>>2]=d[e+160>>2],d[t+176>>2]=d[e+164>>2],d[t+180>>2]=d[e+168>>2],d[t+184>>2]=d[e+172>>2],d[t+188>>2]=d[e+176>>2],d[t+224>>2]=d[e+180>>2],s=d[e+184>>2],d[t>>2]=0,d[t+192>>2]=s,s=0|r[d[d[i>>2]+28>>2]](i,d[e+192>>2]),d[t+8>>2]=0,d[t+4>>2]=s,d[t+228>>2]=d[e+204>>2],d[t+232>>2]=d[e+208>>2],d[t+236>>2]=d[e+212>>2],d[t+240>>2]=d[e+216>>2],d[t+196>>2]=d[e+220>>2],d[t+200>>2]=d[e+224>>2],d[t+204>>2]=d[e+232>>2],d[t+208>>2]=d[e+228>>2],d[t+244>>2]=d[e+236>>2],s=0|r[d[d[i>>2]+40>>2]](i,e),n=0|r[d[d[i>>2]+28>>2]](i,s),d[t+12>>2]=n,n&&r[d[d[i>>2]+48>>2]](i,s),d[t+212>>2]=d[e+244>>2],d[t+216>>2]=d[e+248>>2],d[t+220>>2]=d[e+252>>2],d[t+248>>2]=d[e+256>>2],3976}function Dt(e,t){var i=0,n=0,r=0;e:{t:{i:{n:{r:{s:if((0|(i=d[e>>2]))>=4){if(8&u[0|t]){r=i;break s}r=i+-1|0,d[e>>2]=r,i=d[16+(n=(r<<4)+e|0)>>2],d[e+60>>2]=d[n+12>>2],d[e+64>>2]=i,i=d[n+8>>2],d[e+52>>2]=d[n+4>>2],d[e+56>>2]=i,i=d[n+88>>2],d[e+132>>2]=d[n+84>>2],d[e+136>>2]=i,i=d[n+96>>2],d[e+140>>2]=d[n+92>>2],d[e+144>>2]=i,i=d[n+176>>2],d[e+220>>2]=d[n+172>>2],d[e+224>>2]=i,i=d[n+168>>2],d[e+212>>2]=d[n+164>>2],d[e+216>>2]=i}else if(r=3,3!=(0|i))break r;if(4&u[0|t])break n;r=r+-1|0,d[e>>2]=r,i=d[16+(n=(r<<4)+e|0)>>2],d[e+44>>2]=d[n+12>>2],d[e+48>>2]=i,i=d[n+8>>2],d[e+36>>2]=d[n+4>>2],d[e+40>>2]=i,i=d[n+88>>2],d[e+116>>2]=d[n+84>>2],d[e+120>>2]=i,i=d[n+96>>2],d[e+124>>2]=d[n+92>>2],d[e+128>>2]=i,i=d[n+176>>2],d[e+204>>2]=d[n+172>>2],d[e+208>>2]=i,i=d[n+168>>2],d[e+196>>2]=d[n+164>>2],d[e+200>>2]=i;break n}if(r=2,(0|i)<2)break i}if(2&u[0|t])break t;r=r+-1|0,d[e>>2]=r,i=d[16+(n=(r<<4)+e|0)>>2],d[e+28>>2]=d[n+12>>2],d[e+32>>2]=i,i=d[n+8>>2],d[e+20>>2]=d[n+4>>2],d[e+24>>2]=i,i=d[n+88>>2],d[e+100>>2]=d[n+84>>2],d[e+104>>2]=i,i=d[n+96>>2],d[e+108>>2]=d[n+92>>2],d[e+112>>2]=i,i=d[n+176>>2],d[e+188>>2]=d[n+172>>2],d[e+192>>2]=i,i=d[n+168>>2],d[e+180>>2]=d[n+164>>2],d[e+184>>2]=i;break t}if(r=1,1!=(0|i))break e}1&s[0|t]||(t=r+-1|0,d[e>>2]=t,t=d[4+(r=(i=t<<4)+(e+4|0)|0)>>2],d[e+4>>2]=d[r>>2],d[e+8>>2]=t,t=d[r+12>>2],d[e+12>>2]=d[r+8>>2],d[e+16>>2]=t,t=d[4+(r=i+(e+84|0)|0)>>2],d[e+84>>2]=d[r>>2],d[e+88>>2]=t,t=d[r+12>>2],d[e+92>>2]=d[r+8>>2],d[e+96>>2]=t,t=d[12+(i=i+(e+164|0)|0)>>2],d[e+172>>2]=d[i+8>>2],d[e+176>>2]=t,t=d[i+4>>2],d[e+164>>2]=d[i>>2],d[e+168>>2]=t)}}function Ot(e,t,i){var n=0,o=0,a=0,l=0,c=0,h=0,_=0,p=0,m=0,g=0;e:{if(h=d[e+48>>2],l=d[t>>2],o=b((o=(l<<15^-1)+l|0)>>10^o,9),!((_=h+-1&((o=((o^=o>>6)<<11^-1)+o|0)>>16^o))>>>0>=f[e+4>>2])&&-1!=(0|(n=d[d[e+12>>2]+(_<<2)>>2])))for(c=d[e+72>>2];;){if((0|l)==d[(o=n<<2)+c>>2])break e;if(-1==(0|(n=d[o+d[e+32>>2]>>2])))break}if((0|h)==(0|(n=m=d[e+44>>2]))&&!((0|(n=h))>=(0|(p=n?n<<1:1)))){if(p?(d[7717]=d[7717]+1,a=0|r[d[6606]](p<<3,16),n=d[e+44>>2]):n=h,(0|(o=n))>=1)for(n=0;g=(c=n<<3)+a|0,l=c+d[e+52>>2]|0,c=d[l+4>>2],d[g>>2]=d[l>>2],d[g+4>>2]=c,(0|o)!=(0|(n=n+1|0)););(o=d[e+52>>2])&&(u[e+56|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+52>>2]=0),d[e+52>>2]=a,d[e+48>>2]=p,s[e+56|0]=1,n=d[e+44>>2]}if(o=d[i+4>>2],n=d[e+52>>2]+(n<<3)|0,d[n>>2]=d[i>>2],d[n+4>>2]=o,d[e+44>>2]=d[e+44>>2]+1,(0|(a=d[e- -64>>2]))==d[e+68>>2]&&!((0|a)>=(0|(c=a?a<<1:1)))){n=0,o=0,c&&(d[7717]=d[7717]+1,o=0|r[d[6606]](c<<2,16),a=d[e+64>>2]),l=d[e+72>>2];t:{i:{if((0|a)>=1)for(;;)if(d[(i=n<<2)+o>>2]=d[i+l>>2],(0|a)==(0|(n=n+1|0)))break i;if(!l)break t}u[e+76|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+72>>2]=0,a=d[e+64>>2]}d[e+72>>2]=o,d[e+68>>2]=c,s[e+76|0]=1}return d[d[e+72>>2]+(a<<2)>>2]=d[t>>2],d[e+64>>2]=d[e+64>>2]+1,(0|h)>2]&&(function(e){var t,i=0,n=0,o=0,a=0,l=0,c=0,h=0,_=0;if(!((0|(t=d[e+4>>2]))>=(0|(n=d[e+48>>2])))){if(d[e+8>>2]>=(0|n))a=d[e+12>>2];else{i=t,n&&(d[7717]=d[7717]+1,a=0|r[d[6606]](n<<2,16),i=d[e+4>>2]),c=d[e+12>>2];t:{i:{if((0|i)>=1)for(;;)if(d[(l=o<<2)+a>>2]=d[c+l>>2],(0|(o=o+1|0))==(0|i))break i;if(!c)break t}u[e+16|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c))}d[e+12>>2]=a,s[e+16|0]=1,d[e+8>>2]=n}if(Mn((i=t<<2)+a|0,0,(l=n<<2)-i|0),d[e+4>>2]=n,(0|(c=d[e+24>>2]))<(0|n)){t:if(d[e+28>>2]>=(0|n))a=d[e+32>>2];else{o=0,i=c,a=0,n&&(d[7717]=d[7717]+1,a=0|r[d[6606]](l,16),i=d[e+24>>2]),h=d[e+32>>2];i:{if((0|i)>=1)for(;;)if(d[(_=o<<2)+a>>2]=d[h+_>>2],(0|(o=o+1|0))==(0|i))break i;if(!h){d[e+32>>2]=a,d[e+28>>2]=n,s[e+36|0]=1;break t}}u[e+36|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+32>>2]=a,s[e+36|0]=1,d[e+28>>2]=n}Mn((i=c<<2)+a|0,0,l-i|0)}if(d[e+24>>2]=n,(0|n)>=1&&(Mn(d[e+12>>2],255,l),Mn(d[e+32>>2],255,l)),!((0|t)<1))for(c=d[e+32>>2],n=d[e+72>>2],a=d[e+12>>2],o=0;i=d[(l=o<<2)+n>>2],i=b((i=(i<<15^-1)+i|0)>>10^i,9),i=((i^=i>>6)<<11^-1)+i|0,i=a+((d[e+48>>2]+-1&(i>>16^i))<<2)|0,d[c+l>>2]=d[i>>2],d[i>>2]=o,(0|t)!=(0|(o=o+1|0)););}}(e),t=d[t>>2],t=b((t=(t<<15^-1)+t|0)>>10^t,9),t=((t^=t>>6)<<11^-1)+t|0,_=d[e+48>>2]+-1&(t>>16^t)),t=d[e+32>>2]+(m<<2)|0,e=d[e+12>>2]+(_<<2)|0,d[t>>2]=d[e>>2],void(d[e>>2]=m)}t=d[e+52>>2]+(n<<3)|0,e=d[i+4>>2],d[t>>2]=d[i>>2],d[t+4>>2]=e}function wt(e,t,i,n){var s,o=y(0),a=y(0),l=0,c=y(0),h=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=0,C=y(0),S=y(0),x=y(0),T=0,E=0,R=0,P=0,I=0,M=0,D=0,w=0;O=s=O-16|0;e:if(u[e+60|0]){h=m[e+28>>2],c=m[e+12>>2],o=(o=m[i+8>>2])>2],l=(o=y(y((h=y(0)?~~o>>>0:0,S=m[e+40>>2],b=m[e+24>>2],o=m[e+8>>2],x=m[e+36>>2],v=m[e+20>>2],g=m[e+4>>2],a=m[i>>2],f=m[i+4>>2],T=65534&l,_[s+14>>1]=T,i=s,E=65534&(l=(f=y(S*y((b<(f=f=y(0)?~~f>>>0:0),_[i+12>>1]=E,i=s,R=65534&(l=(a=y(y((v<(a=a=y(0)?~~a>>>0:0),_[i+10>>1]=R,a=m[n+8>>2],i=(c=y(y(C*y((h<(a=a=y(0)?~~c>>>0:0,c=m[n>>2],h=m[n+4>>2],P=1|i,_[s+8>>1]=P,i=s,I=1|(n=(o=y(y(S*y((b<(h=h=y(0)?~~o>>>0:0),_[i+6>>1]=I,i=s,M=1|(n=(o=y(y(x*y((v<(o=c=y(0)?~~o>>>0:0),_[i+4>>1]=M;t:switch(d[e+144>>2]){case 0:if(n=0,(0|(D=d[e+56>>2]))>=1)for(e=d[e+136>>2],i=0;(w=(0|(A=d[e+12>>2]))<0)|!(l=R>>>0<=p[e+6>>1]&M>>>0>=p[e>>1]&T>>>0<=p[e+10>>1]&P>>>0>=p[e+4>>1]&E>>>0<=p[e+8>>1]&I>>>0>=p[e+2>>1])||r[d[d[t>>2]+8>>2]](t,A>>>21|0,2097151&A),(-1^l)&w?(i=i-(l=d[e+12>>2])|0,e=e-(l<<4)|0):(i=i+1|0,e=e+16|0),n=n+1|0,(0|i)<(0|D););if(d[7309]>=(0|n))break e;d[7309]=n;break e;case 1:!function(e,t,i,n){var s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,f=0,m=0,g=0;if(d[e+152>>2]>=1)for(;;){if(u=p[i>>1],o=d[e+160>>2]+(f<<5)|0,!(u>>>0>p[o+6>>1]||(m=p[n>>1])>>>0>1]||(g=p[i+4>>1])>>>0>p[o+10>>1]||(h=p[n+4>>1])>>>0>1]||(l=p[i+2>>1])>>>0>p[o+8>>1]||(a=p[n+2>>1])>>>0>1])){i:if((0|(s=d[o+16>>2]))<1)_=0;else for(o=s+(c=d[o+12>>2])|0,s=d[e+136>>2]+(c<<4)|0,_=0;;){if(h=u>>>0<=p[s+6>>1]&m>>>0>=p[s>>1]&g>>>0<=p[s+10>>1]&h>>>0>=p[s+4>>1]&l>>>0<=p[s+8>>1]&a>>>0>=p[s+2>>1],(a=(0|(l=d[s+12>>2]))<0)|!h||r[d[d[t>>2]+8>>2]](t,l>>>21|0,2097151&l),a&(-1^h)?(c=c-(a=d[s+12>>2])|0,s=s-(a<<4)|0):(c=c+1|0,s=s+16|0),_=_+1|0,(0|c)>=(0|o))break i;a=p[n+2>>1],l=p[i+2>>1],h=p[n+4>>1],g=p[i+4>>1],m=p[n>>1],u=p[i>>1]}d[7309]>=(0|_)||(d[7309]=_)}if(!((0|(f=f+1|0))>2]))break}}(e,t,s+10|0,s+4|0);break e;case 2:break t;default:break e}as(e,d[e+136>>2],t,s+10|0,s+4|0)}else!function(e,t,i,n){var s=0,o=0,a=0,l=0,c=0;if(d[e+56>>2]>=1)for(s=d[e+96>>2];;){o=0,m[i>>2]>m[s+16>>2]||(o=0,m[n>>2]>2]||(o=1)),a=0,a=m[n+8>>2]>2]|m[i+8>>2]>m[s+24>>2]?a:o;t:{i:{if(m[n+4>>2]>2]^1&&!(m[i+4>>2]>m[s+20>>2])){if(1==(a&(o=-1==d[s+32>>2]))){r[d[d[t>>2]+8>>2]](t,d[s+36>>2],d[s+40>>2]);break i}}else o=-1==d[s+32>>2],a=0;if(!(o|a)){l=(o=d[s+32>>2])+l|0,s=(o<<6)+s|0;break t}}l=l+1|0,s=s- -64|0}if(c=c+1|0,!((0|l)>2]))break}d[7309]<(0|c)&&(d[7309]=c)}(e,t,i,n);O=s+16|0}function Ft(e,t){var i=y(0),n=y(0),r=0,s=y(0),o=y(0),a=y(0),l=0;n=m[1192+((t<<2)+e|0)>>2],(s=m[868+(r=(t<<6)+e|0)>>2])>=(o=m[r+872>>2])||(ny(3.1415927410125732)&&(i=y(i+y(-6.2831854820251465))),a=y(v(i)),(i=Ji(y(o-n),y(6.2831854820251465)))y(3.1415927410125732)&&(i=y(i+y(-6.2831854820251465))),n=ao&&((i=Ji(y(n-o),y(6.2831854820251465)))y(3.1415927410125732)&&(i=y(i+y(-6.2831854820251465))),a=y(v(i)),(i=Ji(y(n-s),y(6.2831854820251465)))y(3.1415927410125732)&&(i=y(i+y(-6.2831854820251465))),n=y(v(i))>2]=n;e:{t:{if(s>o)l=924+((t<<6)+e|0)|0;else{if(s>n){if(e=(t<<6)+e|0,i=y(n-s),m[e+916>>2]=i,d[e+924>>2]=1,i>y(3.1415927410125732)){m[e+916>>2]=i+y(-6.2831854820251465);break t}if(!(i>2]=i+y(6.2831854820251465);break t}if(l=924+(r=(t<<6)+e|0)|0,o>2]=2,i=y(n-o),m[r+916>>2]=i,i>y(3.1415927410125732)){m[r+916>>2]=i+y(-6.2831854820251465);break t}if(!(i>2]=i+y(6.2831854820251465);break t}}if(d[l>>2]=0,r=0,!u[912+((t<<6)+e|0)|0])break e}r=1}return r}function Bt(e){var t=0;return d[(e|=0)>>2]=5228,u[e+20|0]&&((t=d[d[e+16>>2]+16>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),(t=d[e+16>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),u[e+12|0]&&((t=d[d[e+8>>2]+16>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),(t=d[e+8>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),t=d[e+32>>2],r[d[d[t>>2]>>2]](t),(t=d[e+32>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+36>>2],r[d[d[t>>2]>>2]](t),(t=d[e+36>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+40>>2],r[d[d[t>>2]>>2]](t),(t=d[e+40>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+44>>2],r[d[d[t>>2]>>2]](t),(t=d[e+44>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+48>>2],r[d[d[t>>2]>>2]](t),(t=d[e+48>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+52>>2],r[d[d[t>>2]>>2]](t),(t=d[e+52>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+56>>2],r[d[d[t>>2]>>2]](t),(t=d[e+56>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+60>>2],r[d[d[t>>2]>>2]](t),(t=d[e+60>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+76>>2],r[d[d[t>>2]>>2]](t),(t=d[e+76>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+80>>2],r[d[d[t>>2]>>2]](t),(t=d[e+80>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+72>>2],r[d[d[t>>2]>>2]](t),(t=d[e+72>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+88>>2],r[d[d[t>>2]>>2]](t),(t=d[e+88>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+84>>2],r[d[d[t>>2]>>2]](t),(t=d[e+84>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),(t=d[e+24>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+28>>2],r[d[d[t>>2]>>2]](t),(t=d[e+28>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),0|e}function Nt(e,t,i){var n=0,o=0,a=0,l=0,c=0,h=0,_=0,p=0,m=0;e:{if(_=d[e+48>>2],a=d[t>>2],n=b((n=(a<<15^-1)+a|0)>>10^n,9),!((p=_+-1&((n=((n^=n>>6)<<11^-1)+n|0)>>16^n))>>>0>=f[e+4>>2])&&-1!=(0|(o=d[d[e+12>>2]+(p<<2)>>2])))for(n=d[e+72>>2];;){if((0|a)==d[n+(o<<3)>>2])break e;if(-1==(0|(o=d[d[e+32>>2]+(o<<2)>>2])))break}if((0|_)==(0|(n=m=d[e+44>>2]))&&!((0|(n=_))>=(0|(l=n?n<<1:1)))){o=0,l&&(d[7717]=d[7717]+1,h=0|r[d[6606]](l<<2,16),n=d[e+44>>2]),c=d[e+52>>2];t:{i:{if((0|n)>=1)for(;;)if(d[(a=o<<2)+h>>2]=d[a+c>>2],(0|(o=o+1|0))==(0|n))break i;if(!c)break t}u[e+56|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[e+52>>2]=0,n=d[e+44>>2]}d[e+52>>2]=h,d[e+48>>2]=l,s[e+56|0]=1}if(d[d[e+52>>2]+(n<<2)>>2]=d[i>>2],d[e+44>>2]=d[e+44>>2]+1,(0|(n=d[e- -64>>2]))==d[e+68>>2]&&!((0|n)>=(0|(l=n?n<<1:1)))){if(l?(d[7717]=d[7717]+1,h=0|r[d[6606]](l<<3,16),n=d[e+64>>2]):h=0,(0|n)>=1)for(o=0;c=(i=o<<3)+h|0,a=i+d[e+72>>2]|0,i=d[a+4>>2],d[c>>2]=d[a>>2],d[c+4>>2]=i,(0|(o=o+1|0))!=(0|n););(i=d[e+72>>2])&&(u[e+76|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+72>>2]=0),d[e+72>>2]=h,d[e+68>>2]=l,s[e+76|0]=1,n=d[e+64>>2]}return i=d[t+4>>2],n=d[e+72>>2]+(n<<3)|0,d[n>>2]=d[t>>2],d[n+4>>2]=i,d[e+64>>2]=d[e+64>>2]+1,(0|_)>2]&&(fi(e),t=d[t>>2],t=b((t=(t<<15^-1)+t|0)>>10^t,9),t=((t^=t>>6)<<11^-1)+t|0,p=d[e+48>>2]+-1&(t>>16^t)),t=d[e+32>>2]+(m<<2)|0,e=d[e+12>>2]+(p<<2)|0,d[t>>2]=d[e>>2],void(d[e>>2]=m)}d[d[e+52>>2]+(o<<2)>>2]=d[i>>2]}function Lt(e,t,i){var n=0,o=0,a=0,l=0,c=0,h=0,_=0,p=0,m=0;e:{if(c=d[e+48>>2],n=d[t>>2],o=b((o=(n<<15^-1)+n|0)>>10^o,9),!((_=c+-1&((o=((o^=o>>6)<<11^-1)+o|0)>>16^o))>>>0>=f[e+4>>2])&&-1!=(0|(o=d[d[e+12>>2]+(_<<2)>>2])))for(a=d[e+72>>2];;){if((0|n)==d[a+(o<<3)>>2])break e;if(-1==(0|(o=d[d[e+32>>2]+(o<<2)>>2])))break}if((0|c)==(0|(n=p=d[e+44>>2]))&&!((0|(n=c))>=(0|(a=n?n<<1:1)))){if(a?(d[7717]=d[7717]+1,l=0|r[d[6606]](a<<2,16),n=d[e+44>>2]):n=c,(0|n)>=1)for(o=0;d[(h=o<<2)+l>>2]=d[h+d[e+52>>2]>>2],(0|(o=o+1|0))!=(0|n););(o=d[e+52>>2])&&(u[e+56|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),n=d[e+44>>2]),d[e+52>>2]=0),d[e+52>>2]=l,d[e+48>>2]=a,s[e+56|0]=1}if(d[d[e+52>>2]+(n<<2)>>2]=d[i>>2],d[e+44>>2]=n+1,(0|(n=d[e- -64>>2]))==d[e+68>>2]&&!((0|n)>=(0|(i=n?n<<1:1)))){if(i?(d[7717]=d[7717]+1,l=0|r[d[6606]](i<<3,16),n=d[e+64>>2]):l=0,(0|n)>=1)for(o=0;h=(a=o<<3)+l|0,a=a+d[e+72>>2]|0,m=d[a+4>>2],d[h>>2]=d[a>>2],d[h+4>>2]=m,(0|(o=o+1|0))!=(0|n););(n=d[e+72>>2])&&(u[e+76|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+72>>2]=0),d[e+72>>2]=l,d[e+68>>2]=i,s[e+76|0]=1,n=d[e+64>>2]}return i=d[e+72>>2]+(n<<3)|0,n=d[t+4>>2],d[i>>2]=d[t>>2],d[i+4>>2]=n,d[e+64>>2]=d[e+64>>2]+1,(0|c)>2]&&(fi(e),t=d[t>>2],t=b((t=(t<<15^-1)+t|0)>>10^t,9),t=((t^=t>>6)<<11^-1)+t|0,_=d[e+48>>2]+-1&(t>>16^t)),t=d[e+32>>2]+(p<<2)|0,e=d[e+12>>2]+(_<<2)|0,d[t>>2]=d[e>>2],void(d[e>>2]=p)}d[d[e+52>>2]+(o<<2)>>2]=d[i>>2]}function kt(e,t,i,n){var r,s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0);O=r=O+-64|0,g=m[t+24>>2],b=m[t+20>>2],v=m[t+40>>2],S=m[t+36>>2],c=m[e+40>>2],h=m[e+20>>2],p=m[e+36>>2],_=m[e+24>>2],T=m[t+8>>2],E=m[t>>2],R=m[t+4>>2],P=m[t+16>>2],I=m[t+32>>2],o=m[e+8>>2],a=m[e+4>>2],f=m[e+32>>2],u=m[e+16>>2],l=m[e>>2],d[r+60>>2]=0,d[r+44>>2]=0,D=y(y(h*c)-y(_*p)),w=y(y(_*f)-y(c*u)),F=y(y(p*u)-y(h*f)),s=y(y(1)/y(y(y(l*D)+y(a*w))+y(o*F))),M=y(y(y(_*a)-y(h*o))*s),_=y(y(y(u*o)-y(_*l))*s),h=y(y(y(h*l)-y(u*a))*s),m[r+56>>2]=y(y(I*M)+y(S*_))+y(v*h),u=y(y(y(p*o)-y(c*a))*s),o=y(y(y(c*l)-y(f*o))*s),a=y(y(y(f*a)-y(p*l))*s),m[r+52>>2]=y(y(I*u)+y(S*o))+y(v*a),m[r+40>>2]=y(y(M*P)+y(_*b))+y(h*g),m[r+36>>2]=y(y(u*P)+y(o*b))+y(a*g),d[r+28>>2]=0,l=y(D*s),c=y(w*s),s=y(F*s),m[r+48>>2]=y(y(I*l)+y(S*c))+y(v*s),m[r+32>>2]=y(y(l*P)+y(c*b))+y(s*g),m[r+24>>2]=y(T*h)+y(y(E*M)+y(R*_)),m[r+20>>2]=y(T*a)+y(y(E*u)+y(R*o)),m[r+16>>2]=y(T*s)+y(y(E*l)+y(R*c)),st(r+16|0,r),l=m[r>>2],a=m[r+4>>2],o=m[r+8>>2],c=m[r+12>>2],s=y(y(1)/y(x(y(y(y(y(l*l)+y(a*a))+y(o*o))+y(c*c))))),o=y(o*s),m[r+8>>2]=o,a=y(a*s),m[r+4>>2]=a,l=y(l*s),m[r>>2]=l,s=y(c*s),m[r+12>>2]=s,s=Ki(y(A(y(C(s,y(-1))),y(1)))),m[n>>2]=s+s,d[i+12>>2]=0,m[i+8>>2]=o,m[i+4>>2]=a,m[i>>2]=l,(s=y(y(y(l*l)+y(a*a))+y(o*o)))>2]=0,d[i+12>>2]=0,d[i>>2]=1065353216,d[i+4>>2]=0):(s=y(y(1)/y(x(s))),m[i+8>>2]=o*s,m[i+4>>2]=a*s,m[i>>2]=l*s),O=r- -64|0}function Vt(e,t,i){var n=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0,f=0;if(!(!e|!t)){for(d[7717]=d[7717]+1,o=0|r[d[6606]](1024,16),d[o+4>>2]=t,d[o>>2]=e,t=124,h=128,e=128,s=1;;){if(c=s,l=d[4+(n=(_=(s=s+-1|0)<<3)+o|0)>>2],a=d[n>>2],(0|s)>(0|t)){e:if((0|h)>=(0|(t=h<<1)))n=o;else if((0|e)>=(0|t))n=o;else{t:{if(h){if(e=0,d[7717]=d[7717]+1,n=0|r[d[6606]](h<<4,16),!((0|h)<1)){for(;p=(u=e<<3)+n|0,u=d[4+(f=o+u|0)>>2],d[p>>2]=d[f>>2],d[p+4>>2]=u,(0|h)!=(0|(e=e+1|0)););break t}}else n=0;if(e=t,!o)break e}o&&(d[7718]=d[7718]+1,r[d[6607]](o)),e=t}o=n,h=t,t=t+-4|0}e:if((0|a)!=(0|l)){if(!(m[a>>2]<=m[l+16>>2]^1|m[a+16>>2]>=m[l>>2]^1|m[a+4>>2]<=m[l+20>>2]^1|m[a+20>>2]>=m[l+4>>2]^1||m[a+8>>2]<=m[l+24>>2]^1|m[a+24>>2]>=m[l+8>>2]^1))if(n=d[l+40>>2],d[a+40>>2]){if(s=d[a+36>>2],n){d[4+(n=o+_|0)>>2]=d[l+36>>2],d[n>>2]=s,n=d[a+40>>2],d[4+(s=(c<<3)+o|0)>>2]=d[l+36>>2],d[s>>2]=n,n=d[a+36>>2],d[s+12>>2]=d[l+40>>2],d[s+8>>2]=n,n=d[a+40>>2],d[s+20>>2]=d[l+40>>2],d[s+16>>2]=n,s=c+3|0;break e}d[4+(n=o+_|0)>>2]=l,d[n>>2]=s,s=d[a+40>>2],d[4+(n=(c<<3)+o|0)>>2]=l,d[n>>2]=s,s=c+1|0}else n?(d[4+(n=o+_|0)>>2]=d[l+36>>2],d[n>>2]=a,d[4+(n=(c<<3)+o|0)>>2]=d[l+40>>2],d[n>>2]=a,s=c+1|0):r[d[d[i>>2]+8>>2]](i,a,l)}else{if(!d[a+40>>2])break e;s=o+_|0,n=d[a+36>>2],d[s+4>>2]=n,d[s>>2]=n,s=(c<<3)+o|0,n=d[a+40>>2],d[s+4>>2]=n,d[s>>2]=n,n=d[a+40>>2],d[s+8>>2]=d[a+36>>2],d[s+12>>2]=n,s=c+2|0}if(!s)break}o&&o&&(d[7718]=d[7718]+1,r[d[6607]](o))}}function Ut(e,t,i,n){var r=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0);go(e,4,t),d[e>>2]=19668,t=d[i+12>>2],d[e+560>>2]=d[i+8>>2],d[e+564>>2]=t,t=d[i+4>>2],d[e+552>>2]=d[i>>2],d[e+556>>2]=t,t=d[i+28>>2],d[e+576>>2]=d[i+24>>2],d[e+580>>2]=t,t=d[i+20>>2],d[e+568>>2]=d[i+16>>2],d[e+572>>2]=t,t=d[i+44>>2],d[e+592>>2]=d[i+40>>2],d[e+596>>2]=t,t=d[i+36>>2],d[e+584>>2]=d[i+32>>2],d[e+588>>2]=t,t=d[i+60>>2],d[e+608>>2]=d[i+56>>2],d[e+612>>2]=t,t=d[i+52>>2],d[e+600>>2]=d[i+48>>2],d[e+604>>2]=t,t=d[i+12>>2],d[e+624>>2]=d[i+8>>2],d[e+628>>2]=t,t=d[i+4>>2],d[e+616>>2]=d[i>>2],d[e+620>>2]=t,t=d[i+20>>2],d[e+632>>2]=d[i+16>>2],d[e+636>>2]=t,t=d[i+28>>2],d[e+640>>2]=d[i+24>>2],d[e+644>>2]=t,t=d[i+36>>2],d[e+648>>2]=d[i+32>>2],d[e+652>>2]=t,t=d[i+44>>2],d[e+656>>2]=d[i+40>>2],d[e+660>>2]=t,t=d[i+52>>2],d[e+664>>2]=d[i+48>>2],d[e+668>>2]=t,t=d[i+60>>2],d[e+672>>2]=d[i+56>>2],d[e+676>>2]=t,d[e+688>>2]=0,d[e+692>>2]=-1082130432,d[e+696>>2]=1063675494,d[e+700>>2]=1050253722,d[e+704>>2]=1065353216,d[e+708>>2]=0,d[e+712>>2]=0,s[e+716|0]=0,s[e+740|0]=n,d[e+748>>2]=0,d[e+736>>2]=16777216,t=d[e+28>>2],l=m[t+52>>2],c=m[t+8>>2],h=m[t+12>>2],_=m[t+56>>2],u=m[t+28>>2],p=m[t+20>>2],f=m[t+24>>2],g=m[t+60>>2],r=m[e+608>>2],b=m[t+44>>2],o=m[e+600>>2],v=m[t+36>>2],a=m[e+604>>2],A=m[t+40>>2],C=m[t+4>>2],m[e+732>>2]=y(n?-1:1),d[e+676>>2]=0,m[e+672>>2]=g+y(y(y(o*v)+y(a*A))+y(r*b)),m[e+668>>2]=_+y(y(y(o*p)+y(a*f))+y(r*u)),m[e+664>>2]=l+y(y(y(o*C)+y(a*c))+y(r*h))}function Gt(e,t){var i,n=0,o=0,a=0,l=0,c=0,h=0;if(O=i=O-96|0,(0|(l=d[e+8>>2]))>=1)for(;a=d[d[e+16>>2]+(o<<2)>>2],1==d[a+236>>2]&&(r[d[d[a>>2]+24>>2]](a,t),l=d[e+8>>2]),(0|(o=o+1|0))<(0|l););if(s[i+52|0]=1,d[i+48>>2]=0,s[i+72|0]=1,d[i+40>>2]=0,d[i+44>>2]=0,d[i+68>>2]=0,s[i+92|0]=1,d[i+60>>2]=0,d[i+64>>2]=0,d[i+88>>2]=0,d[i+80>>2]=0,d[i+84>>2]=0,d[i+28>>2]=0,s[i+32|0]=1,d[i+20>>2]=0,d[i+24>>2]=0,!((0|l)<1)){for(o=0;;){a=d[d[d[e+16>>2]+(c<<2)>>2]+192>>2],d[i+12>>2]=a,h=n+-1|0,n=b((n=a+(a<<15^-1)|0)>>10^n,9);e:{t:if(!((n=h&((n=((n^=n>>6)<<11^-1)+n|0)>>16^n))>>>0>=o>>>0)&&-1!=(0|(o=d[d[i+28>>2]+(n<<2)>>2]))){for(n=d[i+48>>2],h=d[i+88>>2];;){if((0|a)!=d[(o<<3)+h>>2]){if(-1!=(0|(o=d[n+(o<<2)>>2])))continue;break t}break}if(d[i+68>>2])break e}d[i>>2]=a,Lt(i+16|0,i,i+12|0),o=d[i+12>>2],r[d[d[o>>2]+60>>2]](o,t),l=d[e+8>>2]}if(!((0|(c=c+1|0))<(0|l)))break;o=d[i+20>>2],n=d[i+64>>2]}(e=d[i+88>>2])&&(u[i+92|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+88>>2]=0)}d[i+88>>2]=0,s[i+92|0]=1,d[i+80>>2]=0,d[i+84>>2]=0,(e=d[i+68>>2])&&(u[i+72|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+68>>2]=0),d[i+68>>2]=0,s[i+72|0]=1,d[i+60>>2]=0,d[i+64>>2]=0,(e=d[i+48>>2])&&(u[i+52|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+48>>2]=0),d[i+48>>2]=0,s[i+52|0]=1,d[i+40>>2]=0,d[i+44>>2]=0,(e=d[i+28>>2])&&(u[i+32|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+28>>2]=0),O=i+96|0}function jt(e,t){var i,n=y(0),o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0);O=i=O-48|0,oi(e,t,0),n=m[t+204>>2],d[t+28>>2]=0,n=y(n+m[t+212>>2]),m[t+24>>2]=y(n*m[t+60>>2])+m[t+44>>2],m[t+20>>2]=y(n*m[t+56>>2])+m[t+40>>2],m[t+16>>2]=y(m[t+52>>2]*n)+m[t+36>>2],d[i+40>>2]=-1082130432,o=d[e+100>>2],o=0|r[d[d[o>>2]+8>>2]](o,t+36|0,t+16|0,i+8|0),d[t+88>>2]=0;e:if(o){if(l=m[i+40>>2],o=d[i+28>>2],d[t>>2]=d[i+24>>2],d[t+4>>2]=o,o=d[i+36>>2],d[t+8>>2]=d[i+32>>2],d[t+12>>2]=o,s[t+84|0]=1,function(){var e;O=e=O-16|0,1&s[30492]||mc(30492)&&(d[e+8>>2]=0,d[e+12>>2]=0,d[e>>2]=0,d[e+4>>2]=0,Pn(29876,e),uh(30492)),d[e+8>>2]=0,d[e+12>>2]=0,d[e>>2]=0,d[e+4>>2]=0,Pr(29876,y(0),e),O=e+16|0}(),d[t+88>>2]=29876,l=y(n*l),m[t+32>>2]=l-m[t+212>>2],(n=(o=(n=m[t+32>>2])<(a=y(m[t+204>>2]-y(m[t+208>>2]*y(.009999999776482582)))))?a:n)>(a=y(m[t+204>>2]+y(m[t+208>>2]*y(.009999999776482582))))^1&&!o||(m[t+32>>2]=n>a?a:n),o=d[i+12>>2],d[t+16>>2]=d[i+8>>2],d[t+20>>2]=o,o=d[i+20>>2],d[t+24>>2]=d[i+16>>2],d[t+28>>2]=o,a=m[t>>2],c=m[t+4>>2],u=m[t+8>>2],(n=y(y(y(a*m[t+52>>2])+y(c*m[t+56>>2]))+y(u*m[t+60>>2])))>=y(-.10000000149011612)){d[t+272>>2]=0,n=y(10);break e}n=y(y(-1)/n),_=a,e=d[e+116>>2],a=m[e+332>>2],h=y(m[t+24>>2]-m[e+60>>2]),p=y(m[t+20>>2]-m[e+56>>2]),f=m[e+336>>2],g=y(_*y(y(y(a*h)-y(p*f))+m[e+312>>2])),_=c,c=y(m[t+16>>2]-m[e+52>>2]),b=h,h=m[e+328>>2],m[t+272>>2]=n*y(y(g+y(_*y(y(y(c*f)-y(b*h))+m[e+316>>2])))+y(u*y(y(y(p*h)-y(c*a))+m[e+320>>2])))}else n=m[t+204>>2],d[t+272>>2]=0,m[t+32>>2]=n,d[t+12>>2]=0,m[t+8>>2]=-m[t+60>>2],m[t+4>>2]=-m[t+56>>2],m[t>>2]=-m[t+52>>2],l=y(-1),n=y(1);return m[t+268>>2]=n,O=i+48|0,l}function Wt(e,t,i,n,r){var o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=0,v=y(0);if(o=d[e+9288>>2]){if((a=d[o+48>>2])&&(d[a+44>>2]=d[o+44>>2]),(a=d[o+44>>2])&&(d[a+48>>2]=d[o+48>>2]),d[e+9288>>2]==(0|o)&&(d[e+9288>>2]=d[o+48>>2]),d[(a=e+9292|0)>>2]=d[a>>2]+-1,d[o+44>>2]=0,d[o+48>>2]=d[e+9280>>2],(a=d[e+9280>>2])&&(d[a+44>>2]=o),d[e+9280>>2]=o,d[(a=e+9284|0)>>2]=d[a>>2]+1,d[o+28>>2]=n,d[o+24>>2]=i,d[o+20>>2]=t,s[o+55|0]=0,_=m[i+24>>2],v=m[n+24>>2],l=m[t+24>>2],u=m[n+20>>2],h=m[t+20>>2],p=m[i+20>>2],f=m[i+16>>2],g=m[n+16>>2],c=m[t+16>>2],d[o+12>>2]=0,f=y(f-c),u=y(u-h),p=y(p-h),c=y(g-c),h=y(y(f*u)-y(p*c)),m[o+8>>2]=h,_=y(_-l),g=y(_*c),c=y(v-l),l=y(g-y(f*c)),m[o+4>>2]=l,c=y(y(p*c)-y(_*u)),m[o>>2]=c,b=2,(l=y(x(y(y(y(c*c)+y(l*l))+y(h*h)))))>y(9999999747378752e-20)){if(Ln(o,t,i,a=o+16|0)||Ln(o,i,n,a)||Ln(o,n,t,a)||(m[o+16>>2]=y(y(y(m[t+16>>2]*m[o>>2])+y(m[t+20>>2]*m[o+4>>2]))+y(m[t+24>>2]*m[o+8>>2]))/l),l=y(y(1)/l),m[o>>2]=l*m[o>>2],m[o+4>>2]=l*m[o+4>>2],m[o+8>>2]=l*m[o+8>>2],r)return o;if(b=3,m[a>>2]>=y(-9999999747378752e-21))return o}return d[e>>2]=b,(t=d[o+48>>2])&&(d[t+44>>2]=d[o+44>>2]),(t=d[o+44>>2])&&(d[t+48>>2]=d[o+48>>2]),d[e+9280>>2]==(0|o)&&(d[e+9280>>2]=d[o+48>>2]),d[e+9284>>2]=d[e+9284>>2]+-1,d[o+44>>2]=0,d[o+48>>2]=d[e+9288>>2],(t=d[e+9288>>2])&&(d[t+44>>2]=o),d[e+9288>>2]=o,d[e+9292>>2]=d[e+9292>>2]+1,0}return d[e>>2]=5,0}function zt(e,t,i,n,r,s){var o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),d=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0);o=m[r>>2],a=m[r+4>>2],l=m[r+8>>2],y(y(y(o*o)+y(a*a))+y(l*l))>y(1.100000023841858)?o=y(0):(_=y(m[t+4>>2]-m[e+56>>2]),c=y(m[t+8>>2]-m[e+60>>2]),b=y(y(l*_)-y(a*c)),d=y(m[t>>2]-m[e+52>>2]),v=y(y(o*c)-y(l*d)),A=y(y(a*d)-y(o*_)),T=y(y(y(b*m[e+4>>2])+y(v*m[e+20>>2]))+y(A*m[e+36>>2])),u=y(m[n+8>>2]-m[i+60>>2]),p=y(m[n+4>>2]-m[i+56>>2]),C=y(y(a*u)-y(l*p)),f=y(m[n>>2]-m[i+52>>2]),S=y(y(l*f)-y(o*u)),x=y(y(o*p)-y(a*f)),E=y(y(y(C*m[i+4>>2])+y(S*m[i+20>>2]))+y(x*m[i+36>>2])),h=o,o=m[e+332>>2],g=m[e+336>>2],R=m[i+332>>2],P=m[i+336>>2],I=y(h*y(y(y(y(c*o)-y(_*g))+m[e+312>>2])-y(y(y(u*R)-y(p*P))+m[i+312>>2]))),h=a,a=m[e+328>>2],g=y(m[e+316>>2]+y(y(d*g)-y(c*a))),c=m[i+328>>2],a=y(y(y(I+y(h*y(g-y(m[i+316>>2]+y(y(f*P)-y(u*c))))))+y(l*y(y(y(y(_*a)-y(d*o))+m[e+320>>2])-y(y(y(p*c)-y(f*R))+m[i+320>>2]))))*y(-.20000000298023224)),o=y(y(y(b*m[e+8>>2])+y(v*m[e+24>>2]))+y(A*m[e+40>>2])),h=y(y(T*y(T*m[e+396>>2]))+y(o*y(o*m[e+400>>2]))),o=y(y(y(b*m[e+12>>2])+y(v*m[e+28>>2]))+y(A*m[e+44>>2])),h=y(m[i+344>>2]+y(m[e+344>>2]+y(h+y(o*y(o*m[e+404>>2]))))),o=y(y(y(C*m[i+8>>2])+y(S*m[i+24>>2]))+y(x*m[i+40>>2])),l=y(y(E*y(E*m[i+396>>2]))+y(o*y(o*m[i+400>>2]))),o=y(y(y(C*m[i+12>>2])+y(S*m[i+28>>2]))+y(x*m[i+44>>2])),o=y(a*y(y(1)/y(h+y(l+y(o*y(o*m[i+404>>2]))))))),m[s>>2]=o}function Ht(e,t){var i,n=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=0;O=i=O+-64|0,p=d[t+192>>2],r[d[d[p>>2]+8>>2]](p,t+4|0,i+48|0,i+32|0),n=m[6601],a=y(m[i+48>>2]-n),m[i+48>>2]=a,l=y(m[i+52>>2]-n),m[i+52>>2]=l,c=y(m[i+56>>2]-n),m[i+56>>2]=c,o=y(n+m[i+32>>2]),m[i+32>>2]=o,h=y(n+m[i+36>>2]),m[i+36>>2]=h,_=y(n+m[i+40>>2]),m[i+40>>2]=_,3&u[t+204|0]|!u[e+44|0]|2!=d[t+236>>2]||(p=d[t+192>>2],r[d[d[p>>2]+8>>2]](p,t+68|0,i+16|0,i),l=y(m[i+16>>2]-n),m[i+16>>2]=l,c=y(m[i+20>>2]-n),m[i+20>>2]=c,o=y(m[i+24>>2]-n),m[i+24>>2]=o,h=y(n+m[i>>2]),m[i>>2]=h,_=y(n+m[i+4>>2]),m[i+4>>2]=_,n=y(n+m[i+8>>2]),m[i+8>>2]=n,l<(a=m[i+48>>2])&&(m[i+48>>2]=l,a=l),c<(l=m[i+52>>2])&&(m[i+52>>2]=c,l=c),o<(c=m[i+56>>2])&&(m[i+56>>2]=o,c=o),(o=m[i+28>>2])>2]&&(m[i+60>>2]=o),(o=m[i+32>>2])>2]=h,o=h),(h=m[i+36>>2])<_&&(m[i+36>>2]=_,h=_),(_=m[i+40>>2])>2]=n,_=n),n=m[i+12>>2],m[i+44>>2]>2]=n)),p=d[e+68>>2],1&s[t+204|0]||(a=y(o-a),o=y(a*a),a=y(h-l),o=y(o+y(a*a)),a=y(_-c),y(o+y(a*a))>2]+16>>2]](p,d[t+188>>2],i+48|0,i+32|0,d[e+24>>2]):(4!=(-2&d[t+216>>2])&&(d[t+216>>2]=5),u[27960]||(t=d[e+72>>2])&&(s[27960]=1,r[d[d[t>>2]+36>>2]](t,7508),t=d[e+72>>2],r[d[d[t>>2]+36>>2]](t,7557),t=d[e+72>>2],r[d[d[t>>2]+36>>2]](t,7625),e=d[e+72>>2],r[d[d[e>>2]+36>>2]](e,7690))),O=i- -64|0}function Xt(e,t,i,n){var o;!function(e,t,i){d[e>>2]=7456,s[e+76|0]=1,d[e+72>>2]=0,d[e+68>>2]=i,d[e+28>>2]=0,d[e+32>>2]=0,d[e+24>>2]=t,s[e+20|0]=1,d[e+16>>2]=0,d[e- -64>>2]=0,s[e+60|0]=0,d[e+56>>2]=1025758986,s[e+54|0]=1,_[e+52>>1]=256,d[e+48>>2]=0,s[e+44|0]=1,d[e+36>>2]=1,d[e+40>>2]=1065353216,d[e+8>>2]=0,d[e+12>>2]=0}(e,t,i),d[(i=e)+100>>2]=1050253722,d[i+104>>2]=1015580809,d[i+92>>2]=1058642330,d[i+96>>2]=1065353216,d[i+88>>2]=0,d[i+80>>2]=0,d[i+84>>2]=0,d[i+124>>2]=1045220557,d[i+128>>2]=1061997773,d[i+108>>2]=0,d[i+112>>2]=10,d[i+168>>2]=1120403456,d[i+172>>2]=1900671690,d[i+164>>2]=128,d[i+156>>2]=260,d[i+160>>2]=2,d[i+148>>2]=0,d[i+152>>2]=1062836634,d[i+140>>2]=-1121724662,d[i+144>>2]=1036831949,d[i+132>>2]=0,d[i+136>>2]=1,d[i+116>>2]=1101004800,d[i+120>>2]=1065353216,s[i+192|0]=1,d[i>>2]=17980,d[i+188>>2]=0,d[i+180>>2]=0,d[i+184>>2]=0,s[i+224|0]=1,d[i+200>>2]=n,d[i+196>>2]=0,d[i+212>>2]=0,d[i+216>>2]=0,d[i+220>>2]=0,s[i+244|0]=1,_[i+274>>1]=0,d[i+240>>2]=0,d[i+232>>2]=0,d[i+236>>2]=0,d[i+248>>2]=0,d[i+252>>2]=-1054867456,d[i+256>>2]=0,d[i+260>>2]=0,d[i+264>>2]=0,d[i+268>>2]=0,s[i+292|0]=1,d[i+296>>2]=0,d[i+288>>2]=0,d[i+280>>2]=0,d[i+284>>2]=0,s[i+320|0]=1,s[i+300|0]=1,d[i+316>>2]=0,d[i+308>>2]=0,d[i+312>>2]=0,o=i,n?i=0:(d[7717]=d[7717]+1,fr(i=0|r[d[6606]](196,16)),d[e+200>>2]=i,i=1),s[o+273|0]=i,d[7717]=d[7717]+1,function(e){d[e>>2]=17876,d[e+16>>2]=0,s[e+20|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,d[e+36>>2]=0,s[e+40|0]=1,s[e+60|0]=1,d[e+28>>2]=0,d[e+32>>2]=0,d[e+56>>2]=0,s[e+64|0]=1,d[e+48>>2]=0,d[e+52>>2]=0}(i=0|r[d[6606]](68,16)),s[e+272|0]=1,d[e+204>>2]=i,d[7717]=d[7717]+1,i=0|r[d[6606]](88,16),n=d[e+200>>2],s[i+44|0]=1,d[i+24>>2]=t,d[i+20>>2]=0,d[i+12>>2]=0,d[i+16>>2]=0,d[i+8>>2]=n,d[i+4>>2]=0,d[i>>2]=18620,d[i+40>>2]=0,s[i+64|0]=1,d[i+32>>2]=0,d[i+36>>2]=0,d[i+60>>2]=0,s[i+84|0]=1,d[i+52>>2]=0,d[i+56>>2]=0,d[i+80>>2]=0,d[i+72>>2]=0,d[i+76>>2]=0,d[e+196>>2]=i}function Yt(e,t){var i=0,n=0;2&u[e+204|0]?(i=d[e+8>>2],d[e+68>>2]=d[e+4>>2],d[e+72>>2]=i,i=d[e+16>>2],d[e+76>>2]=d[e+12>>2],d[e+80>>2]=i,i=d[e+24>>2],d[e+84>>2]=d[e+20>>2],d[e+88>>2]=i,i=d[e+32>>2],d[e+92>>2]=d[e+28>>2],d[e+96>>2]=i,i=d[e+40>>2],d[e+100>>2]=d[e+36>>2],d[e+104>>2]=i,i=d[e+48>>2],d[e+108>>2]=d[e+44>>2],d[e+112>>2]=i,i=d[e+56>>2],d[e+116>>2]=d[e+52>>2],d[e+120>>2]=i,i=d[e+64>>2],d[e+124>>2]=d[e+60>>2],d[e+128>>2]=i):(n=d[(i=t)+4>>2],d[e+68>>2]=d[i>>2],d[e+72>>2]=n,n=d[i+12>>2],d[e+76>>2]=d[i+8>>2],d[e+80>>2]=n,n=d[i+28>>2],d[e+92>>2]=d[i+24>>2],d[e+96>>2]=n,n=d[i+20>>2],d[e+84>>2]=d[i+16>>2],d[e+88>>2]=n,n=d[i+36>>2],d[e+100>>2]=d[i+32>>2],d[e+104>>2]=n,n=d[i+44>>2],d[e+108>>2]=d[i+40>>2],d[e+112>>2]=n,n=d[i+60>>2],d[e+124>>2]=d[i+56>>2],d[e+128>>2]=n,n=d[i+52>>2],d[e+116>>2]=d[i+48>>2],d[e+120>>2]=n),i=d[e+332>>2],d[e+148>>2]=d[e+328>>2],d[e+152>>2]=i,i=d[e+316>>2],d[e+132>>2]=d[e+312>>2],d[e+136>>2]=i,i=d[e+340>>2],d[e+156>>2]=d[e+336>>2],d[e+160>>2]=i,i=d[e+324>>2],d[e+140>>2]=d[e+320>>2],d[e+144>>2]=i,i=d[t+12>>2],d[e+12>>2]=d[t+8>>2],d[e+16>>2]=i,i=d[t+4>>2],d[e+4>>2]=d[t>>2],d[e+8>>2]=i,i=d[t+28>>2],d[e+28>>2]=d[t+24>>2],d[e+32>>2]=i,i=d[t+20>>2],d[e+20>>2]=d[t+16>>2],d[e+24>>2]=i,i=d[t+44>>2],d[e+44>>2]=d[t+40>>2],d[e+48>>2]=i,i=d[t+36>>2],d[e+36>>2]=d[t+32>>2],d[e+40>>2]=i,i=d[t+60>>2],d[e+60>>2]=d[t+56>>2],d[e+64>>2]=i,i=d[t+52>>2],d[e+52>>2]=d[t+48>>2],d[e+56>>2]=i,Tn(e)}function Qt(e,t,i,n){var r=y(0),s=y(0),o=0,a=y(0),l=0,c=y(0),h=y(0),f=0,g=0,b=0,v=0,A=0,C=0;e:{if(u[e+60|0]){if(h=m[e+12>>2],s=m[e+44>>2],f=(r=y(y(m[i+8>>2]-h)*s))=y(0)?~~r>>>0:0,a=m[e+8>>2],r=m[e+40>>2],g=(c=y(y(m[i+4>>2]-a)*r))=y(0)?~~c>>>0:0,b=(s=y(y(s*y(m[n+8>>2]-h))+y(1)))=y(0)?~~s>>>0:0,o=(r=y(y(r*y(m[n+4>>2]-a))+y(1)))=y(0)?~~r>>>0:0,l=d[e+136>>2],C=p[(v=l+(t<<4)|0)>>1],a=m[e+4>>2],r=m[e+36>>2],i=C>>>0<=(A=65534&(e=(s=y(y(m[i>>2]-a)*r))=y(0)?~~s>>>0:0))>>>0,e=(r=y(y(r*y(m[n>>2]-a))+y(1)))=y(0)?~~r>>>0:0,i||(_[v>>1]=A),e|=1,p[6+(i=l+(t<<4)|0)>>1]>>0&&(_[i+6>>1]=e),e=65534&g,p[i+2>>1]>e>>>0&&(_[i+2>>1]=e),e=1|o,p[8+(i=n=l+(t<<4)|0)>>1]>>0&&(_[i+8>>1]=e),e=65534&f,p[n+4>>1]>e>>>0&&(_[n+4>>1]=e),e=1|b,p[10+(t=l+(t<<4)|0)>>1]>=e>>>0)break e;return void(_[t+10>>1]=e)}r=m[i>>2],o=d[e+96>>2],r>2]&&(m[e>>2]=r),(r=m[i+4>>2])>2]&&(m[e+4>>2]=r),(r=m[i+8>>2])>2]&&(m[e+8>>2]=r),(r=m[i+12>>2])>2]&&(m[e+12>>2]=r),e=o+(t<<6)|0,r=m[n>>2],m[e+16>>2]>2]=r),r=m[n+4>>2],m[e+20>>2]>2]=r),e=t=o+(t<<6)|0,r=m[n+8>>2],m[e+24>>2]>2]=r),r=m[n+12>>2],m[t+28>>2]>2]=r)}}function qt(e,t){var i;O=i=O-112|0,d[i+108>>2]=e,d[i+104>>2]=t,e=d[i+108>>2],m[i+100>>2]=vh(d[i+104>>2]),m[i+96>>2]=y(2)/m[i+100>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+92>>2]=m[d[t+12>>2]>>2]*m[i+96>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+88>>2]=m[d[t+12>>2]+4>>2]*m[i+96>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+84>>2]=m[d[t+12>>2]+8>>2]*m[i+96>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+80>>2]=m[d[t+12>>2]+12>>2]*m[i+92>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+76>>2]=m[d[t+12>>2]+12>>2]*m[i+88>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+72>>2]=m[d[t+12>>2]+12>>2]*m[i+84>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+68>>2]=m[d[t+12>>2]>>2]*m[i+92>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+64>>2]=m[d[t+12>>2]>>2]*m[i+88>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+60>>2]=m[d[t+12>>2]>>2]*m[i+84>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+56>>2]=m[d[t+12>>2]+4>>2]*m[i+88>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+52>>2]=m[d[t+12>>2]+4>>2]*m[i+84>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],m[i+48>>2]=m[d[t+12>>2]+8>>2]*m[i+84>>2],m[i+44>>2]=y(1)-y(m[i+56>>2]+m[i+48>>2]),m[i+40>>2]=m[i+64>>2]-m[i+72>>2],m[i+36>>2]=m[i+60>>2]+m[i+76>>2],m[i+32>>2]=m[i+64>>2]+m[i+72>>2],m[i+28>>2]=y(1)-y(m[i+68>>2]+m[i+48>>2]),m[i+24>>2]=m[i+52>>2]-m[i+80>>2],m[i+20>>2]=m[i+60>>2]-m[i+76>>2],m[i+16>>2]=m[i+52>>2]+m[i+80>>2],m[i+12>>2]=y(1)-y(m[i+68>>2]+m[i+56>>2]),vs(e,i+44|0,i+40|0,i+36|0,i+32|0,i+28|0,i+24|0,i+20|0,i+16|0,i+12|0),O=i+112|0}function Kt(e,t,i){var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=0;(n=m[i+128>>2])!=y(0)&&(d[7468]=d[7468]+1,a=n,n=m[i+96>>2],o=m[i+16>>2],l=m[i+20>>2],c=m[i+24>>2],r=m[i+108>>2],r=y(y(y(a-y(n*m[i+116>>2]))-y(y(y(y(y(o*m[e+144>>2])+y(l*m[e+148>>2]))+y(c*m[e+152>>2]))+y(y(y(m[i>>2]*m[e+160>>2])+y(m[i+4>>2]*m[e+164>>2]))+y(m[i+8>>2]*m[e+168>>2])))*r))-y(r*y(y(y(y(m[i+48>>2]*m[t+144>>2])+y(m[i+52>>2]*m[t+148>>2]))+y(m[i+56>>2]*m[t+152>>2]))+y(y(y(m[i+32>>2]*m[t+160>>2])+y(m[i+36>>2]*m[t+164>>2]))+y(m[i+40>>2]*m[t+168>>2]))))),h=(a=y(n+r))<(s=m[i+120>>2]),m[i+96>>2]=h?s:a,n=h?y(s-n):r,d[e+240>>2]&&(m[e+144>>2]=y(m[e+112>>2]*y(n*y(o*m[e+128>>2])))+m[e+144>>2],m[e+148>>2]=y(y(n*y(l*m[e+132>>2]))*m[e+116>>2])+m[e+148>>2],m[e+152>>2]=y(y(n*y(c*m[e+136>>2]))*m[e+120>>2])+m[e+152>>2],r=m[i+72>>2],s=m[i+68>>2],m[e+160>>2]=y(y(n*m[e+96>>2])*m[i+64>>2])+m[e+160>>2],o=m[e+104>>2],m[e+164>>2]=y(s*y(n*m[e+100>>2]))+m[e+164>>2],m[e+168>>2]=y(r*y(n*o))+m[e+168>>2]),d[t+240>>2]&&(r=m[i+56>>2],s=m[i+52>>2],m[t+144>>2]=y(m[t+112>>2]*y(n*y(m[i+48>>2]*m[t+128>>2])))+m[t+144>>2],m[t+148>>2]=y(y(n*y(s*m[t+132>>2]))*m[t+116>>2])+m[t+148>>2],m[t+152>>2]=y(y(n*y(r*m[t+136>>2]))*m[t+120>>2])+m[t+152>>2],r=m[i+88>>2],s=m[i+84>>2],m[t+160>>2]=y(y(n*m[t+96>>2])*m[i+80>>2])+m[t+160>>2],o=m[t+104>>2],m[t+164>>2]=y(s*y(n*m[t+100>>2]))+m[t+164>>2],m[t+168>>2]=y(r*y(n*o))+m[t+168>>2]))}function Zt(e,t,i,n){var r,s,o=y(0),a=0,l=0,c=0,h=0,_=y(0),u=0,p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=0,S=y(0),x=y(0),T=y(0);for(O=r=O-32|0,c=(l=d[e+12>>2])+b((i+n|0)/2|0,24)|0,s=d[c+20>>2],f=m[c+16>>2],S=m[c+8>>2],x=m[c+4>>2],T=m[c>>2],c=i,u=n;;){for(g=m[t>>2],_=y(T-g),o=y(_*_),v=m[t+4>>2],_=y(x-v),o=y(o+y(_*_)),A=m[t+8>>2],_=y(S-A),_=y(o+y(_*_));;){e:{a=b(c,24)+l|0;t:{if((o=m[a+16>>2])!=f){if(o>2]-g),p=y(o*o),o=y(m[a+4>>2]-v),p=y(p+y(o*o)),o=y(m[a+8>>2]-A),1!=(0|((o=y(p+y(o*o)))!=_?o<_:d[a+20>>2]<(0|s))))break e}c=c+1|0;continue}break}for(;;){e:{C=b(u,24);t:{if(f!=(o=m[16+(h=C+l|0)>>2])){if(f>2]-g),p=y(o*o),o=y(m[h+4>>2]-v),p=y(p+y(o*o)),o=y(m[h+8>>2]-A),1!=(0|(_!=(o=y(p+y(o*o)))?_>2])))break e}u=u+-1|0;continue}break}if((0|c)<=(0|u)&&(l=d[a+20>>2],d[r+24>>2]=d[a+16>>2],d[r+28>>2]=l,l=d[a+12>>2],d[r+16>>2]=d[a+8>>2],d[r+20>>2]=l,l=d[a+4>>2],d[r+8>>2]=d[a>>2],d[r+12>>2]=l,l=d[h+4>>2],d[a>>2]=d[h>>2],d[a+4>>2]=l,l=d[h+12>>2],d[a+8>>2]=d[h+8>>2],d[a+12>>2]=l,l=d[h+20>>2],d[a+16>>2]=d[h+16>>2],d[a+20>>2]=l,l=d[r+12>>2],a=d[e+12>>2]+C|0,d[a>>2]=d[r+8>>2],d[a+4>>2]=l,h=d[r+28>>2],d[a+16>>2]=d[r+24>>2],d[a+20>>2]=h,h=d[r+20>>2],d[a+8>>2]=d[r+16>>2],d[a+12>>2]=h,u=u+-1|0,c=c+1|0),!((0|c)<=(0|u)))break;l=d[e+12>>2]}(0|u)>(0|i)&&Zt(e,t,i,u),(0|c)<(0|n)&&Zt(e,t,c,n),O=r+32|0}function $t(e,t,i){var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0);o=m[i+100>>2],a=m[i+16>>2],l=m[i+20>>2],c=m[i+24>>2],r=m[i+108>>2],n=y(y(y(m[i+112>>2]-y(o*m[i+116>>2]))-y(y(y(y(y(a*m[e+64>>2])+y(l*m[e+68>>2]))+y(c*m[e+72>>2]))+y(y(y(m[i>>2]*m[e+80>>2])+y(m[i+4>>2]*m[e+84>>2]))+y(m[i+8>>2]*m[e+88>>2])))*r))-y(r*y(y(y(y(m[i+48>>2]*m[t+64>>2])+y(m[i+52>>2]*m[t+68>>2]))+y(m[i+56>>2]*m[t+72>>2]))+y(y(y(m[i+32>>2]*m[t+80>>2])+y(m[i+36>>2]*m[t+84>>2]))+y(m[i+40>>2]*m[t+88>>2]))))),((r=y(o+n))<(s=m[i+120>>2])||r>(s=m[i+124>>2]))&&(n=y(s-o),r=s),m[i+100>>2]=r,d[e+240>>2]&&(m[e+64>>2]=y(m[e+112>>2]*y(n*y(a*m[e+128>>2])))+m[e+64>>2],m[e+68>>2]=y(y(n*y(l*m[e+132>>2]))*m[e+116>>2])+m[e+68>>2],m[e+72>>2]=y(y(n*y(c*m[e+136>>2]))*m[e+120>>2])+m[e+72>>2],r=m[i+72>>2],s=m[i+68>>2],m[e+80>>2]=y(y(n*m[e+96>>2])*m[i+64>>2])+m[e+80>>2],o=m[e+104>>2],m[e+84>>2]=y(s*y(n*m[e+100>>2]))+m[e+84>>2],m[e+88>>2]=y(r*y(n*o))+m[e+88>>2]),d[t+240>>2]&&(r=m[i+56>>2],s=m[i+52>>2],m[t+64>>2]=y(m[t+112>>2]*y(n*y(m[i+48>>2]*m[t+128>>2])))+m[t+64>>2],m[t+68>>2]=y(y(n*y(s*m[t+132>>2]))*m[t+116>>2])+m[t+68>>2],m[t+72>>2]=y(y(n*y(r*m[t+136>>2]))*m[t+120>>2])+m[t+72>>2],r=m[i+88>>2],s=m[i+84>>2],m[t+80>>2]=y(y(n*m[t+96>>2])*m[i+80>>2])+m[t+80>>2],o=m[t+104>>2],m[t+84>>2]=y(s*y(n*m[t+100>>2]))+m[t+84>>2],m[t+88>>2]=y(r*y(n*o))+m[t+88>>2])}function Jt(e,t,i,n,s,o,a){var l,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=0,g=0,b=y(0),v=y(0),A=y(0);O=l=O-128|0,t&&(!d[t+40>>2]|((0|a)>-1?(0|i)>=(0|a):0)||(f=i+1|0,Jt(e,d[t+36>>2],f,n,s,o,a),Jt(e,d[t+40>>2],f,n,s,o,a)),(0|i)<(0|o)||(c=m[t+20>>2],h=m[t+24>>2],o=d[t+40>>2],_=m[t+16>>2],b=m[t>>2],u=m[t+4>>2],p=m[t+8>>2],d[l+124>>2]=0,d[l+108>>2]=0,d[l+92>>2]=0,d[l+76>>2]=0,d[l+60>>2]=0,d[l+44>>2]=0,d[l+28>>2]=0,v=y(y(p+h)*y(.5)),p=y(y(h-p)*y(.5)),h=y(v+p),m[l+120>>2]=h,A=y(y(u+c)*y(.5)),u=y(y(c-u)*y(.5)),c=y(A+u),m[l+116>>2]=c,m[l+104>>2]=h,m[l+100>>2]=c,m[l+88>>2]=h,u=y(A-u),m[l+84>>2]=u,m[l+72>>2]=h,m[l+68>>2]=u,h=y(v-p),m[l+56>>2]=h,m[l+52>>2]=c,m[l+40>>2]=h,m[l+36>>2]=c,m[l+24>>2]=h,m[l+20>>2]=u,d[l+12>>2]=0,p=y(y(b+_)*y(.5)),_=y(y(_-b)*y(.5)),c=y(p-_),m[l+112>>2]=c,_=y(p+_),m[l+96>>2]=_,m[l+80>>2]=_,m[l+64>>2]=c,m[l+48>>2]=c,m[l+32>>2]=_,m[l+16>>2]=_,m[l>>2]=c,m[l+8>>2]=h,m[l+4>>2]=u,i=l+16|0,t=o?n:s,r[d[d[e>>2]+8>>2]](e,l,i,t),n=l+32|0,r[d[d[e>>2]+8>>2]](e,i,n,t),s=l+48|0,r[d[d[e>>2]+8>>2]](e,n,s,t),r[d[d[e>>2]+8>>2]](e,s,l,t),o=l- -64|0,a=l+80|0,r[d[d[e>>2]+8>>2]](e,o,a,t),f=l+96|0,r[d[d[e>>2]+8>>2]](e,a,f,t),g=l+112|0,r[d[d[e>>2]+8>>2]](e,f,g,t),r[d[d[e>>2]+8>>2]](e,g,o,t),r[d[d[e>>2]+8>>2]](e,l,o,t),r[d[d[e>>2]+8>>2]](e,i,a,t),r[d[d[e>>2]+8>>2]](e,n,f,t),r[d[d[e>>2]+8>>2]](e,s,g,t))),O=l+128|0}function ei(e,t){var i,n=0,r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0;O=i=O-32|0;e:if(!((0|(t=(0|t)<=-1?d[e+12>>2]:t))<1)&&(r=d[e>>2]))for(;;){if(c=0,d[(o=r+40|0)>>2])for(;(s=d[r+32>>2])>>>0<=r>>>0?s=r:(a=(0|(n=d[s+40>>2]))==(0|r),_=d[36+((h=((0|r)!=(0|n))<<2)+s|0)>>2],l=e,(n=d[s+32>>2])&&(l=36+(n+((d[n+40>>2]==(0|s))<<2)|0)|0),d[l>>2]=r,d[_+32>>2]=r,d[s+32>>2]=r,d[r+32>>2]=n,d[s+36>>2]=d[r+36>>2],d[s+40>>2]=d[o>>2],d[d[r+36>>2]+32>>2]=s,d[d[o>>2]+32>>2]=s,d[(n=r+36|0)+(a<<2)>>2]=s,d[n+h>>2]=_,o=d[4+(n=s+24|0)>>2],d[i+24>>2]=d[n>>2],d[i+28>>2]=o,o=d[4+(n=s+16|0)>>2],d[i+16>>2]=d[n>>2],d[i+20>>2]=o,o=d[4+(n=s+8|0)>>2],d[i+8>>2]=d[n>>2],d[i+12>>2]=o,n=d[s+4>>2],d[i>>2]=d[s>>2],d[i+4>>2]=n,o=d[4+(n=r+24|0)>>2],d[s+24>>2]=d[n>>2],d[s+28>>2]=o,o=d[4+(n=r+16|0)>>2],d[s+16>>2]=d[n>>2],d[s+20>>2]=o,o=d[4+(n=r+8|0)>>2],d[s+8>>2]=d[n>>2],d[s+12>>2]=o,n=d[r+4>>2],d[s>>2]=d[r>>2],d[s+4>>2]=n,n=d[i+28>>2],d[r+24>>2]=d[i+24>>2],d[r+28>>2]=n,n=d[i+20>>2],d[r+16>>2]=d[i+16>>2],d[r+20>>2]=n,n=d[i+12>>2],d[r+8>>2]=d[i+8>>2],d[r+12>>2]=n,n=d[i+4>>2],d[r>>2]=d[i>>2],d[r+4>>2]=n),r=d[e+16>>2]>>>c|0,c=c+1&31,r=d[36+(((1&r)<<2)+s|0)>>2],d[(o=r+40|0)>>2];);if(l=s=e,a=0,Xi(s,r)&&(a=d[e>>2]),Tt(l,a,r),d[e+16>>2]=d[e+16>>2]+1,!(t=t+-1|0))break e;r=d[e>>2]}O=i+32|0}function ti(e){var t,i=0,n=0,o=0,a=0,l=0,c=0,h=0,_=0;if(!((0|(t=d[e+36>>2]))>=(0|(n=d[e+12>>2])))){e:if(d[e+40>>2]>=(0|n))i=d[e+44>>2];else{o=t,n&&(d[7717]=d[7717]+1,i=0|r[d[6606]](n<<2,16),o=d[e+36>>2]),l=d[e+44>>2];t:{if((0|o)>=1)for(;;)if(d[(c=a<<2)+i>>2]=d[l+c>>2],(0|(a=a+1|0))==(0|o))break t;if(!l){d[e+44>>2]=i,d[e+40>>2]=n,s[e+48|0]=1;break e}}u[e+48|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+44>>2]=i,s[e+48|0]=1,d[e+40>>2]=n}if(Mn((o=t<<2)+i|0,0,(c=n<<2)-o|0),d[e+36>>2]=n,(0|(l=d[e+56>>2]))<(0|n)){e:if(d[e+60>>2]>=(0|n))i=d[e- -64>>2];else{a=0,o=l,i=0,n&&(d[7717]=d[7717]+1,i=0|r[d[6606]](c,16),o=d[e+56>>2]),h=d[e- -64>>2];t:{if((0|o)>=1)for(;;)if(d[(_=a<<2)+i>>2]=d[h+_>>2],(0|(a=a+1|0))==(0|o))break t;if(!h){d[e+64>>2]=i,d[e+60>>2]=n,s[e+68|0]=1;break e}}u[e+68|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+64>>2]=i,s[e+68|0]=1,d[e+60>>2]=n}Mn((o=l<<2)+i|0,0,c-o|0)}if(d[e+56>>2]=n,(0|n)>=1&&(Mn(d[e+44>>2],255,c),Mn(d[e- -64>>2],255,c)),!((0|t)<1))for(o=d[e- -64>>2],l=d[e+16>>2],n=d[e+44>>2],a=0;i=d[d[4+(i=l+(a<<4)|0)>>2]+12>>2]<<16|d[d[i>>2]+12>>2],i=b((i=(i<<15^-1)+i|0)>>10^i,9),i=((i^=i>>6)<<11^-1)+i|0,i=n+((d[e+12>>2]+-1&(i>>16^i))<<2)|0,d[o+(a<<2)>>2]=d[i>>2],d[i>>2]=a,(0|t)!=(0|(a=a+1|0)););}}function ii(e,t){var i=0,n=0,o=0,a=0,l=0,c=0,h=0,_=0;if(l=n=d[e+4>>2],(0|n)==d[e+8>>2]&&(l=n,!((0|n)>=(0|(c=n?n<<1:1))))){if(c?(d[7717]=d[7717]+1,_=0|r[d[6606]](b(c,244),16),l=d[e+4>>2]):l=n,(0|l)>=1)for(;o=(i=b(h,244))+_|0,i=i+d[e+12>>2]|0,a=d[i+4>>2],d[o>>2]=d[i>>2],d[o+4>>2]=a,a=d[i+12>>2],d[o+8>>2]=d[i+8>>2],d[o+12>>2]=a,a=d[i+28>>2],d[o+24>>2]=d[i+24>>2],d[o+28>>2]=a,a=d[i+20>>2],d[o+16>>2]=d[i+16>>2],d[o+20>>2]=a,a=d[i+44>>2],d[o+40>>2]=d[i+40>>2],d[o+44>>2]=a,a=d[i+36>>2],d[o+32>>2]=d[i+32>>2],d[o+36>>2]=a,a=d[i+52>>2],d[o+48>>2]=d[i+48>>2],d[o+52>>2]=a,a=d[i+60>>2],d[o+56>>2]=d[i+56>>2],d[o+60>>2]=a,Mi(o- -64|0,i- -64|0,180),(0|l)!=(0|(h=h+1|0)););(l=d[e+12>>2])&&(u[e+16|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+12>>2]=0),d[e+12>>2]=_,s[e+16|0]=1,d[e+8>>2]=c,l=d[e+4>>2]}return d[e+4>>2]=l+1,o=d[t+12>>2],n=(l=b(n,244))+d[e+12>>2]|0,d[(i=n)+8>>2]=d[t+8>>2],d[i+12>>2]=o,i=d[t+4>>2],d[n>>2]=d[t>>2],d[n+4>>2]=i,i=d[t+28>>2],d[n+24>>2]=d[t+24>>2],d[n+28>>2]=i,i=d[t+20>>2],d[n+16>>2]=d[t+16>>2],d[n+20>>2]=i,i=d[t+36>>2],d[n+32>>2]=d[t+32>>2],d[n+36>>2]=i,i=d[t+44>>2],d[n+40>>2]=d[t+40>>2],d[n+44>>2]=i,i=d[t+52>>2],d[n+48>>2]=d[t+48>>2],d[n+52>>2]=i,i=d[t+60>>2],d[n+56>>2]=d[t+56>>2],d[n+60>>2]=i,Mi(n- -64|0,t- -64|0,180),l+d[e+12>>2]|0}function ni(e,t,i){var n,r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0);r=m[i+100>>2],a=m[i+16>>2],l=m[i+20>>2],c=m[i+24>>2],s=m[i+108>>2],s=y(y(y(m[i+112>>2]-y(r*m[i+116>>2]))-y(y(y(y(y(a*m[e+64>>2])+y(l*m[e+68>>2]))+y(c*m[e+72>>2]))+y(y(y(m[i>>2]*m[e+80>>2])+y(m[i+4>>2]*m[e+84>>2]))+y(m[i+8>>2]*m[e+88>>2])))*s))-y(s*y(y(y(y(m[i+48>>2]*m[t+64>>2])+y(m[i+52>>2]*m[t+68>>2]))+y(m[i+56>>2]*m[t+72>>2]))+y(y(y(m[i+32>>2]*m[t+80>>2])+y(m[i+36>>2]*m[t+84>>2]))+y(m[i+40>>2]*m[t+88>>2]))))),n=(h=y(r+s))<(o=m[i+120>>2]),m[i+100>>2]=n?o:h,r=n?y(o-r):s,d[e+240>>2]&&(m[e+64>>2]=y(m[e+112>>2]*y(r*y(a*m[e+128>>2])))+m[e+64>>2],m[e+68>>2]=y(y(r*y(l*m[e+132>>2]))*m[e+116>>2])+m[e+68>>2],m[e+72>>2]=y(y(r*y(c*m[e+136>>2]))*m[e+120>>2])+m[e+72>>2],s=m[i+72>>2],o=m[i+68>>2],m[e+80>>2]=y(y(r*m[e+96>>2])*m[i+64>>2])+m[e+80>>2],a=m[e+104>>2],m[e+84>>2]=y(o*y(r*m[e+100>>2]))+m[e+84>>2],m[e+88>>2]=y(s*y(r*a))+m[e+88>>2]),d[t+240>>2]&&(s=m[i+56>>2],o=m[i+52>>2],m[t+64>>2]=y(m[t+112>>2]*y(r*y(m[i+48>>2]*m[t+128>>2])))+m[t+64>>2],m[t+68>>2]=y(y(r*y(o*m[t+132>>2]))*m[t+116>>2])+m[t+68>>2],m[t+72>>2]=y(y(r*y(s*m[t+136>>2]))*m[t+120>>2])+m[t+72>>2],s=m[i+88>>2],o=m[i+84>>2],m[t+80>>2]=y(y(r*m[t+96>>2])*m[i+80>>2])+m[t+80>>2],a=m[t+104>>2],m[t+84>>2]=y(o*y(r*m[t+100>>2]))+m[t+84>>2],m[t+88>>2]=y(s*y(r*a))+m[t+88>>2])}function ri(e){var t=0;return d[(e|=0)>>2]=19780,(t=d[e+176>>2])&&(u[e+180|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+176>>2]=0),d[e+176>>2]=0,s[e+180|0]=1,d[e+168>>2]=0,d[e+172>>2]=0,(t=d[e+156>>2])&&(u[e+160|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+156>>2]=0),d[e+156>>2]=0,s[e+160|0]=1,d[e+148>>2]=0,d[e+152>>2]=0,(t=d[e+136>>2])&&(u[e+140|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+136>>2]=0),d[e+136>>2]=0,s[e+140|0]=1,d[e+128>>2]=0,d[e+132>>2]=0,(t=d[e+116>>2])&&(u[e+120|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+116>>2]=0),d[e+116>>2]=0,s[e+120|0]=1,d[e+108>>2]=0,d[e+112>>2]=0,(t=d[e+96>>2])&&(u[e+100|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+96>>2]=0),d[e+96>>2]=0,s[e+100|0]=1,d[e+88>>2]=0,d[e+92>>2]=0,(t=d[e+76>>2])&&(u[e+80|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+76>>2]=0),d[e+76>>2]=0,s[e+80|0]=1,d[e+68>>2]=0,d[e+72>>2]=0,(t=d[e+56>>2])&&(u[e+60|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+56>>2]=0),d[e+56>>2]=0,s[e+60|0]=1,d[e+48>>2]=0,d[e+52>>2]=0,(t=d[e+36>>2])&&(u[e+40|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+36>>2]=0),d[e+36>>2]=0,s[e+40|0]=1,d[e+28>>2]=0,d[e+32>>2]=0,(t=d[e+16>>2])&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+16>>2]=0,s[e+20|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,0|e}function si(e){var t,i=0,n=0,o=0,a=0,l=0,c=0,h=0,_=0;if(!((0|(t=d[e+32>>2]))>=(0|(n=d[e+12>>2])))){e:if(d[e+36>>2]>=(0|n))i=d[e+40>>2];else{o=t,n&&(d[7717]=d[7717]+1,i=0|r[d[6606]](n<<2,16),o=d[e+32>>2]),l=d[e+40>>2];t:{if((0|o)>=1)for(;;)if(d[(c=a<<2)+i>>2]=d[l+c>>2],(0|(a=a+1|0))==(0|o))break t;if(!l){d[e+40>>2]=i,d[e+36>>2]=n,s[e+44|0]=1;break e}}u[e+44|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+40>>2]=i,s[e+44|0]=1,d[e+36>>2]=n}if(Mn((o=t<<2)+i|0,0,(c=n<<2)-o|0),d[e+32>>2]=n,(0|(l=d[e+52>>2]))<(0|n)){e:if(d[e+56>>2]>=(0|n))i=d[e+60>>2];else{a=0,o=l,i=0,n&&(d[7717]=d[7717]+1,i=0|r[d[6606]](c,16),o=d[e+52>>2]),h=d[e+60>>2];t:{if((0|o)>=1)for(;;)if(d[(_=a<<2)+i>>2]=d[h+_>>2],(0|(a=a+1|0))==(0|o))break t;if(!h){d[e+60>>2]=i,d[e+56>>2]=n,s[e- -64|0]=1;break e}}u[e- -64|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+60>>2]=i,s[e+64|0]=1,d[e+56>>2]=n}Mn((o=l<<2)+i|0,0,c-o|0)}if(d[e+52>>2]=n,(0|n)>=1&&(Mn(d[e+40>>2],255,c),Mn(d[e+60>>2],255,c)),!((0|t)<1))for(o=d[e+60>>2],l=d[e+16>>2],n=d[e+40>>2],a=0;i=l+b(a,12)|0,i=d[i+4>>2]<<16|d[i>>2],i=b((i=(i<<15^-1)+i|0)>>10^i,9),i=((i^=i>>6)<<11^-1)+i|0,i=n+((d[e+12>>2]+-1&(i>>16^i))<<2)|0,d[o+(a<<2)>>2]=d[i>>2],d[i>>2]=a,(0|t)!=(0|(a=a+1|0)););}}function oi(e,t,i){var n,o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0);O=n=O+-64|0,s[t+84|0]=0,o=d[e+116>>2],a=d[(e=o)+16>>2],d[n+8>>2]=d[e+12>>2],d[n+12>>2]=a,a=d[e+8>>2],d[n>>2]=d[e+4>>2],d[n+4>>2]=a,a=d[e+32>>2],d[n+24>>2]=d[e+28>>2],d[n+28>>2]=a,a=d[e+24>>2],d[n+16>>2]=d[e+20>>2],d[n+20>>2]=a,a=d[e+48>>2],d[n+40>>2]=d[e+44>>2],d[n+44>>2]=a,a=d[e+40>>2],d[n+32>>2]=d[e+36>>2],d[n+36>>2]=a,a=d[e+64>>2],d[n+56>>2]=d[e+60>>2],d[n+60>>2]=a,a=d[e+56>>2],d[n+48>>2]=d[e+52>>2],d[n+52>>2]=a,i&&(e=d[o+480>>2])&&r[d[d[e>>2]+8>>2]](e,n),S=m[n+52>>2],_=m[n+24>>2],u=m[n+20>>2],l=m[n+56>>2],p=m[n+40>>2],f=m[n+36>>2],x=m[n+48>>2],g=m[n+8>>2],b=m[n+4>>2],v=m[n>>2],A=m[n+16>>2],C=m[n+32>>2],d[t+48>>2]=0,T=l,l=m[t+156>>2],c=m[t+160>>2],h=m[t+164>>2],m[t+44>>2]=T+y(y(y(C*l)+y(f*c))+y(p*h)),m[t+40>>2]=S+y(y(y(l*A)+y(c*u))+y(h*_)),m[t+36>>2]=x+y(y(y(l*v)+y(c*b))+y(h*g)),d[t- -64>>2]=0,l=m[t+172>>2],c=m[t+176>>2],h=m[t+180>>2],m[t+60>>2]=y(y(C*l)+y(f*c))+y(p*h),m[t+56>>2]=y(y(l*A)+y(c*u))+y(h*_),m[t+52>>2]=y(y(v*l)+y(b*c))+y(g*h),l=m[t+196>>2],c=m[t+192>>2],h=m[t+188>>2],d[t+80>>2]=0,m[t+76>>2]=y(y(C*h)+y(f*c))+y(p*l),m[t+72>>2]=y(y(A*h)+y(u*c))+y(_*l),m[t+68>>2]=y(y(v*h)+y(b*c))+y(g*l),O=n- -64|0}function ai(e,t,i,n,r,s,o,a,l,c){var h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=0,E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0);T=d[s+4>>2],d[e>>2]=d[s>>2],d[e+4>>2]=T,T=d[s+12>>2],d[e+8>>2]=d[s+8>>2],d[e+12>>2]=T,x=m[t+24>>2],v=m[t+20>>2],p=m[t+40>>2],_=m[t+36>>2],A=m[t+8>>2],C=m[t>>2],E=m[t+4>>2],R=m[t+16>>2],h=m[t+32>>2],g=m[n+4>>2],f=m[n+8>>2],S=m[n>>2],d[e+28>>2]=0,P=h,h=m[e+8>>2],u=m[e+4>>2],b=y(y(g*h)-y(f*u)),I=_,M=f,f=m[e>>2],_=y(y(M*f)-y(h*S)),g=y(y(u*S)-y(g*f)),S=y(y(y(P*b)+y(I*_))+y(p*g)),m[e+24>>2]=S,x=y(y(y(b*R)+y(_*v))+y(g*x)),m[e+20>>2]=x,g=y(y(y(b*C)+y(E*_))+y(g*A)),m[e+16>>2]=g,A=m[i+24>>2],C=m[i+20>>2],E=m[i+40>>2],R=m[i+36>>2],D=m[i+8>>2],O=m[i>>2],P=m[i+4>>2],I=m[i+16>>2],p=m[i+32>>2],b=m[r+4>>2],_=m[r>>2],v=m[r+8>>2],d[e+44>>2]=0,M=p,p=y(y(u*v)-y(h*b)),h=y(y(h*_)-y(f*v)),u=y(y(f*b)-y(u*_)),f=y(y(y(M*p)+y(R*h))+y(E*u)),m[e+40>>2]=f,b=y(y(y(p*I)+y(h*C))+y(u*A)),m[e+36>>2]=b,h=y(y(y(O*p)+y(P*h))+y(u*D)),m[e+32>>2]=h,u=m[o+8>>2],_=m[o+4>>2],v=m[o>>2],d[e+60>>2]=0,v=y(v*g),m[e+48>>2]=v,_=y(_*x),m[e+52>>2]=_,u=y(u*S),m[e+56>>2]=u,p=m[l+8>>2],A=m[l+4>>2],C=m[l>>2],d[e+76>>2]=0,C=y(C*h),m[e+64>>2]=C,A=y(A*b),m[e+68>>2]=A,p=y(p*f),m[e+72>>2]=p,m[e+80>>2]=y(y(y(y(y(g*v)+y(x*_))+y(S*u))+a)+c)+y(y(y(h*C)+y(b*A))+y(f*p))}function li(e,t,i,n){var r,s=0,o=0,a=0,l=0,c=0,h=0,_=0;O=r=O-16|0;e:{t:{i:{n:{r:{s:switch(0|(s=i-t|0)){case 1:break n;case 2:break r;case 0:break s;default:break t}d[n>>2]=0,d[n+4>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0;break e}if(i=d[d[e+92>>2]+(t<<2)>>2],s=d[i+204>>2],!((0|(l=d[i+88>>2]))!=(0|(a=d[i+200>>2]))|(0|(o=d[i+92>>2]))!=(0|s))&&(s=o,d[i+96>>2]==d[i+208>>2]))break i;t=i+112|0,(s=o-s|0)|(o=l-a|0)?(d[i+4>>2]=t,d[i>>2]=t,d[i+116>>2]=i,d[i+112>>2]=i,a=(l=(0|s)<0)&!o,a|=o=(0|o)<0,d[n+4>>2]=a?t:i,d[n>>2]=a?i:t,o&!s||l?(d[n+8>>2]=i,s=t):(d[n+8>>2]=t,s=i)):(o=d[i+96>>2]>d[i+208>>2],d[(s=o?t:i)+4>>2]=s,d[s>>2]=s,d[n+8>>2]=s,d[n+4>>2]=s,d[n>>2]=s,t=o?i:t,i=s),d[n+12>>2]=s,e=Pi(e,i,t),d[e+4>>2]=e,d[e>>2]=e,d[i+8>>2]=e,e=d[e+8>>2],d[e+4>>2]=e,d[e>>2]=e,d[t+8>>2]=e;break e}i=d[d[e+92>>2]+(t<<2)>>2]}d[i+8>>2]=0,d[i+4>>2]=i,d[i>>2]=i,d[n+12>>2]=i,d[n+8>>2]=i,d[n+4>>2]=i,d[n>>2]=i;break e}t:if(!((0|(s=o=((0|s)/2|0)+t|0))>=(0|i))){for(a=d[e+92>>2],s=d[(a+(o<<2)|0)-4>>2],c=d[s+88>>2],h=d[s+96>>2],_=d[s+92>>2],s=o;;){if(l=d[a+(s<<2)>>2],d[l+88>>2]!=(0|c)|d[l+92>>2]!=(0|_)|d[l+96>>2]!=(0|h))break t;if(!((0|(s=s+1|0))<(0|i)))break}s=i}li(e,t,o,n),d[r+8>>2]=0,d[r+12>>2]=0,d[r>>2]=0,d[r+4>>2]=0,li(e,s,i,r),function(e,t,i){var n,r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0,g=0,y=0,v=0,A=0,C=0,S=0,x=0,T=0,E=0,R=0,P=0,I=0,M=0,D=0,F=0,B=0,N=0,L=0;O=n=O-128|0;t:if(d[i+4>>2])if(d[t+4>>2]){if(d[e+100>>2]=d[e+100>>2]+-1,d[n+124>>2]=0,d[n+120>>2]=0,function(e,t,i,n){var r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0,g=0,y=0,v=0,A=0,C=0,S=0,x=0,T=0;s=d[e+12>>2],_=d[t+8>>2];i:{if(!(d[s+88>>2]!=d[_+88>>2]|d[s+92>>2]!=d[_+92>>2])){if((0|(r=d[_+4>>2]))==(0|_)){if(d[i>>2]=s,e=0,!(t=d[_+8>>2]))break i;return d[n>>2]=d[t+12>>2],0}s=d[_>>2],d[r>>2]=s,d[s+4>>2]=r,d[t>>2]==(0|_)&&(a=t,l=s,(0|(o=d[s+88>>2]))<(0|(c=d[r+88>>2]))|(d[s+92>>2]>2]?(0|o)==(0|c):0)||(l=r),d[a>>2]=l),d[t+4>>2]==(0|_)&&((0|(o=d[s+88>>2]))!=(0|(c=d[r+88>>2]))|d[s+92>>2]<=d[r+92>>2]&&(0|o)<=(0|c)?d[t+4>>2]=r:d[t+4>>2]=s)}for(v=d[t>>2],S=d[e>>2],o=x=d[e+4>>2],r=A=d[t+4>>2],c=0,s=0,l=1,T=1;;){_=s,C=c,h=d[o+88>>2];n:if((0|(a=b(d[r+88>>2]-h|0,l)))>=1)for(c=o;;){for(s=r,h=d[r+92>>2],o=a;p=h-(a=d[c+92>>2])|0,!((0|(r=d[(f=y?0:4)+c>>2]))==(0|c)||(0|(u=d[r+92>>2]-a|0))>0||(m=d[r+88>>2],(0|(a=b(m-d[c+88>>2]|0,l)))>-1|(0|b(o,u))>(0|b(a,p))&&a));)o=b(d[s+88>>2]-m|0,l),c=r;if((0|s)==(0|(r=d[s+f>>2])))break n;if((0|(f=d[r+92>>2]-h|0))>-1)break n;if(h=d[r+88>>2],(0|(a=b(h-d[c+88>>2]|0,l)))<1)break n;if(h=b(h-d[s+88>>2]|0,l)){if((0|h)>-1)break n;if(!((0|b(o,f))<(0|b(h,p))))break}}else if((0|a)<=-1){r:for(;;){for(p=d[r+92>>2],s=d[(m=y?4:0)+r>>2];;){if(h=a,c=o,f=p-(a=d[o+92>>2])|0,(0|r)!=(0|s)&&!((0|(u=d[s+92>>2]-p|0))<0||(g=d[s+88>>2],(0|(o=b(g-d[r+88>>2]|0,l)))>-1|(0|b(h,u))>(0|b(o,f))&&o))){a=b(g-d[c+88>>2]|0,l),r=s,o=c;continue r}if((0|c)==(0|(o=d[c+m>>2]))){s=r;break n}if((0|(g=d[o+92>>2]-a|0))<1){s=r;break n}if(u=d[o+88>>2],(0|(a=b(d[r+88>>2]-u|0,l)))>-1){s=r;break n}if(u=b(u-d[c+88>>2]|0,l)){if((0|u)>-1){s=r;break n}if(!((0|b(h,g))<(0|b(u,f))))break}}break}s=r}else{for(s=d[o+92>>2],l=o;c=l,!((0|(l=d[(y?0:4)+l>>2]))==(0|o)|(0|h)!=d[l+88>>2])&&(p=(0|(a=d[l+92>>2]))<=(0|s),s=a,p););for(o=d[r+92>>2],l=r;;){if((0|(l=d[(s=l)+(y?4:0)>>2]))==(0|r)|(0|h)!=d[l+88>>2])break n;if(p=(0|(a=d[l+92>>2]))>=(0|o),o=a,!p)break}}if(y=1,a=T,T=0,l=-1,o=S,r=v,!a)break}d[c+4>>2]=s,d[s>>2]=c,d[C>>2]=_,d[_+4>>2]=C,d[v+88>>2]>2]&&(d[e>>2]=v),d[A+88>>2]>=d[x+88>>2]&&(d[e+4>>2]=A),d[e+12>>2]=d[t+12>>2],d[i>>2]=C,e=1}return d[n>>2]=_,e}(t,i,n+124|0,n+120|0)){if(x=d[n+124>>2],h=d[x+92>>2],y=d[n+120>>2],_=d[y+92>>2],v=d[x+96>>2],m=d[y+96>>2],g=d[x+88>>2],I=d[y+88>>2],d[n+92>>2]=-1,i=m-v|0,d[n+88>>2]=i,o=_-h|0,d[n+84>>2]=o,l=I-g|0,d[n+80>>2]=l,t=d[x+8>>2],d[n+32>>2]=0,r=i,a=o,C=id(i,R=i>>31,o,p=o>>31),F=w,s=i=0-l|0,i=id(i,c=i>>31,l,l>>31),o=w,l=i-(P=id(a,p,a,p))|0,P=o-(w+(i>>>0

>>0)|0)|0,R=0-(i=id(r,R,s,c))|0,B=0-(w+(0>>0)|0)|0,t){for(i=t;r=d[i+12>>2],f=id(A=o=d[r+92>>2]-h|0,o>>=31,s,c),T=w,(0|f)!=(0-(L=id(a,p,N=f=d[r+88>>2]-g|0,f>>=31))|0)|(0-(w+(0>>0)|0)|0)!=(0|T)||(o=id(C,F,A,o),T=w,A=(f=id(N,f,R,B))+o|0,o=w+T|0,o=A>>>0>>0?o+1|0:o,f=id(l,P,r=d[r+96>>2]-v|0,r>>31),r=w+o|0,(0|(r=(A=f+A|0)>>>0>>0?r+1|0:r))<0||(0|r)<=0&&!(A>>>0>=1)||u&&(d[n+64>>2]=-1,d[n+68>>2]=-1,d[n+56>>2]=0,d[n+60>>2]=0,1!=(0|xn(u,i,n+80|0,n+56|0)))||(u=i)),(0|t)!=(0|(i=d[i>>2])););d[n+32>>2]=u}if(o=d[y+8>>2],t=0,d[n+8>>2]=0,o){for(i=o;h=d[i+12>>2],g=id(v=r=d[h+92>>2]-_|0,r>>=31,s,c),A=w,(0|g)!=(0-(T=id(a,p,f=g=d[h+88>>2]-I|0,g=f>>31))|0)|(0-(w+(0>>0)|0)|0)!=(0|A)||(r=id(C,F,v,r),A=w,v=(g=id(f,g,R,B))+r|0,r=w+A|0,r=v>>>0>>0?r+1|0:r,f=v,v=id(l,P,h=d[h+96>>2]-m|0,h>>31),r=w+r|0,(0|(r=(h=f+v|0)>>>0>>0?r+1|0:r))<0||(0|r)<=0&&!(h>>>0>=1)||t&&(d[n+64>>2]=-1,d[n+68>>2]=-1,d[n+56>>2]=0,d[n+60>>2]=0,2!=(0|xn(t,i,n+80|0,n+56|0)))||(t=i)),(0|o)!=(0|(i=d[i>>2])););d[n+8>>2]=t}t|u&&(V(e,x,y,n+32|0,n+8|0),(t=d[n+32>>2])&&(x=d[t+12>>2],d[n+124>>2]=x),(t=d[n+8>>2])&&(y=d[t+12>>2],d[n+120>>2]=y)),g=d[y+96>>2]+1|0,I=d[y+88>>2],v=d[y+92>>2]}else y=d[n+120>>2],I=d[y+88>>2]+1|0,g=d[y+96>>2],x=d[n+124>>2],v=d[y+92>>2];for(i=y,t=x,p=0,u=0,F=1,c=0,o=0;;){r=d[i+96>>2],s=d[t+96>>2],h=d[t+92>>2],a=d[i+92>>2],m=d[t+88>>2],l=d[i+88>>2],d[n+116>>2]=-1,a=a-h|0,d[n+108>>2]=a,r=r-s|0,d[n+112>>2]=r,l=l-m|0,d[n+104>>2]=l,s=g-s|0,_=(C=b(h=v-h|0,r)-b(s,a)|0)>>31,P=C,d[n+80>>2]=C,d[n+84>>2]=_,m=(C=(f=b(s,l))-b(s=I-m|0,r)|0)>>31,R=C,d[n+88>>2]=C,d[n+92>>2]=m,C=(s=b(s,a)-b(l,h)|0)>>31,B=s,d[n+96>>2]=s,d[n+100>>2]=C,l=id(R,m,s=l,A=s>>31),f=w,h=a,a=id(P,_,a,T=a>>31),d[n+72>>2]=l-a,d[n+76>>2]=f-(w+(l>>>0>>0)|0),a=r,r=id(P,_,r,l=r>>31),_=w,s=id(B,C,s,A),d[n+64>>2]=r-s,d[n+68>>2]=_-(w+(r>>>0>>0)|0),r=id(B,C,h,T),s=w,a=id(a,l,R,m),d[n+56>>2]=r-a,d[n+60>>2]=s-(w+(r>>>0>>0)|0),d[n+48>>2]=0,d[n+40>>2]=0,d[n+44>>2]=0,d[n+32>>2]=0,d[n+36>>2]=0,m=It(e,0,t,n+104|0,n+80|0,n+56|0,n+32|0),d[n+24>>2]=0,d[n+16>>2]=0,d[n+20>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0;i:if((_=It(e,1,i,n+104|0,n+80|0,n+56|0,n+8|0))|m){h=m?-1:1,!m|!_||(h=bi(n+32|0,n+8|0));n:{r:if(!F){s:{if((0|h)>=0){if(d[n+24>>2]>-1)break r;if(!(d[n+16>>2]|d[n+20>>2]))break s;break r}if(d[n+40>>2]|d[n+44>>2]|d[n+48>>2]>-1)break r}s=p,a=u,l=c,r=o;break n}r=l=Pi(e,t,i),c&&(d[c+4>>2]=l,r=o),d[l>>2]=c,a=s=d[l+8>>2],p&&(d[p>>2]=s,a=u),d[s+4>>2]=p}if(d[n+4>>2]=m,d[n>>2]=_,p=_,h||(V(e,d[n+124>>2],d[n+120>>2],n+4|0,n),p=d[n>>2]),t=s,!((0|h)<0)&&(t=s,p)){n:{r:{s:{if(S){if((0|_)!=(0|(i=d[S>>2])))for(;c=d[i+8>>2],o=0,t=0,(0|(u=d[i>>2]))!=(0|i)&&(d[u+4>>2]=d[i+4>>2],d[d[i+4>>2]>>2]=u,t=u),d[d[c+12>>2]+8>>2]=t,(0|(t=d[c>>2]))!=(0|c)&&(d[t+4>>2]=d[c+4>>2],d[d[c+4>>2]>>2]=t,o=t),d[d[i+12>>2]+8>>2]=o,d[i+12>>2]=0,d[i+16>>2]=0,d[i+4>>2]=0,d[i+8>>2]=0,d[i>>2]=d[e+56>>2],d[e+56>>2]=i,d[c+12>>2]=0,d[c+16>>2]=0,d[c+4>>2]=0,d[c+8>>2]=0,d[c>>2]=d[e+56>>2],d[e+56>>2]=c,d[e+116>>2]=d[e+116>>2]+-1,(0|_)!=(0|(i=u)););if(s)break s;break r}if(!s)break r;S=d[_+4>>2],M=a}d[S>>2]=a,d[a+4>>2]=S,d[s>>2]=_,d[_+4>>2]=s,a=0,p=d[n>>2];break n}M=S?M:_}t=d[n+120>>2],g=d[t+96>>2],v=d[t+92>>2],I=d[t+88>>2],d[n+120>>2]=d[p+12>>2],S=d[p+8>>2],t=0}if(p=t,(0|h)<=0&&(s=d[n+4>>2])){n:{r:{s:{o:{if(E){if((0|m)!=(0|(t=d[E+4>>2])))for(;u=t+4|0,_=d[t+8>>2],c=d[t+4>>2],i=0,h=0,(0|(o=d[t>>2]))!=(0|t)&&(d[o+4>>2]=c,d[d[u>>2]>>2]=o,h=o),d[d[_+12>>2]+8>>2]=h,(0|(o=d[_>>2]))!=(0|_)&&(d[o+4>>2]=d[_+4>>2],d[d[_+4>>2]>>2]=o,i=o),d[d[t+12>>2]+8>>2]=i,d[(i=u)+8>>2]=0,d[i+12>>2]=0,d[i>>2]=0,d[i+4>>2]=0,d[t>>2]=d[e+56>>2],d[e+56>>2]=t,d[_+12>>2]=0,d[_+16>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,d[_>>2]=d[e+56>>2],d[e+56>>2]=_,d[e+116>>2]=d[e+116>>2]+-1,(0|m)!=(0|(t=c)););if(!l)break o;d[r>>2]=E,t=E+4|0;break r}if(l)break s}D=E?D:m;break n}t=d[m>>2],d[r>>2]=t,D=r,t=t+4|0}d[t>>2]=r,d[m>>2]=l,d[l+4>>2]=m,r=0,s=d[n+4>>2]}t=d[n+124>>2],g=d[t+96>>2],v=d[t+92>>2],I=d[t+88>>2],t=d[s+12>>2],d[n+124>>2]=t,E=d[s+8>>2],l=0}else t=d[n+124>>2];if(i=1,(0|t)!=(0|x)|d[n+120>>2]!=(0|y))F=0;else{if(E){if((0|D)!=(0|(t=d[E+4>>2])))for(;u=t+4|0,c=d[t+8>>2],s=d[t+4>>2],i=0,h=0,(0|(o=d[t>>2]))!=(0|t)&&(d[o+4>>2]=s,d[d[u>>2]>>2]=o,h=o),d[d[c+12>>2]+8>>2]=h,(0|(o=d[c>>2]))!=(0|c)&&(d[o+4>>2]=d[c+4>>2],d[d[c+4>>2]>>2]=o,i=o),d[d[t+12>>2]+8>>2]=i,d[(i=u)+8>>2]=0,d[i+12>>2]=0,d[i>>2]=0,d[i+4>>2]=0,d[t>>2]=d[e+56>>2],d[e+56>>2]=t,d[c+12>>2]=0,d[c+16>>2]=0,d[c+4>>2]=0,d[c+8>>2]=0,d[c>>2]=d[e+56>>2],d[e+56>>2]=c,d[e+116>>2]=d[e+116>>2]+-1,(0|D)!=(0|(t=s)););l&&(d[r>>2]=E,d[E+4>>2]=r,d[D>>2]=l,d[l+4>>2]=D)}else d[r>>2]=l,d[l+4>>2]=r,d[d[n+124>>2]+8>>2]=l;if(!S){d[p>>2]=a,d[a+4>>2]=p,d[d[n+120>>2]+8>>2]=p,S=0,u=a,c=l,o=r,i=0;break i}if((0|M)!=(0|(i=d[S>>2])))for(;s=d[i+8>>2],o=0,t=0,(0|(u=d[i>>2]))!=(0|i)&&(d[u+4>>2]=d[i+4>>2],d[d[i+4>>2]>>2]=u,t=u),d[d[s+12>>2]+8>>2]=t,(0|(t=d[s>>2]))!=(0|s)&&(d[t+4>>2]=d[s+4>>2],d[d[s+4>>2]>>2]=t,o=t),d[d[i+12>>2]+8>>2]=o,d[i+12>>2]=0,d[i+16>>2]=0,d[i+4>>2]=0,d[i+8>>2]=0,d[i>>2]=d[e+56>>2],d[e+56>>2]=i,d[s+12>>2]=0,d[s+16>>2]=0,d[s+4>>2]=0,d[s+8>>2]=0,d[s>>2]=d[e+56>>2],d[e+56>>2]=s,d[e+116>>2]=d[e+116>>2]+-1,(0|M)!=(0|(i=u)););i=0,p?(d[S>>2]=a,d[a+4>>2]=S,d[p>>2]=M,d[M+4>>2]=p):p=0}u=a,c=l,o=r}else a=Pi(e,t,i),d[a+4>>2]=a,d[a>>2]=a,d[t+8>>2]=a,t=d[a+8>>2],d[t+4>>2]=t,d[t>>2]=t,d[i+8>>2]=t,i=0;if(!i)break t;t=d[n+124>>2],i=d[n+120>>2]}}else e=d[i+4>>2],d[t>>2]=d[i>>2],d[t+4>>2]=e,e=d[i+12>>2],d[t+8>>2]=d[i+8>>2],d[t+12>>2]=e;O=n+128|0}(e,n,r)}O=r+16|0}function ci(e,t,i){var n,r=0;return O=n=O-256|0,(0|(r=d[t+212>>2]))>-1||(2&(r=d[t+236>>2])&&(2&u[204+(r=r<<30>>31&t)|0]||m[r+344>>2]!=y(0))?(r=d[e+8>>2],Mn(n+8|0,0,244),function(e,t,i){var n=0,r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0);t=t?d[t+236>>2]<<30>>31&t:0,d[e+64>>2]=0,d[e+68>>2]=0,d[e+144>>2]=0,d[e+148>>2]=0,d[e+88>>2]=0,d[e+92>>2]=0,d[e+80>>2]=0,d[e+84>>2]=0,d[e+72>>2]=0,d[e+76>>2]=0,d[e+152>>2]=0,d[e+156>>2]=0,d[e+160>>2]=0,d[e+164>>2]=0,d[e+168>>2]=0,d[e+172>>2]=0,t?(n=d[t+8>>2],d[e>>2]=d[t+4>>2],d[e+4>>2]=n,n=d[t+16>>2],d[e+8>>2]=d[t+12>>2],d[e+12>>2]=n,n=d[t+32>>2],d[e+24>>2]=d[t+28>>2],d[e+28>>2]=n,n=d[t+24>>2],d[e+16>>2]=d[t+20>>2],d[e+20>>2]=n,n=d[t+48>>2],d[e+40>>2]=d[t+44>>2],d[e+44>>2]=n,n=d[t+40>>2],d[e+32>>2]=d[t+36>>2],d[e+36>>2]=n,n=d[t+64>>2],d[e+56>>2]=d[t+60>>2],d[e+60>>2]=n,n=d[t+56>>2],d[e+48>>2]=d[t+52>>2],d[e+52>>2]=n,s=m[t+352>>2],o=m[t+356>>2],a=m[t+348>>2],r=m[t+344>>2],d[e+240>>2]=t,d[e+140>>2]=0,m[e+136>>2]=r*o,m[e+132>>2]=r*s,m[e+128>>2]=r*a,n=d[t+556>>2],d[e+104>>2]=d[t+552>>2],d[e+108>>2]=n,n=d[t+548>>2],d[e+96>>2]=d[t+544>>2],d[e+100>>2]=n,n=d[t+360>>2],d[e+120>>2]=d[t+356>>2],d[e+124>>2]=n,n=d[t+352>>2],d[e+112>>2]=d[t+348>>2],d[e+116>>2]=n,n=d[t+324>>2],d[e+184>>2]=d[t+320>>2],d[e+188>>2]=n,n=d[t+316>>2],d[e+176>>2]=d[t+312>>2],d[e+180>>2]=n,n=d[t+340>>2],d[e+200>>2]=d[t+336>>2],d[e+204>>2]=n,n=d[t+332>>2],d[e+192>>2]=d[t+328>>2],d[e+196>>2]=n,s=m[t+416>>2],o=m[t+420>>2],a=m[t+412>>2],r=m[t+344>>2],d[e+220>>2]=0,m[e+216>>2]=y(r*o)*i,m[e+212>>2]=y(r*s)*i,m[e+208>>2]=y(r*a)*i,a=m[t+280>>2],l=m[t+296>>2],c=m[t+268>>2],h=m[t+284>>2],_=m[t+300>>2],u=m[t+264>>2],r=m[t+428>>2],s=m[t+432>>2],o=m[t+436>>2],m[e+232>>2]=y(y(y(r*m[t+272>>2])+y(s*m[t+288>>2]))+y(o*m[t+304>>2]))*i,m[e+228>>2]=y(y(y(r*c)+y(s*h))+y(o*_))*i,m[e+224>>2]=y(y(y(u*r)+y(a*s))+y(l*o))*i):(d[e+4>>2]=0,d[e+8>>2]=0,d[e>>2]=1065353216,d[e+32>>2]=0,d[e+36>>2]=0,d[e+240>>2]=0,d[e+128>>2]=0,d[e+132>>2]=0,d[e+112>>2]=1065353216,d[e+116>>2]=1065353216,d[e+96>>2]=1065353216,d[e+100>>2]=1065353216,d[e+176>>2]=0,d[e+180>>2]=0,d[e+12>>2]=0,d[e+16>>2]=0,d[e+24>>2]=0,d[e+28>>2]=0,d[e+20>>2]=1065353216,d[e+44>>2]=0,d[e+48>>2]=0,d[e+40>>2]=1065353216,d[e+52>>2]=0,d[e+56>>2]=0,d[e+60>>2]=0,d[e+136>>2]=0,d[e+140>>2]=0,d[e+120>>2]=1065353216,d[e+124>>2]=0,d[e+104>>2]=1065353216,d[e+108>>2]=0,d[e+232>>2]=0,d[e+224>>2]=0,d[e+228>>2]=0,d[e+216>>2]=0,d[e+220>>2]=0,d[e+208>>2]=0,d[e+212>>2]=0,d[e+200>>2]=0,d[e+204>>2]=0,d[e+192>>2]=0,d[e+196>>2]=0,d[e+184>>2]=0,d[e+188>>2]=0),d[e+236>>2]=0}(ii(e+4|0,n+8|0),t,i),d[t+212>>2]=r):(0|(r=d[e+188>>2]))>-1||(d[e+188>>2]=d[e+8>>2],Mn(n+8|0,0,244),t=ii(e+4|0,n+8|0),d[t+88>>2]=0,d[t+92>>2]=0,d[t+80>>2]=0,d[t+84>>2]=0,d[t+72>>2]=0,d[t+76>>2]=0,d[t+64>>2]=0,d[t+68>>2]=0,d[t+144>>2]=0,d[t+148>>2]=0,d[t+152>>2]=0,d[t+156>>2]=0,d[t+160>>2]=0,d[t+164>>2]=0,d[t+168>>2]=0,d[t+172>>2]=0,d[t+4>>2]=0,d[t+8>>2]=0,d[t>>2]=1065353216,d[t+12>>2]=0,d[t+16>>2]=0,d[t+24>>2]=0,d[t+28>>2]=0,d[t+20>>2]=1065353216,d[t+32>>2]=0,d[t+36>>2]=0,d[t+44>>2]=0,d[t+48>>2]=0,d[t+40>>2]=1065353216,d[t+52>>2]=0,d[t+56>>2]=0,d[t+60>>2]=0,d[t+136>>2]=0,d[t+140>>2]=0,d[t+240>>2]=0,d[t+128>>2]=0,d[t+132>>2]=0,d[t+120>>2]=1065353216,d[t+124>>2]=0,d[t+112>>2]=1065353216,d[t+116>>2]=1065353216,d[t+104>>2]=1065353216,d[t+108>>2]=0,d[t+96>>2]=1065353216,d[t+100>>2]=1065353216,d[t+232>>2]=0,d[t+236>>2]=0,d[t+224>>2]=0,d[t+228>>2]=0,d[t+216>>2]=0,d[t+220>>2]=0,d[t+208>>2]=0,d[t+212>>2]=0,d[t+200>>2]=0,d[t+204>>2]=0,d[t+192>>2]=0,d[t+196>>2]=0,d[t+184>>2]=0,d[t+188>>2]=0,d[t+176>>2]=0,d[t+180>>2]=0,r=d[e+188>>2])),O=n+256|0,r}function hi(e,t,i,n,r,s){var o;d[e+4>>2]=t,d[e>>2]=7348,t=d[i+12>>2],d[e+16>>2]=d[i+8>>2],d[e+20>>2]=t,t=d[i+4>>2],d[e+8>>2]=d[i>>2],d[e+12>>2]=t,t=d[i+28>>2],d[e+32>>2]=d[i+24>>2],d[e+36>>2]=t,t=d[i+20>>2],d[e+24>>2]=d[i+16>>2],d[e+28>>2]=t,t=d[i+44>>2],d[e+48>>2]=d[i+40>>2],d[e+52>>2]=t,t=d[i+36>>2],d[e+40>>2]=d[i+32>>2],d[e+44>>2]=t,o=d[i+60>>2],d[(t=e- -64|0)>>2]=d[i+56>>2],d[t+4>>2]=o,t=d[i+52>>2],d[e+56>>2]=d[i+48>>2],d[e+60>>2]=t,t=d[n+12>>2],d[e+80>>2]=d[n+8>>2],d[e+84>>2]=t,t=d[n+4>>2],d[e+72>>2]=d[n>>2],d[e+76>>2]=t,t=d[n+28>>2],d[e+96>>2]=d[n+24>>2],d[e+100>>2]=t,t=d[n+20>>2],d[e+88>>2]=d[n+16>>2],d[e+92>>2]=t,t=d[n+44>>2],d[e+112>>2]=d[n+40>>2],d[e+116>>2]=t,t=d[n+36>>2],d[e+104>>2]=d[n+32>>2],d[e+108>>2]=t,t=d[n+60>>2],d[e+128>>2]=d[n+56>>2],d[e+132>>2]=t,t=d[n+52>>2],d[e+120>>2]=d[n+48>>2],d[e+124>>2]=t,t=d[r+12>>2],d[e+144>>2]=d[r+8>>2],d[e+148>>2]=t,t=d[r+4>>2],d[e+136>>2]=d[r>>2],d[e+140>>2]=t,t=d[r+28>>2],d[e+160>>2]=d[r+24>>2],d[e+164>>2]=t,t=d[r+20>>2],d[e+152>>2]=d[r+16>>2],d[e+156>>2]=t,t=d[r+44>>2],d[e+176>>2]=d[r+40>>2],d[e+180>>2]=t,t=d[r+36>>2],d[e+168>>2]=d[r+32>>2],d[e+172>>2]=t,t=d[r+60>>2],d[e+192>>2]=d[r+56>>2],d[e+196>>2]=t,t=d[r+52>>2],d[e+184>>2]=d[r+48>>2],d[e+188>>2]=t,d[e+208>>2]=0,m[e+204>>2]=s,d[e+200>>2]=1065353216}function _i(e,t,i){var n,o=0,a=0,l=0;if(d[e+4>>2]=1065353216,d[e+8>>2]=1065353216,d[e+48>>2]=0,d[e>>2]=16376,s[e+36|0]=1,d[e+12>>2]=1065353216,d[e+16>>2]=0,d[e+32>>2]=0,d[e+24>>2]=0,d[e+28>>2]=0,s[e+100|0]=1,d[e+96>>2]=0,s[e+120|0]=1,d[e+88>>2]=0,d[e+92>>2]=0,d[e+116>>2]=0,s[e+140|0]=1,d[e+108>>2]=0,d[e+112>>2]=0,d[e+136>>2]=0,s[e+160|0]=1,d[e+128>>2]=0,d[e+132>>2]=0,d[e+168>>2]=0,s[e+164|0]=t,d[e+148>>2]=0,d[e+152>>2]=0,d[e+156>>2]=0,s[e+165|0]=i,d[7717]=d[7717]+1,l=0|r[d[6606]](32,16),(0|(n=d[e+24>>2]))>=1)for(;i=(t=a<<5)+l|0,t=t+d[e+32>>2]|0,o=d[t+4>>2],d[i>>2]=d[t>>2],d[i+4>>2]=o,o=d[t+28>>2],d[i+24>>2]=d[t+24>>2],d[i+28>>2]=o,o=d[t+20>>2],d[i+16>>2]=d[t+16>>2],d[i+20>>2]=o,o=d[t+12>>2],d[i+8>>2]=d[t+8>>2],d[i+12>>2]=o,(0|n)!=(0|(a=a+1|0)););(t=d[e+32>>2])&&(u[e+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+32>>2]=0),d[e+32>>2]=l,s[e+36|0]=1,d[e+28>>2]=1,t=l+(d[e+24>>2]<<5)|0,d[t+24>>2]=2,d[t+28>>2]=0,d[t+16>>2]=0,d[t+20>>2]=16,d[t+8>>2]=12,d[t+12>>2]=0,d[t>>2]=0,d[t+4>>2]=0,d[e+24>>2]=d[e+24>>2]+1,i=u[e+164|0],l=d[(i?128:148)+e>>2],t=d[e+32>>2],d[t+24>>2]=i?2:3,d[t+4>>2]=0,a=12,d[t+8>>2]=i?12:6,d[t>>2]=(0|l)/3,u[e+165|0]?(a=16,e=d[e+88>>2]):e=d[e+108>>2]/3|0,d[t+20>>2]=a,d[t+16>>2]=0,d[t+12>>2]=e}function di(e,t){var i,n=0,o=0,a=0,l=0,c=0,h=0,_=0;if(O=i=O-48|0,d[i+40>>2]=0,d[(n=i)+32>>2]=0,d[n+36>>2]=0,d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=0,d[n+20>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,d[n>>2]=0,d[n+4>>2]=0,t=t||d[d[e+880>>2]>>2],(0|(l=d[e+732>>2]))==d[e+736>>2]&&!((0|l)>=(0|(c=l?l<<1:1)))){if(c&&(d[7717]=d[7717]+1,_=0|r[d[6606]](b(c,52),16),l=d[e+732>>2]),(0|l)>=1)for(;o=(n=b(h,52))+_|0,n=n+d[e+740>>2]|0,a=d[n+4>>2],d[o>>2]=d[n>>2],d[o+4>>2]=a,d[o+48>>2]=d[n+48>>2],a=d[n+44>>2],d[o+40>>2]=d[n+40>>2],d[o+44>>2]=a,a=d[n+36>>2],d[o+32>>2]=d[n+32>>2],d[o+36>>2]=a,a=d[n+28>>2],d[o+24>>2]=d[n+24>>2],d[o+28>>2]=a,a=d[n+20>>2],d[o+16>>2]=d[n+16>>2],d[o+20>>2]=a,a=d[n+12>>2],d[o+8>>2]=d[n+8>>2],d[o+12>>2]=a,(0|(h=h+1|0))!=(0|l););(n=d[e+740>>2])&&(u[e+744|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+740>>2]=0),d[e+740>>2]=_,d[e+736>>2]=c,s[e+744|0]=1,l=d[e+732>>2]}n=d[e+740>>2]+b(l,52)|0,d[n+4>>2]=t,d[n>>2]=0,t=d[i+4>>2],d[n+8>>2]=d[i>>2],d[n+12>>2]=t,t=d[i+12>>2],d[n+16>>2]=d[i+8>>2],d[n+20>>2]=t,t=d[i+20>>2],d[n+24>>2]=d[i+16>>2],d[n+28>>2]=t,t=d[i+28>>2],d[n+32>>2]=d[i+24>>2],d[n+36>>2]=t,t=d[i+36>>2],d[n+40>>2]=d[i+32>>2],d[n+44>>2]=t,d[n+48>>2]=d[i+40>>2],d[e+732>>2]=d[e+732>>2]+1,O=i+48|0}function ui(e,t,i,n,r,o,a,l,c){var h,_,p,f=0,m=0,g=0,y=0,v=0,A=0,C=0,S=0,x=0,T=0,E=0,R=0,P=0;for(O=h=O-80|0,d[h+32>>2]=1133903872,d[h+24>>2]=0,d[h+28>>2]=1036831949,d[h+72>>2]=0,d[h+76>>2]=0,d[h+52>>2]=0,d[h+56>>2]=0,d[h+44>>2]=0,d[h+48>>2]=1045220557,d[h+16>>2]=1065353216,d[h+20>>2]=-1082130432,d[h+36>>2]=1065353216,d[h+40>>2]=1056964608,d[h+64>>2]=0,s[h+60|0]=0,p=t+4|0,_=e+680|0;m=u[108+(v+_|0)|0],((y=d[176+((g=v<<2)+_|0)>>2])||(f=m,m=1,f))&&(d[h+72>>2]=y,d[h+56>>2]=0,f=e+g|0,d[h+68>>2]=d[f+840>>2],d[h+64>>2]=d[f+824>>2],g=d[e+732>>2],s[h+60|0]=m,d[h+36>>2]=g,d[h+20>>2]=d[f+696>>2],d[h+40>>2]=d[e+728>>2],m=d[f+680>>2],d[h+32>>2]=0,d[h+16>>2]=m,d[h+28>>2]=d[f+808>>2],d[h+24>>2]=d[f+792>>2],d[h>>2]=d[f+1064>>2],d[h+4>>2]=d[f+1080>>2],m=d[f+1096>>2],d[h+12>>2]=0,d[h+8>>2]=m,m=h,g=f+740|0,1&(y=d[e+1304>>2]>>b(v,3))||(g=d[t+32>>2]),d[m+44>>2]=d[g>>2],d[h+52>>2]=d[(2&y?f+772|0:d[t+32>>2])>>2],d[h+48>>2]=d[(4&y?f+756|0:p)>>2],f=e,C=h+16|0,m=n,y=r,g=o,S=a,x=l,T=c,E=t,R=i,P=h,A=0,u[e+1301|0]&&(A=1,d[924+((((v+1&255)>>>0)%3<<6)+e|0)>>2]&&(A=!d[924+((((v+2&255)>>>0)%3<<6)+e|0)>>2])),i=me(f,C,m,y,g,S,x,T,E,R,P,0,A)+i|0),3!=(0|(v=v+1|0)););return O=h+80|0,i}function pi(e,t,i){e|=0,t|=0,i|=0;var n,s,o,a,l,c,h=0,_=0,u=0,f=y(0),v=y(0),A=y(0),C=y(0),S=0;O=n=O-80|0,_=d[e+4>>2],r[d[d[_>>2]+16>>2]](_,n+28|0,n+24|0,n+20|0,n+16|0,n+12|0,n+8|0,n+4|0,n,t),o=d[n+12>>2]+b(d[n+8>>2],i)|0,a=d[n+20>>2],_=(s=d[e+4>>2])+12|0,h=u=d[n+28>>2],l=d[n>>2],S=p[o+4>>1],3!=(0|l)&&(S=d[o+8>>2]),c=d[n+16>>2],h=h+b(S,c)|0,a?(f=y(m[s+8>>2]*y(g[h+8>>3])),v=y(m[s+4>>2]*y(g[h>>3])),A=y(g[h+16>>3]),h=_):(f=y(m[h+4>>2]*m[s+8>>2]),v=y(m[h>>2]*m[s+4>>2]),A=m[s+12>>2],h=h+8|0),C=m[h>>2],d[n+76>>2]=0,m[n+68>>2]=f,m[n+72>>2]=C*A,m[n+64>>2]=v,h=3!=(0|l)?d[o+4>>2]:p[o+2>>1],h=b(h,c)+u|0,a?(f=y(m[s+8>>2]*y(g[h+8>>3])),v=y(m[s+4>>2]*y(g[h>>3])),A=y(g[h+16>>3]),h=_):(f=y(m[h+4>>2]*m[s+8>>2]),v=y(m[h>>2]*m[s+4>>2]),A=m[s+12>>2],h=h+8|0),C=m[h>>2],d[n+60>>2]=0,m[n+52>>2]=f,m[n+56>>2]=C*A,m[n+48>>2]=v,h=3!=(0|l)?d[o>>2]:p[o>>1],u=b(h,c)+u|0,a?(A=y(g[u+16>>3]),f=y(m[s+8>>2]*y(g[u+8>>3])),v=y(m[s+4>>2]*y(g[u>>3]))):(_=u+8|0,A=m[s+12>>2],f=y(m[u+4>>2]*m[s+8>>2]),v=y(m[u>>2]*m[s+4>>2])),C=m[_>>2],d[n+44>>2]=0,m[n+36>>2]=f,m[n+32>>2]=v,m[n+40>>2]=C*A,_=d[e+8>>2],r[d[d[_>>2]+8>>2]](_,n+32|0,t,i),e=d[e+4>>2],r[d[d[e>>2]+24>>2]](e,t),O=n+80|0}function fi(e){var t,i=0,n=0,o=0,a=0,l=0,c=0,h=0,_=0;if(!((0|(t=d[e+4>>2]))>=(0|(n=d[e+48>>2])))){if(d[e+8>>2]>=(0|n))i=d[e+12>>2];else{o=t,n&&(d[7717]=d[7717]+1,i=0|r[d[6606]](n<<2,16),o=d[e+4>>2]),l=d[e+12>>2];e:{t:{if((0|o)>=1)for(;;)if(d[(c=a<<2)+i>>2]=d[l+c>>2],(0|(a=a+1|0))==(0|o))break t;if(!l)break e}u[e+16|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l))}d[e+12>>2]=i,s[e+16|0]=1,d[e+8>>2]=n}if(Mn((o=t<<2)+i|0,0,(c=n<<2)-o|0),d[e+4>>2]=n,(0|(l=d[e+24>>2]))<(0|n)){e:if(d[e+28>>2]>=(0|n))i=d[e+32>>2];else{a=0,o=l,i=0,n&&(d[7717]=d[7717]+1,i=0|r[d[6606]](c,16),o=d[e+24>>2]),h=d[e+32>>2];t:{if((0|o)>=1)for(;;)if(d[(_=a<<2)+i>>2]=d[h+_>>2],(0|(a=a+1|0))==(0|o))break t;if(!h){d[e+32>>2]=i,d[e+28>>2]=n,s[e+36|0]=1;break e}}u[e+36|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+32>>2]=i,s[e+36|0]=1,d[e+28>>2]=n}Mn((o=l<<2)+i|0,0,c-o|0)}if(d[e+24>>2]=n,(0|n)>=1&&(Mn(d[e+12>>2],255,c),Mn(d[e+32>>2],255,c)),!((0|t)<1))for(o=d[e+32>>2],l=d[e+72>>2],n=d[e+12>>2],a=0;i=d[l+(a<<3)>>2],i=b((i=(i<<15^-1)+i|0)>>10^i,9),i=((i^=i>>6)<<11^-1)+i|0,i=n+((d[e+48>>2]+-1&(i>>16^i))<<2)|0,d[o+(a<<2)>>2]=d[i>>2],d[i>>2]=a,(0|t)!=(0|(a=a+1|0)););}}function mi(e,t,i,n,r){var s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0);O=s=O-16|0,o=m[e+52>>2],a=m[e+56>>2],h=m[e+48>>2],l=m[t>>2],_=m[t+4>>2],c=m[t+8>>2],d[r+60>>2]=0,m[r+56>>2]=a+y(c*n),m[r+52>>2]=o+y(_*n),m[r+48>>2]=h+y(l*n),f=m[i>>2],u=m[i+4>>2],p=m[i+8>>2],o=y(x(y(y(y(f*f)+y(u*u))+y(p*p)))),o=(a=y(o*n)>y(.7853981852531433)?y(y(.7853981852531433)/n):o)>2],l=m[s>>2],_=m[s+4>>2],c=m[s+12>>2],d[r+44>>2]=0,d[r+28>>2]=0,d[r+12>>2]=0,p=y(p*o),u=y(u*o),n=yn(y(y(a*n)*y(.5))),o=y(f*o),a=y(y(y(l*p)+y(y(c*u)+y(_*n)))-y(h*o)),f=y(y(y(y(n*c)-y(o*l))-y(u*_))-y(p*h)),g=y(y(y(y(p*c)+y(n*h))+y(o*_))-y(u*l)),l=y(y(y(y(n*l)+y(o*c))+y(u*h))-y(p*_)),o=y(y(1)/y(x(y(y(f*f)+y(y(g*g)+y(y(l*l)+y(a*a))))))),n=y(a*o),a=y(f*o),h=y(g*o),o=y(l*o),l=y(y(2)/y(y(a*a)+y(y(h*h)+y(y(o*o)+y(n*n))))),_=y(h*l),c=y(n*_),p=y(o*l),u=y(a*p),m[r+36>>2]=c+u,f=y(o*_),l=y(n*l),g=y(a*l),m[r+32>>2]=f-g,m[r+24>>2]=c-u,c=y(o*l),a=y(a*_),m[r+16>>2]=c+a,m[r+8>>2]=f+g,m[r+4>>2]=c-a,o=y(o*p),n=y(n*l),m[r+40>>2]=y(1)-y(o+n),a=o,o=y(h*_),m[r+20>>2]=y(1)-y(a+o),m[r>>2]=y(1)-y(n+o),O=s+16|0}function gi(e,t){var i=y(0),n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0);if(i=m[e+312>>2],l=m[e+444>>2],n=le(y(y(1)-l),t),i=y(i*n),m[e+312>>2]=i,o=y(n*m[e+316>>2]),m[e+316>>2]=o,n=y(n*m[e+320>>2]),m[e+320>>2]=n,s=m[e+328>>2],c=m[e+448>>2],r=le(y(y(1)-c),t),t=y(s*r),m[e+328>>2]=t,s=y(r*m[e+332>>2]),m[e+332>>2]=s,r=y(r*m[e+336>>2]),m[e+336>>2]=r,u[e+452|0]&&(y(y(y(t*t)+y(s*s))+y(r*r))>2]^1|y(y(y(i*i)+y(o*o))+y(n*n))>2]^1||(a=m[e+456>>2],r=y(r*a),m[e+336>>2]=r,s=y(s*a),m[e+332>>2]=s,t=y(t*a),m[e+328>>2]=t,n=y(n*a),m[e+320>>2]=n,o=y(o*a),m[e+316>>2]=o,i=y(i*a),m[e+312>>2]=i),(a=y(x(y(y(y(i*i)+y(o*o))+y(n*n)))))y(.004999999888241291)?(l=n,n=y(y(1)/a),m[e+320>>2]=l-y(y(l*n)*y(.004999999888241291)),m[e+316>>2]=o-y(y(o*n)*y(.004999999888241291)),m[e+312>>2]=i-y(y(i*n)*y(.004999999888241291))):(d[e+312>>2]=0,d[e+316>>2]=0,d[e+320>>2]=0,d[e+324>>2]=0)),(i=y(x(y(y(y(t*t)+y(s*s))+y(r*r)))))y(.004999999888241291))return i=y(y(1)/i),m[e+336>>2]=r-y(y(r*i)*y(.004999999888241291)),m[e+332>>2]=s-y(y(s*i)*y(.004999999888241291)),void(m[e+328>>2]=t-y(y(t*i)*y(.004999999888241291)));d[e+328>>2]=0,d[e+332>>2]=0,d[e+336>>2]=0,d[e+340>>2]=0}}function bi(e,t){var i,n,r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0;return(0|(i=d[e+16>>2]))!=(0|(s=d[t+16>>2]))?i-s|0:i?(l=d[e+4>>2],h=d[t+8>>2],u=id(_=d[t+12>>2],0,m=d[e>>2],0),c=w,_=id(_,o,l,0),s=w+a|0,a=r=_+c|0,r=r>>>0<_>>>0?s+1|0:s,l=id(h,_=0,l,o),(o=(s=a)+(a=w)|0)>>>0>>0&&(r=r+1|0),s=o,a=r,o=0,(r=l+u|0)>>>0>>0&&(o=o+1|0),u=o,o=o+s|0,s=a,s=o>>>0>>0?s+1|0:s,a=o,o=r,u=0,h=id(m,p,h,_),r=w+r|0,r=(l=u+h|0)>>>0>>0?r+1|0:r,n=l,h=l,l=r,(r=a+(o=(0|o)==(0|r)&h>>>0>>0|r>>>0>>0)|0)>>>0>>0&&(s=s+1|0),u=r,h=s,_=r,m=s,o=d[e+8>>2],e=d[e+12>>2],r=d[t>>2],p=o,a=id(c=d[t+4>>2],s=0,o,0),t=w,f=e,c=id(c,s,e,o=0),s=w,s=(e=t+c|0)>>>0>>0?s+1|0:s,t=e,c=r,e=id(r,0,f,o),r=s,o=r=(t=(f=w)+t|0)>>>0>>0?r+1|0:r,s=0,(r=e+a|0)>>>0>>0&&(s=s+1|0),f=s,a=s+t|0,s=o,s=a>>>0>>0?s+1|0:s,t=a,a=-1,o=s,f=t,t=0,p=id(c,0,p,0),s=r,r=r+w|0,r=(e=t+p|0)>>>0

>>0?r+1|0:r,p=e,c=e,e=r,(s=f+(t=(0|s)==(0|r)&c>>>0>>0|r>>>0>>0)|0)>>>0>>0&&(o=o+1|0),t=o,(0|o)==(0|m)&_>>>0<(r=s)>>>0|m>>>0>>0||(a=1,(0|t)==(0|h)&u>>>0>s>>>0|h>>>0>t>>>0||(a=-1,(0|e)==(0|l)&n>>>0

>>0|l>>>0>>0||(a=(0|e)==(0|l)&n>>>0>p>>>0|l>>>0>e>>>0))),b(a,i)):0}function yi(e){var t,i=0,n=0,r=y(0),s=y(0),o=0,a=y(0),l=y(0),c=0,h=y(0),_=y(0),u=y(0),p=y(0),f=0,g=y(0);if((0|(o=d[e+712>>2]))>=1)for(;n=d[e+720>>2]+b(i,104)|0,d[n+72>>2]=0,d[n+76>>2]=0,d[n+80>>2]=0,d[n+84>>2]=0,(0|o)!=(0|(i=i+1|0)););if((0|(t=d[e+752>>2]))>=1)for(;c=d[e+760>>2]+b(f,44)|0,i=d[c+12>>2],a=m[i+12>>2],n=d[c+8>>2],r=m[n+12>>2],o=d[c+16>>2],_=m[o+12>>2],u=m[i+16>>2],h=m[o+8>>2],l=m[n+16>>2],g=m[o+16>>2],s=m[n+8>>2],p=m[i+8>>2],d[c+32>>2]=0,p=y(p-s),_=y(_-r),a=y(a-r),s=y(h-s),r=y(y(p*_)-y(a*s)),h=a,a=y(g-l),u=y(u-l),l=y(y(h*a)-y(u*_)),s=y(y(u*s)-y(p*a)),a=y(y(1)/y(x(y(y(r*r)+y(y(l*l)+y(s*s)))))),m[c+28>>2]=r*a,m[c+24>>2]=s*a,m[c+20>>2]=l*a,m[n+80>>2]=r+m[n+80>>2],m[n+76>>2]=s+m[n+76>>2],m[n+72>>2]=l+m[n+72>>2],m[i+72>>2]=l+m[i+72>>2],m[i+76>>2]=s+m[i+76>>2],m[i+80>>2]=r+m[i+80>>2],m[o+72>>2]=l+m[o+72>>2],m[o+76>>2]=s+m[o+76>>2],m[o+80>>2]=r+m[o+80>>2],(0|t)!=(0|(f=f+1|0)););if((0|(n=d[e+712>>2]))>=1)for(o=d[e+720>>2],i=0;e=o+b(i,104)|0,r=m[e+72>>2],l=m[e+76>>2],s=m[e+80>>2],(a=y(x(y(y(y(r*r)+y(l*l))+y(s*s)))))>y(1.1920928955078125e-7)&&(h=r,r=y(y(1)/a),m[e+72>>2]=h*r,m[e+76>>2]=l*r,m[e+80>>2]=s*r),(0|n)!=(0|(i=i+1|0)););}function vi(e,t,i,n,r,s){var o=y(0),a=y(0),l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0);d[e+4>>2]=i,d[e>>2]=t,l=d[n+4>>2],d[e+8>>2]=d[n>>2],d[e+12>>2]=l,l=d[n+12>>2],d[e+16>>2]=d[n+8>>2],d[e+20>>2]=l,l=d[r+4>>2],d[e+24>>2]=d[r>>2],d[e+28>>2]=l,l=d[r+12>>2],d[e+32>>2]=d[r+8>>2],d[e+36>>2]=l,m[e+44>>2]=s,c=m[n+4>>2],o=y(c-m[t+56>>2]),s=m[r+8>>2],C=m[n+8>>2],a=y(C-m[t+60>>2]),u=m[r+4>>2],p=y(y(o*s)-y(a*u)),f=m[r>>2],h=m[n>>2],_=y(h-m[t+52>>2]),g=y(y(a*f)-y(s*_)),b=y(y(_*u)-y(o*f)),S=y(y(y(m[t+264>>2]*p)+y(m[t+280>>2]*g))+y(b*m[t+296>>2])),h=y(h-m[i+52>>2]),c=y(c-m[i+56>>2]),v=y(y(u*h)-y(f*c)),x=y(y(y(p*m[t+268>>2])+y(g*m[t+284>>2]))+y(b*m[t+300>>2])),T=y(s*y(y(o*S)-y(_*x))),A=o,o=y(y(y(p*m[t+272>>2])+y(g*m[t+288>>2]))+y(b*m[t+304>>2])),g=y(m[t+344>>2]+y(T+y(y(f*y(y(a*x)-y(A*o)))+y(u*y(y(_*o)-y(a*S)))))),A=s,o=y(C-m[i+60>>2]),a=y(y(s*c)-y(u*o)),s=y(y(f*o)-y(s*h)),_=y(y(v*m[i+296>>2])+y(y(m[i+264>>2]*a)+y(m[i+280>>2]*s))),p=y(y(y(a*m[i+268>>2])+y(s*m[i+284>>2]))+y(v*m[i+300>>2])),s=y(y(y(a*m[i+272>>2])+y(s*m[i+288>>2]))+y(v*m[i+304>>2])),m[e+40>>2]=y(1)/y(g+y(m[i+344>>2]+y(y(A*y(y(c*_)-y(h*p)))+y(y(f*y(y(o*p)-y(c*s)))+y(u*y(y(h*s)-y(o*_)))))))}function Ai(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var r=0,o=y(0);O=i=O-784|0,d[i+732>>2]=0,d[i+736>>2]=0,d[i+744>>2]=0,d[i+748>>2]=0,d[i+740>>2]=1065353216,d[i+764>>2]=0,d[i+768>>2]=0,d[i+760>>2]=1065353216,d[i+772>>2]=0,d[i+776>>2]=0,d[i+780>>2]=0,d[i+724>>2]=0,d[i+728>>2]=0,d[i+720>>2]=1065353216,d[i+752>>2]=0,d[i+756>>2]=0,d[i+712>>2]=0,d[i+716>>2]=0,d[i+544>>2]=6896,d[i+708>>2]=d[e+200>>2],r=d[e+196>>2],d[4+(n=i+488|0)>>2]=35,d[n+8>>2]=0,d[n>>2]=13316,d[n+44>>2]=1025758986,d[n+20>>2]=1065353216,d[n+24>>2]=0,d[n+12>>2]=1065353216,d[n+16>>2]=1065353216,d[n>>2]=13444,d[i+532>>2]=r,d[i+516>>2]=r,d[i+488>>2]=11556,d[i+492>>2]=8,n=po(i+384|0),d[i+388>>2]=1,d[i+384>>2]=6500,r=d[t+12>>2],d[i+448>>2]=d[t+8>>2],d[i+452>>2]=r,r=d[t+4>>2],d[i+440>>2]=d[t>>2],d[i+444>>2]=r,r=d[t+20>>2],d[i+456>>2]=d[t+16>>2],d[i+460>>2]=r,r=d[t+28>>2],d[i+464>>2]=d[t+24>>2],d[i+468>>2]=r,r=d[t+36>>2],d[i+472>>2]=d[t+32>>2],d[i+476>>2]=r,r=d[t+44>>2],d[i+480>>2]=d[t+40>>2],d[i+484>>2]=r,s[i+356|0]=0,d[i+332>>2]=953267991,d[12+(t=i+8|0)>>2]=i+384,d[t+8>>2]=i+488,d[t+4>>2]=i+24,d[t>>2]=6304,ee(t,e+4|0,e+68|0,i+720|0,i+720|0,i+544|0)&&(o=m[i+708>>2],m[e+200>>2]>o&&(m[e+200>>2]=o)),Ha(n),O=i+784|0}function Ci(e,t,i,n){var o,a=0,l=0;if(O=o=O-128|0,d[o+108>>2]=16,d[o+112>>2]=981668463,d[o+104>>2]=t,d[o+100>>2]=i,d[o+96>>2]=1,d[o+60>>2]=0,s[o- -64|0]=1,s[o+92|0]=1,d[o+52>>2]=0,d[o+56>>2]=0,d[o+88>>2]=0,d[o+80>>2]=0,d[o+84>>2]=0,d[o+68>>2]=0,d[o+72>>2]=0,d[o+44>>2]=0,s[o+40|0]=1,s[o+36|0]=1,d[o+32>>2]=0,d[o+24>>2]=0,d[o+28>>2]=0,d[o+12>>2]=0,s[o+16|0]=1,d[o+4>>2]=0,d[o+8>>2]=0,d[o+116>>2]=i,ie(o,o+96|0,o+40|0),d[7717]=d[7717]+1,e=Ce(0|r[d[6606]](1252,16),e,d[o+44>>2],d[o+60>>2],0),d[o+68>>2]>0)for(;a=d[o+88>>2]+b(l,12)|0,t=d[a+8>>2],(0|(i=d[a>>2]))<(0|(a=d[a+4>>2]))&&Lh(e,i,a,0,0),(0|a)<(0|t)&&Lh(e,a,t,0,0),(0|t)<(0|i)&&Lh(e,t,i,0,0),lr(e,i,a,t,0),(0|(l=l+1|0))>2];);return os(o+40|0),n&&rt(e),(t=d[o+32>>2])&&(u[o+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[o+32>>2]=0),d[o+32>>2]=0,s[o+36|0]=1,d[o+24>>2]=0,d[o+28>>2]=0,(t=d[o+12>>2])&&(u[o+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[o+12>>2]=0),(t=d[o+88>>2])&&(u[o+92|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[o+88>>2]=0),d[o+88>>2]=0,s[o+92|0]=1,d[o+80>>2]=0,d[o+84>>2]=0,(t=d[o+60>>2])&&(u[o+64|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[o+60>>2]=0),O=o+128|0,e}function Si(e,t,i,n){var s=0,o=0,a=0,l=0,c=0,h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0);if(t){for(h=m[i+24>>2],_=m[i+20>>2],u=m[i+16>>2],p=m[i+8>>2],f=m[i+4>>2],g=m[i>>2],d[7717]=d[7717]+1,s=0|r[d[6606]](256,16),d[s>>2]=t,e=64,i=1;;){a=d[((t=i+-1|0)<<2)+s>>2];e:if(!(m[a>>2]<=u^1|m[a+16>>2]>=g^1|m[a+4>>2]<=_^1|m[a+20>>2]>=f^1||m[a+8>>2]<=h^1|m[a+24>>2]>=p^1)){t:{i:{if(d[a+40>>2]){if((0|e)!=(0|t)){o=e,l=s;break t}if((0|i)>(0|(o=e?e<<1:1))){l=s,t=o=e;break t}if(t=0,l=0,o&&(d[7717]=d[7717]+1,l=0|r[d[6606]](o<<2,16)),(0|i)>=2)for(;;)if(d[(i=t<<2)+l>>2]=d[i+s>>2],(0|(t=t+1|0))==(0|e))break i;if(s)break i;break t}r[d[d[n>>2]+12>>2]](n,a);break e}s&&(d[7718]=d[7718]+1,r[d[6607]](s)),t=e}d[(t<<2)+l>>2]=d[a+36>>2];t:if((0|(c=t+1|0))!=(0|o)||(0|o)>=(0|(e=o?o<<1:1)))e=o,s=l;else{i=0,s=0,e&&(d[7717]=d[7717]+1,s=0|r[d[6606]](e<<2,16));i:{if((0|t)>=0)for(;;)if(d[(o=i<<2)+s>>2]=d[o+l>>2],o=(0|t)==(0|i),i=i+1|0,o)break i;if(!l)break t}l&&(d[7718]=d[7718]+1,r[d[6607]](l))}d[(c<<2)+s>>2]=d[a+40>>2],t=t+2|0}if(!((0|(i=t))>0))break}s&&s&&(d[7718]=d[7718]+1,r[d[6607]](s))}}function xi(e,t){var i,n=0,o=0,a=0,l=0,c=0,h=0,_=0;if(O=i=O-48|0,d[i+40>>2]=0,d[(n=i)+32>>2]=0,d[n+36>>2]=0,d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=0,d[n+20>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,t=t||d[d[e+880>>2]>>2],(0|(a=d[e+752>>2]))==d[e+756>>2]&&!((0|a)>=(0|(c=a?a<<1:1)))){if(c&&(d[7717]=d[7717]+1,_=0|r[d[6606]](b(c,44),16),a=d[e+752>>2]),(0|a)>=1)for(;o=(n=b(h,44))+_|0,n=n+d[e+760>>2]|0,l=d[n+4>>2],d[o>>2]=d[n>>2],d[o+4>>2]=l,d[o+40>>2]=d[n+40>>2],l=d[n+36>>2],d[o+32>>2]=d[n+32>>2],d[o+36>>2]=l,l=d[n+28>>2],d[o+24>>2]=d[n+24>>2],d[o+28>>2]=l,l=d[n+20>>2],d[o+16>>2]=d[n+16>>2],d[o+20>>2]=l,l=d[n+12>>2],d[o+8>>2]=d[n+8>>2],d[o+12>>2]=l,(0|(h=h+1|0))!=(0|a););(n=d[e+760>>2])&&(u[e+764|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+760>>2]=0),d[e+760>>2]=_,d[e+756>>2]=c,s[e+764|0]=1,a=d[e+752>>2]}n=d[e+760>>2]+b(a,44)|0,d[n+4>>2]=t,d[n>>2]=0,t=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=t,t=d[i+20>>2],d[n+16>>2]=d[i+16>>2],d[n+20>>2]=t,t=d[i+28>>2],d[n+24>>2]=d[i+24>>2],d[n+28>>2]=t,t=d[i+36>>2],d[n+32>>2]=d[i+32>>2],d[n+36>>2]=t,d[n+40>>2]=d[i+40>>2],d[e+752>>2]=d[e+752>>2]+1,O=i+48|0}function Ti(e,t,i,n,r,s){var o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),d=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0);return u=y(-1),p=m[n>>2],c=m[i>>2],h=y(p-c),x=m[r+4>>2],_=m[i+4>>2],d=y(x-_),f=m[n+4>>2],a=y(f-_),T=m[r>>2],o=y(T-c),b=y(y(h*d)-y(a*o)),A=m[t+8>>2],l=m[t>>2],C=a,E=m[r+8>>2],a=m[i+8>>2],g=y(E-a),R=m[n+8>>2],S=y(R-a),d=y(y(C*g)-y(S*d)),C=m[t+4>>2],h=y(y(S*o)-y(h*g)),o=y(y(b*A)+y(y(l*d)+y(C*h))),y(v(o))>2],S=m[e+4>>2],P=m[e+8>>2],!((u=y(y(-y(y(y(y(d*g)+y(h*S))+y(b*P))-y(y(a*b)+y(y(c*d)+y(_*h)))))/o))>y(11920928955078125e-22)^1|uy(-11920928955078125e-22)&&(o=y(x-o),l=y(T-l),g=y(b*y(y(o*p)-y(s*l))),C=s,s=y(E-A),y(g+y(y(d*y(y(C*s)-y(f*o)))+y(h*y(y(f*l)-y(s*p)))))>y(-11920928955078125e-22)&&y(y(b*y(y(_*l)-y(o*c)))+y(y(d*y(y(o*a)-y(s*_)))+y(h*y(y(s*c)-y(a*l)))))>y(-11920928955078125e-22)))||(u=y(-1))),u}function Ei(e,t,i){var n,r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0);n=d[e+32>>2],l=m[n+36>>2],c=m[n+20>>2],u=m[n+40>>2],h=m[n+24>>2],_=m[n+8>>2],p=m[n+44>>2],o=m[n+28>>2],A=m[n+12>>2],e=d[e+28>>2],b=m[e+36>>2],v=m[e+20>>2],f=m[e+40>>2],C=m[e+8>>2],S=m[e+24>>2],g=m[e+44>>2],x=m[e+12>>2],T=m[e+28>>2],E=m[n+4>>2],R=m[e+4>>2],d[t+8>>2]=0,d[t+12>>2]=0,d[t>>2]=0,d[t+4>>2]=0,s=m[i+8>>2],r=m[i>>2],a=m[i+4>>2],d[t+28>>2]=0,g=y(y(y(x*r)+y(T*a))+y(g*s)),m[t+24>>2]=g,f=y(y(y(C*r)+y(S*a))+y(f*s)),m[t+20>>2]=f,a=y(y(y(R*r)+y(v*a))+y(b*s)),m[t+16>>2]=a,s=m[i+8>>2],b=m[i+4>>2],r=m[i>>2],d[t+44>>2]=0,v=o,o=y(-b),p=y(y(y(v*o)-y(A*r))-y(p*s)),m[t+40>>2]=p,u=y(y(y(h*o)-y(_*r))-y(u*s)),m[t+36>>2]=u,s=y(y(y(c*o)-y(E*r))-y(l*s)),m[t+32>>2]=s,r=m[e+400>>2],o=m[e+404>>2],l=m[e+396>>2],d[t+60>>2]=0,o=y(g*o),m[t+56>>2]=o,r=y(f*r),m[t+52>>2]=r,l=y(a*l),m[t+48>>2]=l,c=m[n+400>>2],h=m[n+404>>2],_=m[n+396>>2],d[t+76>>2]=0,h=y(p*h),m[t+72>>2]=h,c=y(u*c),m[t+68>>2]=c,_=y(s*_),m[t+64>>2]=_,m[t+80>>2]=y(y(y(a*l)+y(f*r))+y(g*o))+y(y(y(s*_)+y(u*c))+y(p*h))}function Ri(e){var t,i,n=y(0),r=y(0),s=y(0),o=0,a=0,l=0,c=0,h=0;for(i=(0|(t=d[e+28>>2]))<1;;){e:{t:switch(0|l){case 0:n=y(m[e+88>>2]+m[e+72>>2]),r=y(m[e+84>>2]+m[e+68>>2]),s=y(m[e+80>>2]+m[e+64>>2]);break e;case 1:n=y(m[e+72>>2]-m[e+88>>2]),r=y(m[e+84>>2]+m[e+68>>2]),s=y(m[e+80>>2]+m[e+64>>2]);break e;case 2:n=y(m[e+88>>2]+m[e+72>>2]),r=y(m[e+68>>2]-m[e+84>>2]),s=y(m[e+80>>2]+m[e+64>>2]);break e;case 3:n=y(m[e+72>>2]-m[e+88>>2]),r=y(m[e+68>>2]-m[e+84>>2]),s=y(m[e+80>>2]+m[e+64>>2]);break e;case 4:n=y(m[e+88>>2]+m[e+72>>2]),r=y(m[e+84>>2]+m[e+68>>2]),s=y(m[e+64>>2]-m[e+80>>2]);break e;case 5:n=y(m[e+72>>2]-m[e+88>>2]),r=y(m[e+84>>2]+m[e+68>>2]),s=y(m[e+64>>2]-m[e+80>>2]);break e;case 6:n=y(m[e+88>>2]+m[e+72>>2]),r=y(m[e+68>>2]-m[e+84>>2]),s=y(m[e+64>>2]-m[e+80>>2]);break e;case 7:break t;default:break e}n=y(m[e+72>>2]-m[e+88>>2]),r=y(m[e+68>>2]-m[e+84>>2]),s=y(m[e+64>>2]-m[e+80>>2])}e:{if(!i)for(h=d[e+36>>2],c=0,o=0;;){if(a=b(o,36)+h|0,y(m[a+32>>2]+y(y(y(s*m[a+20>>2])+y(r*m[a+24>>2]))+y(n*m[a+28>>2])))>y(0))break e;if(!((0|(o=o+1|0))<(0|t)))break}if(c=1,8!=(0|(l=l+1|0)))continue}break}return c}function Pi(e,t,i){var n=0,s=0,o=0,a=0,l=0,c=0;if(!((o=d[e+56>>2])||((n=d[e+52>>2])?d[e+52>>2]=d[n+8>>2]:(d[7717]=d[7717]+1,n=0|r[d[6606]](12,16),s=d[e+60>>2],d[n+8>>2]=0,d[n+4>>2]=s,d[7717]=d[7717]+1,d[n>>2]=r[d[6606]](b(s,24),16),d[n+8>>2]=d[e+48>>2],d[e+48>>2]=n),o=d[n>>2],(0|(a=d[n+4>>2]))<1)))for(n=0,s=o;l=s,s=s+24|0,n=n+1|0,d[l>>2]=(0|n)<(0|a)?s:0,(0|n)!=(0|a););if(d[e+56>>2]=d[o>>2],d[o+16>>2]=0,d[o+20>>2]=0,d[o+8>>2]=0,d[o+12>>2]=0,d[o>>2]=0,d[o+4>>2]=0,!((a=d[e+56>>2])||((n=d[e+52>>2])?d[e+52>>2]=d[n+8>>2]:(d[7717]=d[7717]+1,n=0|r[d[6606]](12,16),s=d[e+60>>2],d[n+8>>2]=0,d[n+4>>2]=s,d[7717]=d[7717]+1,d[n>>2]=r[d[6606]](b(s,24),16),d[n+8>>2]=d[e+48>>2],d[e+48>>2]=n),a=d[n>>2],(0|(c=d[n+4>>2]))<1)))for(n=0,s=a;l=s,s=s+24|0,n=n+1|0,d[l>>2]=(0|n)<(0|c)?s:0,(0|n)!=(0|c););return d[e+56>>2]=d[a>>2],d[a>>2]=0,d[a+4>>2]=0,d[o+8>>2]=a,d[a+8>>2]=o,s=d[e+100>>2],d[o+20>>2]=s,d[a+20>>2]=s,d[o+12>>2]=i,d[a+12>>2]=t,d[o+16>>2]=0,d[a+16>>2]=0,i=(t=d[e+116>>2])+1|0,d[e+116>>2]=i,(0|t)>=d[e+120>>2]&&(d[e+120>>2]=i),o}function Ii(e,t,i,n){for(var r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0,m=0,g=0,b=0,y=0,v=0,A=0,C=0;;){for(v=i,p=d[e+12>>2],A=d[8+(s=p+((i+n|0)/2<<4)|0)>>2],_=d[s+4>>2],h=d[s>>2],s=n;;){o=-1,l=-1,(u=d[(r=(i<<4)+p|0)>>2])&&(l=d[u+12>>2]),o=h?d[h+12>>2]:o,a=-1,c=-1,(m=d[r+4>>2])&&(c=d[m+12>>2]),a=_?d[_+12>>2]:a;e:{t:if(!((0|l)>(0|o))){if(!((0|h)!=(0|u)|(0|c)>(0|a))){if((0|_)!=(0|m))break e;if(f[r+8>>2]>A>>>0)break t;break e}if((0|h)!=(0|u)|(0|c)<=(0|a))break e}i=i+1|0;continue}for(;;){o=(C=s<<4)+p|0,l=-1,a=-1,a=h?d[h+12>>2]:a,(g=d[o>>2])&&(l=d[g+12>>2]),c=-1,b=-1,b=_?d[_+12>>2]:b,(y=d[o+4>>2])&&(c=d[y+12>>2]);e:{t:if(!((0|a)>(0|l))){if(!((0|h)!=(0|g)|(0|b)>(0|c))){if((0|_)!=(0|y))break e;if(f[o+8>>2]>>0)break t;break e}if((0|h)!=(0|g)|(0|b)<=(0|c))break e}s=s+-1|0;continue}break}if((0|i)<=(0|s)&&(c=d[r+8>>2],a=d[r+12>>2],l=d[o+4>>2],d[r>>2]=d[o>>2],d[r+4>>2]=l,l=d[o+12>>2],d[r+8>>2]=d[o+8>>2],d[r+12>>2]=l,r=d[e+12>>2]+C|0,d[r+4>>2]=m,d[r+8>>2]=c,d[r+12>>2]=a,d[r>>2]=u,s=s+-1|0,i=i+1|0),!((0|i)<=(0|s)))break;p=d[e+12>>2]}if((0|s)>(0|v)&&Ii(e,t,v,s),!((0|i)<(0|n)))break}}function Mi(e,t,i){var n,r=0,o=0;if(i>>>0>=512)return I(0|e,0|t,0|i),e;n=e+i|0;e:if(3&(e^t))if(n>>>0<4)i=e;else if((r=n+-4|0)>>>0>>0)i=e;else for(i=e;s[0|i]=u[0|t],s[i+1|0]=u[t+1|0],s[i+2|0]=u[t+2|0],s[i+3|0]=u[t+3|0],t=t+4|0,(i=i+4|0)>>>0<=r>>>0;);else{t:if((0|i)<1)i=e;else if(3&e)for(i=e;;){if(s[0|i]=u[0|t],t=t+1|0,(i=i+1|0)>>>0>=n>>>0)break t;if(!(3&i))break}else i=e;if(!((r=-4&n)>>>0<64||i>>>0>(o=r+-64|0)>>>0))for(;d[i>>2]=d[t>>2],d[i+4>>2]=d[t+4>>2],d[i+8>>2]=d[t+8>>2],d[i+12>>2]=d[t+12>>2],d[i+16>>2]=d[t+16>>2],d[i+20>>2]=d[t+20>>2],d[i+24>>2]=d[t+24>>2],d[i+28>>2]=d[t+28>>2],d[i+32>>2]=d[t+32>>2],d[i+36>>2]=d[t+36>>2],d[i+40>>2]=d[t+40>>2],d[i+44>>2]=d[t+44>>2],d[i+48>>2]=d[t+48>>2],d[i+52>>2]=d[t+52>>2],d[i+56>>2]=d[t+56>>2],d[i+60>>2]=d[t+60>>2],t=t- -64|0,(i=i- -64|0)>>>0<=o>>>0;);if(i>>>0>=r>>>0)break e;for(;d[i>>2]=d[t>>2],t=t+4|0,(i=i+4|0)>>>0>>0;);}if(i>>>0>>0)for(;s[0|i]=u[0|t],t=t+1|0,(0|n)!=(0|(i=i+1|0)););return e}function Di(e){var t=0;return d[(e|=0)>>2]=17980,u[e+272|0]&&(t=d[e+204>>2],r[d[d[t>>2]>>2]](t),(t=d[e+204>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),(t=d[e+196>>2])&&(r[d[d[t>>2]>>2]](t),(t=d[e+196>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),u[e+273|0]&&(t=d[e+200>>2],r[d[d[t>>2]>>2]](t),(t=d[e+200>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),(t=d[e+316>>2])&&(u[e+320|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+316>>2]=0),d[e+316>>2]=0,s[e+320|0]=1,d[e+308>>2]=0,d[e+312>>2]=0,(t=d[e+288>>2])&&(u[e+292|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+288>>2]=0),d[e+288>>2]=0,s[e+292|0]=1,d[e+280>>2]=0,d[e+284>>2]=0,(t=d[e+240>>2])&&(u[e+244|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+240>>2]=0),d[e+240>>2]=0,s[e+244|0]=1,d[e+232>>2]=0,d[e+236>>2]=0,(t=d[e+220>>2])&&(u[e+224|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+220>>2]=0),d[e+220>>2]=0,s[e+224|0]=1,d[e+212>>2]=0,d[e+216>>2]=0,(t=d[e+188>>2])&&(u[e+192|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+188>>2]=0),d[e+188>>2]=0,s[e+192|0]=1,d[e+180>>2]=0,d[e+184>>2]=0,Mr(e),0|e}function Oi(e){var t,i,n,o,a=0,l=0,c=0,h=0;if(i=t=d[e+8>>2],n=l=(c=d[e+32>>2])?d[e+40>>2]:0,o=a=(l=d[e+52>>2])?d[e+60>>2]:0,h=0,(a=d[e+72>>2])&&(h=d[e+80>>2]),y(r[d[d[t>>2]+12>>2]](i,n,c,o,l,h,a,d[e+4>>2],d[e+20>>2],d[e+24>>2])),(0|(l=d[e+32>>2]))<=-1)for(d[e+36>>2]<=-1&&((a=d[e+40>>2])&&(u[e+44|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[e+40>>2]=0),d[e+36>>2]=0,d[e+40>>2]=0,s[e+44|0]=1);d[d[e+40>>2]+(l<<2)>>2]=0,c=(a=l+1|0)>>>0>=l>>>0,l=a,c;);if(d[e+32>>2]=0,(0|(l=d[e+52>>2]))<=-1)for(d[e+56>>2]<=-1&&((a=d[e+60>>2])&&(u[e- -64|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[e+60>>2]=0),d[e+56>>2]=0,d[e+60>>2]=0,s[e- -64|0]=1);d[d[e+60>>2]+(l<<2)>>2]=0,c=(a=l+1|0)>>>0>=l>>>0,l=a,c;);if(d[e+52>>2]=0,(0|(l=d[e+72>>2]))<=-1)for(d[e+76>>2]<=-1&&((a=d[e+80>>2])&&(u[e+84|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[e+80>>2]=0),d[e+76>>2]=0,d[e+80>>2]=0,s[e+84|0]=1);d[d[e+80>>2]+(l<<2)>>2]=0,c=(a=l+1|0)>>>0>=l>>>0,l=a,c;);d[e+72>>2]=0}function wi(e,t,i,n,r,o){Ao(e,4,t,i),d[e>>2]=19668,t=d[n+12>>2],d[e+560>>2]=d[n+8>>2],d[e+564>>2]=t,t=d[n+4>>2],d[e+552>>2]=d[n>>2],d[e+556>>2]=t,t=d[n+28>>2],d[e+576>>2]=d[n+24>>2],d[e+580>>2]=t,t=d[n+20>>2],d[e+568>>2]=d[n+16>>2],d[e+572>>2]=t,t=d[n+44>>2],d[e+592>>2]=d[n+40>>2],d[e+596>>2]=t,t=d[n+36>>2],d[e+584>>2]=d[n+32>>2],d[e+588>>2]=t,t=d[n+60>>2],d[e+608>>2]=d[n+56>>2],d[e+612>>2]=t,t=d[n+52>>2],d[e+600>>2]=d[n+48>>2],d[e+604>>2]=t,t=d[r+12>>2],d[e+624>>2]=d[r+8>>2],d[e+628>>2]=t,t=d[r+4>>2],d[e+616>>2]=d[r>>2],d[e+620>>2]=t,t=d[r+20>>2],d[e+632>>2]=d[r+16>>2],d[e+636>>2]=t,t=d[r+28>>2],d[e+640>>2]=d[r+24>>2],d[e+644>>2]=t,t=d[r+36>>2],d[e+648>>2]=d[r+32>>2],d[e+652>>2]=t,t=d[r+44>>2],d[e+656>>2]=d[r+40>>2],d[e+660>>2]=t,t=d[r+52>>2],d[e+664>>2]=d[r+48>>2],d[e+668>>2]=t,t=d[r+60>>2],d[e+672>>2]=d[r+56>>2],d[e+676>>2]=t,d[e+688>>2]=0,d[e+692>>2]=-1082130432,d[e+696>>2]=1063675494,d[e+700>>2]=1050253722,d[e+704>>2]=1065353216,d[e+708>>2]=0,d[e+712>>2]=0,s[e+716|0]=0,s[e+740|0]=o,d[e+748>>2]=0,d[e+736>>2]=16777216,m[e+732>>2]=y(o?-1:1)}function Fi(e,t){t|=0;var i,n,r,s,o,a,l,c=0,h=0,_=0,p=0,f=0,m=0;if(O=i=O-16|0,n=(h=d[32+(e|=0)>>2])+328|0,r=(p=d[e+28>>2])+328|0,s=h+312|0,o=p+312|0,a=h+4|0,l=p+4|0,u[e+1301|0]){for(p=0,h=0;(u[912+(_=(h<<6)+e|0)|0]||d[_+924>>2])&&(m=d[4+(f=1216+(c=(h<<4)+e|0)|0)>>2],d[i+8>>2]=d[f>>2],d[i+12>>2]=m,f=d[4+(c=c+1208|0)>>2],d[i>>2]=d[c>>2],d[i+4>>2]=f,1&(c=d[e+1304>>2]>>b(h,3)+9)||(d[_+896>>2]=d[d[t+32>>2]>>2]),2&c||(d[_+904>>2]=d[d[t+32>>2]>>2]),4&c||(d[_+900>>2]=d[t+4>>2]),p=me(e,_+868|0,l,a,o,s,r,n,t,p,i,1,0)+p|0),3!=(0|(h=h+1|0)););ui(e,t,p,l,a,o,s,r,n)}else for(p=ui(e,t,0,l,a,o,s,r,n),h=0;(u[912+(_=(h<<6)+e|0)|0]||d[_+924>>2])&&(m=d[4+(f=1216+(c=(h<<4)+e|0)|0)>>2],d[i+8>>2]=d[f>>2],d[i+12>>2]=m,f=d[4+(c=c+1208|0)>>2],d[i>>2]=d[c>>2],d[i+4>>2]=f,1&(c=d[e+1304>>2]>>b(h,3)+9)||(d[_+896>>2]=d[d[t+32>>2]>>2]),2&c||(d[_+904>>2]=d[d[t+32>>2]>>2]),4&c||(d[_+900>>2]=d[t+4>>2]),p=me(e,_+868|0,l,a,o,s,r,n,t,p,i,1,0)+p|0),3!=(0|(h=h+1|0)););O=i+16|0}function Bi(e,t){var i,n=0,s=y(0),o=y(0),a=y(0),l=y(0);O=i=O-32|0,t!=y(0)&&((n=d[e+480>>2])&&r[d[d[n>>2]+8>>2]](n,e+4|0),d[e+324>>2]=0,t=y(y(1)/t),m[e+320>>2]=t*y(m[e+60>>2]-m[e+124>>2]),m[e+316>>2]=t*y(m[e+56>>2]-m[e+120>>2]),m[e+312>>2]=t*y(m[e+52>>2]-m[e+116>>2]),kt(e+68|0,e+4|0,i+16|0,i+12|0),o=m[i+16>>2],a=m[i+20>>2],l=m[i+24>>2],s=m[i+12>>2],d[e+340>>2]=0,m[e+336>>2]=t*y(s*l),m[e+332>>2]=t*y(s*a),m[e+328>>2]=t*y(o*s),n=d[e+324>>2],d[e+140>>2]=d[e+320>>2],d[e+144>>2]=n,n=d[e+316>>2],d[e+132>>2]=d[e+312>>2],d[e+136>>2]=n,n=d[e+332>>2],d[e+148>>2]=d[e+328>>2],d[e+152>>2]=n,n=d[e+340>>2],d[e+156>>2]=d[e+336>>2],d[e+160>>2]=n,n=d[e+8>>2],d[e+68>>2]=d[e+4>>2],d[e+72>>2]=n,n=d[e+16>>2],d[e+76>>2]=d[e+12>>2],d[e+80>>2]=n,n=d[e+24>>2],d[e+84>>2]=d[e+20>>2],d[e+88>>2]=n,n=d[e+32>>2],d[e+92>>2]=d[e+28>>2],d[e+96>>2]=n,n=d[e+48>>2],d[e+108>>2]=d[e+44>>2],d[e+112>>2]=n,n=d[e+40>>2],d[e+100>>2]=d[e+36>>2],d[e+104>>2]=n,n=d[e+64>>2],d[e+124>>2]=d[e+60>>2],d[e+128>>2]=n,n=d[e+56>>2],d[e+116>>2]=d[e+52>>2],d[e+120>>2]=n),O=i+32|0}function Ni(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);O=n=O-160|0,d[n+112>>2]=d[t>>2],d[n+64>>2]=d[t+64>>2],d[n+116>>2]=d[t+4>>2],d[n+68>>2]=d[t+68>>2],d[n+120>>2]=d[t+8>>2],d[n+72>>2]=d[t+72>>2],d[n+128>>2]=d[t+16>>2],d[n+80>>2]=d[t+80>>2],d[n+132>>2]=d[t+20>>2],d[n+84>>2]=d[t+84>>2],d[n+136>>2]=d[t+24>>2],d[n+88>>2]=d[t+88>>2],d[n+144>>2]=d[t+32>>2],d[n+96>>2]=d[t+96>>2],d[n+148>>2]=d[t+36>>2],d[n+100>>2]=d[t+100>>2],d[n+152>>2]=d[t+40>>2],d[n+104>>2]=d[t+104>>2],s=d[e+4>>2],a=m[s+36>>2],o=m[s+32>>2],l=m[s+28>>2],c=y(r[d[d[s>>2]+48>>2]](s)),h=y(r[d[d[s>>2]+48>>2]](s)),_=y(r[d[d[s>>2]+48>>2]](s)),d[n+36>>2]=0,o=y(o+h),m[n+28>>2]=o+o,o=y(l+c),m[n+24>>2]=o+o,a=y(a+_),m[n+32>>2]=a+a,e=d[e+8>>2],a=m[e+36>>2],o=m[e+32>>2],l=m[e+28>>2],c=y(r[d[d[e>>2]+48>>2]](e)),h=y(r[d[d[e>>2]+48>>2]](e)),_=y(r[d[d[e>>2]+48>>2]](e)),d[n+20>>2]=0,o=y(o+h),m[n+12>>2]=o+o,o=y(l+c),m[n+8>>2]=o+o,a=y(a+_),m[n+16>>2]=a+a,function(e,t,i,n,s,o,a,l,c,h){var _,u=y(0),p=y(0),f=y(0),g=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=0,I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=0,k=y(0),V=0,U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=0,$=y(0),J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0),se=y(0),oe=y(0),ae=0,le=y(0),ce=y(0),he=y(0),_e=y(0),de=y(0),ue=0,pe=y(0),fe=0,me=0,ge=0,be=0,ye=0,ve=0,Ae=y(0),Ce=y(0),Se=0,xe=0,Te=0,Ee=0;O=_=O-384|0,w=m[t+36>>2],X=m[t+4>>2],T=m[t+20>>2],G=m[t+40>>2],se=m[t+8>>2],$=m[t+24>>2],S=m[e+8>>2],R=m[n+8>>2],A=m[e>>2],C=m[n>>2],N=m[e+4>>2],k=m[n+4>>2],u=m[t+32>>2],pe=m[t>>2],p=m[t+16>>2],f=y(m[i>>2]*y(.5)),m[_+372>>2]=f,g=y(m[i+4>>2]*y(.5)),m[_+376>>2]=g,I=y(m[i+8>>2]*y(.5)),m[_+380>>2]=I,F=y(m[o>>2]*y(.5)),m[_+360>>2]=F,M=y(m[o+4>>2]*y(.5)),m[_+364>>2]=M,E=y(m[o+8>>2]*y(.5)),m[_+368>>2]=E,A=y(C-A),C=y(k-N),S=y(R-S),R=y(y(y(pe*A)+y(p*C))+y(u*S)),J=m[s>>2],j=m[s+16>>2],Y=m[s+32>>2],N=y(y(y(pe*J)+y(p*j))+y(u*Y)),le=y(v(N)),D=m[s+4>>2],ee=m[s+20>>2],te=m[s+36>>2],k=y(y(y(pe*D)+y(p*ee))+y(u*te)),Ae=y(v(k)),ie=m[s+8>>2],ne=m[s+24>>2],oe=m[s+40>>2],W=y(y(y(pe*ie)+y(p*ne))+y(u*oe)),Ce=y(v(W));e:if(!((p=y(y(v(R))-y(y(y(f+y(F*le))+y(M*Ae))+y(E*Ce))))>y(0)||(z=y(y(y(X*ie)+y(T*ne))+y(w*oe)),ce=y(v(z)),Q=y(y(y(X*D)+y(T*ee))+y(w*te)),re=y(v(Q)),q=y(y(y(X*J)+y(T*j))+y(w*Y)),K=y(v(q)),u=y(-34028234663852886e22),i=0,p>y(-34028234663852886e22)&&(V=Ry(0)||(H=y(y(y(se*ie)+y($*ne))+y(G*oe)),he=y(v(H)),U=y(y(y(se*D)+y($*ee))+y(G*te)),_e=y(v(U)),B=y(y(y(se*J)+y($*j))+y(G*Y)),de=y(v(B)),p>u&&(P=t+4|0,V=wy(0)||(p>u&&(P=t+8|0,V=Ty(0)||(p>u&&(V=Gy(0)||(p>u&&(P=s+4|0,V=Gy(0)||(p>u&&(P=s+8|0,V=Ay(1.1920928955078125e-7)||(G=y(_e+y(9999999747378752e-21)),$=y(re+y(9999999747378752e-21)),J=y(le+y(9999999747378752e-21)),C=y(0),oe=y(q*q),re=y(y(B*B)+y(0)),(j=y(x(y(oe+re))))>y(1.1920928955078125e-7)?(S=y(0),p=y(p/j),A=y(0),y(p*y(1.0499999523162842))>u&&(V=Yy(1.1920928955078125e-7)||(j=y(he+y(9999999747378752e-21)),Y=y(ce+y(9999999747378752e-21)),ce=y(Q*Q),he=y(y(U*U)+y(0)),(D=y(x(y(ce+he))))>y(1.1920928955078125e-7)&&(p=y(p/D),y(p*y(1.0499999523162842))>u&&(V=Ky(1.1920928955078125e-7)||(_e=y(z*z),de=y(y(H*H)+y(0)),(D=y(x(y(_e+de))))>y(1.1920928955078125e-7)&&(p=y(p/D),y(p*y(1.0499999523162842))>u&&(V=Ky(1.1920928955078125e-7)||(le=y(N*N),(D=y(x(y(le+re))))>y(1.1920928955078125e-7)&&(p=y(p/D),y(p*y(1.0499999523162842))>u&&(V=Ky(1.1920928955078125e-7)||(re=y(k*k),(B=y(x(y(re+he))))>y(1.1920928955078125e-7)&&(p=y(p/B),y(p*y(1.0499999523162842))>u&&(V=Dy(1.1920928955078125e-7)||(B=y(W*W),(T=y(x(y(B+de))))>y(1.1920928955078125e-7)&&(p=y(p/T),y(p*y(1.0499999523162842))>u&&(V=Uy(1.1920928955078125e-7)||((T=y(x(y(y(oe+le)+y(0)))))>y(1.1920928955078125e-7)&&(p=y(p/T),y(p*y(1.0499999523162842))>u&&(V=Hy(1.1920928955078125e-7)||((E=y(x(y(y(ce+re)+y(0)))))>y(1.1920928955078125e-7)&&(p=y(p/E),y(p*y(1.0499999523162842))>u&&(V=Ty(1.1920928955078125e-7))))))))))))))))){t:{i:{if((f=y(x(y(y(_e+B)+y(0)))))>y(1.1920928955078125e-7)&&(p=y(p/f),y(p*y(1.0499999523162842))>u))V=E>2]=f,g=y(y(y(C*m[t+16>>2])+y(S*m[t+20>>2]))+y(A*m[t+24>>2])),m[a+4>>2]=g,C=y(y(y(C*m[t+32>>2])+y(S*m[t+36>>2]))+y(A*m[t+40>>2])),m[a+8>>2]=C;break t}f=m[P>>2],d[a>>2]=d[P>>2],g=m[P+16>>2],d[a+4>>2]=d[P+16>>2],C=m[P+32>>2],d[a+8>>2]=d[P+32>>2],p=u}if(V&&(m[a+8>>2]=-C,m[a+4>>2]=-g,m[a>>2]=-f),m[l>>2]=-p,(0|i)>=7)d[_+120>>2]=d[e+8>>2],o=d[e+4>>2],d[_+112>>2]=d[e>>2],d[_+116>>2]=o,g=y(0),M=m[_+112>>2],E=m[_+116>>2],T=u=m[_+372>>2],C=y(-u),u=m[a>>2],R=m[t>>2],A=m[a+4>>2],w=m[t+16>>2],f=m[a+8>>2],S=m[t+32>>2],C=y(y(y(u*R)+y(A*w))+y(f*S))>y(0)?T:C,D=y(m[_+120>>2]+y(C*S)),S=m[_+376>>2],T=m[t+4>>2],N=m[t+20>>2],k=m[t+36>>2],S=y(y(y(u*T)+y(A*N))+y(f*k))>y(0)?S:y(-S),D=y(D+y(S*k)),k=m[t+8>>2],W=m[t+24>>2],z=m[t+40>>2],I=y(y(y(u*k)+y(A*W))+y(f*z))>y(0)?I:y(-I),m[_+120>>2]=D+y(I*z),m[_+116>>2]=y(y(E+y(C*w))+y(S*N))+y(I*W),m[_+112>>2]=y(y(M+y(C*R))+y(S*T))+y(I*k),d[_+216>>2]=d[n+8>>2],e=d[n+4>>2],d[_+208>>2]=d[n>>2],d[_+212>>2]=e,T=y(-F),R=F,I=m[s>>2],F=m[s+16>>2],S=m[s+32>>2],C=y(y(y(u*I)+y(A*F))+y(f*S))>y(0)?T:R,T=y(m[_+216>>2]+y(C*S)),S=m[_+364>>2],M=m[s+4>>2],E=m[s+20>>2],R=m[s+36>>2],S=y(y(y(u*M)+y(A*E))+y(f*R))>y(0)?y(-S):S,D=y(T+y(S*R)),R=m[_+368>>2],B=y(-R),T=R,R=m[s+8>>2],w=m[s+24>>2],u=y(y(u*R)+y(A*w)),A=m[s+40>>2],u=y(u+y(f*A))>y(0)?B:T,A=y(D+y(u*A)),m[_+216>>2]=A,f=y(y(y(m[_+212>>2]+y(C*F))+y(S*E))+y(u*w)),m[_+212>>2]=f,u=y(y(y(m[_+208>>2]+y(C*I))+y(S*M))+y(u*R)),m[_+208>>2]=u,M=m[(e=(e=t)+((n=(0|(t=i+-7|0))/3|0)<<2)|0)>>2],t=(t-b(n,3)<<2)+s|0,C=m[t>>2],E=m[e+16>>2],S=m[t+16>>2],R=m[e+32>>2],I=m[t+32>>2],F=y(y(y(M*C)+y(E*S))+y(R*I)),(w=y(y(1)-y(F*F)))<=y(9999999747378752e-20)||(g=y(u-m[_+112>>2]),T=y(g*M),M=y(f-m[_+116>>2]),T=y(T+y(M*E)),E=y(A-m[_+120>>2]),g=y(y(y(y(T+y(E*R))*F)-y(y(y(g*C)+y(M*S))+y(E*I)))*y(y(1)/w))),m[_+216>>2]=A+y(g*I),m[_+212>>2]=f+y(g*S),m[_+208>>2]=u+y(g*C),u=m[a>>2],A=m[a+4>>2],f=m[a+8>>2],d[_+300>>2]=0,m[_+296>>2]=-f,m[_+292>>2]=-A,m[_+288>>2]=-u,r[d[d[h>>2]+16>>2]](h,_+288|0,_+208|0,p),d[c>>2]=i;else{S=m[a>>2],(0|i)<=3?(p=m[a+8>>2],A=m[a+4>>2],be=_+372|0,L=s,P=_+360|0):(S=y(-S),p=y(-m[a+8>>2]),A=y(-m[a+4>>2]),o=n,be=_+360|0,n=e,e=o,L=t,t=s,P=_+372|0),f=y(y(y(S*m[L>>2])+y(A*m[L+16>>2]))+y(p*m[L+32>>2])),m[_+344>>2]=f,g=y(y(y(S*m[L+4>>2])+y(A*m[L+20>>2]))+y(p*m[L+36>>2])),m[_+348>>2]=g,u=y(y(y(S*m[L+8>>2])+y(A*m[L+24>>2]))+y(p*m[L+40>>2])),m[_+352>>2]=u,u=y(v(u)),(g=y(v(g)))>(f=y(v(f)))?(s=(l=g>u)?1:2,o=0):(s=(1^(l=f>u))<<1,o=l),Se=o,u=m[(o=s<<2)+P>>2],f=y(u*m[o+L>>2]),g=y(m[n>>2]-m[e>>2]),xe=l?2:1,s=_,m[o+(_+344|0)>>2]>2]=f,g=y(y(m[n+4>>2]-m[e+4>>2])+y(u*m[(16|o)+L>>2])),m[_+332>>2]=g,u=y(y(m[n+8>>2]-m[e+8>>2])+y(u*m[(32|o)+L>>2]))):(f=y(g-f),m[_+328>>2]=f,g=y(y(m[n+4>>2]-m[e+4>>2])-y(u*m[(16|o)+L>>2])),m[_+332>>2]=g,u=y(y(m[n+8>>2]-m[e+8>>2])-y(u*m[(32|o)+L>>2]))),m[s+336>>2]=u,s=4,n=1,l=2;t:{i:{n:switch(0|(Te=((0|i)<4?-1:-4)+i|0)){case 0:break t;case 1:break n;default:break i}n=0;break t}l=1,n=0}C=m[32+(n=(o=n<<2)+t|0)>>2],I=m[n>>2],F=m[n+16>>2],M=m[(t=(n=l<<2)+t|0)>>2],E=m[t+16>>2],R=m[t+32>>2],w=y(y(y(f*M)+y(g*E))+y(u*R)),N=m[(ye=(t=Se<<2)+L|0)>>2],k=m[ye+16>>2],W=m[ye+32>>2],T=y(y(y(M*N)+y(E*k))+y(R*W)),z=m[t+P>>2],Q=y(T*z),q=y(w+Q),H=m[(ve=(t=xe<<2)+L|0)>>2],U=m[ve+16>>2],B=m[ve+32>>2],E=y(y(y(M*H)+y(E*U))+y(R*B)),X=m[t+P>>2],M=y(E*X),m[_+316>>2]=q-M,R=y(y(y(f*I)+y(g*F))+y(u*C)),N=y(y(y(I*N)+y(F*k))+y(C*W)),f=y(z*N),g=y(R+f),I=y(y(y(I*H)+y(F*U))+y(C*B)),u=y(X*I),m[_+312>>2]=g-u,m[_+308>>2]=q+M,m[_+304>>2]=g+u,g=y(w-Q),m[_+300>>2]=g+M,f=y(R-f),m[_+296>>2]=f+u,m[_+292>>2]=g-M,m[_+288>>2]=f-u,d[_+280>>2]=d[o+be>>2],d[_+284>>2]=d[n+be>>2],o=_+208|0,P=_+288|0,V=1,t=0;t:{for(;;){i:{n:if((0|s)>0){for(Ee=1^t,ue=(ae=t<<2)+(_+280|0)|0,n=o,t=P,l=0;;){if(f=m[ue>>2],g=m[(Z=t+ae|0)>>2],f>(C=y(-g))){if(d[n>>2]=d[t>>2],d[n+4>>2]=d[t+4>>2],8&(l=l+1|0))break i;f=m[ue>>2],g=m[Z>>2],C=y(-g),n=n+8|0}if(fe=C1)?Z:P)+ae>>2],(0|fe)!=(f>y(-C)|0)){if(u=m[(fe=t)+(t=Ee<<2)>>2],m[t+n>>2]=u+y(y(y(-f)-g)*y(y(m[t+ge>>2]-u)/y(C-g))),m[n+ae>>2]=-m[ue>>2],8&(l=l+1|0))break i;n=n+8|0}if(s=s+-1|0,t=Z,!me)break}if(s=0,P=(_+208|0)==(0|o)?_+112|0:_+208|0,(0|l)<=0)break n;for(n=P,t=o;;){if((g=m[(Z=t+ae|0)>>2])<(f=m[ue>>2])){if(d[n>>2]=d[t>>2],d[n+4>>2]=d[t+4>>2],8&(s=s+1|0))break t;f=m[ue>>2],g=m[Z>>2],n=n+8|0}if(Z=t+8|0,(g1)?Z:o)+ae>>2])>2],m[t+n>>2]=u+y(y(f-g)*y(y(m[t+ge>>2]-u)/y(C-g))),d[n+ae>>2]=d[ue>>2],8&(s=s+1|0))break t;n=n+8|0}if(l=l+-1|0,t=Z,!me)break}}else P=(_+208|0)==(0|o)?_+112|0:_+208|0,s=0;if(t=1,n=V,o=(_+208|0)==(0|P)?_+112|0:_+208|0,V=0,n)continue;break t}break}P=o,s=l}if((_+208|0)!=(0|P)&&Mi(_+208|0,P,s<<3),!((0|s)<1)){for(u=y(y(1)/y(y(N*E)-y(T*I))),g=y(u*y(-T)),C=y(E*u),I=y(I*u),F=y(N*u),M=m[(Te<<2)+be>>2],E=m[(32|(t=xe<<2))+L>>2],T=m[(32|(n=Se<<2))+L>>2],N=m[(16|t)+L>>2],k=m[(16|n)+L>>2],W=m[ve>>2],z=m[ye>>2],t=0,Q=m[_+336>>2],q=m[_+332>>2],H=m[_+328>>2],n=0;o=(_+112|0)+b(t,12)|0,U=m[(l=n<<3)+(_+208|0)>>2],f=y(U-R),B=m[(_+208|0)+(4|l)>>2],X=y(B-w),u=y(y(C*f)-y(I*X)),f=y(y(g*f)+y(F*X)),X=y(y(H+y(u*z))+y(f*W)),m[o>>2]=X,se=y(y(q+y(u*k))+y(f*N)),m[o+4>>2]=se,u=y(y(Q+y(u*T))+y(f*E)),m[o+8>>2]=u,u=y(M-y(y(y(S*X)+y(A*se))+y(p*u))),m[(_+80|0)+(t<<2)>>2]=u,u>=y(0)&&(m[(o=t<<3)+(_+208|0)>>2]=U,m[(_+208|0)+(4|o)>>2]=B,t=t+1|0),(0|s)!=(0|(n=n+1|0)););if(!((0|t)<1)){t:if((0|t)<=(0|(o=(0|(n=(0|t)<4?t:4))>1?n:1))){if((0|i)>=4){for(s=0;n=(_+112|0)+b(s,12)|0,p=m[a>>2],u=m[(_+80|0)+(s<<2)>>2],m[_+32>>2]=y(m[n>>2]+m[e>>2])-y(p*u),A=m[a+4>>2],m[_+36>>2]=y(m[n+4>>2]+m[e+4>>2])-y(u*A),f=m[a+8>>2],m[_+40>>2]=y(m[n+8>>2]+m[e+8>>2])-y(u*f),d[_+76>>2]=0,m[_+72>>2]=-f,m[_+68>>2]=-A,m[_+64>>2]=-p,r[d[d[h>>2]+16>>2]](h,_- -64|0,_+32|0,y(-u)),(0|(s=s+1|0))!=(0|t););break t}for(s=0;n=(_+112|0)+b(s,12)|0,m[_+32>>2]=m[n>>2]+m[e>>2],m[_+36>>2]=m[n+4>>2]+m[e+4>>2],m[_+40>>2]=m[n+8>>2]+m[e+8>>2],u=m[a>>2],p=m[a+4>>2],A=m[a+8>>2],d[_+76>>2]=0,m[_+72>>2]=-A,m[_+68>>2]=-p,m[_+64>>2]=-u,r[d[d[h>>2]+16>>2]](h,_- -64|0,_+32|0,y(-m[(_+80|0)+(s<<2)>>2])),(0|(s=s+1|0))!=(0|t););}else{if(n=0,(0|t)>=2)for(f=m[_+80>>2],s=1;f=(l=(u=m[(_+80|0)+(s<<2)>>2])>f)?u:f,n=l?s:n,(0|(s=s+1|0))!=(0|t););for(function(e,t,i,n,r){var s,o=0,a=y(0),l=y(0),c=0,h=y(0),_=y(0),u=0,p=y(0),f=y(0),g=y(0),b=0,A=y(0),C=y(0);O=s=O+-64|0;i:{n:{switch(e+-1|0){default:if((0|e)>=2)for(b=e+-1|0;_=m[(c=(u=o<<3)+t|0)>>2],p=m[c+12>>2],f=m[c+8>>2],g=m[(4|u)+t>>2],h=y(y(_*p)-y(f*g)),a=y(a+h),l=y(l+y(y(p+g)*h)),A=y(A+y(y(_+f)*h)),(0|b)!=(0|(o=o+1|0)););if(h=y(0xde0b6b000000000),C=a,_=m[(o=(e<<3)+t|0)-8>>2],p=m[t+4>>2],f=m[t>>2],g=m[o+-4>>2],a=y(y(_*p)-y(f*g)),C=y(C+a),y(v(C))>y(1.1920928955078125e-7)&&(h=y(y(1)/y(C*y(3)))),b=0,(0|e)<=0)break i;l=y(y(l+y(y(p+g)*a))*h),a=y(y(A+y(y(_+f)*a))*h);break n;case 0:l=m[t+4>>2],a=m[t>>2];break n;case 1:}l=y(y(m[t+4>>2]+m[t+12>>2])*y(.5)),a=y(y(m[t>>2]+m[t+8>>2])*y(.5))}for(o=0;c=o<<3,m[(s+32|0)+(o<<2)>>2]=tn(y(m[(4|c)+t>>2]-l),y(m[t+c>>2]-a)),(0|(o=o+1|0))!=(0|e););for(o=0;b=1,d[(o<<2)+s>>2]=1,(0|(o=o+1|0))!=(0|e););}if(d[(t=n<<2)+s>>2]=0,d[r>>2]=n,(0|i)>=2)for(h=y(y(6.2831854820251465)/y(0|i)),A=m[t+(s+32|0)>>2],c=1;;){if(d[r+4>>2]=n,r=r+4|0,t=n,b)for(_=(a=y(y(h*y(0|c))+A))>y(3.1415927410125732)?y(a+y(-6.2831854820251465)):a,o=0,a=y(1e9);d[(u=o<<2)+s>>2]&&(l=(l=y(v(y(m[u+(s+32|0)>>2]-_))))>y(3.1415927410125732)?y(y(6.2831854820251465)-l):l)>2]=o,t=o,a=l),(0|(o=o+1|0))!=(0|e););if(d[(t<<2)+s>>2]=0,(0|(c=c+1|0))==(0|i))break}O=s- -64|0}(t,_+208|0,o,n,_+32|0),l=(0|i)>3,t=0;n=d[(_+32|0)+(t<<2)>>2],s=(_+112|0)+b(n,12)|0,f=y(m[s>>2]+m[e>>2]),m[_+64>>2]=f,g=y(m[s+4>>2]+m[e+4>>2]),m[_+68>>2]=g,C=y(m[s+8>>2]+m[e+8>>2]),m[_+72>>2]=C,l?(p=m[a>>2],A=m[a+4>>2],u=m[a+8>>2],d[_+28>>2]=0,m[_+24>>2]=-u,m[_+20>>2]=-A,m[_+16>>2]=-p,d[_+12>>2]=0,R=u,u=m[(_+80|0)+(n<<2)>>2],m[_+8>>2]=C-y(R*u),m[_+4>>2]=g-y(A*u),m[_>>2]=f-y(p*u),r[d[d[h>>2]+16>>2]](h,_+16|0,_,y(-u))):(u=m[a>>2],p=m[a+4>>2],A=m[a+8>>2],d[_+28>>2]=0,m[_+24>>2]=-A,m[_+20>>2]=-p,m[_+16>>2]=-u,r[d[d[h>>2]+16>>2]](h,_+16|0,_- -64|0,y(-m[(_+80|0)+(n<<2)>>2]))),(0|o)!=(0|(t=t+1|0)););}d[c>>2]=i}}}}O=_+384|0}(t+48|0,n+112|0,n+24|0,t+112|0,n- -64|0,n+8|0,n+48|0,n+44|0,n+40|0,i),O=n+160|0}function Li(e,t,i,n){t|=0,i|=0,n|=0;var o,a=0,l=0,c=0,h=0,_=0;if(O=o=O-96|0,(0|(a=d[8+(e|=0)>>2]))==d[e+12>>2]&&!((0|a)>=(0|(c=a?a<<1:1)))){if(c&&(d[7717]=d[7717]+1,h=0|r[d[6606]](c<<2,16),a=d[e+8>>2]),(0|a)>=1)for(;d[(_=l<<2)+h>>2]=d[d[e+16>>2]+_>>2],(0|(l=l+1|0))!=(0|a););(l=d[e+16>>2])&&(u[e+20|0]&&(l&&(d[7718]=d[7718]+1,r[d[6607]](l)),a=d[e+8>>2]),d[e+16>>2]=0),d[e+16>>2]=h,d[e+12>>2]=c,s[e+20|0]=1}d[d[e+16>>2]+(a<<2)>>2]=t,d[e+8>>2]=a+1,a=d[t+16>>2],d[o+40>>2]=d[t+12>>2],d[o+44>>2]=a,a=d[t+8>>2],d[o+32>>2]=d[t+4>>2],d[o+36>>2]=a,a=d[t+32>>2],d[o+56>>2]=d[t+28>>2],d[o+60>>2]=a,a=d[t+24>>2],d[o+48>>2]=d[t+20>>2],d[o+52>>2]=a,a=d[t+48>>2],d[o+72>>2]=d[t+44>>2],d[o+76>>2]=a,a=d[t+40>>2],d[o+64>>2]=d[t+36>>2],d[o+68>>2]=a,a=d[t+64>>2],d[o+88>>2]=d[t+60>>2],d[o+92>>2]=a,a=d[t+56>>2],d[o+80>>2]=d[t+52>>2],d[o+84>>2]=a,a=d[t+192>>2],r[d[d[a>>2]+8>>2]](a,o+32|0,o+16|0,o),a=d[e+68>>2],d[t+188>>2]=r[d[d[a>>2]+8>>2]](a,o+16|0,o,d[d[t+192>>2]+4>>2],t,i,n,d[e+24>>2],0),O=o+96|0}function ki(e,t,i){var n,o,a=0,l=0,c=0,h=0,_=0,p=0;if(O=n=O-16|0,o=ts(e),s[e+108|0]=1,d[e>>2]=13728,d[e+104>>2]=0,d[e+96>>2]=0,d[e+100>>2]=0,d[e+4>>2]=4,(0|i)<=0)d[e+96>>2]=i;else{if(d[7717]=d[7717]+1,a=0|r[d[6606]](i<<4,16),(0|(_=d[e+96>>2]))>=1)for(;h=(c=l<<4)+a|0,c=c+d[e+104>>2]|0,p=d[c+4>>2],d[h>>2]=d[c>>2],d[h+4>>2]=p,p=d[c+12>>2],d[h+8>>2]=d[c+8>>2],d[h+12>>2]=p,(0|_)!=(0|(l=l+1|0)););if((l=d[e+104>>2])&&(u[e+108|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+104>>2]=0),d[e+104>>2]=a,l=1,s[e+108|0]=1,d[e+100>>2]=i,c=d[n+12>>2],d[a+8>>2]=d[n+8>>2],d[a+12>>2]=c,c=d[n+4>>2],d[a>>2]=d[n>>2],d[a+4>>2]=c,1!=(0|i))for(;h=d[n+4>>2],a=d[e+104>>2]+(l<<4)|0,d[a>>2]=d[n>>2],d[a+4>>2]=h,c=d[n+12>>2],d[a+8>>2]=d[n+8>>2],d[a+12>>2]=c,(0|(l=l+1|0))!=(0|i););if(d[e+96>>2]=i,!((0|i)<1))for(l=0;c=d[t+4>>2],h=d[t>>2],_=d[t+8>>2],a=d[e+104>>2]+(l<<4)|0,d[a+12>>2]=0,d[a+8>>2]=_,d[a>>2]=h,d[a+4>>2]=c,t=t+16|0,(0|(l=l+1|0))!=(0|i););}Qn(o),O=n+16|0}function Vi(e,t,i,n,r,s,o){var a,l,c=y(0),h=y(0),_=0,u=0,p=y(0),f=y(0),g=y(0);if(a=O-16|0,d[n>>2]=2139095039,_=-8388609,d[r>>2]=-8388609,l=d[e+8>>2],c=y(-34028234663852886e22),!((0|l)<1)){for(_=0;u=d[e+16>>2]+(_<<4)|0,c=m[u>>2],h=m[u+4>>2],p=m[u+8>>2],f=y(y(y(y(c*m[t>>2])+y(h*m[t+4>>2]))+y(p*m[t+8>>2]))+m[t+48>>2]),g=y(y(y(y(c*m[t+16>>2])+y(h*m[t+20>>2]))+y(p*m[t+24>>2]))+m[t+52>>2]),h=y(y(y(y(c*m[t+32>>2])+y(h*m[t+36>>2]))+y(p*m[t+40>>2]))+m[t+56>>2]),(c=y(y(y(f*m[i>>2])+y(g*m[i+4>>2]))+y(h*m[i+8>>2])))>2]&&(m[n>>2]=c,d[s+12>>2]=0,m[s+8>>2]=h,m[s+4>>2]=g,m[s>>2]=f),c>m[r>>2]&&(m[r>>2]=c,d[o+12>>2]=0,m[o+8>>2]=h,m[o+4>>2]=g,m[o>>2]=f),(0|l)!=(0|(_=_+1|0)););_=d[r>>2],c=m[r>>2]}(h=m[n>>2])>c&&(d[n>>2]=_,m[r>>2]=h,e=d[s+12>>2],d[a+8>>2]=d[s+8>>2],d[a+12>>2]=e,e=d[s+4>>2],d[a>>2]=d[s>>2],d[a+4>>2]=e,e=d[o+12>>2],d[s+8>>2]=d[o+8>>2],d[s+12>>2]=e,e=d[o+4>>2],d[s>>2]=d[o>>2],d[s+4>>2]=e,e=d[a+12>>2],d[o+8>>2]=d[a+8>>2],d[o+12>>2]=e,e=d[a+4>>2],d[o>>2]=d[a>>2],d[o+4>>2]=e)}function Ui(e,t,i){var n,r,s,o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0);O=r=O-16|0,s=d[t+16>>2],o=d[t+12>>2],n=d[t+8>>2],t=d[n+12>>2],d[e+16>>2]=d[n+8>>2],d[e+20>>2]=t,t=d[n+20>>2],d[e+24>>2]=d[n+16>>2],d[e+28>>2]=t,t=d[n+20>>2],d[e+8>>2]=d[n+16>>2],d[e+12>>2]=t,t=d[n+12>>2],d[e>>2]=d[n+8>>2],d[e+4>>2]=t,(l=m[o+8>>2])<(_=m[e>>2])&&(m[e>>2]=l,_=l),(c=m[o+12>>2])<(u=m[e+4>>2])&&(m[e+4>>2]=c,u=c),(h=m[o+16>>2])<(f=m[e+8>>2])&&(m[e+8>>2]=h,f=h),(a=m[o+20>>2])<(g=m[e+12>>2])&&(m[e+12>>2]=a,g=a),(b=m[e+16>>2])>2]=l,b=l),(l=m[e+20>>2])>2]=c,l=c),(c=m[e+24>>2])>2]=h,c=h),(h=m[e+28>>2])>2]=a,h=a),(p=m[s+8>>2])<_&&(m[e>>2]=p),(_=m[s+12>>2])>2]=_),(u=m[s+16>>2])>2]=u),(a=m[s+20>>2])>2]=a),b>2]=p),l<_&&(m[e+20>>2]=_),c>2]=u),h>2]=a),d[r+12>>2]=0,m[r+8>>2]=i,m[r+4>>2]=i,m[r>>2]=i,function(e,t){m[e>>2]=m[e>>2]-m[t>>2],m[e+4>>2]=m[e+4>>2]-m[t+4>>2],m[e+8>>2]=m[e+8>>2]-m[t+8>>2],m[e+16>>2]=m[t>>2]+m[e+16>>2],m[e+20>>2]=m[t+4>>2]+m[e+20>>2],m[e+24>>2]=m[t+8>>2]+m[e+24>>2]}(e,r),O=r+16|0}function Gi(e,t,i){var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0);s=m[t+336>>2],_=m[t+44>>2],g=m[t+40>>2],b=m[t+36>>2],l=m[t+332>>2],v=m[t+28>>2],c=m[t+12>>2],p=m[t+404>>2],A=m[t+24>>2],h=m[t+8>>2],u=m[t+400>>2],C=m[t+20>>2],r=m[t+328>>2],S=m[t+4>>2],n=m[t+396>>2],d[e+12>>2]=0,f=y(y(1)/n),n=y(C*f),u=y(y(1)/u),o=y(A*u),p=y(y(1)/p),a=y(v*p),T=y(y(y(r*y(y(y(S*n)+y(h*o))+y(c*a)))+y(l*y(y(y(n*C)+y(o*A))+y(a*v))))+y(s*y(y(y(n*b)+y(o*g))+y(a*_)))),n=y(f*S),o=y(u*h),a=y(p*c),o=y(y(y(r*y(y(y(S*n)+y(h*o))+y(c*a)))+y(l*y(y(y(n*C)+y(o*A))+y(a*v))))+y(s*y(y(y(n*b)+y(o*g))+y(a*_)))),n=y(y(r*T)-y(l*o)),m[e+8>>2]=n,a=r,r=y(f*b),f=h,h=y(u*g),u=c,c=y(p*_),_=y(y(y(a*y(y(y(S*r)+y(f*h))+y(u*c)))+y(l*y(y(y(r*C)+y(h*A))+y(c*v))))+y(s*y(y(y(r*b)+y(h*g))+y(c*_)))),r=y(y(s*o)-y(a*_)),m[e+4>>2]=r,s=y(y(l*_)-y(s*T)),m[e>>2]=s,(l=y(y(n*n)+y(y(s*s)+y(r*r))))>y(i*i)&&(i=y(y(y(1)/y(x(l)))*i),m[e+8>>2]=n*i,m[e+4>>2]=r*i,m[e>>2]=s*i)}function ji(e,t){var i=0,n=0,o=0,a=0,l=0,c=0;if(u[e+164|0]){if((0|(i=d[e+128>>2]))==d[e+132>>2]&&!((0|i)>=(0|(n=i?i<<1:1)))){n&&(d[7717]=d[7717]+1,a=0|r[d[6606]](n<<2,16),i=d[e+128>>2]),o=d[e+136>>2];e:{t:{if((0|i)>=1)for(;;)if(d[(c=l<<2)+a>>2]=d[o+c>>2],(0|(l=l+1|0))==(0|i))break t;if(!o)break e}u[e+140|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+136>>2]=0,i=d[e+128>>2]}d[e+136>>2]=a,d[e+132>>2]=n,s[e+140|0]=1}return n=i<<2,i=d[e+136>>2],d[n+i>>2]=t,d[e+128>>2]=d[e+128>>2]+1,void(d[d[e+32>>2]+4>>2]=i)}if((0|(i=d[e+148>>2]))==d[e+152>>2]&&!((0|i)>=(0|(n=i?i<<1:1)))){n&&(d[7717]=d[7717]+1,a=0|r[d[6606]](n<<1,16),i=d[e+148>>2]),o=d[e+156>>2];e:{t:{if((0|i)>=1)for(;;)if(_[(c=l<<1)+a>>1]=p[o+c>>1],(0|(l=l+1|0))==(0|i))break t;if(!o)break e}u[e+160|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),i=d[e+148>>2]),d[e+156>>2]=0}d[e+156>>2]=a,d[e+152>>2]=n,s[e+160|0]=1}a=d[e+156>>2],_[a+(i<<1)>>1]=t,d[e+148>>2]=i+1,d[d[e+32>>2]+4>>2]=a}function Wi(e){var t,i=0;O=t=O-48|0,d[t+44>>2]=0,d[t+36>>2]=0,d[t+40>>2]=0,d[t+32>>2]=1065353216,r[d[d[e>>2]+68>>2]](t+16|0,e,t+32|0),m[e+32>>2]=m[t+16>>2]+m[e+12>>2],d[t+32>>2]=-1082130432,r[d[d[e>>2]+68>>2]](t,e,t+32|0),i=d[t+12>>2],d[t+24>>2]=d[t+8>>2],d[t+28>>2]=i,i=d[t+4>>2],d[t+16>>2]=d[t>>2],d[t+20>>2]=i,m[e+16>>2]=m[t+16>>2]-m[e+12>>2],d[t+32>>2]=0,d[t+36>>2]=0,d[t+40>>2]=0,d[t+44>>2]=0,d[t+36>>2]=1065353216,r[d[d[e>>2]+68>>2]](t+16|0,e,t+32|0),m[e+36>>2]=m[t+20>>2]+m[e+12>>2],d[t+36>>2]=-1082130432,r[d[d[e>>2]+68>>2]](t,e,t+32|0),i=d[t+12>>2],d[t+24>>2]=d[t+8>>2],d[t+28>>2]=i,i=d[t+4>>2],d[t+16>>2]=d[t>>2],d[t+20>>2]=i,m[e+20>>2]=m[t+20>>2]-m[e+12>>2],d[t+40>>2]=0,d[t+44>>2]=0,d[t+32>>2]=0,d[t+36>>2]=0,d[t+40>>2]=1065353216,r[d[d[e>>2]+68>>2]](t+16|0,e,t+32|0),m[e+40>>2]=m[t+24>>2]+m[e+12>>2],d[t+40>>2]=-1082130432,r[d[d[e>>2]+68>>2]](t,e,t+32|0),i=d[t+12>>2],d[t+24>>2]=d[t+8>>2],d[t+28>>2]=i,i=d[t+4>>2],d[t+16>>2]=d[t>>2],d[t+20>>2]=i,m[e+24>>2]=m[t+24>>2]-m[e+12>>2],O=t+48|0}function zi(e,t,i,n,r){var s=0,o=y(0),a=y(0),l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=0;a=m[i>>2];e:{if(m[t>>2]<=a){if(o=m[i+4>>2],!(m[t+4>>2]<=o^1|m[t+8>>2]<=m[i+8>>2]^1|m[t+16>>2]>=m[i+16>>2]^1|m[t+20>>2]>=m[i+20>>2]^1)&&(s=0,m[t+24>>2]>=m[i+24>>2]))break e}else o=m[i+4>>2];o=y(o-r),m[i+4>>2]=o,a=y(a-r),m[i>>2]=a,c=y(m[i+8>>2]-r),m[i+8>>2]=c,h=y(m[i+16>>2]+r),m[i+16>>2]=h,_=y(m[i+20>>2]+r),m[i+20>>2]=_,r=y(m[i+24>>2]+r),m[i+24>>2]=r,s=(u=m[n>>2])>y(0),m[(s<<4)+i>>2]=(s?h:a)+u,s=(a=m[n+4>>2])>y(0),m[(s?20:4)+i>>2]=(s?_:o)+a,n=(o=m[n+8>>2])>y(0),m[(n?24:8)+i>>2]=(n?r:c)+o;t:if(n=Xi(e,t))if((0|(l=d[e+8>>2]))>=0){if(!l)break t;for(;;){if(!(s=d[n+32>>2]))break t;if(n=s,(0|l)==(0|(p=p+1|0)))break}}else n=d[e>>2];else n=0;s=d[i+4>>2],d[t>>2]=d[i>>2],d[t+4>>2]=s,s=d[i+28>>2],d[t+24>>2]=d[i+24>>2],d[t+28>>2]=s,s=d[i+20>>2],d[t+16>>2]=d[i+16>>2],d[t+20>>2]=s,s=d[i+12>>2],d[t+8>>2]=d[i+8>>2],d[t+12>>2]=s,Tt(e,n,t),s=1}return s}function Hi(e,t,i){var n,r=0,s=y(0),o=y(0),a=y(0);O=n=O-80|0,d[e+240>>2]&&(m[e+176>>2]=m[e+64>>2]+m[e+176>>2],m[e+192>>2]=m[e+80>>2]+m[e+192>>2],m[e+180>>2]=m[e+68>>2]+m[e+180>>2],m[e+184>>2]=m[e+72>>2]+m[e+184>>2],m[e+196>>2]=m[e+84>>2]+m[e+196>>2],m[e+200>>2]=m[e+88>>2]+m[e+200>>2],(m[e+144>>2]!=y(0)|m[e+148>>2]!=y(0)|m[e+152>>2]!=y(0)|m[e+160>>2]!=y(0)||m[e+164>>2]!=y(0)||m[e+168>>2]!=y(0))&&(s=m[e+164>>2],o=m[e+168>>2],a=m[e+160>>2],d[n+12>>2]=0,m[n>>2]=a*i,m[n+8>>2]=o*i,m[n+4>>2]=s*i,mi(e,e+144|0,n,t,n+16|0),r=d[n+28>>2],d[e+8>>2]=d[n+24>>2],d[e+12>>2]=r,r=d[n+20>>2],d[e>>2]=d[n+16>>2],d[e+4>>2]=r,r=d[n+44>>2],d[e+24>>2]=d[n+40>>2],d[e+28>>2]=r,r=d[n+36>>2],d[e+16>>2]=d[n+32>>2],d[e+20>>2]=r,r=d[n+52>>2],d[e+32>>2]=d[n+48>>2],d[e+36>>2]=r,r=d[n+60>>2],d[e+40>>2]=d[n+56>>2],d[e+44>>2]=r,r=d[n+68>>2],d[e+48>>2]=d[n+64>>2],d[e+52>>2]=r,r=d[n+76>>2],d[e+56>>2]=d[n+72>>2],d[e+60>>2]=r)),O=n+80|0}function Xi(e,t){var i=0,n=0,s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0);if(d[e>>2]==(0|t))return d[e>>2]=0,0;n=d[t+32>>2],i=d[36+(((d[n+40>>2]!=(0|t))<<2)+n|0)>>2];e:{if(t=d[n+32>>2])for(d[36+((((0|n)==d[t+40>>2])<<2)+t|0)>>2]=i,d[i+32>>2]=t,(i=d[e+4>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+4>>2]=n;;){if(v=m[t>>2],n=d[t+36>>2],s=m[n>>2],i=d[t+40>>2],s=s<(_=m[i>>2])?s:_,m[t>>2]=s,_=m[t+16>>2],o=(o=m[n+16>>2])>(u=m[i+16>>2])?o:u,m[t+16>>2]=o,u=m[t+4>>2],a=(a=m[n+4>>2])<(p=m[i+4>>2])?a:p,m[t+4>>2]=a,p=m[t+20>>2],l=(l=m[n+20>>2])>(f=m[i+20>>2])?l:f,m[t+20>>2]=l,f=m[t+8>>2],c=(c=m[n+8>>2])<(g=m[i+8>>2])?c:g,m[t+8>>2]=c,g=m[t+24>>2],h=(h=m[n+24>>2])>(b=m[i+24>>2])?h:b,m[t+24>>2]=h,!(p!=l|_!=o|v!=s|u!=a)&&f==c&&g==h)break e;if(!(t=d[t+32>>2]))break}else d[e>>2]=i,d[i+32>>2]=0,(t=d[e+4>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+4>>2]=n;t=d[e>>2]}return t}function Yi(e,t,i,n,r){var s,o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0);O=s=O-128|0,o=d[e+28>>2],d[s+80>>2]=d[o+4>>2],d[s+84>>2]=d[o+20>>2],a=d[o+36>>2],d[s+92>>2]=0,d[s+88>>2]=a,d[s+96>>2]=d[o+8>>2],d[s+100>>2]=d[o+24>>2],a=d[o+40>>2],d[s+108>>2]=0,d[s+104>>2]=a,d[s+112>>2]=d[o+12>>2],d[s+116>>2]=d[o+28>>2],a=d[o+44>>2],d[s+124>>2]=0,d[s+120>>2]=a,e=d[e+32>>2],d[s+32>>2]=d[e+4>>2],d[s+36>>2]=d[e+20>>2],a=d[e+36>>2],d[s+44>>2]=0,d[s+40>>2]=a,d[s+48>>2]=d[e+8>>2],d[s+52>>2]=d[e+24>>2],a=d[e+40>>2],d[s+60>>2]=0,d[s+56>>2]=a,d[s+64>>2]=d[e+12>>2],d[s+68>>2]=d[e+28>>2],a=d[e+44>>2],d[s+76>>2]=0,d[s+72>>2]=a,l=m[o+52>>2],c=m[o+56>>2],h=m[o+60>>2],_=m[n>>2],u=m[n+4>>2],p=m[n+8>>2],d[s+28>>2]=0,m[s+24>>2]=p-h,m[s+20>>2]=u-c,m[s+16>>2]=_-l,l=m[e+52>>2],c=m[e+56>>2],h=m[e+60>>2],_=m[r>>2],u=m[r+4>>2],p=m[r+8>>2],d[s+12>>2]=0,m[s+8>>2]=p-h,m[s+4>>2]=u-c,m[s>>2]=_-l,ai(t,s+80|0,s+32|0,s+16|0,s,i,o+396|0,m[o+344>>2],e+396|0,m[e+344>>2]),O=s+128|0}function Qi(e,t,i,n){var r,s,o,a,l=0,c=0,h=0,_=0,u=0,p=0,f=0;for(O=r=O-16|0,h=d[e+12>>2],a=d[8+(_=h+((i+n|0)/2<<4)|0)>>2],s=d[_+4>>2],o=d[_>>2],_=i,u=n;;){e:{if(!((0|(c=d[4+(l=(_<<4)+h|0)>>2]))<(0|s))){if((0|c)!=(0|s))break e;if(!((0|(c=d[l>>2]))<(0|o))&&(0|c)!=(0|o)|d[l+8>>2]>=(0|a))break e}_=_+1|0;continue}for(;;){e:{if(!((0|s)<(0|(p=d[4+(c=(f=u<<4)+h|0)>>2])))){if((0|s)!=(0|p))break e;if(!((0|o)<(0|(p=d[c>>2])))&&(0|o)!=(0|p)|(0|a)>=d[c+8>>2])break e}u=u+-1|0;continue}break}if((0|_)<=(0|u)&&(h=d[l+12>>2],d[r+8>>2]=d[l+8>>2],d[r+12>>2]=h,h=d[l+4>>2],d[r>>2]=d[l>>2],d[r+4>>2]=h,h=d[c+4>>2],d[l>>2]=d[c>>2],d[l+4>>2]=h,h=d[c+12>>2],d[l+8>>2]=d[c+8>>2],d[l+12>>2]=h,h=d[r+4>>2],l=d[e+12>>2]+f|0,d[l>>2]=d[r>>2],d[l+4>>2]=h,c=d[r+12>>2],d[l+8>>2]=d[r+8>>2],d[l+12>>2]=c,u=u+-1|0,_=_+1|0),!((0|_)<=(0|u)))break;h=d[e+12>>2]}(0|u)>(0|i)&&Qi(e,t,i,u),(0|_)<(0|n)&&Qi(e,t,_,n),O=r+16|0}function qi(e){var t=0;return 1&s[30632]||mc(30632)&&(1&s[26880]||mc(26880)&&(1&s[26932]||mc(26932)&&(d[6722]=0,d[6723]=0,d[6721]=1065353216,d[6724]=0,d[6725]=0,d[6727]=0,d[6728]=0,d[6726]=1065353216,d[6729]=0,d[6730]=0,d[6731]=1065353216,d[6732]=0,uh(26932)),d[6716]=0,d[6717]=0,d[6718]=0,d[6719]=0,t=d[6724],d[6706]=d[6723],d[6707]=t,t=d[6722],d[6704]=d[6721],d[6705]=t,t=d[6726],d[6708]=d[6725],d[6709]=t,t=d[6728],d[6710]=d[6727],d[6711]=t,t=d[6730],d[6712]=d[6729],d[6713]=t,t=d[6732],d[6714]=d[6731],d[6715]=t,uh(26880)),t=d[6707],d[7644]=d[6706],d[7645]=t,t=d[6705],d[7642]=d[6704],d[7643]=t,t=d[6709],d[7646]=d[6708],d[7647]=t,t=d[6711],d[7648]=d[6710],d[7649]=t,t=d[6713],d[7650]=d[6712],d[7651]=t,t=d[6715],d[7652]=d[6714],d[7653]=t,t=d[6717],d[7654]=d[6716],d[7655]=t,t=d[6719],d[7656]=d[6718],d[7657]=t,uh(30632)),(t=d[e+8>>2])?t+4|0:(e=d[e>>2])?e+60|0:30568}function Ki(e){var t,i,n=y(0),r=y(0);if(l(e),(t=2147483647&(i=c(0)))>>>0>=1065353216)return y(1065353216==(0|t)?(0|i)<0?3.141592502593994:0:y(0)/y(e-e));e:{if(t>>>0<=1056964607){if(n=y(1.570796251296997),t>>>0<847249409)break e;return n=y(e*e),y(y(y(y(7.549789415861596e-8)-y(y(y(n*y(y(n*y(y(n*y(-.008656363002955914))+y(-.04274342209100723)))+y(.16666586697101593)))/y(y(n*y(-.7066296339035034))+y(1)))*e))-e)+y(1.570796251296997))}if((0|i)<=-1)return e=y(y(e+y(1))*y(.5)),n=y(x(e)),e=y(y(1.570796251296997)-y(n+y(y(n*y(y(e*y(y(e*y(y(e*y(-.008656363002955914))+y(-.04274342209100723)))+y(.16666586697101593)))/y(y(e*y(-.7066296339035034))+y(1))))+y(-7.549789415861596e-8)))),y(e+e);e=y(y(y(1)-e)*y(.5)),a(0,-4096&(l(r=y(x(e))),c(0))),n=h(),e=y(y(y(y(y(e*y(y(e*y(y(e*y(-.008656363002955914))+y(-.04274342209100723)))+y(.16666586697101593)))/y(y(e*y(-.7066296339035034))+y(1)))*r)+y(y(e-y(n*n))/y(r+n)))+n),n=y(e+e)}return n}function Zi(e,t,i,n,r,o){var a=0,l=0,c=0;e:if(u[n+55|0]!=(0|t)){if(l=d[4408+(a=r<<2)>>2],y(y(y(y(m[n>>2]*m[i+16>>2])+y(m[n+4>>2]*m[i+20>>2]))+y(m[n+8>>2]*m[i+24>>2]))-m[n+16>>2])>2],d[e+a>>2],i,0)))break e;return d[e+32>>2]=n,s[e+52|0]=r,s[52+(n+r|0)|0]=0,d[32+((r<<2)+n|0)>>2]=e,(t=d[o>>2])?(d[t+36>>2]=e,s[t+53|0]=2,d[e+40>>2]=t,s[e+54|0]=1):d[o+4>>2]=e,d[o>>2]=e,d[o+8>>2]=d[o+8>>2]+1,1}s[n+55|0]=t,Zi(e,t,i,d[32+((l<<2)+n|0)>>2],u[52+(n+l|0)|0],o)&&(r=t,t=d[a+4420>>2],Zi(e,r,i,d[32+((t<<2)+n|0)>>2],u[52+(t+n|0)|0],o)&&((t=d[n+48>>2])&&(d[t+44>>2]=d[n+44>>2]),(t=d[n+44>>2])&&(d[t+48>>2]=d[n+48>>2]),d[e+9280>>2]==(0|n)&&(d[e+9280>>2]=d[n+48>>2]),d[(t=e+9284|0)>>2]=d[t>>2]+-1,d[n+44>>2]=0,d[n+48>>2]=d[e+9288>>2],(t=d[e+9288>>2])&&(d[t+44>>2]=n),d[e+9288>>2]=n,c=1,d[(e=e+9292|0)>>2]=d[e>>2]+1))}return c}function $i(e,t){var i=0,n=0,o=0,a=0;if(et(e,t),d[e>>2]=20532,d[7717]=d[7717]+1,i=0|r[d[6606]](8,16),d[i>>2]=20620,s[i+4|0]=0,d[e+92>>2]=i,d[7717]=d[7717]+1,i=0|r[d[6606]](8,16),d[i>>2]=20700,s[i+4|0]=0,d[e+96>>2]=i,d[7717]=d[7717]+1,i=0|r[d[6606]](8,16),d[i>>2]=20700,d[e+100>>2]=i,s[i+4|0]=1,d[7717]=d[7717]+1,i=0|r[d[6606]](8,16),d[i>>2]=20780,s[i+4|0]=0,d[e+104>>2]=i,d[7717]=d[7717]+1,i=0|r[d[6606]](8,16),d[i>>2]=20864,d[e+108>>2]=i,s[i+4|0]=1,u[e+20|0]&&!(!(i=d[e+16>>2])|d[i>>2]>155)){if((i=d[i+16>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),(i=d[e+16>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[7717]=d[7717]+1,n=0|r[d[6606]](20,16),t=d[t+12>>2],d[n+4>>2]=t,d[n>>2]=156,d[7717]=d[7717]+1,i=0|r[d[6606]](b(t,156),16),d[n+12>>2]=i,d[n+16>>2]=i,t=d[n+4>>2],d[n+8>>2]=t,o=t+-1|0)for(a=d[n>>2];t=i+a|0,d[i>>2]=t,i=t,o=o+-1|0;);else t=i;d[t>>2]=0,d[e+16>>2]=n}}function Ji(e,t){var i=0,n=0,r=0,s=0,o=0,_=0,d=0;if(l(t),!(r=(o=c(0))<<1)|(2147483647&o)>>>0>2139095040||(l(e),255==(0|(n=(d=c(0))>>>23&255))))return e=y(e*t),y(e/e);if((i=d<<1)>>>0>r>>>0){if(_=o>>>23&255,n)i=8388607&d|8388608;else{if(n=0,(0|(i=d<<9))>=0)for(;n=n+-1|0,(0|(i<<=1))>-1;);i=d<<1-n}if(r=i,_)o=8388607&o|8388608;else{if(_=0,(0|(s=o<<9))>=0)for(;_=_+-1|0,(0|(s<<=1))>-1;);o<<=1-_}if(s=(0|(r=r-o|0))>-1,(0|n)>(0|_)){for(;;){if(1&s&&!(i=r))return y(e*y(0));if(s=(0|(r=(i<<=1)-o|0))>-1,!((0|(n=n+-1|0))>(0|_)))break}n=_}if(s&&!(i=r))return y(e*y(0));if(i>>>0>8388607)s=i;else for(;n=n+-1|0,r=i>>>0<4194304,i=s=i<<1,r;);return a(0,(i=-2147483648&d)|((0|n)>=1?s+-8388608|n<<23:s>>>1-n|0)),h()}return(0|i)==(0|r)?y(e*y(0)):e}function en(e,t,i){var n,o,a,l,c,h=0,_=0,p=0,f=0,m=0;if(O=n=O-32|0,h=d[e+12>>2],c=u[e+28|0],l=d[(a=c?i:t)+4>>2],(0|h)<(0|(o=d[l+16>>2]))){if(d[e+16>>2]<(0|o)){if(o?(d[7717]=d[7717]+1,f=0|r[d[6606]](o<<2,16),_=d[e+12>>2]):_=h,(0|_)>=1)for(;d[(m=p<<2)+f>>2]=d[d[e+20>>2]+m>>2],(0|_)!=(0|(p=p+1|0)););(_=d[e+20>>2])&&(u[e+24|0]&&_&&(d[7718]=d[7718]+1,r[d[6607]](_)),d[e+20>>2]=0),d[e+20>>2]=f,d[e+16>>2]=o,s[e+24|0]=1}for(;d[d[e+20>>2]+(h<<2)>>2]=0,(0|o)!=(0|(h=h+1|0)););}if(d[e+12>>2]=o,(0|o)>=1)for(t=c?t:i,h=0;d[l+64>>2]?d[d[e+20>>2]+(h<<2)>>2]=0:(i=d[a+12>>2],_=d[a+8>>2],d[n+12>>2]=d[64+(d[l+24>>2]+b(h,80)|0)>>2],d[n+16>>2]=_,d[n+20>>2]=i,d[n+28>>2]=h,d[n+24>>2]=-1,d[n+8>>2]=a,i=d[e+4>>2],i=0|r[d[d[i>>2]+8>>2]](i,n+8|0,t,d[e+32>>2]),d[d[e+20>>2]+(h<<2)>>2]=i),(0|o)!=(0|(h=h+1|0)););O=n+32|0}function tn(e,t){var i,n=0,r=0,s=0,o=y(0);if(l(t),!((i=2147483647&(n=c(0)))>>>0<=2139095040&&(l(e),(r=2147483647&(s=c(0)))>>>0<2139095041)))return y(e+t);if(1065353216==(0|n))return vn(e);n=s>>>31|0|(s=n>>>30&2);e:{t:{i:{n:{if(!r){r:switch(n-2|0){case 0:break n;case 1:break r;default:break i}return y(-3.1415927410125732)}if(2139095040!=(0|i)){if(!i|!(i+218103808>>>0>=r>>>0&&2139095040!=(0|r)))break e;switch(r+218103808>>>0>>0&&(o=y(0),s)||(o=vn(y(v(y(e/t))))),e=o,0|n){case 1:return y(-e);case 2:return y(y(3.1415927410125732)-y(e+y(8.742277657347586e-8)));case 0:break i}return y(y(e+y(8.742277657347586e-8))+y(-3.1415927410125732))}if(2139095040==(0|r))break t;return m[25936+(n<<2)>>2]}e=y(3.1415927410125732)}return e}return m[25920+(n<<2)>>2]}return a(0,-2147483648&(l(e),c(0))|1070141403),h()}function nn(e,t,i,n,o,a){var l,c=0,h=0,_=0,p=0;O=l=O-96|0;e:if(o){t:if(!((0|(c=d[e+268>>2]))<1)){for(h=d[e+276>>2],o=0;;){if(d[h+(o<<2)>>2]!=(0|i)){if((0|c)!=(0|(o=o+1|0)))continue;break t}break}if((0|o)!=(0|c))break e}if(d[e+272>>2]==(0|c)&&!((0|c)>=(0|(h=c?c<<1:1)))){if(h&&(d[7717]=d[7717]+1,_=0|r[d[6606]](h<<2,16),c=d[e+268>>2]),(0|c)>=1)for(o=0;d[(p=o<<2)+_>>2]=d[d[e+276>>2]+p>>2],(0|c)!=(0|(o=o+1|0)););(o=d[e+276>>2])&&(u[e+280|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),c=d[e+268>>2]),d[e+276>>2]=0),d[e+276>>2]=_,d[e+272>>2]=h,s[e+280|0]=1}d[d[e+276>>2]+(c<<2)>>2]=i,d[e+268>>2]=c+1}o=d[e+720>>2],d[l+20>>2]=i,t=o+b(t,104)|0,d[l>>2]=t,i=d[n+12>>2],d[l+12>>2]=d[n+8>>2],d[l+16>>2]=i,i=d[n+4>>2],d[l+4>>2]=d[n>>2],d[l+8>>2]=i,s[t+100|0]=1|u[t+100|0],m[l+24>>2]=a,Kr(e+788|0,l),O=l+96|0}function rn(e,t,i){var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0);u=m[e+220>>2],p=m[e+212>>2],f=m[e+216>>2],g=m[e+204>>2],b=m[e+196>>2],v=m[e+200>>2],A=m[e+188>>2],C=m[e+184>>2],S=m[e+180>>2],o=m[t+4>>2],a=m[t+8>>2],c=m[t>>2],n=m[i+8>>2],s=m[i+4>>2],l=m[i>>2],r=m[e+128>>2],h=y(l*r),m[e+244>>2]=h+m[e+244>>2],_=y(r*s),m[e+248>>2]=_+m[e+248>>2],r=y(r*n),m[e+252>>2]=r+m[e+252>>2],m[e+316>>2]=h+m[e+316>>2],m[e+320>>2]=_+m[e+320>>2],m[e+324>>2]=r+m[e+324>>2],r=y(y(n*o)-y(s*a)),n=y(y(l*a)-y(n*c)),s=y(y(s*c)-y(l*o)),o=y(y(y(S*r)+y(C*n))+y(A*s)),m[e+260>>2]=o+m[e+260>>2],a=y(y(y(r*b)+y(n*v))+y(s*g)),m[e+264>>2]=a+m[e+264>>2],n=y(y(y(r*p)+y(n*f))+y(s*u)),m[e+268>>2]=n+m[e+268>>2],m[e+332>>2]=o+m[e+332>>2],m[e+336>>2]=a+m[e+336>>2],m[e+340>>2]=n+m[e+340>>2],d[e+308>>2]=d[e+308>>2]+1}function sn(e,t,i,n){var s=0,o=0,a=0,l=0,c=0,h=0,u=0,f=0,m=0,g=0;e:if(o=d[68+((t<<2)+e|0)>>2],a=p[(c=(i=o+(u=i<<2)|0)-4|0)>>1],!(p[i>>1]>=a>>>0))for(u=(f=t<<1)+((l=d[e+60>>2])+(p[2+(o+u|0)>>1]<<6)|0)|0,g=1<<(m=1<>1],1&a?t=54+(((t<<6)+l|0)+f|0)|0:(s=(a=(p[i+2>>1]<<6)+l|0)+(o=m<<1)|0,h=(h=o)+(o=(t<<6)+l|0)|0,p[s+54>>1]>1]|p[h+54>>1]>1]||(h=(s=g<<1)+a|0,s=s+o|0,p[h+54>>1]>1]|p[s+54>>1]>1]||(s=d[e+92>>2],r[d[d[s>>2]+12>>2]](s,a,o,n),(s=d[e+96>>2])&&r[d[d[s>>2]+12>>2]](s,a,o,n))),t=48+(((t<<6)+l|0)+f|0)|0),_[t>>1]=p[t>>1]+1,_[u+54>>1]=p[u+54>>1]+-1,t=p[i>>1]|p[i+2>>1]<<16,l=p[c>>1]|p[c+2>>1]<<16,_[i>>1]=l,_[i+2>>1]=l>>>16,_[c>>1]=t,_[c+2>>1]=t>>>16,i=i+-4|0,a=p[(c=c+-4|0)>>1],p[i>>1]>=a>>>0)break e;l=d[e+60>>2]}}function on(e,t,i){var n=0,s=0,o=0,a=0,l=0,c=0,h=0,u=0,f=0,m=0,g=0,b=0;e:if(i=d[68+((t<<2)+e|0)>>2]+(i<<2)|0,s=p[i+6>>1])for(h=(l=t<<1)+(o=54+(a=d[e+60>>2]+(p[i+2>>1]<<6)|0)|0)|0,f=(c=(t=1<>1];;){if((65535&t)>>>0<(o=p[i+4>>1])>>>0)break e;if(t=d[e+60>>2],1&o?t=54+(((s<<6)+t|0)+l|0)|0:(n=c+(o=(s<<6)+t|0)|0,p[m>>1]>1]|p[n+54>>1]>1]||(n=o+a|0,p[b>>1]>1]|p[n+54>>1]>1]||(n=d[e+92>>2],u=(p[i+2>>1]<<6)+t|0,r[d[d[n>>2]+8>>2]](n,u,o),(n=d[e+96>>2])&&r[d[d[n>>2]+8>>2]](n,u,o))),t=48+(((s<<6)+t|0)+l|0)|0),_[t>>1]=p[t>>1]+-1,_[h>>1]=p[h>>1]+1,s=p[i+4>>1]|p[i+6>>1]<<16,t=p[i>>1]|p[i+2>>1]<<16,_[i+4>>1]=t,_[i+6>>1]=t>>>16,_[i>>1]=s,_[i+2>>1]=s>>>16,s=i,i=i+4|0,!(s=p[s+10>>1]))break}}function an(e){var t=0,i=y(0),n=0,r=y(0),s=0,o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=0,u=0;if(yr(21101),i=m[e+300>>2],c=m[e+304>>2],a=m[e+312>>2],((l=m[e+308>>2])!=y(0)||(r=y(0),a>y(0)))&&(r=function(e){var t,i=0,n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=0,c=0,h=y(0),_=y(0),u=y(0),p=0,f=y(0),g=y(0),v=y(0);if(d[e+712>>2]<1)return y(0);if((0|(t=d[e+752>>2]))>=1)for(i=d[e+720>>2],s=m[i+8>>2],o=m[i+16>>2],a=m[i+12>>2],p=d[e+760>>2],e=0;f=n,i=b(e,44)+p|0,l=d[i+8>>2],c=d[i+12>>2],n=y(m[c+8>>2]-s),i=d[i+16>>2],h=y(m[i+12>>2]-a),r=y(m[c+12>>2]-a),_=y(m[i+8>>2]-s),g=y(y(m[l+16>>2]-o)*y(y(n*h)-y(r*_))),v=r,r=y(m[i+16>>2]-o),u=y(m[c+16>>2]-o),n=y(f+y(g+y(y(y(m[l+8>>2]-s)*y(y(v*r)-y(u*h)))+y(y(m[l+12>>2]-a)*y(y(u*_)-y(n*r)))))),(0|t)!=(0|(e=e+1|0)););return y(n/y(6))}(e),h=y(a*y(m[e+476>>2]-r)),r=y(l*y(y(1)/y(v(r))))),(0|(o=d[e+712>>2]))>=1)for(_=c>y(0)|i>y(0),u=e+1212|0;t=d[e+720>>2]+b(n,104)|0,m[t+88>>2]>y(0)&&(_&&Ke(e,u,n),l!=y(0)&&(i=y(r*m[t+92>>2]),m[t+56>>2]=y(m[t+72>>2]*i)+m[t+56>>2],m[t+60>>2]=y(i*m[t+76>>2])+m[t+60>>2],m[(s=t- -64|0)>>2]=y(i*m[t+80>>2])+m[s>>2]),a>y(0)&&(i=y(h*m[t+92>>2]),m[t+56>>2]=y(m[t+72>>2]*i)+m[t+56>>2],m[t+60>>2]=y(i*m[t+76>>2])+m[t+60>>2],m[(s=t- -64|0)>>2]=y(i*m[t+80>>2])+m[s>>2])),(0|o)!=(0|(n=n+1|0)););if((0|(n=d[e+752>>2]))>=1)for(o=e+1212|0,t=0;we(e,o,t),(0|n)!=(0|(t=t+1|0)););As()}function ln(e,t,i,n){var r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0);if(h=m[e>>2],o=m[t>>2],s=y(h-o),r=y(s*s),_=m[e+4>>2],s=m[t+4>>2],a=y(_-s),r=y(r+y(a*a)),u=m[e+8>>2],a=m[t+8>>2],l=y(u-a),c=y(r+y(l*l)),p=m[e+12>>2],l=m[t+12>>2],r=y(p-l),c=y(c+y(r*r)),r=y(h+o),f=y(r*r),r=y(_+s),f=y(f+y(r*r)),r=y(u+a),f=y(f+y(r*r)),r=y(p+l),c>2]=r+r,d[i+12>>2]=0,r=y(y(h*s)+y(y(y(a*p)-y(u*l))-y(_*o))),m[i+8>>2]=r,c=y(y(u*o)+y(y(y(s*p)-y(_*l))-y(h*a))),m[i+4>>2]=c,o=y(y(_*a)+y(y(y(o*p)-y(h*l))-y(u*s))),m[i>>2]=o,(s=y(y(y(o*o)+y(c*c))+y(r*r)))>2]=0,d[i+12>>2]=0,d[i>>2]=1065353216,void(d[i+4>>2]=0);s=y(y(1)/y(x(s))),m[i+8>>2]=r*s,m[i+4>>2]=c*s,m[i>>2]=o*s}function cn(e,t,i){var n=0,s=0,o=0,a=0,l=0,c=0,h=0,u=0,f=0,m=0,g=0,b=0,y=0;e:if(i=d[68+((t<<2)+e|0)>>2]+(i<<2)|0,s=p[(o=i+-4|0)>>1],!(p[i>>1]>=s>>>0))for(m=(h=t<<1)+(n=48+(l=(a=d[e+60>>2])+(p[i+2>>1]<<6)|0)|0)|0,g=n+(u=(t=1<>1],1&s?(n=(s=(t<<6)+a|0)+u|0,p[b>>1]>1]|p[n+54>>1]>1]||(n=s+f|0,p[c>>1]>1]|p[n+54>>1]>1]||(n=d[e+92>>2],r[d[d[n>>2]+8>>2]](n,l,s),(n=d[e+96>>2])&&r[d[d[n>>2]+8>>2]](n,l,s))),t=54+(((t<<6)+a|0)+h|0)|0):t=48+(((t<<6)+a|0)+h|0)|0,_[t>>1]=p[t>>1]+1,_[m>>1]=p[m>>1]+-1,t=p[i>>1]|p[i+2>>1]<<16,a=p[o>>1]|p[o+2>>1]<<16,_[i>>1]=a,_[i+2>>1]=a>>>16,_[o>>1]=t,_[o+2>>1]=t>>>16,i=i+-4|0,s=p[(o=o+-4|0)>>1],p[i>>1]>=s>>>0)break e;a=d[e+60>>2]}}function hn(e,t,i,n){var s=0,o=0,a=0,l=0,c=0,h=0,u=0,f=0,m=0;e:if(i=d[68+((t<<2)+e|0)>>2]+(i<<2)|0,o=p[i+6>>1])for(u=(h=t<<1)+(d[e+60>>2]+(p[i+2>>1]<<6)|0)|0,m=1<<(f=1<>1];;){if((65535&t)>>>0<(a=p[i+4>>1])>>>0)break e;if(t=d[e+60>>2],1&a?(l=(a=(p[i+2>>1]<<6)+t|0)+(s=f<<1)|0,s=s+(c=(o<<6)+t|0)|0,p[l+54>>1]>1]|p[s+54>>1]>1]||(l=(s=m<<1)+a|0,s=s+c|0,p[l+54>>1]>1]|p[s+54>>1]>1]||(s=d[e+92>>2],r[d[d[s>>2]+12>>2]](s,a,c,n),(s=d[e+96>>2])&&r[d[d[s>>2]+12>>2]](s,a,c,n))),t=54+(((o<<6)+t|0)+h|0)|0):t=48+(((o<<6)+t|0)+h|0)|0,_[t>>1]=p[t>>1]+-1,_[u+48>>1]=p[u+48>>1]+1,o=p[i+4>>1]|p[i+6>>1]<<16,t=p[i>>1]|p[i+2>>1]<<16,_[i+4>>1]=t,_[i+6>>1]=t>>>16,_[i>>1]=o,_[i+2>>1]=o>>>16,o=i,i=i+4|0,!(o=p[o+10>>1]))break}}function _n(e,t,i,n,r,s,o){var a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),d=y(0),u=y(0),p=y(0);return a=m[n>>2],h=m[n+4>>2],_=m[n+8>>2],u=y(y(y(m[i>>2]*a)+y(m[i+4>>2]*h))+y(m[i+8>>2]*_)),l=y(y(y(a*m[e>>2])+y(h*m[e+16>>2]))+y(_*m[e+32>>2])),c=m[r+80>>2],d=y(l*(l>2])+y(h*m[e+20>>2]))+y(_*m[e+36>>2])),c=m[r+84>>2],d=y(d+y(l*(l>2])+y(h*m[e+24>>2]))+y(_*m[e+40>>2])),c=m[r+88>>2],d=(l=y(d+y(l*(l(c=m[r+96>>2])?l:c,l=y(y(y(a*m[t>>2])+y(h*m[t+16>>2]))+y(_*m[t+32>>2])),c=m[s+80>>2],p=y(l*(l>2])+y(h*m[t+20>>2]))+y(_*m[t+36>>2])),c=m[s+84>>2],a=y(y(y(a*m[t+8>>2])+y(h*m[t+24>>2]))+y(_*m[t+40>>2])),h=m[s+88>>2],a=y(y(p+y(l*(l>2],a=y(d+(a>h?a:h)),((h=y(u+a))<(a=y(a-u))?h:a)>o^1}function dn(e,t,i,n,s,o){var a=y(0),h=y(0),_=y(0),u=y(0),p=0,f=0,g=0,b=0,v=0,A=y(0),C=y(0),S=y(0),T=y(0),E=y(0);r[d[d[e>>2]+8>>2]](e,t,s,o),a=m[i+8>>2],h=m[i+4>>2],u=m[s+8>>2],t=d[s+8>>2],A=m[s+4>>2],p=d[s+4>>2],C=m[s>>2],f=d[s>>2],S=m[o+8>>2],g=d[o+8>>2],T=m[o+4>>2],b=d[o+4>>2],E=m[o>>2],v=d[o>>2],(_=m[i>>2])>y(0)?(l(y(_+E)),v=c(0)):(l(y(_+C)),f=c(0)),h>y(0)?(l(y(h+T)),b=c(0)):(l(y(h+A)),p=c(0)),a>y(0)?(l(y(a+S)),g=c(0)):(l(y(a+u)),t=c(0)),a=m[n+8>>2],h=m[n>>2],_=m[n+4>>2],u=y(r[d[d[e>>2]+16>>2]](e)),d[s+12>>2]=0,d[s+8>>2]=t,d[s+4>>2]=p,d[s>>2]=f,d[o+12>>2]=0,d[o+8>>2]=g,d[o+4>>2]=b,d[o>>2]=v,a=y(u*y(x(y(y(y(h*h)+y(_*_))+y(a*a))))),m[s>>2]=m[s>>2]-a,m[s+4>>2]=m[s+4>>2]-a,m[s+8>>2]=m[s+8>>2]-a,m[o>>2]=a+m[o>>2],m[o+4>>2]=a+m[o+4>>2],m[o+8>>2]=a+m[o+8>>2]}function un(e,t,i,n){var s,o,a=0,l=0;O=s=O+-64|0,a=(o=b(t,80))+d[e+24>>2]|0,l=d[(t=i)+4>>2],d[a>>2]=d[t>>2],d[a+4>>2]=l,l=d[t+12>>2],d[a+8>>2]=d[t+8>>2],d[a+12>>2]=l,l=d[t+28>>2],d[a+24>>2]=d[t+24>>2],d[a+28>>2]=l,l=d[t+20>>2],d[a+16>>2]=d[t+16>>2],d[a+20>>2]=l,l=d[t+44>>2],d[a+40>>2]=d[t+40>>2],d[a+44>>2]=l,l=d[t+36>>2],d[a+32>>2]=d[t+32>>2],d[a+36>>2]=l,l=d[t+60>>2],d[a+56>>2]=d[t+56>>2],d[a+60>>2]=l,l=d[t+52>>2],d[a+48>>2]=d[t+48>>2],d[a+52>>2]=l,d[e+64>>2]&&(t=d[64+(d[e+24>>2]+o|0)>>2],r[d[d[t>>2]+8>>2]](t,i,s+48|0,s+32|0),i=d[(t=s)+60>>2],a=d[t+56>>2],d[t+8>>2]=a,d[t+12>>2]=i,i=d[t+44>>2],d[t+24>>2]=d[t+40>>2],d[t+28>>2]=i,i=d[t+36>>2],d[t+16>>2]=d[t+32>>2],d[t+20>>2]=i,i=d[t+52>>2],d[t>>2]=d[t+48>>2],d[t+4>>2]=i,Qr(d[e+64>>2],d[76+(d[e+24>>2]+o|0)>>2],t)),n&&r[d[d[e>>2]+68>>2]](e),O=s- -64|0}function pn(e,t,i){var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),d=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0);return n=m[e+552>>2],r=m[t>>2],s=m[e+568>>2],o=m[t+4>>2],a=m[e+584>>2],l=m[t+8>>2],h=m[e+620>>2],_=m[e+636>>2],c=m[e+652>>2],d=y(y(y(h*m[i>>2])+y(_*m[i+4>>2]))+y(c*m[i+8>>2])),u=m[t+16>>2],p=m[t+20>>2],f=m[t+24>>2],g=y(y(y(h*m[i+16>>2])+y(_*m[i+20>>2]))+y(c*m[i+24>>2])),b=y(y(y(y(y(n*r)+y(s*o))+y(a*l))*d)+y(y(y(y(n*u)+y(s*p))+y(a*f))*g)),v=n,n=m[t+32>>2],A=s,s=m[t+36>>2],C=a,a=m[t+40>>2],c=y(y(y(h*m[i+32>>2])+y(_*m[i+36>>2]))+y(c*m[i+40>>2])),h=r,r=m[e+556>>2],_=o,o=m[e+572>>2],S=l,l=m[e+588>>2],y(tn(y(b+y(y(y(y(v*n)+y(A*s))+y(C*a))*c)),y(y(y(y(y(y(h*r)+y(_*o))+y(S*l))*d)+y(y(y(y(u*r)+y(p*o))+y(f*l))*g))+y(y(y(y(n*r)+y(s*o))+y(a*l))*c)))*m[e+732>>2])}function fn(e){var t=0,i=0,n=0,o=0,a=0,l=0;if((t=d[e+16>>2])&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+16>>2]=0,s[e+20|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,(t=d[e+40>>2])&&(u[e+44|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+40>>2]=0),d[e+40>>2]=0,s[e+44|0]=1,d[e+32>>2]=0,d[e+36>>2]=0,(t=d[e+60>>2])&&(u[e- -64|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+60>>2]=0),t=0,d[e+60>>2]=0,s[e- -64|0]=1,d[e+52>>2]=0,d[e+56>>2]=0,d[e+12>>2]<=1){if(d[7717]=d[7717]+1,o=0|r[d[6606]](24,16),(0|(a=d[e+8>>2]))>=1)for(;n=(i=b(t,12))+d[e+16>>2]|0,l=d[n+4>>2],d[(i=i+o|0)>>2]=d[n>>2],d[i+4>>2]=l,d[i+8>>2]=d[n+8>>2],(0|a)!=(0|(t=t+1|0)););(t=d[e+16>>2])&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+16>>2]=o,s[e+20|0]=1,d[e+12>>2]=2}si(e)}function mn(e){var t,i=0,n=0,o=0,a=0,l=0;if(d[7717]=d[7717]+1,t=0|r[d[6606]](20,16),d[(i=t)>>2]=0,d[i+4>>2]=0,d[i+16>>2]=0,d[i+8>>2]=0,d[i+12>>2]=0,d[e+872>>2]>=1?(i=d[d[e+880>>2]>>2],n=d[i+4>>2],d[t>>2]=d[i>>2],d[t+4>>2]=n,d[t+16>>2]=d[i+16>>2],n=d[i+12>>2],d[t+8>>2]=d[i+8>>2],d[t+12>>2]=n):(d[t>>2]=0,d[t+4>>2]=0,d[t+16>>2]=0,d[t+8>>2]=0,d[t+12>>2]=0),(0|(i=d[e+872>>2]))==d[e+876>>2]&&!((0|i)>=(0|(n=i?i<<1:1)))){if(n&&(d[7717]=d[7717]+1,a=0|r[d[6606]](n<<2,16),i=d[e+872>>2]),(0|i)>=1)for(;d[(l=o<<2)+a>>2]=d[l+d[e+880>>2]>>2],(0|(o=o+1|0))!=(0|i););(o=d[e+880>>2])&&(u[e+884|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),i=d[e+872>>2]),d[e+880>>2]=0),d[e+880>>2]=a,d[e+876>>2]=n,s[e+884|0]=1}return d[d[e+880>>2]+(i<<2)>>2]=t,d[e+872>>2]=i+1,t}function gn(e,t){var i,n=0,o=0,a=0;i=d[d[e+1120>>2]+(t<<2)>>2],(t=d[i+348>>2])&&ec(e+1048|0,t),(t=d[i+52>>2])&&(u[i+56|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[i+52>>2]=0),d[i+52>>2]=0,s[i+56|0]=1,d[i+44>>2]=0,d[i+48>>2]=0,(t=d[i+32>>2])&&(u[i+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[i+32>>2]=0),d[i+32>>2]=0,s[i+36|0]=1,d[i+24>>2]=0,d[i+28>>2]=0,(t=d[i+12>>2])&&(u[i+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[i+12>>2]=0),t=0,d[i+12>>2]=0,s[i+16|0]=1,d[i+4>>2]=0,d[i+8>>2]=0,i&&(d[7718]=d[7718]+1,r[d[6607]](i));e:if(!((0|(n=d[e+1112>>2]))<1)){for(o=d[e+1120>>2];;){if(d[(a=(t<<2)+o|0)>>2]!=(0|i)){if((0|n)!=(0|(t=t+1|0)))continue;break e}break}(0|t)>=(0|n)||(n=(t=n+-1|0)<<2,d[a>>2]=d[n+o>>2],d[n+d[e+1120>>2]>>2]=i,d[e+1112>>2]=t)}}function bn(e,t){var i,n,o=0,a=0,l=0,c=0,h=0,_=0,p=0,f=0;if((0|(l=d[e+4>>2]))==d[e+8>>2]&&(bs(e,l?l<<1:1),l=d[e+4>>2]),o=(n=d[e+12>>2])+b(l,36)|0,d[o+12>>2]=0,s[o+16|0]=1,d[o+4>>2]=0,d[o+8>>2]=0,(0|(i=d[t+4>>2]))>=1){d[7717]=d[7717]+1,_=i<<2,c=0|r[d[6606]](_,16),h=d[o+12>>2];e:{t:{if((0|(p=d[o+4>>2]))>=1)for(;;)if(d[c+(f=a<<2)>>2]=d[h+f>>2],(0|p)==(0|(a=a+1|0)))break t;if(!h)break e}u[o+16|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h))}for(s[o+16|0]=1,d[o+12>>2]=c,d[o+8>>2]=i,a=0,Mn(c,0,_),d[o+4>>2]=i,h=d[t+12>>2],o=d[o+12>>2];d[(c=a<<2)+o>>2]=d[h+c>>2],(0|i)!=(0|(a=a+1|0)););}else d[o+4>>2]=i;a=d[t+24>>2],o=b(l,36)+n|0,d[o+20>>2]=d[t+20>>2],d[o+24>>2]=a,a=d[t+32>>2],d[o+28>>2]=d[t+28>>2],d[o+32>>2]=a,d[e+4>>2]=d[e+4>>2]+1}function yn(e){var t,i,n=y(0),r=0,s=0;O=t=O-16|0,l(e);e:if((i=2147483647&(r=c(0)))>>>0<=1061752794){if(n=y(1),i>>>0<964689920)break e;n=el(+e)}else if(i>>>0<=1081824209){if(s=+e,i>>>0>=1075235812){n=y(-el(((0|r)<0?3.141592653589793:-3.141592653589793)+s));break e}if((0|r)<=-1){n=La(s+1.5707963267948966);break e}n=La(1.5707963267948966-s)}else if(i>>>0<=1088565717){if(i>>>0>=1085271520){n=el(+e+((0|r)<0?6.283185307179586:-6.283185307179586));break e}if((0|r)<=-1){n=La(-4.71238898038469-+e);break e}n=La(+e-4.71238898038469)}else if(n=y(e-e),!(i>>>0>=2139095040)){switch(3&Tr(e,t+8|0)){case 0:n=el(g[t+8>>3]);break e;case 1:n=La(-g[t+8>>3]);break e;case 2:n=y(-el(g[t+8>>3]));break e}n=La(g[t+8>>3])}return O=t+16|0,n}function vn(e){var t,i=0,n=y(0),r=0,s=y(0),o=y(0);if(l(e),(i=2147483647&(t=c(0)))>>>0<1283457024){e:{t:if(i>>>0<=1054867455){if(i>>>0<964689920)break e;i=-1,r=1}else{if(e=y(v(e)),i>>>0<=1066926079){if(i>>>0<=1060110335){e=y(y(y(e+e)+y(-1))/y(e+y(2))),i=0,r=0;break t}i=1,e=y(y(e+y(-1))/y(e+y(1)))}else i>>>0<=1075576831?(i=2,e=y(y(e+y(-1.5))/y(y(e*y(1.5))+y(1)))):(i=3,e=y(y(-1)/e));r=0}if(s=y(e*e),n=y(s*s),o=y(n*y(y(n*y(-.106480173766613))+y(-.19999158382415771))),n=y(s*y(y(n*y(y(n*y(.06168760731816292))+y(.14253635704517365)))+y(.333333283662796))),r)return y(e-y(e*y(o+n)));e=y(m[25888+(i<<=2)>>2]-y(y(y(e*y(o+n))-m[i+25904>>2])-e)),e=(0|t)<0?y(-e):e}return e}return i>>>0>2139095040?e:(a(0,-2147483648&(l(e),c(0))|1070141402),h())}function An(e){var t,i,n=0,r=0;O=t=O-16|0,l(e);e:if((i=2147483647&(r=c(0)))>>>0<=1061752794){if(i>>>0<964689920)break e;e=La(+e)}else if(i>>>0<=1081824209){if(n=+e,i>>>0<=1075235811){if((0|r)<=-1){e=y(-el(n+1.5707963267948966));break e}e=el(n+-1.5707963267948966);break e}e=La(-(((0|r)<0?3.141592653589793:-3.141592653589793)+n))}else if(i>>>0<=1088565717){if(n=+e,i>>>0<=1085271519){if((0|r)<=-1){e=el(n+4.71238898038469);break e}e=y(-el(n+-4.71238898038469));break e}e=La(((0|r)<0?6.283185307179586:-6.283185307179586)+n)}else if(i>>>0>=2139095040)e=y(e-e);else{switch(3&Tr(e,t+8|0)){case 0:e=La(g[t+8>>3]);break e;case 1:e=el(g[t+8>>3]);break e;case 2:e=La(-g[t+8>>3]);break e}e=y(-el(g[t+8>>3]))}return O=t+16|0,e}function Cn(e){var t=0;return d[(e|=0)>>2]=17612,(t=d[e+160>>2])&&(u[e+164|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+160>>2]=0),d[e+160>>2]=0,s[e+164|0]=1,d[e+152>>2]=0,d[e+156>>2]=0,(t=d[e+136>>2])&&(u[e+140|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+136>>2]=0),d[e+136>>2]=0,s[e+140|0]=1,d[e+128>>2]=0,d[e+132>>2]=0,(t=d[e+116>>2])&&(u[e+120|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+116>>2]=0),d[e+116>>2]=0,s[e+120|0]=1,d[e+108>>2]=0,d[e+112>>2]=0,(t=d[e+96>>2])&&(u[e+100|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+96>>2]=0),d[e+96>>2]=0,s[e+100|0]=1,d[e+88>>2]=0,d[e+92>>2]=0,(t=d[e+76>>2])&&(u[e+80|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+76>>2]=0),d[e+76>>2]=0,s[e+80|0]=1,d[e+68>>2]=0,d[e+72>>2]=0,0|e}function Sn(e,t,i){e|=0,i|=0;var n=0,s=0;if(d[(t|=0)>>2]=r[d[d[i>>2]+28>>2]](i,d[e+28>>2]),d[t+4>>2]=r[d[d[i>>2]+28>>2]](i,d[e+32>>2]),n=0|r[d[d[i>>2]+40>>2]](i,e),s=0|r[d[d[i>>2]+28>>2]](i,n),d[t+8>>2]=s,s&&r[d[d[i>>2]+48>>2]](i,n),d[t+12>>2]=d[e+4>>2],d[t+24>>2]=u[e+21|0],d[t+40>>2]=d[e+24>>2],d[t+44>>2]=d[e+16>>2],d[t+48>>2]=u[e+20|0],d[t+20>>2]=d[e+12>>2],d[t+16>>2]=d[e+8>>2],d[t+28>>2]=d[e+36>>2],n=d[e+40>>2],i=0,d[t+36>>2]=0,d[t+32>>2]=n,n=d[e+28>>2],(0|(s=d[n+488>>2]))>=1)for(n=d[n+496>>2];d[n+(i<<2)>>2]==(0|e)&&(d[t+36>>2]=1),(0|s)!=(0|(i=i+1|0)););if(i=d[e+32>>2],(0|(n=d[i+488>>2]))>=1)for(s=d[i+496>>2],i=0;d[s+(i<<2)>>2]==(0|e)&&(d[t+36>>2]=1),(0|n)!=(0|(i=i+1|0)););return 19332}function xn(e,t,i,n){var r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0;s=d[e+4>>2];e:{if(d[e>>2]==(0|t)){if(r=2,(0|t)!=(0|s))break e;return s=d[t+12>>2],t=d[d[t+8>>2]+12>>2],a=d[t+96>>2],u=d[s+96>>2]-a|0,e=d[e+12>>2],r=d[t+92>>2],l=d[e+92>>2]-r|0,r=d[s+92>>2]-r|0,a=d[e+96>>2]-a|0,o=c=b(u,l)-b(r,a)|0,_=c>>31,c=d[i+8>>2],p=d[n+4>>2],f=d[i+4>>2],m=d[n+8>>2],h=id(o,_,h=b(c,p)-b(f,m)|0,h>>31),_=w,o=r,r=(r=d[e+88>>2])-(e=d[t+88>>2])|0,s=d[s+88>>2]-e|0,t=e=b(o,r)-b(s,l)|0,o=e>>31,n=d[n>>2],i=d[i>>2],l=id(t,o,e=b(n,f)-b(i,p)|0,e>>31),e=w+_|0,e=(t=l+h|0)>>>0>>0?e+1|0:e,o=t,i=id(r=t=b(s,a)-b(r,u)|0,s=t>>31,t=b(i,m)-b(n,c)|0,t>>31),e=w+e|0,(0|(e=(t=o+i|0)>>>0>>0?e+1|0:e))>0||(0|e)>=0&&!(t>>>0<=0)?2:1}r=(0|t)==(0|s)}return r}function Tn(e){var t=y(0),i=y(0),n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0);d[e+308>>2]=0,d[e+292>>2]=0,d[e+276>>2]=0,p=m[e+396>>2],t=m[e+36>>2],i=y(p*t),f=m[e+400>>2],n=m[e+40>>2],r=y(f*n),g=m[e+404>>2],s=m[e+44>>2],o=y(g*s),m[e+304>>2]=y(y(i*t)+y(r*n))+y(o*s),h=m[e+20>>2],_=m[e+24>>2],u=m[e+28>>2],m[e+300>>2]=y(y(i*h)+y(r*_))+y(o*u),a=i,i=m[e+4>>2],l=r,r=m[e+8>>2],c=o,o=m[e+12>>2],m[e+296>>2]=y(y(a*i)+y(l*r))+y(c*o),a=y(p*h),l=y(f*_),c=y(g*u),m[e+288>>2]=y(y(t*a)+y(n*l))+y(s*c),m[e+284>>2]=y(y(a*h)+y(l*_))+y(c*u),m[e+280>>2]=y(y(a*i)+y(l*r))+y(c*o),a=t,t=y(i*p),l=n,n=y(r*f),c=s,s=y(o*g),m[e+272>>2]=y(y(a*t)+y(l*n))+y(c*s),m[e+268>>2]=y(y(t*h)+y(n*_))+y(s*u),m[e+264>>2]=y(y(t*i)+y(n*r))+y(s*o)}function En(e,t){var i=y(0),n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);i=y(m[e+112>>2]-m[e+92>>2]),r=y(m[e+116>>2]-m[e+96>>2]),n=y(m[e+120>>2]-m[e+100>>2]),(a=y(x(y(y(y(i*i)+y(r*r))+y(n*n)))))>y(1.1920928955078125e-7)&&(c=m[t+8>>2],o=m[t>>2],h=m[t+4>>2],t=d[e+96>>2],d[e+112>>2]=d[e+92>>2],d[e+116>>2]=t,t=d[e+104>>2],d[e+120>>2]=d[e+100>>2],d[e+124>>2]=t,s=i,i=y(y(1)/a),l=s=y(s*i),_=y(s*o),s=y(r*i),n=y(n*i),i=y(y(_+y(s*h))+y(n*c)),i=y(i+i),l=r=y(l-y(o*i)),n=y(n-y(c*i)),i=y(s-y(h*i)),r=y(y(1)/y(x(y(y(n*n)+y(y(r*r)+y(i*i)))))),s=y(l*r),l=o,n=y(n*r),i=y(i*r),o=y(y(c*n)+y(y(o*s)+y(h*i))),m[e+112>>2]=y(a*y(s-y(l*o)))+m[e+112>>2],m[e+116>>2]=y(a*y(i-y(h*o)))+m[e+116>>2],m[e+120>>2]=y(a*y(n-y(c*o)))+m[e+120>>2])}function Rn(e){var t=0;return d[(e|=0)>>2]=19996,(t=d[e+144>>2])&&(u[e+148|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+144>>2]=0),d[e+144>>2]=0,s[e+148|0]=1,d[e+136>>2]=0,d[e+140>>2]=0,(t=d[e+76>>2])&&(u[e+80|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+76>>2]=0),d[e+76>>2]=0,s[e+80|0]=1,d[e+68>>2]=0,d[e+72>>2]=0,(t=d[e+56>>2])&&(u[e+60|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+56>>2]=0),d[e+56>>2]=0,s[e+60|0]=1,d[e+48>>2]=0,d[e+52>>2]=0,(t=d[e+36>>2])&&(u[e+40|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+36>>2]=0),d[e+36>>2]=0,s[e+40|0]=1,d[e+28>>2]=0,d[e+32>>2]=0,(t=d[e+16>>2])&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+16>>2]=0,s[e+20|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,0|e}function Pn(e,t){var i,n=0;O=i=O-144|0,kn(e),s[e+500|0]=1,d[e>>2]=17792,d[e+496>>2]=0,d[e+488>>2]=0,d[e+492>>2]=0,d[i+72>>2]=0,d[i+4>>2]=0,m[i>>2]=0,n=d[t+12>>2],d[i+84>>2]=d[t+8>>2],d[i+88>>2]=n,n=d[t>>2],t=d[t+4>>2],d[i+12>>2]=0,d[i+16>>2]=0,d[i+20>>2]=0,d[i+24>>2]=0,d[i+28>>2]=1065353216,d[i+40>>2]=0,d[i+44>>2]=0,d[i+32>>2]=0,d[i+36>>2]=0,d[i+48>>2]=1065353216,d[i+68>>2]=0,d[i+60>>2]=0,d[i+64>>2]=0,d[i+52>>2]=0,d[i+56>>2]=0,d[i+76>>2]=n,d[i+80>>2]=t,d[i+132>>2]=1008981770,d[i+136>>2]=1008981770,d[i+124>>2]=1000593162,d[i+128>>2]=1008981770,s[i+120|0]=0,d[i+116>>2]=1065353216,d[i+108>>2]=0,d[i+112>>2]=1061997773,d[i+100>>2]=1056964608,d[i+104>>2]=0,d[i+92>>2]=0,d[i+96>>2]=0,d[i+8>>2]=1065353216,Te(e,i),O=i+144|0}function In(e,t,i){var n,r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0);(n=d[e+4>>2])&&Vs(n,t,i),(e=d[e>>2])&&(_=m[e+220>>2],u=m[e+212>>2],p=m[e+216>>2],f=m[e+204>>2],g=m[e+196>>2],b=m[e+200>>2],v=m[e+188>>2],A=m[e+184>>2],C=m[e+180>>2],l=m[i+4>>2],c=m[i+8>>2],h=m[i>>2],r=m[t+8>>2],s=m[t+4>>2],a=m[t>>2],o=m[e+128>>2],m[e+276>>2]=y(a*o)+m[e+276>>2],m[e+280>>2]=y(o*s)+m[e+280>>2],m[e+284>>2]=y(o*r)+m[e+284>>2],d[e+312>>2]=d[e+312>>2]+1,o=y(y(r*l)-y(s*c)),r=y(y(a*c)-y(r*h)),s=y(y(s*h)-y(a*l)),m[e+292>>2]=y(y(y(C*o)+y(A*r))+y(v*s))+m[e+292>>2],m[e+296>>2]=y(y(y(o*g)+y(r*b))+y(s*f))+m[e+296>>2],m[e+300>>2]=y(y(y(o*u)+y(r*p))+y(s*_))+m[e+300>>2])}function Mn(e,t,i){var n=0,r=0,o=0,a=0;if(i&&(s[(n=e+i|0)-1|0]=t,s[0|e]=t,!(i>>>0<3||(s[n+-2|0]=t,s[e+1|0]=t,s[n+-3|0]=t,s[e+2|0]=t,i>>>0<7||(s[n+-4|0]=t,s[e+3|0]=t,i>>>0<9||(r=(n=0-e&3)+e|0,t=b(255&t,16843009),d[r>>2]=t,d[(n=(i=i-n&-4)+r|0)-4>>2]=t,i>>>0<9||(d[r+8>>2]=t,d[r+4>>2]=t,d[n+-8>>2]=t,d[n+-12>>2]=t,i>>>0<25||(d[r+24>>2]=t,d[r+20>>2]=t,d[r+16>>2]=t,d[r+12>>2]=t,d[n+-16>>2]=t,d[n+-20>>2]=t,d[n+-24>>2]=t,d[n+-28>>2]=t,(i=i-(a=4&r|24)|0)>>>0<32))))))))for(n=t,o=t,t=r+a|0;d[t+24>>2]=o,d[t+28>>2]=n,d[t+16>>2]=o,d[t+20>>2]=n,d[t+8>>2]=o,d[t+12>>2]=n,d[t>>2]=o,d[t+4>>2]=n,t=t+32|0,(i=i+-32|0)>>>0>31;);return e}function Dn(e){var t,i=0,n=0,o=0,a=0;if(d[(e|=0)>>2]=11320,(i=d[e+56>>2])&&(u[e+60|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+56>>2]=0),d[e+56>>2]=0,s[e+60|0]=1,d[e+48>>2]=0,d[e+52>>2]=0,(0|(t=d[e+28>>2]))>=1)for(;a=i=d[e+36>>2]+b(n,36)|0,(o=d[i+12>>2])&&(u[i+16|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[a+12>>2]=0),s[i+16|0]=1,d[a+12>>2]=0,d[i+4>>2]=0,d[i+8>>2]=0,(0|t)!=(0|(n=n+1|0)););return(i=d[e+36>>2])&&(u[e+40|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+36>>2]=0),d[e+36>>2]=0,d[e+28>>2]=0,d[e+32>>2]=0,s[e+40|0]=1,(i=d[e+16>>2])&&(u[e+20|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+16>>2]=0),d[e+16>>2]=0,s[e+20|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,0|e}function On(e,t,i,n){for(var r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0,g=0,b=0;;){for(u=i,o=d[e+12>>2],c=d[o+((i+n|0)/2<<2)>>2],a=n,l=i;;){for(p=d[d[c+740>>2]+208>>2];h=d[(f=((i=l)<<2)+o|0)>>2],(0|(r=d[d[h+740>>2]+208>>2]))<=-1&&(r=d[d[h+744>>2]+208>>2]),l=i+1|0,s=r,(m=(0|(r=p))>-1)||(r=d[d[c+744>>2]+208>>2]),(0|s)<(0|r););for(;_=d[(g=(r=a)<<2)+o>>2],s=p,a=r+-1|0,m||(s=d[d[c+744>>2]+208>>2]),b=s,(0|(s=d[d[_+740>>2]+208>>2]))<=-1&&(s=d[d[_+744>>2]+208>>2]),(0|b)<(0|s););if((0|i)<=(0|r)&&(d[f>>2]=_,d[d[e+12>>2]+g>>2]=h,r=a,i=l),!((0|i)<=(0|r)))break;o=d[e+12>>2],a=r,l=i}if((0|r)>(0|u)&&On(e,t,u,r),!((0|i)<(0|n)))break}}function wn(e){var t=0,i=0,n=0,o=0,a=0;if(d[e+32>>2]=262144,(0|(i=d[e+4>>2]))<2383){if(d[e+8>>2]<2383){if(d[7717]=d[7717]+1,a=0|r[d[6606]](9532,16),(0|(n=d[e+4>>2]))>=1)for(;d[(t=o<<2)+a>>2]=d[t+d[e+12>>2]>>2],(0|n)!=(0|(o=o+1|0)););(t=d[e+12>>2])&&(u[e+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+12>>2]=0),d[e+12>>2]=a,s[e+16|0]=1,d[e+8>>2]=2383}for(;d[d[e+12>>2]+(i<<2)>>2]=0,2383!=(0|(i=i+1|0)););}for(d[e+4>>2]=2383,n=0;;){if(t=d[e+12>>2]+(n<<2)|0,i=d[t>>2],d[t>>2]=0,i)for(;t=d[i+280>>2],ve(i),i=t,t;);if(2383==(0|(n=n+1|0)))break}d[e+36>>2]=1,d[e+40>>2]=1,d[e+28>>2]=0,d[e+20>>2]=1048576e3,d[e+24>>2]=0}function Fn(e,t){var i,n,s=0,o=y(0),a=y(0);O=i=O-32|0;e:if(n=((s=d[t+388>>2])&d[e+388>>2]&48)-16|0){if(16!=(0|n))break e;if(!(64&s)&&(0|e)==(0|t))break e;d[i+20>>2]=0,d[i+4>>2]=1065353216,d[i>>2]=22016,d[i+8>>2]=d[e+456>>2],s=d[e+192>>2],o=y(r[d[d[s>>2]+48>>2]](s)),s=d[t+192>>2],m[i+12>>2]=o+y(r[d[d[s>>2]+48>>2]](s)),o=m[t+316>>2],a=m[e+316>>2],d[i+28>>2]=t,d[i+24>>2]=e,m[i+16>>2]=a>2],d[t+1048>>2],i)}else(0|e)!=(0|t)&&(d[i>>2]=22100,s=d[e+192>>2],o=y(r[d[d[s>>2]+48>>2]](s)),s=d[t+192>>2],a=y(r[d[d[s>>2]+48>>2]](s)),d[i+8>>2]=t,d[i+4>>2]=e,m[i+12>>2]=o+a,Vt(d[e+928>>2],d[t+988>>2],i),d[i+8>>2]=e,d[i+4>>2]=t,Vt(d[t+928>>2],d[e+988>>2],i));O=i+32|0}function Bn(e,t,i,n){for(var r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0,g=0,b=0;;){for(u=i,o=d[e+12>>2],c=d[o+((i+n|0)/2<<2)>>2],a=n,l=i;;){for(p=d[d[c+28>>2]+208>>2];h=d[(f=((i=l)<<2)+o|0)>>2],(m=(0|(s=p))>-1)||(s=d[d[c+32>>2]+208>>2]),l=i+1|0,(0|(r=d[d[h+28>>2]+208>>2]))<=-1&&(r=d[d[h+32>>2]+208>>2]),(0|r)<(0|s););for(;_=d[(g=(r=a)<<2)+o>>2],(0|(s=d[d[_+28>>2]+208>>2]))<=-1&&(s=d[d[_+32>>2]+208>>2]),b=p,a=r+-1|0,m||(b=d[d[c+32>>2]+208>>2]),(0|b)<(0|s););if((0|i)<=(0|r)&&(d[f>>2]=_,d[d[e+12>>2]+g>>2]=h,r=a,i=l),!((0|i)<=(0|r)))break;o=d[e+12>>2],a=r,l=i}if((0|r)>(0|u)&&Bn(e,t,u,r),!((0|i)<(0|n)))break}}function Nn(e,t,i){var n,r=y(0),s=y(0),o=0,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0);O=n=O-16|0;e:{t:{i:{n:{if(d[i+100>>2]>=0)m[(d[t+108>>2]<<2)+n>>2]=d[i+88>>2];else if(r=zr(i+24|0),s=zr(o=i+72|0),a=d[i+100>>2],m[(d[t+108>>2]<<2)+n>>2]=r/s,(0|a)<0)break n;m[(d[t+112>>2]<<2)+n>>2]=d[i+92>>2];break i}if(r=zr(i+40|0),s=zr(o),o=d[i+100>>2],m[(d[t+112>>2]<<2)+n>>2]=r/s,(0|o)<0)break t}r=y(d[i+96>>2]);break e}r=y(zr(i+56|0)/zr(i+72|0))}m[(d[t+104>>2]<<2)+n>>2]=r,r=m[t+20>>2],s=m[t+24>>2],l=m[t+16>>2],c=m[t>>2],h=m[t+4>>2],_=m[t+8>>2],u=m[n>>2],p=m[n+4>>2],f=m[n+8>>2],d[e+12>>2]=0,m[e+8>>2]=s+y(f*_),m[e+4>>2]=r+y(p*h),m[e>>2]=l+y(u*c),O=n+16|0}function Ln(e,t,i,n){var r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),d=y(0),u=y(0),p=y(0),f=y(0);return l=m[i+24>>2],r=m[t+24>>2],_=y(l-r),c=m[i+16>>2],o=m[t+16>>2],d=y(c-o),s=m[e+4>>2],h=m[i+20>>2],a=m[t+20>>2],u=y(h-a),p=m[e>>2],f=m[e+8>>2],y(y(r*y(y(d*s)-y(u*p)))+y(y(o*y(y(u*f)-y(_*s)))+y(a*y(y(_*p)-y(d*f)))))y(0)||(s=y(y(y(c*c)+y(h*h))+y(l*l)),y(y(y(c*d)+y(h*u))+y(l*_))y(0)?r:y(0))),m[n>>2]=x(s),e=1):e=0,e}function kn(e){d[e+188>>2]=0,d[e+192>>2]=0,d[e+180>>2]=0,d[e+184>>2]=1566444395,d[e+164>>2]=1065353216,d[e+168>>2]=1065353216,d[e>>2]=3948,d[e+244>>2]=1065353216,d[e+236>>2]=1,d[e+240>>2]=0,d[e+228>>2]=0,d[e+232>>2]=0,d[e+220>>2]=0,d[e+224>>2]=1056964608,d[e+212>>2]=-1,d[e+216>>2]=1,d[e+204>>2]=1,d[e+208>>2]=-1,d[e+248>>2]=0,d[e+252>>2]=0,d[e+4>>2]=1065353216,d[e+172>>2]=1065353216,d[e+176>>2]=0,d[e+196>>2]=0,d[e+200>>2]=0,d[e+256>>2]=0,d[e+260>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,d[e+16>>2]=0,d[e+20>>2]=0,d[e+36>>2]=0,d[e+40>>2]=0,d[e+24>>2]=1065353216,d[e+28>>2]=0,d[e+32>>2]=0,d[e- -64>>2]=0,d[e+44>>2]=1065353216,d[e+56>>2]=0,d[e+60>>2]=0,d[e+48>>2]=0,d[e+52>>2]=0}function Vn(e,t,i,n){var r=y(0),s=0,o=y(0),a=y(0),l=y(0);if(a=y(m[i+8>>2]-m[e+16>>2]),l=m[e+48>>2],o=y(y(m[i+4>>2]-m[e+12>>2])*m[e+44>>2]),r=y(y(m[i>>2]-m[e+8>>2])*m[e+40>>2]),i=n,r<=y(0)||(i=p[e+6>>1],i=r>=y(i>>>0)?i&p[e+4>>1]|n:(i=r=y(0)?~~r>>>0:0)&p[e+4>>1]|n),s=i,r=y(a*l),_[t>>1]=s,s=t,i=n,o<=y(0)||(i=p[e+6>>1],i=o>=y(i>>>0)?i&p[e+4>>1]|n:(i=o=y(0)?~~o>>>0:0)&p[e+4>>1]|n),_[s+2>>1]=i,i=t,!(r<=y(0))){if(s=p[e+6>>1],r>=y(s>>>0))return void(_[t+4>>1]=s&p[e+4>>1]|n);n=(t=r=y(0)?~~r>>>0:0)&p[e+4>>1]|n}_[i+4>>1]=n}function Un(e,t){var i=0,n=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0;if((0|(n=d[e+8>>2]))>=1)for(;i=d[d[e+16>>2]+(s<<2)>>2],2&u[i+236|0]&&(a=t,l=0|r[d[d[i>>2]+16>>2]](i),c=1,o=d[d[t>>2]+16>>2],n=0|r[o](0|a,0|l,0|c),c=t,l=n,a=0|r[d[d[i>>2]+20>>2]](i,d[n+8>>2],t),h=1497645650,_=i,o=d[d[t>>2]+20>>2],r[o](0|c,0|l,0|a,0|h,0|_),n=d[e+8>>2]),(0|(s=s+1|0))<(0|n););if(d[e+212>>2]>=1)for(s=0;i=d[d[e+220>>2]+(s<<2)>>2],_=t,h=0|r[d[d[i>>2]+36>>2]](i),a=1,o=d[d[t>>2]+16>>2],n=0|r[o](0|_,0|h,0|a),a=t,h=n,_=0|r[d[d[i>>2]+40>>2]](i,d[n+8>>2],t),l=1397641027,c=i,o=d[d[t>>2]+20>>2],r[o](0|a,0|h,0|_,0|l,0|c),(0|(s=s+1|0))>2];);}function Gn(e,t,i){var n=0,o=0,a=0,l=0,c=0,h=0,_=0;if((0|(n=d[e+96>>2]))==d[e+100>>2]&&!((0|n)>=(0|(o=n?n<<1:1)))){if(o&&(d[7717]=d[7717]+1,_=0|r[d[6606]](o<<4,16),n=d[e+96>>2]),(0|n)>=1)for(;l=(a=c<<4)+_|0,a=a+d[e+104>>2]|0,h=d[a+4>>2],d[l>>2]=d[a>>2],d[l+4>>2]=h,h=d[a+12>>2],d[l+8>>2]=d[a+8>>2],d[l+12>>2]=h,(0|(c=c+1|0))!=(0|n););(n=d[e+104>>2])&&(u[e+108|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+104>>2]=0),d[e+104>>2]=_,d[e+100>>2]=o,s[e+108|0]=1,n=d[e+96>>2]}o=d[t+4>>2],n=d[e+104>>2]+(n<<4)|0,d[n>>2]=d[t>>2],d[n+4>>2]=o,o=d[t+12>>2],d[n+8>>2]=d[t+8>>2],d[n+12>>2]=o,d[e+96>>2]=d[e+96>>2]+1,i&&Qn(e)}function jn(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0);s=y(r[d[d[e>>2]+48>>2]](e)),h=m[t+52>>2],l=m[t+20>>2],p=m[t+24>>2],_=m[t+56>>2],c=m[t+36>>2],o=m[e+32>>2],f=m[t+40>>2],g=m[e+36>>2],u=m[t+48>>2],b=m[t>>2],A=m[t+4>>2],C=m[t+8>>2],S=m[t+16>>2],x=m[t+32>>2],a=m[e+28>>2],d[i+12>>2]=0,a=y(s+a),o=y(s+o),s=y(s+g),c=y(y(y(a*y(v(x)))+y(o*y(v(c))))+y(s*y(v(f)))),m[i+8>>2]=_-c,l=y(y(y(a*y(v(S)))+y(o*y(v(l))))+y(s*y(v(p)))),m[i+4>>2]=h-l,s=y(y(y(a*y(v(b)))+y(o*y(v(A))))+y(s*y(v(C)))),m[i>>2]=u-s,d[n+12>>2]=0,m[n+8>>2]=_+c,m[n+4>>2]=l+h,m[n>>2]=s+u}function Wn(e){e|=0;var t=0,i=0,n=0;if(yr(18160),Ue(e),r[d[d[e>>2]+20>>2]](e)&&(t=0|r[d[d[e>>2]+20>>2]](e),6144&r[d[d[t>>2]+48>>2]](t)&&!((0|(i=0|r[d[d[e>>2]+104>>2]](e)))<1)))for(;t=i+-1|0,B(e,0|r[d[d[e>>2]+108>>2]](e,t)),n=(0|i)>1,i=t,n;);if(r[d[d[e>>2]+20>>2]](e)&&(t=0|r[d[d[e>>2]+20>>2]](e),16387&r[d[d[t>>2]+48>>2]](t)&&r[d[d[e>>2]+20>>2]](e)&&(t=0|r[d[d[e>>2]+20>>2]](e),!(!r[d[d[t>>2]+48>>2]](t)|d[e+280>>2]<1))))for(i=0;t=d[d[e+288>>2]+(i<<2)>>2],r[d[d[t>>2]+12>>2]](t,d[e+72>>2]),(0|(i=i+1|0))>2];);As()}function zn(e,t){var i,n,s=y(0),o=y(0),a=y(0),l=0,c=y(0),h=y(0),_=y(0);d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,i=e,d[e+52>>2]=1,d[e>>2]=15624,n=e,s=m[t>>2],o=m[t+8>>2],a=m[t+4>>2],(s=y(m[((s>2]*y(.10000000149011612)))>2]?(es(e,s),l=d[e>>2]):l=15624,s=y(r[d[l+48>>2]](n)),o=y(r[d[d[e>>2]+48>>2]](i)),a=y(r[d[d[e>>2]+48>>2]](i)),c=m[t>>2],h=m[t+4>>2],_=m[t+8>>2],d[e+40>>2]=0,d[e+4>>2]=13,m[e+36>>2]=y(_*m[e+20>>2])-a,m[e+32>>2]=y(h*m[e+16>>2])-o,m[e+28>>2]=y(c*m[e+12>>2])-s}function Hn(e,t){var i=0,n=0,o=0,a=0,l=0;e:{t:if(!((0|(i=d[e+488>>2]))<1)){for(o=d[e+496>>2];;){if(d[o+(n<<2)>>2]!=(0|t)){if((0|(n=n+1|0))!=(0|i))continue;break t}break}if((0|i)!=(0|n))break e}if(d[e+492>>2]==(0|i)&&!((0|i)>=(0|(o=i?i<<1:1)))){if(o&&(d[7717]=d[7717]+1,a=0|r[d[6606]](o<<2,16),i=d[e+488>>2]),(0|i)>=1)for(n=0;d[(l=n<<2)+a>>2]=d[d[e+496>>2]+l>>2],(0|(n=n+1|0))!=(0|i););(n=d[e+496>>2])&&(u[e+500|0]&&(n&&(d[7718]=d[7718]+1,r[d[6607]](n)),i=d[e+488>>2]),d[e+496>>2]=0),d[e+496>>2]=a,d[e+492>>2]=o,s[e+500|0]=1}d[d[e+496>>2]+(i<<2)>>2]=t,d[e+488>>2]=i+1}d[e+256>>2]=1}function Xn(e,t,i,n){var r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);s=yn(i),r=m[t+444>>2],i=An(i),y(v(s))>y(1.1920928955078125e-7)?(o=y(i*i),l=y(s*s),c=y(o/l),a=m[t+448>>2],r=y(x(y(y(c+y(1))/y(y(y(1)/y(a*a))+y(c/y(r*r))))))):(o=y(i*i),l=y(s*s)),d[e+12>>2]=0,r=y(r*y(.5)),o=y(An(r)/y(x(y(o+y(l+y(0)))))),l=y(o*y(0)),r=yn(r),a=y(r*y(0)),i=y(o*y(-i)),h=y(l*y(0)),c=y(y(a+y(i*n))-h),s=y(s*o),a=y(y(a+h)-y(s*n)),h=y(s*y(0)),_=y(i*y(0)),o=y(y(y(y(o*y(-0))*n)-h)-_),n=y(y(y(r*n)+h)-_),m[e+8>>2]=y(l*c)+y(y(y(r*a)-y(i*o))-y(s*n)),m[e+4>>2]=y(i*n)+y(y(y(r*c)-y(s*o))-y(l*a)),m[e>>2]=y(s*a)+y(y(y(r*n)-y(l*o))-y(i*c))}function Yn(e){var t=0;return d[(e|=0)>>2]=16376,(t=d[e+156>>2])&&(u[e+160|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+156>>2]=0),d[e+156>>2]=0,s[e+160|0]=1,d[e+148>>2]=0,d[e+152>>2]=0,(t=d[e+136>>2])&&(u[e+140|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+136>>2]=0),d[e+136>>2]=0,s[e+140|0]=1,d[e+128>>2]=0,d[e+132>>2]=0,(t=d[e+116>>2])&&(u[e+120|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+116>>2]=0),d[e+116>>2]=0,s[e+120|0]=1,d[e+108>>2]=0,d[e+112>>2]=0,(t=d[e+96>>2])&&(u[e+100|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+96>>2]=0),d[e+96>>2]=0,s[e+100|0]=1,d[e+88>>2]=0,d[e+92>>2]=0,xo(e),0|e}function Qn(e){var t=0,i=y(0);O=t=O-96|0,s[e+88|0]=1,1&s[29104]||mc(29104)&&(d[7253]=0,d[7254]=0,d[7252]=1065353216,d[7255]=0,d[7256]=0,d[7258]=0,d[7259]=0,d[7257]=1065353216,d[7260]=0,d[7261]=0,d[7265]=0,d[7266]=0,d[7264]=-1082130432,d[7262]=1065353216,d[7263]=0,d[7267]=0,d[7268]=0,d[7270]=0,d[7271]=0,d[7269]=-1082130432,d[7272]=0,d[7273]=0,d[7274]=-1082130432,d[7275]=0,uh(29104)),t=Mn(t,0,96),r[d[d[e>>2]+76>>2]](e,29008,t,6),i=m[e+44>>2],m[e+72>>2]=m[t>>2]+i,m[e+56>>2]=m[t+48>>2]-i,m[e+76>>2]=i+m[t+20>>2],m[e+60>>2]=m[t+68>>2]-i,m[e+80>>2]=i+m[t+40>>2],m[e- -64>>2]=m[t+88>>2]-i,O=t+96|0}function qn(e){var t=0,i=y(0);O=t=O-96|0,s[e+84|0]=1,1&s[29216]||mc(29216)&&(d[7281]=0,d[7282]=0,d[7280]=1065353216,d[7283]=0,d[7284]=0,d[7286]=0,d[7287]=0,d[7285]=1065353216,d[7288]=0,d[7289]=0,d[7293]=0,d[7294]=0,d[7292]=-1082130432,d[7290]=1065353216,d[7291]=0,d[7295]=0,d[7296]=0,d[7298]=0,d[7299]=0,d[7297]=-1082130432,d[7300]=0,d[7301]=0,d[7302]=-1082130432,d[7303]=0,uh(29216)),t=Mn(t,0,96),r[d[d[e>>2]+76>>2]](e,29120,t,6),i=m[e+44>>2],m[e+68>>2]=m[t>>2]+i,m[e+52>>2]=m[t+48>>2]-i,m[e+72>>2]=i+m[t+20>>2],m[e+56>>2]=m[t+68>>2]-i,m[e+76>>2]=i+m[t+40>>2],m[e+60>>2]=m[t+88>>2]-i,O=t+96|0}function Kn(e,t,i,n){var o,a=0,l=0;if(d[7717]=d[7717]+1,o=0|r[d[6606]](36,16),d[o+28>>2]=-1,d[o+32>>2]=0,d[o+20>>2]=-1,d[o+12>>2]=-1,d[o+16>>2]=-1,d[o+8>>2]=n,d[o+4>>2]=i,d[o>>2]=t,i=d[e+4>>2],d[o+24>>2]=i,d[e+8>>2]==(0|i)&&!((0|i)>=(0|(n=i?i<<1:1)))){if(n&&(d[7717]=d[7717]+1,a=0|r[d[6606]](n<<2,16),i=d[e+4>>2]),(0|i)>=1)for(t=0;d[(l=t<<2)+a>>2]=d[d[e+12>>2]+l>>2],(0|i)!=(0|(t=t+1|0)););(t=d[e+12>>2])&&(u[e+16|0]&&(t&&(d[7718]=d[7718]+1,r[d[6607]](t)),i=d[e+4>>2]),d[e+12>>2]=0),d[e+12>>2]=a,s[e+16|0]=1,d[e+8>>2]=n}return d[d[e+12>>2]+(i<<2)>>2]=o,d[e+4>>2]=i+1,o}function Zn(e){var t,i,n=0,o=0,a=0;if(d[e>>2]=16848,s[e+28|0]=0,d[e+24>>2]=0,d[e+72>>2]=0,s[e+20|0]=1,d[e+16>>2]=0,s[e+48|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,d[e+44>>2]=0,s[e+68|0]=1,d[e+36>>2]=0,d[e+40>>2]=0,d[e- -64>>2]=0,d[e+56>>2]=0,d[e+60>>2]=0,d[7717]=d[7717]+1,t=0|r[d[6606]](32,16),(0|(i=d[e+8>>2]))>=1)for(;n=(o=a<<4)+t|0,o=o+d[e+16>>2]|0,d[n>>2]=d[o>>2],d[n+4>>2]=d[o+4>>2],d[n+8>>2]=d[o+8>>2],d[n+12>>2]=d[o+12>>2],(0|i)!=(0|(a=a+1|0)););(n=d[e+16>>2])&&(u[e+20|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+16>>2]=0),d[e+16>>2]=t,s[e+20|0]=1,d[e+12>>2]=2,ti(e)}function $n(e,t){var i=y(0),n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0);!e|!(1&d[e+180>>2])||(b=m[e+172>>2],i=m[e+44>>2],c=m[e+12>>2],h=m[e+28>>2],r=m[e+36>>2],_=m[e+20>>2],v=m[e+168>>2],n=m[e+40>>2],u=m[e+8>>2],p=m[e+24>>2],s=m[e+164>>2],f=m[e+4>>2],d[t+12>>2]=0,g=r,o=s,s=m[t>>2],a=m[t+4>>2],r=m[t+8>>2],l=y(o*y(y(y(f*s)+y(_*a))+y(g*r))),A=n,n=y(v*y(y(y(s*u)+y(a*p))+y(r*n))),o=i,i=y(b*y(y(y(s*c)+y(a*h))+y(r*i))),m[t+8>>2]=y(y(g*l)+y(A*n))+y(o*i),m[t+4>>2]=y(y(_*l)+y(p*n))+y(h*i),m[t>>2]=y(y(f*l)+y(u*n))+y(c*i))}function Jn(e,t){var i,n=0,o=0,a=0,l=0,c=0;if(O=i=O-96|0,Mn(i,0,96),t=t||d[d[e+880>>2]>>2],(0|(n=d[e+772>>2]))==d[e+776>>2]&&!((0|n)>=(0|(o=n?n<<1:1)))){if(o&&(d[7717]=d[7717]+1,l=0|r[d[6606]](b(o,104),16),n=d[e+772>>2]),(0|n)>=1)for(;Mi((c=b(a,104))+l|0,d[e+780>>2]+c|0,104),(0|(a=a+1|0))!=(0|n););(n=d[e+780>>2])&&(u[e+784|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+780>>2]=0),d[e+780>>2]=l,d[e+776>>2]=o,s[e+784|0]=1,n=d[e+772>>2]}n=d[e+780>>2]+b(n,104)|0,d[n+4>>2]=t,d[n>>2]=0,Mi(n+8|0,i,96),d[e+772>>2]=d[e+772>>2]+1,O=i+96|0}function er(e,t,i){var n,s,o,a,l,c,h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0);O=n=O-48|0,h=m[t+8>>2],_=m[t>>2],u=m[t+4>>2],d[i+12>>2]=0,p=h,h=y(y(1)/y(x(y(y(y(_*_)+y(u*u))+y(h*h))))),m[i+8>>2]=p*h,m[i+4>>2]=u*h,m[i>>2]=_*h,t=d[e+120>>2],a=n+32|0,s=d[e+124>>2],l=o=d[e>>2]+(s>>1)|0,c=i,1&s&&(t=d[t+d[o>>2]>>2]),r[t](a,l,c),h=m[i>>2],_=m[i+4>>2],u=m[i+8>>2],d[n+12>>2]=0,m[n+8>>2]=-u,m[n+4>>2]=-_,m[n>>2]=-h,function(e,t,i){var n,s,o,a=y(0),l=y(0),c=y(0),h=0,_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0);O=n=O-32|0,s=d[t+124>>2],o=d[t+4>>2]+(s>>1)|0,h=d[t+120>>2],h=1&s?d[d[o>>2]+h>>2]:h,_=m[t+16>>2],u=m[t+12>>2],p=m[t+32>>2],f=m[t+24>>2],g=m[t+28>>2],b=m[t+48>>2],v=m[t+40>>2],A=m[t+44>>2],C=m[t+8>>2],a=m[i+8>>2],l=m[i>>2],c=m[i+4>>2],d[n+12>>2]=0,m[n+8>>2]=y(y(l*v)+y(c*A))+y(a*b),m[n+4>>2]=y(y(l*f)+y(c*g))+y(a*p),m[n>>2]=y(y(C*l)+y(u*c))+y(_*a),r[h](n+16|0,o,n),_=m[t+104>>2],u=m[t- -64>>2],p=m[t+60>>2],f=m[t+108>>2],g=m[t+80>>2],b=m[t+72>>2],v=m[t+76>>2],A=m[t+112>>2],C=m[t+96>>2],S=m[t+88>>2],x=m[t+92>>2],T=m[t+56>>2],a=m[n+24>>2],l=m[n+16>>2],c=m[n+20>>2],d[e+12>>2]=0,m[e+8>>2]=A+y(y(y(l*S)+y(c*x))+y(a*C)),m[e+4>>2]=f+y(y(y(l*b)+y(c*v))+y(a*g)),m[e>>2]=_+y(y(y(l*T)+y(c*p))+y(a*u)),O=n+32|0}(n+16|0,e,n),h=m[n+16>>2],_=m[n+32>>2],u=m[n+20>>2],p=m[n+36>>2],f=m[n+24>>2],g=m[n+40>>2],d[i+28>>2]=0,m[i+24>>2]=g-f,m[i+20>>2]=p-u,m[i+16>>2]=_-h,O=n+48|0}function tr(e,t,i,n,s){e|=0,t|=0,i=y(i),n|=0,s|=0;var o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0);return O=o=O-48|0,d[o+44>>2]=s,d[o+40>>2]=n,h=m[e- -64>>2],_=m[e+60>>2],u=m[e+80>>2],p=m[e+72>>2],f=m[e+76>>2],g=m[e+96>>2],b=m[e+88>>2],v=m[e+92>>2],A=m[e+56>>2],a=m[t+8>>2],l=m[t>>2],c=m[t+4>>2],t=d[e+48>>2],d[o+28>>2]=0,m[o+24>>2]=y(y(l*b)+y(c*v))+y(a*g),m[o+20>>2]=y(y(l*p)+y(c*f))+y(a*u),m[o+32>>2]=i,d[o+8>>2]=t,m[o+16>>2]=y(y(A*l)+y(_*c))+y(h*a),d[o+12>>2]=o+40,e=d[e+44>>2],i=y(r[d[d[e>>2]+12>>2]](e,o+8|0,1)),O=o+48|0,y(i)}function ir(e){var t=0;(t=d[e+72>>2])&&(u[e+76|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+72>>2]=0),d[e+72>>2]=0,s[e+76|0]=1,d[(t=e- -64|0)>>2]=0,d[t+4>>2]=0,(t=d[e+52>>2])&&(u[e+56|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+52>>2]=0),d[e+52>>2]=0,s[e+56|0]=1,d[e+44>>2]=0,d[e+48>>2]=0,(t=d[e+32>>2])&&(u[e+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+32>>2]=0),d[e+32>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0,(t=d[e+12>>2])&&(u[e+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+12>>2]=0),d[e+12>>2]=0,s[e+16|0]=1,d[e+4>>2]=0,d[e+8>>2]=0}function nr(e,t,i,n,r){var o;O=o=O-32|0,d[o+28>>2]=e,m[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,d[o+12>>2]=r,e=d[o+28>>2],m[e>>2]=m[o+24>>2],d[e+4>>2]=d[o+20>>2],ph(e+8|0),d[e+72>>2]=d[o+16>>2],i=d[o+12>>2],n=d[i+4>>2],d[e+76>>2]=d[i>>2],d[e+80>>2]=n,n=d[i+12>>2],d[e+84>>2]=d[i+8>>2],d[e+88>>2]=n,m[e+92>>2]=0,m[e+96>>2]=0,m[e+100>>2]=.5,m[e+104>>2]=0,m[e+108>>2]=0,m[e+112>>2]=.800000011920929,m[e+116>>2]=1,s[e+120|0]=0,m[e+124>>2]=.004999999888241291,m[e+128>>2]=.009999999776482582,m[e+132>>2]=.009999999776482582,m[e+136>>2]=.009999999776482582,al(e+8|0),O=o+32|0}function rr(e){var t=0;return d[(e|=0)>>2]=16640,d[e+108>>2]&&(t=d[e+112>>2],r[d[d[t>>2]>>2]](t),(t=d[e+112>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+108>>2],r[d[d[t>>2]>>2]](t),(t=d[e+108>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),(t=d[e+88>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),(t=d[e+84>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),(t=d[e+80>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),(t=d[e+60>>2])&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),u[e+100|0]&&(t=d[e+92>>2],r[d[d[t>>2]>>2]](t),(t=d[e+92>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),0|e}function sr(e,t,i,n){var r,s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0);return r=(d[t+4>>2]<<4)+e|0,c=m[r>>2],s=(d[t>>2]<<4)+e|0,u=m[s>>2],p=y(c-u),e=(d[t+8>>2]<<4)+e|0,o=m[r+4>>2],a=y(m[e+4>>2]-o),f=m[s+4>>2],o=y(o-f),g=y(m[e>>2]-c),_=y(y(p*a)-y(o*g)),h=o,o=m[r+8>>2],l=y(m[e+8>>2]-o),c=m[s+8>>2],o=y(o-c),a=y(y(h*l)-y(o*a)),l=y(y(o*g)-y(p*l)),(o=y(x(y(y(_*_)+y(y(a*a)+y(l*l))))))!=y(0)?(o=y(y(1)/o),b=y(_*o),v=y(l*o),h=y(a*o)):h=y(1),y(y(y(h*y(m[i>>2]-u))+y(v*y(m[i+4>>2]-f)))+y(b*y(m[i+8>>2]-c)))>n}function or(e,t,i,n,o,a,l,c,h,_,p){var f,m=0,g=0,y=0,v=0,A=0;if(m=f=d[e+68>>2],(0|f)==d[e+72>>2]&&(m=f,!((0|f)>=(0|(y=f?f<<1:1))))){if(y?(d[7717]=d[7717]+1,v=0|r[d[6606]](b(y,152),16),m=d[e+68>>2]):m=f,(0|(g=m))>=1)for(m=0;Mi((A=b(m,152))+v|0,d[e+76>>2]+A|0,152),(0|g)!=(0|(m=m+1|0)););(g=d[e+76>>2])&&(u[e+80|0]&&g&&(d[7718]=d[7718]+1,r[d[6607]](g)),d[e+76>>2]=0),d[e+76>>2]=v,d[e+72>>2]=y,s[e+80|0]=1,m=d[e+68>>2]}d[e+68>>2]=m+1,g=d[e+76>>2]+b(f,152)|0,d[g+140>>2]=o,Re(e,g,t,i,n,a,l,c,h,_,p)}function ar(e){var t,i=0;(i=d[e>>2])&&Ca(e,i),(i=d[e+4>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+4>>2]=0,d[e+8>>2]=-1,(i=d[e+32>>2])&&(u[e+36|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+32>>2]=0),d[e+32>>2]=0,d[e+16>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0,i=0,(t=d[e+52>>2])&&(u[e+56|0]&&(t&&(d[7718]=d[7718]+1,r[d[6607]](t)),i=d[e+32>>2]),d[e+52>>2]=0),d[e+52>>2]=0,s[e+56|0]=1,d[e+44>>2]=0,d[e+48>>2]=0,i&&(u[e+36|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+32>>2]=0),d[e+32>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0}function lr(e,t,i,n,r){var o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0);(0|t)==(0|n)|(0|t)==(0|i)|(0|i)==(0|n)||(xi(e,r),r=d[e+760>>2]+b(d[e+752>>2],44)|0,t=d[e+720>>2]+b(t,104)|0,d[r+-36>>2]=t,i=d[e+720>>2]+b(i,104)|0,d[r+-32>>2]=i,n=d[e+720>>2]+b(n,104)|0,d[r+-28>>2]=n,a=m[t+8>>2],h=y(m[i+8>>2]-a),o=m[t+12>>2],l=y(m[n+12>>2]-o),o=y(m[i+12>>2]-o),a=y(m[n+8>>2]-a),c=y(y(h*l)-y(o*a)),_=y(c*c),u=o,o=m[t+16>>2],c=y(m[n+16>>2]-o),o=y(m[i+16>>2]-o),l=y(y(u*c)-y(o*l)),a=y(y(o*a)-y(h*c)),m[r+-8>>2]=x(y(_+y(y(l*l)+y(a*a)))),s[e+924|0]=1)}function cr(e,t,i){var n;if(e|=0,!((n=8!=(0|(t|=0)))|8!=(0|(i|=0))))return d[e+60>>2];if(!(1!=(0|i)|n))return d[e+76>>2];if(!(1!=(0|t)|8!=(0|i)))return d[e+80>>2];if(!(t|i))return d[e+72>>2];if(!(28!=(0|i)|(0|t)>19))return d[e+88>>2];if(!(28!=(0|t)|(0|i)>19))return d[e+84>>2];e:{if((0|t)<=19){if((0|i)<=19)return d[e+32>>2];if(i+-21>>>0>8)break e;return d[e+36>>2]}if(!((0|i)>19|t+-21>>>0>8))return d[e+40>>2];if(31==(0|t))return 31==(0|i)?d[e+48>>2]:d[e+44>>2]}return 31==(0|i)?d[e+52>>2]:d[e+56>>2]}function hr(e){var t=0,i=0,n=0,s=0,o=0,a=0;if(d[e+852>>2]>=1)for(;;){t=d[(i=n<<2)+d[e+860>>2]>>2],r[d[d[t>>2]+16>>2]](t,m[e+452>>2]),t=d[i+d[e+860>>2]>>2];e:if(u[t+152|0]){if(t&&(d[7718]=d[7718]+1,r[d[6607]](t)),n=n+-1|0,!((0|(t=d[e+852>>2]))<1)){for(s=d[e+860>>2],o=d[i+s>>2],i=0;;){if(d[(a=(i<<2)+s|0)>>2]!=(0|o)){if((0|(i=i+1|0))!=(0|t))continue;break e}break}(0|i)>=(0|t)||(i=(t=t+-1|0)<<2,d[a>>2]=d[i+s>>2],d[i+d[e+860>>2]>>2]=o,d[e+852>>2]=t)}}else t=d[e+852>>2];if(!((0|(n=n+1|0))<(0|t)))break}}function _r(e,t,i,n,o,a){var l,c=0,h=0,_=0,p=0,f=0;if(c=l=d[e+88>>2],(0|l)==d[e+92>>2]&&(c=l,!((0|l)>=(0|(_=l?l<<1:1))))){if(_?(d[7717]=d[7717]+1,p=0|r[d[6606]](b(_,152),16),c=d[e+88>>2]):c=l,(0|(h=c))>=1)for(c=0;Mi((f=b(c,152))+p|0,d[e+96>>2]+f|0,152),(0|h)!=(0|(c=c+1|0)););(h=d[e+96>>2])&&(u[e+100|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+96>>2]=0),d[e+96>>2]=p,d[e+92>>2]=_,s[e+100|0]=1,c=d[e+88>>2]}d[e+88>>2]=c+1,h=d[e+96>>2]+b(l,152)|0,d[h+140>>2]=o,Ge(e,h,t,i,n,a)}function dr(e,t,i){var n,r,s=y(0),o=y(0),a=y(0),l=0,c=y(0),h=y(0);o=y(m[t+60>>2]*y(.5)),n=d[t+64>>2],l=(r=d[t+68>>2])<<2,s=m[i>>2],a=y(s*s),s=m[i+4>>2],a=y(a+y(s*s)),s=m[i+8>>2];e:{if(m[l+i>>2]>y(m[t+52>>2]*y(x(y(a+y(s*s))))))d[(n<<2)+e>>2]=0,m[e+l>>2]=o,i=d[t+72>>2];else{if(s=m[(n<<2)+i>>2],l=i,i=d[t+72>>2],c=m[l+(i<<2)>>2],(h=y(x(y(y(s*s)+y(c*c)))))>y(1.1920928955078125e-7)){a=s,s=y(m[t+56>>2]/h),m[(n<<2)+e>>2]=a*s,m[(r<<2)+e>>2]=-o,o=y(c*s);break e}d[(n<<2)+e>>2]=0,m[(r<<2)+e>>2]=-o}o=y(0)}m[(i<<2)+e>>2]=o}function ur(e,t){var i,n=0,r=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[i+4>>2]=d[d[t+12>>2]+4>>2],t=d[i+4>>2],d[12+(n=O-16|0)>>2]=e,d[d[n+12>>2]+8>>2]==(0|t)&&(d[12+(n=O-16|0)>>2]=e,r=d[d[n+12>>2]+4>>2],d[12+(n=O-16|0)>>2]=e,d[n+8>>2]=r,ys(t=e,n=d[n+8>>2]?d[n+8>>2]<<1:1)),n=d[e+12>>2]+(d[e+4>>2]<<4)|0,d[12+(t=O-16|0)>>2]=16,d[t+8>>2]=n,n=d[i+8>>2],r=d[n+4>>2],t=d[t+8>>2],d[t>>2]=d[n>>2],d[t+4>>2]=r,r=d[n+12>>2],d[t+8>>2]=d[n+8>>2],d[t+12>>2]=r,d[e+4>>2]=d[e+4>>2]+1,O=i+16|0}function pr(e,t,i){var n;if(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,t=O-16|0,e=d[n+28>>2],d[t+12>>2]=e,d[n+16>>2]=d[d[t+12>>2]+4>>2],d[n+24>>2]>2])for(d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)d[n+12>>2]=d[n+12>>2]+1;else for(t=d[n+24>>2],d[12+(i=O-16|0)>>2]=e,(0|t)>d[d[i+12>>2]+4>>2]&&fs(e,d[n+24>>2]),d[n+8>>2]=d[n+16>>2];d[n+8>>2]>2];)d[d[e+12>>2]+(d[n+8>>2]<<2)>>2]=d[d[n+20>>2]>>2],d[n+8>>2]=d[n+8>>2]+1;d[e+4>>2]=d[n+24>>2],O=n+32|0}function fr(e){d[e>>2]=19780,s[e+20|0]=1,d[e+16>>2]=0,s[e+40|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,d[e+36>>2]=0,s[e+60|0]=1,d[e+28>>2]=0,d[e+32>>2]=0,d[e+56>>2]=0,s[e+80|0]=1,d[e+48>>2]=0,d[e+52>>2]=0,d[e+76>>2]=0,s[e+100|0]=1,d[e+68>>2]=0,d[e+72>>2]=0,d[e+96>>2]=0,s[e+120|0]=1,d[e+88>>2]=0,d[e+92>>2]=0,d[e+116>>2]=0,s[e+140|0]=1,d[e+108>>2]=0,d[e+112>>2]=0,d[e+136>>2]=0,d[e+128>>2]=0,d[e+132>>2]=0,s[e+160|0]=1,d[e+156>>2]=0,d[e+148>>2]=0,d[e+152>>2]=0,s[e+180|0]=1,d[e+192>>2]=0,d[e+176>>2]=0,d[e+168>>2]=0,d[e+172>>2]=0}function mr(e,t,i){var n,r;for(d[28+(n=O-32|0)>>2]=e,d[n+24>>2]=0,d[n+20>>2]=t,d[n+16>>2]=i,r=d[n+28>>2],d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)e=d[r+12>>2]+b(d[n+12>>2],44)|0,i=d[e+4>>2],t=d[n+16>>2]+b(d[n+12>>2],44)|0,d[t>>2]=d[e>>2],d[t+4>>2]=i,d[t+40>>2]=d[e+40>>2],i=d[e+36>>2],d[t+32>>2]=d[e+32>>2],d[t+36>>2]=i,i=d[e+28>>2],d[t+24>>2]=d[e+24>>2],d[t+28>>2]=i,i=d[e+20>>2],d[t+16>>2]=d[e+16>>2],d[t+20>>2]=i,i=d[e+12>>2],d[t+8>>2]=d[e+8>>2],d[t+12>>2]=i,d[n+12>>2]=d[n+12>>2]+1}function gr(e,t){t|=0;var i=0,n=0,o=0,a=0,l=0;if(!(!(i=d[12+(e|=0)>>2])|!u[e+8|0])){if((0|(n=d[t+4>>2]))==d[t+8>>2]&&!((0|n)>=(0|(o=n?n<<1:1)))){if(o&&(d[7717]=d[7717]+1,a=0|r[d[6606]](o<<2,16),n=d[t+4>>2]),(0|n)>=1)for(i=0;d[(l=i<<2)+a>>2]=d[d[t+12>>2]+l>>2],(0|(i=i+1|0))!=(0|n););(i=d[t+12>>2])&&(u[t+16|0]&&(i&&(d[7718]=d[7718]+1,r[d[6607]](i)),n=d[t+4>>2]),d[t+12>>2]=0),d[t+12>>2]=a,s[t+16|0]=1,d[t+8>>2]=o,i=d[e+12>>2]}d[d[t+12>>2]+(n<<2)>>2]=i,d[t+4>>2]=n+1}}function br(e,t,i){var n=0;return(n=d[e+4>>2])?d[e+4>>2]=0:(d[7717]=d[7717]+1,n=0|r[d[6606]](44,16),d[n>>2]=0,d[n+4>>2]=0,d[n+40>>2]=0,d[n+32>>2]=0,d[n+36>>2]=0,d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=0,d[n+20>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0),d[n+36>>2]=i,d[n+32>>2]=0,d[n+40>>2]=0,i=d[t+4>>2],d[n>>2]=d[t>>2],d[n+4>>2]=i,i=d[t+12>>2],d[n+8>>2]=d[t+8>>2],d[n+12>>2]=i,i=d[t+20>>2],d[n+16>>2]=d[t+16>>2],d[n+20>>2]=i,i=d[t+28>>2],d[n+24>>2]=d[t+24>>2],d[n+28>>2]=i,Tt(e,d[e>>2],n),d[e+12>>2]=d[e+12>>2]+1,n}function yr(e){var t,i,n=0;if(O=i=O-16|0,t=d[6605],d[t>>2]!=(0|e)){e:{if(n=d[t+24>>2])for(;;){if(d[n>>2]==(0|e))break e;if(!(n=d[n+28>>2]))break}n=ic(36),d[n+4>>2]=0,d[n+8>>2]=0,d[n>>2]=e,d[n+32>>2]=0,d[n+24>>2]=0,d[n+28>>2]=0,d[n+20>>2]=t,d[n+12>>2]=0,d[n+16>>2]=0,cc(n),d[n+28>>2]=d[t+24>>2],d[t+24>>2]=n}d[6605]=n}else n=t;d[n+4>>2]=d[n+4>>2]+1,e=d[n+16>>2],d[n+16>>2]=e+1,e||(R(i+8|0,0),e=d[7705],d[n+12>>2]=(d[i+12>>2]-d[e+4>>2]|0)+b(d[i+8>>2]-d[e>>2]|0,1e6)),O=i+16|0}function vr(e,t){e|=0,t=y(t);var i=0,n=0;if(yr(18214),(i=d[e+84>>2])&&r[i](e,t),r[d[d[e>>2]+140>>2]](e,t),i=0,d[e+32>>2]=0,m[e+28>>2]=t,d[e+48>>2]=r[d[d[e>>2]+20>>2]](e),function(e,t){var i,n=0,o=0,a=0,l=y(0),c=0,h=0,f=y(0),g=y(0),v=y(0),S=y(0),x=y(0),T=0,E=0,R=0,P=y(0),I=y(0),M=0,D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0);if(O=i=O-464|0,yr(18323),yr(18348),n=d[e+316>>2],d[e+308>>2]>=1)for(;o=d[e+24>>2],r[d[d[o>>2]+16>>2]](o,d[(h<<2)+n>>2]),n=d[e+316>>2],(0|(h=h+1|0))>2];);if(n&&(u[e+320|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+316>>2]=0),d[e+316>>2]=0,d[e+308>>2]=0,d[e+312>>2]=0,s[e+320|0]=1,As(),d[e+232>>2]>=1)for(T=i- -64|0,h=0;;){o=d[d[e+240>>2]+(h<<2)>>2],d[o+244>>2]=1065353216;e:{switch(d[o+216>>2]+-2|0){case 0:case 3:break e}if(!(3&u[o+204|0])&&(q_(o,t,i+400|0),u[e+44|0]&&(l=m[o+252>>2],(l=y(l*l))!=y(0)&&(f=l,l=y(m[i+448>>2]-m[o+52>>2]),g=y(l*l),l=y(m[i+452>>2]-m[o+56>>2]),g=y(g+y(l*l)),l=y(m[i+456>>2]-m[o+60>>2]),f>2]+4>>2]<=19&&(d[7312]=d[7312]+1,n=d[e+68>>2],n=0|r[d[d[n>>2]+36>>2]](n),a=d[e+24>>2],d[i+308>>2]=1065353216,d[i+312>>2]=-65535,c=d[o+64>>2],d[i+324>>2]=d[o+60>>2],d[i+328>>2]=c,c=d[o+56>>2],d[i+316>>2]=d[o+52>>2],d[i+320>>2]=c,c=d[i+460>>2],d[i+340>>2]=d[i+456>>2],d[i+344>>2]=c,c=d[i+452>>2],d[i+332>>2]=d[i+448>>2],d[i+336>>2]=c,d[i+380>>2]=0,d[i+304>>2]=18736,d[i+392>>2]=n,d[i+396>>2]=a,d[i+388>>2]=0,d[i+384>>2]=o,a=d[o+248>>2],d[4+(n=i+248|0)>>2]=35,d[n+8>>2]=0,d[n>>2]=13316,d[n+44>>2]=1025758986,d[n+20>>2]=1065353216,d[n+24>>2]=0,d[n+12>>2]=1065353216,d[n+16>>2]=1065353216,d[n>>2]=13444,d[i+292>>2]=a,d[i+276>>2]=a,d[i+252>>2]=8,d[i+248>>2]=11556,d[i+388>>2]=d[e+56>>2],n=d[o+188>>2],_[i+312>>1]=p[n+4>>1],_[i+314>>1]=p[n+6>>1],n=d[i+412>>2],d[i+192>>2]=d[i+408>>2],d[i+196>>2]=n,n=d[i+404>>2],d[i+184>>2]=d[i+400>>2],d[i+188>>2]=n,n=d[i+428>>2],d[i+208>>2]=d[i+424>>2],d[i+212>>2]=n,n=d[i+420>>2],d[i+200>>2]=d[i+416>>2],d[i+204>>2]=n,n=d[i+444>>2],d[i+224>>2]=d[i+440>>2],d[i+228>>2]=n,n=d[i+436>>2],d[i+216>>2]=d[i+432>>2],d[i+220>>2]=n,n=d[i+460>>2],d[i+240>>2]=d[i+456>>2],d[i+244>>2]=n,n=d[i+452>>2],d[i+232>>2]=d[i+448>>2],d[i+236>>2]=n,a=d[12+(n=o+4|0)>>2],d[i+192>>2]=d[n+8>>2],d[i+196>>2]=a,a=d[n+4>>2],d[i+184>>2]=d[n>>2],d[i+188>>2]=a,a=d[o+32>>2],d[i+208>>2]=d[o+28>>2],d[i+212>>2]=a,a=d[o+24>>2],d[i+200>>2]=d[o+20>>2],d[i+204>>2]=a,a=d[o+48>>2],d[i+224>>2]=d[o+44>>2],d[i+228>>2]=a,a=d[o+40>>2],d[i+216>>2]=d[o+36>>2],d[i+220>>2]=a,Ae(e,i+248|0,n,i+184|0,i+304|0,y(0)),(l=m[i+308>>2])>2]-m[o+56>>2])),S=y(l*y(m[i+448>>2]-m[o+52>>2])),x=y(l*y(m[i+456>>2]-m[o+60>>2])),U=y(y(y(v*y(-m[i+352>>2]))-y(S*m[i+348>>2]))-y(x*m[i+356>>2])),n=d[e+24>>2],c=0|r[d[d[n>>2]+12>>2]](n,o,d[i+380>>2]),(0|(a=d[e+308>>2]))==d[e+312>>2]&&!((0|a)>=(0|(E=a?a<<1:1)))){if(n=0,R=0,E&&(d[7717]=d[7717]+1,R=0|r[d[6606]](E<<2,16),a=d[e+308>>2]),(0|a)>=1)for(;d[(M=n<<2)+R>>2]=d[d[e+316>>2]+M>>2],(0|a)!=(0|(n=n+1|0)););(n=d[e+316>>2])&&(u[e+320|0]&&(n&&(d[7718]=d[7718]+1,r[d[6607]](n)),a=d[e+308>>2]),d[e+316>>2]=0),d[e+316>>2]=R,s[e+320|0]=1,d[e+312>>2]=E}d[d[e+316>>2]+(a<<2)>>2]=c,d[e+308>>2]=a+1,n=d[i+380>>2],D=m[n+20>>2],w=m[n+36>>2],F=m[n+40>>2],B=m[n+8>>2],N=m[n+24>>2],l=m[n+60>>2],G=m[n+56>>2],P=m[n+52>>2],L=m[n+44>>2],k=m[n+12>>2],f=m[n+28>>2],V=m[n+4>>2],g=m[o+60>>2],I=m[o+52>>2],j=m[o+56>>2],d[i+8>>2]=0,d[i+12>>2]=0,d[i+28>>2]=0,d[i>>2]=0,d[i+4>>2]=0,S=y(S+I),v=y(v+j),x=y(x+g),I=y(y(y(k*S)+y(f*v))+y(L*x)),g=f,f=y(-G),m[i+24>>2]=I+y(y(y(g*f)-y(k*P))-y(L*l)),m[i+20>>2]=y(y(y(S*B)+y(v*N))+y(x*F))+y(y(y(N*f)-y(B*P))-y(F*l)),m[i+16>>2]=y(y(y(S*V)+y(v*D))+y(x*w))+y(y(y(D*f)-y(V*P))-y(w*l)),n=d[i+352>>2],d[T>>2]=d[i+348>>2],d[T+4>>2]=n,n=d[i+360>>2],d[T+8>>2]=d[i+356>>2],d[T+12>>2]=n,s[i+116|0]=0,d[i+112>>2]=0,d[i+92>>2]=0,d[i+84>>2]=0,d[i+88>>2]=0,m[i+80>>2]=U,d[i+144>>2]=0,d[i+148>>2]=0,d[i+136>>2]=0,d[i+140>>2]=0,d[i+128>>2]=0,d[i+132>>2]=0,d[i+120>>2]=0,d[i+124>>2]=0,n=b(ks(c,i),184)+c|0,d[n+96>>2]=0,m[n+88>>2]=A(y(C(y(m[o+224>>2]*m[d[i+380>>2]+224>>2]),y(-10))),y(10)),a=d[o+56>>2],d[n+52>>2]=d[o+52>>2],d[n+56>>2]=a,a=d[o+64>>2],d[n+60>>2]=d[o+60>>2],d[n+64>>2]=a,d[n+48>>2]=0,m[n+44>>2]=x,m[n+40>>2]=v,m[n+36>>2]=S}As()}}if(!((0|(h=h+1|0))>2]))break}As(),O=i+464|0}(e,t),r[d[d[e>>2]+44>>2]](e),r[d[d[e>>2]+148>>2]](e),m[e+104>>2]=t,r[d[d[e>>2]+152>>2]](e,e+92|0),r[d[d[e>>2]+144>>2]](e,t),yr(18243),d[e+280>>2]>=1)for(;n=d[d[e+288>>2]+(i<<2)>>2],r[d[d[n>>2]+8>>2]](n,e,t),(0|(i=i+1|0))>2];);As(),r[d[d[e>>2]+156>>2]](e,t),(i=d[e+80>>2])&&r[i](e,t),As()}function Ar(e,t){var i,n=0;for(O=i=O-16|0,d[i+8>>2]=e,d[i+4>>2]=t,e=d[i+8>>2],d[i+12>>2]=e,n=e+48|0,t=e;d[12+(O-16|0)>>2]=t,(0|n)!=(0|(t=t+16|0)););t=d[i+4>>2],n=d[t+4>>2],d[e>>2]=d[t>>2],d[e+4>>2]=n,n=d[t+12>>2],d[e+8>>2]=d[t+8>>2],d[e+12>>2]=n,t=d[i+4>>2],n=d[t+20>>2],d[e+16>>2]=d[t+16>>2],d[e+20>>2]=n,n=d[t+28>>2],d[e+24>>2]=d[t+24>>2],d[e+28>>2]=n,t=d[i+4>>2],n=d[t+36>>2],d[e+32>>2]=d[t+32>>2],d[e+36>>2]=n,n=d[t+44>>2],d[e+40>>2]=d[t+40>>2],d[e+44>>2]=n,O=i+16|0}function Cr(e){var t,i=0,n=0,o=0,a=0;if(d[(e|=0)>>2]=10568,i=d[e+8>>2],(0|(t=d[i+8>>2]))>=1){for(;(n=d[8+(d[i+16>>2]+b(o,12)|0)>>2])&&(r[d[d[n>>2]>>2]](n),a=d[e+4>>2],r[d[d[a>>2]+60>>2]](a,n)),(0|t)!=(0|(o=o+1|0)););i=d[e+8>>2]}return fn(i),i=d[e+8>>2],r[d[d[i>>2]>>2]](i),(i=d[e+8>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),(i=d[e+24>>2])&&(u[e+28|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+24>>2]=0),d[e+24>>2]=0,s[e+28|0]=1,d[e+16>>2]=0,d[e+20>>2]=0,0|e}function Sr(e,t,i,n){for(var r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0;;){for(h=i,o=d[e+12>>2],_=d[o+((i+n|0)/2<<3)>>2],a=i,r=n;;)if(a=(i=a)+1|0,!(d[(s=(i<<3)+o|0)>>2]<(0|_))){for(l=r;l=(r=l)+-1|0,d[(c=(u=r<<3)+o|0)>>2]>(0|_););if((0|i)<=(0|r)&&(i=d[s>>2],r=d[s+4>>2],o=d[c+4>>2],d[s>>2]=d[c>>2],d[s+4>>2]=o,s=d[e+12>>2]+u|0,d[s>>2]=i,d[s+4>>2]=r,r=l,i=a),!((0|i)<=(0|r)))break;o=d[e+12>>2],a=i}if((0|r)>(0|h)&&Sr(e,t,h,r),!((0|i)<(0|n)))break}}function xr(e,t,i,n){var r=0,o=0;r=d[t+4>>2],d[e+292>>2]=d[t>>2],d[e+296>>2]=r,r=d[t+12>>2],d[e+300>>2]=d[t+8>>2],d[e+304>>2]=r,s[e+356|0]=1,o=d[t+4>>2],r=e+(d[e>>2]<<4)|0,d[r+4>>2]=d[t>>2],d[r+8>>2]=o,o=d[t+12>>2],d[r+12>>2]=d[t+8>>2],d[r+16>>2]=o,o=d[i+12>>2],t=(d[e>>2]<<4)+e|0,d[t+92>>2]=d[i+8>>2],d[t+96>>2]=o,r=d[i+4>>2],d[t+84>>2]=d[i>>2],d[t+88>>2]=r,r=d[n+12>>2],t=(d[e>>2]<<4)+e|0,d[t+172>>2]=d[n+8>>2],d[t+176>>2]=r,i=d[n+4>>2],d[t+164>>2]=d[n>>2],d[t+168>>2]=i,d[e>>2]=d[e>>2]+1}function Tr(e,t){var i,n=0,r=0,s=0,o=0,_=0;O=i=O-16|0,l(e);e:if((n=2147483647&(s=c(0)))>>>0<=1305022426){if(r=.6366197723675814*(o=+e)+6755399441055744-6755399441055744,g[t>>3]=o+-1.5707963109016418*r+-1.5893254773528196e-8*r,v(r)<2147483648){n=~~r;break e}n=-2147483648}else n>>>0>=2139095040?(g[t>>3]=y(e-e),n=0):(_=n,n=(n>>>23|0)-150|0,g[i+8>>3]=(a(0,_-(n<<23)|0),h()),n=function(e,t,i){var n,r,s,o,a,l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0,y=0,A=0,C=0,x=0,T=0;if(O=n=O-560|0,f=(c=i)+b(r=(0|(i=(i+-3|0)/24|0))>0?i:0,-24)|0,(0|(u=d[5760]))>=0)for(c=u+1|0,i=r;g[(n+320|0)+(h<<3)>>3]=(0|i)<0?0:+d[23056+(i<<2)>>2],i=i+1|0,(0|c)!=(0|(h=h+1|0)););for(y=f+-24|0,c=0,h=(0|u)>0?u:0;;){for(i=0,l=0;l+=g[(i<<3)+e>>3]*g[(n+320|0)+(c-i<<3)>>3],1!=(0|(i=i+1|0)););if(g[(c<<3)+n>>3]=l,i=(0|c)==(0|h),c=c+1|0,i)break}o=47-f|0,s=48-f|0,a=f+-25|0,c=u;t:{for(;;){if(l=g[(c<<3)+n>>3],i=0,h=c,!(m=(0|c)<1))for(;p=(n+480|0)+(i<<2)|0,A=l,_=v(l*=5.960464477539063e-8)<2147483648?~~l:-2147483648,_=v(A+=-16777216*(l=+(0|_)))<2147483648?~~A:-2147483648,d[p>>2]=_,l=g[((h=h+-1|0)<<3)+n>>3]+l,(0|c)!=(0|(i=i+1|0)););l=cs(l,y),l+=-8*S(.125*l),l-=+(0|(_=v(l)<2147483648?~~l:-2147483648));i:{n:{r:{if(x=(0|y)<1){if(y)break r;p=d[476+((c<<2)+n|0)>>2]>>23}else C=h=(c<<2)+n|0,h=(p=d[h+476>>2])-((i=p>>s)<>2]=h,_=i+_|0,p=h>>o;if((0|p)<1)break i;break n}if(p=2,!(l>=.5)){p=0;break i}}if(i=0,h=0,!m)for(;T=d[(C=(n+480|0)+(i<<2)|0)>>2],m=16777215,h||(m=16777216,T)?(d[C>>2]=m-T,h=1):h=0,(0|c)!=(0|(i=i+1|0)););n:if(!x){r:switch(0|a){case 0:d[476+(i=(c<<2)+n|0)>>2]=8388607&d[i+476>>2];break n;case 1:break r;default:break n}d[476+(i=(c<<2)+n|0)>>2]=4194303&d[i+476>>2]}_=_+1|0,2==(0|p)&&(l=1-l,p=2,h&&(l-=cs(1,y)))}if(0!=l)break;if(h=0,!((0|(i=c))<=(0|u))){for(;h=d[(n+480|0)+((i=i+-1|0)<<2)>>2]|h,(0|i)>(0|u););if(h){for(f=y;f=f+-24|0,!d[(n+480|0)+((c=c+-1|0)<<2)>>2];);break t}}for(i=1;h=i,i=i+1|0,!d[(n+480|0)+(u-h<<2)>>2];);for(h=c+h|0;;){for(_=c+1|0,c=c+1|0,g[(n+320|0)+(_<<3)>>3]=d[23056+(r+c<<2)>>2],i=0,l=0;l+=g[(i<<3)+e>>3]*g[(n+320|0)+(_-i<<3)>>3],1!=(0|(i=i+1|0)););if(g[(c<<3)+n>>3]=l,!((0|c)<(0|h)))break}c=h}(l=cs(l,0-y|0))>=16777216?(h=(n+480|0)+(c<<2)|0,A=l,i=v(l*=5.960464477539063e-8)<2147483648?~~l:-2147483648,e=v(l=A+-16777216*+(0|i))<2147483648?~~l:-2147483648,d[h>>2]=e,c=c+1|0):(i=v(l)<2147483648?~~l:-2147483648,f=y),d[(n+480|0)+(c<<2)>>2]=i}if(l=cs(1,f),!((0|c)<=-1)){for(i=c;g[(i<<3)+n>>3]=l*+d[(n+480|0)+(i<<2)>>2],l*=5.960464477539063e-8,e=(0|i)>0,i=i+-1|0,e;);if(m=0,!((0|c)<0))for(e=(0|u)>0?u:0,h=c;;){for(f=e>>>0>>0?e:m,y=c-h|0,i=0,l=0;l+=g[25824+(i<<3)>>3]*g[(i+h<<3)+n>>3],u=(0|i)!=(0|f),i=i+1|0,u;);if(g[(n+160|0)+(y<<3)>>3]=l,h=h+-1|0,i=(0|c)!=(0|m),m=m+1|0,!i)break}}if(l=0,(0|c)>=0)for(;l+=g[(n+160|0)+(c<<3)>>3],e=(0|c)>0,c=c+-1|0,e;);return g[t>>3]=p?-l:l,O=n+560|0,7&_}(i+8|0,i,n),r=g[i>>3],(0|s)<=-1?(g[t>>3]=-r,n=0-n|0):g[t>>3]=r);return O=i+16|0,n}function Er(e){var t=0,i=0,n=0,o=0,a=0,l=0,c=0,h=0,_=0;if(d[e+104>>2]>=1)for(;;){if(h=d[e+112>>2]+(a<<3)|0,n=d[h+4>>2],l=d[d[e+4>>2]+684>>2],(0|(i=d[l+60>>2]))>=1){for(o=0;;){if(c=0,_=d[l+68>>2]+(o<<2)|0,t=d[_>>2]){for(;i=d[t+280>>2],d[t+276>>2]==(0|n)?(d[(c?c+280|0:_)>>2]=i,ve(t)):c=t,t=i;);i=d[l+60>>2]}if(!((0|(o=o+1|0))<(0|i)))break}n=d[h+4>>2]}if(n&&r[d[d[n>>2]+4>>2]](n),!((0|(a=a+1|0))>2]))break}!function(e){var t=0;(t=d[e+12>>2])&&(u[e+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+12>>2]=0),d[e+12>>2]=0,s[e+16|0]=1,d[e+4>>2]=0,d[e+8>>2]=0,(t=d[e+32>>2])&&(u[e+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+32>>2]=0),d[e+32>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0,(t=d[e+52>>2])&&(u[e+56|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+52>>2]=0),d[e+52>>2]=0,s[e+56|0]=1,d[e+44>>2]=0,d[e+48>>2]=0,(t=d[e+72>>2])&&(u[e+76|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+72>>2]=0),d[e+72>>2]=0,s[e+76|0]=1,d[(e=e- -64|0)>>2]=0,d[e+4>>2]=0}(e+60|0)}function Rr(e,t,i,n){var r,s,o=0;O=r=O-160|0,d[r+156>>2]=t,d[r+152>>2]=i,m[r+148>>2]=n,t=d[r+152>>2],i=d[r+156>>2],m[r+124>>2]=ra(d[r+152>>2],i),zs(s=r+128|0,t,r+124|0),Ws(o=r+104|0,i,s),t=r+88|0,d[12+(O-16|0)>>2]=t,ps(r+72|0,d[r+152>>2],i),i=d[r+76>>2],d[t>>2]=d[r+72>>2],d[t+4>>2]=i,i=d[r+84>>2],d[t+8>>2]=d[r+80>>2],d[t+12>>2]=i,m[r+36>>2]=Uh(m[r+148>>2]),zs(i=r+40|0,o,r+36|0),js(o=r+56|0,s,i),m[r+12>>2]=Vh(m[r+148>>2]),zs(i=r+16|0,t,r+12|0),js(e,o,i),O=r+160|0}function Pr(e,t,i){var n,r=y(0),s=y(0),o=y(0);n=d[e+204>>2],t!=y(0)?(d[e+204>>2]=-2&n,r=y(y(1)/t)):d[e+204>>2]=1|n,m[e+344>>2]=r,d[e+376>>2]=0,m[e+364>>2]=m[e+380>>2]*t,m[e+372>>2]=m[e+388>>2]*t,m[e+368>>2]=m[e+384>>2]*t,t=m[i+8>>2],s=m[i+4>>2],o=m[i>>2],m[e+560>>2]=m[e+348>>2]*r,m[e+564>>2]=r*m[e+352>>2],m[e+568>>2]=r*m[e+356>>2],d[e+572>>2]=0,d[e+408>>2]=0,m[e+396>>2]=o!=y(0)?y(y(1)/o):y(0),m[e+400>>2]=s!=y(0)?y(y(1)/s):y(0),m[e+404>>2]=t!=y(0)?y(y(1)/t):y(0)}function Ir(e){var t,i=y(0),n=0,s=0,o=0,a=0,l=y(0),c=0,h=0;if((0|(t=d[e+732>>2]))>=1){for(h=d[e+740>>2];n=b(s,52)+h|0,o=d[n+8>>2],a=d[n+12>>2],i=y(m[o+8>>2]-m[a+8>>2]),l=y(i*i),i=y(m[o+12>>2]-m[a+12>>2]),l=y(l+y(i*i)),i=y(m[o+16>>2]-m[a+16>>2]),i=y(x(y(l+y(i*i)))),m[n+16>>2]=i,m[n+28>>2]=i*i,(0|t)!=(0|(s=s+1|0)););for(;n=b(c,52)+h|0,m[n+24>>2]=y(m[d[n+8>>2]+88>>2]+m[d[n+12>>2]+88>>2])/m[d[n+4>>2]+4>>2],(0|t)!=(0|(c=c+1|0)););}!function(e){var t=0,i=y(0),n=0,s=0,o=0,a=0,l=y(0),c=0,h=y(0),_=0,u=0,p=y(0),f=y(0),g=y(0),A=y(0);if((0|(c=d[e+752>>2]))>=1)for(u=d[e+760>>2];n=u+b(t,44)|0,a=d[n+12>>2],s=d[n+8>>2],i=m[s+8>>2],p=y(m[a+8>>2]-i),o=d[n+16>>2],l=m[s+12>>2],h=y(m[o+12>>2]-l),l=y(m[a+12>>2]-l),f=y(m[o+8>>2]-i),i=y(y(p*h)-y(l*f)),g=y(i*i),A=l,i=m[s+16>>2],l=y(m[o+16>>2]-i),i=y(m[a+16>>2]-i),h=y(y(A*l)-y(i*h)),i=y(y(i*f)-y(p*l)),m[n+36>>2]=x(y(g+y(y(h*h)+y(i*i)))),(0|c)!=(0|(t=t+1|0)););if((0|(n=d[e+712>>2]))<1)a=0;else if(d[7717]=d[7717]+1,t=n<<2,Mn(a=0|r[d[6606]](t,16),0,t),!((0|(n=d[e+712>>2]))<1))for(s=d[e+720>>2],t=0;d[92+(s+b(t,104)|0)>>2]=0,(0|n)!=(0|(t=t+1|0)););if((0|(c=d[e+752>>2]))>=1){for(t=d[e+720>>2],u=d[e+760>>2],n=0;s=b(n,44)+u|0,i=m[s+36>>2],o=d[s+8>>2],d[(_=((o-t|0)/104<<2)+a|0)>>2]=d[_>>2]+1,i=y(v(i)),m[o+92>>2]=i+m[o+92>>2],o=d[s+12>>2],d[(_=((o-t|0)/104<<2)+a|0)>>2]=d[_>>2]+1,m[o+92>>2]=i+m[o+92>>2],s=d[s+16>>2],d[(o=((s-t|0)/104<<2)+a|0)>>2]=d[o>>2]+1,m[s+92>>2]=i+m[s+92>>2],(0|c)!=(0|(n=n+1|0)););n=d[e+712>>2]}e:{if((0|n)>=1)for(t=0;(0|(s=d[(t<<2)+a>>2]))>=1?(o=d[e+720>>2]+b(t,104)|0,m[o+92>>2]=m[o+92>>2]/y(0|s)):d[92+(d[e+720>>2]+b(t,104)|0)>>2]=0,(0|n)!=(0|(t=t+1|0)););else if(!a)break e;a&&(d[7718]=d[7718]+1,r[d[6607]](a))}}(e)}function Mr(e){var t=0,i=0,n=0,o=0,a=0;if(d[(e|=0)>>2]=7456,t=d[e+16>>2],(0|(i=d[e+8>>2]))>=1)for(;a=d[(n<<2)+t>>2],(o=d[a+188>>2])&&(t=d[e+68>>2],t=0|r[d[d[t>>2]+36>>2]](t),r[d[d[t>>2]+40>>2]](t,o,d[e+24>>2]),t=d[e+68>>2],r[d[d[t>>2]+12>>2]](t,o,d[e+24>>2]),d[a+188>>2]=0,i=d[e+8>>2],t=d[e+16>>2]),(0|(n=n+1|0))<(0|i););return t&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+16>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,s[e+20|0]=1,0|e}function Dr(e){var t=0;return d[(e|=0)>>2]=10504,(t=d[e+60>>2])&&(u[e- -64|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+60>>2]=0),d[e+60>>2]=0,s[e- -64|0]=1,d[e+52>>2]=0,d[e+56>>2]=0,(t=d[e+40>>2])&&(u[e+44|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+40>>2]=0),d[e+40>>2]=0,s[e+44|0]=1,d[e+32>>2]=0,d[e+36>>2]=0,(t=d[e+16>>2])&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+16>>2]=0,s[e+20|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,0|e}function Or(e){var t=0;return d[(e|=0)>>2]=16848,(t=d[e- -64>>2])&&(u[e+68|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+64>>2]=0),d[e+64>>2]=0,s[e+68|0]=1,d[e+56>>2]=0,d[e+60>>2]=0,(t=d[e+44>>2])&&(u[e+48|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+44>>2]=0),d[e+44>>2]=0,s[e+48|0]=1,d[e+36>>2]=0,d[e+40>>2]=0,(t=d[e+16>>2])&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+16>>2]=0,s[e+20|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,0|e}function wr(e,t){var i;d[e>>2]=10732,d[(i=e)+4>>2]=31,d[i+8>>2]=0,d[i+72>>2]=0,d[i+76>>2]=1065353216,d[i+64>>2]=0,d[i+68>>2]=1,d[i+48>>2]=-581039253,d[i+52>>2]=-581039253,d[i+32>>2]=1566444395,d[i+36>>2]=1566444395,s[i+28|0]=1,d[i+24>>2]=0,d[i+88>>2]=0,d[i+80>>2]=1065353216,d[i+84>>2]=1065353216,d[i+56>>2]=-581039253,d[i+60>>2]=0,d[i+40>>2]=1566444395,d[i+44>>2]=0,d[i+16>>2]=0,d[i+20>>2]=0,t&&(d[7717]=d[7717]+1,ko(t=0|r[d[6606]](60,16)),d[e+64>>2]=t)}function Fr(e,t,i,n,r){d[e>>2]=20152,d[e+176>>2]=r,d[e+60>>2]=0,d[e+64>>2]=0,d[e+56>>2]=1017370378,m[e+52>>2]=n,d[e+8>>2]=t,d[e+168>>2]=16842752,d[e+172>>2]=0,d[e+12>>2]=i,d[e+44>>2]=1105933107,d[e+48>>2]=0,d[e+16>>2]=0,d[e+20>>2]=0,s[e+180|0]=1,d[e+24>>2]=1113325568,d[e+28>>2]=1092616192,s[e+181|0]=0,s[e+182|0]=0,d[e+36>>2]=1061752795,d[e+40>>2]=1060439283,d[e+108>>2]=0,s[e+144|0]=1,d[e+140>>2]=0,d[e+132>>2]=0,d[e+136>>2]=0,d[e+68>>2]=0,d[e+72>>2]=0}function Br(e){var t=0;return d[(e|=0)>>2]=22608,u[e+456|0]&&(t=d[e+452>>2],r[d[d[t>>2]>>2]](t),(t=d[e+452>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),(t=d[e+420>>2])&&(u[e+424|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+420>>2]=0),d[e+420>>2]=0,s[e+424|0]=1,d[e+412>>2]=0,d[e+416>>2]=0,(t=d[e+336>>2])&&(u[e+340|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+336>>2]=0),d[e+336>>2]=0,s[e+340|0]=1,d[e+328>>2]=0,d[e+332>>2]=0,Di(e),0|e}function Nr(e,t){e|=0;var i=0,n=0,s=0,o=0;(n=d[188+(t|=0)>>2])&&(i=d[e+68>>2],i=0|r[d[d[i>>2]+36>>2]](i),r[d[d[i>>2]+40>>2]](i,n,d[e+24>>2]),i=d[e+68>>2],r[d[d[i>>2]+12>>2]](i,n,d[e+24>>2]),d[t+188>>2]=0);e:if(!((0|(i=d[e+8>>2]))<1)){for(s=d[e+16>>2],n=0;;){if(d[(o=(n<<2)+s|0)>>2]!=(0|t)){if((0|i)!=(0|(n=n+1|0)))continue;break e}break}(0|n)>=(0|i)||(i=(n=i+-1|0)<<2,d[o>>2]=d[i+s>>2],d[i+d[e+16>>2]>>2]=t,d[e+8>>2]=n)}}function Lr(e,t){var i=y(0);if(d[e+20>>2]=0,d[e+24>>2]=0,s[e+28|0]=0,(i=m[e+4>>2])>=y(0)){if((t=Ji(y(t-m[e>>2]),y(6.2831854820251465)))y(3.1415927410125732)&&(t=y(t+y(-6.2831854820251465))),t>2]=1065353216,s[e+28|0]=1,void(m[e+20>>2]=-y(i+t));t>i&&(d[e+24>>2]=-1082130432,s[e+28|0]=1,m[e+20>>2]=i-t)}}function kr(e,t,i){e|=0,t|=0,i|=0;var n=y(0),s=y(0),o=y(0),a=y(0),l=y(0);r[d[d[t>>2]+68>>2]](e,t,i),y(r[d[d[t>>2]+48>>2]](t))!=y(0)&&(s=m[i+4>>2],n=m[i>>2],o=m[i+8>>2],a=y(r[d[d[t>>2]+48>>2]](t)),l=n=(t=y(y(y(n*n)+y(s*s))+y(o*o))>2]=m[e>>2]+y(a*y(l*n)),m[e+4>>2]=m[e+4>>2]+y(a*y(s*n)),m[e+8>>2]=m[e+8>>2]+y(a*y(o*n)))}function Vr(e,t){var i,n=y(0),r=0,s=0,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=0;if((0|(i=d[e>>2]))>=1)for(a=m[e+308>>2],l=m[t+8>>2],c=m[t+4>>2],h=m[t>>2];_=r,n=y(h-m[4+(r=(s<<4)+e|0)>>2]),o=y(n*n),n=y(c-m[r+8>>2]),o=y(o+y(n*n)),n=y(l-m[r+12>>2]),r=_|y(o+y(n*n))<=a,(0|i)!=(0|(s=s+1|0)););return m[t+12>>2]!=m[e+304>>2]|m[t+8>>2]!=m[e+300>>2]|m[t+4>>2]!=m[e+296>>2]|m[t>>2]!=m[e+292>>2]||(r=1),1&r}function Ur(e,t){var i,n=y(0),r=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,n=m[d[t+12>>2]+4>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],n=y(n*m[d[t+12>>2]>>2]),d[12+(t=O-16|0)>>2]=e+16,r=m[d[t+12>>2]+4>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],n=y(n+y(r*m[d[t+12>>2]+4>>2])),d[12+(t=O-16|0)>>2]=e+32,r=m[d[t+12>>2]+4>>2],d[12+(e=O-16|0)>>2]=d[i+8>>2],O=i+16|0,y(n+y(r*m[d[e+12>>2]+8>>2]))}function Gr(e,t){var i,n=y(0),r=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,n=m[d[t+12>>2]+8>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],n=y(n*m[d[t+12>>2]>>2]),d[12+(t=O-16|0)>>2]=e+16,r=m[d[t+12>>2]+8>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],n=y(n+y(r*m[d[t+12>>2]+4>>2])),d[12+(t=O-16|0)>>2]=e+32,r=m[d[t+12>>2]+8>>2],d[12+(e=O-16|0)>>2]=d[i+8>>2],O=i+16|0,y(n+y(r*m[d[e+12>>2]+8>>2]))}function jr(e,t,i,n,r){d[e>>2]=17764,d[e+4>>2]=d[t>>2],s[e+8|0]=r,d[e>>2]=22272,t=d[t>>2],s[e+88|0]=1,d[e- -64>>2]=0,d[e+60>>2]=t,d[e+12>>2]=22300,d[e+84>>2]=0,s[e+108|0]=1,d[e+76>>2]=0,d[e+80>>2]=0,d[e+104>>2]=0,s[e+128|0]=1,d[e+96>>2]=0,d[e+100>>2]=0,d[e+124>>2]=0,s[e+148|0]=1,d[e+116>>2]=0,d[e+120>>2]=0,d[e+144>>2]=0,d[e+136>>2]=0,d[e+140>>2]=0,d[e+16>>2]=d[(r?n:i)+8>>2],d[e+20>>2]=d[(r?i:n)+8>>2],Er(e+12|0)}function Wr(e,t){var i,n=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],n=d[t+4>>2],e=d[i+12>>2],d[e>>2]=d[t>>2],d[e+4>>2]=n,d[e+24>>2]=d[t+24>>2],n=d[t+20>>2],d[e+16>>2]=d[t+16>>2],d[e+20>>2]=n,n=d[t+12>>2],d[e+8>>2]=d[t+8>>2],d[e+12>>2]=n,Ar(e+28|0,d[i+8>>2]+28|0),t=d[i+8>>2],n=d[t+80>>2],d[e+76>>2]=d[t+76>>2],d[e+80>>2]=n,d[e+92>>2]=d[t+92>>2],n=d[t+88>>2],d[e+84>>2]=d[t+84>>2],d[e+88>>2]=n,O=i+16|0}function zr(e){var t,i,n=0,r=0,s=0,o=y(0);return O=t=O-16|0,r=n=d[e+12>>2],i=d[e+8>>2],(0|n)>0||(0|n)>=0&&!(i>>>0<0)?o=y(y(y(+(i>>>0)+4294967296*+(r>>>0))*y(0x10000000000000000))+y(+f[e>>2]+4294967296*+f[e+4>>2])):(s=d[e+4>>2],e=n=d[e>>2],d[t>>2]=0-e,d[t+4>>2]=0-(s+(0>>0)|0),r^=-1,(n=(e=!(e|s))+(s=-1^i)|0)>>>0>>0&&(r=r+1|0),d[(e=t)+8>>2]=n,d[e+12>>2]=r,o=y(-zr(e))),O=t+16|0,o}function Hr(e,t,i){var n,r=0;for(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=0,d[n+20>>2]=t,d[n+16>>2]=i,i=d[n+28>>2],d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)t=d[n+16>>2]+(d[n+12>>2]<<4)|0,d[12+(e=O-16|0)>>2]=16,d[e+8>>2]=t,t=d[i+12>>2]+(d[n+12>>2]<<4)|0,r=d[t+4>>2],e=d[e+8>>2],d[e>>2]=d[t>>2],d[e+4>>2]=r,r=d[t+12>>2],d[e+8>>2]=d[t+8>>2],d[e+12>>2]=r,d[n+12>>2]=d[n+12>>2]+1;O=n+32|0}function Xr(e,t){var i,n=y(0),r=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,n=m[d[t+12>>2]>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],n=y(n*m[d[t+12>>2]>>2]),d[12+(t=O-16|0)>>2]=e+16,r=m[d[t+12>>2]>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],n=y(n+y(r*m[d[t+12>>2]+4>>2])),d[12+(t=O-16|0)>>2]=e+32,r=m[d[t+12>>2]>>2],d[12+(e=O-16|0)>>2]=d[i+8>>2],O=i+16|0,y(n+y(r*m[d[e+12>>2]+8>>2]))}function Yr(e,t,i,n,r,s,o,a,l,c){var h;for(O=h=O-48|0,d[h+40>>2]=e,d[h+36>>2]=t,d[h+32>>2]=i,d[h+28>>2]=n,d[h+24>>2]=r,d[h+20>>2]=s,d[h+16>>2]=o,d[h+12>>2]=a,d[h+8>>2]=l,d[h+4>>2]=c,e=d[h+40>>2],d[h+44>>2]=e,i=e+48|0,t=e;d[12+(O-16|0)>>2]=t,(0|i)!=(0|(t=n=t+16|0)););vs(e,d[h+36>>2],d[h+32>>2],d[h+28>>2],d[h+24>>2],d[h+20>>2],d[h+16>>2],d[h+12>>2],d[h+8>>2],d[h+4>>2]),O=h+48|0}function Qr(e,t,i){var n=0,r=0,s=0,o=0;e:if(r=Xi(e,t))if((0|(s=d[e+8>>2]))>=0){if(!s)break e;for(;;){if(!(n=d[r+32>>2]))break e;if(r=n,(0|s)==(0|(o=o+1|0)))break}}else r=d[e>>2];else r=0;n=d[i+4>>2],d[t>>2]=d[i>>2],d[t+4>>2]=n,n=d[i+28>>2],d[t+24>>2]=d[i+24>>2],d[t+28>>2]=n,n=d[i+20>>2],d[t+16>>2]=d[i+16>>2],d[t+20>>2]=n,n=d[i+12>>2],d[t+8>>2]=d[i+8>>2],d[t+12>>2]=n,Tt(e,r,t)}function qr(e,t){e|=0,t|=0;var i=y(0),n=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);i=y(r[d[d[e>>2]+48>>2]](e)),n=y(r[d[d[e>>2]+48>>2]](e)),s=y(r[d[d[e>>2]+48>>2]](e)),o=m[e+16>>2],a=m[e+32>>2],l=m[e+20>>2],c=m[e+36>>2],h=m[e+12>>2],_=m[e+28>>2],Wa(e,t),d[e+40>>2]=0,m[e+36>>2]=y(y(y(s+c)/l)*m[e+20>>2])-s,m[e+32>>2]=y(y(y(n+a)/o)*m[e+16>>2])-n,m[e+28>>2]=y(y(y(i+_)/h)*m[e+12>>2])-i}function Kr(e,t){var i,n=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[i+4>>2]=d[d[t+12>>2]+4>>2],t=d[i+4>>2],d[12+(n=O-16|0)>>2]=e,d[d[n+12>>2]+8>>2]==(0|t)&&(d[12+(n=O-16|0)>>2]=e,t=d[d[n+12>>2]+4>>2],d[12+(n=O-16|0)>>2]=e,d[n+8>>2]=t,gs(t=e,n=d[n+8>>2]?d[n+8>>2]<<1:1)),Wr(d[e+12>>2]+b(d[e+4>>2],96)|0,d[i+8>>2]),d[e+4>>2]=d[e+4>>2]+1,O=i+16|0}function Zr(e,t,i){var n;O=n=O-32|0,d[n+28>>2]=t,d[n+24>>2]=i,d[12+(t=O-16|0)>>2]=d[n+28>>2],d[t+8>>2]=0,m[n+20>>2]=ra(d[t+12>>2]+(d[t+8>>2]<<4)|0,d[n+24>>2]),d[12+(t=O-16|0)>>2]=d[n+28>>2],d[t+8>>2]=1,m[n+16>>2]=ra(d[t+12>>2]+(d[t+8>>2]<<4)|0,d[n+24>>2]),d[12+(t=O-16|0)>>2]=d[n+28>>2],d[t+8>>2]=2,m[n+12>>2]=ra(d[t+12>>2]+(d[t+8>>2]<<4)|0,d[n+24>>2]),Zo(e,n+20|0,n+16|0,n+12|0),O=n+32|0}function $r(e,t){var i=0,n=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],n=d[t+4>>2],e=d[i+12>>2],d[e>>2]=d[t>>2],d[e+4>>2]=n,n=d[t+12>>2],d[e+8>>2]=d[t+8>>2],d[e+12>>2]=n,t=d[i+8>>2],n=d[t+20>>2],d[e+16>>2]=d[t+16>>2],d[e+20>>2]=n,n=d[t+28>>2],d[e+24>>2]=d[t+24>>2],d[e+28>>2]=n,t=d[i+8>>2],i=d[t+36>>2],d[e+32>>2]=d[t+32>>2],d[e+36>>2]=i,i=d[t+44>>2],d[e+40>>2]=d[t+40>>2],d[e+44>>2]=i}function Jr(e,t){d[e>>2]=17276,ko(e+4|0),ko(e- -64|0),s[e+193|0]=256,s[e+194|0]=1,s[e+192|0]=!t,d[e+164>>2]=0,d[e+140>>2]=0,d[e+144>>2]=0,d[e+176>>2]=0,d[e+168>>2]=0,d[e+172>>2]=0,d[e+156>>2]=10,d[e+160>>2]=1,d[e+148>>2]=1,d[e+152>>2]=0,t||(d[7717]=d[7717]+1,Zn(t=0|r[d[6606]](76,16))),d[e+188>>2]=0,d[e+136>>2]=t,d[e+180>>2]=0,d[e+184>>2]=0,d[e+124>>2]=0,d[e+128>>2]=0,d[e+132>>2]=0}function es(e,t){e|=0,t=y(t);var i=y(0),n=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0);i=y(r[d[d[e>>2]+48>>2]](e)),n=y(r[d[d[e>>2]+48>>2]](e)),s=y(r[d[d[e>>2]+48>>2]](e)),m[e+44>>2]=t,t=m[e+36>>2],o=m[e+32>>2],a=m[e+28>>2],l=y(r[d[d[e>>2]+48>>2]](e)),c=y(r[d[d[e>>2]+48>>2]](e)),h=y(r[d[d[e>>2]+48>>2]](e)),d[e+40>>2]=0,m[e+32>>2]=y(n+o)-c,m[e+28>>2]=y(i+a)-l,m[e+36>>2]=y(s+t)-h}function ts(e){return d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,s[e+88|0]=0,d[e+84>>2]=0,d[e+76>>2]=-1082130432,d[e+80>>2]=-1082130432,d[e+68>>2]=0,d[e+72>>2]=-1082130432,d[e+60>>2]=1065353216,d[e+64>>2]=1065353216,d[e>>2]=12932,d[e+52>>2]=0,d[e+56>>2]=1065353216,e}function is(e,t){var i,n;O=i=O+-64|0,d[i+60>>2]=e,d[i+56>>2]=t,t=d[i+60>>2],d[12+(e=O-16|0)>>2]=d[i+56>>2],d[i+52>>2]=d[d[e+12>>2]+4>>2],n=d[i+52>>2],d[(e=i+8|0)>>2]=0,d[e+4>>2]=0,d[e+40>>2]=0,d[e+32>>2]=0,d[e+36>>2]=0,d[e+24>>2]=0,d[e+28>>2]=0,d[e+16>>2]=0,d[e+20>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,function(e){var t;O=t=O-16|0,d[t+12>>2]=e,Oc(e=d[t+12>>2]),d[12+(O-16|0)>>2]=e+20,O=t+16|0}(e),function(e,t,i){var n,o=0;if(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,e=O-16|0,i=d[n+28>>2],d[e+12>>2]=i,d[n+16>>2]=d[d[e+12>>2]+4>>2],d[n+24>>2]>2])for(d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)d[n+12>>2]=d[n+12>>2]+1;else for(e=d[n+24>>2],d[12+(t=O-16|0)>>2]=i,(0|e)>d[d[t+12>>2]+4>>2]&&function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[d[t+12>>2]+8>>2]>2]&&(d[i+4>>2]=function(e,t){var i;return O=i=O-16|0,d[i+8>>2]=e,d[i+4>>2]=t,e=d[i+8>>2],d[i+4>>2]?d[i+12>>2]=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,d[i+4>>2]=0,e=b(d[i+8>>2],44),d[7717]=d[7717]+1,e=0|r[d[6606]](e,16),O=i+16|0,e}(e,d[i+4>>2]):d[i+12>>2]=0,O=i+16|0,d[i+12>>2]}(e,d[i+8>>2]),d[12+(t=O-16|0)>>2]=e,mr(e,d[d[t+12>>2]+4>>2],d[i+4>>2]),d[12+(t=O-16|0)>>2]=e,Ua(e,d[d[t+12>>2]+4>>2]),_l(e),s[e+16|0]=1,d[e+12>>2]=d[i+4>>2],d[e+8>>2]=d[i+8>>2]),O=i+16|0}(i,d[n+24>>2]),d[n+8>>2]=d[n+16>>2];d[n+8>>2]>2];)e=d[n+20>>2],o=d[e+4>>2],t=d[i+12>>2]+b(d[n+8>>2],44)|0,d[t>>2]=d[e>>2],d[t+4>>2]=o,d[t+40>>2]=d[e+40>>2],o=d[e+36>>2],d[t+32>>2]=d[e+32>>2],d[t+36>>2]=o,o=d[e+28>>2],d[t+24>>2]=d[e+24>>2],d[t+28>>2]=o,o=d[e+20>>2],d[t+16>>2]=d[e+16>>2],d[t+20>>2]=o,o=d[e+12>>2],d[t+8>>2]=d[e+8>>2],d[t+12>>2]=o,d[n+8>>2]=d[n+8>>2]+1;d[i+4>>2]=d[n+24>>2],O=n+32|0}(t,n,e),mr(d[i+56>>2],d[i+52>>2],d[t+12>>2]),O=i- -64|0}function ns(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0);l=y(r[d[d[e>>2]+48>>2]](e)),c=y(r[d[d[e>>2]+48>>2]](e)),h=y(r[d[d[e>>2]+48>>2]](e)),s=m[t+52>>2],o=m[t+56>>2],a=m[t+48>>2],d[i+12>>2]=0,m[i+8>>2]=o-h,m[i+4>>2]=s-c,m[i>>2]=a-l,s=m[t+52>>2],o=m[t+56>>2],a=m[t+48>>2],d[n+12>>2]=0,m[n+8>>2]=h+o,m[n+4>>2]=c+s,m[n>>2]=l+a}function rs(e,t){var i=y(0),n=y(0);if((i=m[e+32>>2])y(-1))return m[t>>2]=tn(y(-m[e+36>>2]),m[e+40>>2]),m[t+4>>2]=function(e){var t=0,i=0,n=y(0),r=0;e:{t:{if(l(e),(i=2147483647&(r=c(0)))>>>0>=1065353216){if(1065353216!=(0|i))break t;return y(1.5707963267948966*+e+752316384526264e-51)}if(i>>>0<=1056964607){if(i+-8388608>>>0<956301312)break e;return n=y(e*e),y(y(y(y(n*y(y(n*y(y(n*y(-.008656363002955914))+y(-.04274342209100723)))+y(.16666586697101593)))/y(y(n*y(-.7066296339035034))+y(1)))*e)+e)}return e=y(y(y(1)-y(v(e)))*y(.5)),t=x(+e),t+=t*+y(y(e*y(y(e*y(y(e*y(-.008656363002955914))+y(-.04274342209100723)))+y(.16666586697101593)))/y(y(e*y(-.7066296339035034))+y(1))),e=y(1.5707963267948966-(t+t)),(0|r)<0?y(-e):e}e=y(y(0)/y(e-e))}return e}(y(A(y(C(m[e+32>>2],y(-1))),y(1)))),void(m[t+8>>2]=tn(y(-m[e+16>>2]),m[e>>2]));i=m[e+20>>2],n=m[e+4>>2],d[t+4>>2]=-1077342245,m[t>>2]=-tn(n,i)}else i=m[e+20>>2],n=m[e+4>>2],d[t+4>>2]=1070141403,m[t>>2]=tn(n,i);m[t+8>>2]=0}function ss(e,t,i,n){var r;d[28+(r=O-32|0)>>2]=e,d[r+24>>2]=t,d[r+20>>2]=i,m[r+16>>2]=n,e=d[r+28>>2],m[r+12>>2]=y(1)-m[r+16>>2],m[e>>2]=y(m[r+12>>2]*m[d[r+24>>2]>>2])+y(m[r+16>>2]*m[d[r+20>>2]>>2]),m[e+4>>2]=y(m[r+12>>2]*m[d[r+24>>2]+4>>2])+y(m[r+16>>2]*m[d[r+20>>2]+4>>2]),m[e+8>>2]=y(m[r+12>>2]*m[d[r+24>>2]+8>>2])+y(m[r+16>>2]*m[d[r+20>>2]+8>>2])}function os(e){var t=0;d[e+12>>2]&&(d[e+4>>2]=0,(t=d[e+20>>2])&&(u[e+24|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+20>>2]=0),d[e+20>>2]=0,d[e+12>>2]=0,d[e+16>>2]=0,s[e+24|0]=1),d[e+40>>2]&&(d[e+32>>2]=0,(t=d[e+48>>2])&&(u[e+52|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+48>>2]=0),d[e+48>>2]=0,d[e+40>>2]=0,d[e+44>>2]=0,s[e+52|0]=1)}function as(e,t,i,n,s){for(var o=0,a=0;;){e:{if(!(p[s>>1]>1]|p[n>>1]>p[t+6>>1]|p[s+4>>1]>1]|p[n+4>>1]>p[t+10>>1]||p[s+2>>1]>1]|p[n+2>>1]>p[t+8>>1])){if((0|(o=d[t+12>>2]))<0)break e;r[d[d[i>>2]+8>>2]](i,o>>>21|0,2097151&o)}return}as(e,o=t+16|0,i,n,s),a=t+32|0,t=(0|(t=d[t+28>>2]))>-1?a:o-(t<<4)|0}}function ls(e,t){var i,n=y(0),r=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],n=m[e>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],n=y(n*m[d[t+12>>2]>>2]),r=m[e+4>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],n=y(n+y(r*m[d[t+12>>2]+4>>2])),r=m[e+8>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],O=i+16|0,y(y(n+y(r*m[d[t+12>>2]+8>>2]))+y(m[e+12>>2]*m[d[i+8>>2]+12>>2]))}function cs(e,t){e:if((0|t)>=1024){if(e*=898846567431158e293,(0|t)<2047){t=t+-1023|0;break e}e*=898846567431158e293,t=((0|t)<3069?t:3069)+-2046|0}else(0|t)>-1023||(e*=22250738585072014e-324,(0|t)>-2045?t=t+1022|0:(e*=22250738585072014e-324,t=((0|t)>-3066?t:-3066)+2044|0));return a(0,0),a(1,t+1023<<20),e*+o[0]}function hs(e,t,i){var n,r,s,o,a;O=n=O-32|0,d[n+28>>2]=t,d[n+24>>2]=i,s=d[n+24>>2],t=O-16|0,i=d[n+28>>2],d[t+12>>2]=i,d[t+8>>2]=0,o=d[t+12>>2]+(d[t+8>>2]<<4)|0,d[12+(t=O-16|0)>>2]=i,d[t+8>>2]=1,a=d[t+12>>2]+(d[t+8>>2]<<4)|0,d[12+(t=O-16|0)>>2]=i,d[t+8>>2]=2,function(e,t,i,n,r){var s;O=s=O-32|0,d[s+28>>2]=t,d[s+24>>2]=i,d[s+20>>2]=n,d[s+16>>2]=r,t=d[s+28>>2],m[s+12>>2]=ra(t,d[s+24>>2]),m[s+8>>2]=ra(t,d[s+20>>2]),m[s+4>>2]=ra(t,d[s+16>>2]),Zo(e,s+12|0,s+8|0,s+4|0),O=s+32|0}(r=n+8|0,s,o,a,d[t+12>>2]+(d[t+8>>2]<<4)|0),js(e,r,i+48|0),O=n+32|0}function _s(e,t,i,n){s[e+53|0]=1;e:if(d[e+4>>2]==(0|i)){if(s[e+52|0]=1,!(i=d[e+16>>2])){if(d[e+36>>2]=1,d[e+24>>2]=n,d[e+16>>2]=t,1!=(0|n)|1!=d[e+48>>2])break e;return void(s[e+54|0]=1)}if((0|t)==(0|i)){if(2==(0|(i=d[e+24>>2]))&&(d[e+24>>2]=n,i=n),1!=d[e+48>>2]|1!=(0|i))break e;return void(s[e+54|0]=1)}s[e+54|0]=1,d[e+36>>2]=d[e+36>>2]+1}}function ds(e,t,i,n,s,o,a,l){e|=0,t|=0,i|=0,n|=0,s|=0,o|=0,a|=0,l|=0;var c,h=y(0);return O=c=O-32|0,d[c+28>>2]=e,d[c+24>>2]=t,d[c+20>>2]=i,d[c+16>>2]=n,d[c+12>>2]=s,d[c+8>>2]=o,d[c+4>>2]=a,d[c>>2]=l,e=d[c+28>>2],h=y(r[d[d[e>>2]+12>>2]](e,d[c+24>>2],d[c+20>>2],d[c+16>>2],d[c+12>>2],d[c+8>>2],d[c+4>>2],d[c>>2])),O=c+32|0,y(h)}function us(e,t,i,n,o){var a=y(0);return d[e+32>>2]=i,d[e+28>>2]=t,d[e+24>>2]=n,d[e+20>>2]=o,d[e+4>>2]=0,d[e+8>>2]=1065353216,d[e>>2]=4548,d[e+12>>2]=0,d[e+16>>2]=0,d[e+36>>2]=d[t+4>>2],d[e+40>>2]=d[i+4>>2],m[e+44>>2]=r[d[d[t>>2]+48>>2]](t),a=y(r[d[d[i>>2]+48>>2]](i)),d[e+72>>2]=1,d[e+76>>2]=1,d[e+60>>2]=-1,s[e+52|0]=0,m[e+48>>2]=a,e}function ps(e,t,i){var n;O=n=O-32|0,d[n+28>>2]=t,d[n+24>>2]=i,t=d[n+28>>2],m[n+20>>2]=y(m[t+4>>2]*m[d[n+24>>2]+8>>2])-y(m[t+8>>2]*m[d[n+24>>2]+4>>2]),m[n+16>>2]=y(m[t+8>>2]*m[d[n+24>>2]>>2])-y(m[t>>2]*m[d[n+24>>2]+8>>2]),m[n+12>>2]=y(m[t>>2]*m[d[n+24>>2]+4>>2])-y(m[t+4>>2]*m[d[n+24>>2]>>2]),Zo(e,n+20|0,n+16|0,n+12|0),O=n+32|0}function fs(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[d[t+12>>2]+8>>2]>2]&&(d[i+4>>2]=ya(e,d[i+8>>2]),d[12+(t=O-16|0)>>2]=e,Fs(e,d[d[t+12>>2]+4>>2],d[i+4>>2]),d[12+(t=O-16|0)>>2]=e,Ua(e,d[d[t+12>>2]+4>>2]),_l(e),s[e+16|0]=1,d[e+12>>2]=d[i+4>>2],d[e+8>>2]=d[i+8>>2]),O=i+16|0}function ms(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[d[t+12>>2]+8>>2]>2]&&(d[i+4>>2]=ya(e,d[i+8>>2]),d[12+(t=O-16|0)>>2]=e,Ds(e,d[d[t+12>>2]+4>>2],d[i+4>>2]),d[12+(t=O-16|0)>>2]=e,Ua(e,d[d[t+12>>2]+4>>2]),_l(e),s[e+16|0]=1,d[e+12>>2]=d[i+4>>2],d[e+8>>2]=d[i+8>>2]),O=i+16|0}function gs(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[d[t+12>>2]+8>>2]>2]&&(d[i+4>>2]=function(e,t){var i;return O=i=O-16|0,d[i+8>>2]=e,d[i+4>>2]=t,e=d[i+8>>2],d[i+4>>2]?d[i+12>>2]=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,d[i+4>>2]=0,e=b(d[i+8>>2],96),d[7717]=d[7717]+1,e=0|r[d[6606]](e,16),O=i+16|0,e}(e,d[i+4>>2]):d[i+12>>2]=0,O=i+16|0,d[i+12>>2]}(e,d[i+8>>2]),d[12+(t=O-16|0)>>2]=e,Ps(e,d[d[t+12>>2]+4>>2],d[i+4>>2]),d[12+(t=O-16|0)>>2]=e,Ua(e,d[d[t+12>>2]+4>>2]),_l(e),s[e+16|0]=1,d[e+12>>2]=d[i+4>>2],d[e+8>>2]=d[i+8>>2]),O=i+16|0}function bs(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[d[t+12>>2]+8>>2]>2]&&(d[i+4>>2]=function(e,t){var i;return O=i=O-16|0,d[i+8>>2]=e,d[i+4>>2]=t,e=d[i+8>>2],d[i+4>>2]?d[i+12>>2]=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,d[i+4>>2]=0,e=b(d[i+8>>2],36),d[7717]=d[7717]+1,e=0|r[d[6606]](e,16),O=i+16|0,e}(e,d[i+4>>2]):d[i+12>>2]=0,O=i+16|0,d[i+12>>2]}(e,d[i+8>>2]),d[12+(t=O-16|0)>>2]=e,Rs(e,d[d[t+12>>2]+4>>2],d[i+4>>2]),d[12+(t=O-16|0)>>2]=e,ho(e,d[d[t+12>>2]+4>>2]),_l(e),s[e+16|0]=1,d[e+12>>2]=d[i+4>>2],d[e+8>>2]=d[i+8>>2]),O=i+16|0}function ys(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[d[t+12>>2]+8>>2]>2]&&(d[i+4>>2]=function(e,t){var i;return O=i=O-16|0,d[i+8>>2]=e,d[i+4>>2]=t,e=d[i+8>>2],d[i+4>>2]?d[i+12>>2]=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,d[i+4>>2]=0,e=d[i+8>>2]<<4,d[7717]=d[7717]+1,e=0|r[d[6606]](e,16),O=i+16|0,e}(e,d[i+4>>2]):d[i+12>>2]=0,O=i+16|0,d[i+12>>2]}(e,d[i+8>>2]),d[12+(t=O-16|0)>>2]=e,Hr(e,d[d[t+12>>2]+4>>2],d[i+4>>2]),d[12+(t=O-16|0)>>2]=e,Ua(e,d[d[t+12>>2]+4>>2]),_l(e),s[e+16|0]=1,d[e+12>>2]=d[i+4>>2],d[e+8>>2]=d[i+8>>2]),O=i+16|0}function vs(e,t,i,n,r,s,o,a,l,c){var h;O=h=O-48|0,d[h+44>>2]=e,d[h+40>>2]=t,d[h+36>>2]=i,d[h+32>>2]=n,d[h+28>>2]=r,d[h+24>>2]=s,d[h+20>>2]=o,d[h+16>>2]=a,d[h+12>>2]=l,d[h+8>>2]=c,Zo(e=d[h+44>>2],d[h+40>>2],d[h+36>>2],d[h+32>>2]),Zo(e+16|0,d[h+28>>2],d[h+24>>2],d[h+20>>2]),Zo(e+32|0,d[h+16>>2],d[h+12>>2],d[h+8>>2]),O=h+48|0}function As(){var e,t=0,i=0;O=e=O-16|0,t=d[6605],i=d[t+16>>2]+-1|0,d[t+16>>2]=i;e:{t:{if(!i){if(!d[t+4>>2])break t;R(e+8|0,0),i=d[7705],m[t+8>>2]=m[t+8>>2]+y(y(((d[e+12>>2]+b(d[e+8>>2]-d[i>>2]|0,1e6)|0)-d[i+4>>2]|0)-d[t+12>>2]>>>0)/y(1e3)),i=d[t+16>>2]}if(i)break e;t=d[6605]}d[6605]=d[t+20>>2]}O=e+16|0}function Cs(e){var t;return O=t=O-16|0,m[t+8>>2]=e,m[t+8>>2]=function(e){var t;return O=t=O-16|0,m[t+12>>2]=e,m[t+8>>2]=6.2831854820251465,e=Ji(m[t+12>>2],m[t+8>>2]),O=t+16|0,e}(m[t+8>>2]),m[t+8>>2]>2]=m[t+8>>2]+y(6.2831854820251465):m[t+8>>2]>y(3.1415927410125732)?m[t+12>>2]=m[t+8>>2]-y(6.2831854820251465):m[t+12>>2]=m[t+8>>2],O=t+16|0,m[t+12>>2]}function Ss(e,t,i,n,o){var a;d[e>>2]=17764,d[e+4>>2]=d[t>>2],d[e>>2]=5076,s[e+8|0]=o,d[e>>2]=6364,t=d[t>>2],d[e- -64>>2]=0,d[e+60>>2]=t,d[e+12>>2]=6392,a=o?i:n,d[e+20>>2]=a,i=o?n:i,d[e+16>>2]=i,t=0|r[d[d[t>>2]+12>>2]](t,d[i+8>>2],d[a+8>>2]),d[e+76>>2]=t,e=d[e+60>>2],r[d[d[e>>2]+20>>2]](e,t)}function xs(e,t){var i=0,n=0,r=0,s=0;e:if(!((0|(i=d[e+488>>2]))<1)){for(r=d[e+496>>2];;){if(d[(s=(n<<2)+r|0)>>2]!=(0|t)){if((0|(n=n+1|0))!=(0|i))continue;break e}break}(0|n)>=(0|i)||(n=(i=i+-1|0)<<2,d[s>>2]=d[n+r>>2],d[n+d[e+496>>2]>>2]=t,d[e+488>>2]=i)}d[e+256>>2]=(0|i)>0}function Ts(e,t){var i=y(0),n=0,r=y(0),s=y(0),o=y(0);(i=m[e+344>>2])!=y(0)&&(r=m[t>>2],s=m[t+4>>2],o=m[t+8>>2],d[e+376>>2]=0,i=y(y(1)/i),m[e+372>>2]=o*i,m[e+368>>2]=i*s,m[e+364>>2]=i*r),n=d[t+4>>2],d[e+380>>2]=d[t>>2],d[e+384>>2]=n,n=d[t+12>>2],d[e+388>>2]=d[t+8>>2],d[e+392>>2]=n}function Es(e,t,i){var n;for(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=0,d[n+20>>2]=t,d[n+16>>2]=i,e=d[n+28>>2],d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)Mi(d[n+16>>2]+b(d[n+12>>2],104)|0,d[e+12>>2]+b(d[n+12>>2],104)|0,104),d[n+12>>2]=d[n+12>>2]+1;O=n+32|0}function Rs(e,t,i){var n;for(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=0,d[n+20>>2]=t,d[n+16>>2]=i,e=d[n+28>>2],d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)lo(d[n+16>>2]+b(d[n+12>>2],36)|0,d[e+12>>2]+b(d[n+12>>2],36)|0),d[n+12>>2]=d[n+12>>2]+1;O=n+32|0}function Ps(e,t,i){var n;for(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=0,d[n+20>>2]=t,d[n+16>>2]=i,e=d[n+28>>2],d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)Wr(d[n+16>>2]+b(d[n+12>>2],96)|0,d[e+12>>2]+b(d[n+12>>2],96)|0),d[n+12>>2]=d[n+12>>2]+1;O=n+32|0}function Is(e){var t=0;(t=d[e>>2])&&Ca(e,t),(t=d[e+4>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+4>>2]=0,d[e+8>>2]=-1,(t=d[e+32>>2])&&(u[e+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+32>>2]=0),d[e+32>>2]=0,d[e+16>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0}function Ms(e,t,i,n,r,o,a,l,c){return d[e+72>>2]=1,d[e+76>>2]=1,d[e+60>>2]=-1,s[e+52|0]=0,m[e+48>>2]=a,m[e+44>>2]=o,d[e+40>>2]=r,d[e+36>>2]=n,d[e+32>>2]=i,d[e+28>>2]=t,d[e+24>>2]=l,d[e+20>>2]=c,d[e+4>>2]=0,d[e+8>>2]=1065353216,d[e>>2]=4548,d[e+12>>2]=0,d[e+16>>2]=0,e}function Ds(e,t,i){var n;for(d[28+(n=O-32|0)>>2]=e,d[n+24>>2]=0,d[n+20>>2]=t,d[n+16>>2]=i,e=d[n+28>>2],d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)m[d[n+16>>2]+(d[n+12>>2]<<2)>>2]=m[d[e+12>>2]+(d[n+12>>2]<<2)>>2],d[n+12>>2]=d[n+12>>2]+1}function Os(e,t,i,n,r){var s=y(0);if(s=y(1),!(t>i)&&(s=y(0),t!=i)){if((n=y(n/r))=t^1|y(t-n)>e^1?y(ey(0)){if(!(e<=i^1|y(i-n)i?0:1)}}return s}function ws(e,t,i){var n,r,s=0;O=n=O-16|0,d[n+12>>2]=t,d[n+8>>2]=i,i=O-16|0,t=d[n+12>>2],d[i+12>>2]=t,i=d[i+12>>2]+(d[n+8>>2]<<2)|0,d[12+(s=O-16|0)>>2]=t+16,s=d[s+12>>2]+(d[n+8>>2]<<2)|0,d[12+(r=O-16|0)>>2]=t+32,Zo(e,i,s,d[r+12>>2]+(d[n+8>>2]<<2)|0),O=n+16|0}function Fs(e,t,i){var n;for(d[28+(n=O-32|0)>>2]=e,d[n+24>>2]=0,d[n+20>>2]=t,d[n+16>>2]=i,e=d[n+28>>2],d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)d[d[n+16>>2]+(d[n+12>>2]<<2)>>2]=d[d[e+12>>2]+(d[n+12>>2]<<2)>>2],d[n+12>>2]=d[n+12>>2]+1}function Bs(e,t,i,n,r,s,o,a,l,c){t|=0,i|=0,n|=0,r|=0,s|=0,o|=0,a|=0,l|=0,c|=0,e=d[32+(e|=0)>>2]+(c<<5)|0,d[i>>2]=d[e+12>>2],d[t>>2]=d[e+16>>2],d[n>>2]=d[e+28>>2],d[r>>2]=d[e+20>>2],d[a>>2]=d[e>>2],d[s>>2]=d[e+4>>2],d[o>>2]=d[e+8>>2],d[l>>2]=d[e+24>>2]}function Ns(e,t,i,n,s,o){var a;e|=0,t|=0,i|=0,n=y(n),s|=0,o|=0,O=a=O-32|0,d[a+28>>2]=e,d[a+24>>2]=t,d[a+20>>2]=i,m[a+16>>2]=n,d[a+12>>2]=s,d[a+8>>2]=o,e=d[a+28>>2],r[d[d[e>>2]+32>>2]](e,d[a+24>>2],d[a+20>>2],m[a+16>>2],d[a+12>>2],d[a+8>>2]),O=a+32|0}function Ls(e,t,i,n){var r=0;d[e>>2]=7324,r=d[t+4>>2],d[e+4>>2]=d[t>>2],d[e+8>>2]=r,r=d[t+12>>2],d[e+12>>2]=d[t+8>>2],d[e+16>>2]=r,t=d[i+4>>2],d[e+20>>2]=d[i>>2],d[e+24>>2]=t,t=d[i+12>>2],d[e+28>>2]=d[i+8>>2],d[e+32>>2]=t,d[e+40>>2]=1065353216,d[e+36>>2]=n}function ks(e,t){var i=0,n=0,s=0,o=0;e:if(4!=(0|(i=d[e+748>>2])))d[e+748>>2]=i+1;else{if(i=function(e,t){var i,n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),d=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=0,T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=0,U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0);V=(x=(n=m[e+84>>2])<(r=m[t+80>>2]))?0:-1,i=(x=(o=m[e+268>>2])<(n=x?n:r))?1:V,x=(r=m[e+452>>2])<(n=x?o:n),x=(V=m[e+636>>2]<(x?r:n))?3:x?2:i,c=m[t>>2];t:{i:{n:{r:{if(u[26408]){if(!x){b=m[e+564>>2],T=m[e+380>>2],a=y(b-T),S=m[e+560>>2],E=m[e+376>>2],o=y(S-E),s=m[e+556>>2],M=m[e+372>>2],d=y(s-M),n=m[t+8>>2],r=m[t+4>>2];break r}if(l=m[e+188>>2],h=y(c-l),S=m[e+560>>2],E=m[e+376>>2],o=y(S-E),r=m[t+4>>2],f=m[e+192>>2],n=y(r-f),s=m[e+556>>2],M=m[e+372>>2],d=y(s-M),a=y(y(h*o)-y(n*d)),_=y(a*a),b=m[e+564>>2],T=m[e+380>>2],a=y(b-T),p=y(n*a),n=m[t+8>>2],R=m[e+196>>2],A=y(n-R),C=y(p-y(A*o)),h=y(y(A*d)-y(h*a)),H=y(_+y(y(C*C)+y(h*h))),1!=(0|x))break r;c=y(c-m[e+4>>2]),n=y(n-m[e+12>>2]),r=y(r-m[e+8>>2]),d=y(0);break n}s:{o:{if(x){if(w=m[e+188>>2],S=y(c-w),f=m[e+376>>2],A=m[e+560>>2],I=y(f-A),E=m[t+4>>2],F=m[e+192>>2],b=y(E-F),l=m[e+372>>2],C=m[e+556>>2],D=y(l-C),n=y(y(S*I)-y(b*D)),r=y(n*n),R=m[e+380>>2],h=m[e+564>>2],d=y(R-h),T=m[t+8>>2],s=m[e+196>>2],M=y(T-s),n=y(y(b*d)-y(M*I)),o=y(n*n),n=y(y(M*D)-y(S*d)),o=y(r+y(o+y(n*n))),a=y(c-l),O=y(F-A),n=y(E-f),U=y(w-C),r=y(y(a*O)-y(n*U)),_=y(r*r),G=y(s-h),r=y(T-R),p=y(y(n*G)-y(r*O)),g=y(p*p),p=y(y(r*U)-y(a*G)),p=o>(p=y(_+y(g+y(p*p))))?o:p,o=y(F-f),L=y(c-C),g=y(w-l),N=y(E-A),P=y(y(o*L)-y(g*N)),B=y(P*P),P=y(s-R),_=o,o=y(T-h),_=y(y(P*N)-y(_*o)),g=y(y(g*o)-y(P*L)),H=p>(g=y(B+y(y(_*_)+y(g*g))))?p:g,1==(0|x)){p=m[e+4>>2],j=y(p-C),_=y(c-p),g=m[e+12>>2],W=y(g-h),P=m[e+8>>2],z=y(P-A),B=y(T-g),k=y(E-P),d=y(0);break o}}else R=m[e+380>>2],h=m[e+564>>2],d=y(R-h),f=m[e+376>>2],A=m[e+560>>2],I=y(f-A),l=m[e+372>>2],C=m[e+556>>2],D=y(l-C),T=m[t+8>>2],o=y(T-h),E=m[t+4>>2],N=y(E-A),L=y(c-C),r=y(T-R),n=y(E-f),a=y(c-l);if(p=m[e+4>>2],_=y(c-p),P=m[e+8>>2],k=y(E-P),s=y(y(_*I)-y(k*D)),b=y(s*s),g=m[e+12>>2],B=y(T-g),s=y(y(k*d)-y(B*I)),d=y(y(B*D)-y(_*d)),d=y(b+y(y(s*s)+y(d*d))),z=y(P-A),j=y(p-C),s=y(y(a*z)-y(n*j)),b=y(s*s),W=y(g-h),s=y(y(n*W)-y(r*z)),S=y(s*s),s=y(y(r*j)-y(a*W)),d=d>(s=y(b+y(S+y(s*s))))?d:s,I=y(P-f),D=y(p-l),s=y(y(I*L)-y(D*N)),b=y(s*s),O=y(g-R),s=y(y(O*N)-y(I*o)),S=y(s*s),s=y(y(D*o)-y(O*L)),d=d>(s=y(b+y(S+y(s*s))))?d:s,s=m[e+196>>2],M=y(T-s),F=m[e+192>>2],b=y(E-F),w=m[e+188>>2],S=y(c-w),2==(0|x)){h=y(g-s),A=y(P-F),C=y(p-w),o=y(0);break s}G=y(s-h),O=y(F-A),U=y(w-C)}if(n=y(y(_*O)-y(k*U)),r=y(n*n),n=y(y(k*G)-y(B*O)),a=y(n*n),n=y(y(B*U)-y(_*G)),n=y(r+y(a+y(n*n))),r=y(y(S*z)-y(b*j)),a=y(r*r),r=y(y(b*W)-y(M*z)),h=y(r*r),r=y(y(M*j)-y(S*W)),n=n>(r=y(a+y(h+y(r*r))))?n:r,A=y(P-F),C=y(p-w),r=y(y(A*L)-y(C*N)),a=y(r*r),h=y(g-s),r=y(y(h*N)-y(A*o)),I=y(r*r),r=y(y(C*o)-y(h*L)),o=n>(r=y(a+y(I+y(r*r))))?n:r,a=y(0),V)break t;O=y(g-R),I=y(P-f),D=y(p-l),r=y(T-R),n=y(E-f),a=y(c-l)}c=y(F-f),l=y(w-l),f=y(y(_*c)-y(k*l)),p=y(f*f),f=y(s-R),c=y(y(k*f)-y(B*c)),s=y(c*c),c=y(y(B*l)-y(_*f)),c=y(p+y(s+y(c*c))),l=y(y(S*I)-y(b*D)),_=y(l*l),l=y(y(b*O)-y(M*I)),s=y(l*l),l=y(y(M*D)-y(S*O)),c=c>(l=y(_+y(s+y(l*l))))?c:l,l=y(y(A*a)-y(C*n)),n=y(y(h*n)-y(A*r)),_=y(n*n),n=y(y(C*r)-y(h*a)),a=c>(n=y(y(l*l)+y(_+y(n*n))))?c:n;break t}if(c=y(c-m[e+4>>2]),r=y(r-m[e+8>>2]),l=y(y(c*o)-y(r*d)),n=y(n-m[e+12>>2]),o=y(y(r*a)-y(n*o)),_=y(o*o),o=y(y(n*d)-y(c*a)),d=y(y(l*l)+y(_+y(o*o))),R=m[e+196>>2],f=m[e+192>>2],l=m[e+188>>2],o=y(0),2==(0|x))break i}if(o=y(S-f),a=y(s-l),h=y(y(c*o)-y(r*a)),_=y(h*h),h=y(b-R),o=y(y(r*h)-y(n*o)),s=y(o*o),o=y(y(n*a)-y(c*h)),o=y(_+y(s+y(o*o))),a=y(0),V)break t}a=y(E-f),l=y(M-l),f=y(y(c*a)-y(r*l)),_=r,r=y(T-R),a=y(y(_*r)-y(n*a)),n=y(y(n*l)-y(c*r)),a=y(y(f*f)+y(y(a*a)+y(n*n)))}return t=(e=(n=y(v(H)))>y(-0xde0b6b000000000))?0:-1,t=(e=(r=y(v(d)))>(n=e?n:y(-0xde0b6b000000000)))?1:t,e=(o=y(v(o)))>(n=e?r:n),y(v(a))>(e?o:n)?3:e?2:t}(e,t),n=b(i,184)+e|0,!(s=d[n+116>>2]))break e;if(!(o=d[6734]))break e;r[o](s),d[n+116>>2]=0}return Mi(4+((n=e)+b(e=(0|i)>0?i:0,184)|0)|0,t,184),e}function Vs(e,t,i){var n;O=n=O-48|0,d[n+44>>2]=e,d[n+40>>2]=t,d[n+36>>2]=i,e=d[n+44>>2],m[e+344>>2]!=y(0)&&(Pa(e,d[n+40>>2]),d[12+(t=O-16|0)>>2]=e+544,d[t+12>>2]&&(t=d[n+36>>2],Gs(n,d[n+40>>2],e+348|0),ps(i=n+16|0,t,n),Ra(e,i))),O=n+48|0}function Us(e,t){var i,n;O=i=O-128|0,d[i+124>>2]=e,d[i+120>>2]=t,e=d[i+124>>2],d[12+(t=O-16|0)>>2]=d[i+120>>2],d[i+116>>2]=d[d[t+12>>2]+4>>2],n=d[i+116>>2],Mn(t=i+8|0,0,104),function(e){var t;O=t=O-16|0,d[t+12>>2]=e,Oc(e=d[t+12>>2]),d[12+(O-16|0)>>2]=e+8,d[12+(O-16|0)>>2]=e+24,d[12+(O-16|0)>>2]=e+40,d[12+(O-16|0)>>2]=e+56,d[12+(O-16|0)>>2]=e+72,O=t+16|0}(t),function(e,t,i){var n;if(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,t=O-16|0,e=d[n+28>>2],d[t+12>>2]=e,d[n+16>>2]=d[d[t+12>>2]+4>>2],d[n+24>>2]>2])for(d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)d[n+12>>2]=d[n+12>>2]+1;else for(t=d[n+24>>2],d[12+(i=O-16|0)>>2]=e,(0|t)>d[d[i+12>>2]+4>>2]&&function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[d[t+12>>2]+8>>2]>2]&&(d[i+4>>2]=function(e,t){var i;return O=i=O-16|0,d[i+8>>2]=e,d[i+4>>2]=t,e=d[i+8>>2],d[i+4>>2]?d[i+12>>2]=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,d[i+4>>2]=0,e=b(d[i+8>>2],104),d[7717]=d[7717]+1,e=0|r[d[6606]](e,16),O=i+16|0,e}(e,d[i+4>>2]):d[i+12>>2]=0,O=i+16|0,d[i+12>>2]}(e,d[i+8>>2]),d[12+(t=O-16|0)>>2]=e,Es(e,d[d[t+12>>2]+4>>2],d[i+4>>2]),d[12+(t=O-16|0)>>2]=e,Ua(e,d[d[t+12>>2]+4>>2]),_l(e),s[e+16|0]=1,d[e+12>>2]=d[i+4>>2],d[e+8>>2]=d[i+8>>2]),O=i+16|0}(e,d[n+24>>2]),d[n+8>>2]=d[n+16>>2];d[n+8>>2]>2];)Mi(d[e+12>>2]+b(d[n+8>>2],104)|0,d[n+20>>2],104),d[n+8>>2]=d[n+8>>2]+1;d[e+4>>2]=d[n+24>>2],O=n+32|0}(e,n,t),Es(d[i+120>>2],d[i+116>>2],d[e+12>>2]),O=i+128|0}function Gs(e,t,i){var n;O=n=O-32|0,d[n+28>>2]=t,d[n+24>>2]=i,m[n+20>>2]=m[d[n+28>>2]>>2]*m[d[n+24>>2]>>2],m[n+16>>2]=m[d[n+28>>2]+4>>2]*m[d[n+24>>2]+4>>2],m[n+12>>2]=m[d[n+28>>2]+8>>2]*m[d[n+24>>2]+8>>2],Zo(e,n+20|0,n+16|0,n+12|0),O=n+32|0}function js(e,t,i){var n;O=n=O-32|0,d[n+28>>2]=t,d[n+24>>2]=i,m[n+20>>2]=m[d[n+28>>2]>>2]+m[d[n+24>>2]>>2],m[n+16>>2]=m[d[n+28>>2]+4>>2]+m[d[n+24>>2]+4>>2],m[n+12>>2]=m[d[n+28>>2]+8>>2]+m[d[n+24>>2]+8>>2],Zo(e,n+20|0,n+16|0,n+12|0),O=n+32|0}function Ws(e,t,i){var n;O=n=O-32|0,d[n+28>>2]=t,d[n+24>>2]=i,m[n+20>>2]=m[d[n+28>>2]>>2]-m[d[n+24>>2]>>2],m[n+16>>2]=m[d[n+28>>2]+4>>2]-m[d[n+24>>2]+4>>2],m[n+12>>2]=m[d[n+28>>2]+8>>2]-m[d[n+24>>2]+8>>2],Zo(e,n+20|0,n+16|0,n+12|0),O=n+32|0}function zs(e,t,i){var n;O=n=O-32|0,d[n+28>>2]=t,d[n+24>>2]=i,m[n+20>>2]=m[d[n+28>>2]>>2]*m[d[n+24>>2]>>2],m[n+16>>2]=m[d[n+28>>2]+4>>2]*m[d[n+24>>2]>>2],m[n+12>>2]=m[d[n+28>>2]+8>>2]*m[d[n+24>>2]>>2],Zo(e,n+20|0,n+16|0,n+12|0),O=n+32|0}function Hs(){var e;return O=e=O-16|0,1&s[29868]||mc(29868)&&(d[e+8>>2]=0,d[e+12>>2]=0,d[e>>2]=0,d[e+4>>2]=0,Pn(29252,e),uh(29868)),d[e+8>>2]=0,d[e+12>>2]=0,d[e>>2]=0,d[e+4>>2]=0,Pr(29252,y(0),e),O=e+16|0,29252}function Xs(e,t,i,n,r,s){var o;e|=0,t|=0,i|=0,n|=0,r|=0,s=y(s),O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,d[o+12>>2]=r,m[o+8>>2]=s,Ae(d[o+28>>2],d[o+24>>2],d[o+20>>2],d[o+16>>2],d[o+12>>2],m[o+8>>2]),O=o+32|0}function Ys(e,t,i){var n;O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,t=O-16|0,e=d[n+12>>2],d[t+12>>2]=e,d[d[t+12>>2]>>2]=1588,d[e>>2]=1504,oo(e+4|0,d[n+8>>2]),oo(e+68|0,d[n+4>>2]),oo(e+132|0,d[n+8>>2]),d[e+196>>2]=0,O=n+16|0}function Qs(e){s[e+356|0]=1,d[e>>2]=0,s[e+312|0]=0,d[e+292>>2]=1566444395,d[e+296>>2]=1566444395,d[e+336>>2]=0,d[e+340>>2]=0,d[e+300>>2]=1566444395,d[e+304>>2]=0,d[e+344>>2]=0,d[e+348>>2]=0,s[e+352|0]=0,s[e+332|0]=240&u[e+332|0]}function qs(e,t){var i;O=i=O-32|0,e=d[e+928>>2],d[i+24>>2]=1065353216,d[i+28>>2]=0,d[i+16>>2]=1065353216,d[i+20>>2]=0,d[i+8>>2]=1065353216,d[i+12>>2]=0,d[i>>2]=1065353216,d[i+4>>2]=1065353216,Jt(t,e,0,i+16|0,i,0,-1),O=i+32|0}function Ks(e,t,i,n){var r;O=r=O-32|0,d[r+24>>2]=0,d[r+28>>2]=0,d[r+16>>2]=0,d[r+20>>2]=0,d[r+8>>2]=0,d[r+12>>2]=0,d[r>>2]=0,d[r+4>>2]=0,u[e+60|0]?Ne(e,t,i,n,r+16|0,r,d[e+56>>2]):ht(e,t,i,n,r+16|0,r),O=r+32|0}function Zs(e,t,i,n,r){d[e>>2]=17764,d[e+4>>2]=d[t>>2],d[e>>2]=5076,s[e+24|0]=1,d[e>>2]=10356,d[e+20>>2]=0,s[e+28|0]=r,d[e+12>>2]=0,d[e+16>>2]=0,t=d[t+4>>2],s[e+36|0]=0,d[e+32>>2]=t,d[e+40>>2]=d[d[(r?n:i)+4>>2]+68>>2],en(e,i,n)}function $s(e,t,i,n){!function(e,t){d[e+4>>2]=35,d[e+8>>2]=0,d[e+12>>2]=0,d[e>>2]=14720,d[e+48>>2]=t,d[e>>2]=12324,d[e+4>>2]=21,r[d[d[t>>2]+40>>2]](t)?r[d[d[t>>2]+48>>2]](t,e+16|0,e+32|0):Wi(e)}(e,t),s[e+61|0]=0,s[e+60|0]=i,d[e+52>>2]=0,d[e+56>>2]=0,d[e>>2]=11692,d[e+4>>2]=21,n&&(d[7717]=d[7717]+1,i=nd(t=0|r[d[6606]](172,16)),d[e+52>>2]=t,oe(i,d[e+48>>2],u[e+60|0],e+16|0,e+32|0),s[e+61|0]=1)}function Js(e,t,i,n){e|=0,i|=0,n|=0,e=d[20+(t|=0)>>2],d[i>>2]=d[t+16>>2],d[i+4>>2]=e,e=d[t+28>>2],d[i+8>>2]=d[t+24>>2],d[i+12>>2]=e,e=d[t+44>>2],d[n+8>>2]=d[t+40>>2],d[n+12>>2]=e,e=d[t+36>>2],d[n>>2]=d[t+32>>2],d[n+4>>2]=e}function eo(e,t,i,n,r){var s;d[28+(s=O-32|0)>>2]=e,d[s+24>>2]=t,d[s+20>>2]=i,d[s+16>>2]=n,d[s+12>>2]=r,e=d[s+28>>2],m[e>>2]=m[d[s+24>>2]>>2],m[e+4>>2]=m[d[s+20>>2]>>2],m[e+8>>2]=m[d[s+16>>2]>>2],m[e+12>>2]=m[d[s+12>>2]>>2]}function to(e,t){var i;return d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],m[e>>2]=m[e>>2]*m[d[i+8>>2]>>2],m[e+4>>2]=m[e+4>>2]*m[d[i+8>>2]>>2],m[e+8>>2]=m[e+8>>2]*m[d[i+8>>2]>>2],m[e+12>>2]=m[e+12>>2]*m[d[i+8>>2]>>2],e}function io(e,t,i){var n=0;ce(e),n=d[e+248>>2],d[t>>2]=d[e+244>>2],d[t+4>>2]=n,n=d[e+256>>2],d[t+8>>2]=d[e+252>>2],d[t+12>>2]=n,t=d[e+272>>2],d[i+8>>2]=d[e+268>>2],d[i+12>>2]=t,t=d[e+264>>2],d[i>>2]=d[e+260>>2],d[i+4>>2]=t}function no(e,t){e|=0,t=y(t);var i=0,n=0,r=0;if(yr(18490),(0|(n=d[e+232>>2]))>=1)for(;i=d[d[e+240>>2]+(r<<2)>>2],3&u[i+204|0]||(gi(i,t),q_(i,t,i+68|0),n=d[e+232>>2]),(0|(r=r+1|0))<(0|n););As()}function ro(e,t,i){var n;O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,Ar(e=d[n+12>>2],d[n+8>>2]),t=d[n+4>>2],i=d[t+4>>2],d[e+48>>2]=d[t>>2],d[e+52>>2]=i,i=d[t+12>>2],d[e+56>>2]=d[t+8>>2],d[e+60>>2]=i,O=n+16|0}function so(){var e,t=0,i=0;return O=e=O-32|0,1&s[26880]||mc(26880)&&(i=function(){var e;return O=e=O-48|0,1&s[26932]||mc(26932)&&(m[e+44>>2]=1,m[e+40>>2]=0,m[e+36>>2]=0,m[e+32>>2]=0,m[e+28>>2]=1,m[e+24>>2]=0,m[e+20>>2]=0,m[e+16>>2]=0,m[e+12>>2]=1,Yr(26884,e+44|0,e+40|0,e+36|0,e+32|0,e+28|0,e+24|0,e+20|0,e+16|0,e+12|0),uh(26932)),O=e+48|0,26884}(),m[e+12>>2]=0,m[e+8>>2]=0,m[e+4>>2]=0,Zo(t=e+16|0,e+12|0,e+8|0,e+4|0),ro(26816,i,t),uh(26880)),O=e+32|0,26816}function oo(e,t){var i,n=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ar(e=d[i+12>>2],d[i+8>>2]),t=d[i+8>>2],n=d[t+52>>2],d[e+48>>2]=d[t+48>>2],d[e+52>>2]=n,n=d[t+60>>2],d[e+56>>2]=d[t+56>>2],d[e+60>>2]=n,O=i+16|0}function ao(e,t){var i,n=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,$r(e=d[i+12>>2],d[i+8>>2]),t=d[i+8>>2],n=d[t+52>>2],d[e+48>>2]=d[t+48>>2],d[e+52>>2]=n,n=d[t+60>>2],d[e+56>>2]=d[t+56>>2],d[e+60>>2]=n,O=i+16|0}function lo(e,t){var i,n=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[12+(O-16|0)>>2]=e,Fc(e),d[12+(t=O-16|0)>>2]=d[i+8>>2],d[i+4>>2]=d[d[t+12>>2]+4>>2],t=d[i+4>>2],d[i>>2]=0,pr(e,t,i),Fs(d[i+8>>2],d[i+4>>2],d[e+12>>2]),O=i+16|0}(e=d[i+12>>2],d[i+8>>2]),t=d[i+8>>2],n=d[t+24>>2],d[e+20>>2]=d[t+20>>2],d[e+24>>2]=n,n=d[t+32>>2],d[e+28>>2]=d[t+28>>2],d[e+32>>2]=n,O=i+16|0}function co(e,t){var i;O=i=O-32|0,e=d[e+1048>>2],d[i+24>>2]=1065353216,d[i+28>>2]=0,d[i+16>>2]=0,d[i+20>>2]=1065353216,d[i+8>>2]=0,d[i+12>>2]=0,d[i>>2]=1065353216,d[i+4>>2]=0,Jt(t,e,0,i+16|0,i,0,-1),O=i+32|0}function ho(e,t){var i;for(O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=0,d[i+4>>2]=t,e=d[i+12>>2],d[i>>2]=d[i+8>>2];d[i>>2]>2];)B_(d[e+12>>2]+b(d[i>>2],36)|0),d[i>>2]=d[i>>2]+1;O=i+16|0}function _o(e,t,i){var n;if(!(n=d[e+16>>2]))return d[e+36>>2]=1,d[e+24>>2]=i,void(d[e+16>>2]=t);e:{if((0|t)==(0|n)){if(2!=d[e+24>>2])break e;return void(d[e+24>>2]=i)}s[e+54|0]=1,d[e+24>>2]=2,d[e+36>>2]=d[e+36>>2]+1}}function uo(e,t,i,n,r,s){var o;O=o=O-32|0,d[o+28>>2]=e,m[o+24>>2]=t,m[o+20>>2]=i,m[o+16>>2]=n,m[o+12>>2]=r,m[o+8>>2]=s,function(e,t,i,n,r,s){i=y(y(i-t)*y(.5)),m[e+4>>2]=i,(t=Ji(y(i+t),y(6.2831854820251465)))y(3.1415927410125732)&&(t=y(t+y(-6.2831854820251465))),m[e+16>>2]=s,m[e+12>>2]=r,m[e+8>>2]=n,m[e>>2]=t}(d[o+28>>2]+688|0,m[o+24>>2],m[o+20>>2],m[o+16>>2],m[o+12>>2],m[o+8>>2]),O=o+32|0}function po(e){return d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,d[e+52>>2]=0,d[e>>2]=12800,e}function fo(e){var t=y(0);return(t=Ji(y(m[e>>2]+m[e+4>>2]),y(6.2831854820251465)))y(3.1415927410125732)^1?t:y(t+y(-6.2831854820251465))}function mo(e){var t=y(0);return(t=Ji(y(m[e>>2]-m[e+4>>2]),y(6.2831854820251465)))y(3.1415927410125732)^1?t:y(t+y(-6.2831854820251465))}function go(e,t,i){d[e+28>>2]=i,d[e+24>>2]=-1,_[e+20>>1]=1,d[e+16>>2]=2139095039,d[e+8>>2]=-1,d[e+12>>2]=-1,d[e>>2]=19288,d[e+4>>2]=t,Hs(),d[e+44>>2]=0,d[e+36>>2]=0,d[e+40>>2]=1050253722,d[e+32>>2]=29252}function bo(e,t,i,n){var s;return e|=0,t=y(t),i|=0,n=y(n),O=s=O-16|0,d[s+12>>2]=e,m[s+8>>2]=t,d[s+4>>2]=i,m[s>>2]=n,e=d[s+12>>2],e=0|r[d[d[e>>2]+52>>2]](e,m[s+8>>2],d[s+4>>2],m[s>>2]),O=s+16|0,0|e}function yo(e,t){var i;O=i=O-32|0,e=d[e+988>>2],d[i+24>>2]=0,d[i+28>>2]=0,d[i+16>>2]=0,d[i+20>>2]=1065353216,d[i+8>>2]=0,d[i+12>>2]=0,d[i>>2]=1065353216,d[i+4>>2]=0,Jt(t,e,0,i+16|0,i,0,-1),O=i+32|0}function vo(e,t,i){var n;return e|=0,t=y(t),i|=0,O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,d[n+4>>2]=i,e=d[n+12>>2],e=0|r[d[d[e>>2]+52>>2]](e,m[n+8>>2],d[n+4>>2],y(.01666666753590107)),O=n+16|0,0|e}function Ao(e,t,i,n){d[e+44>>2]=0,d[e+36>>2]=0,d[e+40>>2]=1050253722,d[e+32>>2]=n,d[e+28>>2]=i,d[e+24>>2]=-1,_[e+20>>1]=1,d[e+16>>2]=2139095039,d[e+8>>2]=-1,d[e+12>>2]=-1,d[e>>2]=19288,d[e+4>>2]=t}function Co(e){switch(d[e+4>>2]){case 8:return y(m[e+28>>2]*m[e+12>>2]);default:return y(r[d[d[e>>2]+48>>2]](e));case 0:case 1:case 4:case 5:case 10:case 11:case 13:}return m[e+44>>2]}function So(e,t,i,n,r){var s;e|=0,t=y(t),i=y(i),n=y(n),r=y(r),O=s=O-32|0,d[s+28>>2]=e,m[s+24>>2]=t,m[s+20>>2]=i,m[s+16>>2]=n,m[s+12>>2]=r,eo(d[s+28>>2],s+24|0,s+20|0,s+16|0,s+12|0),O=s+32|0}function xo(e){var t;return d[(e|=0)>>2]=16264,(t=d[e+32>>2])&&(u[e+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+32>>2]=0),d[e+32>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0,0|e}function To(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+12>>2]=e,d[s+8>>2]=t,_[s+6>>1]=i,_[s+4>>1]=n,e=d[s+12>>2],r[d[d[e>>2]+36>>2]](e,d[s+8>>2],_[s+6>>1],_[s+4>>1]),O=s+16|0}function Eo(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+12>>2]=e,d[s+8>>2]=t,_[s+6>>1]=i,_[s+4>>1]=n,e=d[s+12>>2],r[d[d[e>>2]+88>>2]](e,d[s+8>>2],_[s+6>>1],_[s+4>>1]),O=s+16|0}function Ro(e,t){var i;return d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],m[e>>2]=m[e>>2]+m[d[i+8>>2]>>2],m[e+4>>2]=m[e+4>>2]+m[d[i+8>>2]+4>>2],m[e+8>>2]=m[e+8>>2]+m[d[i+8>>2]+8>>2],e}function Po(e){3&u[e+204|0]||(m[e+412>>2]=y(m[e+364>>2]*m[e+348>>2])+m[e+412>>2],m[e+416>>2]=y(m[e+368>>2]*m[e+352>>2])+m[e+416>>2],m[e+420>>2]=y(m[e+372>>2]*m[e+356>>2])+m[e+420>>2])}function Io(e,t,i,n){var r;d[12+(r=O-16|0)>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,s[r+3|0]=n,e=d[r+12>>2],1&s[r+3|0]?d[e+84>>2]=d[r+8>>2]:d[e+80>>2]=d[r+8>>2],d[e+88>>2]=d[r+4>>2]}function Mo(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+12>>2]=e,d[s+8>>2]=t,d[s+4>>2]=i,d[s>>2]=n,e=d[s+12>>2],r[d[d[e>>2]+8>>2]](e,d[s+8>>2],d[s+4>>2],d[s>>2]),O=s+16|0}function Do(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+52>>2]=d[e>>2],d[t+56>>2]=i,i=d[e+12>>2],d[t+60>>2]=d[e+8>>2],d[t+64>>2]=i}function Oo(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+68>>2]=d[e>>2],d[t+72>>2]=i,i=d[e+12>>2],d[t+76>>2]=d[e+8>>2],d[t+80>>2]=i}function wo(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+24>>2]=d[e>>2],d[t+28>>2]=i,i=d[e+12>>2],d[t+32>>2]=d[e+8>>2],d[t+36>>2]=i}function Fo(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,O=i+16|0,d[d[d[e+12>>2]+12>>2]+(d[e+8>>2]<<2)>>2]}function Bo(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+32>>2]=d[e>>2],d[t+36>>2]=i,i=d[e+12>>2],d[t+40>>2]=d[e+8>>2],d[t+44>>2]=i}function No(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+20>>2]=d[e>>2],d[t+24>>2]=i,i=d[e+12>>2],d[t+28>>2]=d[e+8>>2],d[t+32>>2]=i}function Lo(e,t,i,n){var s;e|=0,t|=0,i=y(i),n|=0,O=s=O-16|0,d[s+12>>2]=e,d[s+8>>2]=t,m[s+4>>2]=i,d[s>>2]=n,e=d[s+12>>2],r[d[d[e>>2]+28>>2]](e,d[s+8>>2],m[s+4>>2],d[s>>2]),O=s+16|0}function ko(e){return d[e+16>>2]=0,d[e+8>>2]=-1,d[e+12>>2]=0,d[e>>2]=0,d[e+4>>2]=0,d[e+32>>2]=0,s[e+36|0]=1,s[e+56|0]=1,d[e+24>>2]=0,d[e+28>>2]=0,d[e+52>>2]=0,d[e+44>>2]=0,d[e+48>>2]=0,e}function Vo(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+40>>2]=d[e>>2],d[t+44>>2]=i,i=d[e+12>>2],d[t+48>>2]=d[e+8>>2],d[t+52>>2]=i}function Uo(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+56>>2]=d[e>>2],d[t+60>>2]=i,i=d[e+12>>2],d[t+64>>2]=d[e+8>>2],d[t+68>>2]=i}function Go(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+48>>2]=d[e>>2],d[t+52>>2]=i,i=d[e+12>>2],d[t+56>>2]=d[e+8>>2],d[t+60>>2]=i}function jo(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+16>>2]=d[e>>2],d[t+20>>2]=i,i=d[e+12>>2],d[t+24>>2]=d[e+8>>2],d[t+28>>2]=i}function Wo(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+36>>2]=d[e>>2],d[t+40>>2]=i,i=d[e+12>>2],d[t+44>>2]=d[e+8>>2],d[t+48>>2]=i}function zo(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+12>>2]=e,d[s+8>>2]=t,d[s+4>>2]=i,d[s>>2]=n,e=d[s+12>>2],r[d[d[e>>2]+28>>2]](e,d[s+8>>2],d[s+4>>2],d[s>>2]),O=s+16|0}function Ho(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+8>>2]=d[e>>2],d[t+12>>2]=i,i=d[e+12>>2],d[t+16>>2]=d[e+8>>2],d[t+20>>2]=i}function Xo(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+12>>2]=e,d[s+8>>2]=t,d[s+4>>2]=i,d[s>>2]=n,e=d[s+12>>2],r[d[d[e>>2]+32>>2]](e,d[s+8>>2],d[s+4>>2],d[s>>2]),O=s+16|0}function Yo(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+4>>2]=d[e>>2],d[t+8>>2]=i,i=d[e+12>>2],d[t+12>>2]=d[e+8>>2],d[t+16>>2]=i}function Qo(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+12>>2]=e,d[s+8>>2]=t,d[s+4>>2]=i,d[s>>2]=n,e=d[s+12>>2],r[d[d[e>>2]+8>>2]](e,d[s+8>>2],d[s+4>>2],d[s>>2]),O=s+16|0}function qo(e,t){var i;return d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],m[e>>2]=m[e>>2]*m[d[i+8>>2]>>2],m[e+4>>2]=m[e+4>>2]*m[d[i+8>>2]>>2],m[e+8>>2]=m[e+8>>2]*m[d[i+8>>2]>>2],e}function Ko(e,t,i){e|=0,t|=0,i|=0;var n,s=y(0);return O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,e=d[n+12>>2],s=y(r[d[d[e>>2]+32>>2]](e,d[n+8>>2],d[n+4>>2])),O=n+16|0,y(s)}function Zo(e,t,i,n){var r;d[12+(r=O-16|0)>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,e=d[r+12>>2],m[e>>2]=m[d[r+8>>2]>>2],m[e+4>>2]=m[d[r+4>>2]>>2],m[e+8>>2]=m[d[r>>2]>>2],m[e+12>>2]=0}function $o(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t>>2]=d[e>>2],d[t+4>>2]=i,i=d[e+12>>2],d[t+8>>2]=d[e+8>>2],d[t+12>>2]=i}function Jo(e,t,i){var n,s;return e|=0,t|=0,n=0|r[d[d[(i|=0)>>2]+40>>2]](i,e),s=0|r[d[d[i>>2]+28>>2]](i,n),d[t>>2]=s,s&&r[d[d[i>>2]+48>>2]](i,n),d[t+4>>2]=d[e+4>>2],13258}function ea(e,t,i,n){var s,o,a,l=0;s=d[e+4>>2],o=e=d[e>>2],a=t,l=0,i&&(l=t=s>>8,1&s&&(l=d[t+d[i>>2]>>2])),r[d[d[e>>2]+28>>2]](o,a,l+i|0,2&s?n:2)}function ta(e){var t;return O=t=O-16|0,d[t+8>>2]=e,d[12+(e=O-16|0)>>2]=d[t+8>>2],4!=d[d[e+12>>2]+236>>2]?d[t+12>>2]=0:d[t+12>>2]=d[t+8>>2],O=t+16|0,d[t+12>>2]}function ia(e,t,i,n,r){var s;O=s=O-32|0,d[s+28>>2]=e,d[s+24>>2]=t,d[s+20>>2]=i,d[s+16>>2]=n,d[s+12>>2]=r,eo(d[s+28>>2],d[s+24>>2],d[s+20>>2],d[s+16>>2],d[s+12>>2]),O=s+32|0}function na(e){var t,i;return(e=(t=d[7848])+(i=e+3&-4)|0)>>>0<=t>>>0&&(0|i)>=1||e>>>0>(n.byteLength/65536|0)<<16>>>0&&!M(0|e)?(d[7722]=48,-1):(d[7848]=e,t)}function ra(e,t){var i;return d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],y(y(y(m[e>>2]*m[d[i+8>>2]>>2])+y(m[e+4>>2]*m[d[i+8>>2]+4>>2]))+y(m[e+8>>2]*m[d[i+8>>2]+8>>2]))}function sa(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,t=1&s[i+11|0],d[12+(e=O-16|0)>>2]=d[i+12>>2],s[e+11|0]=t,s[d[e+12>>2]+21|0]=1&s[e+11|0],O=i+16|0}function oa(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+252>>2]=m[e+8>>2],O=i+16|0}function aa(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+248>>2]=m[e+8>>2],O=i+16|0}function la(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+184>>2]=m[e+8>>2],O=i+16|0}function ca(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+12>>2]=m[e+8>>2],O=i+16|0}function ha(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,d[d[e+12>>2]+204>>2]=d[e+8>>2],O=i+16|0}function _a(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+16>>2]=m[e+8>>2],O=i+16|0}function da(e,t){var i;return e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,e=d[i+12>>2],e=0|r[d[d[e>>2]+52>>2]](e,m[i+8>>2],1,y(.01666666753590107)),O=i+16|0,0|e}function ua(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,d[d[e+12>>2]+240>>2]=d[e+8>>2],O=i+16|0}function pa(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+4>>2]=m[e+8>>2],O=i+16|0}function fa(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+8>>2]=m[e+8>>2],O=i+16|0}function ma(e,t,i,n){var r;e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,s[r+3|0]=n,Io(d[r+12>>2],d[r+8>>2],d[r+4>>2],1&s[r+3|0]),O=r+16|0}function ga(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]>>2]=m[e+8>>2],O=i+16|0}function ba(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],d[e>>2]=1296,c_(e+112|0),c_(e+92|0),c_(e+72|0),c_(e+20|0),d[12+(O-16|0)>>2]=e,O=t+16|0,0|e}function ya(e,t){var i;return O=i=O-16|0,d[i+8>>2]=e,d[i+4>>2]=t,e=d[i+8>>2],d[i+4>>2]?d[i+12>>2]=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,d[i+4>>2]=0,e=d[i+8>>2]<<2,d[7717]=d[7717]+1,e=0|r[d[6606]](e,16),O=i+16|0,e}(e,d[i+4>>2]):d[i+12>>2]=0,O=i+16|0,d[i+12>>2]}function va(e,t){var i;O=i=O-16|0,d[i+12>>2]=t,m[i+8>>2]=-m[d[i+12>>2]>>2],m[i+4>>2]=-m[d[i+12>>2]+4>>2],m[i>>2]=-m[d[i+12>>2]+8>>2],Zo(e,i+8|0,i+4|0,i),O=i+16|0}function Aa(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+12>>2]=e,d[s+8>>2]=t,d[s+4>>2]=i,d[s>>2]=n,function(e,t,i,n){var s,o;O=s=O-96|0,o=d[t+192>>2],d[s+88>>2]=-1,d[s+92>>2]=-1,d[s+84>>2]=t+4,d[s+80>>2]=t,d[s+76>>2]=o,d[s+72>>2]=0,t=d[i+192>>2],d[s+64>>2]=-1,d[s+68>>2]=-1,d[s+60>>2]=i+4,d[s+56>>2]=i,d[s+52>>2]=t,d[s+48>>2]=0,t=d[e+24>>2],(t=0|r[d[d[t>>2]+8>>2]](t,s+72|0,s+48|0,0))&&(d[12+(i=s+8|0)>>2]=s+48,d[i+8>>2]=s+72,d[i+4>>2]=0,d[i>>2]=7088,d[s+40>>2]=n,d[s+8>>2]=9484,r[d[d[t>>2]+8>>2]](t,s+72|0,s+48|0,e+28|0,i),r[d[d[t>>2]>>2]](t),e=d[e+24>>2],r[d[d[e>>2]+60>>2]](e,t)),O=s+96|0}(d[s+12>>2],d[s+8>>2],d[s+4>>2],d[s>>2]),O=s+16|0}function Ca(e,t){var i;d[t+40>>2]&&(Ca(e,d[t+36>>2]),Ca(e,d[t+40>>2])),d[e>>2]==(0|t)&&(d[e>>2]=0),(i=d[e+4>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+4>>2]=t}function Sa(e){var t,i;for(O=t=O-16|0,d[t+8>>2]=e,e=d[t+8>>2],d[t+12>>2]=e,i=e+48|0;d[12+(O-16|0)>>2]=e,(0|i)!=(0|(e=e+16|0)););O=t+16|0}function xa(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,_[n+6>>1]=i,e=d[n+12>>2],r[d[d[e>>2]+36>>2]](e,d[n+8>>2],_[n+6>>1],-3),O=n+16|0}function Ta(e,t,i){var n;O=n=O-80|0,d[n+76>>2]=e,d[n+72>>2]=t,d[n+68>>2]=i,function(e,t,i){var n;O=n=O-48|0,d[n+44>>2]=e,d[n+40>>2]=t,d[n+36>>2]=i,i=d[n+36>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],d[t+8>>2]=0,m[n+32>>2]=Xr(i,d[t+12>>2]+(d[t+8>>2]<<4)|0),i=d[n+36>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],d[t+8>>2]=0,m[n+28>>2]=Ur(i,d[t+12>>2]+(d[t+8>>2]<<4)|0),i=d[n+36>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],d[t+8>>2]=0,m[n+24>>2]=Gr(i,d[t+12>>2]+(d[t+8>>2]<<4)|0),i=d[n+36>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],d[t+8>>2]=1,m[n+20>>2]=Xr(i,d[t+12>>2]+(d[t+8>>2]<<4)|0),i=d[n+36>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],d[t+8>>2]=1,m[n+16>>2]=Ur(i,d[t+12>>2]+(d[t+8>>2]<<4)|0),i=d[n+36>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],d[t+8>>2]=1,m[n+12>>2]=Gr(i,d[t+12>>2]+(d[t+8>>2]<<4)|0),i=d[n+36>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],d[t+8>>2]=2,m[n+8>>2]=Xr(i,d[t+12>>2]+(d[t+8>>2]<<4)|0),i=d[n+36>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],d[t+8>>2]=2,m[n+4>>2]=Ur(i,d[t+12>>2]+(d[t+8>>2]<<4)|0),i=d[n+36>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],d[t+8>>2]=2,m[n>>2]=Gr(i,d[t+12>>2]+(d[t+8>>2]<<4)|0),Yr(e,n+32|0,n+28|0,n+24|0,n+20|0,n+16|0,n+12|0,n+8|0,n+4|0,n),O=n+48|0}(t=n+16|0,i=d[n+72>>2],d[n+68>>2]),hs(n,i,d[n+68>>2]+48|0),ro(e,t,n),O=n+80|0}function Ea(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,_[n+6>>1]=i,e=d[n+12>>2],r[d[d[e>>2]+36>>2]](e,d[n+8>>2],_[n+6>>1],-1),O=n+16|0}function Ra(e,t){var i,n;O=i=O-48|0,d[i+44>>2]=e,d[i+40>>2]=t,Zr(t=i+8|0,(e=d[i+44>>2])+264|0,d[i+40>>2]),Gs(n=i+24|0,t,e+544|0),Ro(e+328|0,n),O=i+48|0}function Pa(e,t){var i,n;O=i=O-48|0,d[i+44>>2]=e,d[i+40>>2]=t,t=i+8|0,e=d[i+44>>2],Gs(t,d[i+40>>2],e+348|0),zs(n=i+24|0,t,e+344|0),Ro(e+312|0,n),O=i+48|0}function Ia(e,t){var i,n,r=0;O=i=O-96|0,d[i+92>>2]=e,d[i+88>>2]=t,function(e,t){var i,n,r=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,r=O-16|0,t=d[i+8>>2],d[r+12>>2]=t,r=d[r+12>>2],d[12+(s=O-16|0)>>2]=t+16,s=d[s+12>>2],d[12+(o=O-16|0)>>2]=t+32,o=d[o+12>>2],d[12+(a=O-16|0)>>2]=t,a=d[a+12>>2]+4|0,d[12+(l=O-16|0)>>2]=t+16,l=d[l+12>>2]+4|0,d[12+(c=O-16|0)>>2]=t+32,c=d[c+12>>2]+4|0,d[12+(h=O-16|0)>>2]=t,h=d[h+12>>2]+8|0,d[12+(_=O-16|0)>>2]=t+16,_=d[_+12>>2]+8|0,d[12+(n=O-16|0)>>2]=t+32,Yr(e,r,s,o,a,l,c,h,_,d[n+12>>2]+8|0),O=i+16|0}(t=i+40|0,r=d[i+88>>2]),va(n=i+8|0,r+48|0),Zr(r=i+24|0,t,n),ro(e,t,r),O=i+96|0}function Ma(e,t,i){var n;e|=0,t=y(t),i|=0,O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,d[n+4>>2]=i,e=d[n+12>>2],r[d[d[e>>2]+32>>2]](e,m[n+8>>2],d[n+4>>2]),O=n+16|0}function Da(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,e=d[n+12>>2],r[d[d[e>>2]+8>>2]](e,d[n+8>>2],m[n+4>>2]),O=n+16|0}function Oa(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,e=d[n+12>>2],r[d[d[e>>2]+56>>2]](e,d[n+8>>2],1&s[n+7|0]),O=n+16|0}function wa(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,e=d[n+12>>2],r[d[d[e>>2]+40>>2]](e,d[n+8>>2],d[n+4>>2]),O=n+16|0}function Fa(e,t,i,n,r,s,o,a){var l;O=l=O-32|0,d[l+24>>2]=-1,d[l+28>>2]=-1,d[l+20>>2]=s,d[l+16>>2]=n,d[l+12>>2]=r,d[l+8>>2]=0,j(e,t,i,l+8|0,o,a),O=l+32|0}function Ba(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,d[6734]=d[e+8>>2],O=i+16|0}function Na(e){var t;(t=d[e+12>>2])&&(u[e+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+12>>2]=0),d[e+12>>2]=0,s[e+16|0]=1,d[e+4>>2]=0,d[e+8>>2]=0}function La(e){var t,i;return y((i=(t=e*e)*e)*(t*t)*(2718311493989822e-21*t-.00019839334836096632)+(i*(.008333329385889463*t-.16666666641626524)+e))}function ka(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,d[6989]=d[e+8>>2],O=i+16|0}function Va(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,d[6735]=d[e+8>>2],O=i+16|0}function Ua(e,t){var i;for(d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=0,d[i+4>>2]=t,d[i>>2]=d[i+8>>2];d[i>>2]>2];)d[i>>2]=d[i>>2]+1}function Ga(e){var t;return O=t=O-16|0,m[t+12>>2]=e,m[t+12>>2]>2]=-1),m[t+12>>2]>y(1)&&(m[t+12>>2]=1),e=Ki(m[t+12>>2]),O=t+16|0,e}function ja(e){e|=0;var t=y(0),i=y(0);return t=m[e+28>>2],i=y(r[d[d[e>>2]+48>>2]](e)),y(r[d[d[e>>2]+48>>2]](e)),y(r[d[d[e>>2]+48>>2]](e)),y(y(t+i))}function Wa(e,t){e|=0,t|=0;var i=y(0),n=y(0),r=y(0);i=m[t>>2],n=m[t+4>>2],r=m[t+8>>2],d[e+24>>2]=0,m[e+20>>2]=v(r),m[e+16>>2]=v(n),m[e+12>>2]=v(i)}function za(e,t){e|=0;var i,n=0;n=d[4+(t|=0)>>2],i=d[e+48>>2],d[i+4>>2]=d[t>>2],d[i+8>>2]=n,n=d[t+12>>2],d[i+12>>2]=d[t+8>>2],d[i+16>>2]=n,Wi(e)}function Ha(e){var t=0;return d[(e|=0)>>2]=12800,(t=d[e+52>>2])&&(r[d[d[t>>2]>>2]](t),(t=d[e+52>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),0|e}function Xa(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+8>>2],t=d[i+12>>2],4!=(-2&d[t+216>>2])&&(d[t+216>>2]=e),O=i+16|0}function Ya(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],e=0|r[d[d[e>>2]+40>>2]](e,d[i+8>>2]),O=i+16|0,0|e}function Qa(e,t,i,n,s,o){var a,l,c=0;c=(a=d[e+4>>2])>>8,l=e=d[e>>2],1&a&&(c=d[d[n>>2]+c>>2]),r[d[d[e>>2]+20>>2]](l,t,i,n+c|0,2&a?s:2,o)}function qa(e,t){var i,n=0;return i=ce(e),n=d[e+288>>2],d[t+8>>2]=d[e+284>>2],d[t+12>>2]=n,n=d[e+280>>2],d[t>>2]=d[e+276>>2],d[t+4>>2]=n,i}function Ka(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,Io(d[n+12>>2],d[n+8>>2],d[n+4>>2],0),O=n+16|0}function Za(e,t,i,n,s){var o,a,l=0;l=(o=d[e+4>>2])>>8,a=e=d[e>>2],1&o&&(l=d[d[i>>2]+l>>2]),r[d[d[e>>2]+24>>2]](a,t,i+l|0,2&o?n:2,s)}function $a(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],m[i+4>>2]=y(1)/m[d[i+8>>2]>>2],e=to(e,i+4|0),O=i+16|0,e}function Ja(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e,t,i){var n,s;O=n=O-48|0,s=d[t+192>>2],r[d[d[s>>2]+8>>2]](s,t+4|0,n+32|0,n+16|0),d[n+12>>2]=i,d[n+4>>2]=t,d[n>>2]=9424,d[n+8>>2]=e,e=d[e+68>>2],r[d[d[e>>2]+28>>2]](e,n+32|0,n+16|0,n),O=n+48|0}(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0}function el(e){var t;return y(-.499999997251031*(e*=e)+1+.04166662332373906*(t=e*e)+e*t*(2439044879627741e-20*e-.001388676377460993))}function tl(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e,t,i){var n,r=0;O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,t=d[n+8>>2],r=d[t+4>>2],e=d[n+12>>2],d[(i=e)+164>>2]=d[t>>2],d[i+168>>2]=r,i=d[t+12>>2],d[e+172>>2]=d[t+8>>2],d[e+176>>2]=i,t=n,d[12+(r=O-16|0)>>2]=d[n+8>>2],i=1,m[d[r+12>>2]>>2]==y(1)&&(d[12+(r=O-16|0)>>2]=d[n+8>>2],i=1,m[d[r+12>>2]+4>>2]==y(1)&&(d[12+(i=O-16|0)>>2]=d[n+8>>2],i=m[d[i+12>>2]+8>>2]!=y(1))),s[t+3|0]=i,t=1&s[n+3|0]?d[n+4>>2]:0,d[e+180>>2]=t,O=n+16|0}(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0}function il(e){d[e+12>>2]=1065353216,d[e+4>>2]=5,d[e+8>>2]=0,d[e>>2]=20392,s[e+16|0]=1,s[e+36|0]=1,d[e+32>>2]=0,d[e+24>>2]=0,d[e+28>>2]=0}function nl(e){var t;d[12+(t=O-16|0)>>2]=e,e=d[t+12>>2],d[e>>2]=1428,m[e+4>>2]=1,d[e+8>>2]=0,_[e+12>>1]=1,_[e+14>>1]=65535,d[e+16>>2]=0}function rl(e){var t;d[12+(t=O-16|0)>>2]=e,e=d[t+12>>2],d[e>>2]=0,d[e+4>>2]=0,d[e+8>>2]=4096,d[e+12>>2]=4096,d[e+16>>2]=0,d[e+20>>2]=1}function sl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+36>>2]](e,d[i+8>>2],2,-3),O=i+16|0}function ol(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+36>>2]](e,d[i+8>>2],1,-1),O=i+16|0}function al(e){var t;O=t=O-16|0,d[t+12>>2]=e,function(e){var t;O=t=O-48|0,d[t+44>>2]=e,e=d[t+44>>2],m[t+40>>2]=1,m[t+36>>2]=0,m[t+32>>2]=0,m[t+28>>2]=0,m[t+24>>2]=1,m[t+20>>2]=0,m[t+16>>2]=0,m[t+12>>2]=0,m[t+8>>2]=1,vs(e,t+40|0,t+36|0,t+32|0,t+28|0,t+24|0,t+20|0,t+16|0,t+12|0,t+8|0),O=t+48|0}(e=d[t+12>>2]),m[t+8>>2]=0,m[t+4>>2]=0,m[t>>2]=0,Zo(e+48|0,t+8|0,t+4|0,t),O=t+16|0}function ll(e,t){var i;O=i=O-32|0,d[i+28>>2]=e,d[i+24>>2]=t,e=i+8|0,t=d[i+28>>2],Gs(e,d[i+24>>2],t+544|0),Ro(t+428|0,e),O=i+32|0}function cl(e,t){var i;O=i=O-32|0,d[i+28>>2]=e,d[i+24>>2]=t,e=i+8|0,t=d[i+28>>2],Gs(e,d[i+24>>2],t+348|0),Ro(t+412|0,e),O=i+32|0}function hl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+56>>2]](e,d[i+8>>2],0),O=i+16|0}function _l(e){var t;O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],d[e+12>>2]&&(1&s[e+16|0]&&function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,(e=d[i+8>>2])&&(d[7718]=d[7718]+1,r[d[6607]](e)),O=i+16|0}(e,d[e+12>>2]),d[e+12>>2]=0),O=t+16|0}function dl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,0!=(2&d[d[e+12>>2]+204>>2])|0}function ul(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,0!=(1&d[d[e+12>>2]+204>>2])|0}function pl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,0!=(3&d[d[e+12>>2]+204>>2])|0}function fl(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+44>>2]](e,m[i+8>>2]),O=i+16|0}function ml(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+12>>2]](e,d[i+8>>2]),O=i+16|0}function gl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+24>>2]](e,d[i+8>>2]),O=i+16|0}function bl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+40>>2]](e,d[i+8>>2]),O=i+16|0}function yl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+72>>2]](e,d[i+8>>2]),O=i+16|0}function vl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+64>>2]](e,d[i+8>>2]),O=i+16|0}function Al(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+84>>2]](e,d[i+8>>2]),O=i+16|0}function Cl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+92>>2]](e,d[i+8>>2]),O=i+16|0}function Sl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+16>>2]](e,d[i+8>>2]),O=i+16|0}function xl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+60>>2]](e,d[i+8>>2]),O=i+16|0}function Tl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+36>>2]](e,d[i+8>>2]),O=i+16|0}function El(e,t){e|=0,t|=0;var i,n=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,n=ra(d[i+12>>2],d[i+8>>2]),O=i+16|0,y(n)}function Rl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+68>>2]](e,d[i+8>>2]),O=i+16|0}function Pl(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+44>>2]](e,d[i+8>>2]),O=i+16|0}function Il(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+8>>2]](e,d[i+8>>2]),O=i+16|0}function Ml(e){var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=function(e){var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=ra(e=d[t+12>>2],e),O=t+16|0,i}(d[t+12>>2]),m[12+(e=O-16|0)>>2]=i,O=t+16|0,y(x(m[e+12>>2]))}function Dl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,m[d[e+12>>2]+4>>2]>2]=e,i=vh(d[t+12>>2]),m[12+(e=O-16|0)>>2]=i,O=t+16|0,y(x(m[e+12>>2]))}function wl(e){var t;O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],d[12+(O-16|0)>>2]=e+4,Sa(e+28|0),d[12+(O-16|0)>>2]=e+76,O=t+16|0}function Fl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,0!=d[d[e+12>>2]+8>>2]|0}function Bl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+228>>2])}function Nl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+224>>2])}function Ll(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+232>>2])}function kl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+16>>2])}function Vl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+12>>2])}function Ul(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+4>>2])}function Gl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+8>>2])}function jl(e){e|=0;var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],i=y(r[d[d[e>>2]+48>>2]](e)),O=t+16|0,y(i)}function Wl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+204>>2]}function zl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+188>>2]}function Hl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+240>>2]}function Xl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+192>>2]}function Yl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+24>>2]}function Ql(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]>>2])}function ql(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+52>>2]}function Kl(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+68>>2]}function Zl(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2]+264,d[e+8>>2]=t,O=i+16|0,d[d[d[e+12>>2]+12>>2]+(d[e+8>>2]<<2)>>2]}(d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e}function $l(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=Ro(d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e}function Jl(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=function(e,t){var i;return d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],m[e>>2]=m[e>>2]-m[d[i+8>>2]>>2],m[e+4>>2]=m[e+4>>2]-m[d[i+8>>2]+4>>2],m[e+8>>2]=m[e+8>>2]-m[d[i+8>>2]+8>>2],e}(d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e}function ec(e,t){var i;Xi(e,t),(i=d[e+4>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+4>>2]=t,d[e+12>>2]=d[e+12>>2]+-1}function tc(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+4>>2]}function ic(e){var t=0;e=e||1;e:{for(;;){if(t=L(e))break e;if(!(t=d[7723]))break;r[t]()}D(),T()}return t}function nc(e){var t;return O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],d[7717]=d[7717]+1,e=0|r[d[6606]](e,16),O=t+16|0,e}function rc(e,t){var i;return e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,e=qo(d[i+12>>2],i+8|0),O=i+16|0,0|e}function sc(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+28|0}function oc(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+92|0}function ac(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+48|0}function lc(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+4|0}function cc(e){for(var t=0;d[e+4>>2]=0,d[e+8>>2]=0,(t=d[e+24>>2])&&cc(t),e=d[e+28>>2];);}function hc(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],e=0|r[d[d[e>>2]+28>>2]](e),O=t+16|0,0|e}function _c(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],e=0|r[d[d[e>>2]+36>>2]](e),O=t+16|0,0|e}function dc(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],e=0|r[d[d[e>>2]+48>>2]](e),O=t+16|0,0|e}function uc(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],e=0|r[d[d[e>>2]+20>>2]](e),O=t+16|0,0|e}function pc(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+216>>2]=d[i+8>>2],O=i+16|0}function fc(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Io(d[i+12>>2],d[i+8>>2],0,0),O=i+16|0}function mc(e){var t;return O=t=O-16|0,d[t+12>>2]=0,d[t+4>>2]=e,d[t>>2]=e,d[t+8>>2]=e+1,e=function(e){var t,i=0;return O=t=O-16|0,d[t+8>>2]=d[e+4>>2],u[d[t+8>>2]]||(i=function(e){var t=0;e:{if(e=d[e+8>>2],1!=(0|(t=u[0|e]))){if(2&t)break e;s[0|e]=2,e=1}else e=0;return e}T()}(e)),O=t+16|0,i}(t),O=t+16|0,e}function gc(e,t){t|=0,d[(e|=0)>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,d[e+(d[t+52>>2]<<2)>>2]=1065353216}function bc(e,t,i){return i?(0|e)==(0|t)?1:!function(e,t){var i=0,n=0;e:if(!(!(i=u[0|e])|(0|i)!=(0|(n=u[0|t]))))for(;;){if(n=u[t+1|0],!(i=u[e+1|0]))break e;if(t=t+1|0,e=e+1|0,(0|i)!=(0|n))break}return i-n|0}(d[e+4>>2],d[t+4>>2]):d[e+4>>2]==d[t+4>>2]}function yc(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,Eh(d[i+12>>2],1&s[i+11|0]),O=i+16|0}function vc(e,t,i,n,r){var s;s=d[e+32>>2],d[s>>2]=d[s>>2]+1,ji(e,Fe(e,t,r)),ji(e,Fe(e,i,r)),ji(e,Fe(e,n,r))}function Ac(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,function(e,t){var i;d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,e=d[i+12>>2],d[e+260>>2]=d[e+260>>2]+1,m[e+228>>2]=m[i+8>>2]}(d[i+12>>2],m[i+8>>2]),O=i+16|0}function Cc(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,function(e,t){var i;d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,e=d[i+12>>2],d[e+260>>2]=d[e+260>>2]+1,m[e+224>>2]=m[i+8>>2]}(d[i+12>>2],m[i+8>>2]),O=i+16|0}function Sc(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,function(e,t){var i;d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,e=d[i+12>>2],d[e+260>>2]=d[e+260>>2]+1,m[e+232>>2]=m[i+8>>2]}(d[i+12>>2],m[i+8>>2]),O=i+16|0}function xc(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+680>>2]=d[e>>2],d[t+684>>2]=i,i=d[e+12>>2],d[t+688>>2]=d[e+8>>2],d[t+692>>2]=i}(d[i+12>>2],d[i+8>>2]),O=i+16|0}function Tc(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+696>>2]=d[e>>2],d[t+700>>2]=i,i=d[e+12>>2],d[t+704>>2]=d[e+8>>2],d[t+708>>2]=i}(d[i+12>>2],d[i+8>>2]),O=i+16|0}function Ec(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[e+260>>2]=d[e+260>>2]+1,ao(e+4|0,d[i+8>>2]),O=i+16|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0}function Rc(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n=y(0);for(O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[i+4>>2]=0;d[i+4>>2]<3;)d[12+(t=O-16|0)>>2]=d[i+8>>2],n=Cs(m[d[t+12>>2]+(d[i+4>>2]<<2)>>2]),m[(e+868|0)+(d[i+4>>2]<<6)>>2]=n,d[i+4>>2]=d[i+4>>2]+1;O=i+16|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0}function Pc(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n=y(0);for(O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[i+4>>2]=0;d[i+4>>2]<3;)d[12+(t=O-16|0)>>2]=d[i+8>>2],n=Cs(m[d[t+12>>2]+(d[i+4>>2]<<2)>>2]),m[4+((e+868|0)+(d[i+4>>2]<<6)|0)>>2]=n,d[i+4>>2]=d[i+4>>2]+1;O=i+16|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0}function Ic(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Yo(d[i+12>>2],d[i+8>>2]),O=i+16|0}function Mc(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ht(d[i+12>>2],d[i+8>>2]),O=i+16|0}function Dc(e){var t;O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&(d[7718]=d[7718]+1,r[d[6607]](e)),O=t+16|0}function Oc(e){var t;O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],d[d[e+12>>2]>>2]=0,O=t+16|0}function wc(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],d[12+(O-16|0)>>2]=e,O=t+16|0,0|e}function Fc(e){var t;d[12+(t=O-16|0)>>2]=e,e=d[t+12>>2],s[e+16|0]=1,d[e+12>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0}function Bc(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&r[d[d[e>>2]+8>>2]](e),O=t+16|0}function Nc(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&r[d[d[e>>2]+4>>2]](e),O=t+16|0}function Lc(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,_[i+10>>1]=t,_[d[i+12>>2]+12>>1]=p[i+10>>1]}function kc(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,_[i+10>>1]=t,_[d[i+12>>2]+14>>1]=p[i+10>>1]}function Vc(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,_[i+10>>1]=t,_[d[i+12>>2]+10>>1]=p[i+10>>1]}function Uc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+40>>2]=m[i+8>>2]}function Gc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+28>>2]=m[i+8>>2]}function jc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+48>>2]=m[i+8>>2]}function Wc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+52>>2]=m[i+8>>2]}function zc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+56>>2]=m[i+8>>2]}function Hc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+60>>2]=m[i+8>>2]}function Xc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+64>>2]=m[i+8>>2]}function Yc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+68>>2]=m[i+8>>2]}function Qc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+36>>2]=m[i+8>>2]}function qc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+72>>2]=m[i+8>>2]}function Kc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+76>>2]=m[i+8>>2]}function Zc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+32>>2]=m[i+8>>2]}function $c(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,_[i+10>>1]=t,_[d[i+12>>2]+8>>1]=p[i+10>>1]}function Jc(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+16>>2]=m[i+8>>2]}function eh(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+20>>2]=m[i+8>>2]}function th(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+12>>2]=m[i+8>>2]}function ih(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+24>>2]=m[i+8>>2]}function nh(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+92>>2]=m[i+8>>2]}function rh(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+88>>2]=d[i+8>>2]}function sh(e,t,i){var n;O=n=O-16|0,d[n+12>>2]=t,d[n+8>>2]=i,zs(e,d[n+8>>2],d[n+12>>2]),O=n+16|0}function oh(e,t,i){var n;O=n=O-16|0,d[n+12>>2]=t,d[n+8>>2]=i,hs(e,d[n+12>>2],d[n+8>>2]),O=n+16|0}function ah(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+4>>2]=m[i+8>>2]}function lh(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+8>>2]=m[i+8>>2]}function ch(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+20>>2]=d[i+8>>2]}function hh(e){e|=0;var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=Ml(d[t+12>>2]),O=t+16|0,y(i)}function _h(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+8>>2]=d[i+8>>2]}function dh(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+4>>2]=d[i+8>>2]}function uh(e){var t;O=t=O-16|0,d[t+12>>2]=0,d[t+4>>2]=e,d[t>>2]=e,d[t+8>>2]=e+1,function(e){var t;O=t=O-16|0,d[t+8>>2]=d[e+4>>2],s[d[t+8>>2]]=1,s[d[e+8>>2]]=1,O=t+16|0}(t),O=t+16|0}function ph(e){var t;O=t=O-16|0,d[t+12>>2]=e,Sa(e=d[t+12>>2]),d[12+(O-16|0)>>2]=e+48,O=t+16|0}function fh(e){e|=0;var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=function(e){var t,i;return O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],d[t+8>>2]=(d[e+52>>2]+2|0)%3,d[12+(i=O-16|0)>>2]=e+28,O=t+16|0,m[d[i+12>>2]+(d[t+8>>2]<<2)>>2]}(d[t+12>>2]),O=t+16|0,y(i)}function mh(e){e|=0;var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=function(e){var t,i;return O=t=O-16|0,d[t+12>>2]=e,e=O-16|0,i=d[t+12>>2],d[e+12>>2]=i+28,O=t+16|0,m[d[e+12>>2]+(d[i+52>>2]<<2)>>2]}(d[t+12>>2]),O=t+16|0,y(i)}function gh(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],r[d[d[e>>2]+24>>2]](e),O=t+16|0}function bh(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]>>2]=m[i+8>>2]}function yh(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]>>2]=d[i+8>>2]}function vh(e){var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=ls(e=d[t+12>>2],e),O=t+16|0,i}function Ah(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-32|0,d[i+28>>2]=e,d[i+24>>2]=t,e=d[i+28>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],d[i+20>>2]=d[d[t+12>>2]+4>>2],t=d[i+20>>2],d[12+(O-16|0)>>2]=i,function(e,t,i){var n,r=0;if(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,t=O-16|0,e=d[n+28>>2],d[t+12>>2]=e,d[n+16>>2]=d[d[t+12>>2]+4>>2],d[n+24>>2]>2])for(d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)d[n+12>>2]=d[n+12>>2]+1;else for(t=d[n+24>>2],d[12+(i=O-16|0)>>2]=e,(0|t)>d[d[i+12>>2]+4>>2]&&ys(e,d[n+24>>2]),d[n+8>>2]=d[n+16>>2];d[n+8>>2]>2];)i=d[e+12>>2]+(d[n+8>>2]<<4)|0,d[12+(t=O-16|0)>>2]=16,d[t+8>>2]=i,i=d[n+20>>2],r=d[i+4>>2],t=d[t+8>>2],d[t>>2]=d[i>>2],d[t+4>>2]=r,r=d[i+12>>2],d[t+8>>2]=d[i+8>>2],d[t+12>>2]=r,d[n+8>>2]=d[n+8>>2]+1;d[e+4>>2]=d[n+24>>2],O=n+32|0}(e,t,i),Hr(d[i+24>>2],d[i+20>>2],d[e+12>>2]),O=i+32|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0}function Ch(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],d[i+4>>2]=d[d[t+12>>2]+4>>2],t=d[i+4>>2],d[i>>2]=0,pr(e,t,i),Fs(d[i+8>>2],d[i+4>>2],d[e+12>>2]),O=i+16|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0}function Sh(e){var t;O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],d[12+(O-16|0)>>2]=e,Fc(e),O=t+16|0}function xh(e,t){e|=0,!(t|=0)|!(2&d[t+236>>2])?Nr(e,t):r[d[d[e>>2]+92>>2]](e,t)}function Th(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&(c_(e),ve(e)),O=t+16|0}function Eh(e,t){3&u[e+204|0]&&!t||(4!=(-2&d[e+216>>2])&&(d[e+216>>2]=1),d[e+220>>2]=0)}function Rh(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=1&function(e){var t,i,n;return O=t=O-16|0,d[t+12>>2]=e,e=0,i=O-16|0,n=d[t+12>>2],d[i+12>>2]=n,2!=d[d[i+12>>2]+216>>2]&&(d[12+(e=O-16|0)>>2]=n,e=5!=d[d[e+12>>2]+216>>2]),O=t+16|0,1&e}(d[t+12>>2]),O=t+16|0,0|e}function Ph(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=function(e){var t;return O=t=O-16|0,d[t+12>>2]=e,e=d[d[t+12>>2]+68>>2],e=0|r[d[d[e>>2]+36>>2]](e),O=t+16|0,e}(d[t+12>>2]),O=t+16|0,0|e}function Ih(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=function(e){var t;return O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2]+264,O=t+16|0,d[d[e+12>>2]+4>>2]}(d[t+12>>2]),O=t+16|0,0|e}function Mh(e){var t=0;return(t=d[e+24>>2])&&ve(Mh(t)),(t=d[e+28>>2])&&ve(Mh(t)),e}function Dh(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&ve(e),O=t+16|0}function Oh(e,t,i,n,r,s){u[e+60|0]?Ne(e,t,i,n,r,s,d[e+56>>2]):ht(e,t,i,n,r,s)}function wh(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,wc(e=d[t+12>>2]),ve(e),O=t+16|0}function Fh(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&Dc(e),O=t+16|0}function Bh(e,t,i,n,r){return ae(e,26816,t,i,n,r)?1:_e(e,26816,t,i,n,r,0)}function Nh(e,t,i){var n;n=ts(e),d[e+92>>2]=t,d[e>>2]=14468,d[e+4>>2]=3,i&&Qn(n)}function Lh(e,t,i,n,r){!function(e,t,i,n,r){var o=y(0),a=0,l=y(0),c=0,h=0,_=0;e:{if(r&&!((0|(c=d[e+732>>2]))<1))for(_=d[e+740>>2],r=0;;){if(a=b(r,52)+_|0,h=d[a+8>>2],(d[a+12>>2]==(0|i)?(0|h)==(0|t):0)|(d[a+12>>2]==(0|t)?(0|i)==(0|h):0))break e;if((0|c)==(0|(r=r+1|0)))break}di(e,n),n=d[e+740>>2]+b(d[e+732>>2],52)|0,d[n+-40>>2]=i,d[n+-44>>2]=t,o=y(m[t+8>>2]-m[i+8>>2]),l=y(o*o),o=y(m[t+12>>2]-m[i+12>>2]),l=y(l+y(o*o)),o=y(m[t+16>>2]-m[i+16>>2]),m[n+-36>>2]=x(y(l+y(o*o))),s[e+924|0]=1}}(e,(e=d[e+720>>2])+b(t,104)|0,e+b(i,104)|0,n,r)}function kh(e,t,i){t=y(t),d[(i|=0)>>2]=0,d[i+4>>2]=0,d[i+8>>2]=0,d[i+12>>2]=0}function Vh(e){var t;return O=t=O-16|0,m[t+12>>2]=e,e=An(m[t+12>>2]),O=t+16|0,e}function Uh(e){var t;return O=t=O-16|0,m[t+12>>2]=e,e=yn(m[t+12>>2]),O=t+16|0,e}function Gh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+40>>2])}function jh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+28>>2])}function Wh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+48>>2])}function zh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+52>>2])}function Hh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+16>>2])}function Xh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+56>>2])}function Yh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+60>>2])}function Qh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+64>>2])}function qh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+68>>2])}function Kh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+36>>2])}function Zh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+72>>2])}function $h(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+92>>2])}function Jh(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+32>>2])}function e_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+20>>2])}function t_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+12>>2])}function i_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+24>>2])}function n_(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,Eh(d[t+12>>2],0),O=t+16|0}function r_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+76>>2])}function s_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+4>>2])}function o_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+8>>2])}function a_(e){var t;return(-1>>>(t=31&e)&-2)<>>e}function l_(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e){var t;O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],m[t+8>>2]=Ml(e),function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],m[i+4>>2]=y(1)/m[d[i+8>>2]>>2],qo(e,i+4|0),O=i+16|0}(e,t+8|0),O=t+16|0}(d[t+12>>2]),O=t+16|0}function c_(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e){var t,i;O=t=O-16|0,d[t+12>>2]=e,i=O-16|0,e=d[t+12>>2],d[i+12>>2]=e,Ua(e,d[d[i+12>>2]+4>>2]),_l(e),Fc(e),O=t+16|0}(d[t+12>>2]),O=t+16|0}function h_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,_[d[t+12>>2]+12>>1]}function __(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,_[d[t+12>>2]+14>>1]}function d_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]>>2])}function u_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,_[d[t+12>>2]+10>>1]}function p_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+20>>2]}function f_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+88>>2]}function m_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+4>>2]}function g_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+8>>2]}function b_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,_[d[t+12>>2]+8>>1]}function y_(e,t){t|=0,e=d[4+(e|=0)>>2],r[d[d[e>>2]+8>>2]](e,d[t+36>>2])}function v_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]>>2]}function A_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+52|0}function C_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+68|0}function S_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+28|0}function x_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+32|0}function T_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+92|0}function E_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+20|0}function R_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+40|0}function P_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+56|0}function I_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+72|0}function M_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+24|0}function D_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+16|0}function O_(e){d[(e|=0)>>2]=19288,e&&(d[7718]=d[7718]+1,r[d[6607]](e))}function w_(e,t,i,n){t|=0,i|=0,n|=0,r[d[d[(e|=0)>>2]+80>>2]](e,t,i,n)}function F_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+36|0}function B_(e){var t;O=t=O-16|0,d[t+12>>2]=e,c_(d[t+12>>2]),O=t+16|0}function N_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+8|0}function L_(e){var t;O=t=O-16|0,d[t+12>>2]=e,Sh(d[t+12>>2]),O=t+16|0}function k_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+4|0}function V_(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]}function U_(e,t,i,n,r){return y(y(1))}function G_(e){Ha(e|=0),e&&(d[7718]=d[7718]+1,r[d[6607]](e))}function j_(e,t,i,n,s){!function(e,t,i,n){var s,o,a=y(0),l=0,c=y(0),h=0,_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=0,C=0,S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=0;for(O=s=O-272|0,d[e+56>>2]=0,d[s+264>>2]=0,d[s+268>>2]=0,d[s+256>>2]=0,d[s+260>>2]=0,h=d[(l=t)+12>>2],d[s+168>>2]=d[l+8>>2],d[s+172>>2]=h,h=d[l+4>>2],d[s+160>>2]=d[l>>2],d[s+164>>2]=h,h=d[l+28>>2],d[s+184>>2]=d[l+24>>2],d[s+188>>2]=h,h=d[l+20>>2],d[s+176>>2]=d[l+16>>2],d[s+180>>2]=h,h=d[l+44>>2],d[s+200>>2]=d[l+40>>2],d[s+204>>2]=h,h=d[l+36>>2],d[s+192>>2]=d[l+32>>2],d[s+196>>2]=h,h=d[l+60>>2],d[s+216>>2]=d[l+56>>2],d[s+220>>2]=h,h=d[l+52>>2],d[s+208>>2]=d[l+48>>2],d[s+212>>2]=h,h=d[l+76>>2],d[s+104>>2]=d[l+72>>2],d[s+108>>2]=h,h=d[l+68>>2],d[s+96>>2]=d[l+64>>2],d[s+100>>2]=h,h=d[l+92>>2],d[s+120>>2]=d[l+88>>2],d[s+124>>2]=h,h=d[l+84>>2],d[s+112>>2]=d[l+80>>2],d[s+116>>2]=h,h=d[l+108>>2],d[s+136>>2]=d[l+104>>2],d[s+140>>2]=h,h=d[l+100>>2],d[s+128>>2]=d[l+96>>2],d[s+132>>2]=h,h=d[l+124>>2],d[s+152>>2]=d[l+120>>2],d[s+156>>2]=h,h=d[l+116>>2],d[s+144>>2]=d[l+112>>2],d[s+148>>2]=h,a=m[s+212>>2],c=m[s+148>>2],I=y(y(a+c)*y(.5)),m[s+212>>2]=a-I,a=m[s+216>>2],p=m[s+152>>2],M=y(y(a+p)*y(.5)),m[s+216>>2]=a-M,m[s+148>>2]=c-I,m[s+152>>2]=p-M,a=m[s+208>>2],c=m[s+144>>2],D=y(y(a+c)*y(.5)),m[s+208>>2]=a-D,m[s+144>>2]=c-D,C=d[d[e+28>>2]+4>>2]+-17>>>0<=1?d[d[e+32>>2]+4>>2]+-17>>>0<2:C,v=m[e+44>>2],a=m[e+48>>2],d[6738]=d[6738]+1,d[e+68>>2]=0,d[e+12>>2]=0,d[e+16>>2]=0,d[e+4>>2]=0,d[e+8>>2]=1065353216,d[e+60>>2]=-1,d[e+64>>2]=0,o=u[e+52|0],Qs(d[e+24>>2]),b=o?y(0):a,l=e+4|0,c=y(0xde0b6b000000000);;){g=m[t+32>>2],S=m[t+16>>2],E=m[t>>2],R=m[t+36>>2],P=m[t+20>>2],w=m[t+4>>2],F=m[t+40>>2],a=m[e+12>>2],_=m[t+24>>2],f=m[e+8>>2],B=m[t+8>>2],p=m[e+4>>2],d[s+252>>2]=0,T=_,_=y(-f),m[s+248>>2]=y(y(T*_)-y(p*B))-y(a*F),m[s+244>>2]=y(y(P*_)-y(p*w))-y(a*R),m[s+240>>2]=y(y(S*_)-y(p*E))-y(a*g),_=m[t+96>>2],g=m[t+64>>2],S=m[t+80>>2],E=m[t+100>>2],R=m[t+68>>2],P=m[t+84>>2],w=m[t+104>>2],F=m[t+72>>2],B=m[t+88>>2],d[s+236>>2]=0,m[s+232>>2]=y(y(p*F)+y(f*B))+y(a*w),m[s+228>>2]=y(y(p*R)+y(f*P))+y(a*E),m[s+224>>2]=y(y(p*g)+y(f*S))+y(a*_),pe(s+80|0,d[e+28>>2],s+240|0),pe(s- -64|0,d[e+32>>2],s+224|0),d[s+60>>2]=0,a=m[s+80>>2],f=m[s+84>>2],_=m[s+88>>2],p=y(y(y(y(a*m[s+192>>2])+y(f*m[s+196>>2]))+y(_*m[s+200>>2]))+m[s+216>>2]),m[s+56>>2]=p,S=y(y(y(y(a*m[s+176>>2])+y(f*m[s+180>>2]))+y(_*m[s+184>>2]))+m[s+212>>2]),m[s+52>>2]=S,E=y(y(y(y(a*m[s+160>>2])+y(f*m[s+164>>2]))+y(_*m[s+168>>2]))+m[s+208>>2]),m[s+48>>2]=E,d[s+44>>2]=0,a=m[s+64>>2],_=m[s+68>>2],g=m[s+72>>2],f=y(y(y(y(a*m[s+128>>2])+y(_*m[s+132>>2]))+y(g*m[s+136>>2]))+m[s+152>>2]),m[s+40>>2]=f,R=y(y(y(y(a*m[s+112>>2])+y(_*m[s+116>>2]))+y(g*m[s+120>>2]))+m[s+148>>2]),m[s+36>>2]=R,a=y(y(y(y(a*m[s+96>>2])+y(_*m[s+100>>2]))+y(g*m[s+104>>2]))+m[s+144>>2]),m[s+32>>2]=a,C&&(d[s+40>>2]=0,d[s+56>>2]=0,f=y(0),p=y(0)),d[s+28>>2]=0,p=y(p-f),m[s+24>>2]=p,a=y(E-a),m[s+16>>2]=a,f=y(S-R),m[s+20>>2]=f;e:{if((a=y(y(y(a*m[e+4>>2])+y(f*m[e+8>>2]))+y(p*m[e+12>>2])))>y(0)^1|y(a*a)>y(c*m[t+128>>2])^1){if(Vr(d[e+24>>2],s+16|0)){A=1,d[e+68>>2]=1,h=2;break e}if((a=y(c-a))<=y(c*y(9.999999974752427e-7))){h=2,d[e+68>>2]=a<=y(0)?2:11,A=1;break e}if(xr(d[e+24>>2],s+16|0,s+48|0,s+32|0),qa(d[e+24>>2],s)){if(a=m[s>>2],_=y(a*a),a=m[s+4>>2],_=y(_+y(a*a)),a=m[s+8>>2],!((a=y(_+y(a*a)))>2]=12,A=1,h=2):(h=d[s+4>>2],d[l>>2]=d[s>>2],d[l+4>>2]=h,h=d[s+12>>2],d[l+8>>2]=d[s+8>>2],d[l+12>>2]=h,N=d[e+64>>2],d[e+64>>2]=N+1,h=2,(0|N)>1e3||(4==d[d[e+24>>2]>>2]?d[e+68>>2]=13:h=0)),c=a;break e}h=d[s+4>>2],d[l>>2]=d[s>>2],d[l+4>>2]=h,h=d[s+12>>2],d[l+8>>2]=d[s+8>>2],d[l+12>>2]=h,d[e+68>>2]=6}else d[e+68>>2]=3}else d[e+68>>2]=10;A=1,h=2}if(h)break}a=y(0),p=o?y(0):v,f=y(p+b),C=0,h=0,1&A&&(io(d[e+24>>2],s+240|0,s+224|0),A=d[l+12>>2],d[s+264>>2]=d[l+8>>2],d[s+268>>2]=A,A=d[l+4>>2],d[s+256>>2]=d[l>>2],d[s+260>>2]=A,a=m[e+4>>2],_=m[e+8>>2],g=m[e+12>>2],+(v=y(y(y(a*a)+y(_*_))+y(g*g)))<1e-4&&(d[e+68>>2]=5),A=1,v>y(14210854715202004e-30)?(v=y(y(1)/y(x(v))),m[s+256>>2]=v*m[s+256>>2],m[s+260>>2]=v*m[s+260>>2],m[s+264>>2]=v*m[s+264>>2],S=y(x(c)),c=y(p/S),m[s+240>>2]=m[s+240>>2]-y(c*a),m[s+244>>2]=m[s+244>>2]-y(c*_),m[s+248>>2]=m[s+248>>2]-y(c*g),c=y(b/S),m[s+224>>2]=y(c*a)+m[s+224>>2],m[s+228>>2]=y(c*_)+m[s+228>>2],m[s+232>>2]=y(c*g)+m[s+232>>2],h=1,a=y(y(y(1)/v)-f)):(A=2,a=y(0)),d[e+60>>2]=A),!d[e+68>>2]|!d[e+72>>2]|!d[e+20>>2]||(C=+y(f+a)<.01);e:{t:{if(((A=1^h)||C)&&(C=d[e+20>>2])){if(d[6737]=d[6737]+1,d[l+8>>2]=0,d[l+12>>2]=0,d[l>>2]=0,d[l+4>>2]=0,r[d[d[C>>2]+8>>2]](C,d[e+24>>2],d[e+28>>2],d[e+32>>2],s+160|0,s+96|0,l,s+80|0,s- -64|0,n)){if(g=y(0),C=9,c=m[s+64>>2],v=m[s+80>>2],b=y(c-v),S=m[s+68>>2],E=m[s+84>>2],_=y(S-E),R=m[s+72>>2],P=m[s+88>>2],p=y(R-P),(f=y(y(y(b*b)+y(_*_))+y(p*p)))<=y(14210854715202004e-30)&&(g=m[e+16>>2],b=m[e+4>>2],_=m[e+8>>2],p=m[e+12>>2],f=y(y(y(b*b)+y(_*_))+y(p*p))),f>y(14210854715202004e-30)&&(C=8,c=y(v-c),T=y(c*c),c=y(E-S),T=y(T+y(c*c)),c=y(P-R),!((a>(c=y(-y(x(y(T+y(c*c))))))^-1)&(1^A)))){n=d[s+92>>2],d[s+248>>2]=d[s+88>>2],d[s+252>>2]=n,n=d[s+76>>2],d[s+232>>2]=d[s+72>>2],d[s+236>>2]=n,n=d[s+84>>2],d[s+240>>2]=d[s+80>>2],d[s+244>>2]=n,n=d[s+68>>2],d[s+224>>2]=d[s+64>>2],d[s+228>>2]=n,m[s+268>>2]=g,a=y(y(1)/y(x(f))),m[s+264>>2]=p*a,m[s+260>>2]=_*a,m[s+256>>2]=b*a,d[e+60>>2]=3,a=c;break t}if(d[e+60>>2]=C,h)break t;break e}if(_=m[e+4>>2],g=m[e+8>>2],v=m[e+12>>2],y(y(y(_*_)+y(g*g))+y(v*v))>y(0)){if(c=y(m[s+80>>2]-m[s+64>>2]),T=y(c*c),c=y(m[s+84>>2]-m[s+68>>2]),T=y(T+y(c*c)),c=y(m[s+88>>2]-m[s+72>>2]),!(((c=y(y(x(y(T+y(c*c))))-f))>2],d[s+248>>2]=d[s+88>>2],d[s+252>>2]=n,n=d[s+76>>2],d[s+232>>2]=d[s+72>>2],d[s+236>>2]=n,m[s+248>>2]=m[s+248>>2]-y(p*v),m[s+232>>2]=y(b*v)+m[s+232>>2],n=d[s+68>>2],d[s+224>>2]=d[s+64>>2],d[s+228>>2]=n,n=d[s+84>>2],d[s+240>>2]=d[s+80>>2],d[s+244>>2]=n,m[s+224>>2]=y(b*_)+m[s+224>>2],m[s+228>>2]=y(b*g)+m[s+228>>2],m[s+240>>2]=m[s+240>>2]-y(p*_),m[s+244>>2]=m[s+244>>2]-y(p*g),n=d[l+12>>2],d[s+264>>2]=d[l+8>>2],d[s+268>>2]=n,n=d[l+4>>2],d[s+256>>2]=d[l>>2],d[s+260>>2]=n,p=m[s+256>>2],f=m[s+260>>2],b=m[s+264>>2],a=y(y(1)/y(x(y(y(y(p*p)+y(f*f))+y(b*b))))),m[s+264>>2]=b*a,m[s+260>>2]=f*a,m[s+256>>2]=p*a,d[e+60>>2]=6,a=c;break t}d[e+60>>2]=5}}if(!h)break e}y(a*a)>2]^1&&!(a>2]&&(t=d[e+28>>2],r[d[d[t>>2]+8>>2]](t,s+160|0,s+80|0,s- -64|0),c=m[s+88>>2],p=m[s+72>>2],f=m[s+80>>2],b=m[s+64>>2],_=m[s+84>>2],g=m[s+68>>2],t=d[e+32>>2],r[d[d[t>>2]+8>>2]](t,s+96|0,s+80|0,s- -64|0),T=y(y(y(b+f)*y(.5))-y(y(m[s+80>>2]+m[s+64>>2])*y(.5))),f=m[s+256>>2],b=m[s+260>>2],p=y(y(y(p+c)*y(.5))-y(y(m[s+88>>2]+m[s+72>>2])*y(.5))),c=m[s+264>>2],y(y(y(T*f)+y(y(y(y(g+_)*y(.5))-y(y(m[s+84>>2]+m[s+68>>2])*y(.5)))*b))+y(p*c))>2]=-c,m[s+260>>2]=-b,m[s+256>>2]=-f)),t=d[s+260>>2],d[l>>2]=d[s+256>>2],d[l+4>>2]=t,t=d[s+268>>2],d[l+8>>2]=d[s+264>>2],d[l+12>>2]=t,m[e+56>>2]=a,d[s+92>>2]=0,m[s+88>>2]=M+m[s+232>>2],m[s+84>>2]=I+m[s+228>>2],m[s+80>>2]=D+m[s+224>>2],r[d[d[i>>2]+16>>2]](i,s+256|0,s+80|0,a))}O=s+272|0}(e|=0,t|=0,i|=0,n|=0)}function W_(e,t){return t|=0,d[d[220+(e|=0)>>2]+(t<<2)>>2]}function z_(e){(e|=0)&&(d[7718]=d[7718]+1,r[d[6607]](e))}function H_(e,t,i,n,o,a){!function(e,t,i,n,o,a){var l=y(0);if(d[e+104>>2]=0,d[e+108>>2]=0,s[e+100|0]=0,d[e+96>>2]=0,d[e+92>>2]=o,_[e+6>>1]=65535,_[e+4>>1]=65534,d[e>>2]=16640,o||(d[7717]=d[7717]+1,Zn(o=0|r[d[6606]](76,16)),s[e+100|0]=1,d[e+92>>2]=o),a||(d[7717]=d[7717]+1,o=0|r[d[6606]](24,16),d[o+20>>2]=0,d[o+4>>2]=0,d[o+8>>2]=0,d[o>>2]=16704,d[o+12>>2]=0,d[o+16>>2]=0,s[o+20|0]=1,d[o+8>>2]=0,d[e+112>>2]=o,d[7717]=d[7717]+1,Jr(o=0|r[d[6606]](196,16),d[e+112>>2]),d[e+108>>2]=o,s[o+193|0]=1),o=d[t+4>>2],d[e+8>>2]=d[t>>2],d[e+12>>2]=o,o=d[t+12>>2],d[e+16>>2]=d[t+8>>2],d[e+20>>2]=o,t=d[i+12>>2],d[e+32>>2]=d[i+8>>2],d[e+36>>2]=t,t=d[i+4>>2],d[e+24>>2]=d[i>>2],d[e+28>>2]=t,d[e+52>>2]=0,l=y(p[e+6>>1]),m[e+48>>2]=l/y(m[e+32>>2]-m[e+16>>2]),m[e+44>>2]=l/y(m[e+28>>2]-m[e+12>>2]),m[e+40>>2]=l/y(m[e+24>>2]-m[e+8>>2]),d[7717]=d[7717]+1,o=(i=65535&(n=n+1|0))<<6,t=0|r[d[6606]](o,16),i)for(a=t+o|0,o=t;d[o+8>>2]=0,d[o>>2]=0,(0|a)!=(0|(o=o- -64|0)););if(_[e+58>>1]=n,d[e+60>>2]=t,o=1,_[e+64>>1]=1,_[e+56>>1]=0,i>>>0>1)for(;n=t+(o<<6)|0,o=o+1|0,_[n+48>>1]=o,(0|i)!=(0|o););_[(t+(i<<6)|0)-16>>1]=0,d[7717]=d[7717]+1,t=i<<3,i=0|r[d[6606]](t,16),d[e+68>>2]=i,d[e+80>>2]=i,d[7717]=d[7717]+1,i=0|r[d[6606]](t,16),d[e+72>>2]=i,d[e+84>>2]=i,d[7717]=d[7717]+1,t=0|r[d[6606]](t,16),d[e+76>>2]=t,d[e+88>>2]=t,t=d[e+60>>2],_[t+48>>1]=0,d[t>>2]=0,_[t+54>>1]=1,i=d[e+68>>2],_[i>>1]=0,_[i+2>>1]=0,n=p[e+6>>1],_[i+6>>1]=0,_[i+4>>1]=n,_[t+56>>1]=1,_[t+50>>1]=0,i=d[e+72>>2],_[i>>1]=0,_[i+2>>1]=0,n=p[e+6>>1],_[i+6>>1]=0,_[i+4>>1]=n,_[t+58>>1]=1,_[t+52>>1]=0,t=d[e+76>>2],_[t>>1]=0,_[t+2>>1]=0,e=p[e+6>>1],_[t+6>>1]=0,_[t+4>>1]=e}(e,t,i,n,o,a),d[e>>2]=16476}function X_(e,t){t|=0,r[d[d[(e|=0)>>2]+64>>2]](e,t)}function Y_(e,t){t|=0,r[d[d[(e|=0)>>2]+68>>2]](e,t)}function Q_(e){nt(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0)}function q_(e,t,i){mi(e+4|0,e+312|0,e+328|0,t,i)}function K_(e,t,i){return i=y(i),0}function Z_(e){return d[(e|=0)>>2]=19288,0|e}function $_(e,t,i){return 0}function J_(e,t,i,n){n=y(n)}function ed(e){e|=0,d[12+(O-16|0)>>2]=e,T()}function td(e,t,i,n){}function id(e,t,i,n){return e=function(e,t,i,n){var r,s,o,a,l=0,c=0;return a=b(l=i>>>16|0,c=e>>>16|0),l=(65535&(c=((o=b(r=65535&i,s=65535&e))>>>16|0)+b(c,r)|0))+b(l,s)|0,e=(b(t,i)+a|0)+b(e,n)+(c>>>16)+(l>>>16)|0,w=e,65535&o|l<<16}(e,t,i,n),e}function nd(e){return function(e){s[e+60|0]=0,d[e+52>>2]=282,d[e>>2]=17612,d[e+144>>2]=0,s[e+80|0]=1,d[e+76>>2]=0,s[e+100|0]=1,d[e+68>>2]=0,d[e+72>>2]=0,d[e+96>>2]=0,s[e+120|0]=1,d[e+88>>2]=0,d[e+92>>2]=0,d[e+116>>2]=0,s[e+140|0]=1,d[e+108>>2]=0,d[e+112>>2]=0,d[e+136>>2]=0,s[e+164|0]=1,d[e+128>>2]=0,d[e+132>>2]=0,d[e+160>>2]=0,d[e+168>>2]=0,d[e+152>>2]=0,d[e+156>>2]=0,d[e+4>>2]=-8388609,d[e+8>>2]=-8388609,d[e+12>>2]=-8388609,d[e+16>>2]=0,d[e+20>>2]=2139095039,d[e+24>>2]=2139095039,d[e+28>>2]=2139095039,d[e+32>>2]=0}(e),d[e>>2]=15164,e}function rd(e,t){e|=0,t=y(t),m[e+44>>2]=t}function sd(e,t){t|=0,d[72+(e|=0)>>2]=t}function od(e){return d[136+(e|=0)>>2]}function ad(e){return d[92+(e|=0)>>2]}function ld(e){return d[16+(e|=0)>>2]}function cd(e){return d[96+(e|=0)>>2]}function hd(e){return d[24+(e|=0)>>2]}function _d(e){return d[68+(e|=0)>>2]}function dd(e,t){return 1}function ud(e){return d[8+(e|=0)>>2]}function pd(e,t,i){t=y(t)}function fd(e,t,i){}function md(e){return 4+(e|=0)|0}function gd(e){return 0|e}function bd(e){return 84}function yd(e){return 52}function vd(e){return 60}function Ad(e){return 12}function Cd(e){return 0}function Sd(e){return 2}function xd(e){return 1}function Td(e){return 6}function Ed(e){return 3}function Rd(e,t){}function Pd(e){ve(e|=0)}function Id(e){T()}function Md(){return 1}function Dd(){return 2}function Od(){return 3}function wd(){return 4}function Fd(e){}return r[1]=wc,r[2]=wh,r[3]=function(e,t){var i;return e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],s[i+7|0]=0!=(_[d[i+8>>2]+4>>1]&_[t+10>>1]),s[i+7|0]=1&s[i+7|0]?0!=(_[t+8>>1]&_[d[i+8>>2]+6>>1]):0,1&s[i+7|0]},r[4]=function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,s[n+23|0]=i,e=d[n+28>>2],m[e+4>>2]=m[d[n+24>>2]+40>>2],d[e+76>>2]=d[d[n+24>>2]>>2],1&s[n+23|0]?(t=d[n+24>>2],i=d[t+12>>2],d[e+44>>2]=d[t+8>>2],d[e+48>>2]=i,i=d[t+20>>2],d[e+52>>2]=d[t+16>>2],d[e+56>>2]=i):(d[12+(t=O-16|0)>>2]=d[e+76>>2],d[12+(i=O-16|0)>>2]=d[t+12>>2]+4,Zr(n,d[i+12>>2],d[n+24>>2]+8|0),t=d[n+4>>2],d[e+44>>2]=d[n>>2],d[e+48>>2]=t,t=d[n+12>>2],d[e+52>>2]=d[n+8>>2],d[e+56>>2]=t),t=d[n+24>>2],i=d[t+28>>2],d[e+60>>2]=d[t+24>>2],d[e+64>>2]=i,i=d[t+36>>2],d[e+68>>2]=d[t+32>>2],d[e+72>>2]=i,O=n+32|0,y(m[d[n+24>>2]+40>>2])},r[5]=V_,r[6]=ed,r[7]=function(){T()},r[8]=ba,r[9]=function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,ba(e=d[t+12>>2]),ve(e),O=t+16|0},r[10]=function(e,t){var i;return e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],s[i+7|0]=0!=(_[d[i+8>>2]+4>>1]&_[t+14>>1]),s[i+7|0]=1&s[i+7|0]?0!=(_[t+12>>1]&_[d[i+8>>2]+6>>1]):0,1&s[i+7|0]},r[11]=function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O+-64|0,d[n+60>>2]=e,d[n+56>>2]=t,s[n+55|0]=i,e=d[n+60>>2],d[e+8>>2]=d[d[n+56>>2]>>2],function(e,t){var i,n=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[i+4>>2]=d[d[t+12>>2]+4>>2],t=d[i+4>>2],d[12+(n=O-16|0)>>2]=e,d[d[n+12>>2]+8>>2]==(0|t)&&(d[12+(n=O-16|0)>>2]=e,t=d[d[n+12>>2]+4>>2],d[12+(n=O-16|0)>>2]=e,d[n+8>>2]=t,fs(t=e,n=d[n+8>>2]?d[n+8>>2]<<1:1)),d[d[e+12>>2]+(d[e+4>>2]<<2)>>2]=d[d[i+8>>2]>>2],d[e+4>>2]=d[e+4>>2]+1,O=i+16|0}(e+20|0,d[n+56>>2]),d[12+(O-16|0)>>2]=n+32,1&s[n+55|0]?(t=d[n+56>>2],i=d[t+12>>2],d[n+32>>2]=d[t+8>>2],d[n+36>>2]=i,i=d[t+20>>2],d[n+40>>2]=d[t+16>>2],d[n+44>>2]=i):(d[12+(t=O-16|0)>>2]=d[e+8>>2],d[12+(i=O-16|0)>>2]=d[t+12>>2]+4,Zr(n+16|0,d[i+12>>2],d[n+56>>2]+8|0),t=d[n+20>>2],d[n+32>>2]=d[n+16>>2],d[n+36>>2]=t,t=d[n+28>>2],d[n+40>>2]=d[n+24>>2],d[n+44>>2]=t),ur(e+72|0,n+32|0),d[12+(O-16|0)>>2]=n,ss(n,e+40|0,e+56|0,m[d[n+56>>2]+24>>2]),ur(e+92|0,n),function(e,t){var i,n=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[i+4>>2]=d[d[t+12>>2]+4>>2],t=d[i+4>>2],d[12+(n=O-16|0)>>2]=e,d[d[n+12>>2]+8>>2]==(0|t)&&(d[12+(n=O-16|0)>>2]=e,t=d[d[n+12>>2]+4>>2],d[12+(n=O-16|0)>>2]=e,d[n+8>>2]=t,ms(t=e,n=d[n+8>>2]?d[n+8>>2]<<1:1)),m[d[e+12>>2]+(d[e+4>>2]<<2)>>2]=m[d[i+8>>2]>>2],d[e+4>>2]=d[e+4>>2]+1,O=i+16|0}(e+112|0,d[n+56>>2]+24|0),O=n- -64|0,y(m[e+4>>2])},r[12]=V_,r[13]=ed,r[14]=V_,r[15]=ed,r[16]=wc,r[17]=function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,wc(e=d[t+12>>2]),Dc(e),O=t+16|0},r[18]=function(e,t){var i,n;e|=0,t|=0,O=i=O-144|0,d[i+140>>2]=e,d[i+136>>2]=t,Ia(e=i+8|0,(t=d[i+140>>2])+68|0),Ta(n=i+72|0,e,t+4|0),ao(d[i+136>>2],n),O=i+144|0},r[19]=function(e,t){var i;e|=0,t|=0,O=i=O-80|0,d[i+76>>2]=e,d[i+72>>2]=t,e=i+8|0,t=d[i+76>>2],Ta(e,d[i+72>>2],t+68|0),ao(t+4|0,e),O=i+80|0},r[20]=V_,r[21]=ed,r[22]=wc,r[23]=wh,r[24]=function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,d[n+16>>2]=d[d[n+24>>2]>>2],d[n+12>>2]=d[d[n+20>>2]>>2],d[n+8>>2]=ta(d[n+16>>2]),d[n+4>>2]=ta(d[n+12>>2]),d[n+8>>2]&&(e=d[n+8>>2],r[d[d[e>>2]+28>>2]](e,d[n+20>>2],d[n+24>>2])),d[n+4>>2]&&(e=d[n+4>>2],r[d[d[e>>2]+28>>2]](e,d[n+24>>2],d[n+20>>2])),O=n+32|0,0},r[25]=function(e,t,i,n){var s;return e|=0,t|=0,i|=0,n|=0,O=s=O-32|0,d[s+28>>2]=e,d[s+24>>2]=t,d[s+20>>2]=i,d[s+16>>2]=n,d[s+12>>2]=d[d[s+24>>2]>>2],d[s+8>>2]=d[d[s+20>>2]>>2],d[s+4>>2]=ta(d[s+12>>2]),d[s>>2]=ta(d[s+8>>2]),d[s+4>>2]&&(e=d[s+4>>2],r[d[d[e>>2]+32>>2]](e,d[s+20>>2],d[s+16>>2],d[s+24>>2])),d[s>>2]&&(e=d[s>>2],r[d[d[e>>2]+32>>2]](e,d[s+24>>2],d[s+16>>2],d[s+20>>2])),O=s+32|0,0},r[26]=function(e,t,i){var n;e|=0,t|=0,i|=0,d[12+(n=O-16|0)>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i},r[27]=V_,r[28]=ed,r[29]=wc,r[30]=wh,r[31]=function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,s[n+23|0]=i,e=d[n+28>>2],m[e+4>>2]=m[d[n+24>>2]+24>>2],d[e+8>>2]=d[d[n+24>>2]>>2],1&s[n+23|0]?(t=d[n+24>>2],i=d[t+12>>2],d[e+52>>2]=d[t+8>>2],d[e+56>>2]=i,i=d[t+20>>2],d[e+60>>2]=d[t+16>>2],d[e+64>>2]=i):(d[12+(t=O-16|0)>>2]=d[e+8>>2],d[12+(i=O-16|0)>>2]=d[t+12>>2]+4,Zr(n,d[i+12>>2],d[n+24>>2]+8|0),t=d[n+4>>2],d[e+52>>2]=d[n>>2],d[e+56>>2]=t,t=d[n+12>>2],d[e+60>>2]=d[n+8>>2],d[e+64>>2]=t),ss(e+68|0,e+20|0,e+36|0,m[d[n+24>>2]+24>>2]),O=n+32|0,y(m[d[n+24>>2]+24>>2])},r[32]=wc,r[33]=wh,r[34]=function(e,t){var i;return e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],s[i+7|0]=0!=(_[d[i+8>>2]+4>>1]&_[t+6>>1]),s[i+7|0]=1&s[i+7|0]?0!=(_[t+4>>1]&_[d[i+8>>2]+6>>1]):0,1&s[i+7|0]},r[35]=function(e,t,i,n,r,s,o,a){var l,c;return e|=0,t|=0,i|=0,n|=0,r|=0,s|=0,o|=0,a|=0,O=l=O+-64|0,d[l+60>>2]=e,d[l+56>>2]=t,d[l+52>>2]=i,d[l+48>>2]=n,d[l+44>>2]=r,d[l+40>>2]=s,d[l+36>>2]=o,d[l+32>>2]=a,e=d[l+60>>2],t=d[l+56>>2],i=d[l+52>>2],n=d[l+48>>2],r=d[l+44>>2],s=d[l+40>>2],o=d[l+36>>2],d[l+28>>2]=d[l+32>>2],d[l+24>>2]=o,d[l+20>>2]=s,d[l+16>>2]=r,d[l+12>>2]=n,d[l+8>>2]=i,d[l+4>>2]=t,d[l>>2]=e,c=+P(1960,2256,0|l),O=l- -64|0,y(y(c))},r[36]=V_,r[37]=ed,r[38]=wc,r[39]=wh,r[40]=function(e,t,i,n){var r;e|=0,t|=0,i|=0,n|=0,O=r=O-32|0,d[r+28>>2]=e,d[r+24>>2]=t,d[r+20>>2]=i,d[r+16>>2]=n,e=d[r+28>>2],t=d[r+24>>2],i=d[r+20>>2],d[r+12>>2]=d[r+16>>2],d[r+8>>2]=i,d[r+4>>2]=t,d[r>>2]=e,E(2520,2740,0|r),O=r+32|0},r[41]=function(e,t,i,n,s){var o;e|=0,t|=0,i|=0,n|=0,s|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,d[o+12>>2]=s,e=d[o+28>>2],r[d[d[e>>2]+8>>2]](e,d[o+24>>2],d[o+20>>2],d[o+16>>2]),O=o+32|0},r[42]=function(e,t,i,n){e|=0,t=y(t),i|=0,n|=0;var s,o=0,a=0;O=s=O-112|0,d[s+108>>2]=e,m[s+104>>2]=t,d[s+100>>2]=i,d[s+96>>2]=n,i=d[s+108>>2],d[12+(n=O-16|0)>>2]=d[s+100>>2],n=d[n+12>>2]+48|0,o=d[n+4>>2],d[(e=s+80|0)>>2]=d[n>>2],d[e+4>>2]=o,o=d[n+12>>2],d[e+8>>2]=d[n+8>>2],d[e+12>>2]=o,d[12+(o=O-16|0)>>2]=d[s+100>>2],ws(n=s- -64|0,d[o+12>>2],1),d[12+(a=O-16|0)>>2]=d[s+100>>2],ws(o=s+48|0,d[a+12>>2],0),m[s+44>>2]=-1.5707963705062866,m[s+40>>2]=1.5707963705062866,m[s+36>>2]=-1.5707963705062866,m[s+32>>2]=1.5707963705062866,m[s+28>>2]=30,r[d[d[i>>2]+64>>2]](i,e,n,o,m[s+104>>2],m[s+44>>2],m[s+40>>2],m[s+36>>2],m[s+32>>2],d[s+96>>2],m[s+28>>2],0),va(a=s+8|0,o),r[d[d[i>>2]+64>>2]](i,e,n,a,m[s+104>>2],m[s+44>>2],m[s+40>>2],m[s+36>>2],m[s+32>>2],d[s+96>>2],m[s+28>>2],0),O=s+112|0},r[43]=function(e,t,i,n){var s;e|=0,t|=0,i=y(i),n|=0,O=s=O-80|0,d[s+76>>2]=e,d[s+72>>2]=t,m[s+68>>2]=i,d[s+64>>2]=n,e=d[s+76>>2],ph(s),al(s),Go(s,d[s+72>>2]),r[d[d[e>>2]+16>>2]](e,m[s+68>>2],s,d[s+64>>2]),O=s+80|0},r[44]=function(e,t,i,n,s,o,a,l,c){var h;e|=0,t|=0,i|=0,n|=0,s|=0,o|=0,a|=0,l|=0,c=y(c),O=h=O-48|0,d[h+44>>2]=e,d[h+40>>2]=t,d[h+36>>2]=i,d[h+32>>2]=n,d[h+28>>2]=s,d[h+24>>2]=o,d[h+20>>2]=a,d[h+16>>2]=l,m[h+12>>2]=c,e=d[h+44>>2],r[d[d[e>>2]+28>>2]](e,d[h+40>>2],d[h+36>>2],d[h+32>>2],d[h+16>>2],m[h+12>>2]),O=h+48|0},r[45]=function(e,t,i,n,s,o){var a;e|=0,t|=0,i|=0,n|=0,s|=0,o=y(o),O=a=O-32|0,d[a+28>>2]=e,d[a+24>>2]=t,d[a+20>>2]=i,d[a+16>>2]=n,d[a+12>>2]=s,m[a+8>>2]=o,e=d[a+28>>2],r[d[d[e>>2]+8>>2]](e,d[a+24>>2],d[a+20>>2],d[a+12>>2]),r[d[d[e>>2]+8>>2]](e,d[a+20>>2],d[a+16>>2],d[a+12>>2]),r[d[d[e>>2]+8>>2]](e,d[a+16>>2],d[a+24>>2],d[a+12>>2]),O=a+32|0},r[46]=function(e,t,i,n,r,s){var o;e|=0,t|=0,i|=0,n=y(n),r|=0,s|=0,O=o=O+-64|0,d[o+60>>2]=e,d[o+56>>2]=t,d[o+52>>2]=i,m[o+48>>2]=n,d[o+44>>2]=r,d[o+40>>2]=s,e=d[o+60>>2],t=d[o+56>>2],i=d[o+52>>2],n=m[o+48>>2],r=d[o+44>>2],d[o+28>>2]=d[o+40>>2],d[o+24>>2]=r,g[o+16>>3]=n,d[o+8>>2]=i,d[o+4>>2]=t,d[o>>2]=e,E(2745,2995,0|o),O=o- -64|0},r[47]=function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[i+4>>2]=d[i+8>>2],d[i>>2]=e,E(3002,3246,0|i),O=i+16|0},r[48]=function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,e=d[n+28>>2],t=d[n+24>>2],d[n+8>>2]=d[n+20>>2],d[n+4>>2]=t,d[n>>2]=e,E(3249,3472,0|n),O=n+32|0},r[49]=function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[i+4>>2]=d[i+8>>2],d[i>>2]=e,E(3476,3702,0|i),O=i+16|0},r[50]=function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[t>>2]=d[t+12>>2],e=0|E(3705,3936,0|t),O=t+16|0,0|e},r[51]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=0,a=y(0),l=0;for(O=s=O-272|0,d[s+268>>2]=e,d[s+264>>2]=t,d[s+260>>2]=i,d[s+256>>2]=n,n=d[s+268>>2],Ws(e=s+224|0,d[s+260>>2],d[s+264>>2]),m[s+220>>2]=.5,zs(s+240|0,e,s+220|0),js(e=s+184|0,d[s+260>>2],d[s+264>>2]),m[s+180>>2]=.5,zs(s+200|0,e,s+180|0),m[s+148>>2]=1,m[s+144>>2]=1,m[s+140>>2]=1,Zo(s+152|0,s+148|0,s+144|0,s+140|0),d[12+(O-16|0)>>2]=s+120,d[12+(O-16|0)>>2]=s+104,d[s+176>>2]=0;d[s+176>>2]<4;){for(d[s+172>>2]=0;d[s+172>>2]<3;)e=s+152|0,d[12+(t=O-16|0)>>2]=e,a=m[d[t+12>>2]>>2],t=s+240|0,d[12+(i=O-16|0)>>2]=t,m[s+84>>2]=a*m[d[i+12>>2]>>2],d[12+(i=O-16|0)>>2]=e,a=m[d[i+12>>2]+4>>2],d[12+(i=O-16|0)>>2]=t,m[s+80>>2]=a*m[d[i+12>>2]+4>>2],d[12+(i=O-16|0)>>2]=e,a=m[d[i+12>>2]+8>>2],d[12+(i=O-16|0)>>2]=t,m[s+76>>2]=a*m[d[i+12>>2]+8>>2],Zo(s+88|0,s+84|0,s+80|0,s+76|0),l=d[s+92>>2],d[(i=s+120|0)>>2]=d[s+88>>2],d[i+4>>2]=l,l=d[s+100>>2],d[i+8>>2]=d[s+96>>2],d[i+12>>2]=l,Ro(i,l=s+200|0),d[s+72>>2]=d[s+172>>2]%3,d[12+(o=O-16|0)>>2]=e,o=d[o+12>>2]+(d[s+72>>2]<<2)|0,m[o>>2]=m[o>>2]*y(-1),d[12+(o=O-16|0)>>2]=e,a=m[d[o+12>>2]>>2],d[12+(o=O-16|0)>>2]=t,m[s+52>>2]=a*m[d[o+12>>2]>>2],d[12+(o=O-16|0)>>2]=e,a=m[d[o+12>>2]+4>>2],d[12+(o=O-16|0)>>2]=t,m[s+48>>2]=a*m[d[o+12>>2]+4>>2],d[12+(o=O-16|0)>>2]=e,a=m[d[o+12>>2]+8>>2],d[12+(e=O-16|0)>>2]=t,m[s+44>>2]=a*m[d[e+12>>2]+8>>2],Zo(s+56|0,s+52|0,s+48|0,s+44|0),t=d[s+60>>2],d[(e=s+104|0)>>2]=d[s+56>>2],d[e+4>>2]=t,t=d[s+68>>2],d[e+8>>2]=d[s+64>>2],d[e+12>>2]=t,Ro(e,l),r[d[d[n>>2]+8>>2]](n,i,e,d[s+256>>2]),d[s+172>>2]=d[s+172>>2]+1;m[s+20>>2]=-1,m[s+16>>2]=-1,m[s+12>>2]=-1,Zo(s+24|0,s+20|0,s+16|0,s+12|0),e=d[s+28>>2],d[s+152>>2]=d[s+24>>2],d[s+156>>2]=e,e=d[s+36>>2],d[s+160>>2]=d[s+32>>2],d[s+164>>2]=e,d[s+176>>2]<3&&(d[12+(e=O-16|0)>>2]=s+152,e=d[e+12>>2]+(d[s+176>>2]<<2)|0,m[e>>2]=m[e>>2]*y(-1)),d[s+176>>2]=d[s+176>>2]+1}O=s+272|0},r[52]=function(e,t,i){e|=0,t|=0,i=y(i);var n,s=0,o=0,a=0,l=0;O=n=O-304|0,d[n+300>>2]=e,d[n+296>>2]=t,m[n+292>>2]=i,t=d[n+300>>2],d[12+(o=O-16|0)>>2]=d[n+296>>2],o=d[o+12>>2]+48|0,s=d[o+4>>2],d[(e=n+272|0)>>2]=d[o>>2],d[e+4>>2]=s,s=d[o+12>>2],d[e+8>>2]=d[o+8>>2],d[e+12>>2]=s,d[12+(o=O-16|0)>>2]=d[n+296>>2],s=d[o+12>>2],m[n+220>>2]=0,m[n+216>>2]=0,Zo(a=n+224|0,o=n+292|0,n+220|0,n+216|0),Zr(l=n+240|0,s,a),js(s=n+256|0,e,l),m[n+196>>2]=.699999988079071,m[n+192>>2]=0,m[n+188>>2]=0,Zo(a=n+200|0,n+196|0,n+192|0,n+188|0),r[d[d[t>>2]+8>>2]](t,e,s,a),d[12+(s=O-16|0)>>2]=d[n+296>>2],s=d[s+12>>2],m[n+132>>2]=0,m[n+128>>2]=0,Zo(a=n+136|0,n+132|0,o,n+128|0),Zr(l=n+152|0,s,a),js(s=n+168|0,e,l),m[n+108>>2]=0,m[n+104>>2]=.699999988079071,m[n+100>>2]=0,Zo(a=n+112|0,n+108|0,n+104|0,n+100|0),r[d[d[t>>2]+8>>2]](t,e,s,a),d[12+(s=O-16|0)>>2]=d[n+296>>2],s=d[s+12>>2],m[n+44>>2]=0,m[n+40>>2]=0,Zo(a=n+48|0,n+44|0,n+40|0,o),Zr(o=n- -64|0,s,a),js(s=n+80|0,e,o),m[n+20>>2]=0,m[n+16>>2]=0,m[n+12>>2]=.699999988079071,Zo(o=n+24|0,n+20|0,n+16|0,n+12|0),r[d[d[t>>2]+8>>2]](t,e,s,o),O=n+304|0},r[53]=function(e,t,i,n,o,a,l,c,h,_,u){var p;for(e|=0,t|=0,i|=0,n|=0,o=y(o),a=y(a),l=y(l),c=y(c),h|=0,_|=0,u=y(u),O=p=O-304|0,d[p+300>>2]=e,d[p+296>>2]=t,d[p+292>>2]=i,d[p+288>>2]=n,m[p+284>>2]=o,m[p+280>>2]=a,m[p+276>>2]=l,m[p+272>>2]=c,d[p+268>>2]=h,s[p+267|0]=_,m[p+260>>2]=u,t=d[p+300>>2],d[p+256>>2]=d[p+288>>2],ps(p+240|0,d[p+292>>2],d[p+288>>2]),m[p+236>>2]=m[p+260>>2]*y(.01745329238474369),e=p,o=y(y(m[p+272>>2]-m[p+276>>2])/m[p+236>>2]),i=y(v(o))>2]=i,d[p+232>>2]||(d[p+232>>2]=1),e=d[p+296>>2],sh(i=p+168|0,p+284|0,d[p+256>>2]),m[p+164>>2]=Uh(m[p+276>>2]),zs(n=p+184|0,i,p+164|0),js(i=p+200|0,e,n),sh(e=p+128|0,p+280|0,p+240|0),m[p+124>>2]=Vh(m[p+276>>2]),zs(n=p+144|0,e,p+124|0),js(p+216|0,i,n),1&s[p+267|0]&&r[d[d[t>>2]+8>>2]](t,d[p+296>>2],p+216|0,d[p+268>>2]),d[p+120>>2]=1;d[p+120>>2]<=d[p+232>>2];)m[p+116>>2]=m[p+276>>2]+y(y(y(m[p+272>>2]-m[p+276>>2])*y(d[p+120>>2]))/y(d[p+232>>2])),e=d[p+296>>2],sh(i=p+48|0,p+284|0,d[p+256>>2]),m[p+44>>2]=Uh(m[p+116>>2]),zs(n=p- -64|0,i,p+44|0),js(i=p+80|0,e,n),sh(e=p+8|0,p+280|0,p+240|0),m[p+4>>2]=Vh(m[p+116>>2]),zs(n=p+24|0,e,p+4|0),js(e=p+96|0,i,n),i=p+216|0,r[d[d[t>>2]+8>>2]](t,i,e,d[p+268>>2]),n=d[e+4>>2],d[i>>2]=d[e>>2],d[i+4>>2]=n,n=d[e+12>>2],d[i+8>>2]=d[e+8>>2],d[i+12>>2]=n,d[p+120>>2]=d[p+120>>2]+1;1&s[p+267|0]&&r[d[d[t>>2]+8>>2]](t,d[p+296>>2],p+216|0,d[p+268>>2]),O=p+304|0},r[54]=function(e,t,i,n,o,a,l,c,h,_,u,p){var f;for(e|=0,t|=0,i|=0,n|=0,o=y(o),a=y(a),l=y(l),c=y(c),h=y(h),_|=0,u=y(u),p|=0,O=f=O-2720|0,d[f+2716>>2]=e,d[f+2712>>2]=t,d[f+2708>>2]=i,d[f+2704>>2]=n,m[f+2700>>2]=o,m[f+2696>>2]=a,m[f+2692>>2]=l,m[f+2688>>2]=c,m[f+2684>>2]=h,d[f+2680>>2]=_,m[f+2676>>2]=u,s[f+2675|0]=p,t=d[f+2716>>2],i=1184+(e=f+1488|0)|0;d[12+(O-16|0)>>2]=e,(0|i)!=(0|(e=e+16|0)););for(i=1184+(e=f+304|0)|0;d[12+(O-16|0)>>2]=e,(0|i)!=(0|(e=e+16|0)););for(d[f+300>>2]=f+1488,d[f+296>>2]=f+304,e=d[f+2712>>2],n=f+2700|0,zs(i=f+256|0,d[f+2708>>2],n),js(f+272|0,e,i),e=d[f+2712>>2],zs(i=f+224|0,d[f+2708>>2],n),Ws(f+240|0,e,i),d[12+(O-16|0)>>2]=f+208,m[f+204>>2]=m[f+2676>>2]*y(.01745329238474369),d[f+200>>2]=d[f+2708>>2],d[f+196>>2]=d[f+2704>>2],ps(f+176|0,d[f+200>>2],d[f+196>>2]),s[f+175|0]=0,s[f+174|0]=0,m[f+2696>>2]<=y(-1.5707963705062866)&&(m[f+2696>>2]=y(-1.5707963705062866)+m[f+204>>2],s[f+175|0]=1),m[f+2692>>2]>=y(1.5707963705062866)&&(m[f+2692>>2]=y(1.5707963705062866)-m[f+204>>2],s[f+174|0]=1),m[f+2696>>2]>m[f+2692>>2]&&(m[f+2696>>2]=y(-1.5707963705062866)+m[f+204>>2],m[f+2692>>2]=y(1.5707963705062866)-m[f+204>>2],s[f+174|0]=1,s[f+175|0]=1),e=f,o=y(y(m[f+2692>>2]-m[f+2696>>2])/m[f+204>>2]),i=y(v(o))>2]=i+1,d[f+168>>2]<2&&(d[f+168>>2]=2),m[f+164>>2]=y(m[f+2692>>2]-m[f+2696>>2])/y(d[f+168>>2]-1|0),s[f+163|0]=0,m[f+2688>>2]>m[f+2684>>2]?(m[f+2688>>2]=y(-3.1415927410125732)+m[f+204>>2],m[f+2684>>2]=3.1415927410125732,s[f+163|0]=1):y(m[f+2684>>2]-m[f+2688>>2])>=y(6.2831854820251465)?s[f+163|0]=1:s[f+163|0]=0,e=f,o=y(y(m[f+2684>>2]-m[f+2688>>2])/m[f+204>>2]),i=y(v(o))>2]=i+1,d[f+156>>2]<2&&(d[f+156>>2]=2),m[f+152>>2]=y(m[f+2684>>2]-m[f+2688>>2])/y(d[f+156>>2]-1|0),d[f+148>>2]=0;d[f+148>>2]>2];){for(m[f+144>>2]=m[f+2696>>2]+y(y(d[f+148>>2])*m[f+164>>2]),m[f+140>>2]=m[f+2700>>2]*Vh(m[f+144>>2]),m[f+136>>2]=m[f+2700>>2]*Uh(m[f+144>>2]),d[f+132>>2]=0;d[f+132>>2]>2];)m[f+128>>2]=m[f+2688>>2]+y(y(d[f+132>>2])*m[f+152>>2]),m[f+124>>2]=Vh(m[f+128>>2]),m[f+120>>2]=Uh(m[f+128>>2]),e=d[f+2712>>2],m[f+52>>2]=m[f+136>>2]*m[f+120>>2],sh(i=f+56|0,f+52|0,d[f+196>>2]),js(n=f+72|0,e,i),m[f+28>>2]=m[f+136>>2]*m[f+124>>2],sh(e=f+32|0,f+28|0,f+176|0),js(i=f+88|0,n,e),sh(e=f+8|0,f+140|0,d[f+200>>2]),js(f+104|0,i,e),i=d[f+108>>2],e=d[f+296>>2]+(d[f+132>>2]<<4)|0,d[e>>2]=d[f+104>>2],d[e+4>>2]=i,i=d[f+116>>2],d[e+8>>2]=d[f+112>>2],d[e+12>>2]=i,d[f+148>>2]?r[d[d[t>>2]+8>>2]](t,d[f+300>>2]+(d[f+132>>2]<<4)|0,d[f+296>>2]+(d[f+132>>2]<<4)|0,d[f+2680>>2]):1&s[f+174|0]&&r[d[d[t>>2]+8>>2]](t,f+240|0,d[f+296>>2]+(d[f+132>>2]<<4)|0,d[f+2680>>2]),d[f+132>>2]?r[d[d[t>>2]+8>>2]](t,d[f+296>>2]+(d[f+132>>2]-1<<4)|0,d[f+296>>2]+(d[f+132>>2]<<4)|0,d[f+2680>>2]):(e=d[f+296>>2]+(d[f+132>>2]<<4)|0,i=d[e+4>>2],d[f+208>>2]=d[e>>2],d[f+212>>2]=i,i=d[e+12>>2],d[f+216>>2]=d[e+8>>2],d[f+220>>2]=i),!(1&s[f+175|0])|d[f+148>>2]!=(d[f+168>>2]-1|0)||r[d[d[t>>2]+8>>2]](t,f+272|0,d[f+296>>2]+(d[f+132>>2]<<4)|0,d[f+2680>>2]),1&s[f+2675|0]&&(1&s[f+163|0]?d[f+132>>2]==(d[f+156>>2]-1|0)&&r[d[d[t>>2]+8>>2]](t,f+208|0,d[f+296>>2]+(d[f+132>>2]<<4)|0,d[f+2680>>2]):(d[f+148>>2]!=(d[f+168>>2]-1|0)?d[f+148>>2]:0)|(d[f+132>>2]!=(d[f+156>>2]-1|0)?d[f+132>>2]:0)||r[d[d[t>>2]+8>>2]](t,d[f+2712>>2],d[f+296>>2]+(d[f+132>>2]<<4)|0,d[f+2680>>2])),d[f+132>>2]=d[f+132>>2]+1;d[f+292>>2]=d[f+300>>2],d[f+300>>2]=d[f+296>>2],d[f+296>>2]=d[f+292>>2],d[f+148>>2]=d[f+148>>2]+1}O=f+2720|0},r[55]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=0,a=0;O=s=O-400|0,d[s+396>>2]=e,d[s+392>>2]=t,d[s+388>>2]=i,d[s+384>>2]=n,e=d[s+396>>2],d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(o=s+368|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(a=s+352|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(o=s+336|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(a=s+320|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(o=s+304|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(a=s+288|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(o=s+272|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(a=s+256|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(o=s+240|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(a=s+224|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(o=s+208|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(a=s+192|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(o=s+176|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(a=s+160|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+392>>2],Zo(o=s+144|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(a=s+128|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(o=s+112|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(a=s+96|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(o=s+80|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(a=s- -64|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+388>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(o=s+48|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(a=s+32|0,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,a,d[s+384>>2]),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+388>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(o=s+16|0,t,i,d[n+12>>2]+8|0),d[12+(t=O-16|0)>>2]=d[s+392>>2],t=d[t+12>>2],d[12+(i=O-16|0)>>2]=d[s+392>>2],i=d[i+12>>2]+4|0,d[12+(n=O-16|0)>>2]=d[s+388>>2],Zo(s,t,i,d[n+12>>2]+8|0),r[d[d[e>>2]+8>>2]](e,o,s,d[s+384>>2]),O=s+400|0},r[56]=function(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o,a=0,l=0;O=o=O-800|0,d[o+796>>2]=e,d[o+792>>2]=t,d[o+788>>2]=i,d[o+784>>2]=n,d[o+780>>2]=s,e=d[o+796>>2],t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+792>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+792>>2],Zo(a=o+744|0,i,n,d[s+12>>2]+8|0),oh(i=o+760|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+792>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+792>>2],Zo(l=o+712|0,n,s,d[a+12>>2]+8|0),oh(n=o+728|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+788>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+792>>2],Zo(a=o+680|0,i,n,d[s+12>>2]+8|0),oh(i=o+696|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+788>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+792>>2],Zo(l=o+648|0,n,s,d[a+12>>2]+8|0),oh(n=o+664|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+788>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+792>>2],Zo(a=o+616|0,i,n,d[s+12>>2]+8|0),oh(i=o+632|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+788>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+792>>2],Zo(l=o+584|0,n,s,d[a+12>>2]+8|0),oh(n=o+600|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+792>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+792>>2],Zo(a=o+552|0,i,n,d[s+12>>2]+8|0),oh(i=o+568|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+792>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+792>>2],Zo(l=o+520|0,n,s,d[a+12>>2]+8|0),oh(n=o+536|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+792>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+792>>2],Zo(a=o+488|0,i,n,d[s+12>>2]+8|0),oh(i=o+504|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+792>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+788>>2],Zo(l=o+456|0,n,s,d[a+12>>2]+8|0),oh(n=o+472|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+788>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+792>>2],Zo(a=o+424|0,i,n,d[s+12>>2]+8|0),oh(i=o+440|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+792>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+788>>2],Zo(l=o+392|0,n,s,d[a+12>>2]+8|0),oh(n=o+408|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+788>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+792>>2],Zo(a=o+360|0,i,n,d[s+12>>2]+8|0),oh(i=o+376|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+788>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+788>>2],Zo(l=o+328|0,n,s,d[a+12>>2]+8|0),oh(n=o+344|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+792>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+792>>2],Zo(a=o+296|0,i,n,d[s+12>>2]+8|0),oh(i=o+312|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+788>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+788>>2],Zo(l=o+264|0,n,s,d[a+12>>2]+8|0),oh(n=o+280|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+792>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+788>>2],Zo(a=o+232|0,i,n,d[s+12>>2]+8|0),oh(i=o+248|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+792>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+788>>2],Zo(l=o+200|0,n,s,d[a+12>>2]+8|0),oh(n=o+216|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+788>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+788>>2],Zo(a=o+168|0,i,n,d[s+12>>2]+8|0),oh(i=o+184|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+788>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+788>>2],Zo(l=o+136|0,n,s,d[a+12>>2]+8|0),oh(n=o+152|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+788>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+788>>2],Zo(a=o+104|0,i,n,d[s+12>>2]+8|0),oh(i=o+120|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+788>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+788>>2],Zo(l=o+72|0,n,s,d[a+12>>2]+8|0),oh(n=o+88|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),t=d[o+784>>2],d[12+(i=O-16|0)>>2]=d[o+792>>2],i=d[i+12>>2],d[12+(n=O-16|0)>>2]=d[o+788>>2],n=d[n+12>>2]+4|0,d[12+(s=O-16|0)>>2]=d[o+788>>2],Zo(a=o+40|0,i,n,d[s+12>>2]+8|0),oh(i=o+56|0,t,a),t=d[o+784>>2],d[12+(n=O-16|0)>>2]=d[o+792>>2],n=d[n+12>>2],d[12+(s=O-16|0)>>2]=d[o+792>>2],s=d[s+12>>2]+4|0,d[12+(a=O-16|0)>>2]=d[o+788>>2],Zo(l=o+8|0,n,s,d[a+12>>2]+8|0),oh(n=o+24|0,t,l),r[d[d[e>>2]+8>>2]](e,i,n,d[o+780>>2]),O=o+800|0},r[57]=function(e,t,i,n,s,o){e|=0,t=y(t),i=y(i),n|=0,s|=0,o|=0;var a,l=0,c=0;for(O=a=O-496|0,d[a+492>>2]=e,m[a+488>>2]=t,m[a+484>>2]=i,d[a+480>>2]=n,d[a+476>>2]=s,d[a+472>>2]=o,e=d[a+492>>2],d[a+468>>2]=30,m[a+444>>2]=0,m[a+440>>2]=0,m[a+436>>2]=0,Zo(s=a+448|0,a+444|0,a+440|0,a+436|0),t=y(-m[a+484>>2]),d[12+(n=O-16|0)>>2]=s,m[d[n+12>>2]+(d[a+480>>2]<<2)>>2]=t,m[a+412>>2]=0,m[a+408>>2]=0,m[a+404>>2]=0,Zo(l=a+416|0,a+412|0,a+408|0,a+404|0),t=m[a+484>>2],d[12+(n=O-16|0)>>2]=l,m[d[n+12>>2]+(d[a+480>>2]<<2)>>2]=t,oo(n=a+336|0,d[a+476>>2]),oh(a+320|0,d[a+476>>2],s),d[12+(s=O-16|0)>>2]=n,o=d[a+324>>2],s=d[s+12>>2]+48|0,d[s>>2]=d[a+320>>2],d[s+4>>2]=o,o=d[a+332>>2],d[s+8>>2]=d[a+328>>2],d[s+12>>2]=o,d[12+(o=O-16|0)>>2]=n,o=d[o+12>>2]+48|0,c=d[o+4>>2],d[(s=a+304|0)>>2]=d[o>>2],d[s+4>>2]=c,c=d[o+12>>2],d[s+8>>2]=d[o+8>>2],d[s+12>>2]=c,d[12+(o=O-16|0)>>2]=n,ws(c=a+288|0,d[o+12>>2],(d[a+480>>2]+1|0)%3|0),d[12+(o=O-16|0)>>2]=n,ws(n=a+256|0,d[o+12>>2],d[a+480>>2]),va(o=a+272|0,n),m[a+252>>2]=-1.5707963705062866,m[a+248>>2]=1.5707963705062866,m[a+244>>2]=-1.5707963705062866,m[a+240>>2]=1.5707963705062866,r[d[d[e>>2]+64>>2]](e,s,c,o,m[a+488>>2],m[a+252>>2],m[a+248>>2],m[a+244>>2],m[a+240>>2],d[a+472>>2],y(d[a+468>>2]),0),oo(n=a+176|0,d[a+476>>2]),oh(a+160|0,d[a+476>>2],l),d[12+(s=O-16|0)>>2]=n,o=d[a+164>>2],s=d[s+12>>2]+48|0,d[s>>2]=d[a+160>>2],d[s+4>>2]=o,o=d[a+172>>2],d[s+8>>2]=d[a+168>>2],d[s+12>>2]=o,d[12+(o=O-16|0)>>2]=n,o=d[o+12>>2]+48|0,l=d[o+4>>2],d[(s=a+144|0)>>2]=d[o>>2],d[s+4>>2]=l,l=d[o+12>>2],d[s+8>>2]=d[o+8>>2],d[s+12>>2]=l,d[12+(o=O-16|0)>>2]=n,ws(l=a+128|0,d[o+12>>2],(d[a+480>>2]+1|0)%3|0),d[12+(o=O-16|0)>>2]=n,ws(n=a+112|0,d[o+12>>2],d[a+480>>2]),m[a+108>>2]=-1.5707963705062866,m[a+104>>2]=1.5707963705062866,m[a+100>>2]=-1.5707963705062866,m[a+96>>2]=1.5707963705062866,r[d[d[e>>2]+64>>2]](e,s,l,n,m[a+488>>2],m[a+108>>2],m[a+104>>2],m[a+100>>2],m[a+96>>2],d[a+472>>2],y(d[a+468>>2]),0),d[12+(n=O-16|0)>>2]=d[a+476>>2],n=d[n+12>>2]+48|0,s=d[n+4>>2],d[a+80>>2]=d[n>>2],d[a+84>>2]=s,s=d[n+12>>2],d[a+88>>2]=d[n+8>>2],d[a+92>>2]=s,d[a+76>>2]=0;d[a+76>>2]<360;)t=y(Vh(y(y(d[a+76>>2])*y(.01745329238474369)))*m[a+488>>2]),n=a+448|0,d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+((d[a+480>>2]+1|0)%3<<2)>>2]=t,s=a+416|0,d[12+(o=O-16|0)>>2]=s,m[d[o+12>>2]+((d[a+480>>2]+1|0)%3<<2)>>2]=t,t=y(Uh(y(y(d[a+76>>2])*y(.01745329238474369)))*m[a+488>>2]),d[12+(o=O-16|0)>>2]=n,m[d[o+12>>2]+((d[a+480>>2]+2|0)%3<<2)>>2]=t,d[12+(o=O-16|0)>>2]=s,m[d[o+12>>2]+((d[a+480>>2]+2|0)%3<<2)>>2]=t,d[12+(o=O-16|0)>>2]=d[a+476>>2],Zr(l=a+40|0,d[o+12>>2],n),js(n=a+56|0,o=a+80|0,l),d[12+(l=O-16|0)>>2]=d[a+476>>2],Zr(c=a+8|0,d[l+12>>2],s),js(s=a+24|0,o,c),r[d[d[e>>2]+8>>2]](e,n,s,d[a+472>>2]),d[a+76>>2]=d[a+468>>2]+d[a+76>>2];O=a+496|0},r[58]=function(e,t,i,n,s,o){e|=0,t=y(t),i=y(i),n|=0,s|=0,o|=0;var a,l,c,h,_=0,u=0;for(O=a=O-400|0,d[a+396>>2]=e,m[a+392>>2]=t,m[a+388>>2]=i,d[a+384>>2]=n,d[a+380>>2]=s,d[a+376>>2]=o,e=d[a+396>>2],d[12+(n=O-16|0)>>2]=d[a+380>>2],n=d[n+12>>2]+48|0,s=d[n+4>>2],d[a+360>>2]=d[n>>2],d[a+364>>2]=s,s=d[n+12>>2],d[a+368>>2]=d[n+8>>2],d[a+372>>2]=s,m[a+340>>2]=0,m[a+336>>2]=0,m[a+332>>2]=0,Zo(n=a+344|0,a+340|0,a+336|0,a+332|0),t=m[a+388>>2],d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+(d[a+384>>2]<<2)>>2]=t,d[a+328>>2]=30,m[a+308>>2]=0,m[a+304>>2]=0,m[a+300>>2]=0,Zo(n=a+312|0,a+308|0,a+304|0,a+300|0),t=y(-m[a+388>>2]),d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+(d[a+384>>2]<<2)>>2]=t,m[a+276>>2]=0,m[a+272>>2]=0,m[a+268>>2]=0,Zo(n=a+280|0,a+276|0,a+272|0,a+268|0),t=m[a+388>>2],d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+(d[a+384>>2]<<2)>>2]=t,d[a+264>>2]=0;d[a+264>>2]<360;)t=y(Vh(y(y(d[a+264>>2])*y(.01745329238474369)))*m[a+392>>2]),n=a+312|0,d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+((d[a+384>>2]+1|0)%3<<2)>>2]=t,s=a+280|0,d[12+(o=O-16|0)>>2]=s,m[d[o+12>>2]+((d[a+384>>2]+1|0)%3<<2)>>2]=t,t=y(Uh(y(y(d[a+264>>2])*y(.01745329238474369)))*m[a+392>>2]),d[12+(o=O-16|0)>>2]=n,m[d[o+12>>2]+((d[a+384>>2]+2|0)%3<<2)>>2]=t,d[12+(o=O-16|0)>>2]=s,m[d[o+12>>2]+((d[a+384>>2]+2|0)%3<<2)>>2]=t,d[12+(o=O-16|0)>>2]=d[a+380>>2],Zr(_=a+232|0,d[o+12>>2],n),js(n=a+248|0,o=a+360|0,_),d[12+(_=O-16|0)>>2]=d[a+380>>2],Zr(u=a+200|0,d[_+12>>2],s),js(s=a+216|0,o,u),r[d[d[e>>2]+8>>2]](e,n,s,d[a+376>>2]),d[a+264>>2]=d[a+328>>2]+d[a+264>>2];m[a+180>>2]=0,m[a+176>>2]=0,m[a+172>>2]=0,Zo(n=a+184|0,a+180|0,a+176|0,a+172|0),d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+(d[a+384>>2]<<2)>>2]=1,m[a+148>>2]=0,m[a+144>>2]=0,m[a+140>>2]=0,Zo(s=a+152|0,a+148|0,a+144|0,a+140|0),d[12+(o=O-16|0)>>2]=s,m[d[o+12>>2]+((d[a+384>>2]+1|0)%3<<2)>>2]=1,d[12+(o=O-16|0)>>2]=d[a+380>>2],Zr(_=a+104|0,u=d[o+12>>2],o=a+344|0),Ws(u=a+120|0,l=a+360|0,_),d[12+(_=O-16|0)>>2]=d[a+380>>2],Zr(c=a+88|0,d[_+12>>2],n),d[12+(_=O-16|0)>>2]=d[a+380>>2],Zr(h=a+72|0,d[_+12>>2],s),r[d[d[e>>2]+60>>2]](e,u,c,h,m[a+392>>2],m[a+392>>2],y(0),y(6.2831854820251465),d[a+376>>2],0,y(10)),d[12+(_=O-16|0)>>2]=d[a+380>>2],Zr(u=a+40|0,d[_+12>>2],o),js(o=a+56|0,l,u),d[12+(_=O-16|0)>>2]=d[a+380>>2],Zr(u=a+24|0,d[_+12>>2],n),d[12+(n=O-16|0)>>2]=d[a+380>>2],Zr(_=a+8|0,d[n+12>>2],s),r[d[d[e>>2]+60>>2]](e,o,u,_,m[a+392>>2],m[a+392>>2],y(0),y(6.2831854820251465),d[a+376>>2],0,y(10)),O=a+400|0},r[59]=function(e,t,i,n,s,o){e|=0,t=y(t),i=y(i),n|=0,s|=0,o|=0;var a,l=0,c=0,h=0,_=0;for(O=a=O-752|0,d[a+748>>2]=e,m[a+744>>2]=t,m[a+740>>2]=i,d[a+736>>2]=n,d[a+732>>2]=s,d[a+728>>2]=o,e=d[a+748>>2],d[a+724>>2]=30,d[12+(n=O-16|0)>>2]=d[a+732>>2],n=d[n+12>>2]+48|0,s=d[n+4>>2],d[a+704>>2]=d[n>>2],d[a+708>>2]=s,s=d[n+12>>2],d[a+712>>2]=d[n+8>>2],d[a+716>>2]=s,m[a+684>>2]=0,m[a+680>>2]=0,m[a+676>>2]=0,Zo(n=a+688|0,a+684|0,a+680|0,a+676|0),m[a+672>>2]=m[a+740>>2]*y(.5),t=m[a+672>>2],d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+(d[a+736>>2]<<2)>>2]=t,m[a+652>>2]=0,m[a+648>>2]=0,m[a+644>>2]=0,Zo(n=a+656|0,a+652|0,a+648|0,a+644|0),t=m[a+744>>2],d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+((d[a+736>>2]+1|0)%3<<2)>>2]=t,m[a+620>>2]=0,m[a+616>>2]=0,m[a+612>>2]=0,Zo(n=a+624|0,a+620|0,a+616|0,a+612|0),t=m[a+744>>2],d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+((d[a+736>>2]+2|0)%3<<2)>>2]=t,m[a+588>>2]=0,m[a+584>>2]=0,m[a+580>>2]=0,Zo(n=a+592|0,a+588|0,a+584|0,a+580|0),t=y(-m[a+672>>2]),d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+(d[a+736>>2]<<2)>>2]=t,d[a+576>>2]=0;d[a+576>>2]<360;)t=y(Vh(y(y(d[a+576>>2])*y(.01745329238474369)))*m[a+744>>2]),n=a+592|0,d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+((d[a+736>>2]+1|0)%3<<2)>>2]=t,t=y(Uh(y(y(d[a+576>>2])*y(.01745329238474369)))*m[a+744>>2]),d[12+(s=O-16|0)>>2]=n,m[d[s+12>>2]+((d[a+736>>2]+2|0)%3<<2)>>2]=t,d[12+(s=O-16|0)>>2]=d[a+732>>2],Zr(o=a+544|0,d[s+12>>2],a+688|0),js(s=a+560|0,l=a+704|0,o),d[12+(o=O-16|0)>>2]=d[a+732>>2],Zr(c=a+512|0,d[o+12>>2],n),js(n=a+528|0,l,c),r[d[d[e>>2]+8>>2]](e,s,n,d[a+728>>2]),d[a+576>>2]=d[a+724>>2]+d[a+576>>2];d[12+(n=O-16|0)>>2]=d[a+732>>2],Zr(o=a+480|0,s=d[n+12>>2],n=a+688|0),js(l=a+496|0,s=a+704|0,o),d[12+(o=O-16|0)>>2]=d[a+732>>2],o=d[o+12>>2],va(c=a+416|0,n),js(_=a+432|0,h=c,c=a+656|0),Zr(h=a+448|0,o,_),js(o=a+464|0,s,h),r[d[d[e>>2]+8>>2]](e,l,o,d[a+728>>2]),d[12+(o=O-16|0)>>2]=d[a+732>>2],Zr(l=a+384|0,d[o+12>>2],n),js(o=a+400|0,s,l),d[12+(l=O-16|0)>>2]=d[a+732>>2],l=d[l+12>>2],va(_=a+320|0,n),Ws(h=a+336|0,_,c),Zr(c=a+352|0,l,h),js(l=a+368|0,s,c),r[d[d[e>>2]+8>>2]](e,o,l,d[a+728>>2]),d[12+(o=O-16|0)>>2]=d[a+732>>2],Zr(l=a+288|0,d[o+12>>2],n),js(o=a+304|0,s,l),d[12+(l=O-16|0)>>2]=d[a+732>>2],l=d[l+12>>2],va(c=a+224|0,n),js(_=a+240|0,h=c,c=a+624|0),Zr(h=a+256|0,l,_),js(l=a+272|0,s,h),r[d[d[e>>2]+8>>2]](e,o,l,d[a+728>>2]),d[12+(o=O-16|0)>>2]=d[a+732>>2],Zr(l=a+192|0,d[o+12>>2],n),js(o=a+208|0,s,l),d[12+(l=O-16|0)>>2]=d[a+732>>2],l=d[l+12>>2],va(_=a+128|0,n),Ws(h=a+144|0,_,c),Zr(c=a+160|0,l,h),js(l=a+176|0,s,c),r[d[d[e>>2]+8>>2]](e,o,l,d[a+728>>2]),m[a+108>>2]=0,m[a+104>>2]=0,m[a+100>>2]=0,Zo(o=a+112|0,a+108|0,a+104|0,a+100|0),d[12+(l=O-16|0)>>2]=o,m[d[l+12>>2]+(d[a+736>>2]<<2)>>2]=1,m[a+76>>2]=0,m[a+72>>2]=0,m[a+68>>2]=0,Zo(l=a+80|0,a+76|0,a+72|0,a+68|0),d[12+(c=O-16|0)>>2]=l,m[d[c+12>>2]+((d[a+736>>2]+1|0)%3<<2)>>2]=1,d[12+(c=O-16|0)>>2]=d[a+732>>2],Zr(_=a+32|0,d[c+12>>2],n),Ws(n=a+48|0,s,_),d[12+(s=O-16|0)>>2]=d[a+732>>2],Zr(c=a+16|0,d[s+12>>2],o),d[12+(s=O-16|0)>>2]=d[a+732>>2],Zr(a,d[s+12>>2],l),r[d[d[e>>2]+60>>2]](e,n,c,a,m[a+744>>2],m[a+744>>2],y(0),y(6.2831854820251465),d[a+728>>2],0,y(10)),O=a+752|0},r[60]=function(e,t,i,n,s){e|=0,t|=0,i=y(i),n|=0,s|=0;var o,a,l,c=0,h=0;O=o=O-272|0,d[o+268>>2]=e,d[o+264>>2]=t,m[o+260>>2]=i,d[o+256>>2]=n,d[o+252>>2]=s,e=d[o+268>>2],zs(t=o+232|0,d[o+264>>2],o+260|0),n=o+216|0,d[12+(O-16|0)>>2]=n,s=o+200|0,d[12+(O-16|0)>>2]=s,function(e,t,i){var n,r=y(0),s=y(0);O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,d[12+(e=O-16|0)>>2]=d[n+28>>2],m[12+(t=O-16|0)>>2]=m[d[e+12>>2]+8>>2],y(v(m[t+12>>2]))>y(.7071067690849304)?(d[12+(e=O-16|0)>>2]=d[n+28>>2],r=m[d[e+12>>2]+4>>2],d[12+(e=O-16|0)>>2]=d[n+28>>2],r=y(r*m[d[e+12>>2]+4>>2]),d[12+(e=O-16|0)>>2]=d[n+28>>2],s=m[d[e+12>>2]+8>>2],d[12+(e=O-16|0)>>2]=d[n+28>>2],m[n+16>>2]=r+y(s*m[d[e+12>>2]+8>>2]),m[12+(e=O-16|0)>>2]=m[n+16>>2],m[n+12>>2]=y(1)/y(x(m[e+12>>2])),d[12+(e=O-16|0)>>2]=d[n+24>>2],m[d[e+12>>2]>>2]=0,d[12+(e=O-16|0)>>2]=d[n+28>>2],r=y(y(-m[d[e+12>>2]+8>>2])*m[n+12>>2]),d[12+(e=O-16|0)>>2]=d[n+24>>2],m[d[e+12>>2]+4>>2]=r,d[12+(e=O-16|0)>>2]=d[n+28>>2],r=y(m[d[e+12>>2]+4>>2]*m[n+12>>2]),d[12+(e=O-16|0)>>2]=d[n+24>>2],m[d[e+12>>2]+8>>2]=r,r=y(m[n+16>>2]*m[n+12>>2]),d[12+(e=O-16|0)>>2]=d[n+20>>2],m[d[e+12>>2]>>2]=r,d[12+(e=O-16|0)>>2]=d[n+28>>2],r=y(-m[d[e+12>>2]>>2]),d[12+(e=O-16|0)>>2]=d[n+24>>2],r=y(r*m[d[e+12>>2]+8>>2]),d[12+(e=O-16|0)>>2]=d[n+20>>2],m[d[e+12>>2]+4>>2]=r,d[12+(e=O-16|0)>>2]=d[n+28>>2],r=m[d[e+12>>2]>>2],d[12+(e=O-16|0)>>2]=d[n+24>>2],r=y(r*m[d[e+12>>2]+4>>2])):(d[12+(e=O-16|0)>>2]=d[n+28>>2],r=m[d[e+12>>2]>>2],d[12+(e=O-16|0)>>2]=d[n+28>>2],r=y(r*m[d[e+12>>2]>>2]),d[12+(e=O-16|0)>>2]=d[n+28>>2],s=m[d[e+12>>2]+4>>2],d[12+(e=O-16|0)>>2]=d[n+28>>2],m[n+8>>2]=r+y(s*m[d[e+12>>2]+4>>2]),m[12+(e=O-16|0)>>2]=m[n+8>>2],m[n+4>>2]=y(1)/y(x(m[e+12>>2])),d[12+(e=O-16|0)>>2]=d[n+28>>2],r=y(y(-m[d[e+12>>2]+4>>2])*m[n+4>>2]),d[12+(e=O-16|0)>>2]=d[n+24>>2],m[d[e+12>>2]>>2]=r,d[12+(e=O-16|0)>>2]=d[n+28>>2],r=y(m[d[e+12>>2]>>2]*m[n+4>>2]),d[12+(e=O-16|0)>>2]=d[n+24>>2],m[d[e+12>>2]+4>>2]=r,d[12+(e=O-16|0)>>2]=d[n+24>>2],m[d[e+12>>2]+8>>2]=0,d[12+(e=O-16|0)>>2]=d[n+28>>2],r=y(-m[d[e+12>>2]+8>>2]),d[12+(e=O-16|0)>>2]=d[n+24>>2],r=y(r*m[d[e+12>>2]+4>>2]),d[12+(e=O-16|0)>>2]=d[n+20>>2],m[d[e+12>>2]>>2]=r,d[12+(e=O-16|0)>>2]=d[n+28>>2],r=m[d[e+12>>2]+8>>2],d[12+(e=O-16|0)>>2]=d[n+24>>2],r=y(r*m[d[e+12>>2]>>2]),d[12+(e=O-16|0)>>2]=d[n+20>>2],m[d[e+12>>2]+4>>2]=r,r=y(m[n+8>>2]*m[n+4>>2])),d[12+(e=O-16|0)>>2]=d[n+20>>2],m[d[e+12>>2]+8>>2]=r,O=n+32|0}(d[o+264>>2],n,s),m[o+196>>2]=100,zs(c=o+160|0,n,h=o+196|0),js(a=o+176|0,t,c),zs(c=o+128|0,n,h),Ws(n=o+144|0,t,c),zs(c=o+96|0,s,h),js(l=o+112|0,t,c),zs(c=o- -64|0,s,h),Ws(s=o+80|0,t,c),oh(t=o+48|0,d[o+256>>2],a),oh(h=o+32|0,d[o+256>>2],n),r[d[d[e>>2]+8>>2]](e,t,h,d[o+252>>2]),oh(t=o+16|0,d[o+256>>2],l),oh(o,d[o+256>>2],s),r[d[d[e>>2]+8>>2]](e,t,o,d[o+252>>2]),O=o+272|0},r[61]=V_,r[62]=ed,r[63]=dd,r[64]=function(e){return d[(e|=0)>>2]=3948,0|e},r[65]=function(e){d[(e|=0)>>2]=3948,e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[66]=function(e,t){t|=0,d[200+(e|=0)>>2]=t,d[e+192>>2]=t,d[e+260>>2]=d[e+260>>2]+1},r[67]=function(e){return 256},r[68]=Mt,r[69]=function(e,t){var i,n,s=0,o=0,a=0,l=0;o=t|=0,a=0|r[d[d[(e|=0)>>2]+16>>2]](e),l=1,s=d[d[t>>2]+16>>2],n=0|r[s](0|o,0|a,0|l),l=t,a=n,o=0|r[d[d[e>>2]+20>>2]](e,d[n+8>>2],t),i=e,s=d[d[t>>2]+20>>2],r[s](0|l,0|a,0|o,1245859651,0|i)},r[70]=function(e){var t;return d[(e|=0)>>2]=4040,(t=d[e+276>>2])&&(u[e+280|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+276>>2]=0),d[e+276>>2]=0,s[e+280|0]=1,d[e+268>>2]=0,d[e+272>>2]=0,d[e>>2]=3948,0|e},r[71]=function(e){var t;d[(e|=0)>>2]=4040,(t=d[e+276>>2])&&(u[e+280|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+276>>2]=0),d[e+276>>2]=0,s[e+280|0]=1,d[e+268>>2]=0,d[e+272>>2]=0,d[e>>2]=3948,e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[72]=function(e,t,i){e|=0,i|=0;var n,o=0,a=0,l=0;n=d[(t|=0)>>2];e:{t:if(!((0|(i=d[e+268>>2]))<1)){for(o=d[e+276>>2],t=0;;){if(d[o+(t<<2)>>2]!=(0|n)){if((0|i)!=(0|(t=t+1|0)))continue;break t}break}if((0|t)!=(0|i))break e}if(d[e+272>>2]==(0|i)&&!((0|i)>=(0|(o=i?i<<1:1)))){if(o&&(d[7717]=d[7717]+1,a=0|r[d[6606]](o<<2,16),i=d[e+268>>2]),(0|i)>=1)for(t=0;d[(l=t<<2)+a>>2]=d[d[e+276>>2]+l>>2],(0|i)!=(0|(t=t+1|0)););(t=d[e+276>>2])&&(u[e+280|0]&&(t&&(d[7718]=d[7718]+1,r[d[6607]](t)),i=d[e+268>>2]),d[e+276>>2]=0),d[e+276>>2]=a,d[e+272>>2]=o,s[e+280|0]=1}d[d[e+276>>2]+(i<<2)>>2]=n,d[e+268>>2]=i+1}},r[73]=function(e,t,i,n){t|=0,i|=0,n|=0;var r=0,s=0;e:if(!((0|(i=d[268+(e|=0)>>2]))<1)){for(n=d[e+276>>2],s=d[t>>2],t=0;;){if(d[(r=(t<<2)+n|0)>>2]!=(0|s)){if((0|i)!=(0|(t=t+1|0)))continue;break e}break}(0|t)>=(0|i)||(t=i+-1|0,d[r>>2]=d[(t<<2)+n>>2],d[e+268>>2]=t)}},r[74]=function(e){var t=0;return d[(e|=0)>>2]=4084,t=d[e+284>>2],r[d[d[t>>2]>>2]](t),(t=d[e+284>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e>>2]=4040,(t=d[e+276>>2])&&(u[e+280|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+276>>2]=0),d[e+276>>2]=0,s[e+280|0]=1,d[e+268>>2]=0,d[e+272>>2]=0,d[e>>2]=3948,0|e},r[75]=function(e){var t=0;d[(e|=0)>>2]=4084,t=d[e+284>>2],r[d[d[t>>2]>>2]](t),(t=d[e+284>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e>>2]=4040,(t=d[e+276>>2])&&(u[e+280|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+276>>2]=0),d[e+276>>2]=0,s[e+280|0]=1,d[e+268>>2]=0,d[e+272>>2]=0,d[e>>2]=3948,e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[76]=function(e,t,i){e|=0,t|=0;var n,o=0,a=0,l=0,c=0,h=0;i=(i|=0)||d[e+188>>2],n=d[t>>2];e:{t:if(!((0|(o=d[e+268>>2]))<1)){for(l=d[e+276>>2];;){if(d[l+(a<<2)>>2]!=(0|n)){if((0|(a=a+1|0))!=(0|o))continue;break t}break}if((0|o)!=(0|a))break e}if(d[e+272>>2]==(0|o)&&!((0|o)>=(0|(l=o?o<<1:1)))){if(l&&(d[7717]=d[7717]+1,c=0|r[d[6606]](l<<2,16),o=d[e+268>>2]),(0|o)>=1)for(a=0;d[(h=a<<2)+c>>2]=d[d[e+276>>2]+h>>2],(0|(a=a+1|0))!=(0|o););(a=d[e+276>>2])&&(u[e+280|0]&&(a&&(d[7718]=d[7718]+1,r[d[6607]](a)),o=d[e+268>>2]),d[e+276>>2]=0),d[e+276>>2]=c,d[e+272>>2]=l,s[e+280|0]=1}d[d[e+276>>2]+(o<<2)>>2]=n,d[e+268>>2]=o+1,e=d[e+284>>2],r[d[d[e>>2]+8>>2]](e,i,t)}},r[77]=function(e,t,i,n){e|=0,i|=0,n|=0;var s,o=0,a=0,l=0,c=0;s=d[(t|=0)>>2],n=n||d[e+188>>2];e:if(!((0|(o=d[e+268>>2]))<1)){for(l=d[e+276>>2];;){if(d[(c=(a<<2)+l|0)>>2]!=(0|s)){if((0|o)!=(0|(a=a+1|0)))continue;break e}break}(0|a)>=(0|o)||(o=o+-1|0,d[c>>2]=d[(o<<2)+l>>2],d[e+268>>2]=o,e=d[e+284>>2],r[d[d[e>>2]+12>>2]](e,n,t,i))}},r[78]=function(e,t,i){e|=0,t|=0,i|=0;var n,s,o,a=0,l=y(0);O=n=O-80|0,s=d[d[e>>2]>>2],o=d[d[e+4>>2]>>2],r[d[d[t>>2]+24>>2]](t,s,o)&&(a=d[s+192>>2],d[n+72>>2]=-1,d[n+76>>2]=-1,d[n+68>>2]=s+4,d[n+64>>2]=s,d[n+60>>2]=a,d[n+56>>2]=0,a=d[o+192>>2],d[n+48>>2]=-1,d[n+52>>2]=-1,d[n+44>>2]=o+4,d[n+40>>2]=o,d[n+36>>2]=a,d[n+32>>2]=0,(d[e+8>>2]||(t=0|r[d[d[t>>2]+8>>2]](t,n+56|0,n+32|0,0),d[e+8>>2]=t,t))&&(d[n+12>>2]=n+32,d[n+8>>2]=n+56,d[n+4>>2]=0,d[n>>2]=7088,t=n,e=d[e+8>>2],1!=d[i+8>>2]?(l=y(r[d[d[e>>2]+12>>2]](e,s,o,i,t)),m[i+12>>2]>l&&(m[i+12>>2]=l)):r[d[d[e>>2]+8>>2]](e,n+56|0,n+32|0,i,t))),O=n+80|0},r[79]=function(e){var t;return d[(e|=0)>>2]=4196,(t=d[e+20>>2])&&(u[e+24|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+20>>2]=0),d[e+20>>2]=0,s[e+24|0]=1,d[e+12>>2]=0,d[e+16>>2]=0,0|e},r[80]=function(e){var t;d[(e|=0)>>2]=4196,(t=d[e+20>>2])&&(u[e+24|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+20>>2]=0),d[e+20>>2]=0,s[e+24|0]=1,d[e+12>>2]=0,d[e+16>>2]=0,ve(e)},r[81]=function(e,t,i,n){var s;return e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+12>>2]=n,d[s+8>>2]=e,e=d[72+((b(d[d[t+4>>2]+4>>2],144)+e|0)+(d[d[i+4>>2]+4>>2]<<2)|0)>>2],e=0|r[d[d[e>>2]+8>>2]](e,s+8|0,t,i),O=s+16|0,0|e},r[82]=function(e,t,i){e|=0,t|=0,i|=0;var n,o=0,a=0,l=y(0),c=y(0),h=0,_=0,p=0;O=n=O-16|0,d[6736]=d[6736]+1,2&d[e+4>>2]?(o=d[t+192>>2],l=y(r[d[d[o>>2]+20>>2]](o,m[6601])),m[n+12>>2]=l,o=d[i+192>>2],c=y(r[d[d[o>>2]+20>>2]](o,m[6601])),m[n+8>>2]=c,o=l>2],l=m[i+184>>2],c=m[t+184>>2],a=d[e+68>>2];e:{if(_=d[a+8>>2])o=d[a+12>>2],p=d[o>>2],d[a+8>>2]=_+-1,d[a+12>>2]=p;else{if(o=0,4&u[e+4|0])break e;d[7717]=d[7717]+1,o=0|r[d[6606]](772,16)}if(d[o>>2]=1025,d[o+124>>2]=0,d[o+128>>2]=0,s[o+120|0]=0,d[o+116>>2]=0,d[o+132>>2]=0,d[o+136>>2]=0,d[o+140>>2]=0,d[o+144>>2]=0,d[o+148>>2]=0,d[o+152>>2]=0,d[o+308>>2]=0,d[o+312>>2]=0,s[o+304|0]=0,d[o+300>>2]=0,d[o+316>>2]=0,d[o+320>>2]=0,d[o+324>>2]=0,d[o+328>>2]=0,d[o+332>>2]=0,d[o+336>>2]=0,d[o+492>>2]=0,d[o+496>>2]=0,s[o+488|0]=0,d[o+484>>2]=0,d[o+500>>2]=0,d[o+504>>2]=0,d[o+508>>2]=0,d[o+512>>2]=0,d[o+516>>2]=0,d[o+520>>2]=0,s[o+672|0]=0,d[o+668>>2]=0,d[o+700>>2]=0,d[o+704>>2]=0,d[o+692>>2]=0,d[o+696>>2]=0,d[o+684>>2]=0,d[o+688>>2]=0,d[o+676>>2]=0,d[o+680>>2]=0,d[o+740>>2]=t,d[o+744>>2]=i,d[o+748>>2]=0,d[o+752>>2]=h,m[o+756>>2]=c>2],d[o+768>>2]=i,d[e+16>>2]==(0|i)&&!((0|i)>=(0|(a=i?i<<1:1)))){if(a?(d[7717]=d[7717]+1,h=0|r[d[6606]](a<<2,16),i=d[e+12>>2]):h=0,(0|i)>=1)for(t=0;d[(_=t<<2)+h>>2]=d[_+d[e+20>>2]>>2],(0|i)!=(0|(t=t+1|0)););(t=d[e+20>>2])&&(u[e+24|0]&&(t&&(d[7718]=d[7718]+1,r[d[6607]](t)),i=d[e+12>>2]),d[e+20>>2]=0),d[e+20>>2]=h,d[e+16>>2]=a,s[e+24|0]=1}d[d[e+20>>2]+(i<<2)>>2]=o,d[e+12>>2]=i+1}return O=n+16|0,0|o},r[83]=function(e,t){e|=0,t|=0;var i,n,s,o,a,l=0,c=0;if(d[6736]=d[6736]+-1,r[d[d[e>>2]+20>>2]](e,t),i=(l=d[t+768>>2])<<2,n=d[e+20>>2],o=d[(c=i+n|0)>>2],a=c,s=(c=d[e+12>>2]+-1|0)<<2,d[a>>2]=d[n+s>>2],d[d[e+20>>2]+s>>2]=o,d[d[d[e+20>>2]+i>>2]+768>>2]=l,d[e+12>>2]=c,t&&(e=d[e+68>>2],!((l=d[e+16>>2])>>>0>t>>>0|l+b(d[e>>2],d[e+4>>2])>>>0<=t>>>0)))return d[t>>2]=d[e+12>>2],d[e+12>>2]=t,void(d[e+8>>2]=d[e+8>>2]+1);t&&(d[7718]=d[7718]+1,r[d[6607]](t))},r[84]=function(e,t){e|=0;var i=0,n=0,s=0;if(d[748+(t|=0)>>2]>=1)for(e=0;i=b(e,184)+t|0,(n=d[i+116>>2])&&(s=d[6734])&&(r[s](n),d[i+116>>2]=0),(0|(e=e+1|0))>2];);d[t+748>>2]=0},r[85]=function(e,t,i){e|=0,i|=0;e:{t:{i:switch(d[216+(t|=0)>>2]+-2|0){case 0:case 3:break i;default:break t}switch(e=0,d[i+216>>2]+-2|0){case 0:case 3:break e;default:break t}}if(!d[t+256>>2])return 1;e=0|r[d[d[t>>2]>>2]](t,i)}return 0|e},r[86]=function(e,t,i){if(e|=0,i|=0,e=0,!(4&(t=d[204+(t|=0)>>2])||4&(i=d[i+204>>2]))){if(!(3&t))return 1;e=!(3&i)}return 0|e},r[87]=function(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+8>>2]=e,d[s+4>>2]=i,d[s>>2]=4304,r[d[d[t>>2]+48>>2]](t,s,n),O=s+16|0},r[88]=function(e){return d[12+(e|=0)>>2]},r[89]=function(e,t){return t|=0,d[d[20+(e|=0)>>2]+(t<<2)>>2]},r[90]=function(e){return d[12+(e|=0)>>2]?d[e+20>>2]:0},r[91]=_d,r[92]=_d,r[93]=function(e,t){t|=0;var i,n=0;return e=d[64+(e|=0)>>2],(i=d[e+8>>2])?(t=d[e+12>>2],n=d[t>>2],d[e+8>>2]=i+-1,d[e+12>>2]=n,0|t):(d[7717]=d[7717]+1,0|r[d[6606]](t,16))},r[94]=function(e,t){e|=0;var i=0;if((t|=0)&&(e=d[e+64>>2],!((i=d[e+16>>2])>>>0>t>>>0|b(d[e>>2],d[e+4>>2])+i>>>0<=t>>>0)))return d[t>>2]=d[e+12>>2],d[e+12>>2]=t,void(d[e+8>>2]=d[e+8>>2]+1);t&&(d[7718]=d[7718]+1,r[d[6607]](t))},r[95]=gd,r[96]=Pd,r[97]=function(e,t){var i;return i=t|=0,t=d[8+(e|=0)>>2],r[d[t+60>>2]](i,t,d[e+4>>2]),0},r[98]=pe,r[99]=function(e,t,i){e|=0,t|=0,i|=0;var n,s=y(0),o=y(0),a=y(0),l=0,c=y(0),h=y(0),_=y(0),u=y(0);O=n=O-32|0,l=d[i+12>>2],d[n+24>>2]=d[i+8>>2],d[n+28>>2]=l,l=d[i+4>>2],d[n+16>>2]=d[i>>2],d[n+20>>2]=l,s=m[n+16>>2],a=m[n+20>>2],o=m[n+24>>2],y(y(y(s*s)+y(a*a))+y(o*o))>2]=-1082130432,d[n+28>>2]=0,d[n+16>>2]=-1082130432,d[n+20>>2]=-1082130432,o=y(-1),a=y(-1),s=y(-1)),c=o,o=y(y(1)/y(x(y(y(y(s*s)+y(a*a))+y(o*o))))),m[n+24>>2]=c*o,m[n+20>>2]=a*o,m[n+16>>2]=s*o,pe(n,t,n+16|0);e:{switch(d[t+4>>2]){case 8:s=y(m[t+28>>2]*m[t+12>>2]);break e;case 0:case 1:case 13:case 11:case 10:case 4:case 5:s=m[t+44>>2];break e}s=y(r[d[d[t>>2]+48>>2]](t))}a=m[n>>2],o=m[n+16>>2],c=m[n+4>>2],h=m[n+20>>2],_=m[n+8>>2],u=m[n+24>>2],d[e+12>>2]=0,m[e+8>>2]=_+y(s*u),m[e+4>>2]=c+y(s*h),m[e>>2]=a+y(s*o),O=n+32|0},r[100]=gd,r[101]=Pd,r[102]=function(e,t,i,n,r,s,o,a,l,c){e|=0,t|=0,i|=0,n|=0,r|=0,s|=0,o|=0,a|=0,l|=0,c|=0;var h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0);return O=c=O-80|0,h=m[r+52>>2],_=m[s+52>>2],u=m[r+56>>2],p=m[s+56>>2],f=m[r+48>>2],g=m[s+48>>2],e=0,d[c+76>>2]=0,m[c+64>>2]=g-f,m[c+72>>2]=p-u,m[c+68>>2]=_-h,t=1,(_e(i,r,n,s,c- -64|0,c+8|0,1)||(t=0,ae(i,r,n,s,c- -64|0,c+8|0)))&&(e=d[c+16>>2],d[a>>2]=d[c+12>>2],d[a+4>>2]=e,e=d[c+24>>2],d[a+8>>2]=d[c+20>>2],d[a+12>>2]=e,e=d[c+40>>2],d[l+8>>2]=d[c+36>>2],d[l+12>>2]=e,e=d[c+32>>2],d[l>>2]=d[c+28>>2],d[l+4>>2]=e,e=d[c+56>>2],d[o+8>>2]=d[c+52>>2],d[o+12>>2]=e,e=d[c+48>>2],d[o>>2]=d[c+44>>2],d[o+4>>2]=e,e=t),O=c+80|0,0|e},r[103]=gd,r[104]=Pd,r[105]=j_,r[106]=Pd,r[107]=function(e,t,i,n,o,a,l,c,h,_){e|=0,t|=0,i|=0,n|=0,o|=0,a|=0,l|=0,c|=0,h|=0,_|=0;var p=y(0),f=y(0),g=y(0),b=y(0),v=0,A=0,C=y(0),S=y(0),x=y(0),T=y(0),E=0,R=y(0),P=0,I=y(0),M=y(0),D=y(0),w=y(0),F=0,B=0,N=0,L=y(0);for(O=e=O-4240|0,N=d[i+4>>2]+-17>>>0<=1?d[n+4>>2]+-17>>>0<2:N;Me(),S=m[o+32>>2],x=m[o+16>>2],T=m[o>>2],C=m[o+36>>2],I=m[o+20>>2],R=m[o+4>>2],p=m[o+40>>2],f=m[o+24>>2],M=m[o+8>>2],d[12+(v=(E=P<<4)+(e+1264|0)|0)>>2]=0,b=m[E+26964>>2],g=y(-b),w=y(f*g),f=m[E+26960>>2],D=p,p=m[E+26968>>2],m[v+8>>2]=y(w-y(M*f))-y(D*p),m[v+4>>2]=y(y(I*g)-y(f*R))-y(p*C),m[v>>2]=y(y(x*g)-y(f*T))-y(p*S),g=m[a+40>>2],S=m[a+8>>2],x=m[a+24>>2],T=m[a+36>>2],C=m[a+4>>2],I=m[a+20>>2],R=m[a+32>>2],M=m[a>>2],D=m[a+16>>2],d[12+(E=E+(e+272|0)|0)>>2]=0,m[E>>2]=y(y(f*M)+y(b*D))+y(p*R),m[E+4>>2]=y(y(f*C)+y(b*I))+y(p*T),m[E+8>>2]=y(y(f*S)+y(b*x))+y(p*g),42!=(0|(P=P+1|0)););if(E=42,(0|(B=0|r[d[d[i>>2]+84>>2]](i)))>=1)for(P=0;r[d[d[i>>2]+88>>2]](i,P,e+3248|0),g=m[o+8>>2],S=m[o>>2],x=m[o+4>>2],T=m[o+24>>2],C=m[o+16>>2],I=m[o+20>>2],b=m[o+40>>2],f=m[o+32>>2],p=m[o+36>>2],d[e+3260>>2]=0,D=f,f=m[e+3248>>2],R=p,p=m[e+3252>>2],M=b,b=m[e+3256>>2],m[e+3256>>2]=y(y(D*f)+y(R*p))+y(M*b),m[e+3252>>2]=y(y(f*C)+y(p*I))+y(b*T),m[e+3248>>2]=y(y(S*f)+y(x*p))+y(g*b),Me(),F=d[e+3260>>2],d[(A=26968+(v=E<<4)|0)>>2]=d[e+3256>>2],d[A+4>>2]=F,F=d[e+3252>>2],d[(A=v+26960|0)>>2]=d[e+3248>>2],d[A+4>>2]=F,S=m[o+40>>2],x=m[o+24>>2],T=m[o+8>>2],C=m[o+36>>2],I=m[o+20>>2],R=m[o+4>>2],p=m[o+32>>2],f=m[o+16>>2],M=m[o>>2],d[12+(A=v+(e+1264|0)|0)>>2]=0,b=m[e+3252>>2],g=y(-b),w=y(f*g),f=m[e+3248>>2],D=p,p=m[e+3256>>2],m[A>>2]=y(w-y(M*f))-y(D*p),m[A+4>>2]=y(y(I*g)-y(f*R))-y(p*C),m[A+8>>2]=y(y(x*g)-y(f*T))-y(p*S),g=m[a+32>>2],S=m[a>>2],x=m[a+16>>2],T=m[a+36>>2],C=m[a+4>>2],I=m[a+20>>2],R=m[a+40>>2],M=m[a+8>>2],D=m[a+24>>2],d[12+(v=v+(e+272|0)|0)>>2]=0,m[v+8>>2]=y(y(f*M)+y(b*D))+y(p*R),m[v+4>>2]=y(y(f*C)+y(b*I))+y(p*T),m[v>>2]=y(y(f*S)+y(b*x))+y(p*g),E=E+1|0,(0|B)!=(0|(P=P+1|0)););if((0|(B=0|r[d[d[n>>2]+84>>2]](n)))>=1)for(P=0;r[d[d[n>>2]+88>>2]](n,P,e+3248|0),g=m[a+8>>2],S=m[a>>2],x=m[a+4>>2],T=m[a+24>>2],C=m[a+16>>2],I=m[a+20>>2],b=m[a+40>>2],f=m[a+32>>2],p=m[a+36>>2],d[e+3260>>2]=0,D=f,f=m[e+3248>>2],R=p,p=m[e+3252>>2],M=b,b=m[e+3256>>2],m[e+3256>>2]=y(y(D*f)+y(R*p))+y(M*b),m[e+3252>>2]=y(y(f*C)+y(p*I))+y(b*T),m[e+3248>>2]=y(y(S*f)+y(x*p))+y(g*b),Me(),F=d[e+3260>>2],d[(A=26968+(v=E<<4)|0)>>2]=d[e+3256>>2],d[A+4>>2]=F,F=d[e+3252>>2],d[(A=v+26960|0)>>2]=d[e+3248>>2],d[A+4>>2]=F,S=m[o+40>>2],x=m[o+24>>2],T=m[o+8>>2],C=m[o+36>>2],I=m[o+20>>2],R=m[o+4>>2],p=m[o+32>>2],f=m[o+16>>2],M=m[o>>2],d[12+(A=v+(e+1264|0)|0)>>2]=0,b=m[e+3252>>2],g=y(-b),w=y(f*g),f=m[e+3248>>2],D=p,p=m[e+3256>>2],m[A>>2]=y(w-y(M*f))-y(D*p),m[A+4>>2]=y(y(I*g)-y(f*R))-y(p*C),m[A+8>>2]=y(y(x*g)-y(f*T))-y(p*S),g=m[a+32>>2],S=m[a>>2],x=m[a+16>>2],T=m[a+36>>2],C=m[a+4>>2],I=m[a+20>>2],R=m[a+40>>2],M=m[a+8>>2],D=m[a+24>>2],d[12+(v=v+(e+272|0)|0)>>2]=0,m[v+8>>2]=y(y(f*M)+y(b*D))+y(p*R),m[v+4>>2]=y(y(f*C)+y(b*I))+y(p*T),m[v>>2]=y(y(f*S)+y(b*x))+y(p*g),E=E+1|0,(0|B)!=(0|(P=P+1|0)););if(r[d[d[i>>2]+76>>2]](i,e+1264|0,e+3248|0,E),r[d[d[n>>2]+76>>2]](n,e+272|0,e+2256|0,E),(0|E)<1)g=y(0xde0b6b000000000),f=y(0),p=y(0),b=y(0),I=y(0);else for(P=0,g=y(0xde0b6b000000000),I=y(0),b=y(0),p=y(0),f=y(0);Me(),S=m[26960+(v=P<<4)>>2],x=m[v+26964>>2],T=N?y(0):m[v+26968>>2],+y(y(y(S*S)+y(x*x))+y(T*T))>.01&&(C=m[(A=v+(e+2256|0)|0)>>2],R=m[A+4>>2],M=m[A+8>>2],D=m[(A=v+(e+3248|0)|0)>>2],w=m[A+4>>2],L=m[A+8>>2],(C=y(y(y(S*y(y(y(y(y(C*m[a>>2])+y(R*m[a+4>>2]))+y(M*m[a+8>>2]))+m[a+48>>2])-y(y(y(y(D*m[o>>2])+y(w*m[o+4>>2]))+y(L*m[o+8>>2]))+m[o+48>>2])))+y(x*y(y(y(y(y(C*m[a+16>>2])+y(R*m[a+20>>2]))+y(M*m[a+24>>2]))+m[a+52>>2])-y(y(y(y(D*m[o+16>>2])+y(w*m[o+20>>2]))+y(L*m[o+24>>2]))+m[o+52>>2]))))+y(T*y(N?0:y(y(y(y(C*m[a+32>>2])+y(R*m[a+36>>2]))+y(M*m[a+40>>2]))+m[a+56>>2])-y(y(y(y(D*m[o+32>>2])+y(w*m[o+36>>2]))+y(L*m[o+40>>2]))+m[o+56>>2])))))>2],f=S,p=x,b=T,g=C)),(0|(P=P+1|0))!=(0|E););return Co(i),Co(n),E=0,g>2],C=m[o+56>>2],R=m[o+48>>2],n=d[o+12>>2],d[(i=e- -64|0)>>2]=d[o+8>>2],d[i+4>>2]=n,i=d[o+4>>2],d[e+56>>2]=d[o>>2],d[e+60>>2]=i,i=d[o+28>>2],d[e+80>>2]=d[o+24>>2],d[e+84>>2]=i,i=d[o+20>>2],d[e+72>>2]=d[o+16>>2],d[e+76>>2]=i,i=d[o+40>>2],n=d[o+44>>2],P=d[o+32>>2],o=d[o+36>>2],d[e+116>>2]=0,g=y(g+y(y(S+x)+y(.5))),m[e+112>>2]=C+y(b*g),m[e+108>>2]=T+y(p*g),d[e+96>>2]=i,d[e+100>>2]=n,m[e+104>>2]=R+y(f*g),d[e+88>>2]=P,d[e+92>>2]=o,i=d[a+12>>2],d[e+128>>2]=d[a+8>>2],d[e+132>>2]=i,i=d[a+4>>2],d[e+120>>2]=d[a>>2],d[e+124>>2]=i,i=d[a+28>>2],d[e+144>>2]=d[a+24>>2],d[e+148>>2]=i,i=d[a+20>>2],d[e+136>>2]=d[a+16>>2],d[e+140>>2]=i,i=d[a+44>>2],d[e+160>>2]=d[a+40>>2],d[e+164>>2]=i,i=d[a+36>>2],d[e+152>>2]=d[a+32>>2],d[e+156>>2]=i,i=d[a+60>>2],d[e+176>>2]=d[a+56>>2],d[e+180>>2]=i,i=d[a+52>>2],d[e+168>>2]=d[a+48>>2],d[e+172>>2]=i,d[e+184>>2]=1566444395,s[e+48|0]=0,d[e+8>>2]=4716,d[t+16>>2]=0,m[t+12>>2]=-b,m[t+8>>2]=-p,m[t+4>>2]=-f,j_(t,e+56|0,e+8|0,_),(t=u[e+48|0])&&(S=m[e+44>>2],x=m[e+32>>2],T=m[e+36>>2],C=m[e+28>>2],d[c+12>>2]=0,g=y(g-S),m[c>>2]=C-y(f*g),m[c+8>>2]=T-y(b*g),m[c+4>>2]=x-y(p*g),i=d[e+40>>2],d[h+8>>2]=d[e+36>>2],d[h+12>>2]=i,i=d[e+32>>2],d[h>>2]=d[e+28>>2],d[h+4>>2]=i,m[l+12>>2]=I,m[l+8>>2]=b,m[l+4>>2]=p,m[l>>2]=f),E=0!=(0|t)),O=e+4240|0,0|E},r[108]=gd,r[109]=Pd,r[110]=fd,r[111]=fd,r[112]=function(e,t,i,n){e|=0,t|=0,i|=0,n=y(n);var r=0;r=d[t+4>>2],d[e+4>>2]=d[t>>2],d[e+8>>2]=r,r=d[t+12>>2],d[e+12>>2]=d[t+8>>2],d[e+16>>2]=r,t=d[i+4>>2],d[e+20>>2]=d[i>>2],d[e+24>>2]=t,t=d[i+12>>2],d[e+28>>2]=d[i+8>>2],d[e+32>>2]=t,s[e+40|0]=1,m[e+36>>2]=n},r[113]=gd,r[114]=Pd,r[115]=function(e,t,i,n,r){},r[116]=U_,r[117]=Rd,r[118]=gd,r[119]=Id,r[120]=function(e){var t=0,i=0;return d[(e|=0)>>2]=5152,u[e+8|0]&&(t=d[e+12>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),0|e},r[121]=function(e){var t=0,i=0;d[(e|=0)>>2]=5152,u[e+8|0]&&(t=d[e+12>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),ve(e)},r[122]=function(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o=y(0),a=y(0),l=y(0),c=0,h=y(0),_=0,u=y(0),p=y(0),f=y(0),g=y(0),b=y(0);O=n=O-32|0;e:if(e=d[e+12>>2])if(d[s+4>>2]=e,c=d[t+12>>2],_=d[i+12>>2],f=m[_+48>>2],p=y(m[c+48>>2]-f),g=m[_+52>>2],a=y(m[c+52>>2]-g),b=m[_+56>>2],l=y(m[c+56>>2]-b),o=y(x(y(y(y(p*p)+y(a*a))+y(l*l)))),t=d[t+4>>2],h=y(m[t+28>>2]*m[t+12>>2]),t=d[i+4>>2],u=y(m[t+28>>2]*m[t+12>>2]),o>(h=y(h+u))){if(!d[e+748>>2])break e;if((0|(t=d[e+740>>2]))!=(0|(i=d[d[s+8>>2]+8>>2]))){ot(e,d[d[s+12>>2]+8>>2]+4|0,i+4|0);break e}ot(e,t+4|0,d[d[s+12>>2]+8>>2]+4|0)}else d[n+24>>2]=0,d[n+28>>2]=0,d[n+16>>2]=1065353216,d[n+20>>2]=0,h=y(o-h),o>y(1.1920928955078125e-7)?(d[n+28>>2]=0,o=y(y(1)/o),l=y(l*o),m[n+24>>2]=l,a=y(a*o),m[n+20>>2]=a,o=y(p*o),m[n+16>>2]=o):(o=y(1),l=y(0),a=y(0)),d[n+12>>2]=0,m[n+8>>2]=y(u*l)+b,m[n+4>>2]=y(u*a)+g,m[n>>2]=y(u*o)+f,r[d[d[s>>2]+16>>2]](s,n+16|0,n,h),e=d[s+4>>2],d[e+748>>2]&&(t=(0|(i=d[e+740>>2]))==(0|(c=d[d[s+8>>2]+8>>2])),_=e,e=d[d[s+12>>2]+8>>2],ot(_,(t?i:e)+4|0,(t?e:c)+4|0));O=n+32|0},r[123]=U_,r[124]=gr,r[125]=Bt,r[126]=function(e){ve(Bt(e|=0))},r[127]=ud,r[128]=ld,r[129]=cr,r[130]=hd,r[131]=gd,r[132]=Pd,r[133]=function(e,t,i,n){return e|=0,i|=0,n|=0,e=d[(t|=0)>>2],Ss(e=0|r[d[d[e>>2]+56>>2]](e,80),t,i,n,0),0|e},r[134]=Pd,r[135]=function(e,t,i,n){return e|=0,i|=0,n|=0,e=d[(t|=0)>>2],Ss(e=0|r[d[d[e>>2]+56>>2]](e,80),t,i,n,1),0|e},r[136]=Pd,r[137]=function(e,t,i,n){return e|=0,i|=0,n|=0,e=d[(t|=0)>>2],Zs(e=0|r[d[d[e>>2]+56>>2]](e,44),t,i,n,0),0|e},r[138]=Pd,r[139]=function(e,t,i,n){return e|=0,i|=0,n|=0,e=d[(t|=0)>>2],function(e,t,i,n){d[e>>2]=17764,d[e+4>>2]=d[t>>2],d[e>>2]=5076,s[e+28|0]=1,d[e>>2]=10568,d[e+24>>2]=0,d[e+16>>2]=0,d[e+20>>2]=0,t=d[t+4>>2],s[e+36|0]=0,d[e+32>>2]=t,d[7717]=d[7717]+1,function(e){var t,i,n=0,o=0,a=0,l=0;if(d[e>>2]=10504,s[e+24|0]=0,s[e+20|0]=1,d[e+16>>2]=0,s[e+44|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,d[e+40>>2]=0,s[e- -64|0]=1,d[e+32>>2]=0,d[e+36>>2]=0,d[e+60>>2]=0,d[e+52>>2]=0,d[e+56>>2]=0,d[7717]=d[7717]+1,t=0|r[d[6606]](24,16),(0|(i=d[e+8>>2]))>=1)for(;n=(o=b(a,12))+d[e+16>>2]|0,l=d[n+4>>2],d[(o=o+t|0)>>2]=d[n>>2],d[o+4>>2]=l,d[o+8>>2]=d[n+8>>2],(0|i)!=(0|(a=a+1|0)););(n=d[e+16>>2])&&(u[e+20|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+16>>2]=0),d[e+16>>2]=t,s[e+20|0]=1,d[e+12>>2]=2,si(e)}(t=0|r[d[6606]](68,16)),d[e+8>>2]=t,d[e+40>>2]=d[d[i+4>>2]+68>>2],d[e+44>>2]=d[d[n+4>>2]+68>>2]}(e=0|r[d[d[e>>2]+56>>2]](e,48),t,i,n),0|e},r[140]=Pd,r[141]=function(e,t,i,n){return e|=0,i|=0,n|=0,e=d[(t|=0)>>2],Zs(e=0|r[d[d[e>>2]+56>>2]](e,44),t,i,n,1),0|e},r[142]=Pd,r[143]=function(e,t,i,n){return e|=0,e=d[(t|=0)>>2],e=0|r[d[d[e>>2]+56>>2]](e,8),d[e>>2]=17764,d[e+4>>2]=d[t>>2],d[e>>2]=4984,0|e},r[144]=Pd,r[145]=function(e,t,i,n){return e|=0,i|=0,n|=0,e=d[(t|=0)>>2],function(e,t,i,n){d[e>>2]=17764,d[e+4>>2]=d[t>>2],d[e>>2]=5076,d[e+12>>2]=0,s[e+8|0]=0,d[e>>2]=5152,t=d[e+4>>2],t=0|r[d[d[t>>2]+12>>2]](t,d[i+8>>2],d[n+8>>2]),s[e+8|0]=1,d[e+12>>2]=t}(e=0|r[d[d[e>>2]+56>>2]](e,16),t,i,n),0|e},r[146]=Pd,r[147]=function(e,t,i,n){e|=0,i|=0,n|=0;var o=0;return o=d[(t|=0)>>2],function(e,t,i,n,o,a){d[e>>2]=17764,d[e+4>>2]=d[i>>2],d[e>>2]=5076,s[e+16|0]=a,d[e+12>>2]=t,s[e+8|0]=0,d[e>>2]=9708,t||(t=d[e+4>>2],t=0|r[d[d[t>>2]+12>>2]](t,d[n+8>>2],d[o+8>>2]),s[e+8|0]=1,d[e+12>>2]=t)}(o=0|r[d[d[o>>2]+56>>2]](o,20),d[t+4>>2],t,i,n,u[e+4|0]),0|o},r[148]=Pd,r[149]=function(e,t,i,n){return e|=0,i|=0,n|=0,e=d[(t|=0)>>2],function(e,t,i,n){d[e>>2]=17764,d[e+4>>2]=d[t>>2],d[e>>2]=5076,d[e+12>>2]=0,s[e+8|0]=0,d[e>>2]=7016,t=d[e+4>>2],r[d[d[t>>2]+24>>2]](t,d[i+8>>2],d[n+8>>2])&&(t=d[e+4>>2],t=0|r[d[d[t>>2]+12>>2]](t,d[i+8>>2],d[n+8>>2]),s[e+8|0]=1,d[e+12>>2]=t)}(e=0|r[d[d[e>>2]+56>>2]](e,16),t,i,n),0|e},r[150]=Pd,r[151]=function(e,t,i,n){e|=0,i|=0,n|=0;var o=0;return o=d[(t|=0)>>2],function(e,t,i,n,o,a,l){d[e>>2]=17764,d[e+4>>2]=d[t>>2],d[e+24>>2]=l,d[e+20>>2]=a,s[e+16|0]=o,d[e+12>>2]=0,s[e+8|0]=0,d[e>>2]=6204,t=d[e+4>>2],a=o?n:i,i=o?i:n,r[d[d[t>>2]+24>>2]](t,d[a+8>>2],d[i+8>>2])&&(t=d[e+4>>2],t=0|r[d[d[t>>2]+12>>2]](t,d[a+8>>2],d[i+8>>2]),s[e+8|0]=1,d[e+12>>2]=t)}(o=0|r[d[d[o>>2]+56>>2]](o,28),t,i,n,u[e+4|0],d[e+8>>2],d[e+12>>2]),0|o},r[152]=function(e){var t=0,i=0;return d[(e|=0)>>2]=6204,u[e+8|0]&&(t=d[e+12>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),0|e},r[153]=function(e){var t=0,i=0;d[(e|=0)>>2]=6204,u[e+8|0]&&(t=d[e+12>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),ve(e)},r[154]=function(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=0,p=y(0),f=y(0),g=0,b=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=0,z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0),se=y(0),oe=y(0),ae=y(0),le=y(0),ce=y(0);if(O=n=O-48|0,d[e+12>>2]){if(o=u[e+16|0],_=d[(W=o?t:i)+12>>2],T=m[_+56>>2],q=m[_+52>>2],E=m[_+48>>2],o=d[(g=o?i:t)+12>>2],R=m[o+56>>2],G=m[o+52>>2],j=m[o+48>>2],g=d[g+4>>2],P=m[o+32>>2],w=m[o>>2],F=m[o+16>>2],M=m[o+36>>2],N=m[o+20>>2],L=m[o+4>>2],a=m[_+40>>2],l=m[_+24>>2],c=m[_+8>>2],h=m[_+36>>2],b=m[_+20>>2],f=m[_+4>>2],C=m[_+32>>2],I=m[o+40>>2],S=m[_+16>>2],k=m[o+24>>2],p=m[_>>2],V=m[o+8>>2],_=d[W+4>>2],D=m[_+56>>2],B=m[_+52>>2],U=m[_+48>>2],d[n+28>>2]=0,H=y(y(y(V*f)+y(k*b))+y(I*h)),B=y(-B),X=y(y(y(V*p)+y(k*S))+y(I*C)),I=y(y(y(V*c)+y(k*l))+y(I*a)),m[n+24>>2]=y(y(H*B)-y(U*X))-y(D*I),k=y(y(y(L*f)+y(N*b))+y(M*h)),V=y(y(y(L*p)+y(N*S))+y(M*C)),Y=y(y(y(L*c)+y(N*l))+y(M*a)),m[n+20>>2]=y(y(k*B)-y(U*V))-y(D*Y),Q=y(y(y(w*f)+y(F*b))+y(P*h)),z=U,U=y(y(y(w*p)+y(F*S))+y(P*C)),M=D,D=y(y(y(w*c)+y(F*l))+y(P*a)),m[n+16>>2]=y(y(Q*B)-y(z*U))-y(M*D),r[d[d[g>>2]+64>>2]](n+32|0,g,n+16|0),o=d[W+12>>2],B=m[o+48>>2],K=m[o+32>>2],Z=m[o+16>>2],$=m[o+8>>2],J=m[o+4>>2],ee=m[o>>2],te=m[o+56>>2],ie=m[o+52>>2],ne=m[o+40>>2],re=m[o+36>>2],se=m[o+24>>2],oe=m[o+20>>2],ae=m[_+64>>2],M=m[_+56>>2],N=m[_+48>>2],L=m[_+52>>2],P=m[n+40>>2],w=m[n+32>>2],F=m[n+36>>2],le=m[d[e+12>>2]+752>>2],d[s+4>>2]=d[e+12>>2],ce=y(y(y(j*c)+y(G*l))+y(R*a)),z=l,l=y(-q),I=y(y(ce+y(y(y(z*l)-y(E*c))-y(T*a)))+y(y(y(D*w)+y(Y*F))+y(I*P))),C=y(y(y(y(y(j*p)+y(G*S))+y(R*C))+y(y(y(S*l)-y(E*p))-y(T*C)))+y(y(y(U*w)+y(V*F))+y(X*P))),b=y(y(y(y(y(j*f)+y(G*b))+y(R*h))+y(y(y(b*l)-y(E*f))-y(T*h)))+y(y(y(Q*w)+y(k*F))+y(H*P))),(a=y(y(y(M*I)+y(y(N*C)+y(L*b)))-ae))>2],f=m[o+24>>2],S=m[o+20>>2],p=m[o+40>>2],T=m[o+36>>2],E=m[o+16>>2],R=m[o+32>>2],l=m[_+56>>2],G=m[o+8>>2],c=m[_+48>>2],j=m[o>>2],h=m[_+52>>2],P=m[o+4>>2],d[n+28>>2]=0,m[n+16>>2]=y(y(j*c)+y(P*h))+y(G*l),m[n+24>>2]=y(y(c*R)+y(h*T))+y(l*p),m[n+20>>2]=y(y(c*E)+y(h*S))+y(l*f),d[n+12>>2]=0,l=y(C-y(N*a)),c=y(b-y(L*a)),h=y(I-y(M*a)),m[n+8>>2]=y(y(y(l*K)+y(c*re))+y(h*ne))+te,m[n+4>>2]=y(y(y(l*Z)+y(c*oe))+y(h*se))+ie,m[n>>2]=y(y($*h)+y(y(ee*l)+y(J*c)))+B,r[d[d[s>>2]+16>>2]](s,n+16|0,n,a)),!(d[g+4>>2]>6|d[d[s+4>>2]+748>>2]>=d[e+24>>2]||(l=m[_+56>>2],y(v(l))>y(.7071067690849304)?(a=m[_+52>>2],c=y(y(1)/y(x(y(y(l*l)+y(a*a))))),a=y(a*c),l=y(c*y(-l)),c=y(0)):(a=m[_+48>>2],c=m[_+52>>2],h=y(y(1)/y(x(y(y(a*a)+y(c*c))))),l=y(a*h),a=y(0),c=y(h*y(-c))),o=0,h=y(r[d[d[g>>2]+16>>2]](g)),f=An(h=y(y(A(y(m[6601]/h),y(.39269909262657166)))*y(.5))),g=d[e+20>>2],b=yn(h),(0|g)<1)))for(D=a,a=y(f/y(x(y(y(y(c*c)+y(l*l))+y(a*a))))),f=y(D*a),C=y(l*a),S=y(c*a);l=m[_+52>>2],h=m[_+48>>2],a=m[_+56>>2],c=y(y(y(y(6.2831854820251465)/y(0|g))*y(0|o))*y(.5)),p=y(An(c)/y(x(y(y(y(h*h)+y(l*l))+y(a*a))))),a=y(a*p),l=y(l*p),c=yn(c),h=y(h*p),p=y(y(f*a)+y(y(C*l)+y(y(b*c)+y(S*h)))),T=y(y(C*a)+y(y(y(S*c)-y(b*h))-y(f*l))),E=y(y(f*h)+y(y(y(C*c)-y(b*l))-y(S*a))),R=y(y(S*l)+y(y(y(f*c)-y(b*a))-y(C*h))),m[n+28>>2]=y(y(y(c*p)-y(h*T))-y(l*E))-y(a*R),m[n+24>>2]=y(y(l*T)+y(y(a*p)+y(c*R)))-y(h*E),m[n+20>>2]=y(y(h*R)+y(y(c*E)+y(l*p)))-y(a*T),m[n+16>>2]=y(y(a*E)+y(y(h*p)+y(c*T)))-y(l*R),ye(e,n+16|0,t,i,s),(0|(o=o+1|0))<(0|(g=d[e+20>>2])););!u[e+8|0]|!d[d[e+12>>2]+748>>2]||(e=d[s+4>>2],d[e+748>>2]&&((0|(t=d[e+740>>2]))==(0|(i=d[d[s+8>>2]+8>>2]))?ot(e,t+4|0,d[d[s+12>>2]+8>>2]+4|0):ot(e,d[d[s+12>>2]+8>>2]+4|0,i+4|0)))}O=n+48|0},r[155]=U_,r[156]=gr,r[157]=gd,r[158]=Pd,r[159]=ee,r[160]=function(e){var t=0;return d[12+(e|=0)>>2]=6392,d[e>>2]=6364,t=d[e+60>>2],r[d[d[t>>2]+20>>2]](t,d[e+76>>2]),t=d[e+60>>2],r[d[d[t>>2]+16>>2]](t,d[e+76>>2]),0|e},r[161]=function(e){var t=0;d[12+(e|=0)>>2]=6392,d[e>>2]=6364,t=d[e+60>>2],r[d[d[t>>2]+20>>2]](t,d[e+76>>2]),t=d[e+60>>2],r[d[d[t>>2]+16>>2]](t,d[e+76>>2]),ve(e)},r[162]=function(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o,a=0,l=0,c=y(0);o=u[e+8|0],a=d[(l=o?t:i)+4>>2],d[a+4>>2]+-21>>>0>8||d[d[(t=o?i:t)+4>>2]+4>>2]>19||(c=y(r[d[d[a>>2]+48>>2]](a)),d[s+4>>2]=d[e+76>>2],function(e,t,i,n,s,o){var a,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0);O=a=O+-64|0,m[e+56>>2]=t,d[e+52>>2]=i,d[e+8>>2]=s,d[e+4>>2]=n,d[e+44>>2]=o,i=d[s+12>>2],l=m[i+52>>2],A=m[i+56>>2],s=d[n+12>>2],C=m[s+52>>2],S=m[s+56>>2],c=m[i+20>>2],h=m[i+36>>2],x=m[s+20>>2],T=m[s+36>>2],E=m[s+24>>2],_=m[i+24>>2],R=m[s+40>>2],u=m[i+40>>2],P=m[s+32>>2],p=m[i+32>>2],I=m[s>>2],f=m[i>>2],M=m[s+16>>2],g=m[i+16>>2],D=m[i+48>>2],w=m[s+48>>2],b=m[i+4>>2],F=m[s+4>>2],B=m[s+8>>2],v=m[i+8>>2],d[a+60>>2]=0,d[a+44>>2]=0,d[a+28>>2]=0,m[a+40>>2]=y(y(v*B)+y(_*E))+y(u*R),m[a+36>>2]=y(y(v*F)+y(_*x))+y(u*T),m[a+24>>2]=y(y(b*B)+y(c*E))+y(h*R),m[a+20>>2]=y(y(b*F)+y(c*x))+y(h*T),l=y(-l),m[a+56>>2]=y(y(y(_*l)-y(v*D))-y(u*A))+y(y(y(v*w)+y(_*C))+y(u*S)),m[a+52>>2]=y(y(y(c*l)-y(b*D))-y(h*A))+y(y(y(b*w)+y(c*C))+y(h*S)),d[a+12>>2]=0,m[a>>2]=y(y(f*I)+y(g*M))+y(p*P),m[a+32>>2]=y(y(v*I)+y(_*M))+y(u*P),m[a+16>>2]=y(y(b*I)+y(c*M))+y(h*P),m[a+8>>2]=y(y(f*B)+y(g*E))+y(p*R),m[a+4>>2]=y(y(f*F)+y(g*x))+y(p*T),m[a+48>>2]=y(y(y(g*l)-y(f*D))-y(p*A))+y(y(y(f*w)+y(g*C))+y(p*S)),i=d[n+4>>2],r[d[d[i>>2]+8>>2]](i,a,e+12|0,e+28|0),m[e+28>>2]=m[e+28>>2]+t,m[e+32>>2]=m[e+32>>2]+t,m[e+36>>2]=m[e+36>>2]+t,m[e+12>>2]=m[e+12>>2]-t,m[e+16>>2]=m[e+16>>2]-t,m[e+20>>2]=m[e+20>>2]-t,O=a- -64|0}(i=e+12|0,c,n,t,l,s),t=d[t+8>>2],n=d[e+76>>2],d[n+744>>2]=d[l+8>>2],d[n+740>>2]=t,r[d[d[a>>2]+64>>2]](a,i,e+24|0,e+40|0),t=d[s+4>>2],d[t+748>>2]&&(i=(0|(n=d[t+740>>2]))==(0|(a=d[d[s+8>>2]+8>>2])),l=t,t=d[d[s+12>>2]+8>>2],ot(l,(i?n:t)+4|0,(i?t:a)+4|0)),d[e+16>>2]=0,d[e+20>>2]=0)},r[163]=function(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0);return O=n=O-240|0,Z=y(1),s=u[e+8|0],o=y(m[(e=s?i:t)+116>>2]-m[e+52>>2]),a=y(o*o),o=y(m[e+120>>2]-m[e+56>>2]),a=y(a+y(o*o)),o=y(m[e+124>>2]-m[e+60>>2]),a=y(a+y(o*o)),o=m[e+252>>2],a>2],d[i+4>>2]+-21>>>0>8||(w=m[e+92>>2],F=m[e+76>>2],B=m[e+108>>2],N=m[e+88>>2],L=m[e+72>>2],k=m[e+104>>2],V=m[e+100>>2],U=m[e+84>>2],G=m[e+68>>2],p=m[t+36>>2],f=m[t+20>>2],g=m[t+4>>2],j=m[e+28>>2],W=m[e+12>>2],z=m[e+44>>2],H=m[e+24>>2],X=m[e+8>>2],Y=m[e+40>>2],Q=m[e+36>>2],q=m[e+20>>2],K=m[e+4>>2],b=m[t+12>>2],E=m[e+116>>2],v=m[t+28>>2],a=m[e+120>>2],A=m[t+44>>2],R=m[e+124>>2],$=y(y(y(b*E)+y(v*a))+y(A*R)),C=m[t+24>>2],P=y(-m[t+56>>2]),S=m[t+8>>2],x=m[t+52>>2],T=m[t+40>>2],I=m[t+60>>2],_=y(y(y(C*P)-y(S*x))-y(T*I)),o=y(_+y(y(y(S*E)+y(C*a))+y(T*R))),l=m[e+56>>2],c=m[e+52>>2],h=m[e+60>>2],d[n+236>>2]=0,D=y(y(y(v*P)-y(b*x))-y(A*I)),M=y(D+y(y(y(b*c)+y(v*l))+y(A*h))),m[n+232>>2]=M,_=y(_+y(y(y(S*c)+y(C*l))+y(T*h))),m[n+228>>2]=_,x=y(y(y(f*P)-y(g*x))-y(p*I)),l=y(x+y(y(y(g*c)+y(f*l))+y(p*h))),m[n+224>>2]=l,P=l,(c=y(x+y(y(y(g*E)+y(f*a))+y(p*R))))>2]=c,P=c),E=_,o<_&&(m[n+228>>2]=o,E=o),(h=y(D+$))<(a=M)&&(m[n+232>>2]=h,a=h),d[n+220>>2]=0,m[n+216>>2]=M,m[n+212>>2]=_,m[n+208>>2]=l,R=l,l>2]=c,R=c),x=_,_>2]=o,x=o),I=M,M>2]=h,I=h),D=a,a=m[e+248>>2],m[n+232>>2]=D-a,m[n+228>>2]=E-a,m[n+224>>2]=P-a,m[n+216>>2]=a+I,m[n+212>>2]=a+x,m[n+208>>2]=a+R,d[n+128>>2]=0,m[n+124>>2]=h,m[n+120>>2]=o,m[n+116>>2]=c,d[n+112>>2]=0,m[n+108>>2]=y(y(b*F)+y(v*w))+y(A*B),m[n+104>>2]=y(y(b*L)+y(v*N))+y(A*k),m[n+100>>2]=y(y(b*G)+y(v*U))+y(A*V),d[n+96>>2]=0,m[n+92>>2]=y(y(S*F)+y(C*w))+y(T*B),m[n+88>>2]=y(y(S*L)+y(C*N))+y(T*k),m[n+84>>2]=y(y(S*G)+y(C*U))+y(T*V),d[n+80>>2]=0,m[n+76>>2]=y(y(g*F)+y(f*w))+y(p*B),m[n+72>>2]=y(y(g*L)+y(f*N))+y(p*k),d[n- -64>>2]=0,m[n+60>>2]=M,m[n+56>>2]=_,m[n+52>>2]=l,d[n+48>>2]=0,m[n+44>>2]=y(y(b*W)+y(v*j))+y(A*z),m[n+40>>2]=y(y(b*X)+y(v*H))+y(A*Y),m[n+36>>2]=y(y(b*K)+y(v*q))+y(A*Q),d[n+32>>2]=0,m[n+28>>2]=y(y(S*W)+y(C*j))+y(T*z),m[n+24>>2]=y(y(S*X)+y(C*H))+y(T*Y),m[n+20>>2]=y(y(S*K)+y(C*q))+y(T*Q),d[n+16>>2]=0,m[n+12>>2]=y(y(g*W)+y(f*j))+y(p*z),m[n+8>>2]=y(y(g*X)+y(f*H))+y(p*Y),m[n+196>>2]=a,m[n+68>>2]=y(y(g*G)+y(f*U))+y(p*V),m[n+4>>2]=y(y(g*K)+y(f*q))+y(p*Q),d[n>>2]=6704,d[n+200>>2]=d[e+244>>2],i&&(r[d[d[i>>2]+64>>2]](i,n,n+224|0,n+208|0),(o=m[n+200>>2])>2]&&(m[e+244>>2]=o,Z=o)))),O=n+240|0,y(Z)},r[164]=function(e,t){t|=0;var i=0,n=0,o=0,a=0,l=0;if(i=d[76+(e|=0)>>2]){if((0|(n=d[t+4>>2]))==d[t+8>>2]&&!((0|n)>=(0|(o=n?n<<1:1)))){if(o&&(d[7717]=d[7717]+1,a=0|r[d[6606]](o<<2,16),n=d[t+4>>2]),(0|n)>=1)for(i=0;d[(l=i<<2)+a>>2]=d[d[t+12>>2]+l>>2],(0|(i=i+1|0))!=(0|n););(i=d[t+12>>2])&&(u[t+16|0]&&(i&&(d[7718]=d[7718]+1,r[d[6607]](i)),n=d[t+4>>2]),d[t+12>>2]=0),d[t+12>>2]=a,s[t+16|0]=1,d[t+8>>2]=o,i=d[e+76>>2]}d[d[t+12>>2]+(n<<2)>>2]=i,d[t+4>>2]=n+1}},r[165]=function(e){var t=0;return d[(e|=0)>>2]=6392,t=d[e+48>>2],r[d[d[t>>2]+20>>2]](t,d[e+64>>2]),t=d[e+48>>2],r[d[d[t>>2]+16>>2]](t,d[e+64>>2]),0|e},r[166]=function(e){var t=0;d[(e|=0)>>2]=6392,t=d[e+48>>2],r[d[d[t>>2]+20>>2]](t,d[e+64>>2]),t=d[e+48>>2],r[d[d[t>>2]+16>>2]](t,d[e+64>>2]),ve(e)},r[167]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=0,a=y(0),l=y(0),c=y(0),h=0,_=y(0),u=0,p=0;O=s=O-128|0,((_=(a=m[t>>2])<(l=m[t+16>>2])?a:l)<(c=m[t+32>>2])?_:c)>m[e+28>>2]||m[(m[t+(o=(a>l^1)<<4)>>2]>c?o:32)+t>>2]>2]||((_=(a=m[t+8>>2])<(l=m[(o=t+24|0)>>2])?a:l)<(c=m[(h=t+40|0)>>2])?_:c)>m[e+36>>2]||m[(m[(o=a>l?t+8|0:o)>>2]>c?o:h)>>2]>2]||((_=(a=m[t+4>>2])<(l=m[(o=t+20|0)>>2])?a:l)<(c=m[(h=t+36|0)>>2])?_:c)>m[e+32>>2]||(o=a>l?t+4|0:o,d[d[d[e+4>>2]+4>>2]+4>>2]>19|m[(m[o>>2]>c?o:h)>>2]>2]||(h=d[e+48>>2],p=po(s+24|0),d[s+28>>2]=1,d[s+24>>2]=6500,o=d[t+12>>2],d[s+88>>2]=d[t+8>>2],d[s+92>>2]=o,o=d[t+4>>2],d[s+80>>2]=d[t>>2],d[s+84>>2]=o,o=d[t+28>>2],d[s+104>>2]=d[t+24>>2],d[s+108>>2]=o,o=d[t+20>>2],d[s+96>>2]=d[t+16>>2],d[s+100>>2]=o,o=d[t+44>>2],d[s+120>>2]=d[t+40>>2],d[s+124>>2]=o,o=d[t+36>>2],d[s+112>>2]=d[t+32>>2],d[s+116>>2]=o,d[s+68>>2]=d[e+56>>2],t=d[e+8>>2],o=d[t+12>>2],d[s+8>>2]=d[t+8>>2],d[s+12>>2]=o,d[s+20>>2]=n,d[s+16>>2]=i,d[s>>2]=t,d[s+4>>2]=s+24,o=0|r[d[d[h>>2]+8>>2]](h,d[e+4>>2],s,d[e+64>>2]),t=d[e+44>>2],u=d[t+8>>2],d[u+8>>2]!=d[d[e+8>>2]+8>>2]?(u=d[t+12>>2],d[t+12>>2]=s,r[d[d[t>>2]+12>>2]](t,i,n)):(d[t+8>>2]=s,r[d[d[t>>2]+8>>2]](t,i,n)),r[d[d[o>>2]+8>>2]](o,d[e+4>>2],s,d[e+52>>2],d[e+44>>2]),t=d[e+44>>2],d[(d[d[t+8>>2]+8>>2]==d[d[e+8>>2]+8>>2]?8:12)+t>>2]=u,r[d[d[o>>2]>>2]](o),r[d[d[h>>2]+60>>2]](h,o),Ha(p))),O=s+128|0},r[168]=Ha,r[169]=G_,r[170]=w_,r[171]=function(e,t,i){e|=0,t|=0,i|=0;var n,s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0);O=n=O-96|0,d[n+44>>2]=0,d[n+48>>2]=0,d[n+56>>2]=0,d[n+60>>2]=0,d[n+52>>2]=1065353216,d[n+76>>2]=0,d[n+80>>2]=0,d[n+72>>2]=1065353216,d[n+84>>2]=0,d[n+88>>2]=0,d[n+92>>2]=0,d[n+36>>2]=0,d[n+40>>2]=0,d[n+32>>2]=1065353216,d[n+64>>2]=0,d[n+68>>2]=0,r[d[d[e>>2]+8>>2]](e,n+32|0,n+16|0,n),l=m[n>>2],c=m[n+16>>2],s=y(l-c),a=y(s*s),s=m[n+4>>2],h=m[n+20>>2],o=y(s-h),u=y(a+y(o*o)),o=m[n+8>>2],a=m[n+24>>2],_=y(o-a),m[i>>2]=y(x(y(u+y(_*_))))*y(.5),d[t+12>>2]=0,m[t+8>>2]=y(o+a)*y(.5),m[t+4>>2]=y(s+h)*y(.5),m[t>>2]=y(l+c)*y(.5),O=n+96|0},r[172]=function(e){e|=0;var t,i=y(0),n=y(0);return O=t=O-32|0,r[d[d[e>>2]+12>>2]](e,t+16|0,t+12|0),O=t+32|0,i=m[t+16>>2],n=y(i*i),i=m[t+20>>2],n=y(n+y(i*i)),i=m[t+24>>2],y(y(m[t+12>>2]+y(x(y(n+y(i*i))))))},r[173]=function(e,t){return e|=0,t=y(t),y(y(y(r[d[d[e>>2]+16>>2]](e))*t))},r[174]=Wa,r[175]=function(e){return 12+(e|=0)|0},r[176]=kh,r[177]=function(e){return 6660},r[178]=function(e,t){d[8+(e|=0)>>2]=1065353216,d[e+12>>2]=0,d[e>>2]=1065353216,d[e+4>>2]=1065353216},r[179]=rd,r[180]=function(e){return y(m[44+(e|=0)>>2])},r[181]=yd,r[182]=function(e,t,i){return Jo(e|=0,t|=0,i|=0),d[t+28>>2]=d[e+28>>2],d[t+32>>2]=d[e+32>>2],d[t+36>>2]=d[e+36>>2],d[t+40>>2]=d[e+40>>2],d[t+12>>2]=d[e+12>>2],d[t+16>>2]=d[e+16>>2],d[t+20>>2]=d[e+20>>2],d[t+24>>2]=d[e+24>>2],d[t+44>>2]=d[e+44>>2],6669},r[183]=function(e,t){var i,n,s=0,o=0,a=0,l=0;o=t|=0,a=0|r[d[d[(e|=0)>>2]+52>>2]](e),l=1,s=d[d[t>>2]+16>>2],n=0|r[s](0|o,0|a,0|l),l=t,a=n,o=0|r[d[d[e>>2]+56>>2]](e,d[n+8>>2],t),i=e,s=d[d[t>>2]+20>>2],r[s](0|l,0|a,0|o,1346455635,0|i)},r[184]=kr,r[185]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0);n=m[i>>2],r=m[i+4>>2],s=m[i+8>>2],o=y(y(y(n*m[t+72>>2])+y(r*m[t+76>>2]))+y(s*m[t+80>>2])),a=y(y(y(n*m[t+88>>2])+y(r*m[t+92>>2]))+y(s*m[t+96>>2])),n=y(y(y(n*m[t+56>>2])+y(r*m[t+60>>2]))+y(s*m[t- -64>>2])),i=d[4+(t=(t+56|0)+((n>2],d[e>>2]=d[t>>2],d[e+4>>2]=i,i=d[t+12>>2],d[e+8>>2]=d[t+8>>2],d[e+12>>2]=i},r[186]=function(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0);O=o=O-48|0,h=m[t+36>>2],_=m[t+20>>2],u=m[t+40>>2],p=m[t+24>>2],f=m[t+4>>2],g=m[t+8>>2],a=m[i+8>>2],b=m[t+32>>2],l=m[i>>2],v=m[t>>2],c=m[i+4>>2],A=m[t+16>>2],d[o+44>>2]=0,m[o+32>>2]=y(y(v*l)+y(A*c))+y(b*a),m[o+40>>2]=y(y(l*g)+y(c*p))+y(a*u),m[o+36>>2]=y(y(l*f)+y(c*_))+y(a*h),r[d[d[e>>2]+64>>2]](o+16|0,e,o+32|0),p=m[t+56>>2],f=m[t+40>>2],g=m[t+36>>2],b=m[t+52>>2],v=m[t+24>>2],A=m[t+20>>2],C=m[t+32>>2],S=m[t+48>>2],x=m[t+8>>2],T=m[t>>2],E=m[t+4>>2],R=m[t+16>>2],a=m[o+24>>2],l=m[o+16>>2],c=m[o+20>>2],d[o+12>>2]=0,m[o+8>>2]=-m[o+40>>2],m[o+4>>2]=-m[o+36>>2],m[o>>2]=-m[o+32>>2],r[d[d[e>>2]+64>>2]](o+16|0,e,o),P=m[t+56>>2],I=m[t+40>>2],M=m[t+36>>2],D=m[t+52>>2],w=m[t+24>>2],F=m[t+20>>2],B=m[t+32>>2],N=m[t+48>>2],L=m[t+8>>2],k=m[t>>2],V=m[t+4>>2],U=m[t+16>>2],h=m[o+24>>2],_=m[o+16>>2],u=m[o+20>>2],m[n>>2]=y(y(y(S+y(y(y(l*T)+y(c*E))+y(a*x)))*m[i>>2])+y(y(b+y(y(y(l*R)+y(c*A))+y(a*v)))*m[i+4>>2]))+y(y(p+y(y(y(l*C)+y(c*g))+y(a*f)))*m[i+8>>2]),a=y(y(y(y(N+y(y(y(_*k)+y(u*V))+y(h*L)))*m[i>>2])+y(y(D+y(y(y(_*U)+y(u*F))+y(h*w)))*m[i+4>>2]))+y(y(P+y(y(y(_*B)+y(u*M))+y(h*I)))*m[i+8>>2])),m[s>>2]=a,(l=m[n>>2])>a&&(m[n>>2]=a,m[s>>2]=l),O=o+48|0},r[187]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var r=0,s=y(0),o=0,a=0,l=y(0),c=y(0),h=0,_=y(0),u=y(0),p=0;if((0|n)>=1)for(p=e+56|0;o=(r=a<<4)+i|0,s=m[(r=t+r|0)>>2],l=m[r+4>>2],c=m[r+8>>2],_=y(y(y(s*m[e+72>>2])+y(l*m[e+76>>2]))+y(c*m[e+80>>2])),u=y(y(y(s*m[e+88>>2])+y(l*m[e+92>>2]))+y(c*m[e+96>>2])),s=y(y(y(s*m[e+56>>2])+y(l*m[e+60>>2]))+y(c*m[e+64>>2])),h=d[4+(r=((s<_?_>2],d[o>>2]=d[r>>2],d[o+4>>2]=h,h=d[r+12>>2],d[o+8>>2]=d[r+8>>2],d[o+12>>2]=h,(0|(a=a+1|0))!=(0|n););},r[188]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=0,C=0,S=y(0),x=y(0),T=y(0),E=y(0),R=0,P=0;for(O=s=O-80|0,E=y(r[d[d[e>>2]+48>>2]](e));d[s+72>>2]=0,d[s+76>>2]=0,d[s+64>>2]=0,d[s+68>>2]=0,d[(R=(A=C<<2)+(s- -64|0)|0)>>2]=1065353216,c=m[t+32>>2],h=m[t>>2],_=m[t+16>>2],u=m[t+36>>2],p=m[t+4>>2],f=m[t+20>>2],o=m[t+40>>2],a=m[t+8>>2],l=m[t+24>>2],d[s+44>>2]=0,g=a,a=m[s+64>>2],b=l,l=m[s+68>>2],v=o,o=m[s+72>>2],m[s+40>>2]=y(y(g*a)+y(b*l))+y(v*o),m[s+36>>2]=y(y(a*p)+y(l*f))+y(o*u),m[s+32>>2]=y(y(h*a)+y(_*l))+y(c*o),r[d[d[e>>2]+64>>2]](s+48|0,e,s+32|0),c=m[t+48>>2],h=m[t+8>>2],_=m[t>>2],u=m[t+4>>2],p=m[t+52>>2],f=m[t+24>>2],v=m[t+16>>2],S=m[t+20>>2],a=m[t+56>>2],o=m[t+40>>2],l=m[t+32>>2],x=m[t+36>>2],d[s+44>>2]=0,g=a,a=m[s+48>>2],T=y(l*a),l=m[s+52>>2],b=o,o=m[s+56>>2],m[s+40>>2]=g+y(y(T+y(x*l))+y(b*o)),m[s+36>>2]=p+y(y(y(a*v)+y(l*S))+y(o*f)),m[s+32>>2]=c+y(y(y(a*_)+y(l*u))+y(o*h)),P=(s+32|0)+A|0,m[n+A>>2]=E+m[P>>2],d[R>>2]=-1082130432,c=m[t+32>>2],h=m[t>>2],_=m[t+16>>2],u=m[t+36>>2],p=m[t+4>>2],f=m[t+20>>2],o=m[t+40>>2],a=m[t+8>>2],l=m[t+24>>2],d[s+12>>2]=0,g=a,a=m[s+64>>2],b=l,l=m[s+68>>2],v=o,o=m[s+72>>2],m[s+8>>2]=y(y(g*a)+y(b*l))+y(v*o),m[s+4>>2]=y(y(a*p)+y(l*f))+y(o*u),m[s>>2]=y(y(h*a)+y(_*l))+y(c*o),r[d[d[e>>2]+64>>2]](s+16|0,e,s),c=m[t+48>>2],h=m[t+8>>2],_=m[t>>2],u=m[t+4>>2],p=m[t+52>>2],f=m[t+24>>2],v=m[t+16>>2],S=m[t+20>>2],a=m[t+56>>2],o=m[t+40>>2],l=m[t+32>>2],x=m[t+36>>2],d[s+44>>2]=0,g=a,a=m[s+16>>2],T=y(l*a),l=m[s+20>>2],b=o,o=m[s+24>>2],m[s+40>>2]=g+y(y(T+y(x*l))+y(b*o)),m[s+36>>2]=p+y(y(y(a*v)+y(l*S))+y(o*f)),m[s+32>>2]=c+y(y(y(a*_)+y(l*u))+y(o*h)),m[i+A>>2]=m[P>>2]-E,3!=(0|(C=C+1|0)););O=s+80|0},r[189]=Sd,r[190]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0);o=m[e+88>>2],a=m[e+72>>2],l=m[e+76>>2],h=m[e+96>>2],r=m[e- -64>>2],_=m[e+80>>2],c=m[e+92>>2],n=m[e+60>>2],s=m[e+56>>2],d[i+12>>2]=0,a=y(a-s),c=y(c-n),l=y(l-n),s=y(o-s),u=n=y(y(a*c)-y(l*s)),p=y(n*n),n=y(h-r),o=y(_-r),r=y(y(l*n)-y(o*c)),n=y(y(o*s)-y(a*n)),s=y(y(1)/y(x(y(p+y(y(r*r)+y(n*n)))))),o=y(u*s),m[i+8>>2]=o,n=y(n*s),m[i+4>>2]=n,r=y(r*s),m[i>>2]=r,t&&(m[i+8>>2]=-o,m[i+4>>2]=-n,m[i>>2]=-r)},r[191]=function(e,t){e|=0,t|=0;var i,n=0,o=0,a=0,l=0,c=0,h=0,_=0,p=0,f=0,g=y(0),v=0,A=y(0),C=y(0),S=0,T=0,E=y(0),R=0,P=y(0),I=0,M=0,D=0,w=y(0),F=y(0);O=i=O-240|0,(n=d[e+52>>2])&&(r[d[d[n>>2]>>2]](n),(n=d[e+52>>2])&&(d[7718]=d[7718]+1,r[d[6607]](n))),d[7717]=d[7717]+1,function(e){d[e>>2]=11320,s[e+20|0]=1,d[e+16>>2]=0,s[e+40|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,d[e+36>>2]=0,s[e+60|0]=1,d[e+28>>2]=0,d[e+32>>2]=0,d[e+56>>2]=0,d[e+48>>2]=0,d[e+52>>2]=0}(n=0|r[d[6606]](132,16)),d[e+52>>2]=n,d[i+228>>2]=0,d[i+220>>2]=0,d[i+224>>2]=0,s[i+232|0]=1;e:if(!((0|r[d[d[e>>2]+96>>2]](e))<1))for(;;){if((0|a)==(0|h))if((0|h)>=(0|(l=h?h<<1:1)))n=c;else{o=0,n=0,l&&(d[7717]=d[7717]+1,n=0|r[d[6606]](l<<4,16));t:{i:{if((0|h)>=1)for(;;)if(p=v=(_=o<<4)+n|0,S=d[4+(_=c+_|0)>>2],d[p>>2]=d[_>>2],d[p+4>>2]=S,p=d[_+12>>2],d[v+8>>2]=d[_+8>>2],d[v+12>>2]=p,(0|h)==(0|(o=o+1|0)))break i;if(!c)break t}u[i+232|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[i+228>>2]=0}d[i+228>>2]=n,s[i+232|0]=1,d[i+224>>2]=l}else n=c;if(d[i+220>>2]=a+1,l=d[i+156>>2],d[(n=(a<<=4)+n|0)>>2]=d[i+152>>2],d[n+4>>2]=l,l=d[i+164>>2],d[n+8>>2]=d[i+160>>2],d[n+12>>2]=l,c=d[i+228>>2],r[d[d[e>>2]+108>>2]](e,f,a+c|0),(0|(f=f+1|0))>=(0|r[d[d[e>>2]+96>>2]](e)))break e;h=d[i+224>>2],a=d[i+220>>2]}if(s[i+188|0]=1,d[i+184>>2]=0,s[i+208|0]=1,d[i+176>>2]=0,d[i+180>>2]=0,d[i+204>>2]=0,d[i+196>>2]=0,d[i+200>>2]=0,d[i+164>>2]=0,s[i+168|0]=1,d[i+156>>2]=0,d[i+160>>2]=0,t){if(d[i+60>>2]=0,s[i+64|0]=1,d[i+52>>2]=0,d[i+56>>2]=0,function(e,t){var i,n=0,o=y(0),a=0,l=y(0),c=y(0),h=0,_=0,p=0,f=0,g=y(0),b=0,v=y(0),A=0,C=0,S=0,T=y(0),E=y(0),R=0,P=0,I=0,M=0,D=0,O=y(0);if((0|(i=d[e+4>>2]))>=1)for(;;){e:if(!((0|(C=(f=C)+1|0))>=(0|i)))for(I=A=(_=d[e+12>>2])+(f<<4)|0,n=C;;){t:if(!((0|(f=n+1|0))>=(0|i)))for(D=P=(n<<4)+_|0,S=f;;){for(g=m[A>>2],l=y(m[P>>2]-g),n=(S<<4)+_|0,o=m[A+4>>2],v=y(m[n+4>>2]-o),c=y(m[P+4>>2]-o),T=y(m[n>>2]-g),O=y(y(l*v)-y(c*T)),o=m[I+8>>2],g=y(m[D+8>>2]-o),o=y(m[n+8>>2]-o),T=y(y(g*T)-y(l*o)),g=y(y(c*o)-y(g*v)),o=y(1),M=1;;){l=y(O*o),v=y(g*o),c=y(T*o);i:if((o=y(y(l*l)+y(y(v*v)+y(c*c))))>y(9999999747378752e-20)){if(o=y(y(1)/y(x(o))),E=y(l*o),l=y(c*o),c=y(v*o),(0|(h=d[t+4>>2]))>=1)for(b=d[t+12>>2],n=0;;){if(y(y(y(c*m[(a=b+(n<<4)|0)>>2])+y(l*m[a+4>>2]))+y(E*m[a+8>>2]))>y(.9990000128746033))break i;if((0|h)==(0|(n=n+1|0)))break}if(o=y(y(y(c*m[A>>2])+y(l*m[A+4>>2]))+y(E*m[I+8>>2])),(0|(a=d[e+4>>2]))>=1)for(b=d[e+12>>2],n=0;;){if(y(y(y(y(y(c*m[(p=b+(n<<4)|0)>>2])+y(l*m[p+4>>2]))+y(E*m[p+8>>2]))-o)+y(-.009999999776482582))>y(0))break i;if((0|a)==(0|(n=n+1|0)))break}if(o=y(-o),d[t+8>>2]==(0|h)&&!((0|h)>=(0|(R=h?h<<1:1)))){if(_=0,b=0,R&&(d[7717]=d[7717]+1,b=0|r[d[6606]](R<<4,16),h=d[t+4>>2]),(0|h)>=1)for(;a=(n=_<<4)+b|0,p=n+d[t+12>>2]|0,n=d[p+4>>2],d[a>>2]=d[p>>2],d[a+4>>2]=n,n=d[p+12>>2],d[a+8>>2]=d[p+8>>2],d[a+12>>2]=n,(0|(_=_+1|0))!=(0|h););(n=d[t+12>>2])&&(u[t+16|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[t+12>>2]=0),d[t+12>>2]=b,s[t+16|0]=1,d[t+8>>2]=R,h=d[t+4>>2]}n=d[t+12>>2]+(h<<4)|0,m[n+12>>2]=o,m[n+8>>2]=E,m[n+4>>2]=l,m[n>>2]=c,d[t+4>>2]=d[t+4>>2]+1}if(n=M,o=y(-1),M=0,!n)break}if((0|(S=S+1|0))>=(0|i))break t;_=d[e+12>>2]}if((0|i)==(0|f))break e;_=d[e+12>>2],n=f}if((0|i)==(0|C))break}}(i+216|0,i+48|0),d[i+140>>2]=0,s[i+144|0]=1,d[i+132>>2]=0,d[i+136>>2]=0,d[i+52>>2]>=1)for(c=0;;){if(t=d[i+60>>2]+(c<<4)|0,d[i+112>>2]=d[t+8>>2],n=d[t+4>>2],d[i+104>>2]=d[t>>2],d[i+108>>2]=n,g=y(m[t+12>>2]-y(r[d[d[e>>2]+48>>2]](e))),(0|(h=d[i+132>>2]))==d[i+136>>2]&&!((0|h)>=(0|(t=h?h<<1:1)))){if(o=0,n=0,t&&(d[7717]=d[7717]+1,n=0|r[d[6606]](t<<4,16),h=d[i+132>>2]),(0|h)>=1)for(;l=(a=o<<4)+n|0,a=a+d[i+140>>2]|0,v=d[a+4>>2],d[l>>2]=d[a>>2],d[l+4>>2]=v,_=d[a+12>>2],d[l+8>>2]=d[a+8>>2],d[l+12>>2]=_,(0|h)!=(0|(o=o+1|0)););(a=d[i+140>>2])&&(u[i+144|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[i+140>>2]=0),d[i+140>>2]=n,s[i+144|0]=1,d[i+136>>2]=t,h=d[i+132>>2]}if(n=d[i+108>>2],t=d[i+140>>2]+(h<<4)|0,d[t>>2]=d[i+104>>2],d[t+4>>2]=n,n=d[i+112>>2],m[t+12>>2]=g,d[t+8>>2]=n,d[i+132>>2]=d[i+132>>2]+1,!((0|(c=c+1|0))>2]))break}d[i+116>>2]=0,s[i+120|0]=1,d[i+108>>2]=0,d[i+112>>2]=0,_t(i+128|0,i+104|0),H(i+152|0,d[i+116>>2],d[i+108>>2]),(t=d[i+116>>2])&&(u[i+120|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[i+116>>2]=0),(t=d[i+140>>2])&&(u[i+144|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[i+140>>2]=0),(t=d[i+60>>2])&&(u[i+64|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[i+60>>2]=0)}else H(i+152|0,c,d[i+220>>2]);if(l=0,(0|(_=d[i+196>>2]))>=1)for(o=0,d[7717]=d[7717]+1,I=0|r[d[6606]](_<<4,16);a=d[i+52>>2],d[(n=t=(o<<4)+I|0)>>2]=d[i+48>>2],d[n+4>>2]=a,n=d[i+60>>2],d[t+8>>2]=d[i+56>>2],d[t+12>>2]=n,(0|_)!=(0|(o=o+1|0)););d[i+140>>2]=0,s[i+144|0]=1,d[i+132>>2]=0,d[i+136>>2]=0,s[i+63|0]=0,s[i+64|0]=0,s[i+65|0]=0,s[i+66|0]=0,d[i+56>>2]=0,d[i+60>>2]=0,d[i+48>>2]=0,d[i+52>>2]=0;e:{if((0|_)<=-1)for(n=_;;){if(a=t=b(n,36)+l|0,(l=d[t+12>>2])&&(u[t+16|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[a+12>>2]=0),s[t+16|0]=1,d[a+12>>2]=0,d[t+4>>2]=0,d[t+8>>2]=0,(t=n+1|0)>>>0>>0)break e;l=d[i+140>>2],n=t}if(_)for(bs(i+128|0,_),l=a=i+48|3,n=0;t=d[i+140>>2]+b(n,36)|0,d[t+4>>2]=0,d[t+8>>2]=0,s[t+16|0]=1,d[t+12>>2]=0,c=u[a+4|0]|u[a+5|0]<<8|u[a+6|0]<<16|u[a+7|0]<<24,o=u[0|a]|u[a+1|0]<<8|u[a+2|0]<<16|u[a+3|0]<<24,s[t+20|0]=o,s[t+21|0]=o>>>8,s[t+22|0]=o>>>16,s[t+23|0]=o>>>24,s[t+24|0]=c,s[t+25|0]=c>>>8,s[t+26|0]=c>>>16,s[t+27|0]=c>>>24,c=u[l+12|0]|u[l+13|0]<<8|u[l+14|0]<<16|u[l+15|0]<<24,o=u[l+8|0]|u[l+9|0]<<8|u[l+10|0]<<16|u[l+11|0]<<24,s[t+28|0]=o,s[t+29|0]=o>>>8,s[t+30|0]=o>>>16,s[t+31|0]=o>>>24,s[t+32|0]=c,s[t+33|0]=c>>>8,s[t+34|0]=c>>>16,s[t+35|0]=c>>>24,(0|_)!=(0|(n=n+1|0)););}if(d[i+132>>2]=_,n=d[e+52>>2],(0|(o=d[n+8>>2]))<(0|(c=d[i+156>>2]))){if(d[n+12>>2]<(0|c)){if(c?(d[7717]=d[7717]+1,a=0|r[d[6606]](c<<4,16),t=d[n+8>>2]):(a=0,t=o),(0|t)>=1)for(l=0;f=v=(h=l<<4)+a|0,h=h+d[n+16>>2]|0,p=d[h+4>>2],d[f>>2]=d[h>>2],d[f+4>>2]=p,f=d[h+12>>2],d[v+8>>2]=d[h+8>>2],d[v+12>>2]=f,(0|t)!=(0|(l=l+1|0)););(t=d[n+16>>2])&&(u[n+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[n+16>>2]=0),d[n+16>>2]=a,d[n+12>>2]=c,s[n+20|0]=1}for(;l=d[i+52>>2],t=d[n+16>>2]+(o<<4)|0,d[t>>2]=d[i+48>>2],d[t+4>>2]=l,a=d[i+60>>2],d[t+8>>2]=d[i+56>>2],d[t+12>>2]=a,(0|c)!=(0|(o=o+1|0)););}if(d[n+8>>2]=c,o=0,(0|c)>0)for(;t=(n=o<<4)+d[d[e+52>>2]+16>>2]|0,n=n+d[i+164>>2]|0,a=d[n+4>>2],d[t>>2]=d[n>>2],d[t+4>>2]=a,a=d[n+12>>2],d[t+8>>2]=d[n+8>>2],d[t+12>>2]=a,(0|c)!=(0|(o=o+1|0)););if((0|_)>=1)for(t=0;;){for(a=0,n=R=d[i+184>>2]+b(d[d[i+204>>2]+(t<<2)>>2],12)|0;;){if(v=c=(S=b(t,36))+d[i+140>>2]|0,T=d[8+(b(d[n+4>>2],12)+n|0)>>2],(0|(l=d[c+4>>2]))==d[c+8>>2]&&!((0|l)>=(0|(p=l?l<<1:1)))){o=0,h=0,p&&(d[7717]=d[7717]+1,h=0|r[d[6606]](p<<2,16),l=d[v+4>>2]),f=d[c+12>>2];e:{t:{if((0|l)>=1)for(;;)if(d[(M=o<<2)+h>>2]=d[f+M>>2],(0|(o=o+1|0))==(0|l))break t;if(!f)break e}u[c+16|0]&&f&&(d[7718]=d[7718]+1,r[d[6607]](f)),d[c+12>>2]=0,l=d[v+4>>2]}s[c+16|0]=1,d[c+12>>2]=h,d[c+8>>2]=p}if(d[d[c+12>>2]+(l<<2)>>2]=T,d[v+4>>2]=d[v+4>>2]+1,(0|a)<=1?(c=d[i+164>>2],g=m[4+(l=c+(T<<4)|0)>>2],c=c+(d[n+8>>2]<<4)|0,A=m[c+4>>2],C=m[l>>2],E=m[c>>2],P=m[l+8>>2],w=m[c+8>>2],d[12+(l=(i+48|0)+(a<<4)|0)>>2]=0,C=y(E-C),A=y(A-g),E=y(w-P),g=y(y(1)/y(x(y(y(y(C*C)+y(A*A))+y(E*E))))),m[l+8>>2]=E*g,m[l+4>>2]=A*g,m[l>>2]=C*g,a=a+1|0):a=2,n=b(d[n+4>>2],12)+n|0,(0|R)==(0|(n=b(d[n>>2],12)+n|0)))break}if(2!=(0|a)?(d[(n=(t<<4)+I|0)>>2]=0,d[n+4>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,n=d[i+140>>2]):(g=m[i+52>>2],C=m[i+68>>2],A=m[i+64>>2],E=m[i+56>>2],P=m[i+48>>2],w=m[i+72>>2],d[12+(a=(t<<4)+I|0)>>2]=0,F=y(y(C*P)-y(g*A)),C=y(y(g*w)-y(E*C)),A=y(y(E*A)-y(w*P)),g=y(y(1)/y(x(y(y(F*F)+y(y(C*C)+y(A*A)))))),m[a+8>>2]=F*g,m[a+4>>2]=A*g,g=y(C*g),m[a>>2]=g,n=d[i+140>>2],m[20+(l=S+n|0)>>2]=g,d[l+24>>2]=d[a+4>>2],a=d[a+8>>2],d[l+32>>2]=1900671690,d[l+28>>2]=a),(0|(l=d[4+(n=n+S|0)>>2]))<1)g=y(1.0000000150474662e30);else for(c=d[n+12>>2],C=m[8+(a=(t<<4)+I|0)>>2],A=m[a+4>>2],E=m[a>>2],h=d[d[e+52>>2]+16>>2],g=y(1.0000000150474662e30),o=0;a=h+(d[c+(o<<2)>>2]<<4)|0,g=g>(P=y(y(y(m[a>>2]*E)+y(m[a+4>>2]*A))+y(m[a+8>>2]*C)))?P:g,(0|l)!=(0|(o=o+1|0)););if(m[n+32>>2]=-g,(0|_)==(0|(t=t+1|0)))break}_=0;e:if(d[i+132>>2]>0){for(v=0,h=0;;){if((0|h)==(0|_))if(_>>>0>=(h=_?_<<1:1)>>>0)h=_;else{o=0,d[7717]=d[7717]+1,t=0|r[d[6606]](h<<2,16);t:{i:{if(_)for(;;)if(d[(n=o<<2)+t>>2]=d[n+v>>2],(0|_)==(0|(o=o+1|0)))break i;if(!v){h=1;break t}}v&&(d[7718]=d[7718]+1,r[d[6607]](v))}v=t}if(d[(_<<2)+v>>2]=_,!((0|(_=_+1|0))>2]))break}for(;;){t=d[((a=_+-1|0)<<2)+v>>2],d[7717]=d[7717]+1,n=0|r[d[6606]](4,16),d[n>>2]=t;t:{if((0|_)<2)h=1,t=n,_=a;else{for(t=(o=d[i+140>>2])+b(t,36)|0,g=m[t+20>>2],C=m[t+28>>2],A=m[t+24>>2],c=_+-2|0,l=1,_=a,h=1;;){f=d[(c<<2)+v>>2],t=b(f,36)+o|0;i:if(y(y(y(g*m[t+20>>2])+y(A*m[t+24>>2]))+y(C*m[t+28>>2]))>y(.9990000128746033)){n:if((0|l)!=(0|h)||(0|l)>=(0|(a=l?l<<1:1)))a=l,t=n;else{o=0,t=0,a&&(d[7717]=d[7717]+1,t=0|r[d[6606]](a<<2,16));r:{if((0|l)>=1)for(;;)if(d[(p=o<<2)+t>>2]=d[n+p>>2],(0|(o=o+1|0))==(0|l))break r;if(!n)break n}n&&(d[7718]=d[7718]+1,r[d[6607]](n))}if(d[(h<<2)+t>>2]=f,h=h+1|0,o=0,!((0|_)<1)){for(;;){if((0|f)!=d[(n=(o<<2)+v|0)>>2]){if((0|_)!=(0|(o=o+1|0)))continue;break i}break}(0|o)>=(0|_)||(l=n,n=((_=_+-1|0)<<2)+v|0,d[l>>2]=d[n>>2],d[n>>2]=f)}}else a=l,t=n;if(!((0|c)>=1))break;c=c+-1|0,o=d[i+140>>2],n=t,l=a}i:if(!((0|h)<=1)){for(n=0,d[i+116>>2]=0,s[i+120|0]=1,d[i+108>>2]=0,d[i+112>>2]=0,d[i+40>>2]=0,d[i+44>>2]=0,d[i+32>>2]=0,d[i+36>>2]=0,g=y(0),C=y(0),A=y(0),a=0;;){if(l=d[i+140>>2]+b(d[(a<<2)+t>>2],36)|0,E=m[l+24>>2],P=m[l+28>>2],m[i+32>>2]=m[l+20>>2]+A,m[i+40>>2]=P+g,m[i+36>>2]=E+C,(0|(c=d[l+4>>2]))>=1)for(f=0;;){M=d[d[l+12>>2]+(f<<2)>>2],o=d[d[e+52>>2]+16>>2]+(M<<4)|0,p=d[o+12>>2],d[i+16>>2]=d[o+8>>2],d[i+20>>2]=p,p=d[o+4>>2],d[i+8>>2]=d[o>>2],d[i+12>>2]=p;n:{if((0|n)>=1)for(p=(0|n)>1?n:1,o=0,S=d[i+116>>2];;){if((0|M)==d[20+(S+b(o,24)|0)>>2])break n;if((0|p)==(0|(o=o+1|0)))break}if(c=d[i+20>>2],d[i+56>>2]=d[i+16>>2],d[i+60>>2]=c,c=d[i+12>>2],d[i+48>>2]=d[i+8>>2],d[i+52>>2]=c,d[i+112>>2]==(0|n)&&!((0|n)>=(0|(R=n?n<<1:1)))){o=0,c=0,R&&(d[7717]=d[7717]+1,c=0|r[d[6606]](b(R,24),16),n=d[i+108>>2]),S=d[i+116>>2];r:{s:{if((0|n)>=1)for(;;)if(T=(p=b(o,24))+c|0,D=d[4+(p=p+S|0)>>2],d[T>>2]=d[p>>2],d[T+4>>2]=D,D=d[p+20>>2],d[T+16>>2]=d[p+16>>2],d[T+20>>2]=D,D=d[p+12>>2],d[T+8>>2]=d[p+8>>2],d[T+12>>2]=D,(0|(o=o+1|0))==(0|n))break s;if(!S)break r}u[i+120|0]&&(S&&(d[7718]=d[7718]+1,r[d[6607]](S)),n=d[i+108>>2]),d[i+116>>2]=0}d[i+116>>2]=c,s[i+120|0]=1,d[i+112>>2]=R}c=d[i+52>>2],n=d[i+116>>2]+b(n,24)|0,d[n>>2]=d[i+48>>2],d[n+4>>2]=c,c=d[i+60>>2],o=d[i+56>>2],p=d[i- -64>>2],d[n+20>>2]=M,d[n+16>>2]=p,d[n+8>>2]=o,d[n+12>>2]=c,n=d[i+108>>2]+1|0,d[i+108>>2]=n,c=d[l+4>>2]}if(!((0|(f=f+1|0))<(0|c)))break}if(g=m[i+40>>2],C=m[i+36>>2],A=m[i+32>>2],(0|h)==(0|(a=a+1|0)))break}if(d[i+60>>2]=0,s[i+64|0]=1,d[i+52>>2]=0,d[i+56>>2]=0,n=d[i+140>>2]+b(d[t>>2],36)|0,d[i+68>>2]=d[n+20>>2],d[i+72>>2]=d[n+24>>2],d[i+76>>2]=d[n+28>>2],d[i+80>>2]=d[n+32>>2],E=A,A=y(y(1)/y(x(y(y(y(A*A)+y(C*C))+y(g*g))))),m[i+32>>2]=E*A,m[i+36>>2]=C*A,m[i+40>>2]=g*A,d[i+20>>2]=0,s[i+24|0]=1,d[i+12>>2]=0,d[i+16>>2]=0,K(i+104|0,i+8|0,i+32|0),d[i+12>>2]<=0)n=d[i+108>>2];else for(a=0,c=d[i+52>>2];;){if(S=(p=b(a,24))+d[i+20>>2]|0,d[i+56>>2]==(0|c)&&!((0|c)>=(0|(f=c?c<<1:1)))){o=0,l=0,f&&(d[7717]=d[7717]+1,l=0|r[d[6606]](f<<2,16),c=d[i+52>>2]),n=d[i+60>>2];n:{r:{if((0|c)>=1)for(;;)if(d[(T=o<<2)+l>>2]=d[n+T>>2],(0|c)==(0|(o=o+1|0)))break r;if(!n)break n}u[i+64|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+60>>2]=0,c=d[i+52>>2]}d[i+60>>2]=l,s[i+64|0]=1,d[i+56>>2]=f}d[d[i+60>>2]+(c<<2)>>2]=d[S+20>>2],c=d[i+52>>2]+1|0,d[i+52>>2]=c;n:if(!((0|(n=d[i+108>>2]))<1)){for(l=d[20+(p+d[i+20>>2]|0)>>2],o=0,f=d[i+116>>2];;){if(p=f+b(o,24)|0,(0|l)!=d[p+20>>2]){if((0|(o=o+1|0))!=(0|n))continue;break n}break}d[p+20>>2]=-1}if(!((0|(a=a+1|0))>2]))break}if((0|n)>=1)for(f=0,c=d[i+140>>2],a=d[i+132>>2],p=d[i+116>>2];;){if(-1!=(0|(S=d[20+(p+b(f,24)|0)>>2]))&&(l=0,!((0|a)<1)))for(;;){o=0;n:{if((0|h)>0)for(;;){if(d[(o<<2)+t>>2]==(0|l))break n;if((0|h)==(0|(o=o+1|0)))break}if(o=c+b(l,36)|0,!((0|(T=d[o+4>>2]))<1)){for(R=d[o+12>>2],o=0;;){if((0|S)!=d[R+(o<<2)>>2]){if((0|(o=o+1|0))<(0|T))continue;break n}break}if((n=d[i+20>>2])&&(u[i+24|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+20>>2]=0),(n=d[i+60>>2])&&(u[i+64|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+60>>2]=0),!(n=d[i+116>>2]))break i;u[i+120|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+116>>2]=0;break i}}if((0|a)==(0|(l=l+1|0)))break}if((0|(f=f+1|0))==(0|n))break}if(bn(d[e+52>>2]+24|0,i+48|0),(n=d[i+20>>2])&&(u[i+24|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+20>>2]=0),(n=d[i+60>>2])&&(u[i+64|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+60>>2]=0),!(n=d[i+116>>2]))break t;u[i+120|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+116>>2]=0;break t}if((0|h)<1)break t}for(f=0;;){if(n=d[(f<<2)+t>>2],d[i+60>>2]=0,d[i+52>>2]=0,d[i+56>>2]=0,a=d[i+140>>2],s[i+64|0]=1,n=a+b(n,36)|0,(0|(a=d[n+4>>2]))>=1){d[7717]=d[7717]+1,p=a<<2,c=0|r[d[6606]](p,16),o=0,l=d[i+60>>2];i:{n:{if((0|(S=d[i+52>>2]))>=1)for(;;)if(d[(T=o<<2)+c>>2]=d[l+T>>2],(0|S)==(0|(o=o+1|0)))break n;if(!l)break i}u[i+64|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l))}for(d[i+60>>2]=c,s[i+64|0]=1,d[i+56>>2]=a,o=0,Mn(c,0,p),d[i+52>>2]=a,l=d[n+12>>2],c=d[i+60>>2];d[(p=o<<2)+c>>2]=d[l+p>>2],(0|a)!=(0|(o=o+1|0)););}else d[i+52>>2]=a;if(a=d[n+24>>2],d[i+68>>2]=d[n+20>>2],d[i+72>>2]=a,a=d[n+32>>2],d[i+76>>2]=d[n+28>>2],d[i+80>>2]=a,bn(d[e+52>>2]+24|0,i+48|0),(n=d[i+60>>2])&&(u[i+64|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+60>>2]=0),(0|(f=f+1|0))==(0|h))break}}if(t&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),!_)break}if(q(d[e+52>>2]),!v)break e;v&&(d[7718]=d[7718]+1,r[d[6607]](v))}else q(d[e+52>>2]);if((0|(l=d[i+132>>2]))>=1)for(n=0;e=d[i+140>>2]+b(n,36)|0,(a=d[(t=e)+12>>2])&&(u[e+16|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[t+12>>2]=0),s[e+16|0]=1,d[t+12>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,(0|l)!=(0|(n=n+1|0)););return(e=d[i+140>>2])&&(u[i+144|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+140>>2]=0),I&&I&&(d[7718]=d[7718]+1,r[d[6607]](I)),(e=d[i+204>>2])&&(u[i+208|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+204>>2]=0),d[i+204>>2]=0,s[i+208|0]=1,d[i+196>>2]=0,d[i+200>>2]=0,(e=d[i+184>>2])&&(u[i+188|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+184>>2]=0),d[i+184>>2]=0,s[i+188|0]=1,d[i+176>>2]=0,d[i+180>>2]=0,(e=d[i+164>>2])&&(u[i+168|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+164>>2]=0),(e=d[i+228>>2])&&(u[i+232|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[i+228>>2]=0),O=i+240|0,1},r[192]=Ed,r[193]=Ed,r[194]=function(e,t,i,n){t|=0,i|=0,n|=0,r[d[d[(e|=0)>>2]+108>>2]](e,t,i),r[d[d[e>>2]+108>>2]](e,(t+1|0)%3|0,n)},r[195]=function(e,t,i){var n;i|=0,n=d[4+(t=(e=((t|=0)<<4)+(e|=0)|0)- -64|0)>>2],d[i+8>>2]=d[t>>2],d[i+12>>2]=n,t=d[e+60>>2],d[i>>2]=d[e+56>>2],d[i+4>>2]=t},r[196]=xd,r[197]=function(e,t,i,n){t|=0,i|=0,n|=0,r[d[d[(e|=0)>>2]+124>>2]](e,n,t,i)},r[198]=function(e,t,i){e|=0,t|=0,i=y(i);var n,s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=0,v=0;O=n=O-32|0,s=m[e+56>>2],a=y(m[e+72>>2]-s),o=m[e+60>>2],l=y(m[e+92>>2]-o),h=y(m[e+76>>2]-o),_=y(m[e+88>>2]-s),u=c=y(y(a*l)-y(h*_)),g=y(c*c),f=h,h=m[e- -64>>2],c=y(m[e+96>>2]-h),p=y(m[e+80>>2]-h),l=y(y(f*c)-y(p*l)),a=y(y(p*_)-y(a*c)),_=y(y(1)/y(x(y(g+y(y(l*l)+y(a*a)))))),c=y(u*_),l=y(l*_),a=y(a*_);e:if(!((s=y(y(y(m[t+8>>2]*c)+y(y(m[t>>2]*l)+y(m[t+4>>2]*a)))-y(y(h*c)+y(y(s*l)+y(o*a)))))>=(h=y(-i))^1|s<=i^1)){for(;;){if(r[d[d[e>>2]+104>>2]](e,b,n+16|0,n),_=m[n+16>>2],s=y(m[n>>2]-_),p=m[n+20>>2],o=y(m[n+4>>2]-p),u=i=y(y(a*s)-y(l*o)),g=y(i*i),i=y(c*o),f=m[n+24>>2],o=y(m[n+8>>2]-f),i=y(i-y(a*o)),s=y(y(l*o)-y(c*s)),o=y(y(1)/y(x(y(g+y(y(i*i)+y(s*s)))))),u=y(u*o),i=y(i*o),s=y(s*o),!(y(y(y(m[t+8>>2]*u)+y(y(m[t>>2]*i)+y(m[t+4>>2]*s)))-y(y(f*u)+y(y(_*i)+y(p*s))))>2],l=m[e+72>>2],c=m[e+76>>2],_=m[e+96>>2],o=m[(t=e- -64|0)>>2],u=m[e+80>>2],h=m[e+92>>2],r=m[e+60>>2],s=m[e+56>>2],d[i+12>>2]=0,l=y(l-s),h=y(h-r),c=y(c-r),s=y(a-s),p=r=y(y(l*h)-y(c*s)),f=y(r*r),r=y(_-o),a=y(u-o),o=y(y(c*r)-y(a*h)),r=y(y(a*s)-y(l*r)),s=y(y(1)/y(x(y(f+y(y(o*o)+y(r*r)))))),m[i+8>>2]=p*s,m[i+4>>2]=r*s,m[i>>2]=o*s,i=d[t+4>>2],d[n+8>>2]=d[t>>2],d[n+12>>2]=i,t=d[e+60>>2],d[n>>2]=d[e+56>>2],d[n+4>>2]=t},r[200]=gd,r[201]=Pd,r[202]=Ai,r[203]=function(e,t){t=y(t)},r[204]=Rd,r[205]=fd,r[206]=gd,r[207]=Pd,r[208]=Pd,r[209]=Ni,r[210]=function(e){var t=0,i=0;return d[(e|=0)>>2]=7016,u[e+8|0]&&(t=d[e+12>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),0|e},r[211]=function(e){var t=0,i=0;d[(e|=0)>>2]=7016,u[e+8|0]&&(t=d[e+12>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),ve(e)},r[212]=function(e,t,i,n,r){t|=0,i|=0,n|=0,r|=0;var s,o=0,a=0,l=0,c=0;O=s=O-160|0,(o=d[12+(e|=0)>>2])&&(a=d[i+4>>2],l=d[t+4>>2],d[r+4>>2]=o,d[s+152>>2]=1566444395,t=d[t+12>>2],o=d[t+12>>2],d[s+32>>2]=d[t+8>>2],d[s+36>>2]=o,o=d[t+4>>2],d[s+24>>2]=d[t>>2],d[s+28>>2]=o,o=d[t+28>>2],d[s+48>>2]=d[t+24>>2],d[s+52>>2]=o,o=d[t+20>>2],d[s+40>>2]=d[t+16>>2],d[s+44>>2]=o,c=d[t+44>>2],d[(o=s- -64|0)>>2]=d[t+40>>2],d[o+4>>2]=c,o=d[t+36>>2],d[s+56>>2]=d[t+32>>2],d[s+60>>2]=o,o=d[t+60>>2],d[s+80>>2]=d[t+56>>2],d[s+84>>2]=o,o=d[t+52>>2],d[s+72>>2]=d[t+48>>2],d[s+76>>2]=o,t=d[i+12>>2],i=d[t+12>>2],d[s+96>>2]=d[t+8>>2],d[s+100>>2]=i,i=d[t+4>>2],d[s+88>>2]=d[t>>2],d[s+92>>2]=i,i=d[t+20>>2],d[s+104>>2]=d[t+16>>2],d[s+108>>2]=i,i=d[t+28>>2],d[s+112>>2]=d[t+24>>2],d[s+116>>2]=i,i=d[t+36>>2],d[s+120>>2]=d[t+32>>2],d[s+124>>2]=i,i=d[t+44>>2],d[s+128>>2]=d[t+40>>2],d[s+132>>2]=i,i=d[t+52>>2],d[s+136>>2]=d[t+48>>2],d[s+140>>2]=i,i=d[t+60>>2],d[s+144>>2]=d[t+56>>2],d[s+148>>2]=i,d[8+(t=s+8|0)>>2]=a,d[t+4>>2]=l,d[t>>2]=6964,Ni(t,s+24|0,r,d[n+20>>2],0),u[e+8|0]&&(e=d[r+4>>2],d[e+748>>2]&&((0|(t=d[e+740>>2]))==(0|(i=d[d[r+8>>2]+8>>2]))?ot(e,t+4|0,d[d[r+12>>2]+8>>2]+4|0):ot(e,d[d[r+12>>2]+8>>2]+4|0,i+4|0)))),O=s+160|0},r[213]=U_,r[214]=gr,r[215]=Pd,r[216]=function(e,t,i){t|=0,i|=0,d[24+(e|=0)>>2]=i,d[e+16>>2]=t},r[217]=function(e,t,i){t|=0,i|=0,d[28+(e|=0)>>2]=i,d[e+20>>2]=t},r[218]=function(e,t,i,n){e|=0,t|=0,i|=0,n=y(n);var o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=0,g=y(0),S=0,T=0,E=y(0),R=0,P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=0,H=0;O=o=O-192|0,m[d[e+4>>2]+752>>2]>2],_=y(y(m[t+8>>2]*n)+E),P=m[i+4>>2],p=y(y(m[t+4>>2]*n)+P),I=m[i>>2],g=y(y(m[t>>2]*n)+I),S=d[e+4>>2],(T=(0|(f=d[S+740>>2]))==(0|(R=d[d[e+8>>2]+8>>2])))?(l=y(g-m[f+52>>2]),c=y(p-m[f+56>>2]),h=y(_-m[f+60>>2]),M=y(y(y(l*m[f+12>>2])+y(c*m[f+28>>2]))+y(h*m[f+44>>2])),D=y(y(y(l*m[f+8>>2])+y(c*m[f+24>>2]))+y(h*m[f+40>>2])),l=y(y(y(l*m[f+4>>2])+y(c*m[f+20>>2]))+y(h*m[f+36>>2])),a=d[d[e+12>>2]+8>>2]):(a=d[d[e+12>>2]+8>>2],l=y(g-m[a+52>>2]),c=y(p-m[a+56>>2]),h=y(_-m[a+60>>2]),M=y(y(y(l*m[a+12>>2])+y(c*m[a+28>>2]))+y(h*m[a+44>>2])),D=y(y(y(l*m[a+8>>2])+y(c*m[a+24>>2]))+y(h*m[a+40>>2])),l=y(y(y(l*m[a+4>>2])+y(c*m[a+20>>2]))+y(h*m[a+36>>2])),a=R),w=m[a+20>>2],F=m[a+36>>2],B=m[a+40>>2],N=m[a+8>>2],L=m[a+24>>2],k=m[a+44>>2],V=m[a+60>>2],c=m[a+12>>2],h=m[a+52>>2],U=m[a+28>>2],G=m[a+56>>2],j=m[a+4>>2],d[o+36>>2]=0,W=c,c=y(I-h),h=y(P-G),E=y(E-V),m[o+32>>2]=y(y(W*c)+y(U*h))+y(k*E),m[o+28>>2]=y(y(c*N)+y(h*L))+y(E*B),d[o+20>>2]=0,m[o+16>>2]=M,m[o+12>>2]=D,m[o+8>>2]=l,m[o+24>>2]=y(y(c*j)+y(h*w))+y(E*F),a=d[t+12>>2],d[o+80>>2]=d[t+8>>2],d[o+84>>2]=a,a=d[t>>2],t=d[t+4>>2],d[o+136>>2]=0,d[o+140>>2]=0,d[o+144>>2]=0,d[o+148>>2]=0,d[o+152>>2]=0,d[o+156>>2]=0,m[o+60>>2]=p,m[o- -64>>2]=_,d[o+68>>2]=0,d[o+72>>2]=a,d[o+76>>2]=t,d[o+128>>2]=0,d[o+132>>2]=0,s[o+124|0]=0,d[o+120>>2]=0,d[o+100>>2]=0,d[o+92>>2]=0,d[o+96>>2]=0,m[o+88>>2]=n,m[o+56>>2]=g,t=d[i+12>>2],d[o+48>>2]=d[i+8>>2],d[o+52>>2]=t,t=d[i+4>>2],d[o+40>>2]=d[i>>2],d[o+44>>2]=t,a=function(e,t){var i,n=y(0),r=y(0),s=0,o=0,a=y(0),l=y(0),c=y(0),h=y(0);if((0|(i=d[e+748>>2]))<1)o=-1;else for(l=m[t+8>>2],c=m[t+4>>2],h=m[t>>2],r=m[e+752>>2],r=y(r*r),t=0,o=-1;s=b(t,184)+e|0,n=y(m[s+4>>2]-h),a=y(n*n),n=y(m[s+8>>2]-c),a=y(a+y(n*n)),n=y(m[s+12>>2]-l),r=(s=(n=y(a+y(n*n)))>2]+8>>2],i=d[d[e+12>>2]+8>>2],m[o+92>>2]=A(y(C(y(m[t+224>>2]*m[i+224>>2]),y(-10))),y(10)),m[o+100>>2]=m[t+228>>2]*m[i+228>>2],m[o+96>>2]=A(y(C(y(m[t+232>>2]*m[i+232>>2]),y(-10))),y(10)),n=m[o+80>>2],y(v(n))>y(.7071067690849304)?(p=m[o+76>>2],l=y(y(n*n)+y(p*p)),_=y(y(1)/y(x(l))),g=y(l*_),h=m[o+72>>2],l=y(_*y(-n)),c=y(h*l),n=y(p*_),_=y(n*y(-h)),p=y(0)):(g=m[o+72>>2],_=m[o+76>>2],p=y(y(g*g)+y(_*_)),l=y(y(1)/y(x(p))),c=y(p*l),p=y(l*y(-_)),_=y(n*p),l=y(g*l),g=y(l*y(-n)),n=y(0)),m[o+184>>2]=c,m[o+180>>2]=_,m[o+168>>2]=n,m[o+164>>2]=l,m[o+176>>2]=g,m[o+160>>2]=p,T?(i=e+24|0,S=e+16|0,T=e+28|0,t=e+20|0):(i=e+28|0,S=e+20|0,T=e+24|0,t=e+16|0),S=d[S>>2],t=d[t>>2],i=d[i>>2],d[o+116>>2]=d[T>>2],d[o+112>>2]=i,d[o+108>>2]=t,d[o+104>>2]=S,t=d[e+4>>2],(0|a)>=0?(t=t+b(a,184)|0,i=d[t+116>>2],S=d[t+124>>2],T=d[t+128>>2],z=d[t+132>>2],H=d[t+152>>2],Mi(t+4|0,o+8|0,184),d[t+152>>2]=H,d[t+132>>2]=z,d[t+124>>2]=S,d[t+128>>2]=T,d[t+116>>2]=i):a=ks(t,o+8|0),!(t=d[6989])|(8&u[d[d[e+12>>2]+8>>2]+204|0]?0:!(8&u[d[d[e+8>>2]+8>>2]+204|0]))||(i=(0|f)!=(0|R),r[t](4+(d[e+4>>2]+b(a,184)|0)|0,d[(i?12:8)+e>>2],d[o+104>>2],d[o+112>>2],d[(i?8:12)+e>>2],d[o+108>>2],d[o+116>>2]))),O=o+192|0},r[219]=Pd,r[220]=Pe,r[221]=Pd,r[222]=fd,r[223]=fd,r[224]=function(e,t,i,n){e|=0,t|=0,i|=0,n=y(n);var r=0;m[e+36>>2]>n&&(s[e+40|0]=1,r=d[t+4>>2],d[e+4>>2]=d[t>>2],d[e+8>>2]=r,r=d[t+12>>2],d[e+12>>2]=d[t+8>>2],d[e+16>>2]=r,t=d[i+4>>2],d[e+20>>2]=d[i>>2],d[e+24>>2]=t,t=d[i+12>>2],d[e+28>>2]=d[i+8>>2],d[e+32>>2]=t,m[e+36>>2]=n)},r[225]=Pd,r[226]=xe,r[227]=Id,r[228]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0);O=s=O-32|0,b=m[t+24>>2],M=m[t+40>>2],v=m[t+36>>2],_=m[t+20>>2],u=m[t+8>>2],A=m[t+16>>2],f=m[t+4>>2],C=m[t+32>>2],g=m[t>>2],d[s+28>>2]=0,a=y(A-g),c=y(v-f),l=y(_-f),p=y(C-g),o=y(y(a*c)-y(l*p)),m[s+24>>2]=o,h=y(b-u),S=y(h*p),p=y(M-u),a=y(S-y(a*p)),m[s+20>>2]=a,c=y(y(l*p)-y(h*c)),m[s+16>>2]=c,T=m[e+4>>2],h=m[e+8>>2],E=m[e+12>>2],l=y(y(u*o)+y(y(g*c)+y(f*a))),p=y(y(y(y(c*T)+y(a*h))+y(o*E))-l),P=m[e+20>>2],R=m[e+24>>2],I=m[e+28>>2],l=y(y(y(y(c*P)+y(a*R))+y(o*I))-l),y(p*l)>=y(0)||1&(t=d[e+36>>2])&&p<=y(0)||(l=y(p/y(p-l)))>2]&&(S=h,h=y(y(1)-l),R=y(y(R*l)+y(S*h)),_=y(_-R),T=y(y(P*l)+y(T*h)),g=y(g-T),f=y(f-R),A=y(A-T),h=y(y(I*l)+y(E*h)),b=y(b-h),u=y(u-h),P=y(y(o*o)+y(y(c*c)+y(a*a))),E=y(P*y(-9999999747378752e-20)),y(y(o*y(y(_*g)-y(f*A)))+y(y(c*y(y(f*b)-y(u*_)))+y(a*y(y(u*A)-y(b*g)))))>=E&&(v=y(v-R),C=y(C-T),I=y(o*y(y(v*A)-y(_*C))),S=_,_=y(M-h),y(I+y(y(c*y(y(S*_)-y(b*v)))+y(a*y(y(b*C)-y(_*A)))))>=E^1|y(y(o*y(y(f*C)-y(v*g)))+y(y(c*y(y(v*u)-y(_*f)))+y(a*y(y(_*g)-y(u*C)))))>=E^1||(S=o,o=y(y(1)/y(x(P))),u=y(S*o),m[s+24>>2]=u,a=y(a*o),m[s+20>>2]=a,o=y(c*o),m[s+16>>2]=o,2&t|p<=y(0)^1?m[e+40>>2]=r[d[d[e>>2]+12>>2]](e,s+16|0,l,i,n):(d[s+12>>2]=0,m[s+8>>2]=-u,m[s+4>>2]=-a,m[s>>2]=-o,m[e+40>>2]=r[d[d[e>>2]+12>>2]](e,s,l,i,n))))),O=s+32|0},r[229]=Id,r[230]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var o,a,l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0);O=o=O-672|0,a=po(o+568|0),d[o+572>>2]=1,d[o+568>>2]=6500,l=d[t+12>>2],d[o+632>>2]=d[t+8>>2],d[o+636>>2]=l,l=d[t+4>>2],d[o+624>>2]=d[t>>2],d[o+628>>2]=l,l=d[t+28>>2],d[o+648>>2]=d[t+24>>2],d[o+652>>2]=l,l=d[t+20>>2],d[o+640>>2]=d[t+16>>2],d[o+644>>2]=l,l=d[t+44>>2],d[o+664>>2]=d[t+40>>2],d[o+668>>2]=l,l=d[t+36>>2],d[o+656>>2]=d[t+32>>2],d[o+660>>2]=l,d[o+612>>2]=d[e+204>>2],s[o+540|0]=0,d[o+516>>2]=953267991,d[o+200>>2]=4440,l=d[e+4>>2],d[20+(t=o+176|0)>>2]=0,d[t+16>>2]=o+568,d[t+12>>2]=l,d[t+8>>2]=o+200,d[t+4>>2]=o+208,d[t>>2]=7260,d[o>>2]=6896,d[o+164>>2]=1065353216,d[o+168>>2]=0,d[o+172>>2]=d[e+208>>2],xe(l=t,e+8|0,e+72|0,t=e+136|0,t,o)&&(h=m[o+132>>2],_=m[o+136>>2],c=m[o+140>>2],(u=y(y(y(h*h)+y(_*_))+y(c*c)))>y(9999999747378752e-20)&&(p=m[o+164>>2])>2]&&(f=c,c=y(y(1)/y(x(u))),m[o+140>>2]=f*c,m[o+136>>2]=_*c,m[o+132>>2]=h*c,y(r[d[d[e>>2]+12>>2]](e,o+132|0,o+148|0,p,i,n)))),Ha(a),O=o+672|0},r[231]=Mr,r[232]=function(e){ve(Mr(e|=0))},r[233]=function(e){e|=0;var t=0,i=0,n=0;if(yr(7699),(0|(t=d[e+8>>2]))>=1)for(;;){n=d[d[e+16>>2]+(i<<2)>>2];e:{t:if(!u[e+76|0])switch(d[n+216>>2]+-2|0){case 0:case 3:break e;default:break t}Ht(e,n),t=d[e+8>>2]}if(!((0|(i=i+1|0))<(0|t)))break}As()},r[234]=function(e){var t;e|=0,yr(7711),t=d[e+68>>2],r[d[d[t>>2]+32>>2]](t,d[e+24>>2]),As()},r[235]=sd,r[236]=function(e){return d[72+(e|=0)>>2]},r[237]=Ue,r[238]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=0,a=y(0),l=y(0),c=0,h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=0,x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=0,F=0,B=y(0),N=y(0),L=0,k=0,V=0,U=0,G=0,j=y(0),W=y(0),z=y(0);O=s=O-144|0,o=0|r[d[d[e>>2]+20>>2]](e),r[d[d[o>>2]+56>>2]](o,t,y(1));e:{t:{i:{n:{r:{s:{o:{a:{l:{c:switch(0|(o=d[i+4>>2])){case 31:break c;case 28:break i;case 13:break n;case 11:break r;case 10:break s;case 9:break o;case 8:break a;case 0:break l;default:break t}if((0|(S=d[i+16>>2]))<1)break e;for(;o=S+-1|0,c=d[i+24>>2]+b(o,80)|0,w=d[c+64>>2],v=m[c+56>>2],A=m[c+48>>2],R=m[c+52>>2],x=m[c+32>>2],P=m[c>>2],I=m[c+16>>2],D=m[c+36>>2],_=m[c+4>>2],C=m[c+20>>2],M=m[c+40>>2],B=m[c+8>>2],N=m[c+24>>2],j=m[t+48>>2],W=m[t+52>>2],z=m[t+56>>2],a=m[t+8>>2],l=m[t>>2],h=m[t+4>>2],u=m[t+24>>2],p=m[t+16>>2],f=m[t+20>>2],T=m[t+40>>2],E=m[t+32>>2],g=m[t+36>>2],d[s+60>>2]=0,d[s+44>>2]=0,d[s+28>>2]=0,d[s+12>>2]=0,m[s+40>>2]=y(y(B*E)+y(N*g))+y(M*T),m[s+36>>2]=y(y(_*E)+y(C*g))+y(D*T),m[s+32>>2]=y(y(P*E)+y(I*g))+y(x*T),m[s+24>>2]=y(y(B*p)+y(N*f))+y(M*u),m[s+20>>2]=y(y(_*p)+y(C*f))+y(D*u),m[s+16>>2]=y(y(P*p)+y(I*f))+y(x*u),m[s+8>>2]=y(y(B*l)+y(N*h))+y(M*a),m[s+4>>2]=y(y(_*l)+y(C*h))+y(D*a),m[s>>2]=y(y(P*l)+y(I*h))+y(x*a),m[s+56>>2]=z+y(y(y(A*E)+y(R*g))+y(v*T)),m[s+52>>2]=W+y(y(y(A*p)+y(R*f))+y(v*u)),m[s+48>>2]=j+y(y(y(A*l)+y(R*h))+y(v*a)),r[d[d[e>>2]+28>>2]](e,s,w,n),c=(0|S)>1,S=o,c;);break e}o=d[i+40>>2],d[s+8>>2]=d[i+36>>2],d[s+12>>2]=o,o=d[i+32>>2],d[s>>2]=d[i+28>>2],d[s+4>>2]=o,a=y(r[d[d[i>>2]+48>>2]](i)),l=y(r[d[d[i>>2]+48>>2]](i)),h=y(y(r[d[d[i>>2]+48>>2]](i))+m[s+8>>2]),m[s+8>>2]=h,a=y(a+m[s>>2]),m[s>>2]=a,l=y(l+m[s+4>>2]),m[s+4>>2]=l,e=0|r[d[d[e>>2]+20>>2]](e),d[s+140>>2]=0,m[s+136>>2]=-h,m[s+132>>2]=-l,m[s+128>>2]=-a,r[d[d[e>>2]+72>>2]](e,s+128|0,s,t,n);break e}a=y(r[d[d[i>>2]+48>>2]](i)),e=0|r[d[d[e>>2]+20>>2]](e),r[d[d[e>>2]+16>>2]](e,a,t,n);break e}if((0|(o=d[i+92>>2]))<1)break e;for(;c=o+-1|0,S=d[i+100>>2]+(c<<4)|0,a=m[S+8>>2],l=m[S>>2],h=m[S+4>>2],S=0|r[d[d[e>>2]+20>>2]](e),x=m[d[i+120>>2]+(c<<2)>>2],P=m[t+48>>2],I=m[t+52>>2],D=m[t+56>>2],u=m[t+8>>2],p=m[t>>2],f=m[t+4>>2],T=m[t+24>>2],E=m[t+16>>2],g=m[t+20>>2],v=m[t+40>>2],A=m[t+32>>2],R=m[t+36>>2],d[s+60>>2]=0,d[s+44>>2]=0,d[s+28>>2]=0,d[s+12>>2]=0,_=y(A*y(0)),C=y(R*y(0)),m[s+40>>2]=v+y(_+C),M=y(_+R),_=y(v*y(0)),m[s+36>>2]=M+_,m[s+32>>2]=y(A+C)+_,_=y(E*y(0)),C=y(g*y(0)),m[s+24>>2]=T+y(_+C),M=y(_+g),_=y(T*y(0)),m[s+20>>2]=M+_,m[s+16>>2]=y(E+C)+_,_=y(p*y(0)),C=y(f*y(0)),m[s+8>>2]=u+y(_+C),M=y(_+f),_=y(u*y(0)),m[s+4>>2]=M+_,m[s>>2]=y(p+C)+_,m[s+56>>2]=D+y(y(y(l*A)+y(h*R))+y(a*v)),m[s+52>>2]=I+y(y(y(l*E)+y(h*g))+y(a*T)),m[s+48>>2]=P+y(y(y(l*p)+y(h*f))+y(a*u)),r[d[d[S>>2]+16>>2]](S,x,s,n),S=(0|o)>1,o=c,S;);break e}o=d[i+52>>2],a=m[(o<<2)+(i=i+28|0)>>2],l=m[i+((o+2|0)%3<<2)>>2],e=0|r[d[d[e>>2]+20>>2]](e),r[d[d[e>>2]+76>>2]](e,l,a,o,t,n);break e}o=d[i+68>>2],a=m[i+56>>2],l=m[i+60>>2],e=0|r[d[d[e>>2]+20>>2]](e),r[d[d[e>>2]+84>>2]](e,a,l,o,t,n);break e}o=d[i+52>>2],a=y(r[d[d[i>>2]+92>>2]](i)),c=d[i+40>>2],d[s+8>>2]=d[i+36>>2],d[s+12>>2]=c,c=d[i+32>>2],d[s>>2]=d[i+28>>2],d[s+4>>2]=c,l=y(r[d[d[i>>2]+48>>2]](i)),h=y(r[d[d[i>>2]+48>>2]](i)),m[s+8>>2]=y(r[d[d[i>>2]+48>>2]](i))+m[s+8>>2],m[s>>2]=l+m[s>>2],m[s+4>>2]=h+m[s+4>>2],l=m[(o<<2)+s>>2],e=0|r[d[d[e>>2]+20>>2]](e),r[d[d[e>>2]+80>>2]](e,a,l,o,t,n);break e}a=m[i- -64>>2],e=0|r[d[d[e>>2]+20>>2]](e),r[d[d[e>>2]+88>>2]](e,i+48|0,a,t,n);break e}t:if(!((0|o)>6))if(w=d[i+52>>2]){if(d[w+28>>2]<1)break t;for(;;){h=y(0);i:if(o=(V=b(k,36))+d[w+36>>2]|0,L=d[o+4>>2]){if(a=y(0),l=y(0),!((0|L)<1))for(F=d[o+12>>2],o=d[(F+(L<<2)|0)-4>>2],S=0;;){if(F=(U=(c=d[(S<<2)+F>>2])<<4)+d[w+16>>2]|0,M=m[F>>2],B=m[F+4>>2],N=m[F+8>>2],F=0|r[d[d[e>>2]+20>>2]](e),G=d[w+16>>2],u=m[8+(o=G+(o<<4)|0)>>2],p=m[o>>2],f=m[o+4>>2],T=m[t+48>>2],E=m[t+8>>2],g=m[t>>2],v=m[t+4>>2],A=m[t+52>>2],R=m[t+24>>2],x=m[t+16>>2],P=m[t+20>>2],I=m[t+56>>2],D=m[t+40>>2],_=m[t+32>>2],C=m[t+36>>2],d[s+12>>2]=0,m[s+8>>2]=I+y(y(y(p*_)+y(f*C))+y(u*D)),m[s+4>>2]=A+y(y(y(p*x)+y(f*P))+y(u*R)),m[s>>2]=T+y(y(y(p*g)+y(f*v))+y(u*E)),u=m[8+(o=U+G|0)>>2],p=m[o>>2],f=m[o+4>>2],d[s+140>>2]=0,m[s+136>>2]=I+y(y(y(_*p)+y(C*f))+y(D*u)),m[s+132>>2]=A+y(y(y(x*p)+y(P*f))+y(R*u)),m[s+128>>2]=T+y(y(y(g*p)+y(v*f))+y(E*u)),r[d[d[F>>2]+8>>2]](F,s,s+128|0,n),l=y(l+N),a=y(a+B),h=y(h+M),S=S+1|0,o=d[w+36>>2]+V|0,(0|S)>=d[o+4>>2])break i;F=d[o+12>>2],o=c}}else a=y(0),l=y(0);if(o=0|r[d[d[e>>2]+20>>2]](e),16384&r[d[d[o>>2]+48>>2]](o)&&(d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=1065353216,d[s+4>>2]=1065353216,o=d[w+36>>2]+V|0,_=m[o+28>>2],C=m[o+20>>2],M=m[o+24>>2],o=0|r[d[d[e>>2]+20>>2]](e),u=m[t+48>>2],p=m[t+8>>2],f=m[t>>2],T=m[t+4>>2],E=m[t+52>>2],g=m[t+24>>2],v=m[t+16>>2],A=m[t+20>>2],R=m[t+56>>2],x=m[t+40>>2],P=m[t+32>>2],I=m[t+36>>2],d[s+140>>2]=0,D=y(y(1)/y(0|L)),h=y(D*h),a=y(D*a),l=y(D*l),m[s+136>>2]=R+y(y(y(P*h)+y(I*a))+y(x*l)),m[s+132>>2]=E+y(y(y(h*v)+y(a*A))+y(l*g)),m[s+128>>2]=u+y(y(y(h*f)+y(a*T))+y(l*p)),d[s+124>>2]=0,h=y(h+C),a=y(a+M),l=y(l+_),m[s+120>>2]=R+y(y(y(P*h)+y(I*a))+y(x*l)),m[s+116>>2]=E+y(y(y(h*v)+y(a*A))+y(l*g)),m[s+112>>2]=u+y(y(y(h*f)+y(a*T))+y(l*p)),r[d[d[o>>2]+8>>2]](o,s+128|0,s+112|0,s)),!((0|(k=k+1|0))>2]))break}}else if(!((0|r[d[d[i>>2]+100>>2]](i))<1))for(o=0;r[d[d[i>>2]+104>>2]](i,o,s,s+128|0),a=m[t+48>>2],l=m[t+8>>2],h=m[t>>2],u=m[t+4>>2],p=m[t+52>>2],f=m[t+24>>2],T=m[t+16>>2],E=m[t+20>>2],g=m[t+56>>2],v=m[t+40>>2],A=m[t+32>>2],R=m[t+36>>2],d[s+124>>2]=0,x=m[s>>2],P=m[s+4>>2],I=m[s+8>>2],m[s+120>>2]=g+y(y(y(A*x)+y(R*P))+y(v*I)),m[s+116>>2]=p+y(y(y(x*T)+y(P*E))+y(I*f)),m[s+112>>2]=a+y(y(y(x*h)+y(P*u))+y(I*l)),d[s+108>>2]=0,_=g,g=m[s+128>>2],x=y(A*g),A=m[s+132>>2],C=v,v=m[s+136>>2],m[s+104>>2]=_+y(y(x+y(R*A))+y(C*v)),m[s+100>>2]=p+y(y(y(T*g)+y(E*A))+y(f*v)),m[s+96>>2]=a+y(y(y(h*g)+y(u*A))+y(l*v)),c=0|r[d[d[e>>2]+20>>2]](e),r[d[d[c>>2]+8>>2]](c,s+112|0,s+96|0,n),(0|(o=o+1|0))<(0|r[d[d[i>>2]+100>>2]](i)););(o=d[i+4>>2])+-21>>>0<=8&&(d[s+136>>2]=1566444395,d[s+140>>2]=0,d[s+128>>2]=1566444395,d[s+132>>2]=1566444395,d[s+120>>2]=-581039253,d[s+124>>2]=0,d[s+112>>2]=-581039253,d[s+116>>2]=-581039253,d[s+8>>2]=r[d[d[e>>2]+20>>2]](e),d[s+4>>2]=9576,d[s>>2]=9552,o=d[n+12>>2],d[s+20>>2]=d[n+8>>2],d[s+24>>2]=o,o=d[n+4>>2],d[s+12>>2]=d[n>>2],d[s+16>>2]=o,o=d[t+12>>2],d[s+36>>2]=d[t+8>>2],d[s+40>>2]=o,o=d[t+4>>2],d[s+28>>2]=d[t>>2],d[s+32>>2]=o,o=d[t+20>>2],d[s+44>>2]=d[t+16>>2],d[s+48>>2]=o,o=d[t+28>>2],d[s+52>>2]=d[t+24>>2],d[s+56>>2]=o,o=d[t+44>>2],d[s+68>>2]=d[t+40>>2],d[s+72>>2]=o,o=d[t+36>>2],d[s+60>>2]=d[t+32>>2],d[s+64>>2]=o,o=d[t+52>>2],d[s+76>>2]=d[t+48>>2],d[s+80>>2]=o,o=d[t+60>>2],d[s+84>>2]=d[t+56>>2],d[s+88>>2]=o,r[d[d[i>>2]+64>>2]](i,s,s+112|0,s+128|0),o=d[i+4>>2]),3==(0|o)&&(d[s+136>>2]=1566444395,d[s+140>>2]=0,d[s+128>>2]=1566444395,d[s+132>>2]=1566444395,d[s+120>>2]=-581039253,d[s+124>>2]=0,d[s+112>>2]=-581039253,d[s+116>>2]=-581039253,d[s+8>>2]=r[d[d[e>>2]+20>>2]](e),d[s+4>>2]=9576,d[s>>2]=9552,e=d[n+12>>2],d[s+20>>2]=d[n+8>>2],d[s+24>>2]=e,e=d[n+4>>2],d[s+12>>2]=d[n>>2],d[s+16>>2]=e,e=d[t+12>>2],d[s+36>>2]=d[t+8>>2],d[s+40>>2]=e,e=d[t+4>>2],d[s+28>>2]=d[t>>2],d[s+32>>2]=e,e=d[t+20>>2],d[s+44>>2]=d[t+16>>2],d[s+48>>2]=e,e=d[t+28>>2],d[s+52>>2]=d[t+24>>2],d[s+56>>2]=e,e=d[t+44>>2],d[s+68>>2]=d[t+40>>2],d[s+72>>2]=e,e=d[t+36>>2],d[s+60>>2]=d[t+32>>2],d[s+64>>2]=e,e=d[t+52>>2],d[s+76>>2]=d[t+48>>2],d[s+80>>2]=e,e=d[t+60>>2],d[s+84>>2]=d[t+56>>2],d[s+88>>2]=e,e=d[i+92>>2],r[d[d[e>>2]+8>>2]](e,4|s,s+112|0,s+128|0))}O=s+144|0},r[239]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0);O=s=O-256|0,d[s+32>>2]=9240,a=d[t+12>>2],d[s+76>>2]=d[t+8>>2],d[s+80>>2]=a,a=d[t+4>>2],d[s+68>>2]=d[t>>2],d[s+72>>2]=a,a=d[i+12>>2],d[s+92>>2]=d[i+8>>2],d[s+96>>2]=a,a=d[i>>2],o=d[i+4>>2],d[s+104>>2]=0,d[s+108>>2]=0,d[s+112>>2]=0,d[s+116>>2]=0,d[s+124>>2]=0,d[s+128>>2]=0,d[s+120>>2]=1065353216,d[s+132>>2]=0,d[s+136>>2]=0,d[s+140>>2]=1065353216,d[s+144>>2]=0,d[s+84>>2]=a,d[s+88>>2]=o,d[s+248>>2]=n,d[s+100>>2]=1065353216,d[s+244>>2]=e,n=d[s+72>>2],d[s+148>>2]=d[s+68>>2],d[s+152>>2]=n,n=d[s+80>>2],d[s+156>>2]=d[s+76>>2],d[s+160>>2]=n,d[s+164>>2]=1065353216,d[s+176>>2]=0,d[s+180>>2]=0,d[s+168>>2]=0,d[s+172>>2]=0,d[s+184>>2]=1065353216,d[s+196>>2]=0,d[s+200>>2]=0,d[s+188>>2]=0,d[s+192>>2]=0,d[s+204>>2]=1065353216,d[s+208>>2]=0,n=d[i+12>>2],d[s+220>>2]=d[i+8>>2],d[s+224>>2]=n,n=d[i+4>>2],d[s+212>>2]=d[i>>2],d[s+216>>2]=n,_=y(m[i>>2]-m[t>>2]),l=y(m[i+4>>2]-m[t+4>>2]),c=y(m[i+8>>2]-m[t+8>>2]),h=y(y(1)/y(x(y(y(y(_*_)+y(l*l))+y(c*c))))),u=(c=y(c*h))==y(0)?y(0xde0b6b000000000):y(y(1)/c),m[s+44>>2]=u,p=(l=y(l*h))==y(0)?y(0xde0b6b000000000):y(y(1)/l),m[s+40>>2]=p,d[s+60>>2]=u>2]=p>2]=_,d[s+52>>2]=_>2]=y(y(h*y(m[s+84>>2]-m[s+68>>2]))+y(l*y(m[s+88>>2]-m[s+72>>2])))+y(c*y(m[s+92>>2]-m[s+76>>2])),e=d[e+68>>2],d[s+24>>2]=0,d[s+28>>2]=0,d[s+16>>2]=0,d[s+20>>2]=0,d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=0,d[s+4>>2]=0,r[d[d[e>>2]+24>>2]](e,t,i,s+32|0,s+16|0,s),O=s+256|0},r[240]=Li,r[241]=Nr,r[242]=function(e){e|=0;var t,i=0,n=0,s=0,o=0,a=0,l=0;yr(7737),r[d[d[e>>2]+8>>2]](e),r[d[d[e>>2]+12>>2]](e),t=d[e+24>>2],yr(7771),t&&(i=d[e+68>>2],s=t,o=0|r[d[d[i>>2]+36>>2]](i),a=e+28|0,l=d[e+24>>2],n=d[d[t>>2]+32>>2],r[n](0|s,0|o,0|a,0|l)),As(),As()},r[243]=function(e,t){e|=0,r[d[d[(t|=0)>>2]+32>>2]](t),Gt(e,t),r[d[d[t>>2]+36>>2]](t)},r[244]=Pd,r[245]=tr,r[246]=Pd,r[247]=tr,r[248]=gd,r[249]=Pd,r[250]=fd,r[251]=function(e,t){e|=0,t|=0;var i,n,r,s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0);O=i=O-128|0,n=d[t+36>>2],t=d[d[e+8>>2]+24>>2]+b(n,80)|0,r=d[t+64>>2],f=m[t+32>>2],g=m[t>>2],v=m[t+16>>2],A=m[t+56>>2],C=m[t+52>>2],S=m[t+48>>2],x=m[t+36>>2],T=m[t+20>>2],E=m[t+4>>2],R=m[t+40>>2],P=m[t+24>>2],I=m[t+8>>2],t=d[e+12>>2],M=m[t+52>>2],D=m[t+56>>2],s=m[t+24>>2],o=m[t+20>>2],a=m[t+40>>2],l=m[t+36>>2],w=m[t+48>>2],c=m[t+8>>2],h=m[t>>2],_=m[t+4>>2],u=m[t+16>>2],p=m[t+32>>2],d[i+124>>2]=0,d[i+108>>2]=0,d[i+92>>2]=0,m[i+104>>2]=y(y(I*p)+y(P*l))+y(R*a),m[i+100>>2]=y(y(E*p)+y(T*l))+y(x*a),m[i+88>>2]=y(y(I*u)+y(P*o))+y(R*s),m[i+84>>2]=y(y(E*u)+y(T*o))+y(x*s),m[i+120>>2]=D+y(y(y(p*S)+y(l*C))+y(a*A)),m[i+116>>2]=M+y(y(y(u*S)+y(o*C))+y(s*A)),d[i+76>>2]=0,m[i+72>>2]=y(y(h*I)+y(_*P))+y(c*R),m[i+68>>2]=y(y(h*E)+y(_*T))+y(c*x),m[i+64>>2]=y(y(g*h)+y(v*_))+y(f*c),m[i+112>>2]=w+y(y(y(h*S)+y(_*C))+y(c*A)),m[i+96>>2]=y(y(g*p)+y(v*l))+y(f*a),m[i+80>>2]=y(y(g*u)+y(v*o))+y(f*s),t=d[e+4>>2],d[i+60>>2]=n,d[i+56>>2]=-1,d[i+48>>2]=t,d[i+44>>2]=r,d[i+40>>2]=0,d[i+52>>2]=i- -64,t=d[e+24>>2],d[i+20>>2]=-65535,d[i+24>>2]=0,d[i+12>>2]=1065353216,d[i+16>>2]=0,d[i+32>>2]=n,d[i+28>>2]=t,d[i+8>>2]=8444,d[i+12>>2]=d[t+4>>2],d[i+24>>2]=d[t+16>>2],G(d[e+16>>2],d[e+20>>2],i+40|0,i+8|0),O=i+128|0},r[252]=function(e,t,i){e|=0,t|=0,i=y(i),r[d[d[e>>2]+12>>2]](e,t)},r[253]=dd,r[254]=dd,r[255]=Pd,r[256]=function(e,t){return t|=0,e=d[20+(e|=0)>>2],0|r[d[d[e>>2]+8>>2]](e,t)},r[257]=function(e,t,i){e|=0,t|=0,i|=0;var n,s,o=y(0);return O=n=O-16|0,d[n+8>>2]=-1,d[n+12>>2]=d[e+24>>2],d[t+4>>2]||(d[t+4>>2]=n+8),s=d[e+20>>2],o=y(r[d[d[s>>2]+12>>2]](s,t,i)),d[e+4>>2]=d[d[e+20>>2]+4>>2],O=n+16|0,y(o)},r[258]=Pd,r[259]=function(e,t,i,n,s,o){var a;return e|=0,t|=0,i|=0,n=y(n),s|=0,o|=0,O=a=O+-64|0,d[a+60>>2]=o,d[a+56>>2]=s,s=d[e+212>>2],m[s+4>>2]>=n&&(d[a+8>>2]=d[e+216>>2],d[a+12>>2]=a+56,e=d[t+12>>2],d[a+24>>2]=d[t+8>>2],d[a+28>>2]=e,e=d[t+4>>2],d[a+16>>2]=d[t>>2],d[a+20>>2]=e,e=d[i+12>>2],d[a+40>>2]=d[i+8>>2],d[a+44>>2]=e,e=d[i+4>>2],d[a+32>>2]=d[i>>2],d[a+36>>2]=e,m[a+48>>2]=n,n=y(r[d[d[s>>2]+12>>2]](s,a+8|0,1))),O=a- -64|0,y(n)},r[260]=Pd,r[261]=function(e,t,i,n,s,o){var a;return e|=0,t|=0,i|=0,n=y(n),s|=0,o|=0,O=a=O+-64|0,d[a+60>>2]=o,d[a+56>>2]=s,s=d[e+212>>2],m[s+4>>2]>=n&&(d[a+8>>2]=d[e+216>>2],d[a+12>>2]=a+56,e=d[t+12>>2],d[a+24>>2]=d[t+8>>2],d[a+28>>2]=e,e=d[t+4>>2],d[a+16>>2]=d[t>>2],d[a+20>>2]=e,e=d[i+12>>2],d[a+40>>2]=d[i+8>>2],d[a+44>>2]=e,e=d[i+4>>2],d[a+32>>2]=d[i>>2],d[a+36>>2]=e,m[a+48>>2]=n,n=y(r[d[d[s>>2]+12>>2]](s,a+8|0,0))),O=a- -64|0,y(n)},r[262]=Pd,r[263]=function(e,t){return t|=0,e=d[12+(e|=0)>>2],0|r[d[d[e>>2]+8>>2]](e,t)},r[264]=function(e,t,i){e|=0,t|=0,i|=0;var n,s,o=y(0);return O=n=O-16|0,d[n+8>>2]=-1,d[n+12>>2]=d[e+16>>2],d[t+4>>2]||(d[t+4>>2]=n+8),s=d[e+12>>2],o=y(r[d[d[s>>2]+12>>2]](s,t,i)),d[e+4>>2]=d[d[e+12>>2]+4>>2],O=n+16|0,y(o)},r[265]=gd,r[266]=Pd,r[267]=function(e,t){t|=0;var i,n=0,s=0,o=0;return O=i=O-32|0,n=d[216+(e|=0)>>2],m[n+4>>2]!=y(0)&&(s=1,t=d[t>>2],r[d[d[n>>2]+8>>2]](n,d[t+188>>2])&&(n=d[e+216>>2],o=d[t+192>>2],d[i+24>>2]=-1,d[i+28>>2]=-1,d[i+20>>2]=t+4,d[i+16>>2]=t,d[i+12>>2]=o,d[i+8>>2]=0,G(e+68|0,e+132|0,i+8|0,n))),O=i+32|0,0|s},r[268]=Pd,r[269]=function(e,t){e|=0,t|=0;var i,n=0,s=0,o=y(0),a=0,l=0;return O=i=O-32|0,n=d[e+184>>2],m[n+4>>2]!=y(0)&&(s=1,t=d[t>>2],r[d[d[n>>2]+8>>2]](n,d[t+188>>2])&&(o=m[e+188>>2],n=d[e+184>>2],a=d[e+192>>2],l=d[t+192>>2],d[i+24>>2]=-1,d[i+28>>2]=-1,d[i+20>>2]=t+4,d[i+16>>2]=t,d[i+12>>2]=l,d[i+8>>2]=0,j(a,e+36|0,e+100|0,i+8|0,n,o))),O=i+32|0,0|s},r[270]=Pd,r[271]=function(e,t){e|=0;var i,n=0,s=0;return O=i=O-96|0,(0|(t=d[(t|=0)>>2]))!=d[e+4>>2]&&(n=d[e+12>>2],r[d[d[n>>2]+8>>2]](n,d[t+188>>2])&&(n=d[e+4>>2],s=d[n+192>>2],d[i+88>>2]=-1,d[i+92>>2]=-1,d[i+84>>2]=n+4,d[i+80>>2]=n,d[i+76>>2]=s,d[i+72>>2]=0,n=d[t+192>>2],d[i+64>>2]=-1,d[i+68>>2]=-1,d[i+60>>2]=t+4,d[i+56>>2]=t,d[i+52>>2]=n,d[i+48>>2]=0,t=d[d[e+8>>2]+24>>2],(t=0|r[d[d[t>>2]+8>>2]](t,i+72|0,i+48|0,0))&&(s=d[e+12>>2],d[12+(n=i+8|0)>>2]=i+48,d[n+8>>2]=i+72,d[n+4>>2]=0,d[n>>2]=7088,d[i+40>>2]=s,d[i+8>>2]=9484,r[d[d[t>>2]+8>>2]](t,i+72|0,i+48|0,d[e+8>>2]+28|0,n),r[d[d[t>>2]>>2]](t),e=d[d[e+8>>2]+24>>2],r[d[d[e>>2]+60>>2]](e,t)))),O=i+96|0,1},r[272]=Pd,r[273]=function(e,t,i,n){e|=0,t|=0,i|=0,n=y(n);var o,a,l,c=0,h=y(0),_=y(0),u=y(0),p=0,f=y(0),g=0,b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0);O=o=O-192|0,f=m[i+8>>2],b=y(y(m[t+8>>2]*n)+f),C=m[i+4>>2],v=y(y(m[t+4>>2]*n)+C),S=m[i>>2],A=y(y(m[t>>2]*n)+S),(p=(0|(a=d[d[e+4>>2]+740>>2]))==(0|(g=d[d[e+8>>2]+8>>2])))?(u=y(A-m[a+52>>2]),h=y(v-m[a+56>>2]),_=y(b-m[a+60>>2]),x=y(y(y(u*m[a+12>>2])+y(h*m[a+28>>2]))+y(_*m[a+44>>2])),T=y(y(y(u*m[a+8>>2])+y(h*m[a+24>>2]))+y(_*m[a+40>>2])),u=y(y(y(u*m[a+4>>2])+y(h*m[a+20>>2]))+y(_*m[a+36>>2])),c=d[d[e+12>>2]+8>>2]):(c=d[d[e+12>>2]+8>>2],u=y(A-m[c+52>>2]),h=y(v-m[c+56>>2]),_=y(b-m[c+60>>2]),x=y(y(y(u*m[c+12>>2])+y(h*m[c+28>>2]))+y(_*m[c+44>>2])),T=y(y(y(u*m[c+8>>2])+y(h*m[c+24>>2]))+y(_*m[c+40>>2])),u=y(y(y(u*m[c+4>>2])+y(h*m[c+20>>2]))+y(_*m[c+36>>2])),c=g),E=m[c+20>>2],R=m[c+36>>2],P=m[c+40>>2],I=m[c+8>>2],M=m[c+24>>2],D=m[c+44>>2],w=m[c+60>>2],h=m[c+12>>2],_=m[c+52>>2],F=m[c+28>>2],B=m[c+56>>2],N=m[c+4>>2],d[o+36>>2]=0,L=h,h=y(S-_),_=y(C-B),f=y(f-w),m[o+32>>2]=y(y(L*h)+y(F*_))+y(D*f),m[o+28>>2]=y(y(h*I)+y(_*M))+y(f*P),d[o+20>>2]=0,m[o+16>>2]=x,m[o+12>>2]=T,m[o+8>>2]=u,m[o+24>>2]=y(y(h*N)+y(_*E))+y(f*R),c=d[t+12>>2],d[o+80>>2]=d[t+8>>2],d[o+84>>2]=c,c=d[t>>2],t=d[t+4>>2],d[o+136>>2]=0,d[o+140>>2]=0,d[o+144>>2]=0,d[o+148>>2]=0,d[o+152>>2]=0,d[o+156>>2]=0,m[o+60>>2]=v,m[o- -64>>2]=b,d[o+68>>2]=0,d[o+72>>2]=c,d[o+76>>2]=t,d[o+128>>2]=0,d[o+132>>2]=0,s[o+124|0]=0,d[o+120>>2]=0,d[o+100>>2]=0,d[o+92>>2]=0,d[o+96>>2]=0,m[o+88>>2]=n,m[o+56>>2]=A,t=d[i+12>>2],d[o+48>>2]=d[i+8>>2],d[o+52>>2]=t,t=d[i+4>>2],d[o+40>>2]=d[i>>2],d[o+44>>2]=t,p?(i=e+20|0,c=e+16|0,p=e+24|0,t=e+28|0):(i=e+16|0,c=e+20|0,p=e+28|0,t=e+24|0),c=d[c>>2],i=d[i>>2],p=d[p>>2],t=d[t>>2],d[o+116>>2]=t,d[o+112>>2]=p,d[o+108>>2]=i,d[o+104>>2]=c,l=d[e+32>>2],g=(0|a)!=(0|g),y(r[d[d[l>>2]+12>>2]](l,o+8|0,d[(g?12:8)+e>>2],c,p,d[(g?8:12)+e>>2],i,t)),O=o+192|0},r[274]=gd,r[275]=Pd,r[276]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0);O=i=O-96|0,s=m[e+76>>2],o=m[e+36>>2],h=m[e+32>>2],_=m[e+80>>2],f=m[e+52>>2],g=m[e+44>>2],b=m[e+48>>2],u=m[e+84>>2],p=m[e+68>>2],T=m[e+60>>2],E=m[e- -64>>2],R=m[e+28>>2],a=m[t+8>>2],l=m[t>>2],c=m[t+4>>2],d[i+92>>2]=0,A=y(u+y(y(y(l*T)+y(c*E))+y(a*p))),m[i+88>>2]=A,C=y(_+y(y(y(l*g)+y(c*b))+y(a*f))),m[i+84>>2]=C,S=y(s+y(y(y(l*R)+y(c*h))+y(a*o))),m[i+80>>2]=S,a=m[t+20>>2],l=m[t+24>>2],c=m[t+16>>2],d[i+76>>2]=0,P=y(u+y(y(y(T*c)+y(E*a))+y(p*l))),m[i+72>>2]=P,I=y(_+y(y(y(g*c)+y(b*a))+y(f*l))),m[i+68>>2]=I,v=y(s+y(y(y(R*c)+y(h*a))+y(o*l))),m[i+64>>2]=v,a=m[t+36>>2],l=m[t+40>>2],c=m[t+32>>2],d[i+60>>2]=0,u=y(u+y(y(y(T*c)+y(E*a))+y(p*l))),m[i+56>>2]=u,_=y(_+y(y(y(g*c)+y(b*a))+y(f*l))),m[i+52>>2]=_,s=y(s+y(y(y(R*c)+y(h*a))+y(o*l))),m[i+48>>2]=s,d[i+44>>2]=0,f=y(y(y(A+P)+u)*y(.3333333432674408)),m[i+40>>2]=f,g=y(y(y(C+I)+_)*y(.3333333432674408)),m[i+36>>2]=g,b=y(y(y(S+v)+s)*y(.3333333432674408)),m[i+32>>2]=b,t=d[e+8>>2],16384&r[d[d[t>>2]+48>>2]](t)&&(o=m[i+80>>2],d[i+24>>2]=0,d[i+28>>2]=0,d[i+16>>2]=1065353216,d[i+20>>2]=1065353216,t=d[e+8>>2],d[i+12>>2]=0,h=y(v-o),_=y(_-C),p=y(I-C),o=y(s-o),S=s=y(y(h*_)-y(p*o)),v=y(s*s),u=y(u-A),s=y(p*u),p=y(P-A),s=y(s-y(p*_)),o=y(y(p*o)-y(h*u)),h=y(y(1)/y(x(y(v+y(y(s*s)+y(o*o)))))),m[i+8>>2]=y(S*h)+f,m[i+4>>2]=g+y(o*h),m[i>>2]=b+y(s*h),r[d[d[t>>2]+8>>2]](t,i+32|0,i,i+16|0)),n=d[e+8>>2],t=e+12|0,r[d[d[n>>2]+8>>2]](n,i+80|0,i- -64|0,t),n=d[e+8>>2],r[d[d[n>>2]+8>>2]](n,i- -64|0,i+48|0,t),e=d[e+8>>2],r[d[d[e>>2]+8>>2]](e,i+48|0,i+80|0,t),O=i+96|0},r[277]=function(e,t,i,n){t|=0,i|=0,n|=0,r[d[d[(e|=0)>>2]+8>>2]](e,t,i,n)},r[278]=function(e){return(e|=0)-4|0},r[279]=function(e){ve((e|=0)-4|0)},r[280]=function(e,t,i,n){t|=0,i|=0,n|=0,r[d[d[(e=(e|=0)-4|0)>>2]+8>>2]](e,t,i,n)},r[281]=Pd,r[282]=He,r[283]=function(e){var t=0,i=0;return d[(e|=0)>>2]=9708,u[e+8|0]&&(t=d[e+12>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),0|e},r[284]=function(e){var t=0,i=0;d[(e|=0)>>2]=9708,u[e+8|0]&&(t=d[e+12>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),ve(e)},r[285]=function(e,t,i,n,r){t|=0,i|=0,n|=0,r|=0;var s,o=0,a=0,l=0,c=0;O=s=O-160|0,(o=d[12+(e|=0)>>2])&&(a=u[e+16|0],c=d[(l=a?t:i)+4>>2],a=d[(t=a?i:t)+4>>2],d[r+4>>2]=o,m[12+(i=s+144|0)>>2]=m[o+752>>2],d[i+8>>2]=c,d[i+4>>2]=a,d[i>>2]=9648,d[s+136>>2]=1566444395,t=d[t+12>>2],o=d[t+12>>2],d[s+16>>2]=d[t+8>>2],d[s+20>>2]=o,o=d[t+4>>2],d[s+8>>2]=d[t>>2],d[s+12>>2]=o,o=d[t+28>>2],d[s+32>>2]=d[t+24>>2],d[s+36>>2]=o,o=d[t+20>>2],d[s+24>>2]=d[t+16>>2],d[s+28>>2]=o,o=d[t+44>>2],d[s+48>>2]=d[t+40>>2],d[s+52>>2]=o,o=d[t+36>>2],d[s+40>>2]=d[t+32>>2],d[s+44>>2]=o,a=d[t+60>>2],d[(o=s- -64|0)>>2]=d[t+56>>2],d[o+4>>2]=a,o=d[t+52>>2],d[s+56>>2]=d[t+48>>2],d[s+60>>2]=o,t=d[l+12>>2],o=d[t+12>>2],d[s+80>>2]=d[t+8>>2],d[s+84>>2]=o,o=d[t+4>>2],d[s+72>>2]=d[t>>2],d[s+76>>2]=o,o=d[t+20>>2],d[s+88>>2]=d[t+16>>2],d[s+92>>2]=o,o=d[t+28>>2],d[s+96>>2]=d[t+24>>2],d[s+100>>2]=o,o=d[t+36>>2],d[s+104>>2]=d[t+32>>2],d[s+108>>2]=o,o=d[t+44>>2],d[s+112>>2]=d[t+40>>2],d[s+116>>2]=o,o=d[t+52>>2],d[s+120>>2]=d[t+48>>2],d[s+124>>2]=o,o=d[t+60>>2],d[s+128>>2]=d[t+56>>2],d[s+132>>2]=o,He(i,s+8|0,r,d[n+20>>2],u[e+16|0]),u[e+8|0]&&(e=d[r+4>>2],d[e+748>>2]&&((0|(t=d[e+740>>2]))==(0|(i=d[d[r+8>>2]+8>>2]))?ot(e,t+4|0,d[d[r+12>>2]+8>>2]+4|0):ot(e,d[d[r+12>>2]+8>>2]+4|0,i+4|0)))),O=s+160|0},r[286]=U_,r[287]=gr,r[288]=gd,r[289]=Pd,r[290]=function(e,t,i,n){var o,a,l;return e|=0,i|=0,n|=0,i=d[(t|=0)>>2],i=0|r[d[d[i>>2]+56>>2]](i,36),n=d[e+12>>2],o=d[e+8>>2],a=d[t+4>>2],l=d[e+20>>2],e=d[e+16>>2],d[i>>2]=17764,d[i+4>>2]=d[t>>2],d[i>>2]=5076,d[i+28>>2]=e,d[i+32>>2]=l,s[i+24|0]=0,d[i+20>>2]=a,s[i+16|0]=0,d[i+12>>2]=o,d[i+8>>2]=n,d[i>>2]=9808,0|i},r[291]=function(e){var t=0,i=0;return d[(e|=0)>>2]=9808,u[e+16|0]&&(t=d[e+20>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),0|e},r[292]=function(e){var t=0,i=0;d[(e|=0)>>2]=9808,u[e+16|0]&&(t=d[e+20>>2])&&(i=d[e+4>>2],r[d[d[i>>2]+16>>2]](i,t)),ve(e)},r[293]=function(e,t,i,n,o){e|=0,t|=0,i|=0,n|=0,o|=0;var a,l=0,c=0,h=y(0),_=y(0),p=y(0),f=y(0),g=0,b=0,C=y(0),S=y(0),T=0,E=y(0),R=y(0),P=0,I=y(0),M=y(0),D=0,w=y(0),F=y(0),B=y(0),N=y(0),L=0,k=0,V=y(0),U=y(0),G=y(0),j=y(0),z=y(0),H=0,X=y(0),Y=y(0),Q=y(0),q=0,K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=0,ie=y(0),ne=y(0),re=y(0),se=y(0),oe=y(0);O=a=O-544|0,(c=d[e+20>>2])||(l=d[e+4>>2],c=0|r[d[d[l>>2]+12>>2]](l,d[t+8>>2],d[i+8>>2]),s[e+16|0]=1,d[e+20>>2]=c),d[o+4>>2]=c,g=d[t+4>>2],b=d[i+4>>2];e:if(10!=d[g+4>>2]|10!=d[b+4>>2]){if(d[a+536>>2]=1566444395,H=us(a+328|0,g,b,d[e+8>>2],d[e+12>>2]),d[H+32>>2]=b,d[H+28>>2]=g,h=y(y(y(r[d[d[g>>2]+48>>2]](g))+y(r[d[d[b>>2]+48>>2]](b)))+m[d[e+20>>2]+752>>2]),m[a+536>>2]=h*h,l=d[t+12>>2],c=d[l+12>>2],d[a+416>>2]=d[l+8>>2],d[a+420>>2]=c,c=d[l+4>>2],d[a+408>>2]=d[l>>2],d[a+412>>2]=c,c=d[l+28>>2],d[a+432>>2]=d[l+24>>2],d[a+436>>2]=c,c=d[l+20>>2],d[a+424>>2]=d[l+16>>2],d[a+428>>2]=c,c=d[l+44>>2],d[a+448>>2]=d[l+40>>2],d[a+452>>2]=c,c=d[l+36>>2],d[a+440>>2]=d[l+32>>2],d[a+444>>2]=c,c=d[l+60>>2],d[a+464>>2]=d[l+56>>2],d[a+468>>2]=c,c=d[l+52>>2],d[a+456>>2]=d[l+48>>2],d[a+460>>2]=c,l=d[i+12>>2],c=d[l+12>>2],d[a+480>>2]=d[l+8>>2],d[a+484>>2]=c,c=d[l+4>>2],d[a+472>>2]=d[l>>2],d[a+476>>2]=c,T=d[l+20>>2],d[(c=P=a+488|0)>>2]=d[l+16>>2],d[c+4>>2]=T,c=d[l+28>>2],d[a+496>>2]=d[l+24>>2],d[a+500>>2]=c,D=d[l+36>>2],d[(c=T=a+504|0)>>2]=d[l+32>>2],d[c+4>>2]=D,c=d[l+44>>2],d[a+512>>2]=d[l+40>>2],d[a+516>>2]=c,k=d[l+52>>2],d[(c=D=a+520|0)>>2]=d[l+48>>2],d[c+4>>2]=k,c=d[l+60>>2],d[a+528>>2]=d[l+56>>2],d[a+532>>2]=c,!((0|(c=d[g+4>>2]))>6)&&!((0|(l=d[b+4>>2]))>6)&&(d[a+320>>2]=9928,h=y(0),c&&(h=y(r[d[d[g>>2]+48>>2]](g)),l=d[b+4>>2]),l&&(_=y(r[d[d[b>>2]+48>>2]](b))),s[a+36|0]=0,m[a+28>>2]=_,m[a+24>>2]=h,d[a+4>>2]=o,d[a>>2]=10104,d[g+52>>2])){if(d[b+52>>2]){_=m[d[e+20>>2]+752>>2];t:{i:{if(u[n+24|0]){if(h=y(-1.0000000150474662e30),W(d[g+52>>2],d[b+52>>2],d[t+12>>2],d[i+12>>2],a+240|0,o))break i;break t}if(j_(H,a+408|0,a,d[n+20>>2]),n=d[a+20>>2],d[a+248>>2]=d[a+16>>2],d[a+252>>2]=n,n=d[a+12>>2],d[a+240>>2]=d[a+8>>2],d[a+244>>2]=n,h=m[a+32>>2],!u[a+36|0]|h>2],d[b+52>>2],d[t+12>>2],d[i+12>>2],y(h-_),_,o)}if(!u[e+16|0])break e;if(e=d[o+4>>2],!d[e+748>>2])break e;if((0|(t=d[e+740>>2]))!=(0|(i=d[d[o+8>>2]+8>>2]))){ot(e,d[d[o+12>>2]+8>>2]+4|0,i+4|0);break e}ot(e,t+4|0,d[d[o+12>>2]+8>>2]+4|0);break e}if(1==d[b+4>>2]){if(d[a+244>>2]=0,l=d[i+12>>2],f=m[l+52>>2],C=m[l+20>>2],R=m[l+24>>2],I=m[l+56>>2],w=m[l+36>>2],M=m[l+40>>2],h=m[b- -64>>2],_=m[b+56>>2],p=m[b+60>>2],z=m[l+16>>2],N=m[l+32>>2],E=m[l+48>>2],S=m[l+8>>2],B=m[l>>2],j=m[l+4>>2],d[7717]=d[7717]+1,l=0|r[d[6606]](16,16),d[a+252>>2]=l,s[a+256|0]=1,d[a+248>>2]=1,d[l+12>>2]=0,m[l>>2]=E+y(y(y(_*B)+y(p*j))+y(h*S)),m[l+8>>2]=I+y(y(y(_*N)+y(p*w))+y(h*M)),m[l+4>>2]=f+y(y(y(_*z)+y(p*C))+y(h*R)),l=d[a+244>>2]+1|0,d[a+244>>2]=l,h=m[b+72>>2],c=d[i+12>>2],_=m[b+76>>2],p=m[b+80>>2],f=y(y(y(y(h*m[c+32>>2])+y(_*m[c+36>>2]))+y(p*m[c+40>>2]))+m[c+56>>2]),C=y(y(y(y(h*m[c+16>>2])+y(_*m[c+20>>2]))+y(p*m[c+24>>2]))+m[c+52>>2]),h=y(y(y(y(h*m[c>>2])+y(_*m[c+4>>2]))+y(p*m[c+8>>2]))+m[c+48>>2]),d[a+248>>2]==(0|l)&&!((0|l)>=(0|(P=l?l<<1:1)))){if(c=0,P&&(d[7717]=d[7717]+1,L=0|r[d[6606]](P<<4,16),l=d[a+244>>2]),(0|l)>=1)for(;D=(T=c<<4)+L|0,T=T+d[a+252>>2]|0,q=d[T+4>>2],d[D>>2]=d[T>>2],d[D+4>>2]=q,k=d[T+12>>2],d[D+8>>2]=d[T+8>>2],d[D+12>>2]=k,(0|(c=c+1|0))!=(0|l););(l=d[a+252>>2])&&(u[a+256|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[a+252>>2]=0),d[a+252>>2]=L,s[a+256|0]=1,d[a+248>>2]=P,l=d[a+244>>2]}if(l=d[a+252>>2]+(l<<4)|0,d[l+12>>2]=0,m[l+8>>2]=f,m[l+4>>2]=C,m[l>>2]=h,l=d[a+244>>2]+1|0,d[a+244>>2]=l,h=m[b+88>>2],i=d[i+12>>2],_=m[b+92>>2],p=m[b+96>>2],f=y(y(y(y(h*m[i>>2])+y(_*m[i+4>>2]))+y(p*m[i+8>>2]))+m[i+48>>2]),C=y(y(y(y(h*m[i+32>>2])+y(_*m[i+36>>2]))+y(p*m[i+40>>2]))+m[i+56>>2]),h=y(y(y(y(h*m[i+16>>2])+y(_*m[i+20>>2]))+y(p*m[i+24>>2]))+m[i+52>>2]),d[a+248>>2]==(0|l)&&!((0|l)>=(0|(i=l?l<<1:1)))){if(c=0,L=0,i&&(d[7717]=d[7717]+1,L=0|r[d[6606]](i<<4,16),l=d[a+244>>2]),(0|l)>=1)for(;T=(P=c<<4)+L|0,P=P+d[a+252>>2]|0,k=d[P+4>>2],d[T>>2]=d[P>>2],d[T+4>>2]=k,D=d[P+12>>2],d[T+8>>2]=d[P+8>>2],d[T+12>>2]=D,(0|(c=c+1|0))!=(0|l););(l=d[a+252>>2])&&(u[a+256|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[a+252>>2]=0),d[a+252>>2]=L,s[a+256|0]=1,d[a+248>>2]=i,l=d[a+244>>2]}if(i=d[a+252>>2]+(l<<4)|0,d[i+12>>2]=0,m[i+8>>2]=C,m[i+4>>2]=h,m[i>>2]=f,d[a+244>>2]=d[a+244>>2]+1,h=m[d[e+20>>2]+752>>2],j_(H,a+408|0,a+320|0,d[n+20>>2]),_=m[H+4>>2],p=m[H+8>>2],f=m[H+12>>2],(C=y(y(y(_*_)+y(p*p))+y(f*f)))>y(1.1920928955078125e-7)&&(d[a+316>>2]=0,S=f,f=y(y(1)/C),m[a+312>>2]=S*f,m[a+308>>2]=p*f,m[a+304>>2]=_*f,_=m[H+56>>2],p=y(r[d[d[g>>2]+48>>2]](g)),f=y(r[d[d[b>>2]+48>>2]](b)),ge(a+304|0,d[g+52>>2],d[t+12>>2],a+240|0,y(y(y(_-p)-f)-h),h,o)),u[e+16|0]&&(e=d[o+4>>2],d[e+748>>2]&&((0|(t=d[e+740>>2]))==(0|(i=d[d[o+8>>2]+8>>2]))?ot(e,t+4|0,d[d[o+12>>2]+8>>2]+4|0):ot(e,d[d[o+12>>2]+8>>2]+4|0,i+4|0))),!(e=d[a+252>>2]))break e;u[a+256|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[a+252>>2]=0;break e}}if(j_(H,a+408|0,o,d[n+20>>2]),!(!d[e+28>>2]|d[d[o+4>>2]+748>>2]>=d[e+32>>2])&&(h=m[H+4>>2],_=m[H+8>>2],f=m[H+12>>2],(C=y(y(y(h*h)+y(_*_))+y(f*f)))>y(1.1920928955078125e-7)&&(L=a+472|0,k=a+456|0,q=a+440|0,te=a+424|0,S=_,_=y(y(1)/C),C=y(S*_),z=y(h*_),N=y(f*_),y(v(N))>y(.7071067690849304)?(h=y(y(1)/y(x(y(y(N*N)+y(C*C))))),_=y(C*h),h=y(h*y(-N))):(_=y(y(1)/y(x(y(y(z*z)+y(C*C))))),h=y(z*_),p=y(_*y(-C)),_=y(0)),f=y(r[d[d[g>>2]+16>>2]](g)),R=y(r[d[d[b>>2]+16>>2]](b)),I=m[6601],g=d[(l=(b=f>2],d[a+248>>2]=d[l+8>>2],d[a+252>>2]=g,g=d[l+4>>2],d[a+240>>2]=d[l>>2],d[a+244>>2]=g,g=d[(l=b?te:P)+12>>2],d[a+264>>2]=d[l+8>>2],d[a+268>>2]=g,g=d[l+4>>2],d[a+256>>2]=d[l>>2],d[a+260>>2]=g,g=d[(l=b?q:T)+12>>2],d[a+280>>2]=d[l+8>>2],d[a+284>>2]=g,g=d[l+4>>2],d[a+272>>2]=d[l>>2],d[a+276>>2]=g,g=d[(l=b?k:D)+12>>2],d[a+296>>2]=d[l+8>>2],d[a+300>>2]=g,g=d[l+4>>2],d[a+288>>2]=d[l>>2],d[a+292>>2]=g,!((0|(c=d[e+28>>2]))<1))))for(S=_,f=y(y(A(y(I/(b?f:R)),y(.39269909262657166)))*y(.5)),se=y(y(y(p*p)+y(h*h))+y(_*_)),_=y(An(f)/y(x(se))),R=y(S*_),I=y(h*_),w=y(p*_),oe=y(x(y(y(N*N)+y(y(z*z)+y(C*C))))),M=yn(f),g=0;se>y(1.1920928955078125e-7)&&(f=y(y(y(y(6.2831854820251465)/y(0|c))*y(0|g))*y(.5)),p=y(An(f)/oe),h=y(N*p),_=y(C*p),p=y(z*p),f=yn(f),b?(l=d[t+12>>2],B=m[l+36>>2],j=m[l+20>>2],X=m[l+40>>2],Y=m[l+24>>2],Q=m[l+32>>2],Z=m[l>>2],$=m[l+16>>2],J=m[l+4>>2],ee=m[l+8>>2],d[a+452>>2]=0,d[a+436>>2]=0,d[a+420>>2]=0,F=y(y(R*p)+y(y(y(I*f)-y(M*_))-y(w*h))),V=y(y(R*h)+y(y(I*_)+y(y(M*f)+y(w*p)))),U=y(y(I*h)+y(y(y(w*f)-y(M*p))-y(R*_))),G=y(y(w*_)+y(y(y(R*f)-y(M*h))-y(I*p))),E=y(y(y(h*F)+y(y(p*V)+y(f*U)))-y(_*G)),S=y(y(y(y(f*V)-y(p*U))-y(_*F))-y(h*G)),ie=y(y(y(_*U)+y(y(h*V)+y(f*G)))-y(p*F)),h=y(y(y(p*G)+y(y(f*F)+y(_*V)))-y(h*U)),_=y(y(2)/y(y(S*S)+y(y(ie*ie)+y(y(E*E)+y(h*h))))),p=y(ie*_),V=y(E*p),f=y(h*_),U=y(S*f),F=y(V-U),G=y(h*p),K=y(E*_),ne=y(S*K),_=y(G+ne),K=y(E*K),re=y(h*f),h=y(y(1)-y(K+re)),m[a+448>>2]=y(y(ee*F)+y(Y*_))+y(X*h),m[a+444>>2]=y(y(F*J)+y(_*j))+y(h*B),m[a+440>>2]=y(y(F*Z)+y(_*$))+y(h*Q),f=y(E*f),E=y(S*p),h=y(f+E),S=y(ie*p),_=y(y(1)-y(K+S)),p=y(G-ne),m[a+432>>2]=y(y(ee*h)+y(Y*_))+y(X*p),m[a+428>>2]=y(y(h*J)+y(_*j))+y(p*B),m[a+424>>2]=y(y(h*Z)+y(_*$))+y(p*Q),h=y(y(1)-y(re+S)),_=y(f-E),p=y(V+U),m[a+416>>2]=y(y(ee*h)+y(Y*_))+y(X*p),m[a+412>>2]=y(y(h*J)+y(_*j))+y(p*B),m[a+408>>2]=y(y(h*Z)+y(_*$))+y(p*Q),l=d[i+12>>2],c=d[l+4>>2],d[L>>2]=d[l>>2],d[L+4>>2]=c,c=d[l+12>>2],d[L+8>>2]=d[l+8>>2],d[L+12>>2]=c,c=d[l+28>>2],d[P+8>>2]=d[l+24>>2],d[P+12>>2]=c,c=d[l+20>>2],d[P>>2]=d[l+16>>2],d[P+4>>2]=c,c=d[l+44>>2],d[T+8>>2]=d[l+40>>2],d[T+12>>2]=c,c=d[l+36>>2],d[T>>2]=d[l+32>>2],d[T+4>>2]=c,c=d[l+60>>2],d[D+8>>2]=d[l+56>>2],d[D+12>>2]=c,c=d[l+52>>2],d[D>>2]=d[l+48>>2],d[D+4>>2]=c):(l=d[t+12>>2],c=d[l+12>>2],d[a+416>>2]=d[l+8>>2],d[a+420>>2]=c,c=d[l+4>>2],d[a+408>>2]=d[l>>2],d[a+412>>2]=c,c=d[l+28>>2],d[te+8>>2]=d[l+24>>2],d[te+12>>2]=c,c=d[l+20>>2],d[te>>2]=d[l+16>>2],d[te+4>>2]=c,c=d[l+44>>2],d[q+8>>2]=d[l+40>>2],d[q+12>>2]=c,c=d[l+36>>2],d[q>>2]=d[l+32>>2],d[q+4>>2]=c,c=d[l+60>>2],d[k+8>>2]=d[l+56>>2],d[k+12>>2]=c,c=d[l+52>>2],d[k>>2]=d[l+48>>2],d[k+4>>2]=c,l=d[i+12>>2],B=m[l+36>>2],j=m[l+20>>2],X=m[l+40>>2],Y=m[l+24>>2],Q=m[l+32>>2],Z=m[l>>2],$=m[l+16>>2],J=m[l+4>>2],ee=m[l+8>>2],d[a+516>>2]=0,d[a+500>>2]=0,d[a+484>>2]=0,F=y(y(R*p)+y(y(y(I*f)-y(M*_))-y(w*h))),V=y(y(R*h)+y(y(I*_)+y(y(M*f)+y(w*p)))),U=y(y(I*h)+y(y(y(w*f)-y(M*p))-y(R*_))),G=y(y(w*_)+y(y(y(R*f)-y(M*h))-y(I*p))),E=y(y(y(h*F)+y(y(p*V)+y(f*U)))-y(_*G)),S=y(y(y(y(f*V)-y(p*U))-y(_*F))-y(h*G)),ie=y(y(y(_*U)+y(y(h*V)+y(f*G)))-y(p*F)),h=y(y(y(p*G)+y(y(f*F)+y(_*V)))-y(h*U)),_=y(y(2)/y(y(S*S)+y(y(ie*ie)+y(y(E*E)+y(h*h))))),p=y(ie*_),V=y(E*p),f=y(h*_),U=y(S*f),F=y(V-U),G=y(h*p),K=y(E*_),ne=y(S*K),_=y(G+ne),K=y(E*K),re=y(h*f),h=y(y(1)-y(K+re)),m[a+512>>2]=y(y(ee*F)+y(Y*_))+y(X*h),m[a+508>>2]=y(y(F*J)+y(_*j))+y(h*B),m[a+504>>2]=y(y(F*Z)+y(_*$))+y(h*Q),f=y(E*f),E=y(S*p),h=y(f+E),S=y(ie*p),_=y(y(1)-y(K+S)),p=y(G-ne),m[a+496>>2]=y(y(ee*h)+y(Y*_))+y(X*p),m[a+492>>2]=y(y(h*J)+y(_*j))+y(p*B),m[a+488>>2]=y(y(h*Z)+y(_*$))+y(p*Q),h=y(y(1)-y(re+S)),_=y(f-E),p=y(V+U),m[a+480>>2]=y(y(ee*h)+y(Y*_))+y(X*p),m[a+476>>2]=y(y(h*J)+y(_*j))+y(p*B),m[a+472>>2]=y(y(h*Z)+y(_*$))+y(p*Q)),l=d[n+20>>2],d[a+32>>2]=o,d[a>>2]=10288,c=d[a+420>>2],d[a+44>>2]=d[a+416>>2],d[a+48>>2]=c,c=d[a+412>>2],d[a+36>>2]=d[a+408>>2],d[a+40>>2]=c,c=d[te+12>>2],d[a+60>>2]=d[te+8>>2],d[a+64>>2]=c,c=d[te+4>>2],d[a+52>>2]=d[te>>2],d[a+56>>2]=c,c=d[q+12>>2],d[a+76>>2]=d[q+8>>2],d[a+80>>2]=c,c=d[q+4>>2],d[a+68>>2]=d[q>>2],d[a+72>>2]=c,c=d[k+12>>2],d[a+92>>2]=d[k+8>>2],d[a+96>>2]=c,c=d[k+4>>2],d[a+84>>2]=d[k>>2],d[a+88>>2]=c,c=d[L+12>>2],d[a+108>>2]=d[L+8>>2],d[a+112>>2]=c,c=d[L+4>>2],d[a+100>>2]=d[L>>2],d[a+104>>2]=c,c=d[P+12>>2],d[a+124>>2]=d[P+8>>2],d[a+128>>2]=c,c=d[P+4>>2],d[a+116>>2]=d[P>>2],d[a+120>>2]=c,c=d[T+12>>2],d[a+140>>2]=d[T+8>>2],d[a+144>>2]=c,c=d[T+4>>2],d[a+132>>2]=d[T>>2],d[a+136>>2]=c,c=d[D+12>>2],d[a+156>>2]=d[D+8>>2],d[a+160>>2]=c,c=d[D+4>>2],d[a+148>>2]=d[D>>2],d[a+152>>2]=c,c=d[a+252>>2],d[a+172>>2]=d[a+248>>2],d[a+176>>2]=c,c=d[a+244>>2],d[a+164>>2]=d[a+240>>2],d[a+168>>2]=c,c=d[a+268>>2],d[a+188>>2]=d[a+264>>2],d[a+192>>2]=c,c=d[a+260>>2],d[a+180>>2]=d[a+256>>2],d[a+184>>2]=c,c=d[a+284>>2],d[a+204>>2]=d[a+280>>2],d[a+208>>2]=c,c=d[a+276>>2],d[a+196>>2]=d[a+272>>2],d[a+200>>2]=c,c=d[a+292>>2],d[a+212>>2]=d[a+288>>2],d[a+216>>2]=c,c=d[a+300>>2],d[a+220>>2]=d[a+296>>2],d[a+224>>2]=c,d[a+232>>2]=l,s[a+228|0]=b,j_(H,a+408|0,a,l),c=d[e+28>>2]),(0|(g=g+1|0))<(0|c););u[e+16|0]&&(e=d[o+4>>2],d[e+748>>2]&&((0|(t=d[e+740>>2]))==(0|(i=d[d[o+8>>2]+8>>2]))?ot(e,t+4|0,d[d[o+12>>2]+8>>2]+4|0):ot(e,d[d[o+12>>2]+8>>2]+4|0,i+4|0)))}else{E=m[c+752>>2],e=d[i+12>>2],n=d[b+52>>2],S=m[(i=e+(l=n<<2)|0)>>2],Z=m[e+48>>2],t=d[t+12>>2],B=y(Z-m[t+48>>2]),j=m[i+16>>2],$=m[e+52>>2],X=y($-m[t+52>>2]),Y=m[i+32>>2],J=m[e+56>>2],Q=y(J-m[t+56>>2]),f=y(y(y(S*B)+y(j*X))+y(Y*Q)),e=t,t=d[g+52>>2],w=m[(e=e+(i=t<<2)|0)>>2],R=m[e+16>>2],I=m[e+32>>2],N=y(y(y(w*B)+y(R*X))+y(I*Q)),p=m[(e=b+28|0)+l>>2],C=m[(c=i)+(i=g+28|0)>>2],z=m[e+((n+2|0)%3<<2)>>2],ee=m[i+((t+2|0)%3<<2)>>2],M=y(y(y(w*S)+y(R*j))+y(I*Y)),(h=y(y(1)-y(M*M)))!=y(0)&&((h=y(y(N-y(M*f))/h))<(_=y(-C))||(_=h,h>C&&(_=C)));t:{if((h=y(y(M*_)-f))<(f=y(-p))){if((p=y(N-y(p*M)))<(_=y(-C))){h=f;break t}if(!(p>C)){h=f,_=p;break t}h=f}else{if(!(h>p))break t;if((f=y(y(p*M)+N))<(_=y(-C))){h=p;break t}if(!(f>C)){h=p,_=f;break t}h=p}_=C}if(M=y(Y*h),p=y(M+y(Q-y(I*_))),N=y(S*h),f=y(N+y(B-y(w*_))),S=y(j*h),h=y(S+y(X-y(R*_))),_=y(y(p*p)+y(y(f*f)+y(h*h))),B=y(x(_)),!((C=y(y(B-ee)-z))>E)){t:if(_<=y(14210854715202004e-30)){if(y(v(I))>y(.7071067690849304)){d[a>>2]=0,h=y(y(1)/y(x(y(y(R*R)+y(I*I))))),p=y(R*h),m[a+8>>2]=p,h=y(h*y(-I)),m[a+4>>2]=h,_=y(0);break t}d[a+8>>2]=0,_=y(y(1)/y(x(y(y(w*w)+y(R*R))))),h=y(w*_),m[a+4>>2]=h,_=y(_*y(-R)),m[a>>2]=_,p=y(0)}else d[a+12>>2]=0,_=y(y(-1)/B),p=y(p*_),m[a+8>>2]=p,h=y(h*_),m[a+4>>2]=h,_=y(f*_),m[a>>2]=_;d[a+420>>2]=0,m[a+416>>2]=y(J+M)+y(z*p),m[a+412>>2]=y($+S)+y(z*h),m[a+408>>2]=y(Z+N)+y(z*_)}if(C>2]+16>>2]](o,a,a+408|0,C),e=d[o+4>>2],!d[e+748>>2])break e;if((0|(t=d[e+740>>2]))!=(0|(i=d[d[o+8>>2]+8>>2]))){ot(e,d[d[o+12>>2]+8>>2]+4|0,i+4|0);break e}ot(e,t+4|0,d[d[o+12>>2]+8>>2]+4|0)}O=a+544|0},r[294]=function(e,t,i,n,r){e|=0,t|=0,i|=0,n|=0,r|=0;var o=y(0),a=y(0),l=y(0),c=0,h=0,_=0,p=0,f=0;return O=e=O-608|0,a=y(m[t+116>>2]-m[t+52>>2]),o=y(a*a),a=y(m[t+120>>2]-m[t+56>>2]),o=y(o+y(a*a)),a=y(m[t+124>>2]-m[t+60>>2]),o=y(o+y(a*a)),a=m[t+252>>2],o>2]-m[i+52>>2]),l=y(o*o),o=y(m[i+120>>2]-m[i+56>>2]),l=y(l+y(o*o)),o=y(m[i+124>>2]-m[i+60>>2]),l=y(l+y(o*o)),o=m[i+252>>2],l>2],r=d[i+248>>2],d[4+(n=e+552|0)>>2]=35,d[n+8>>2]=0,d[n>>2]=13316,d[n+44>>2]=1025758986,d[n+20>>2]=1065353216,d[n+24>>2]=0,d[n+12>>2]=1065353216,d[n+16>>2]=1065353216,d[n>>2]=13444,d[e+596>>2]=r,d[e+580>>2]=r,d[e+556>>2]=8,d[e+552>>2]=11556,d[e+548>>2]=0,d[e+540>>2]=1566444395,d[e+544>>2]=0,d[e+376>>2]=6896,s[e+348|0]=0,d[e+324>>2]=953267991,d[e+12>>2]=e+552,d[e+8>>2]=c,d[e+4>>2]=e+16,d[e>>2]=7148,c=t+4|0,h=t+68|0,_=i+4|0,p=i+68|0,a=y(1),Pe(e,c,h,_,p,e+376|0)&&(o=m[e+540>>2],m[t+244>>2]>o&&(m[t+244>>2]=o),m[i+244>>2]>o&&(m[i+244>>2]=o),a=y(1),o>2],r=d[t+248>>2],d[4+(n=e+552|0)>>2]=35,d[n+8>>2]=0,d[n>>2]=13316,d[n+44>>2]=1025758986,d[n+20>>2]=1065353216,d[n+24>>2]=0,d[n+12>>2]=1065353216,d[n+16>>2]=1065353216,d[n>>2]=13444,d[e+596>>2]=r,d[e+580>>2]=r,d[e+556>>2]=8,d[e+552>>2]=11556,d[e+548>>2]=0,d[e+540>>2]=1566444395,d[e+544>>2]=0,d[e+376>>2]=6896,s[e+348|0]=0,d[e+324>>2]=953267991,d[e+12>>2]=f,d[e+8>>2]=e+552,d[e+4>>2]=e+16,d[e>>2]=7148,Pe(e,c,h,_,p,e+376|0)&&(o=m[e+540>>2],m[t+244>>2]>o&&(m[t+244>>2]=o),m[i+244>>2]>o&&(m[i+244>>2]=o),a>o&&(a=o)))),O=e+608|0,y(a)},r[295]=function(e,t){t|=0;var i=0,n=0,o=0,a=0,l=0;if(!(!(i=d[20+(e|=0)>>2])|!u[e+16|0])){if((0|(n=d[t+4>>2]))==d[t+8>>2]&&!((0|n)>=(0|(o=n?n<<1:1)))){if(o&&(d[7717]=d[7717]+1,a=0|r[d[6606]](o<<2,16),n=d[t+4>>2]),(0|n)>=1)for(i=0;d[(l=i<<2)+a>>2]=d[d[t+12>>2]+l>>2],(0|(i=i+1|0))!=(0|n););(i=d[t+12>>2])&&(u[t+16|0]&&(i&&(d[7718]=d[7718]+1,r[d[6607]](i)),n=d[t+4>>2]),d[t+12>>2]=0),d[t+12>>2]=a,s[t+16|0]=1,d[t+8>>2]=o,i=d[e+20>>2]}d[d[t+12>>2]+(n<<2)>>2]=i,d[t+4>>2]=n+1}},r[296]=Pd,r[297]=fd,r[298]=fd,r[299]=J_,r[300]=Pd,r[301]=fd,r[302]=fd,r[303]=function(e,t,i,n){e|=0,t|=0,i|=0,n=y(n);var o,a=y(0),l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0);O=o=O-16|0,m[e+32>>2]=n,l=d[t+4>>2],d[e+8>>2]=d[t>>2],d[e+12>>2]=l,l=d[t+12>>2],d[e+16>>2]=d[t+8>>2],d[e+20>>2]=l,c=m[t+8>>2],h=m[i>>2],_=m[t>>2],u=m[i+4>>2],p=m[t+4>>2],f=m[i+8>>2],a=m[e+28>>2],d[o+12>>2]=0,m[o+8>>2]=f-y(a*c),m[o+4>>2]=u-y(a*p),m[o>>2]=h-y(_*a),n=y(y(a+m[e+24>>2])+n),m[e+32>>2]=n,n>2],r[d[d[e>>2]+16>>2]](e,t,o,n),O=o+16|0},r[304]=Pd,r[305]=function(e,t,i,n){e|=0,t|=0,i|=0,n=y(n);var s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0);O=s=O-16|0,w=m[t+8>>2],M=m[i+8>>2],p=y(y(w*n)+M),F=m[t+4>>2],D=m[i+4>>2],B=y(y(F*n)+D),N=m[t>>2],o=y(N*n),n=m[i>>2],L=y(o+n),u[e+228|0]?(v=m[e+52>>2],f=y(-m[e+88>>2]),A=m[e+36>>2],_=m[e+84>>2],h=m[e+68>>2],o=m[e+92>>2],T=y(y(y(v*f)-y(A*_))-y(h*o)),a=m[e+196>>2],C=m[e+56>>2],S=m[e+40>>2],g=m[e+72>>2],P=y(y(y(C*f)-y(S*_))-y(g*o)),l=m[e+200>>2],x=m[e+60>>2],c=y(x*f),f=m[e+44>>2],c=y(c-y(f*_)),_=m[e+76>>2],E=y(c-y(_*o)),o=m[e+204>>2],c=y(y(y(y(y(T*a)+y(P*l))+y(E*o))+m[e+220>>2])+y(y(p*y(y(y(h*a)+y(g*l))+y(_*o)))+y(y(L*y(y(y(A*a)+y(S*l))+y(f*o)))+y(B*y(y(y(v*a)+y(C*l))+y(x*o)))))),a=m[e+164>>2],l=m[e+168>>2],o=m[e+172>>2],a=y(y(y(p*y(y(y(h*a)+y(g*l))+y(_*o)))+y(y(L*y(y(y(A*a)+y(S*l))+y(f*o)))+y(B*y(y(y(v*a)+y(C*l))+y(x*o)))))+y(y(y(y(a*T)+y(P*l))+y(E*o))+m[e+212>>2])),l=y(N*y(a-n)),o=p,n=m[e+180>>2],p=m[e+184>>2],g=y(y(h*n)+y(g*p)),h=m[e+188>>2],p=y(y(y(o*y(g+y(_*h)))+y(y(L*y(y(y(A*n)+y(S*p))+y(f*h)))+y(B*y(y(y(v*n)+y(C*p))+y(x*h)))))+y(y(y(y(T*n)+y(P*p))+y(E*h))+m[e+216>>2])),n=y(y(l+y(F*y(p-D)))+y(w*y(c-M))),m[s+8>>2]=c+y(w*n),m[s+4>>2]=p+y(F*n),m[s>>2]=a+y(N*n)):(U=m[e+220>>2],v=m[e+204>>2],A=m[e+196>>2],h=m[e+200>>2],G=m[e+212>>2],a=m[e+168>>2],C=m[e+172>>2],S=m[e+164>>2],g=m[e+116>>2],c=y(-m[e+152>>2]),l=m[e+100>>2],R=m[e+148>>2],x=m[e+132>>2],I=m[e+156>>2],f=y(y(y(g*c)-y(l*R))-y(x*I)),_=m[e+120>>2],o=m[e+104>>2],T=m[e+136>>2],P=y(y(y(_*c)-y(o*R))-y(T*I)),E=m[e+124>>2],b=y(E*c),c=m[e+108>>2],b=y(b-y(c*R)),R=m[e+140>>2],I=y(b-y(R*I)),b=m[e+180>>2],k=m[e+184>>2],V=m[e+188>>2],b=y(y(y(M*y(y(y(x*b)+y(T*k))+y(R*V)))+y(y(n*y(y(y(l*b)+y(o*k))+y(c*V)))+y(D*y(y(y(g*b)+y(_*k))+y(E*V)))))+y(y(y(y(f*b)+y(P*k))+y(I*V))+m[e+216>>2])),m[s+4>>2]=b,a=y(y(y(M*y(y(y(x*S)+y(T*a))+y(R*C)))+y(y(n*y(y(y(l*S)+y(o*a))+y(c*C)))+y(D*y(y(y(g*S)+y(_*a))+y(E*C)))))+y(G+y(y(y(S*f)+y(P*a))+y(I*C)))),m[s>>2]=a,n=y(y(U+y(y(y(f*A)+y(P*h))+y(I*v)))+y(y(M*y(y(y(x*A)+y(T*h))+y(R*v)))+y(y(n*y(y(y(l*A)+y(o*h))+y(c*v)))+y(D*y(y(y(g*A)+y(_*h))+y(E*v)))))),m[s+8>>2]=n,n=y(y(y(N*y(L-a))+y(F*y(B-b)))+y(w*y(p-n)))),d[s+12>>2]=0,e=d[e+32>>2],r[d[d[e>>2]+16>>2]](e,t,s,n),O=s+16|0},r[306]=function(e){var t,i=0,n=0,o=0;if(d[(e|=0)>>2]=10356,(0|(t=d[e+12>>2]))>=1)for(;(n=d[(o=i<<2)+d[e+20>>2]>>2])&&(r[d[d[n>>2]>>2]](n),n=d[e+4>>2],r[d[d[n>>2]+60>>2]](n,d[d[e+20>>2]+o>>2])),(0|t)!=(0|(i=i+1|0)););return(i=d[e+20>>2])&&(u[e+24|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+20>>2]=0),d[e+20>>2]=0,d[e+12>>2]=0,d[e+16>>2]=0,s[e+24|0]=1,0|e},r[307]=function(e){var t,i=0,n=0,o=0;if(d[(e|=0)>>2]=10356,(0|(t=d[e+12>>2]))>=1)for(;(n=d[(o=i<<2)+d[e+20>>2]>>2])&&(r[d[d[n>>2]>>2]](n),n=d[e+4>>2],r[d[d[n>>2]+60>>2]](n,d[d[e+20>>2]+o>>2])),(0|t)!=(0|(i=i+1|0)););(i=d[e+20>>2])&&(u[e+24|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+20>>2]=0),d[e+20>>2]=0,d[e+12>>2]=0,d[e+16>>2]=0,s[e+24|0]=1,ve(e)},r[308]=function(e,t,i,n,o){e|=0,t|=0,i|=0,n|=0,o|=0;var a,l,c,h,_=0,p=0,f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=0,j=0,W=y(0),z=y(0),H=0;if(O=a=O-176|0,l=(_=u[e+28|0])?t:i,h=d[(c=_?i:t)+4>>2],d[h+68>>2]!=d[e+40>>2]){if((0|(G=d[e+12>>2]))>=1)for(_=0;(p=d[(j=_<<2)+d[e+20>>2]>>2])&&(r[d[d[p>>2]>>2]](p),p=d[e+4>>2],r[d[d[p>>2]+60>>2]](p,d[d[e+20>>2]+j>>2])),(0|G)!=(0|(_=_+1|0)););en(e,t,i)}if(p=d[h+64>>2],_=d[e+20>>2],t=d[e+4>>2],d[a+172>>2]=d[e+32>>2],d[a+168>>2]=_,d[a+164>>2]=o,d[a+160>>2]=n,d[a+156>>2]=t,d[a+152>>2]=l,d[a+148>>2]=c,d[a+144>>2]=10428,d[a+60>>2]=0,d[a+52>>2]=0,d[a+56>>2]=0,s[a+64|0]=1,!((0|(n=d[e+12>>2]))<1)){for(i=0;;){if(t=d[(i<<2)+_>>2]){if(r[d[d[t>>2]+16>>2]](t,a+48|0),n=0,(0|(_=d[a+52>>2]))>0)for(;t=d[d[a+60>>2]+(n<<2)>>2],d[t+748>>2]&&(d[o+4>>2]=t,_=(0|(G=d[t+740>>2]))==(0|(j=d[d[o+8>>2]+8>>2])),H=t,t=d[d[o+12>>2]+8>>2],ot(H,(_?G:t)+4|0,(_?t:j)+4|0),d[o+4>>2]=0,_=d[a+52>>2]),(0|(n=n+1|0))<(0|_););if((0|_)<=-1)for(d[a+56>>2]<=-1&&((t=d[a+60>>2])&&(u[a+64|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[a+60>>2]=0),s[a+64|0]=1,d[a+56>>2]=0,d[a+60>>2]=0);d[d[a+60>>2]+(_<<2)>>2]=0,n=(t=_+1|0)>>>0>=_>>>0,_=t,n;);d[a+52>>2]=0,n=d[e+12>>2]}if(!((0|(i=i+1|0))<(0|n)))break;_=d[e+20>>2]}(t=d[a+60>>2])&&(u[a+64|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[a+60>>2]=0)}e:{if(p)t=d[c+12>>2],R=m[t+52>>2],P=m[t+56>>2],i=d[l+12>>2],I=m[i+52>>2],M=m[i+56>>2],f=m[t+20>>2],g=m[t+36>>2],D=m[i+20>>2],w=m[i+36>>2],F=m[i+24>>2],v=m[t+24>>2],B=m[i+40>>2],A=m[t+40>>2],N=m[i+32>>2],C=m[t+32>>2],L=m[i>>2],S=m[t>>2],k=m[i+16>>2],x=m[t+16>>2],V=m[t+48>>2],U=m[i+48>>2],T=m[t+4>>2],W=m[i+4>>2],z=m[i+8>>2],E=m[t+8>>2],d[a+108>>2]=0,d[a+92>>2]=0,d[a+76>>2]=0,m[a+88>>2]=y(y(E*z)+y(v*F))+y(A*B),m[a+84>>2]=y(y(E*W)+y(v*D))+y(A*w),m[a+72>>2]=y(y(T*z)+y(f*F))+y(g*B),m[a+68>>2]=y(y(T*W)+y(f*D))+y(g*w),R=y(-R),m[a+104>>2]=y(y(y(v*R)-y(E*V))-y(A*P))+y(y(y(E*U)+y(v*I))+y(A*M)),m[a+100>>2]=y(y(y(f*R)-y(T*V))-y(g*P))+y(y(y(T*U)+y(f*I))+y(g*M)),d[a+60>>2]=0,m[a+48>>2]=y(y(S*L)+y(x*k))+y(C*N),m[a+80>>2]=y(y(E*L)+y(v*k))+y(A*N),m[a+64>>2]=y(y(T*L)+y(f*k))+y(g*N),m[a+56>>2]=y(y(S*z)+y(x*F))+y(C*B),m[a+52>>2]=y(y(S*W)+y(x*D))+y(C*w),m[a+96>>2]=y(y(y(x*R)-y(S*V))-y(C*P))+y(y(y(S*U)+y(x*I))+y(C*M)),t=d[l+4>>2],r[d[d[t>>2]+8>>2]](t,a+48|0,a+128|0,a+112|0),t=d[a+140>>2],d[a+24>>2]=d[a+136>>2],d[a+28>>2]=t,t=d[a+124>>2],d[a+40>>2]=d[a+120>>2],d[a+44>>2]=t,t=d[a+116>>2],d[a+32>>2]=d[a+112>>2],d[a+36>>2]=t,t=d[a+132>>2],d[a+16>>2]=d[a+128>>2],d[a+20>>2]=t,Si(p,d[p>>2],a+16|0,a+144|0);else{if((0|(t=d[e+12>>2]))<1)break e;for(_=0;dt(a+144|0,d[64+(d[h+24>>2]+b(_,80)|0)>>2],_),(0|(_=_+1|0))!=(0|t););}t=d[e+12>>2]}if((0|t)>=1)for(o=0;d[(_=o<<2)+d[e+20>>2]>>2]&&(i=d[h+24>>2]+b(o,80)|0,p=d[i+64>>2],n=d[c+12>>2],W=m[n+52>>2],z=m[n+56>>2],P=m[i+48>>2],I=m[i+52>>2],M=m[i+56>>2],D=m[i+4>>2],w=m[i+20>>2],F=m[i+36>>2],B=m[i+8>>2],N=m[i+24>>2],L=m[i+40>>2],f=m[n+20>>2],g=m[n+24>>2],k=m[i>>2],V=m[i+16>>2],v=m[n+36>>2],U=m[i+32>>2],A=m[n+40>>2],R=m[n+48>>2],C=m[n+8>>2],S=m[n>>2],x=m[n+4>>2],T=m[n+16>>2],E=m[n+32>>2],n=0,d[a+108>>2]=0,d[a+92>>2]=0,d[a+76>>2]=0,d[a+60>>2]=0,m[a+80>>2]=y(y(E*k)+y(v*V))+y(A*U),m[a+64>>2]=y(y(T*k)+y(f*V))+y(g*U),m[a+48>>2]=y(y(S*k)+y(x*V))+y(C*U),m[a+88>>2]=y(y(E*B)+y(v*N))+y(A*L),m[a+84>>2]=y(y(E*D)+y(v*w))+y(A*F),m[a+72>>2]=y(y(T*B)+y(f*N))+y(g*L),m[a+68>>2]=y(y(T*D)+y(f*w))+y(g*F),m[a+56>>2]=y(y(S*B)+y(x*N))+y(C*L),m[a+52>>2]=y(y(S*D)+y(x*w))+y(C*F),m[a+104>>2]=z+y(y(y(E*P)+y(v*I))+y(A*M)),m[a+100>>2]=W+y(y(y(T*P)+y(f*I))+y(g*M)),m[a+96>>2]=R+y(y(y(S*P)+y(x*I))+y(C*M)),r[d[d[p>>2]+8>>2]](p,a+48|0,a+16|0,a+128|0),i=d[l+4>>2],r[d[d[i>>2]+8>>2]](i,d[l+12>>2],a+112|0,a),i=0,m[a+16>>2]>m[a>>2]||(i=0,m[a+128>>2]>2]||(i=1)),(1^(n=m[a+136>>2]>2]|m[a+24>>2]>m[a+8>>2]?n:i)||m[a+132>>2]>2]|m[a+20>>2]>m[a+4>>2])&&(i=d[_+d[e+20>>2]>>2],r[d[d[i>>2]>>2]](i),i=d[e+4>>2],r[d[d[i>>2]+60>>2]](i,d[_+d[e+20>>2]>>2]),d[_+d[e+20>>2]>>2]=0)),(0|(o=o+1|0))!=(0|t););O=a+176|0},r[309]=function(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o,a,l,c,h,_,p,f=0,g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=0,D=y(0),O=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0);if((0|(o=d[e+12>>2]))<1)return y(y(1));for(a=(f=u[e+28|0])?t:i,l=d[(t=f?i:t)- -64>>2],j=m[t+60>>2],W=m[t+56>>2],z=m[t+52>>2],c=d[t+48>>2],v=m[t+44>>2],A=m[t+40>>2],C=m[t+36>>2],h=d[t+32>>2],S=m[t+28>>2],x=m[t+24>>2],T=m[t+20>>2],_=d[t+16>>2],E=m[t+12>>2],R=m[t+8>>2],M=d[t+260>>2],P=m[t+4>>2],p=d[t+192>>2],I=y(1),f=0;i=d[p+24>>2]+b(f,80)|0,g=m[i+56>>2],D=m[i+52>>2],O=m[i+48>>2],w=m[i+36>>2],F=m[i+20>>2],B=m[i+4>>2],N=m[i+40>>2],L=m[i+24>>2],k=m[i+8>>2],V=m[i+32>>2],U=m[i>>2],G=m[i+16>>2],d[t+64>>2]=0,d[t+48>>2]=0,d[t+32>>2]=0,d[t+16>>2]=0,d[t+260>>2]=M+1,m[t+36>>2]=y(y(C*U)+y(A*G))+y(v*V),m[t+20>>2]=y(y(T*U)+y(x*G))+y(S*V),m[t+4>>2]=y(y(P*U)+y(R*G))+y(E*V),m[t+44>>2]=y(y(C*k)+y(A*L))+y(v*N),m[t+40>>2]=y(y(C*B)+y(A*F))+y(v*w),m[t+28>>2]=y(y(T*k)+y(x*L))+y(S*N),m[t+24>>2]=y(y(T*B)+y(x*F))+y(S*w),m[t+12>>2]=y(y(P*k)+y(R*L))+y(E*N),m[t+8>>2]=y(y(P*B)+y(R*F))+y(E*w),m[t+60>>2]=j+y(y(y(C*O)+y(A*D))+y(v*g)),m[t+56>>2]=W+y(y(y(T*O)+y(x*D))+y(S*g)),m[t+52>>2]=z+y(y(y(P*O)+y(R*D))+y(E*g)),i=d[d[e+20>>2]+(f<<2)>>2],g=y(r[d[d[i>>2]+12>>2]](i,t,a,n,s)),d[t+64>>2]=l,m[t+60>>2]=j,m[t+56>>2]=W,m[t+52>>2]=z,d[t+48>>2]=c,m[t+44>>2]=v,m[t+40>>2]=A,m[t+36>>2]=C,d[t+32>>2]=h,m[t+28>>2]=S,m[t+24>>2]=x,m[t+20>>2]=T,d[t+16>>2]=_,m[t+12>>2]=E,m[t+8>>2]=R,m[t+4>>2]=P,M=d[t+260>>2]+1|0,d[t+260>>2]=M,I=g>2]))>=1)for(;(s=d[d[e+20>>2]+(n<<2)>>2])&&(r[d[d[s>>2]+16>>2]](s,t),i=d[e+12>>2]),(0|(n=n+1|0))<(0|i););},r[311]=Pd,r[312]=function(e,t){var i,n;t|=0,i=e|=0,n=d[d[d[e+4>>2]+4>>2]+24>>2],e=d[t+36>>2],dt(i,d[64+(n+b(e,80)|0)>>2],e)},r[313]=Dr,r[314]=function(e){ve(Dr(e|=0))},r[315]=function(e,t,i){e|=0,t|=0,i|=0;var n=0,r=0,s=0,o=0,a=0,l=0,c=0,h=0;d[6996]=d[6996]+1,a=d[e+40>>2],n=b((n=((n=i<<16|t)<<15^-1)+n|0)>>10^n,9),n=((n^=n>>6)<<11^-1)+n|0,s=a+((d[e+12>>2]+-1&(n>>16^n))<<2)|0;e:if(-1!=(0|(n=d[s>>2]))){for(o=d[e+16>>2],r=n;;){if(l=o+b(r,12)|0,d[l+4>>2]!=(0|i)||d[l>>2]!=(0|t)){if(-1!=(0|(r=d[d[e+60>>2]+(r<<2)>>2])))continue;break e}break}h=d[8+(o+b(r,12)|0)>>2],i=d[e+60>>2];t:{i:{if((0|n)!=(0|r)){for(;(0|r)!=(0|(n=d[i+((t=n)<<2)>>2])););if(n=c=d[i+(r<<2)>>2],-1==(0|t))break i;d[i+(t<<2)>>2]=c;break t}n=d[i+(r<<2)>>2]}d[s>>2]=n}if((0|(s=d[e+8>>2]+-1|0))==(0|r))return d[e+8>>2]=r,0|h;t:{if(o=o+b(s,12)|0,t=d[o+4>>2]<<16|d[o>>2],t=b((t=(t<<15^-1)+t|0)>>10^t,9),t=((t^=t>>6)<<11^-1)+t|0,c=d[e+12>>2]+-1&(t>>16^t),(0|s)!=(0|(n=d[(a=a+(c<<2)|0)>>2]))){for(;(0|s)!=(0|(n=d[i+((t=n)<<2)>>2])););if(n=d[i+(s<<2)>>2],-1!=(0|t)){d[i+(t<<2)>>2]=n;break t}}else n=d[i+(s<<2)>>2];d[a>>2]=n}t=d[o+4>>2],d[l>>2]=d[o>>2],d[l+4>>2]=t,d[l+8>>2]=d[o+8>>2],t=d[e+40>>2]+(c<<2)|0,d[d[e+60>>2]+(r<<2)>>2]=d[t>>2],d[t>>2]=r,d[e+8>>2]=d[e+8>>2]+-1}return 0|h},r[316]=function(e,t,i){return e|=0,t|=0,i|=0,d[6997]=d[6997]+1,0|function(e,t,i){var n,o=0,a=0,l=0,c=0,h=0,_=0,p=0,f=0,m=0,g=0;o=b((o=((o=i<<16|t)<<15^-1)+o|0)>>10^o,9),p=(n=(o=((o^=o>>6)<<11^-1)+o|0)>>16^o)&(o=d[e+12>>2])+-1;e:{if(-1!=(0|(l=d[d[e+40>>2]+(p<<2)>>2])))for(c=d[e+16>>2];;){if(a=c+b(l,12)|0,d[a+4>>2]==(0|i)&&d[a>>2]==(0|t))break e;if(-1==(0|(l=d[d[e+60>>2]+(l<<2)>>2])))break}l=e;t:{i:{if((0|(a=c=d[e+8>>2]))==(0|o)){if(!(m=(0|o)>=(0|(a=o?o<<1:1))))break i}else o=a;d[l+8>>2]=o+1,a=(h=d[e+16>>2])+b(c,12)|0;break t}if(a&&(d[7717]=d[7717]+1,h=0|r[d[6606]](b(a,12),16),o=d[e+8>>2]),(0|o)>=1)for(l=0;f=(_=b(l,12))+d[e+16>>2]|0,g=d[f+4>>2],d[(_=h+_|0)>>2]=d[f>>2],d[_+4>>2]=g,d[_+8>>2]=d[f+8>>2],(0|(l=l+1|0))!=(0|o););(o=d[e+16>>2])&&(u[e+20|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+16>>2]=0),d[e+16>>2]=h,d[e+12>>2]=a,s[e+20|0]=1,d[e+8>>2]=d[e+8>>2]+1,a=b(c,12)+h|0,m||(si(e),p=d[e+12>>2]+-1&n)}d[a>>2]=t,t=b(c,12)+h|0,d[t+8>>2]=0,d[t+4>>2]=i,t=d[e+60>>2]+(c<<2)|0,e=d[e+40>>2]+(p<<2)|0,d[t>>2]=d[e>>2],d[e>>2]=c}return a}(e,t,i)},r[317]=ld,r[318]=Cr,r[319]=function(e){ve(Cr(e|=0))},r[320]=function(e,t,i,n,o){e|=0,t|=0,i|=0,n|=0,o|=0;var a,l,c,h=0,_=0,p=0,f=0,g=y(0),A=y(0),C=y(0),S=y(0),x=0,T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=0,D=y(0),w=y(0),F=y(0),B=0,N=y(0),L=0,k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=0,H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=0,Z=y(0),$=0,J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0);if(O=a=O-176|0,l=d[t+4>>2],c=d[i+4>>2],d[c+68>>2]!=d[e+44>>2]||d[l+68>>2]!=d[e+40>>2]){if(h=d[e+8>>2],(0|(f=d[h+8>>2]))>=1){for(;(M=d[8+(d[h+16>>2]+b(_,12)|0)>>2])&&(r[d[d[M>>2]>>2]](M),p=d[e+4>>2],r[d[d[p>>2]+60>>2]](p,M)),(0|f)!=(0|(_=_+1|0)););h=d[e+8>>2]}fn(h)}if(d[a+20>>2]=0,d[a+12>>2]=0,d[a+16>>2]=0,s[a+24|0]=1,M=d[e+8>>2],!((0|(f=d[M+8>>2]))<1)){for(;;){if(h=d[8+(d[M+16>>2]+b(B,12)|0)>>2]){if(r[d[d[h>>2]+16>>2]](h,a+8|0),f=0,(0|(_=d[a+12>>2]))>0)for(;z=d[d[a+20>>2]+(f<<2)>>2],d[z+748>>2]&&(d[o+4>>2]=z,_=(0|(h=d[z+740>>2]))==(0|(p=d[d[o+8>>2]+8>>2])),x=h,h=d[d[o+12>>2]+8>>2],ot(z,(_?x:h)+4|0,(_?h:p)+4|0),d[o+4>>2]=0,_=d[a+12>>2]),(0|(f=f+1|0))<(0|_););if((0|_)<=-1)for(d[a+16>>2]<=-1&&((h=d[a+20>>2])&&(u[a+24|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[a+20>>2]=0),s[a+24|0]=1,d[a+16>>2]=0,d[a+20>>2]=0);d[d[a+20>>2]+(_<<2)>>2]=0,p=(h=_+1|0)>>>0>=_>>>0,_=h,p;);d[a+12>>2]=0,f=d[M+8>>2]}if(!((0|(B=B+1|0))<(0|f)))break}(h=d[a+20>>2])&&(u[a+24|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[a+20>>2]=0)}if(f=d[l+64>>2],_=d[c+64>>2],p=d[e+4>>2],h=d[e+8>>2],d[a+168>>2]=d[e+32>>2],d[a+164>>2]=h,d[a+160>>2]=o,d[a+156>>2]=n,d[a+152>>2]=p,d[a+140>>2]=0,d[a+136>>2]=10648,d[a+144>>2]=t,d[a+148>>2]=i,(o=d[f>>2])&&(n=d[_>>2])){for(p=d[t+12>>2],P=m[p+24>>2],g=y(-m[p+52>>2]),T=m[p+8>>2],C=m[p+48>>2],I=m[p+40>>2],E=m[p+56>>2],h=d[i+12>>2],R=m[h+48>>2],S=m[h+52>>2],A=m[h+56>>2],ie=y(y(y(y(P*g)-y(T*C))-y(I*E))+y(y(y(T*R)+y(P*S))+y(I*A))),D=m[p+20>>2],N=m[p+4>>2],w=m[p+36>>2],ne=y(y(y(y(D*g)-y(N*C))-y(w*E))+y(y(y(N*R)+y(D*S))+y(w*A))),G=m[h+40>>2],k=m[h+24>>2],j=m[h+8>>2],V=m[h+36>>2],W=m[h+20>>2],U=m[h+4>>2],Z=m[p+16>>2],F=y(Z*g),g=m[p>>2],F=y(F-y(g*C)),C=m[p+32>>2],re=y(y(F-y(C*E))+y(y(y(g*R)+y(Z*S))+y(C*A))),R=m[h+16>>2],S=m[h>>2],A=m[h+32>>2],d[7717]=d[7717]+1,h=0|r[d[6606]](1024,16),d[h+4>>2]=n,d[h>>2]=o,te=y(y(y(T*j)+y(P*k))+y(I*G)),Y=y(v(te)),F=y(y(y(T*U)+y(P*W))+y(I*V)),Q=y(v(F)),H=y(y(y(T*S)+y(P*R))+y(I*A)),q=y(v(H)),X=y(y(y(N*j)+y(D*k))+y(w*G)),P=y(v(X)),T=y(y(y(N*U)+y(D*W))+y(w*V)),I=y(v(T)),D=y(y(y(N*S)+y(D*R))+y(w*A)),N=y(v(D)),w=y(y(y(g*j)+y(Z*k))+y(C*G)),G=y(v(w)),k=y(y(y(g*U)+y(Z*W))+y(C*V)),j=y(v(k)),V=y(y(y(g*S)+y(Z*R))+y(C*A)),W=y(v(V)),B=124,p=128,_=128,f=1;;){e:{t:{i:{if(L=d[(n=(K=(M=f+-1|0)<<3)+h|0)>>2],x=d[n+4>>2],U=m[x+16>>2],g=m[x>>2],J=y(y(y(U-g)*y(.5))+y(0)),C=m[x+20>>2],E=m[x+4>>2],ee=y(y(y(C-E)*y(.5))+y(0)),R=m[x+24>>2],A=m[x+8>>2],Z=y(y(y(R-A)*y(.5))+y(0)),S=y(y(y(W*J)+y(j*ee))+y(G*Z)),g=y(y(U+g)*y(.5)),E=y(y(C+E)*y(.5)),R=y(y(R+A)*y(.5)),A=y(re+y(y(y(V*g)+y(k*E))+y(w*R))),!(m[L>>2]<=y(S+A)^1|m[L+16>>2]>=y(A-S)^1||(S=y(y(y(N*J)+y(I*ee))+y(P*Z)),A=y(ne+y(y(y(D*g)+y(T*E))+y(X*R))),m[L+4>>2]<=y(S+A)^1|m[L+20>>2]>=y(A-S)^1||(S=y(y(y(q*J)+y(Q*ee))+y(Y*Z)),A=y(ie+y(y(y(H*g)+y(F*E))+y(te*R))),m[L+8>>2]<=y(S+A)^1|m[L+24>>2]>=y(A-S)^1)))){if((0|M)<=(0|B))o=p,n=h;else{n:if((0|p)>=(0|(o=p<<1)))n=h;else if((0|_)>=(0|o))n=h;else{r:{if(p){if(B=0,d[7717]=d[7717]+1,n=0|r[d[6606]](p<<4,16),!((0|p)<1)){for(;$=(_=B<<3)+n|0,_=d[4+(z=h+_|0)>>2],d[$>>2]=d[z>>2],d[$+4>>2]=_,(0|(B=B+1|0))!=(0|p););break r}}else n=0;if(_=o,!h)break n}h&&(d[7718]=d[7718]+1,r[d[6607]](h)),_=o}B=o+-4|0}if(h=d[x+40>>2],d[L+40>>2]){if(p=d[L+36>>2],h){d[4+(h=n+K|0)>>2]=d[x+36>>2],d[h>>2]=p,h=d[L+40>>2],d[4+(p=(f<<3)+n|0)>>2]=d[x+36>>2],d[p>>2]=h,h=d[L+36>>2],d[p+12>>2]=d[x+40>>2],d[p+8>>2]=h,h=d[L+40>>2],d[p+20>>2]=d[x+40>>2],d[p+16>>2]=h,f=f+3|0;break t}d[4+(h=n+K|0)>>2]=x,d[h>>2]=p,p=d[L+40>>2],d[4+(h=(f<<3)+n|0)>>2]=x,d[h>>2]=p;break i}if(h){d[4+(h=n+K|0)>>2]=d[x+36>>2],d[h>>2]=L,d[4+(h=(f<<3)+n|0)>>2]=d[x+40>>2],d[h>>2]=L;break i}r[d[d[a+136>>2]+8>>2]](a+136|0,L,x),p=o,h=n}f=M;break e}f=f+1|0}p=o,h=n}if(!f)break}h&&h&&(d[7718]=d[7718]+1,r[d[6607]](h))}if(K=d[e+8>>2],d[K+8>>2]>=1)for($=0;;){if(n=(o=b($,12))+d[K+16>>2]|0,(h=d[n+8>>2])&&(_=d[l+24>>2]+b(d[n>>2],80)|0,n=d[_+64>>2],p=d[t+12>>2],R=m[p+52>>2],S=m[p+56>>2],D=m[_+48>>2],N=m[_+52>>2],w=m[_+56>>2],G=m[_+4>>2],k=m[_+20>>2],j=m[_+36>>2],V=m[_+8>>2],W=m[_+24>>2],U=m[_+40>>2],Y=m[p+20>>2],F=m[p+24>>2],g=m[_>>2],Q=m[p+36>>2],C=m[_+16>>2],H=m[p+40>>2],E=m[_+32>>2],A=m[p+48>>2],q=m[p+8>>2],X=m[p>>2],P=m[p+4>>2],T=m[p+16>>2],I=m[p+32>>2],p=0,d[a+68>>2]=0,d[a+52>>2]=0,d[a+36>>2]=0,d[a+20>>2]=0,m[a+40>>2]=y(y(I*g)+y(Q*C))+y(H*E),m[a+24>>2]=y(y(T*g)+y(Y*C))+y(F*E),m[a+8>>2]=y(y(X*g)+y(P*C))+y(q*E),m[a+48>>2]=y(y(I*V)+y(Q*W))+y(H*U),m[a+44>>2]=y(y(I*G)+y(Q*k))+y(H*j),m[a+32>>2]=y(y(T*V)+y(Y*W))+y(F*U),m[a+28>>2]=y(y(T*G)+y(Y*k))+y(F*j),m[a+16>>2]=y(y(X*V)+y(P*W))+y(q*U),m[a+12>>2]=y(y(X*G)+y(P*k))+y(q*j),m[a+64>>2]=S+y(y(y(I*D)+y(Q*N))+y(H*w)),m[a+60>>2]=R+y(y(y(T*D)+y(Y*N))+y(F*w)),m[a+56>>2]=A+y(y(y(X*D)+y(P*N))+y(q*w)),r[d[d[n>>2]+8>>2]](n,a+8|0,a+120|0,a+104|0),f=d[c+24>>2]+b(d[4+(o+d[K+16>>2]|0)>>2],80)|0,n=d[f+64>>2],_=d[i+12>>2],R=m[_+52>>2],S=m[_+56>>2],D=m[f+48>>2],N=m[f+52>>2],w=m[f+56>>2],G=m[f+4>>2],k=m[f+20>>2],j=m[f+36>>2],V=m[f+8>>2],W=m[f+24>>2],U=m[f+40>>2],Y=m[_+20>>2],F=m[_+24>>2],g=m[f>>2],Q=m[_+36>>2],C=m[f+16>>2],H=m[_+40>>2],E=m[f+32>>2],A=m[_+48>>2],q=m[_+8>>2],X=m[_>>2],P=m[_+4>>2],T=m[_+16>>2],I=m[_+32>>2],d[a+68>>2]=0,d[a+52>>2]=0,d[a+36>>2]=0,d[a+20>>2]=0,m[a+40>>2]=y(y(I*g)+y(Q*C))+y(H*E),m[a+24>>2]=y(y(T*g)+y(Y*C))+y(F*E),m[a+8>>2]=y(y(X*g)+y(P*C))+y(q*E),m[a+48>>2]=y(y(I*V)+y(Q*W))+y(H*U),m[a+44>>2]=y(y(I*G)+y(Q*k))+y(H*j),m[a+32>>2]=y(y(T*V)+y(Y*W))+y(F*U),m[a+28>>2]=y(y(T*G)+y(Y*k))+y(F*j),m[a+16>>2]=y(y(X*V)+y(P*W))+y(q*U),m[a+12>>2]=y(y(X*G)+y(P*k))+y(q*j),m[a+64>>2]=S+y(y(y(I*D)+y(Q*N))+y(H*w)),m[a+60>>2]=R+y(y(y(T*D)+y(Y*N))+y(F*w)),m[a+56>>2]=A+y(y(y(X*D)+y(P*N))+y(q*w)),r[d[d[n>>2]+8>>2]](n,a+8|0,a+88|0,a+72|0),n=0,m[a+120>>2]>m[a+72>>2]||(n=0,m[a+104>>2]>2]||(n=1)),1^(p=m[a+112>>2]>2]|m[a+128>>2]>m[a+80>>2]?p:n)||m[a+108>>2]>2]|m[a+124>>2]>m[a+76>>2])){if(r[d[d[h>>2]>>2]](h),n=d[e+4>>2],r[d[d[n>>2]+60>>2]](n,h),n=o+d[K+16>>2]|0,p=d[n+4>>2],h=d[n>>2],(0|(o=d[e+16>>2]))==d[e+20>>2]&&!((0|o)>=(0|(z=o?o<<1:1)))){if(_=0,B=0,z&&(d[7717]=d[7717]+1,B=0|r[d[6606]](b(z,12),16),o=d[e+16>>2]),(0|o)>=1)for(;M=(n=b(_,12))+B|0,f=n+d[e+24>>2]|0,n=d[f+4>>2],d[M>>2]=d[f>>2],d[M+4>>2]=n,d[M+8>>2]=d[f+8>>2],(0|(_=_+1|0))!=(0|o););(n=d[e+24>>2])&&(u[e+28|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+24>>2]=0),d[e+24>>2]=B,s[e+28|0]=1,d[e+20>>2]=z,o=d[e+16>>2]}n=d[e+24>>2]+b(o,12)|0,d[n+8>>2]=0,d[n+4>>2]=p,d[n>>2]=h,d[e+16>>2]=d[e+16>>2]+1}if(!((0|($=$+1|0))>2]))break}if(d[e+16>>2]>=1)for(_=0;i=d[e+8>>2],t=d[e+24>>2]+b(_,12)|0,r[d[d[i>>2]+8>>2]](i,d[t>>2],d[t+4>>2]),(0|(_=_+1|0))>2];);(t=d[e+24>>2])&&(u[e+28|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+24>>2]=0),d[e+24>>2]=0,d[e+16>>2]=0,d[e+20>>2]=0,s[e+28|0]=1,O=a+176|0},r[321]=function(e,t,i,n,r){return y(y(0))},r[322]=function(e,t){t|=0;var i,n=0,s=0;if(i=d[8+(e|=0)>>2],(0|(n=d[i+8>>2]))>=1)for(e=0;(s=d[8+(d[i+16>>2]+b(e,12)|0)>>2])&&(r[d[d[s>>2]+16>>2]](s,t),n=d[i+8>>2]),(0|(e=e+1|0))<(0|n););},r[323]=Pd,r[324]=function(e,t,i){e|=0,t|=0,i|=0;var n,s,o,a,l,c,h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=0,L=0,k=y(0),V=y(0),U=y(0);O=n=O-240|0,d[e+4>>2]=d[e+4>>2]+1,s=d[i+36>>2],a=b(s,80),l=d[e+12>>2],c=d[l+4>>2],N=d[64+(a+d[c+24>>2]|0)>>2],i=d[e+8>>2],o=d[t+36>>2],t=d[d[i+4>>2]+24>>2]+b(o,80)|0,L=d[t+64>>2],i=d[i+12>>2],k=m[i+52>>2],V=m[i+56>>2],h=m[i+24>>2],_=m[i+20>>2],u=m[i+40>>2],p=m[i+36>>2],U=m[i+48>>2],f=m[i+8>>2],g=m[i>>2],v=m[i+4>>2],A=m[i+16>>2],C=m[i+32>>2],S=m[t+32>>2],x=m[t>>2],T=m[t+16>>2],E=m[t+56>>2],R=m[t+48>>2],P=m[t+52>>2],I=m[t+36>>2],M=m[t+4>>2],D=m[t+20>>2],w=m[t+40>>2],F=m[t+8>>2],B=m[t+24>>2],i=0,d[n+236>>2]=0,d[n+220>>2]=0,d[n+204>>2]=0,m[n+216>>2]=y(y(C*F)+y(p*B))+y(u*w),m[n+212>>2]=y(y(C*M)+y(p*D))+y(u*I),m[n+200>>2]=y(y(A*F)+y(_*B))+y(h*w),m[n+196>>2]=y(y(A*M)+y(_*D))+y(h*I),m[n+232>>2]=V+y(y(y(C*R)+y(p*P))+y(u*E)),m[n+228>>2]=k+y(y(y(A*R)+y(_*P))+y(h*E)),d[n+188>>2]=0,m[n+208>>2]=y(y(C*x)+y(p*T))+y(u*S),m[n+192>>2]=y(y(A*x)+y(_*T))+y(h*S),m[n+184>>2]=y(y(g*F)+y(v*B))+y(f*w),m[n+180>>2]=y(y(g*M)+y(v*D))+y(f*I),m[n+176>>2]=y(y(g*x)+y(v*T))+y(f*S),m[n+224>>2]=U+y(y(y(g*R)+y(v*P))+y(f*E)),t=d[l+12>>2],k=m[t+52>>2],V=m[t+56>>2],h=m[t+24>>2],_=m[t+20>>2],u=m[t+40>>2],p=m[t+36>>2],U=m[t+48>>2],f=m[t+8>>2],g=m[t>>2],v=m[t+4>>2],A=m[t+16>>2],C=m[t+32>>2],t=d[c+24>>2]+a|0,S=m[t+32>>2],x=m[t>>2],T=m[t+16>>2],E=m[t+56>>2],R=m[t+48>>2],P=m[t+52>>2],I=m[t+36>>2],M=m[t+4>>2],D=m[t+20>>2],w=m[t+40>>2],F=m[t+8>>2],B=m[t+24>>2],d[n+172>>2]=0,d[n+156>>2]=0,d[n+140>>2]=0,m[n+152>>2]=y(y(C*F)+y(p*B))+y(u*w),m[n+148>>2]=y(y(C*M)+y(p*D))+y(u*I),m[n+136>>2]=y(y(A*F)+y(_*B))+y(h*w),m[n+132>>2]=y(y(A*M)+y(_*D))+y(h*I),m[n+168>>2]=V+y(y(y(C*R)+y(p*P))+y(u*E)),m[n+164>>2]=k+y(y(y(A*R)+y(_*P))+y(h*E)),d[n+124>>2]=0,m[n+144>>2]=y(y(C*x)+y(p*T))+y(u*S),m[n+128>>2]=y(y(A*x)+y(_*T))+y(h*S),m[n+120>>2]=y(y(g*F)+y(v*B))+y(f*w),m[n+116>>2]=y(y(g*M)+y(v*D))+y(f*I),m[n+112>>2]=y(y(g*x)+y(v*T))+y(f*S),m[n+160>>2]=U+y(y(y(g*R)+y(v*P))+y(f*E)),r[d[d[L>>2]+8>>2]](L,n+176|0,n+96|0,n+80|0),r[d[d[N>>2]+8>>2]](N,n+112|0,n- -64|0,n+48|0),(t=d[6999])&&!r[t](L,N)||(i=m[n+80>>2]>2]|m[n+96>>2]>m[n+48>>2]?i:1,t=0,t=m[n+88>>2]>2]|m[n+104>>2]>m[n+56>>2]?t:i,m[n+84>>2]>2]|m[n+100>>2]>m[n+52>>2]|1^t||(t=d[e+8>>2],i=d[t+8>>2],d[n+44>>2]=o,d[n+40>>2]=-1,d[n+32>>2]=i,d[n+28>>2]=L,d[n+24>>2]=t,d[n+36>>2]=n+176,t=d[e+12>>2],i=d[t+8>>2],d[n+20>>2]=s,d[n+16>>2]=-1,d[n+8>>2]=i,d[n+4>>2]=N,d[n>>2]=t,d[n+12>>2]=n+112,t=function(e,t,i){var n=0,r=0,s=0;d[6998]=d[6998]+1,n=((n=(n=b((n=((n=i<<16|t)<<15^-1)+n|0)>>10^n,9))>>6^n)<<11^-1)+n|0;e:{if(!((0|(n=d[e+12>>2]+-1&(n>>16^n)))>=d[e+32>>2])&&-1!=(0|(n=d[d[e+40>>2]+(n<<2)>>2])))for(s=d[e+16>>2];;){if(r=b(n,12)+s|0,d[r+4>>2]==(0|i)&&d[r>>2]==(0|t))break e;if(-1==(0|(n=d[d[e+60>>2]+(n<<2)>>2])))break}r=0}return r}(d[e+28>>2],o,s),t?i=d[t+8>>2]:(t=d[e+16>>2],i=0|r[d[d[t>>2]+8>>2]](t,n+24|0,n,d[e+32>>2]),t=d[e+28>>2],d[8+(0|r[d[d[t>>2]+12>>2]](t,o,s))>>2]=i),t=d[e+24>>2],N=d[t+12>>2],L=d[t+8>>2],d[t+12>>2]=n,d[t+8>>2]=n+24,r[d[d[t>>2]+8>>2]](t,-1,o),t=d[e+24>>2],r[d[d[t>>2]+12>>2]](t,-1,s),r[d[d[i>>2]+8>>2]](i,n+24|0,n,d[e+20>>2],d[e+24>>2]),e=d[e+24>>2],d[e+8>>2]=L,d[e+12>>2]=N)),O=n+240|0},r[325]=Rd,r[326]=function(e){var t=0;return d[(e|=0)>>2]=10732,(t=d[e+64>>2])&&(ar(t),(t=d[e+64>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),(t=d[e+24>>2])&&(u[e+28|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+24>>2]=0),d[e+24>>2]=0,s[e+28|0]=1,d[e+16>>2]=0,d[e+20>>2]=0,0|e},r[327]=function(e){var t=0;d[(e|=0)>>2]=10732,(t=d[e+64>>2])&&(ar(t),(t=d[e+64>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),(t=d[e+24>>2])&&(u[e+28|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+24>>2]=0),d[e+24>>2]=0,s[e+28|0]=1,d[e+16>>2]=0,d[e+20>>2]=0,e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[328]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0);o=m[e+40>>2],c=m[e+56>>2],s=d[e+16>>2],a=m[e+36>>2],h=m[e+52>>2],l=m[e+32>>2],_=m[e+48>>2],I=y(r[d[d[e>>2]+48>>2]](e)),M=y(r[d[d[e>>2]+48>>2]](e)),D=y(r[d[d[e>>2]+48>>2]](e)),O=m[t+52>>2],u=m[t+24>>2],A=m[t+20>>2],p=m[t+56>>2],C=m[t+40>>2],S=m[t+36>>2],w=m[t+48>>2],x=m[t+8>>2],T=m[t>>2],E=m[t+4>>2],R=m[t+16>>2],P=m[t+32>>2],d[i+12>>2]=0,f=p,p=y(s?y(_+l)*y(.5):0),g=y(s?y(h+a)*y(.5):0),b=y(s?y(c+o)*y(.5):0),f=y(f+y(y(y(P*p)+y(S*g))+y(C*b))),l=y(I+y(s?y(_-l)*y(.5):0)),a=y(M+y(s?y(h-a)*y(.5):0)),o=y(D+y(s?y(c-o)*y(.5):0)),c=y(y(y(l*y(v(P)))+y(a*y(v(S))))+y(o*y(v(C)))),m[i+8>>2]=f-c,h=y(O+y(y(y(p*R)+y(g*A))+y(b*u))),_=y(y(y(l*y(v(R)))+y(a*y(v(A))))+y(o*y(v(u)))),m[i+4>>2]=h-_,u=y(w+y(y(y(p*T)+y(g*E))+y(b*x))),o=y(y(y(l*y(v(T)))+y(a*y(v(E))))+y(o*y(v(x)))),m[i>>2]=u-o,d[n+12>>2]=0,m[n+8>>2]=c+f,m[n+4>>2]=_+h,m[n>>2]=o+u},r[329]=function(e,t){e|=0,t|=0;var i,n=0,s=0,o=0,a=0,l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0);if(O=i=O-144|0,d[e+16>>2]>=1)for(o=i- -64|0;n=(a=b(l,80))+d[e+24>>2]|0,s=d[n+12>>2],d[i+24>>2]=d[n+8>>2],d[i+28>>2]=s,s=d[n+4>>2],d[i+16>>2]=d[n>>2],d[i+20>>2]=s,s=d[n+28>>2],d[i+40>>2]=d[n+24>>2],d[i+44>>2]=s,s=d[n+20>>2],d[i+32>>2]=d[n+16>>2],d[i+36>>2]=s,s=d[n+44>>2],d[i+56>>2]=d[n+40>>2],d[i+60>>2]=s,s=d[n+36>>2],d[i+48>>2]=d[n+32>>2],d[i+52>>2]=s,s=d[n+60>>2],d[o+8>>2]=d[n+56>>2],d[o+12>>2]=s,s=d[n+52>>2],d[o>>2]=d[n+48>>2],d[o+4>>2]=s,n=d[n+64>>2],n=0|r[d[d[n>>2]+28>>2]](n),d[i+8>>2]=d[n+8>>2],s=d[n+4>>2],d[i>>2]=d[n>>2],d[i+4>>2]=s,c=m[e+80>>2],h=m[t+4>>2],_=m[e+76>>2],u=m[t>>2],m[i+8>>2]=y(m[i+8>>2]*m[t+8>>2])/m[e+84>>2],d[i+12>>2]=0,m[i>>2]=y(u*m[i>>2])/_,m[i+4>>2]=y(h*m[i+4>>2])/c,n=d[64+(d[e+24>>2]+a|0)>>2],r[d[d[n>>2]+24>>2]](n,i),c=m[e+76>>2],h=m[t>>2],_=m[e+80>>2],u=m[t+4>>2],p=m[e+84>>2],f=m[t+8>>2],d[i+76>>2]=0,m[i+72>>2]=y(f*m[i+72>>2])/p,m[i+68>>2]=y(u*m[i+68>>2])/_,m[i+64>>2]=y(h*m[i+64>>2])/c,s=d[i+20>>2],n=d[e+24>>2]+a|0,d[n>>2]=d[i+16>>2],d[n+4>>2]=s,s=d[i+28>>2],d[n+8>>2]=d[i+24>>2],d[n+12>>2]=s,s=d[i+44>>2],d[n+24>>2]=d[i+40>>2],d[n+28>>2]=s,s=d[i+36>>2],d[n+16>>2]=d[i+32>>2],d[n+20>>2]=s,s=d[i+60>>2],d[n+40>>2]=d[i+56>>2],d[n+44>>2]=s,s=d[i+52>>2],d[n+32>>2]=d[i+48>>2],d[n+36>>2]=s,s=d[o+12>>2],d[n+56>>2]=d[o+8>>2],d[n+60>>2]=s,s=d[o+4>>2],d[n+48>>2]=d[o>>2],d[n+52>>2]=s,d[e+64>>2]&&(n=d[64+(d[e+24>>2]+a|0)>>2],r[d[d[n>>2]+8>>2]](n,i+16|0,i+128|0,i+112|0),n=d[i+140>>2],d[i+88>>2]=d[i+136>>2],d[i+92>>2]=n,n=d[i+132>>2],d[i+80>>2]=d[i+128>>2],d[i+84>>2]=n,n=d[i+124>>2],d[i+104>>2]=d[i+120>>2],d[i+108>>2]=n,n=d[i+116>>2],d[i+96>>2]=d[i+112>>2],d[i+100>>2]=n,Qr(d[e+64>>2],d[76+(d[e+24>>2]+a|0)>>2],i+80|0)),(0|(l=l+1|0))>2];);n=d[t+4>>2],d[e+76>>2]=d[t>>2],d[e+80>>2]=n,n=d[t+12>>2],d[e+84>>2]=d[t+8>>2],d[e+88>>2]=n,r[d[d[e>>2]+68>>2]](e),O=i+144|0},r[330]=function(e){return 76+(e|=0)|0},r[331]=function(e,t,i){e|=0,t=y(t),i|=0;var n,s=y(0),o=y(0),a=y(0),l=y(0);O=n=O-96|0,d[n+44>>2]=0,d[n+48>>2]=0,d[n+56>>2]=0,d[n+60>>2]=0,d[n+52>>2]=1065353216,d[n+76>>2]=0,d[n+80>>2]=0,d[n+72>>2]=1065353216,d[n+84>>2]=0,d[n+88>>2]=0,d[n+92>>2]=0,d[n+36>>2]=0,d[n+40>>2]=0,d[n+32>>2]=1065353216,d[n+64>>2]=0,d[n+68>>2]=0,r[d[d[e>>2]+8>>2]](e,n+32|0,n+16|0,n),s=m[n+24>>2],l=m[n+8>>2],t=y(t/y(12)),o=y(y(m[n>>2]-m[n+16>>2])*y(.5)),o=y(o+o),o=y(o*o),a=y(y(m[n+4>>2]-m[n+20>>2])*y(.5)),a=y(a+a),a=y(a*a),m[i+8>>2]=t*y(o+a),s=y(y(l-s)*y(.5)),s=y(s+s),s=y(s*s),m[i+4>>2]=t*y(o+s),m[i>>2]=t*y(a+s),O=n+96|0},r[332]=function(e){return 10880},r[333]=function(e,t){e|=0,t=y(t),m[e+72>>2]=t},r[334]=function(e){return y(m[72+(e|=0)>>2])},r[335]=function(e){return 24},r[336]=function(e,t,i){var n=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0,u=0,p=0,f=0,m=0;if(Jo(e|=0,t|=0,i|=0),d[t+20>>2]=d[e+72>>2],n=d[e+16>>2],d[t+12>>2]=0,d[t+16>>2]=n,n){if(a=0|r[d[d[i>>2]+16>>2]](i,76,n),n=d[a+8>>2],d[t+12>>2]=r[d[d[i>>2]+28>>2]](i,n),d[t+16>>2]>0)for(;o=(s=b(l,80))+d[e+24>>2]|0,d[n+72>>2]=d[o+72>>2],d[n+64>>2]=r[d[d[i>>2]+28>>2]](i,d[o+64>>2]),r[d[d[i>>2]+24>>2]](i,d[64+(s+d[e+24>>2]|0)>>2])||(o=d[64+(s+d[e+24>>2]|0)>>2],_=i,u=0|r[d[d[o>>2]+52>>2]](o),p=1,h=d[d[i>>2]+16>>2],o=0|r[h](0|_,0|u,0|p),c=d[64+(s+d[e+24>>2]|0)>>2],p=i,u=o,_=0|r[d[d[c>>2]+56>>2]](c,d[o+8>>2],i),f=1346455635,m=d[64+(s+d[e+24>>2]|0)>>2],h=d[d[i>>2]+20>>2],r[h](0|p,0|u,0|_,0|f,0|m)),s=s+d[e+24>>2]|0,d[n+68>>2]=d[s+68>>2],d[n>>2]=d[s>>2],d[n+4>>2]=d[s+4>>2],d[n+8>>2]=d[s+8>>2],d[n+12>>2]=d[s+12>>2],d[n+16>>2]=d[s+16>>2],d[n+20>>2]=d[s+20>>2],d[n+24>>2]=d[s+24>>2],d[n+28>>2]=d[s+28>>2],d[n+32>>2]=d[s+32>>2],d[n+36>>2]=d[s+36>>2],d[n+40>>2]=d[s+40>>2],d[n+44>>2]=d[s+44>>2],d[n+48>>2]=d[s+48>>2],d[n+52>>2]=d[s+52>>2],d[n+56>>2]=d[s+56>>2],d[n+60>>2]=d[s+60>>2],n=n+76|0,(0|(l=l+1|0))>2];);r[d[d[i>>2]+20>>2]](i,a,10804,1497453121,d[a+8>>2])}return 10829},r[337]=function(e,t){t|=0;var i=0,n=0,s=0;if(d[68+(e|=0)>>2]=d[e+68>>2]+1,(0|(i=d[e+16>>2]))>=1)for(;n=i+-1|0,d[64+(d[e+24>>2]+b(n,80)|0)>>2]==(0|t)&&St(e,n),s=(0|i)>1,i=n,s;);r[d[d[e>>2]+68>>2]](e)},r[338]=function(e){e|=0;var t,i=y(0),n=0,s=0,o=0;if(O=t=O-32|0,d[e+48>>2]=-581039253,d[e+52>>2]=-581039253,d[e+32>>2]=1566444395,d[e+36>>2]=1566444395,d[e+56>>2]=-581039253,d[e+60>>2]=0,d[e+40>>2]=1566444395,d[e+44>>2]=0,d[e+16>>2]>=1)for(;s=d[e+24>>2]+b(n,80)|0,o=d[s+64>>2],r[d[d[o>>2]+8>>2]](o,s,t+16|0,t),i=m[t+16>>2],m[e+32>>2]>i&&(m[e+32>>2]=i),i=m[t>>2],m[e+48>>2]>2]=i),i=m[t+20>>2],m[e+36>>2]>i&&(m[e+36>>2]=i),i=m[t+4>>2],m[e+52>>2]>2]=i),i=m[t+24>>2],m[e+40>>2]>i&&(m[e+40>>2]=i),i=m[t+8>>2],m[e+56>>2]>2]=i),(0|(n=n+1|0))>2];);O=t+32|0},r[339]=gd,r[340]=z_,r[341]=w_,r[342]=function(e,t){e|=0,t|=0;var i=y(0),n=0,r=0,s=y(0);r=d[e+68>>2]<<2,i=m[r+t>>2],n=r,r=e+12|0,s=y(m[e+60>>2]*y(i/m[n+r>>2])),m[e+60>>2]=s,n=d[e+64>>2]<<2,i=y(m[n+t>>2]/m[r+n>>2]),n=d[e+72>>2]<<2,i=y(m[e+56>>2]*y(y(i+y(m[n+t>>2]/m[r+n>>2]))*y(.5))),m[e+56>>2]=i,m[e+52>>2]=i/y(x(y(y(s*s)+y(i*i)))),Wa(e,t)},r[343]=function(e,t,i){e|=0,t=y(t),i|=0;var n,s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);O=n=O-96|0,d[n+44>>2]=0,d[n+48>>2]=0,d[n+56>>2]=0,d[n+60>>2]=0,d[n+52>>2]=1065353216,d[n+76>>2]=0,d[n+80>>2]=0,d[n+72>>2]=1065353216,d[n+84>>2]=0,d[n+88>>2]=0,d[n+92>>2]=0,d[n+36>>2]=0,d[n+40>>2]=0,d[n+32>>2]=1065353216,d[n+64>>2]=0,d[n+68>>2]=0,r[d[d[e>>2]+8>>2]](e,n+32|0,n+16|0,n),l=m[n+24>>2],c=m[n+8>>2],o=m[n+16>>2],a=m[n>>2],h=m[n+20>>2],_=m[n+4>>2],s=y(r[d[d[e>>2]+48>>2]](e)),d[i+12>>2]=0,t=y(t*y(.0833333283662796)),o=y(s+y(y(a-o)*y(.5))),o=y(o+o),o=y(o*o),a=y(s+y(y(_-h)*y(.5))),a=y(a+a),a=y(a*a),m[i+8>>2]=t*y(o+a),s=y(s+y(y(c-l)*y(.5))),s=y(s+s),s=y(s*s),m[i+4>>2]=t*y(o+s),m[i>>2]=t*y(a+s),O=n+96|0},r[344]=function(e){return 11276},r[345]=function(e,t){d[8+(e|=0)>>2]=0,d[e+12>>2]=0,d[e>>2]=0,d[e+4>>2]=1065353216},r[346]=vd,r[347]=function(e,t,i){return Jo(e|=0,t|=0,i|=0),d[t+28>>2]=d[e+28>>2],d[t+32>>2]=d[e+32>>2],d[t+36>>2]=d[e+36>>2],d[t+40>>2]=d[e+40>>2],d[t+12>>2]=d[e+12>>2],d[t+16>>2]=d[e+16>>2],d[t+20>>2]=d[e+20>>2],d[t+24>>2]=d[e+24>>2],d[t+44>>2]=d[e+44>>2],d[t+52>>2]=d[e+68>>2],11281},r[348]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),s=y(0),o=y(0),a=y(0),l=y(0);dr(e,t,i),y(r[d[d[t>>2]+48>>2]](t))!=y(0)&&(s=m[i+4>>2],n=m[i>>2],o=m[i+8>>2],a=y(r[d[d[t>>2]+48>>2]](t)),l=n=(t=y(y(y(n*n)+y(s*s))+y(o*o))>2]=m[e>>2]+y(a*y(l*n)),m[e+4>>2]=m[e+4>>2]+y(a*y(s*n)),m[e+8>>2]=m[e+8>>2]+y(a*y(o*n)))},r[349]=function(e,t,i){dr(e|=0,t|=0,i|=0)},r[350]=function(e,t,i,n){e|=0,t|=0,i|=0;var r,s=0,o=0,a=0;if(O=r=O-16|0,(0|(n|=0))>=1)for(;dr(r,e,(s=o<<4)+t|0),a=d[r+12>>2],d[8+(s=i+s|0)>>2]=d[r+8>>2],d[s+12>>2]=a,a=d[r+4>>2],d[s>>2]=d[r>>2],d[s+4>>2]=a,(0|(o=o+1|0))!=(0|n););O=r+16|0},r[351]=Cd,r[352]=fd,r[353]=z_,r[354]=function(e){return 11297},r[355]=function(e,t){d[8+(e|=0)>>2]=1065353216,d[e+12>>2]=0,d[e>>2]=0,d[e+4>>2]=0},r[356]=z_,r[357]=function(e){return 11303},r[358]=function(e,t){d[8+(e|=0)>>2]=0,d[e+12>>2]=0,d[e>>2]=1065353216,d[e+4>>2]=0},r[359]=Dn,r[360]=function(e){(e=Dn(e|=0))&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[361]=function(e){var t=0;return d[(e|=0)>>2]=11368,(t=d[e+120>>2])&&(u[e+124|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+120>>2]=0),d[e+120>>2]=0,s[e+124|0]=1,d[e+112>>2]=0,d[e+116>>2]=0,(t=d[e+100>>2])&&(u[e+104|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+100>>2]=0),d[e+100>>2]=0,s[e+104|0]=1,d[e+92>>2]=0,d[e+96>>2]=0,0|e},r[362]=function(e){var t=0;d[(e|=0)>>2]=11368,(t=d[e+120>>2])&&(u[e+124|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+120>>2]=0),d[e+120>>2]=0,s[e+124|0]=1,d[e+112>>2]=0,d[e+116>>2]=0,(t=d[e+100>>2])&&(u[e+104|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+100>>2]=0),d[e+100>>2]=0,s[e+104|0]=1,d[e+92>>2]=0,d[e+96>>2]=0,e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[363]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0);s=y(r[d[d[e>>2]+48>>2]](e)),I=m[t+52>>2],l=m[t+24>>2],c=m[t+20>>2],h=m[t+56>>2],_=m[t+40>>2],u=m[e+60>>2],b=m[e+76>>2],A=m[t+36>>2],o=m[e+56>>2],C=m[e+72>>2],M=m[t+48>>2],S=m[t+8>>2],x=m[t>>2],T=m[t+4>>2],E=m[t+16>>2],R=m[t+32>>2],a=m[e+52>>2],P=m[e+68>>2],d[i+12>>2]=0,p=h,h=y(y(P+a)*y(.5)),f=y(y(C+o)*y(.5)),g=y(y(b+u)*y(.5)),p=y(p+y(y(y(R*h)+y(A*f))+y(_*g))),a=y(s+y(y(P-a)*y(.5))),o=y(s+y(y(C-o)*y(.5))),s=y(s+y(y(b-u)*y(.5))),_=y(y(y(a*y(v(R)))+y(o*y(v(A))))+y(s*y(v(_)))),m[i+8>>2]=p-_,u=y(I+y(y(y(h*E)+y(f*c))+y(g*l))),l=y(y(y(a*y(v(E)))+y(o*y(v(c))))+y(s*y(v(l)))),m[i+4>>2]=u-l,c=y(M+y(y(y(h*x)+y(f*T))+y(g*S))),s=y(y(y(a*y(v(x)))+y(o*y(v(T))))+y(s*y(v(S)))),m[i>>2]=c-s,d[n+12>>2]=0,m[n+8>>2]=_+p,m[n+4>>2]=l+u,m[n>>2]=s+c},r[364]=function(e,t){e|=0,t|=0;var i=y(0),n=y(0),r=y(0);i=m[t>>2],n=m[t+4>>2],r=m[t+8>>2],d[e+24>>2]=0,m[e+20>>2]=v(r),m[e+16>>2]=v(n),m[e+12>>2]=v(i),qn(e)},r[365]=function(e,t,i){e|=0,t=y(t),i|=0;var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0);n=m[e+76>>2],o=m[e+60>>2],r=m[e+72>>2],a=m[e+56>>2],s=m[e+68>>2],l=m[e+52>>2],d[i+12>>2]=0,t=y(t/y(12)),s=y(y(s-l)*y(.5)),s=y(s+s),s=y(s*s),r=y(y(r-a)*y(.5)),r=y(r+r),r=y(r*r),m[i+8>>2]=t*y(s+r),n=y(y(n-o)*y(.5)),n=y(n+n),n=y(n*n),m[i+4>>2]=t*y(s+n),m[i>>2]=t*y(r+n)},r[366]=function(e){return 11536},r[367]=function(e){return 64},r[368]=function(e,t,i){var n,s=0,o=0,a=0,l=0;if(Jo(e|=0,t|=0,i|=0),d[t+28>>2]=d[e+28>>2],d[t+32>>2]=d[e+32>>2],d[t+36>>2]=d[e+36>>2],d[t+40>>2]=d[e+40>>2],d[t+12>>2]=d[e+12>>2],d[t+16>>2]=d[e+16>>2],d[t+20>>2]=d[e+20>>2],d[t+24>>2]=d[e+24>>2],d[t+44>>2]=d[e+44>>2],n=d[e+92>>2]){if(s=0|r[d[d[i>>2]+28>>2]](i,d[e+100>>2]),d[t+56>>2]=n,d[t+52>>2]=s,o=0|r[d[d[i>>2]+16>>2]](i,20,n),a=d[e+100>>2],(0|n)>=1)for(l=d[e+120>>2],e=d[o+8>>2],t=0;s=(t<<4)+a|0,d[e>>2]=d[s>>2],d[e+4>>2]=d[s+4>>2],d[e+8>>2]=d[s+8>>2],d[e+12>>2]=d[s+12>>2],d[e+16>>2]=d[(t<<2)+l>>2],e=e+20|0,(0|n)!=(0|(t=t+1|0)););return r[d[d[i>>2]+20>>2]](i,o,11460,1497453121,a),11480}return d[t+52>>2]=0,d[t+56>>2]=0,11480},r[369]=function(e,t,i){e|=0,t|=0,i|=0;var n,s,o=0,a=y(0),l=0,c=0,h=y(0),_=y(0),u=y(0),p=y(0),f=0,g=y(0),b=y(0),v=0,A=0,C=0,S=y(0),T=y(0),E=y(0),R=y(0),P=y(0);if(O=n=O-2048|0,d[e>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,a=m[i>>2],u=m[i+4>>2],h=m[i+8>>2],_=y(y(y(a*a)+y(u*u))+y(h*h)),p=y(1),_>2]))>=1)for(i=d[t+100>>2],v=d[t+120>>2],h=y(-0xde0b6b000000000),f=s;;){e:if((0|(c=s-A|0))>0){for(C=(0|(o=(0|f)<128?f:128))>1?o:1,o=0;p=m[i>>2],S=m[t+12>>2],T=m[i+4>>2],E=m[t+16>>2],R=m[i+8>>2],a=m[v>>2],P=m[t+20>>2],_=y(r[d[d[t>>2]+48>>2]](t)),d[12+(l=(o<<4)+n|0)>>2]=0,m[l+8>>2]=y(R+y(a*y(g*P)))-y(g*_),m[l+4>>2]=y(T+y(a*y(b*E)))-y(b*_),m[l>>2]=y(p+y(a*y(u*S)))-y(u*_),v=v+4|0,i=i+16|0,(0|C)!=(0|(o=o+1|0)););if(l=0,o=-1,a=y(-34028234663852886e22),(0|c)<1)break e;for(C=(0|c)<128?c:128;a=(c=(_=y(y(y(u*m[(c=(l<<4)+n|0)>>2])+y(b*m[c+4>>2]))+y(g*m[c+8>>2])))>a)?_:a,o=c?l:o,(0|C)!=(0|(l=l+1|0)););}else a=y(-34028234663852886e22),o=-1;if(a>h&&(l=d[12+(o=(o<<4)+n|0)>>2],d[e+8>>2]=d[o+8>>2],d[e+12>>2]=l,l=d[o+4>>2],d[e>>2]=d[o>>2],d[e+4>>2]=l,h=a),f=f+-128|0,!((0|s)>(0|(A=A+128|0))))break}O=n+2048|0},r[370]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=0,a=0,l=0,c=0,h=0,_=0,u=y(0),p=0,f=y(0),g=0,b=0,v=0,A=y(0),C=y(0),S=y(0),x=0,T=0,E=0,R=y(0),P=y(0),I=y(0),M=0,D=y(0),w=y(0),F=0,B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0);if(O=s=O-2048|0,(0|n)>=1)for(;;){if((0|(g=d[e+92>>2]))>=1)for(b=(l=x<<4)+i|0,T=c=t+l|0,_=d[e+100>>2],E=d[e+120>>2],I=y(-0xde0b6b000000000),v=0,l=g;;){if(u=y(-34028234663852886e22),h=-1,!(M=(0|(p=g-v|0))<1)){for(F=(0|(o=(0|l)<128?l:128))>1?o:1,A=m[T+8>>2],C=m[c+4>>2],S=m[c>>2],o=0;B=m[_>>2],N=m[e+12>>2],L=m[_+4>>2],k=m[e+16>>2],V=m[_+8>>2],R=m[E>>2],U=m[e+20>>2],P=y(r[d[d[e>>2]+48>>2]](e)),f=m[c>>2],D=m[c+4>>2],w=m[T+8>>2],d[12+(a=(o<<4)+s|0)>>2]=0,m[a+8>>2]=y(V+y(R*y(A*U)))-y(P*w),m[a+4>>2]=y(L+y(R*y(C*k)))-y(P*D),m[a>>2]=y(B+y(R*y(S*N)))-y(P*f),E=E+4|0,_=_+16|0,A=w,C=D,S=f,(0|F)!=(0|(o=o+1|0)););if(!M)for(p=(0|p)<128?p:128,A=m[T+8>>2],C=m[c+4>>2],S=m[c>>2],o=0;u=(a=(f=y(y(y(S*m[(a=(o<<4)+s|0)>>2])+y(C*m[a+4>>2]))+y(A*m[a+8>>2])))>u)?f:u,h=a?o:h,(0|p)!=(0|(o=o+1|0)););}if(u>I&&(h=d[12+(o=(h<<4)+s|0)>>2],d[b+8>>2]=d[o+8>>2],d[b+12>>2]=h,h=d[o+4>>2],d[b>>2]=d[o>>2],d[b+4>>2]=h,I=u),l=l+-128|0,!((0|g)>(0|(v=v+128|0))))break}if((0|(x=x+1|0))==(0|n))break}O=s+2048|0},r[371]=z_,r[372]=ns,r[373]=function(e,t,i){e|=0,t=y(t),i|=0;var n=y(0),s=y(0);n=y(r[d[d[e>>2]+48>>2]](e)),s=y(r[d[d[e>>2]+48>>2]](e)),d[i+12>>2]=0,t=y(s*y(n*y(t*y(.4000000059604645)))),m[i+8>>2]=t,m[i+4>>2]=t,m[i>>2]=t},r[374]=function(e){return 11676},r[375]=rd,r[376]=function(e){return y(y(m[28+(e|=0)>>2]*m[e+12>>2]))},r[377]=function(e,t,i){e|=0,t|=0,i|=0;var n,s=y(0),o=y(0),a=y(0),l=0,c=y(0),h=y(0);O=n=O-16|0,r[d[d[t>>2]+68>>2]](n,t,i),l=d[n+12>>2],d[e+8>>2]=d[n+8>>2],d[e+12>>2]=l,l=d[n+4>>2],d[e>>2]=d[n>>2],d[e+4>>2]=l,o=m[i+4>>2],s=m[i>>2],a=m[i+8>>2],c=y(r[d[d[t>>2]+48>>2]](t)),h=s=(t=y(y(y(s*s)+y(o*o))+y(a*a))>2]=m[e>>2]+y(c*y(h*s)),m[e+4>>2]=m[e+4>>2]+y(c*y(o*s)),m[e+8>>2]=m[e+8>>2]+y(c*y(a*s)),O=n+16|0},r[378]=function(e,t,i){d[(e|=0)>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0},r[379]=function(e,t,i,n){(0|(n|=0))>=1&&Mn(i|=0,0,n<<4)},r[380]=function(e){var t=0;return d[(e|=0)>>2]=11692,u[e+61|0]&&(t=d[e+52>>2],r[d[d[t>>2]>>2]](t),(t=d[e+52>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),0|e},r[381]=function(e){var t=0;d[(e|=0)>>2]=11692,u[e+61|0]&&(t=d[e+52>>2],r[d[d[t>>2]>>2]](t),(t=d[e+52>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[382]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=y(0),N=y(0);g=m[e+24>>2],T=m[e+40>>2],E=m[e+20>>2],R=m[e+36>>2],a=m[e+16>>2],P=m[e+32>>2],I=y(r[d[d[e>>2]+48>>2]](e)),M=y(r[d[d[e>>2]+48>>2]](e)),D=y(r[d[d[e>>2]+48>>2]](e)),O=m[t+52>>2],l=m[t+24>>2],c=m[t+20>>2],h=m[t+56>>2],_=m[e+20>>2],u=m[e+36>>2],b=m[e+24>>2],w=m[e+40>>2],p=m[t+40>>2],s=m[t+36>>2],F=m[t+48>>2],A=m[t+8>>2],C=m[t>>2],S=m[t+4>>2],x=m[t+16>>2],B=m[e+16>>2],N=m[e+32>>2],o=m[t+32>>2],d[i+12>>2]=0,f=h,h=y(y(N+B)*y(.5)),_=y(y(u+_)*y(.5)),u=y(y(w+b)*y(.5)),b=y(f+y(y(y(o*h)+y(s*_))+y(p*u))),a=y(I+y(y(P-a)*y(.5))),f=y(a*y(v(o))),o=y(M+y(y(R-E)*y(.5))),f=y(f+y(o*y(v(s)))),s=y(D+y(y(T-g)*y(.5))),p=y(f+y(s*y(v(p)))),m[i+8>>2]=b-p,g=y(O+y(y(y(h*x)+y(_*c))+y(u*l))),l=y(y(y(a*y(v(x)))+y(o*y(v(c))))+y(s*y(v(l)))),m[i+4>>2]=g-l,c=y(F+y(y(y(h*C)+y(_*S))+y(u*A))),s=y(y(y(a*y(v(C)))+y(o*y(v(S))))+y(s*y(v(A)))),m[i>>2]=c-s,d[n+12>>2]=0,m[n+8>>2]=p+b,m[n+4>>2]=l+g,m[n>>2]=s+c},r[383]=function(e,t){e|=0,t|=0;var i=y(0),n=0,o=y(0);n=0|r[d[d[e>>2]+28>>2]](e),i=y(m[n>>2]-m[t>>2]),o=y(i*i),i=y(m[n+4>>2]-m[t+4>>2]),o=y(o+y(i*i)),i=y(m[n+8>>2]-m[t+8>>2]),y(o+y(i*i))>y(1.1920928955078125e-7)&&(za(e,t),u[e+61|0]&&(t=d[e+52>>2],r[d[d[t>>2]>>2]](t),(t=d[e+52>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),d[7717]=d[7717]+1,n=nd(t=0|r[d[6606]](172,16)),d[e+52>>2]=t,oe(n,d[e+48>>2],u[e+60|0],e+16|0,e+32|0),s[e+61|0]=1)},r[384]=function(e){return d[48+(e|=0)>>2]+4|0},r[385]=kh,r[386]=function(e){return 12300},r[387]=function(e,t){e|=0,t=y(t),m[e+12>>2]=t},r[388]=function(e){return y(m[12+(e|=0)>>2])},r[389]=vd,r[390]=function(e,t,i){var n=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0;Jo(e|=0,t|=0,i|=0),n=d[e+48>>2],r[d[d[n>>2]+56>>2]](n,t+12|0,i),d[t+52>>2]=d[e+12>>2];e:if(!d[e+52>>2]||1&r[d[d[i>>2]+52>>2]](i))d[t+40>>2]=0,d[t+44>>2]=0;else{if(n=0|r[d[d[i>>2]+24>>2]](i,d[e+52>>2])){d[t+44>>2]=0,d[t+40>>2]=n;break e}n=0|r[d[d[i>>2]+28>>2]](i,d[e+52>>2]),d[t+44>>2]=0,d[t+40>>2]=n,n=d[e+52>>2],a=i,l=0|r[d[d[n>>2]+12>>2]](n),c=1,o=d[d[i>>2]+16>>2],n=0|r[o](0|a,0|l,0|c),s=d[e+52>>2],c=i,l=n,a=0|r[d[d[s>>2]+16>>2]](s,d[n+8>>2],i),h=1213612625,_=d[e+52>>2],o=d[d[i>>2]+20>>2],r[o](0|c,0|l,0|a,0|h,0|_)}return!d[e+56>>2]||2&r[d[d[i>>2]+52>>2]](i)?(d[t+48>>2]=0,11776):(n=0|r[d[d[i>>2]+24>>2]](i,d[e+56>>2]))?(d[t+48>>2]=n,11776):(d[t+48>>2]=r[d[d[i>>2]+28>>2]](i,d[e+56>>2]),t=d[e+56>>2],_=i,h=0|r[d[d[t>>2]+8>>2]](t),a=1,o=d[d[i>>2]+16>>2],t=0|r[o](0|_,0|h,0|a),n=d[e+56>>2],a=i,h=t,_=0|r[d[d[n>>2]+12>>2]](n,d[t+8>>2],i),l=1346456916,c=d[e+56>>2],o=d[d[i>>2]+20>>2],r[o](0|a,0|h,0|_,0|l,0|c),11776)},r[391]=function(e,t,i,n){var r,s;t|=0,i|=0,n|=0,O=r=O+-64|0,s=d[48+(e|=0)>>2],d[r+8>>2]=t,d[r+4>>2]=s,d[r>>2]=12164,wt(d[e+52>>2],r,i,n),O=r- -64|0},r[392]=function(e,t,i){e|=0,t|=0,i|=0;var n,s=0,o=y(0),a=y(0),l=y(0),c=y(0);O=n=O-160|0,d[n+152>>2]=0,d[n+144>>2]=0,d[n+148>>2]=0,d[n+136>>2]=0,d[n+140>>2]=0,d[n+44>>2]=0,d[n+48>>2]=0,d[n+56>>2]=0,d[n+60>>2]=0,d[(s=n- -64|0)>>2]=0,d[s+4>>2]=0,d[n+76>>2]=0,d[n+80>>2]=0,d[n+72>>2]=1065353216,d[n+84>>2]=0,d[n+88>>2]=0,d[n+92>>2]=1065353216,d[n+96>>2]=0,s=d[n+144>>2],d[n+100>>2]=d[n+140>>2],d[n+104>>2]=s,s=d[n+152>>2],d[n+108>>2]=d[n+148>>2],d[n+112>>2]=s,d[n+36>>2]=0,d[n+40>>2]=0,d[n+32>>2]=12580,d[n+52>>2]=1065353216,d[n+116>>2]=-581039253,o=m[i+4>>2],a=m[i>>2],l=m[i+8>>2],d[n+132>>2]=0,c=y(l*y(0)),m[n+124>>2]=y(o+y(a*m[n+56>>2]))+c,o=y(o*y(0)),m[n+128>>2]=l+y(y(a*m[n+60>>2])+o),m[n+120>>2]=y(a+o)+c,d[n+24>>2]=1566444395,d[n+28>>2]=0,d[n+16>>2]=1566444395,d[n+20>>2]=1566444395,d[n+8>>2]=-581039253,d[n+12>>2]=0,d[n>>2]=-581039253,d[n+4>>2]=-581039253,r[d[d[t>>2]+64>>2]](t,n+32|0,n,n+16|0),t=d[n+48>>2],d[e+8>>2]=d[n+44>>2],d[e+12>>2]=t,t=d[n+40>>2],d[e>>2]=d[n+36>>2],d[e+4>>2]=t,O=n+160|0},r[393]=function(e,t,i){e|=0,i|=0,r[d[d[(t|=0)>>2]+68>>2]](e,t,i)},r[394]=function(e,t){t|=0;var i=0,n=0,s=0,o=0,a=0,l=0,c=0,h=0;(i=d[52+(e|=0)>>2])&&(o=t,a=0|r[d[d[i>>2]+12>>2]](i),l=1,s=d[d[t>>2]+16>>2],i=0|r[s](0|o,0|a,0|l),n=d[e+52>>2],l=t,a=i,o=0|r[d[d[n>>2]+16>>2]](n,d[i+8>>2],t),c=1213612625,h=d[e+52>>2],s=d[d[t>>2]+20>>2],r[s](0|l,0|a,0|o,0|c,0|h))},r[395]=function(e,t){t|=0;var i=0,n=0,s=0,o=0,a=0,l=0,c=0,h=0;(i=d[56+(e|=0)>>2])&&(o=t,a=0|r[d[d[i>>2]+8>>2]](i),l=1,s=d[d[t>>2]+16>>2],i=0|r[s](0|o,0|a,0|l),n=d[e+56>>2],l=t,a=i,o=0|r[d[d[n>>2]+12>>2]](n,d[i+8>>2],t),c=1346456916,h=d[e+56>>2],s=d[d[t>>2]+20>>2],r[s](0|l,0|a,0|o,0|c,0|h))},r[396]=gd,r[397]=Pd,r[398]=pi,r[399]=Pd,r[400]=pi,r[401]=Pd,r[402]=function(e,t,i){e|=0,t|=0,i|=0;var n,s,o,a,l,c=0,h=0,_=0,f=y(0),v=y(0),A=y(0),C=y(0),S=0,x=0;O=n=O-32|0,h=d[e+4>>2],r[d[d[h>>2]+16>>2]](h,n+28|0,n+24|0,n+20|0,n+16|0,n+12|0,n+8|0,n+4|0,n,t),o=d[n+12>>2]+b(d[n+8>>2],i)|0,a=d[n+20>>2],h=(s=d[e+4>>2])+12|0,c=_=d[n+28>>2];e:{t:{i:{n:switch((S=d[n>>2])+-2|0){case 0:break i;case 1:break n;default:break t}x=p[o+4>>1];break e}x=d[o+8>>2];break e}x=u[o+2|0]}l=d[n+16>>2],c=c+b(x,l)|0,a?(f=y(m[s+8>>2]*y(g[c+8>>3])),v=y(m[s+4>>2]*y(g[c>>3])),A=y(g[c+16>>3]),c=h):(f=y(m[c+4>>2]*m[s+8>>2]),v=y(m[c>>2]*m[s+4>>2]),A=m[s+12>>2],c=c+8|0),C=m[c>>2],d[e+56>>2]=0,m[e+48>>2]=f,m[e+44>>2]=v,m[e+52>>2]=C*A;e:{switch(S+-2|0){case 0:c=d[o+4>>2];break e;case 1:c=p[o+2>>1];break e}c=u[o+1|0]}c=b(c,l)+_|0,a?(f=y(m[s+8>>2]*y(g[c+8>>3])),v=y(m[s+4>>2]*y(g[c>>3])),A=y(g[c+16>>3]),c=h):(f=y(m[c+4>>2]*m[s+8>>2]),v=y(m[c>>2]*m[s+4>>2]),A=m[s+12>>2],c=c+8|0),C=m[c>>2],d[e+40>>2]=0,m[e+32>>2]=f,m[e+28>>2]=v,m[e+36>>2]=C*A;e:{switch(S+-2|0){case 0:c=d[o>>2];break e;case 1:c=p[o>>1];break e}c=u[0|o]}_=b(c,l)+_|0,a?(A=y(g[_+16>>3]),f=y(m[s+8>>2]*y(g[_+8>>3])),v=y(m[s+4>>2]*y(g[_>>3]))):(h=_+8|0,A=m[s+12>>2],f=y(m[_+4>>2]*m[s+8>>2]),v=y(m[_>>2]*m[s+4>>2])),C=m[h>>2],d[e+24>>2]=0,m[e+16>>2]=f,m[e+12>>2]=v,m[e+20>>2]=C*A,h=d[e+8>>2],r[d[d[h>>2]+8>>2]](h,e+12|0,t,i),e=d[e+4>>2],r[d[d[e>>2]+24>>2]](e,t),O=n+32|0},r[403]=gd,r[404]=z_,r[405]=za,r[406]=function(e){return 12628},r[407]=Ad,r[408]=Jo,r[409]=function(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-48|0,d[s+12>>2]=t,d[s+8>>2]=12444,t=d[i+12>>2],d[s+24>>2]=d[i+8>>2],d[s+28>>2]=t,t=d[i+4>>2],d[s+16>>2]=d[i>>2],d[s+20>>2]=t,t=d[n+12>>2],d[s+40>>2]=d[n+8>>2],d[s+44>>2]=t,t=d[n+4>>2],d[s+32>>2]=d[n>>2],d[s+36>>2]=t,e=d[e+48>>2],r[d[d[e>>2]+8>>2]](e,s+8|0,i,n),O=s+48|0},r[410]=gd,r[411]=Pd,r[412]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s=0,o=y(0),a=y(0),l=y(0),c=y(0),h=0;((c=(o=m[t>>2])<(a=m[t+16>>2])?o:a)<(l=m[t+32>>2])?c:l)>m[e+24>>2]||m[(m[t+(s=(o>a^1)<<4)>>2]>l?s:32)+t>>2]>2]||((c=(o=m[t+8>>2])<(a=m[(s=t+24|0)>>2])?o:a)<(l=m[(h=t+40|0)>>2])?c:l)>m[e+32>>2]||m[(m[(s=o>a?t+8|0:s)>>2]>l?s:h)>>2]>2]||((c=(o=m[t+4>>2])<(a=m[(s=t+20|0)>>2])?o:a)<(l=m[(h=t+36|0)>>2])?c:l)>m[e+28>>2]||m[(m[(s=o>a?t+4|0:s)>>2]>l?s:h)>>2]>2]||(e=d[e+4>>2],r[d[d[e>>2]+8>>2]](e,t,i,n))},r[413]=Pd,r[414]=function(e,t,i,n){e|=0,t|=0,i|=0;var r=y(0),s=y(0),o=y(0),a=y(0),l=y(0);o=m[e+88>>2],a=m[e+92>>2],l=m[e+96>>2],(r=y(y(y(o*m[t>>2])+y(a*m[t+4>>2]))+y(l*m[t+8>>2])))>(s=m[e+84>>2])&&(m[e+84>>2]=r,i=d[t+12>>2],d[e+12>>2]=d[t+8>>2],d[e+16>>2]=i,i=d[t+4>>2],d[e+4>>2]=d[t>>2],d[e+8>>2]=i,s=r),(r=y(y(y(o*m[t+16>>2])+y(a*m[t+20>>2]))+y(l*m[t+24>>2])))>s&&(m[e+84>>2]=r,i=d[t+28>>2],d[e+12>>2]=d[t+24>>2],d[e+16>>2]=i,i=d[t+20>>2],d[e+4>>2]=d[t+16>>2],d[e+8>>2]=i,s=r),(r=y(y(y(o*m[t+32>>2])+y(a*m[t+36>>2]))+y(l*m[t+40>>2])))>s&&(m[e+84>>2]=r,i=d[t+44>>2],d[e+12>>2]=d[t+40>>2],d[e+16>>2]=i,i=d[t+36>>2],d[e+4>>2]=d[t+32>>2],d[e+8>>2]=i)},r[415]=gd,r[416]=z_,r[417]=function(e,t,i,n){n|=0,d[8+(i|=0)>>2]=-581039253,d[i+12>>2]=0,d[i>>2]=-581039253,d[i+4>>2]=-581039253,d[n+8>>2]=1566444395,d[n+12>>2]=0,d[n>>2]=1566444395,d[n+4>>2]=1566444395},r[418]=function(e,t){e|=0;var i=0;i=d[4+(t|=0)>>2],d[e+68>>2]=d[t>>2],d[e+72>>2]=i,i=d[t+12>>2],d[e+76>>2]=d[t+8>>2],d[e+80>>2]=i},r[419]=function(e){return 68+(e|=0)|0},r[420]=kh,r[421]=function(e){return 12756},r[422]=yd,r[423]=function(e,t,i){return Jo(e|=0,t|=0,i|=0),d[t+12>>2]=d[e+68>>2],d[t+16>>2]=d[e+72>>2],d[t+20>>2]=d[e+76>>2],d[t+24>>2]=d[e+80>>2],d[t+28>>2]=d[e+48>>2],d[t+32>>2]=d[e+52>>2],d[t+36>>2]=d[e+56>>2],d[t+40>>2]=d[e+60>>2],d[t+44>>2]=d[e+64>>2],12768},r[424]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0);O=s=O-48|0,_=m[n>>2],c=m[i>>2],l=y(y(_-c)*y(.5)),h=y(l*l),a=m[n+4>>2],o=m[i+4>>2],l=y(y(a-o)*y(.5)),f=y(h+y(l*l)),h=m[n+8>>2],u=m[i+8>>2],l=y(y(h-u)*y(.5)),l=y(x(y(f+y(l*l)))),h=y(y(h+u)*y(.5)),u=y(y(a+o)*y(.5)),g=y(y(_+c)*y(.5)),_=m[e+56>>2],y(v(_))>y(.7071067690849304)?(c=m[e+52>>2],a=y(y(_*_)+y(c*c)),o=y(y(1)/y(x(a))),b=y(a*o),p=y(c*o),a=m[e+48>>2],A=y(p*y(-a)),o=y(o*y(-_)),C=y(a*o)):(a=m[e+48>>2],c=m[e+52>>2],b=y(y(a*a)+y(c*c)),o=y(y(1)/y(x(b))),C=y(b*o),T=y(o*y(-c)),A=y(_*T),o=y(a*o),b=y(o*y(-_))),S=m[e+64>>2],d[s+44>>2]=0,d[s+28>>2]=0,f=h,h=y(y(y(_*h)+y(y(g*a)+y(u*c)))-S),S=y(f-y(_*h)),p=y(l*p),f=y(S-p),_=y(l*C),C=y(f-_),m[s+40>>2]=C,u=y(u-y(c*h)),o=y(l*o),E=y(u-o),c=y(l*A),A=y(E-c),m[s+36>>2]=A,p=y(p+S),m[s+24>>2]=p-_,o=y(o+u),m[s+20>>2]=o-c,d[s+12>>2]=0,a=y(g-y(a*h)),h=y(l*T),u=y(a-h),l=y(l*b),g=y(u-l),m[s+32>>2]=g,a=y(h+a),m[s+16>>2]=a-l,h=y(_+p),m[s+8>>2]=h,o=y(c+o),m[s+4>>2]=o,a=y(l+a),m[s>>2]=a,r[d[d[t>>2]+8>>2]](t,s,0,0),d[s+44>>2]=0,m[s+40>>2]=h,m[s+36>>2]=o,d[s+28>>2]=0,m[s+24>>2]=_+f,m[s+20>>2]=c+E,m[s+32>>2]=a,m[s+16>>2]=l+u,d[s+12>>2]=0,m[s+8>>2]=C,m[s+4>>2]=A,m[s>>2]=g,r[d[d[t>>2]+8>>2]](t,s,0,1),O=s+48|0},r[425]=Id,r[426]=function(e,t,i){e|=0,t=y(t),i|=0;var n,s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);O=n=O-96|0,s=y(r[d[d[e>>2]+48>>2]](e)),d[n+44>>2]=0,d[n+48>>2]=0,d[n+56>>2]=0,d[n+60>>2]=0,d[n+52>>2]=1065353216,d[n+76>>2]=0,d[n+80>>2]=0,d[n+72>>2]=1065353216,d[n+84>>2]=0,d[n+88>>2]=0,d[n+92>>2]=0,d[n+36>>2]=0,d[n+40>>2]=0,d[n+32>>2]=1065353216,d[n+64>>2]=0,d[n+68>>2]=0,r[d[d[e>>2]+8>>2]](e,n+32|0,n+16|0,n),l=m[n+24>>2],c=m[n+8>>2],o=m[n+16>>2],a=m[n>>2],h=m[n+20>>2],_=m[n+4>>2],d[i+12>>2]=0,t=y(t*y(.0833333283662796)),o=y(s+y(y(a-o)*y(.5))),o=y(o+o),o=y(o*o),a=y(s+y(y(_-h)*y(.5))),a=y(a+a),a=y(a*a),m[i+8>>2]=t*y(o+a),s=y(s+y(y(c-l)*y(.5))),s=y(s+s),s=y(s*s),m[i+4>>2]=t*y(o+s),m[i>>2]=t*y(a+s),O=n+96|0},r[427]=function(e,t,i){e|=0,t|=0,i|=0;var n,s=0,o=y(0),a=y(0),l=y(0),c=y(0),h=0,_=0,u=0,p=y(0),f=y(0),g=y(0);if(O=n=O-2048|0,d[e>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,l=m[i>>2],o=m[i+4>>2],c=m[i+8>>2],a=y(y(y(l*l)+y(o*o))+y(c*c)),p=y(1),a>2]+96>>2]](t))>=1)for(c=y(-0xde0b6b000000000);;){if(h=128,((0|r[d[d[t>>2]+96>>2]](t))-_|0)>127||(0|(h=(0|r[d[d[t>>2]+96>>2]](t))-_|0))>=1){for(i=0,s=0;r[d[d[t>>2]+108>>2]](t,s,(s<<4)+n|0),(0|h)!=(0|(s=s+1|0)););for(u=-1,o=y(-34028234663852886e22);o=(s=(l=y(y(y(a*m[(s=(i<<4)+n|0)>>2])+y(g*m[s+4>>2]))+y(f*m[s+8>>2])))>o)?l:o,u=s?i:u,(0|h)!=(0|(i=i+1|0)););}else o=y(-34028234663852886e22),u=-1;if(o>c&&(i=d[12+(s=(u<<4)+n|0)>>2],d[e+8>>2]=d[s+8>>2],d[e+12>>2]=i,i=d[s+4>>2],d[e>>2]=d[s>>2],d[e+4>>2]=i,c=o),!((0|(_=_+128|0))<(0|r[d[d[t>>2]+96>>2]](t))))break}O=n+2048|0},r[428]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=0,a=0,l=y(0),c=0,h=0,_=0,u=0,p=0,f=0,g=0,b=y(0),v=0,A=y(0),C=y(0),S=y(0);if(O=s=O-2048|0,!((0|n)<=0)){for(;d[12+((o<<4)+i|0)>>2]=-581039253,(0|(o=o+1|0))!=(0|n););if(!((0|n)<1))for(;;){if((0|r[d[d[e>>2]+96>>2]](e))>=1)for(g=h=(o=p<<4)+i|0,v=f=t+o|0,_=0;;){if(u=128,((0|r[d[d[e>>2]+96>>2]](e))-_|0)>127||(0|(u=(0|r[d[d[e>>2]+96>>2]](e))-_|0))>=1){for(o=0;r[d[d[e>>2]+108>>2]](e,o,(o<<4)+s|0),(0|u)!=(0|(o=o+1|0)););for(A=m[v+8>>2],C=m[f+4>>2],S=m[f>>2],o=0,a=-1,l=y(-34028234663852886e22);l=(c=(b=y(y(y(S*m[(c=(o<<4)+s|0)>>2])+y(C*m[c+4>>2]))+y(A*m[c+8>>2])))>l)?b:l,a=c?o:a,(0|u)!=(0|(o=o+1|0)););}else l=y(-34028234663852886e22),a=-1;if(l>m[g+12>>2]&&(a=d[12+(o=(a<<4)+s|0)>>2],d[h+8>>2]=d[o+8>>2],d[h+12>>2]=a,a=d[o+4>>2],d[h>>2]=d[o>>2],d[h+4>>2]=a,m[g+12>>2]=l),!((0|(_=_+128|0))<(0|r[d[d[e>>2]+96>>2]](e))))break}if((0|(p=p+1|0))==(0|n))break}}O=s+2048|0},r[429]=Id,r[430]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0);s=y(r[d[d[e>>2]+48>>2]](e)),I=m[t+52>>2],l=m[t+24>>2],c=m[t+20>>2],h=m[t+56>>2],_=m[t+40>>2],u=m[e- -64>>2],b=m[e+80>>2],A=m[t+36>>2],o=m[e+60>>2],C=m[e+76>>2],M=m[t+48>>2],S=m[t+8>>2],x=m[t>>2],T=m[t+4>>2],E=m[t+16>>2],R=m[t+32>>2],a=m[e+56>>2],P=m[e+72>>2],d[i+12>>2]=0,p=h,h=y(y(P+a)*y(.5)),f=y(y(C+o)*y(.5)),g=y(y(b+u)*y(.5)),p=y(p+y(y(y(R*h)+y(A*f))+y(_*g))),a=y(s+y(y(P-a)*y(.5))),o=y(s+y(y(C-o)*y(.5))),s=y(s+y(y(b-u)*y(.5))),_=y(y(y(a*y(v(R)))+y(o*y(v(A))))+y(s*y(v(_)))),m[i+8>>2]=p-_,u=y(I+y(y(y(h*E)+y(f*c))+y(g*l))),l=y(y(y(a*y(v(E)))+y(o*y(v(c))))+y(s*y(v(l)))),m[i+4>>2]=u-l,c=y(M+y(y(y(h*x)+y(f*T))+y(g*S))),s=y(y(y(a*y(v(x)))+y(o*y(v(T))))+y(s*y(v(S)))),m[i>>2]=c-s,d[n+12>>2]=0,m[n+8>>2]=_+p,m[n+4>>2]=l+u,m[n>>2]=s+c},r[431]=function(e,t){Wa(e|=0,t|=0),Qn(e)},r[432]=gd,r[433]=z_,r[434]=ns,r[435]=function(e,t){e|=0;var i=0;i=d[4+(t|=0)>>2],d[e+16>>2]=d[t>>2],d[e+20>>2]=i,i=d[t+12>>2],d[e+24>>2]=d[t+8>>2],d[e+28>>2]=i},r[436]=function(e){return 16+(e|=0)|0},r[437]=pd,r[438]=function(e){return 13252},r[439]=td,r[440]=Id,r[441]=Id,r[442]=Id,r[443]=function(e){var t;return d[(e|=0)>>2]=13728,(t=d[e+104>>2])&&(u[e+108|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+104>>2]=0),d[e+104>>2]=0,s[e+108|0]=1,d[e+96>>2]=0,d[e+100>>2]=0,Ha(e),0|e},r[444]=function(e){var t;d[(e|=0)>>2]=13728,(t=d[e+104>>2])&&(u[e+108|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+104>>2]=0),d[e+104>>2]=0,s[e+108|0]=1,d[e+96>>2]=0,d[e+100>>2]=0,Ha(e),e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[445]=function(e,t){e|=0;var i=0;i=d[4+(t|=0)>>2],d[e+12>>2]=d[t>>2],d[e+16>>2]=i,i=d[t+12>>2],d[e+20>>2]=d[t+8>>2],d[e+24>>2]=i,Qn(e)},r[446]=function(e){return 13932},r[447]=function(e){return 68},r[448]=function(e,t,i){var n,s=0,o=0,a=0;if(Jo(e|=0,t|=0,i|=0),d[t+28>>2]=d[e+28>>2],d[t+32>>2]=d[e+32>>2],d[t+36>>2]=d[e+36>>2],d[t+40>>2]=d[e+40>>2],d[t+12>>2]=d[e+12>>2],d[t+16>>2]=d[e+16>>2],d[t+20>>2]=d[e+20>>2],d[t+24>>2]=d[e+24>>2],d[t+44>>2]=d[e+44>>2],n=d[e+96>>2],d[t+60>>2]=n,n){if(s=0|r[d[d[i>>2]+28>>2]](i,d[e+104>>2]),d[t+56>>2]=0,d[t+52>>2]=s,s=0|r[d[d[i>>2]+16>>2]](i,16,n),a=d[e+104>>2],(0|n)>=1)for(t=d[s+8>>2];e=(o<<4)+a|0,d[t>>2]=d[e>>2],d[t+4>>2]=d[e+4>>2],d[t+8>>2]=d[e+8>>2],d[t+12>>2]=d[e+12>>2],t=t+16|0,(0|(o=o+1|0))!=(0|n););return r[d[d[i>>2]+20>>2]](i,s,13856,1497453121,a),13875}return d[t+52>>2]=0,d[t+56>>2]=0,13875},r[449]=kr,r[450]=function(e,t,i){e|=0,t|=0,i|=0;var n,r=0,s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=0,u=y(0),p=y(0);if((0|(n=d[t+96>>2]))>=1){for(l=m[t+12>>2],o=y(m[i>>2]*l),c=m[t+20>>2],a=y(m[i+8>>2]*c),h=m[t+16>>2],p=y(m[i+4>>2]*h),_=d[t+104>>2],t=0,i=-1,s=y(-34028234663852886e22);s=(r=(u=y(y(y(o*m[(r=(t<<4)+_|0)>>2])+y(p*m[r+4>>2]))+y(a*m[r+8>>2])))>s)?u:s,i=r?t:i,(0|n)!=(0|(t=t+1|0)););return s=m[(t=(i<<4)+_|0)>>2],o=m[t+4>>2],a=m[t+8>>2],d[e+12>>2]=0,m[e+8>>2]=c*a,m[e+4>>2]=h*o,void(m[e>>2]=l*s)}d[e>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0},r[451]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var r=0,s=0,o=0,a=y(0),l=0,c=0,h=y(0),_=y(0),u=0,p=y(0),f=y(0),g=y(0),b=0,v=y(0),A=y(0);if(!((0|n)<=0)){for(;d[12+((r<<4)+i|0)>>2]=-581039253,(0|(r=r+1|0))!=(0|n););if(!((0|n)<1))for(;;){if(c=l<<4,(0|(u=d[e+96>>2]))<1)a=y(-0xde0b6b000000000);else{for(r=t+c|0,p=m[e+20>>2],h=y(m[r+8>>2]*p),f=m[e+16>>2],_=y(m[r+4>>2]*f),g=m[e+12>>2],A=y(m[r>>2]*g),b=d[e+104>>2],r=0,s=-1,a=y(-34028234663852886e22);a=(o=(v=y(y(y(A*m[(o=(r<<4)+b|0)>>2])+y(_*m[o+4>>2]))+y(h*m[o+8>>2])))>a)?v:a,s=o?r:s,(0|u)!=(0|(r=r+1|0)););h=m[(r=(s<<4)+b|0)>>2],_=m[r+4>>2],m[8+(s=i+c|0)>>2]=m[r+8>>2]*p,m[s+4>>2]=_*f,m[s>>2]=h*g}if(m[12+(i+c|0)>>2]=a,(0|(l=l+1|0))==(0|n))break}}},r[452]=cd,r[453]=cd,r[454]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var r,s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);s=d[e+96>>2],r=d[e+104>>2]+((0|t)%(0|s)<<4)|0,o=m[r>>2],a=m[r+4>>2],l=m[r+8>>2],c=m[e+16>>2],h=m[e+20>>2],_=m[e+12>>2],d[i+12>>2]=0,m[i+8>>2]=l*h,m[i+4>>2]=a*c,m[i>>2]=o*_,t=d[e+104>>2]+((t+1|0)%(0|s)<<4)|0,o=m[t>>2],a=m[t+4>>2],l=m[t+8>>2],c=m[e+16>>2],h=m[e+20>>2],_=m[e+12>>2],d[n+12>>2]=0,m[n+8>>2]=l*h,m[n+4>>2]=a*c,m[n>>2]=o*_},r[455]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0);t=d[e+104>>2]+(t<<4)|0,n=m[t>>2],r=m[t+4>>2],s=m[t+8>>2],o=m[e+16>>2],a=m[e+20>>2],l=m[e+12>>2],d[i+12>>2]=0,m[i+8>>2]=s*a,m[i+4>>2]=r*o,m[i>>2]=n*l},r[456]=Cd,r[457]=td,r[458]=K_,r[459]=function(e,t,i,n,r,s,o){e|=0,t|=0,i|=0,n|=0,r|=0,s|=0,o|=0;var a,l,c=y(0),h=y(0),_=0,u=0,p=y(0),f=y(0),g=y(0);if(a=O-16|0,d[n>>2]=2139095039,_=-8388609,d[r>>2]=-8388609,l=d[e+96>>2],c=y(-34028234663852886e22),!((0|l)<1)){for(_=0;u=d[e+104>>2]+(_<<4)|0,c=y(m[u>>2]*m[e+12>>2]),h=y(m[u+4>>2]*m[e+16>>2]),p=y(m[u+8>>2]*m[e+20>>2]),f=y(y(y(y(c*m[t>>2])+y(h*m[t+4>>2]))+y(p*m[t+8>>2]))+m[t+48>>2]),g=y(y(y(y(c*m[t+16>>2])+y(h*m[t+20>>2]))+y(p*m[t+24>>2]))+m[t+52>>2]),h=y(y(y(y(c*m[t+32>>2])+y(h*m[t+36>>2]))+y(p*m[t+40>>2]))+m[t+56>>2]),(c=y(y(y(f*m[i>>2])+y(g*m[i+4>>2]))+y(h*m[i+8>>2])))>2]&&(m[n>>2]=c,d[s+12>>2]=0,m[s+8>>2]=h,m[s+4>>2]=g,m[s>>2]=f),c>m[r>>2]&&(m[r>>2]=c,d[o+12>>2]=0,m[o+8>>2]=h,m[o+4>>2]=g,m[o>>2]=f),(0|l)!=(0|(_=_+1|0)););_=d[r>>2],c=m[r>>2]}(h=m[n>>2])>c&&(d[n>>2]=_,m[r>>2]=h,e=d[s+12>>2],d[a+8>>2]=d[s+8>>2],d[a+12>>2]=e,e=d[s+4>>2],d[a>>2]=d[s>>2],d[a+4>>2]=e,e=d[o+12>>2],d[s+8>>2]=d[o+8>>2],d[s+12>>2]=e,e=d[o+4>>2],d[s>>2]=d[o>>2],d[s+4>>2]=e,e=d[a+12>>2],d[o+8>>2]=d[a+8>>2],d[o+12>>2]=e,e=d[a+4>>2],d[o>>2]=d[a>>2],d[o+4>>2]=e)},r[460]=z_,r[461]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o,a=y(0),l=y(0),c=0,h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0);O=s=O-16|0,o=e+28|0,c=d[e+52>>2],a=m[o+((c+2|0)%3<<2)>>2],d[s+12>>2]=0,m[s+8>>2]=a,m[s+4>>2]=a,m[s>>2]=a,m[(c<<=2)+s>>2]=a+m[c+o>>2],a=y(r[d[d[e>>2]+48>>2]](e)),l=y(r[d[d[e>>2]+48>>2]](e)),h=y(r[d[d[e>>2]+48>>2]](e)),a=y(a+m[s>>2]),m[s>>2]=a,l=y(l+m[s+4>>2]),m[s+4>>2]=l,p=m[t+52>>2],_=m[t+20>>2],b=m[t+24>>2],f=m[t+56>>2],u=m[t+36>>2],A=m[t+40>>2],g=m[t+48>>2],C=m[t+8>>2],S=m[t>>2],x=m[t+4>>2],T=m[t+16>>2],E=m[t+32>>2],R=m[s+8>>2],d[i+12>>2]=0,h=y(h+R),u=y(y(y(a*y(v(E)))+y(l*y(v(u))))+y(h*y(v(A)))),m[i+8>>2]=f-u,_=y(y(y(a*y(v(T)))+y(l*y(v(_))))+y(h*y(v(b)))),m[i+4>>2]=p-_,a=y(y(y(a*y(v(S)))+y(l*y(v(x))))+y(h*y(v(C)))),m[i>>2]=g-a,d[n+12>>2]=0,m[n+8>>2]=f+u,m[n+4>>2]=_+p,m[n>>2]=a+g,O=s+16|0},r[462]=qr,r[463]=function(e,t,i){e|=0,t=y(t),i|=0;var n,r=y(0),s=y(0),o=y(0),a=0,l=0;n=e+28|0,l=d[e+52>>2],a=d[n+((l+2|0)%3<<2)>>2],d[12+(e=O-16|0)>>2]=0,d[e+8>>2]=a,d[e+4>>2]=a,d[e>>2]=a,m[(l=(a=l<<2)+e|0)>>2]=m[a+n>>2]+m[l>>2],r=m[e+8>>2],t=y(t*y(.0833333283662796)),s=y(m[e>>2]+y(.03999999910593033)),s=y(s+s),s=y(s*s),o=y(m[e+4>>2]+y(.03999999910593033)),o=y(o+o),o=y(o*o),m[i+8>>2]=t*y(s+o),r=y(r+y(.03999999910593033)),r=y(r+r),r=y(r*r),m[i+4>>2]=t*y(s+r),m[i>>2]=t*y(o+r)},r[464]=function(e){return 14408},r[465]=gc,r[466]=es,r[467]=vd,r[468]=function(e,t,i){return Jo(e|=0,t|=0,i|=0),d[t+28>>2]=d[e+28>>2],d[t+32>>2]=d[e+32>>2],d[t+36>>2]=d[e+36>>2],d[t+40>>2]=d[e+40>>2],d[t+12>>2]=d[e+12>>2],d[t+16>>2]=d[e+16>>2],d[t+20>>2]=d[e+20>>2],d[t+24>>2]=d[e+24>>2],d[t+44>>2]=d[e+44>>2],d[t+52>>2]=d[e+52>>2],14421},r[469]=function(e,t,i){e|=0,t|=0,i|=0;var n,s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0);O=n=O-16|0,d[e>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,a=m[i>>2],u=m[i+4>>2],o=m[i+8>>2],(l=y(y(y(a*a)+y(u*u))+y(o*o)))>2],o=m[s+((i+2|0)%3<<2)>>2],d[n+8>>2]=0,d[n+12>>2]=0,d[n>>2]=0,d[n+4>>2]=0,d[(i<<=2)+n>>2]=d[i+s>>2],f=m[n+4>>2],p=m[n>>2],u=y(-0xde0b6b000000000),b=y(h*o),c=y(b+m[n+8>>2]),_=y(r[d[d[t>>2]+48>>2]](t)),g=y(c-y(h*_)),v=y(a*o),p=y(y(p+v)-y(a*_)),c=f,f=y(l*o),_=y(y(c+f)-y(l*_)),(o=y(y(h*g)+y(y(a*p)+y(l*_))))>y(-0xde0b6b000000000)&&(d[e+12>>2]=0,m[e+8>>2]=g,m[e+4>>2]=_,m[e>>2]=p,u=o),d[n+8>>2]=0,d[n+12>>2]=0,d[n>>2]=0,d[n+4>>2]=0,i=d[t+52>>2]<<2,m[i+n>>2]=-m[28+(t+i|0)>>2],_=m[n+4>>2],g=m[n>>2],p=h,c=y(b+m[n+8>>2]),o=y(r[d[d[t>>2]+48>>2]](t)),h=y(c-y(h*o)),c=a,a=y(y(v+g)-y(a*o)),o=y(y(f+_)-y(l*o)),y(y(p*h)+y(y(c*a)+y(l*o)))>u&&(d[e+12>>2]=0,m[e+8>>2]=h,m[e+4>>2]=o,m[e>>2]=a),O=n+16|0},r[470]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=0,g=0,b=y(0),v=0,A=y(0);O=s=O-16|0,g=((o=d[e+52>>2])+2|0)%3|0;e:if(!((0|n)<1))for(b=m[28+((g<<2)+e|0)>>2],g=0;;){if(d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=0,d[s+4>>2]=0,d[(o<<=2)+s>>2]=d[28+(e+o|0)>>2],h=m[8+(o=(v=g<<4)+t|0)>>2],l=m[o+4>>2],_=m[s+8>>2],c=m[s+4>>2],A=y(-0xde0b6b000000000),u=y(m[s>>2]+y(b*m[o>>2])),a=y(r[d[d[e>>2]+48>>2]](e)),p=m[o>>2],u=y(u-y(a*p)),c=y(c+y(b*l)),l=m[o+4>>2],c=y(c-y(a*l)),_=y(_+y(b*h)),h=m[o+8>>2],_=y(_-y(a*h)),(a=y(y(y(p*u)+y(l*c))+y(h*_)))>y(-0xde0b6b000000000)&&(d[12+(f=i+v|0)>>2]=0,m[f+8>>2]=_,m[f+4>>2]=c,m[f>>2]=u,h=m[o+8>>2],l=m[o+4>>2],p=m[o>>2],A=a),d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=0,d[s+4>>2]=0,f=d[e+52>>2]<<2,m[f+s>>2]=-m[28+(e+f|0)>>2],u=m[s+4>>2],c=m[s+8>>2],p=y(m[s>>2]+y(b*p)),a=y(r[d[d[e>>2]+48>>2]](e)),_=m[o>>2],p=y(p-y(a*_)),l=y(u+y(b*l)),u=m[o+4>>2],l=y(l-y(a*u)),c=y(c+y(b*h)),h=m[o+8>>2],a=y(c-y(a*h)),y(y(y(_*p)+y(u*l))+y(h*a))>A&&(d[12+(o=i+v|0)>>2]=0,m[o+8>>2]=a,m[o+4>>2]=l,m[o>>2]=p),(0|(g=g+1|0))==(0|n))break e;o=d[e+52>>2]}O=s+16|0},r[471]=z_,r[472]=function(e){return 14440},r[473]=z_,r[474]=function(e){return 14449},r[475]=G_,r[476]=function(e,t){e|=0;var i,n=0;n=d[4+(t|=0)>>2],i=d[e+92>>2],d[i+4>>2]=d[t>>2],d[i+8>>2]=n,n=d[t+12>>2],d[i+12>>2]=d[t+8>>2],d[i+16>>2]=n,Qn(e)},r[477]=function(e){return d[92+(e|=0)>>2]+4|0},r[478]=function(e){return 14696},r[479]=kr,r[480]=function(e,t,i){e|=0,t|=0,i|=0;var n,s=y(0),o=y(0),a=y(0),h=y(0),_=0,u=0,p=0;O=n=O-80|0,d[e>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,o=m[i>>2],a=m[i+4>>2],h=m[i+8>>2],(s=y(y(y(o*o)+y(a*a))+y(h*h)))>2]),d[n+52>>2]=0,d[n+56>>2]=0,m[n+76>>2]=s,d[n+72>>2]=u,d[n+68>>2]=p,d[n+44>>2]=0,d[n+48>>2]=0,d[n+40>>2]=14640,d[n+64>>2]=_,d[n+60>>2]=-581039253,d[n+32>>2]=1566444395,d[n+36>>2]=0,d[n+24>>2]=1566444395,d[n+28>>2]=1566444395,t=d[t+92>>2],d[n+16>>2]=-581039253,d[n+20>>2]=0,d[n+8>>2]=-581039253,d[n+12>>2]=-581039253,r[d[d[t>>2]+8>>2]](t,n+40|0,n+8|0,n+24|0),t=d[n+56>>2],d[e+8>>2]=d[n+52>>2],d[e+12>>2]=t,t=d[n+48>>2],d[e>>2]=d[n+44>>2],d[e+4>>2]=t,O=n+80|0},r[481]=function(e,t,i,n){e|=0,t|=0,i|=0;var s,o=0,a=0,l=0,c=0,h=0,_=0,u=0;if(O=s=O-80|0,!((0|(n|=0))<=0)){for(;d[12+((o<<4)+i|0)>>2]=-581039253,(0|(o=o+1|0))!=(0|n););if(!((0|n)<1))for(c=s- -64|0,u=s+40|4;d[s+40>>2]=14640,d[(a=u)+8>>2]=0,d[a+12>>2]=0,d[a>>2]=0,d[a+4>>2]=0,d[s+60>>2]=-581039253,l=d[12+(o=(h=_<<4)+t|0)>>2],d[c+8>>2]=d[o+8>>2],d[c+12>>2]=l,l=d[o+4>>2],d[c>>2]=d[o>>2],d[c+4>>2]=l,d[(o=s)+32>>2]=1566444395,d[o+36>>2]=0,d[o+24>>2]=1566444395,d[o+28>>2]=1566444395,l=d[e+92>>2],d[o+16>>2]=-581039253,d[o+20>>2]=0,d[o+8>>2]=-581039253,d[o+12>>2]=-581039253,r[d[d[l>>2]+8>>2]](l,o+40|0,o+8|0,o+24|0),o=i+h|0,h=d[a+12>>2],d[o+8>>2]=d[a+8>>2],d[o+12>>2]=h,l=d[a+4>>2],d[o>>2]=d[a>>2],d[o+4>>2]=l,(0|(_=_+1|0))!=(0|n););}O=s+80|0},r[482]=Cd,r[483]=Cd,r[484]=td,r[485]=fd,r[486]=Cd,r[487]=td,r[488]=K_,r[489]=Pd,r[490]=function(e,t,i,n){e|=0,t|=0,i|=0;var r=y(0),s=y(0),o=y(0),a=y(0),l=y(0);o=m[e+24>>2],a=m[e+28>>2],l=m[e+32>>2],(r=y(y(y(o*m[t>>2])+y(a*m[t+4>>2]))+y(l*m[t+8>>2])))>(s=m[e+20>>2])&&(m[e+20>>2]=r,i=d[t+12>>2],d[e+12>>2]=d[t+8>>2],d[e+16>>2]=i,i=d[t+4>>2],d[e+4>>2]=d[t>>2],d[e+8>>2]=i,s=r),(r=y(y(y(o*m[t+16>>2])+y(a*m[t+20>>2]))+y(l*m[t+24>>2])))>s&&(m[e+20>>2]=r,i=d[t+28>>2],d[e+12>>2]=d[t+24>>2],d[e+16>>2]=i,i=d[t+20>>2],d[e+4>>2]=d[t+16>>2],d[e+8>>2]=i,s=r),(r=y(y(y(o*m[t+32>>2])+y(a*m[t+36>>2]))+y(l*m[t+40>>2])))>s&&(m[e+20>>2]=r,i=d[t+44>>2],d[e+12>>2]=d[t+40>>2],d[e+16>>2]=i,i=d[t+36>>2],d[e+4>>2]=d[t+32>>2],d[e+8>>2]=i)},r[491]=gd,r[492]=Id,r[493]=G_,r[494]=jn,r[495]=qr,r[496]=function(e,t,i){e|=0,t=y(t),i|=0;var n=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0);n=m[e+36>>2],s=m[e+32>>2],o=m[e+28>>2],a=y(r[d[d[e>>2]+48>>2]](e)),l=y(r[d[d[e>>2]+48>>2]](e)),c=y(r[d[d[e>>2]+48>>2]](e)),d[i+12>>2]=0,t=y(t/y(12)),o=y(o+a),o=y(o+o),o=y(o*o),s=y(s+l),s=y(s+s),s=y(s*s),m[i+8>>2]=t*y(o+s),n=y(n+c),n=y(n+n),n=y(n*n),m[i+4>>2]=t*y(o+n),m[i>>2]=t*y(s+n)},r[497]=function(e){return 14984},r[498]=es,r[499]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0);n=m[t+32>>2],s=m[t+36>>2],o=m[t+28>>2],a=y(r[d[d[t>>2]+48>>2]](t)),l=y(r[d[d[t>>2]+48>>2]](t)),c=y(r[d[d[t>>2]+48>>2]](t)),h=m[i>>2],_=m[i+4>>2],u=m[i+8>>2],d[e+12>>2]=0,s=y(s+c),m[e+8>>2]=u>=y(0)?s:y(-s),n=y(n+l),m[e+4>>2]=_>=y(0)?n:y(-n),n=y(o+a),m[e>>2]=h>=y(0)?n:y(-n)},r[500]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0);n=m[t+32>>2],r=m[t+36>>2],o=m[i+4>>2],a=m[i+8>>2],s=m[t+28>>2],l=m[i>>2],d[e+12>>2]=0,m[e>>2]=l>=y(0)?s:y(-s),m[e+8>>2]=a>=y(0)?r:y(-r),m[e+4>>2]=o>=y(0)?n:y(-n)},r[501]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var r=0,s=0,o=0,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0);if((0|n)>=1)for(;h=m[(r=(o=s<<4)+t|0)>>2],_=m[r+4>>2],u=m[r+8>>2],a=m[e+28>>2],l=m[e+32>>2],c=m[e+36>>2],d[12+(r=i+o|0)>>2]=0,m[r+8>>2]=u>=y(0)?c:y(-c),m[r+4>>2]=_>=y(0)?l:y(-l),m[r>>2]=h>=y(0)?a:y(-a),(0|(s=s+1|0))!=(0|n););},r[502]=Td,r[503]=function(e,t,i){e|=0,i|=0,(t|=0)>>>0<=5&&(d[i+12>>2]=0,e=t<<2,d[i+8>>2]=d[e+15036>>2],d[i+4>>2]=d[e+15012>>2],d[i>>2]=d[e+14988>>2])},r[504]=function(e){return 8},r[505]=Ad,r[506]=function(e,t,i,n){i|=0,n|=0;var s,o=0;s=e|=0,(t|=0)>>>0<=11?(o=d[15108+(t<<=2)>>2],t=d[t+15060>>2]):t=0,r[d[d[e>>2]+108>>2]](s,t,i),r[d[d[e>>2]+108>>2]](e,o,n)},r[507]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0);s=m[e+36>>2],n=m[e+32>>2],o=m[e+28>>2],a=y(r[d[d[e>>2]+48>>2]](e)),l=y(r[d[d[e>>2]+48>>2]](e)),c=y(r[d[d[e>>2]+48>>2]](e)),d[i+12>>2]=0,n=y(n+l),e=t>>>1&1,m[i+4>>2]=y(n*y(1^e))-y(n*y(0|e)),n=y(o+a),e=1&t,m[i>>2]=y(n*y(1^e))-y(n*y(0|e)),s=y(s+c),e=t>>>2&1,m[i+8>>2]=y(s*y(1^e))-y(s*y(0|e))},r[508]=Td,r[509]=function(e,t,i,n){var s,o,a;t|=0,i|=0,n|=0,O=s=O-48|0,r[d[d[(e|=0)>>2]+124>>2]](e,s+32|0,n),n=d[s+32>>2],o=d[s+36>>2],a=d[s+40>>2],d[t+12>>2]=0,d[t+8>>2]=a,d[t+4>>2]=o,d[t>>2]=n,d[s+12>>2]=0,d[s+8>>2]=-2147483648^a,d[s+4>>2]=-2147483648^o,d[s>>2]=-2147483648^n,r[d[d[e>>2]+64>>2]](s+16|0,e,s),e=d[s+28>>2],d[i+8>>2]=d[s+24>>2],d[i+12>>2]=e,e=d[s+20>>2],d[i>>2]=d[s+16>>2],d[i+4>>2]=e,O=s+48|0},r[510]=function(e,t,i){e|=0,t|=0,i=y(i);var n=y(0),r=y(0),s=0;return n=m[t>>2],r=m[e+28>>2],n<=y(r+i)^1|n>=y(y(-r)-i)^1||(n=m[t+4>>2],r=m[e+32>>2],n<=y(r+i)^1|n>=y(y(-r)-i)^1||(n=m[t+8>>2],r=m[e+36>>2],n<=y(r+i)&&(s=n>=y(y(-r)-i)))),0|s},r[511]=function(e,t,i){e|=0,t|=0,i|=0;var n=0,r=y(0),s=y(0),o=y(0);s=m[e+36>>2],o=m[e+32>>2],r=m[e+28>>2],e=1065353216,n=i;e:{t:{i:{n:{r:switch(0|i){case 1:i=0,e=-1082130432,n=0;break t;case 2:i=1065353216;break i;case 3:i=-1082130432;break i;case 4:n=1065353216;break n;case 0:break t;case 5:break r;default:break e}n=-1082130432}e=0,r=s,i=0;break t}e=0,r=o,n=0}d[t+8>>2]=n,d[t+4>>2]=i,d[t>>2]=e,m[t+12>>2]=-r}},r[512]=function(e){return Cn(e|=0),0|e},r[513]=function(e){Cn(e|=0),e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[514]=z,r[515]=bd,r[516]=function(e,t,i){e|=0,i|=0;var n=0,s=0,o=0,a=0,l=0,c=0;if(d[16+(t|=0)>>2]=d[e+20>>2],d[t+20>>2]=d[e+24>>2],d[t+24>>2]=d[e+28>>2],d[t+28>>2]=d[e+32>>2],d[t>>2]=d[e+4>>2],d[t+4>>2]=d[e+8>>2],d[t+8>>2]=d[e+12>>2],d[t+12>>2]=d[e+16>>2],d[t+32>>2]=d[e+36>>2],d[t+36>>2]=d[e+40>>2],d[t+40>>2]=d[e+44>>2],d[t+44>>2]=d[e+48>>2],d[t+48>>2]=d[e+56>>2],d[t+52>>2]=u[e+60|0],n=d[e+88>>2],d[t+56>>2]=n,n){if(n=0|r[d[d[i>>2]+28>>2]](i,d[e+96>>2]),d[t+64>>2]=n,n){if(a=d[e+88>>2],l=0|r[d[d[i>>2]+16>>2]](i,48,a),c=d[e+96>>2],(0|a)>=1)for(n=d[l+8>>2];s=c+(o<<6)|0,d[n+16>>2]=d[s+16>>2],d[n+20>>2]=d[s+20>>2],d[n+24>>2]=d[s+24>>2],d[n+28>>2]=d[s+28>>2],d[n>>2]=d[s>>2],d[n+4>>2]=d[s+4>>2],d[n+8>>2]=d[s+8>>2],d[n+12>>2]=d[s+12>>2],d[n+32>>2]=d[s+32>>2],d[n+36>>2]=d[s+36>>2],d[n+40>>2]=d[s+40>>2],n=n+48|0,(0|a)!=(0|(o=o+1|0)););r[d[d[i>>2]+20>>2]](i,l,17640,1497453121,c)}}else d[t+64>>2]=0;if(n=d[e+128>>2],d[t+60>>2]=n,n){if(n=0|r[d[d[i>>2]+28>>2]](i,d[e+136>>2]),d[t+68>>2]=n,n){if(a=d[e+128>>2],l=0|r[d[d[i>>2]+16>>2]](i,16,a),c=d[e+136>>2],(0|a)>=1)for(n=d[l+8>>2],o=0;s=c+(o<<4)|0,d[n+12>>2]=d[s+12>>2],_[n+6>>1]=p[s+6>>1],_[n+8>>1]=p[s+8>>1],_[n+10>>1]=p[s+10>>1],_[n>>1]=p[s>>1],_[n+2>>1]=p[s+2>>1],_[n+4>>1]=p[s+4>>1],n=n+16|0,(0|a)!=(0|(o=o+1|0)););r[d[d[i>>2]+20>>2]](i,l,17663,1497453121,c)}}else d[t+68>>2]=0;if(d[t+76>>2]=d[e+144>>2],n=d[e+152>>2],d[t+80>>2]=n,!n)return d[t+72>>2]=0,17707;if(n=t,t=0|r[d[d[i>>2]+28>>2]](i,d[e+160>>2]),d[n+72>>2]=t,t){if(t=d[e+152>>2],s=0|r[d[d[i>>2]+16>>2]](i,20,t),a=d[e+160>>2],(0|t)>=1)for(n=d[s+8>>2],o=0;e=a+(o<<5)|0,_[n+14>>1]=p[e+6>>1],_[n+16>>1]=p[e+8>>1],_[n+18>>1]=p[e+10>>1],_[n+8>>1]=p[e>>1],_[n+10>>1]=p[e+2>>1],_[n+12>>1]=p[e+4>>1],d[n>>2]=d[e+12>>2],d[n+4>>2]=d[e+16>>2],n=n+20|0,(0|t)!=(0|(o=o+1|0)););r[d[d[i>>2]+20>>2]](i,s,17686,1497453121,a)}return 17707},r[517]=function(e,t){t|=0;var i,n=0,o=0,a=0,l=0,c=0,h=0,f=0,m=0;if(O=i=O+-64|0,d[20+(e|=0)>>2]=d[t+16>>2],d[e+24>>2]=d[t+20>>2],d[e+28>>2]=d[t+24>>2],d[e+32>>2]=d[t+28>>2],d[e+4>>2]=d[t>>2],d[e+8>>2]=d[t+4>>2],d[e+12>>2]=d[t+8>>2],d[e+16>>2]=d[t+12>>2],d[e+36>>2]=d[t+32>>2],d[e+40>>2]=d[t+36>>2],d[e+44>>2]=d[t+40>>2],d[e+48>>2]=d[t+44>>2],d[e+56>>2]=d[t+48>>2],s[e+60|0]=0!=d[t+52>>2],f=d[t+56>>2],d[(o=i)+56>>2]=0,d[o+60>>2]=0,d[o+48>>2]=0,d[o+52>>2]=0,d[o+40>>2]=0,d[o+44>>2]=0,d[o+32>>2]=0,d[o+36>>2]=0,d[o+24>>2]=0,d[o+28>>2]=0,d[o+16>>2]=0,d[o+20>>2]=0,d[o+8>>2]=0,d[o+12>>2]=0,d[o>>2]=0,d[o+4>>2]=0,(0|(h=d[e+88>>2]))<(0|f)){if(d[e+92>>2]<(0|f)){if(f?(d[7717]=d[7717]+1,m=0|r[d[6606]](f<<6,16),o=d[e+88>>2]):o=h,(0|o)>=1)for(;c=(n=a<<6)+m|0,l=n+d[e+96>>2]|0,n=d[l+4>>2],d[c>>2]=d[l>>2],d[c+4>>2]=n,n=d[l+60>>2],d[c+56>>2]=d[l+56>>2],d[c+60>>2]=n,n=d[l+52>>2],d[c+48>>2]=d[l+48>>2],d[c+52>>2]=n,n=d[l+44>>2],d[c+40>>2]=d[l+40>>2],d[c+44>>2]=n,n=d[l+36>>2],d[c+32>>2]=d[l+32>>2],d[c+36>>2]=n,n=d[l+28>>2],d[c+24>>2]=d[l+24>>2],d[c+28>>2]=n,n=d[l+20>>2],d[c+16>>2]=d[l+16>>2],d[c+20>>2]=n,n=d[l+12>>2],d[c+8>>2]=d[l+8>>2],d[c+12>>2]=n,(0|o)!=(0|(a=a+1|0)););(o=d[e+96>>2])&&(u[e+100|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+96>>2]=0),d[e+96>>2]=m,d[e+92>>2]=f,s[e+100|0]=1}for(;a=d[(o=i)+4>>2],n=d[e+96>>2]+(h<<6)|0,d[n>>2]=d[o>>2],d[n+4>>2]=a,a=d[o+60>>2],d[n+56>>2]=d[o+56>>2],d[n+60>>2]=a,a=d[o+52>>2],d[n+48>>2]=d[o+48>>2],d[n+52>>2]=a,a=d[o+44>>2],d[n+40>>2]=d[o+40>>2],d[n+44>>2]=a,a=d[o+36>>2],d[n+32>>2]=d[o+32>>2],d[n+36>>2]=a,a=d[o+28>>2],d[n+24>>2]=d[o+24>>2],d[n+28>>2]=a,a=d[o+20>>2],d[n+16>>2]=d[o+16>>2],d[n+20>>2]=a,a=d[o+12>>2],d[n+8>>2]=d[o+8>>2],d[n+12>>2]=a,(0|f)!=(0|(h=h+1|0)););}if(d[e+88>>2]=f,(0|f)>=1)for(o=d[e+96>>2],a=d[t+64>>2],h=0;d[16+(n=o+(h<<6)|0)>>2]=d[a+16>>2],d[n+20>>2]=d[a+20>>2],d[n+24>>2]=d[a+24>>2],d[n+28>>2]=d[a+28>>2],d[n>>2]=d[a>>2],d[n+4>>2]=d[a+4>>2],d[n+8>>2]=d[a+8>>2],d[n+12>>2]=d[a+12>>2],d[n+32>>2]=d[a+32>>2],d[n+36>>2]=d[a+36>>2],d[n+40>>2]=d[a+40>>2],a=a+48|0,(0|f)!=(0|(h=h+1|0)););if(l=d[t+60>>2],d[i+8>>2]=0,d[i+12>>2]=0,d[i>>2]=0,d[i+4>>2]=0,(0|(a=d[e+128>>2]))<(0|l)){if(d[e+132>>2]<(0|l)){if(l?(d[7717]=d[7717]+1,m=0|r[d[6606]](l<<4,16),o=d[e+128>>2]):(m=0,o=a),(0|o)>=1)for(h=0;f=(n=h<<4)+m|0,c=n+d[e+136>>2]|0,n=d[c+4>>2],d[f>>2]=d[c>>2],d[f+4>>2]=n,n=d[c+12>>2],d[f+8>>2]=d[c+8>>2],d[f+12>>2]=n,(0|o)!=(0|(h=h+1|0)););(o=d[e+136>>2])&&(u[e+140|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+136>>2]=0),d[e+136>>2]=m,d[e+132>>2]=l,s[e+140|0]=1}for(;o=d[i+4>>2],n=d[e+136>>2]+(a<<4)|0,d[n>>2]=d[i>>2],d[n+4>>2]=o,o=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=o,(0|l)!=(0|(a=a+1|0)););}if(d[e+128>>2]=l,(0|l)>=1)for(o=d[e+136>>2],a=d[t+68>>2],h=0;d[12+(n=o+(h<<4)|0)>>2]=d[a+12>>2],_[n+6>>1]=p[a+6>>1],_[n+8>>1]=p[a+8>>1],_[n+10>>1]=p[a+10>>1],_[n>>1]=p[a>>1],_[n+2>>1]=p[a+2>>1],_[n+4>>1]=p[a+4>>1],a=a+16|0,(0|l)!=(0|(h=h+1|0)););if(d[e+144>>2]=d[t+76>>2],(0|(h=d[e+152>>2]))<(0|(l=d[t+80>>2]))){if(d[e+156>>2]<(0|l)){if(l?(d[7717]=d[7717]+1,m=0|r[d[6606]](l<<5,16),o=d[e+152>>2]):(m=0,o=h),(0|o)>=1)for(a=0;f=(n=a<<5)+m|0,c=n+d[e+160>>2]|0,n=d[c+4>>2],d[f>>2]=d[c>>2],d[f+4>>2]=n,n=d[c+28>>2],d[f+24>>2]=d[c+24>>2],d[f+28>>2]=n,n=d[c+20>>2],d[f+16>>2]=d[c+16>>2],d[f+20>>2]=n,n=d[c+12>>2],d[f+8>>2]=d[c+8>>2],d[f+12>>2]=n,(0|o)!=(0|(a=a+1|0)););(o=d[e+160>>2])&&(u[e+164|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+160>>2]=0),d[e+160>>2]=m,d[e+156>>2]=l,s[e+164|0]=1}for(;o=d[i+4>>2],n=d[e+160>>2]+(h<<5)|0,d[n>>2]=d[i>>2],d[n+4>>2]=o,o=d[i+28>>2],d[n+24>>2]=d[i+24>>2],d[n+28>>2]=o,o=d[i+20>>2],d[n+16>>2]=d[i+16>>2],d[n+20>>2]=o,o=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=o,(0|l)!=(0|(h=h+1|0)););}if(d[e+152>>2]=l,(0|l)>=1)for(o=d[e+160>>2],a=d[t+72>>2],e=0;_[6+(t=o+(e<<5)|0)>>1]=p[a+14>>1],_[t+8>>1]=p[a+16>>1],_[t+10>>1]=p[a+18>>1],_[t>>1]=p[a+8>>1],_[t+2>>1]=p[a+10>>1],_[t+4>>1]=p[a+12>>1],d[t+12>>2]=d[a>>2],d[t+16>>2]=d[a+4>>2],a=a+20|0,(0|l)!=(0|(e=e+1|0)););O=i- -64|0},r[518]=function(e,t){t|=0;var i,n=0,o=0,a=0,l=0,c=0,h=0,f=0,b=0;if(O=i=O+-64|0,m[20+(e|=0)>>2]=g[t+32>>3],m[e+24>>2]=g[t+40>>3],m[e+28>>2]=g[t+48>>3],m[e+32>>2]=g[t+56>>3],m[e+4>>2]=g[t>>3],m[e+8>>2]=g[t+8>>3],m[e+12>>2]=g[t+16>>3],m[e+16>>2]=g[t+24>>3],m[e+36>>2]=g[t+64>>3],m[e+40>>2]=g[t+72>>3],m[e+44>>2]=g[t+80>>3],m[e+48>>2]=g[t+88>>3],d[e+56>>2]=d[t+96>>2],s[e+60|0]=0!=d[t+100>>2],f=d[t+104>>2],d[(o=i)+56>>2]=0,d[o+60>>2]=0,d[o+48>>2]=0,d[o+52>>2]=0,d[o+40>>2]=0,d[o+44>>2]=0,d[o+32>>2]=0,d[o+36>>2]=0,d[o+24>>2]=0,d[o+28>>2]=0,d[o+16>>2]=0,d[o+20>>2]=0,d[o+8>>2]=0,d[o+12>>2]=0,d[o>>2]=0,d[o+4>>2]=0,(0|(h=d[e+88>>2]))<(0|f)){if(d[e+92>>2]<(0|f)){if(f?(d[7717]=d[7717]+1,b=0|r[d[6606]](f<<6,16),o=d[e+88>>2]):o=h,(0|o)>=1)for(;c=(n=a<<6)+b|0,l=n+d[e+96>>2]|0,n=d[l+4>>2],d[c>>2]=d[l>>2],d[c+4>>2]=n,n=d[l+60>>2],d[c+56>>2]=d[l+56>>2],d[c+60>>2]=n,n=d[l+52>>2],d[c+48>>2]=d[l+48>>2],d[c+52>>2]=n,n=d[l+44>>2],d[c+40>>2]=d[l+40>>2],d[c+44>>2]=n,n=d[l+36>>2],d[c+32>>2]=d[l+32>>2],d[c+36>>2]=n,n=d[l+28>>2],d[c+24>>2]=d[l+24>>2],d[c+28>>2]=n,n=d[l+20>>2],d[c+16>>2]=d[l+16>>2],d[c+20>>2]=n,n=d[l+12>>2],d[c+8>>2]=d[l+8>>2],d[c+12>>2]=n,(0|o)!=(0|(a=a+1|0)););(o=d[e+96>>2])&&(u[e+100|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+96>>2]=0),d[e+96>>2]=b,d[e+92>>2]=f,s[e+100|0]=1}for(;a=d[(o=i)+4>>2],n=d[e+96>>2]+(h<<6)|0,d[n>>2]=d[o>>2],d[n+4>>2]=a,a=d[o+60>>2],d[n+56>>2]=d[o+56>>2],d[n+60>>2]=a,a=d[o+52>>2],d[n+48>>2]=d[o+48>>2],d[n+52>>2]=a,a=d[o+44>>2],d[n+40>>2]=d[o+40>>2],d[n+44>>2]=a,a=d[o+36>>2],d[n+32>>2]=d[o+32>>2],d[n+36>>2]=a,a=d[o+28>>2],d[n+24>>2]=d[o+24>>2],d[n+28>>2]=a,a=d[o+20>>2],d[n+16>>2]=d[o+16>>2],d[n+20>>2]=a,a=d[o+12>>2],d[n+8>>2]=d[o+8>>2],d[n+12>>2]=a,(0|f)!=(0|(h=h+1|0)););}if(d[e+88>>2]=f,(0|f)>=1)for(o=d[e+96>>2],a=d[t+112>>2],h=0;m[16+(n=o+(h<<6)|0)>>2]=g[a+32>>3],m[n+20>>2]=g[a+40>>3],m[n+24>>2]=g[a+48>>3],m[n+28>>2]=g[a+56>>3],m[n>>2]=g[a>>3],m[n+4>>2]=g[a+8>>3],m[n+8>>2]=g[a+16>>3],m[n+12>>2]=g[a+24>>3],d[n+32>>2]=d[a+64>>2],d[n+36>>2]=d[a+68>>2],d[n+40>>2]=d[a+72>>2],a=a+80|0,(0|f)!=(0|(h=h+1|0)););if(l=d[t+108>>2],d[i+8>>2]=0,d[i+12>>2]=0,d[i>>2]=0,d[i+4>>2]=0,(0|(a=d[e+128>>2]))<(0|l)){if(d[e+132>>2]<(0|l)){if(l?(d[7717]=d[7717]+1,b=0|r[d[6606]](l<<4,16),o=d[e+128>>2]):(b=0,o=a),(0|o)>=1)for(h=0;f=(n=h<<4)+b|0,c=n+d[e+136>>2]|0,n=d[c+4>>2],d[f>>2]=d[c>>2],d[f+4>>2]=n,n=d[c+12>>2],d[f+8>>2]=d[c+8>>2],d[f+12>>2]=n,(0|o)!=(0|(h=h+1|0)););(o=d[e+136>>2])&&(u[e+140|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+136>>2]=0),d[e+136>>2]=b,d[e+132>>2]=l,s[e+140|0]=1}for(;o=d[i+4>>2],n=d[e+136>>2]+(a<<4)|0,d[n>>2]=d[i>>2],d[n+4>>2]=o,o=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=o,(0|l)!=(0|(a=a+1|0)););}if(d[e+128>>2]=l,(0|l)>=1)for(o=d[e+136>>2],a=d[t+116>>2],h=0;d[12+(n=o+(h<<4)|0)>>2]=d[a+12>>2],_[n+6>>1]=p[a+6>>1],_[n+8>>1]=p[a+8>>1],_[n+10>>1]=p[a+10>>1],_[n>>1]=p[a>>1],_[n+2>>1]=p[a+2>>1],_[n+4>>1]=p[a+4>>1],a=a+16|0,(0|l)!=(0|(h=h+1|0)););if(d[e+144>>2]=d[t+120>>2],(0|(h=d[e+152>>2]))<(0|(l=d[t+124>>2]))){if(d[e+156>>2]<(0|l)){if(l?(d[7717]=d[7717]+1,b=0|r[d[6606]](l<<5,16),o=d[e+152>>2]):(b=0,o=h),(0|o)>=1)for(a=0;f=(n=a<<5)+b|0,c=n+d[e+160>>2]|0,n=d[c+4>>2],d[f>>2]=d[c>>2],d[f+4>>2]=n,n=d[c+28>>2],d[f+24>>2]=d[c+24>>2],d[f+28>>2]=n,n=d[c+20>>2],d[f+16>>2]=d[c+16>>2],d[f+20>>2]=n,n=d[c+12>>2],d[f+8>>2]=d[c+8>>2],d[f+12>>2]=n,(0|o)!=(0|(a=a+1|0)););(o=d[e+160>>2])&&(u[e+164|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+160>>2]=0),d[e+160>>2]=b,d[e+156>>2]=l,s[e+164|0]=1}for(;o=d[i+4>>2],n=d[e+160>>2]+(h<<5)|0,d[n>>2]=d[i>>2],d[n+4>>2]=o,o=d[i+28>>2],d[n+24>>2]=d[i+24>>2],d[n+28>>2]=o,o=d[i+20>>2],d[n+16>>2]=d[i+16>>2],d[n+20>>2]=o,o=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=o,(0|l)!=(0|(h=h+1|0)););}if(d[e+152>>2]=l,(0|l)>=1)for(o=d[e+160>>2],a=d[t+128>>2],e=0;_[6+(t=o+(e<<5)|0)>>1]=p[a+14>>1],_[t+8>>1]=p[a+16>>1],_[t+10>>1]=p[a+18>>1],_[t>>1]=p[a+8>>1],_[t+2>>1]=p[a+10>>1],_[t+4>>1]=p[a+12>>1],d[t+12>>2]=d[a>>2],d[t+16>>2]=d[a+4>>2],a=a+20|0,(0|l)!=(0|(e=e+1|0)););O=i- -64|0},r[519]=function(e,t,i,n){return 0|z(e|=0,t|=0,i|=0,n|=0)},r[520]=Pd,r[521]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var o,l,c=0,p=0,f=y(0),g=0,b=0,v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=0,E=y(0),R=0,P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=y(0);if(c=d[t+40>>2],g=d[t+24>>2],b=d[t+8>>2],p=(f=m[t+8>>2])>y(-0xde0b6b000000000)?b:-581039253,p=(A=m[t+24>>2])>(a(0,p),h())?g:p,a(0,(v=m[t+40>>2])>(a(0,p),h())?c:p),E=h(),p=c,c=A<(a(0,c=f>2],g=d[t+20>>2],b=d[t+4>>2],p=(A=m[t+4>>2])>2])<(a(0,p),h())?g:p,a(0,(S=m[t+36>>2])<(a(0,p),h())?c:p),f=h(),p=c,c=C>(a(0,c=A>y(-0xde0b6b000000000)?b:-581039253),h())?g:c,a(0,S>(a(0,c),h())?p:c),A=h(),c=d[t+32>>2],g=d[t+16>>2],b=d[t>>2],p=(C=m[t>>2])>2])<(a(0,p),h())?g:p,o=(x=m[t+32>>2])<(a(0,p),h())?c:p,t=S>(a(0,t=C>y(-0xde0b6b000000000)?b:-581039253),h())?g:t,l=x>(a(0,t),h())?c:t,t=d[e+8>>2],C=m[t+44>>2],S=m[t+40>>2],x=m[t+12>>2],M=m[t+8>>2],D=m[t+36>>2],O=m[t+4>>2],c=d[e+4>>2],(0|(e=d[c+4>>2]))==d[c+8>>2]&&!((0|e)>=(0|(g=e?e<<1:1)))){if(g?(d[7717]=d[7717]+1,b=0|r[d[6606]](g<<4,16),e=d[c+4>>2]):b=0,(0|e)>=1)for(t=0;T=(p=t<<4)+b|0,p=p+d[c+12>>2]|0,R=d[p+4>>2],d[T>>2]=d[p>>2],d[T+4>>2]=R,R=d[p+12>>2],d[T+8>>2]=d[p+8>>2],d[T+12>>2]=R,(0|(t=t+1|0))!=(0|e););(e=d[c+12>>2])&&(u[c+16|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[c+12>>2]=0),d[c+12>>2]=b,s[c+16|0]=1,d[c+8>>2]=g,e=d[c+4>>2]}F=y(A-f),e=d[c+12>>2]+(e<<4)|0,d[e+12>>2]=i<<21|n,a(0,l),P=h(),a(0,o),I=h(),B=y(P-I),t=e,n=w=y(0)?~~v>>>0:0,_[t+4>>1]=65534&i,t=e,g=F=y(0)?~~f>>>0:0,_[t+2>>1]=65534&i,t=e,b=B=y(0)?~~f>>>0:0,_[t>>1]=65534&i,t=e,i=(f=y(y(y((n?y(E+y(.0010000000474974513)):E)-x)*C)+y(1)))=y(0)?~~f>>>0:0,_[t+10>>1]=1|i,t=e,i=(f=y(y(y((g?y(A+y(.0010000000474974513)):A)-M)*S)+y(1)))=y(0)?~~f>>>0:0,_[t+8>>1]=1|i,t=(f=y(y(y((b?y(P+y(.0010000000474974513)):P)-O)*D)+y(1)))=y(0)?~~f>>>0:0,_[e+6>>1]=1|t,d[c+4>>2]=d[c+4>>2]+1},r[522]=Pd,r[523]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var o,l,c,_,p,f=0,g=0,b=0,v=y(0),A=y(0),C=y(0),S=0,x=y(0),T=0,E=0,R=0,P=0,I=0,M=0,D=y(0),w=y(0),F=y(0),B=y(0),N=0;if(O=l=O-32|0,A=m[t+28>>2],D=(v=(C=m[t+12>>2])>y(0)?C:y(0))>2],T=d[t+8>>2],f=(F=m[t+8>>2])>y(-0xde0b6b000000000)?T:-581039253,c=(B=m[t+24>>2])>(a(0,f),h())?S:f,E=d[t+20>>2],R=d[t+4>>2],f=(x=m[t+4>>2])>y(-0xde0b6b000000000)?R:-581039253,_=(A=m[t+20>>2])>(a(0,f),h())?E:f,P=d[t+16>>2],I=d[t>>2],f=(C=m[t>>2])>y(-0xde0b6b000000000)?I:-581039253,p=(v=m[t+16>>2])>(a(0,f),h())?P:f,T=B<(a(0,f=F>2],P=d[t+40>>2],A=m[t+40>>2],I=d[t+36>>2],C=m[t+36>>2],f=d[t+32>>2],v=m[t+32>>2],o=d[e+4>>2],(0|(t=d[o+4>>2]))==d[o+8>>2]&&!((0|t)>=(0|(M=t?t<<1:1)))){if(M&&(d[7717]=d[7717]+1,N=0|r[d[6606]](M<<6,16),t=d[o+4>>2]),(0|t)>=1)for(S=0;g=(e=S<<6)+N|0,b=e+d[o+12>>2]|0,e=d[b+4>>2],d[g>>2]=d[b>>2],d[g+4>>2]=e,e=d[b+60>>2],d[g+56>>2]=d[b+56>>2],d[g+60>>2]=e,e=d[b+52>>2],d[g+48>>2]=d[b+48>>2],d[g+52>>2]=e,e=d[b+44>>2],d[g+40>>2]=d[b+40>>2],d[g+44>>2]=e,e=d[b+36>>2],d[g+32>>2]=d[b+32>>2],d[g+36>>2]=e,e=d[b+28>>2],d[g+24>>2]=d[b+24>>2],d[g+28>>2]=e,e=d[b+20>>2],d[g+16>>2]=d[b+16>>2],d[g+20>>2]=e,e=d[b+12>>2],d[g+8>>2]=d[b+8>>2],d[g+12>>2]=e,(0|(S=S+1|0))!=(0|t););(e=d[o+12>>2])&&(u[o+16|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[o+12>>2]=0),d[o+12>>2]=N,s[o+16|0]=1,d[o+8>>2]=M,t=d[o+4>>2]}t=d[o+12>>2]+(t<<6)|0,d[t+40>>2]=n,d[t+36>>2]=i,d[t+32>>2]=-1,m[t+12>>2]=x>2]=D>2]=A>(a(0,c),h())?P:c,d[t+20>>2]=C>(a(0,_),h())?I:_,d[t+16>>2]=v>(a(0,p),h())?f:p,d[t+8>>2]=A<(a(0,T),h())?P:T,d[t+4>>2]=C<(a(0,E),h())?I:E,d[t>>2]=v<(a(0,R),h())?f:R,e=d[l+16>>2],d[t+44>>2]=d[l+12>>2],d[t+48>>2]=e,e=d[l+24>>2],d[t+52>>2]=d[l+20>>2],d[t+56>>2]=e,d[t+60>>2]=d[l+28>>2],d[o+4>>2]=d[o+4>>2]+1,O=l+32|0},r[524]=function(e){return d[(e|=0)>>2]=15492,0|e},r[525]=function(e){d[(e|=0)>>2]=15492,e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[526]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0);h=m[t+56>>2],p=m[t+36>>2],f=m[t+40>>2],_=m[t+52>>2],a=m[t+20>>2],l=m[e+112>>2],o=m[e+20>>2],c=m[e+36>>2],g=m[t+24>>2],b=m[e+116>>2],A=m[e+24>>2],C=m[e+40>>2],S=m[t+32>>2],u=m[t+48>>2],x=m[t>>2],T=m[t+4>>2],E=m[t+8>>2],R=m[t+16>>2],s=m[e+108>>2],P=m[e+16>>2],I=m[e+32>>2],M=y(r[d[d[e>>2]+48>>2]](e)),D=y(r[d[d[e>>2]+48>>2]](e)),O=y(r[d[d[e>>2]+48>>2]](e)),d[i+12>>2]=0,s=y(y(s*y(I-P))*y(.5)),l=y(y(l*y(c-o))*y(.5)),o=y(y(s*y(v(R)))+y(l*y(v(a)))),a=y(y(b*y(C-A))*y(.5)),o=y(D+y(o+y(a*y(v(g))))),m[i+4>>2]=_-o,c=y(M+y(y(y(s*y(v(x)))+y(l*y(v(T))))+y(a*y(v(E))))),m[i>>2]=u-c,s=y(O+y(y(y(s*y(v(S)))+y(l*y(v(p))))+y(a*y(v(f))))),m[i+8>>2]=h-s,d[n+12>>2]=0,m[n+8>>2]=h+s,m[n+4>>2]=_+o,m[n>>2]=u+c},r[527]=function(e,t){e|=0;var i=0;i=d[4+(t|=0)>>2],d[e+108>>2]=d[t>>2],d[e+112>>2]=i,i=d[t+12>>2],d[e+116>>2]=d[t+8>>2],d[e+120>>2]=i},r[528]=function(e){return 108+(e|=0)|0},r[529]=kh,r[530]=function(e){return 15604},r[531]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=0,f=0,g=0,b=0,A=y(0),C=0,S=0,x=0,T=0,E=0;O=s=O-48|0,_=m[e+40>>2],a=m[e+24>>2],c=y(y(1)/m[e+116>>2]),h=m[e+56>>2],b=((o=_<(o=(o=y(y(c*m[n+8>>2])+h))>2])+h))>2],a=m[e+20>>2],c=y(y(1)/m[e+112>>2]),h=m[e+52>>2],b=((o=_<(o=(o=y(y(c*m[n+4>>2])+h))>2])+h))>2],a=m[e+16>>2],c=y(y(1)/m[e+108>>2]),h=m[e+48>>2],b=((o=_<(o=(o=y(y(c*m[n>>2])+h))>2])+h))>2]+-1|0,S=d[e+64>>2]+-1|0;e:{t:switch(d[e+104>>2]){case 0:p=(0|x)<(0|p)?x:p,g=(0|C)>0?C:0,S=(0|T)<(0|S)?T:S,E=(0|f)>0?f:0;break e;case 1:p=(0|x)<(0|p)?x:p,g=(0|C)>0?C:0,S=(0|n)<(0|S)?n:S,E=(0|i)>0?i:0;break e;case 2:break t;default:break e}p=(0|T)<(0|p)?T:p,g=(0|f)>0?f:0,S=(0|n)<(0|S)?n:S,E=(0|i)>0?i:0}if((0|g)<(0|p))for(;;){if(T=p,(0|E)>=(0|S))i=g+1|0;else{for(x=1&g,A=y(0|(C=g+1|0)),_=y(0|g),i=E;;){if(!u[e+102|0]|x&&!(u[e+100|0]|(i+g&1?0:u[e+101|0]))){a=y(r[d[d[e>>2]+68>>2]](e,i,g)),n=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+8>>2],a=m[s+4>>2],o=m[s>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+12>>2]=0,o=y(a-o),m[s>>2]=o,l=y(_-y(h*y(.5))),m[s+8>>2]=l,a=y(y(0|i)-y(c*y(.5))),m[s+4>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+12>>2]=0,a=y(a-o),m[s+4>>2]=a,l=y(_-y(h*y(.5))),m[s+8>>2]=l,o=y(y(0|i)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+12>>2]=0,l=y(a-o),m[s+8>>2]=l,a=y(_-y(h*y(.5))),m[s+4>>2]=a,o=y(y(0|i)-y(c*y(.5)))}m[n>>2]=o}m[s>>2]=o*m[e+108>>2],m[s+4>>2]=a*m[e+112>>2],m[s+8>>2]=l*m[e+116>>2],a=y(r[d[d[e>>2]+68>>2]](e,i,C)),n=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+24>>2],a=m[s+20>>2],o=m[s+16>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+28>>2]=0,o=y(a-o),m[s+16>>2]=o,l=y(A-y(h*y(.5))),m[s+24>>2]=l,a=y(y(0|i)-y(c*y(.5))),m[s+20>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+28>>2]=0,a=y(a-o),m[s+20>>2]=a,l=y(A-y(h*y(.5))),m[s+24>>2]=l,o=y(y(0|i)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+28>>2]=0,l=y(a-o),m[s+24>>2]=l,a=y(A-y(h*y(.5))),m[s+20>>2]=a,o=y(y(0|i)-y(c*y(.5)))}m[n+16>>2]=o}m[s+16>>2]=o*m[e+108>>2],m[s+20>>2]=a*m[e+112>>2],m[s+24>>2]=l*m[e+116>>2],n=i+1|0,a=y(r[d[d[e>>2]+68>>2]](e,n,g)),f=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+40>>2],a=m[s+36>>2],o=m[s+32>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+44>>2]=0,o=y(a-o),m[s+32>>2]=o,l=y(_-y(h*y(.5))),m[s+40>>2]=l,a=y(y(0|n)-y(c*y(.5))),m[s+36>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+44>>2]=0,a=y(a-o),m[s+36>>2]=a,l=y(_-y(h*y(.5))),m[s+40>>2]=l,o=y(y(0|n)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+44>>2]=0,l=y(a-o),m[s+40>>2]=l,a=y(_-y(h*y(.5))),m[s+36>>2]=a,o=y(y(0|n)-y(c*y(.5)))}m[f+32>>2]=o}m[s+32>>2]=o*m[e+108>>2],m[s+36>>2]=a*m[e+112>>2],m[s+40>>2]=l*m[e+116>>2],r[d[d[t>>2]+8>>2]](t,s,i,g),a=y(r[d[d[e>>2]+68>>2]](e,n,g)),f=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+8>>2],a=m[s+4>>2],o=m[s>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+12>>2]=0,o=y(a-o),m[s>>2]=o,l=y(_-y(h*y(.5))),m[s+8>>2]=l,a=y(y(0|n)-y(c*y(.5))),m[s+4>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+12>>2]=0,a=y(a-o),m[s+4>>2]=a,l=y(_-y(h*y(.5))),m[s+8>>2]=l,o=y(y(0|n)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+12>>2]=0,l=y(a-o),m[s+8>>2]=l,a=y(_-y(h*y(.5))),m[s+4>>2]=a,o=y(y(0|n)-y(c*y(.5)))}m[f>>2]=o}m[s>>2]=o*m[e+108>>2],m[s+4>>2]=a*m[e+112>>2],m[s+8>>2]=l*m[e+116>>2],a=y(r[d[d[e>>2]+68>>2]](e,n,C)),f=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+40>>2],a=m[s+36>>2],o=m[s+32>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+44>>2]=0,o=y(a-o),m[s+32>>2]=o,l=y(A-y(h*y(.5))),m[s+40>>2]=l,a=y(y(0|n)-y(c*y(.5))),m[s+36>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+44>>2]=0,a=y(a-o),m[s+36>>2]=a,l=y(A-y(h*y(.5))),m[s+40>>2]=l,o=y(y(0|n)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+44>>2]=0,l=y(a-o),m[s+40>>2]=l,a=y(A-y(h*y(.5))),m[s+36>>2]=a,o=y(y(0|n)-y(c*y(.5)))}m[f+32>>2]=o}}else{a=y(r[d[d[e>>2]+68>>2]](e,i,g)),n=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+8>>2],a=m[s+4>>2],o=m[s>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+12>>2]=0,o=y(a-o),m[s>>2]=o,l=y(_-y(h*y(.5))),m[s+8>>2]=l,a=y(y(0|i)-y(c*y(.5))),m[s+4>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+12>>2]=0,a=y(a-o),m[s+4>>2]=a,l=y(_-y(h*y(.5))),m[s+8>>2]=l,o=y(y(0|i)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+12>>2]=0,l=y(a-o),m[s+8>>2]=l,a=y(_-y(h*y(.5))),m[s+4>>2]=a,o=y(y(0|i)-y(c*y(.5)))}m[n>>2]=o}m[s>>2]=o*m[e+108>>2],m[s+4>>2]=a*m[e+112>>2],m[s+8>>2]=l*m[e+116>>2],n=i+1|0,a=y(r[d[d[e>>2]+68>>2]](e,n,g)),f=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+24>>2],a=m[s+20>>2],o=m[s+16>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+28>>2]=0,o=y(a-o),m[s+16>>2]=o,l=y(_-y(h*y(.5))),m[s+24>>2]=l,a=y(y(0|n)-y(c*y(.5))),m[s+20>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+28>>2]=0,a=y(a-o),m[s+20>>2]=a,l=y(_-y(h*y(.5))),m[s+24>>2]=l,o=y(y(0|n)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+28>>2]=0,l=y(a-o),m[s+24>>2]=l,a=y(_-y(h*y(.5))),m[s+20>>2]=a,o=y(y(0|n)-y(c*y(.5)))}m[f+16>>2]=o}m[s+16>>2]=o*m[e+108>>2],m[s+20>>2]=a*m[e+112>>2],m[s+24>>2]=l*m[e+116>>2],a=y(r[d[d[e>>2]+68>>2]](e,n,C)),f=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+40>>2],a=m[s+36>>2],o=m[s+32>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+44>>2]=0,o=y(a-o),m[s+32>>2]=o,l=y(A-y(h*y(.5))),m[s+40>>2]=l,a=y(y(0|n)-y(c*y(.5))),m[s+36>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+44>>2]=0,a=y(a-o),m[s+36>>2]=a,l=y(A-y(h*y(.5))),m[s+40>>2]=l,o=y(y(0|n)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+44>>2]=0,l=y(a-o),m[s+40>>2]=l,a=y(A-y(h*y(.5))),m[s+36>>2]=a,o=y(y(0|n)-y(c*y(.5)))}m[f+32>>2]=o}m[s+32>>2]=o*m[e+108>>2],m[s+36>>2]=a*m[e+112>>2],m[s+40>>2]=l*m[e+116>>2],r[d[d[t>>2]+8>>2]](t,s,i,g),a=y(r[d[d[e>>2]+68>>2]](e,n,C)),f=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+24>>2],a=m[s+20>>2],o=m[s+16>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+28>>2]=0,o=y(a-o),m[s+16>>2]=o,l=y(A-y(h*y(.5))),m[s+24>>2]=l,a=y(y(0|n)-y(c*y(.5))),m[s+20>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+28>>2]=0,a=y(a-o),m[s+20>>2]=a,l=y(A-y(h*y(.5))),m[s+24>>2]=l,o=y(y(0|n)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+28>>2]=0,l=y(a-o),m[s+24>>2]=l,a=y(A-y(h*y(.5))),m[s+20>>2]=a,o=y(y(0|n)-y(c*y(.5)))}m[f+16>>2]=o}m[s+16>>2]=o*m[e+108>>2],m[s+20>>2]=a*m[e+112>>2],m[s+24>>2]=l*m[e+116>>2],a=y(r[d[d[e>>2]+68>>2]](e,i,C)),f=s;e:{t:{switch(d[e+104>>2]){default:l=m[s+40>>2],a=m[s+36>>2],o=m[s+32>>2];break e;case 0:c=m[e+80>>2],h=m[e+84>>2],o=m[e+48>>2],d[s+44>>2]=0,o=y(a-o),m[s+32>>2]=o,l=y(A-y(h*y(.5))),m[s+40>>2]=l,a=y(y(0|i)-y(c*y(.5))),m[s+36>>2]=a;break e;case 1:c=m[e+80>>2],h=m[e+84>>2],o=m[e+52>>2],d[s+44>>2]=0,a=y(a-o),m[s+36>>2]=a,l=y(A-y(h*y(.5))),m[s+40>>2]=l,o=y(y(0|i)-y(c*y(.5)));break t;case 2:}c=m[e+80>>2],h=m[e+84>>2],o=m[e+56>>2],d[s+44>>2]=0,l=y(a-o),m[s+40>>2]=l,a=y(A-y(h*y(.5))),m[s+36>>2]=a,o=y(y(0|i)-y(c*y(.5)))}m[f+32>>2]=o}}if(m[s+32>>2]=o*m[e+108>>2],m[s+36>>2]=a*m[e+112>>2],m[s+40>>2]=l*m[e+116>>2],r[d[d[t>>2]+8>>2]](t,s,i,g),i=n,(0|n)==(0|S))break}i=C}if((0|T)==(0|(g=i)))break}O=s+48|0},r[532]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0);switch(d[e+96>>2]){case 0:return y(m[d[e+92>>2]+(b(d[e+64>>2],i)+t<<2)>>2]);case 5:return y(y(m[e+88>>2]*y(u[d[e+92>>2]+(b(d[e+64>>2],i)+t|0)|0])));case 3:n=y(m[e+88>>2]*y(_[d[e+92>>2]+(b(d[e+64>>2],i)+t<<1)>>1]))}return y(n)},r[533]=z_,r[534]=jn,r[535]=qr,r[536]=function(e,t,i){e|=0,t=y(t),i|=0;var n,s=y(0),o=y(0),a=y(0),l=y(0),c=0;O=n=O-16|0,c=d[e+40>>2],d[n+8>>2]=d[e+36>>2],d[n+12>>2]=c,c=d[e+32>>2],d[n>>2]=d[e+28>>2],d[n+4>>2]=c,s=y(r[d[d[e>>2]+48>>2]](e)),l=y(r[d[d[e>>2]+48>>2]](e)),m[n+8>>2]=y(r[d[d[e>>2]+48>>2]](e))+m[n+8>>2],m[n>>2]=s+m[n>>2],m[n+4>>2]=l+m[n+4>>2],s=y(t*y(.5)),l=y(t*y(.25)),t=y(t/y(12));e:{switch(d[e+52>>2]){case 0:a=s,s=m[n+4>>2],o=y(s*s),s=y(a*o),a=t,t=m[n>>2],a=o=y(y(l*o)+y(a*y(t*y(t*y(4)))));break e;case 2:o=s,s=m[n>>2],s=y(s*s),a=y(o*s),o=t,t=m[n+8>>2],o=s=y(y(l*s)+y(o*y(t*y(t*y(4)))));break e}o=s,s=m[n>>2],s=y(s*s),o=y(o*s),a=t,t=m[n+4>>2],a=s=y(y(l*s)+y(a*y(t*y(t*y(4)))))}d[i+12>>2]=0,m[i+8>>2]=a,m[i+4>>2]=o,m[i>>2]=s,O=n+16|0},r[537]=function(e){return 16024},r[538]=gc,r[539]=es,r[540]=vd,r[541]=function(e,t,i){return Jo(e|=0,t|=0,i|=0),d[t+28>>2]=d[e+28>>2],d[t+32>>2]=d[e+32>>2],d[t+36>>2]=d[e+36>>2],d[t+40>>2]=d[e+40>>2],d[t+12>>2]=d[e+12>>2],d[t+16>>2]=d[e+16>>2],d[t+20>>2]=d[e+20>>2],d[t+24>>2]=d[e+24>>2],d[t+44>>2]=d[e+44>>2],d[t+52>>2]=d[e+52>>2],16034},r[542]=function(e,t,i){e|=0,t|=0,i|=0;var n,s=y(0),o=y(0),a=y(0),l=0,c=y(0),h=y(0);O=n=O-16|0,r[d[d[t>>2]+68>>2]](n,t,i),l=d[n+12>>2],d[e+8>>2]=d[n+8>>2],d[e+12>>2]=l,l=d[n+4>>2],d[e>>2]=d[n>>2],d[e+4>>2]=l,y(r[d[d[t>>2]+48>>2]](t))!=y(0)&&(o=m[i+4>>2],s=m[i>>2],a=m[i+8>>2],c=y(r[d[d[t>>2]+48>>2]](t)),h=s=(t=y(y(y(s*s)+y(o*o))+y(a*a))>2]=m[e>>2]+y(c*y(h*s)),m[e+4>>2]=m[e+4>>2]+y(c*y(o*s)),m[e+8>>2]=m[e+8>>2]+y(c*y(a*s))),O=n+16|0},r[543]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0);n=m[t+32>>2],r=m[t+28>>2],s=m[i>>2],o=m[i+8>>2],(a=y(x(y(y(s*s)+y(o*o)))))==y(0)||(r=y(r/a),l=y(o*r),r=y(s*r)),n=m[i+4>>2]>2]=l,m[e+4>>2]=n,m[e>>2]=r},r[544]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var r=0,s=y(0),o=y(0),a=y(0),l=0,c=y(0),h=0,_=y(0);if((0|n)>=1)for(;s=m[e+32>>2],o=m[e+28>>2],c=m[(r=(h=l<<4)+t|0)>>2],a=m[r+8>>2],(_=y(x(y(y(c*c)+y(a*a)))))==y(0)?(a=y(0),s=m[r+4>>2]>2]>2]=a,m[r+4>>2]=s,m[r>>2]=o,(0|(l=l+1|0))!=(0|n););},r[545]=ja,r[546]=z_,r[547]=function(e){return 16054},r[548]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0);r=m[t+32>>2],n=m[t+28>>2],s=m[i+4>>2],o=m[i+8>>2],(a=y(x(y(y(s*s)+y(o*o)))))==y(0)||(r=y(r/a),l=y(o*r),r=y(s*r)),n=m[i>>2]>2]=l,m[e>>2]=n,m[e+4>>2]=r},r[549]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var r=0,s=y(0),o=y(0),a=y(0),l=0,c=y(0),h=0,_=y(0);if((0|n)>=1)for(;s=m[e+28>>2],o=m[e+32>>2],c=m[4+(r=(h=l<<4)+t|0)>>2],a=m[r+8>>2],(_=y(x(y(y(c*c)+y(a*a)))))==y(0)?(a=y(0),s=m[r>>2]>2]>2]=a,m[r+4>>2]=o,m[r>>2]=s,(0|(l=l+1|0))!=(0|n););},r[550]=function(e){e|=0;var t=y(0),i=y(0);return t=m[e+32>>2],y(r[d[d[e>>2]+48>>2]](e)),i=y(r[d[d[e>>2]+48>>2]](e)),y(r[d[d[e>>2]+48>>2]](e)),y(y(t+i))},r[551]=z_,r[552]=function(e){return 16064},r[553]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0);n=m[t+36>>2],r=m[t+28>>2],t=e,s=m[i>>2],o=m[i+4>>2],(a=y(x(y(y(s*s)+y(o*o)))))==y(0)||(r=y(r/a),l=y(o*r),r=y(s*r)),n=m[i+8>>2]>2]=n,m[e>>2]=r,m[e+4>>2]=l},r[554]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var r=0,s=y(0),o=y(0),a=y(0),l=0,c=y(0),h=0,_=y(0);if((0|n)>=1)for(;s=m[e+36>>2],o=m[e+28>>2],c=m[(r=(h=l<<4)+t|0)>>2],a=m[r+4>>2],(_=y(x(y(y(c*c)+y(a*a)))))==y(0)?(a=y(0),s=m[r+8>>2]>2]>2]=s,m[r+4>>2]=a,m[r>>2]=o,(0|(l=l+1|0))!=(0|n););},r[555]=ja,r[556]=xo,r[557]=function(e){var t;d[(e|=0)>>2]=16264,(t=d[e+32>>2])&&(u[e+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+32>>2]=0),d[e+32>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0,e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[558]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=0,a=0,l=0,c=0,h=y(0),_=y(0),f=y(0),v=y(0),A=y(0),C=y(0),S=0,x=0,T=0,E=0;if(O=i=O-80|0,(0|(s=0|r[d[d[e>>2]+28>>2]](e)))>=1)for(h=m[e+12>>2],_=m[e+8>>2],f=m[e+4>>2];;){r[d[d[e>>2]+16>>2]](e,i+76|0,i+52|0,i- -64|0,i+56|0,i+72|0,i+68|0,i+48|0,i+60|0,E);e:{t:switch(d[i+64>>2]){case 0:i:switch(d[i+60>>2]+-2|0){case 0:if(n=0,d[i+48>>2]<1)break e;for(;l=d[i+76>>2],c=d[i+56>>2],o=d[i+72>>2]+b(d[i+68>>2],n)|0,a=l+b(c,d[o>>2])|0,v=m[a>>2],A=m[a+4>>2],C=m[a+8>>2],d[i+12>>2]=0,m[i+8>>2]=h*C,m[i+4>>2]=_*A,m[i>>2]=f*v,a=l+b(c,d[o+4>>2])|0,v=m[a>>2],A=m[a+4>>2],C=m[a+8>>2],d[i+28>>2]=0,m[i+24>>2]=h*C,m[i+20>>2]=_*A,m[i+16>>2]=f*v,o=l+b(c,d[o+8>>2])|0,v=m[o>>2],A=m[o+4>>2],C=m[o+8>>2],d[i+44>>2]=0,m[i+40>>2]=h*C,m[i+36>>2]=_*A,m[i+32>>2]=f*v,r[d[d[t>>2]+8>>2]](t,i,E,n),(0|(n=n+1|0))>2];);break e;case 1:if(n=0,d[i+48>>2]<=0)break e;for(;l=d[i+76>>2],c=d[i+56>>2],o=d[i+72>>2]+b(d[i+68>>2],n)|0,a=l+b(c,p[o>>1])|0,v=m[a>>2],A=m[a+4>>2],C=m[a+8>>2],d[i+12>>2]=0,m[i+8>>2]=h*C,m[i+4>>2]=_*A,m[i>>2]=f*v,a=l+b(c,p[o+2>>1])|0,v=m[a>>2],A=m[a+4>>2],C=m[a+8>>2],d[i+28>>2]=0,m[i+24>>2]=h*C,m[i+20>>2]=_*A,m[i+16>>2]=f*v,o=l+b(c,p[o+4>>1])|0,v=m[o>>2],A=m[o+4>>2],C=m[o+8>>2],d[i+44>>2]=0,m[i+40>>2]=h*C,m[i+36>>2]=_*A,m[i+32>>2]=f*v,r[d[d[t>>2]+8>>2]](t,i,E,n),(0|(n=n+1|0))>2];);break e;case 3:break i;default:break e}if(n=0,d[i+48>>2]<=0)break e;for(;l=d[i+76>>2],c=d[i+56>>2],o=d[i+72>>2]+b(d[i+68>>2],n)|0,a=l+b(c,u[0|o])|0,v=m[a>>2],A=m[a+4>>2],C=m[a+8>>2],d[i+12>>2]=0,m[i+8>>2]=h*C,m[i+4>>2]=_*A,m[i>>2]=f*v,a=l+b(c,u[o+1|0])|0,v=m[a>>2],A=m[a+4>>2],C=m[a+8>>2],d[i+28>>2]=0,m[i+24>>2]=h*C,m[i+20>>2]=_*A,m[i+16>>2]=f*v,o=l+b(c,u[o+2|0])|0,v=m[o>>2],A=m[o+4>>2],C=m[o+8>>2],d[i+44>>2]=0,m[i+40>>2]=h*C,m[i+36>>2]=_*A,m[i+32>>2]=f*v,r[d[d[t>>2]+8>>2]](t,i,E,n),(0|(n=n+1|0))>2];);break e;case 1:break t;default:break e}t:switch(d[i+60>>2]+-2|0){case 0:if(n=0,d[i+48>>2]<1)break e;for(;l=d[i+76>>2],c=d[i+56>>2],o=d[i+72>>2]+b(d[i+68>>2],n)|0,a=l+b(c,d[o>>2])|0,S=g[a>>3],x=g[a+8>>3],T=g[a+16>>3],d[i+12>>2]=0,m[i+8>>2]=h*y(T),m[i+4>>2]=_*y(x),m[i>>2]=f*y(S),a=l+b(c,d[o+4>>2])|0,S=g[a>>3],x=g[a+8>>3],T=g[a+16>>3],d[i+28>>2]=0,m[i+24>>2]=h*y(T),m[i+20>>2]=_*y(x),m[i+16>>2]=f*y(S),o=l+b(c,d[o+8>>2])|0,S=g[o>>3],x=g[o+8>>3],T=g[o+16>>3],d[i+44>>2]=0,m[i+40>>2]=h*y(T),m[i+36>>2]=_*y(x),m[i+32>>2]=f*y(S),r[d[d[t>>2]+8>>2]](t,i,E,n),(0|(n=n+1|0))>2];);break e;case 1:if(n=0,d[i+48>>2]<=0)break e;for(;l=d[i+76>>2],c=d[i+56>>2],o=d[i+72>>2]+b(d[i+68>>2],n)|0,a=l+b(c,p[o>>1])|0,S=g[a>>3],x=g[a+8>>3],T=g[a+16>>3],d[i+12>>2]=0,m[i+8>>2]=h*y(T),m[i+4>>2]=_*y(x),m[i>>2]=f*y(S),a=l+b(c,p[o+2>>1])|0,S=g[a>>3],x=g[a+8>>3],T=g[a+16>>3],d[i+28>>2]=0,m[i+24>>2]=h*y(T),m[i+20>>2]=_*y(x),m[i+16>>2]=f*y(S),o=l+b(c,p[o+4>>1])|0,S=g[o>>3],x=g[o+8>>3],T=g[o+16>>3],d[i+44>>2]=0,m[i+40>>2]=h*y(T),m[i+36>>2]=_*y(x),m[i+32>>2]=f*y(S),r[d[d[t>>2]+8>>2]](t,i,E,n),(0|(n=n+1|0))>2];);break e;case 3:break t;default:break e}if(n=0,!(d[i+48>>2]<=0))for(;l=d[i+76>>2],c=d[i+56>>2],o=d[i+72>>2]+b(d[i+68>>2],n)|0,a=l+b(c,u[0|o])|0,S=g[a>>3],x=g[a+8>>3],T=g[a+16>>3],d[i+12>>2]=0,m[i+8>>2]=h*y(T),m[i+4>>2]=_*y(x),m[i>>2]=f*y(S),a=l+b(c,u[o+1|0])|0,S=g[a>>3],x=g[a+8>>3],T=g[a+16>>3],d[i+28>>2]=0,m[i+24>>2]=h*y(T),m[i+20>>2]=_*y(x),m[i+16>>2]=f*y(S),o=l+b(c,u[o+2|0])|0,S=g[o>>3],x=g[o+8>>3],T=g[o+16>>3],d[i+44>>2]=0,m[i+40>>2]=h*y(T),m[i+36>>2]=_*y(x),m[i+32>>2]=f*y(S),r[d[d[t>>2]+8>>2]](t,i,E,n),(0|(n=n+1|0))>2];);}if(r[d[d[e>>2]+24>>2]](e,E),(0|s)==(0|(E=E+1|0)))break}O=i+80|0},r[559]=Bs,r[560]=Bs,r[561]=Rd,r[562]=Rd,r[563]=hd,r[564]=Rd,r[565]=Rd,r[566]=function(e){return 1==d[48+(e|=0)>>2]|0},r[567]=function(e,t,i){e|=0,i|=0;var n=0;n=d[4+(t|=0)>>2],d[e+52>>2]=d[t>>2],d[e+56>>2]=n,n=d[t+12>>2],d[e+60>>2]=d[t+8>>2],d[e+64>>2]=n,t=d[i+4>>2],d[e+68>>2]=d[i>>2],d[e+72>>2]=t,t=d[i+12>>2],d[e+76>>2]=d[i+8>>2],d[e+80>>2]=t,d[e+48>>2]=1},r[568]=function(e,t,i){t|=0,i|=0;var n=0;n=d[56+(e|=0)>>2],d[t>>2]=d[e+52>>2],d[t+4>>2]=n,n=d[e+64>>2],d[t+8>>2]=d[e+60>>2],d[t+12>>2]=n,t=d[e+80>>2],d[i+8>>2]=d[e+76>>2],d[i+12>>2]=t,t=d[e+72>>2],d[i>>2]=d[e+68>>2],d[i+4>>2]=t},r[569]=function(e){return 28},r[570]=function(e,t,i){t|=0,i|=0;var n,o=0,a=0,l=0,c=0,h=0,f=0,m=0,g=0,y=0,v=0,A=0,C=0,S=0;if(O=n=O-32|0,o=0|r[d[d[(e|=0)>>2]+28>>2]](e),d[t>>2]=0,d[t+20>>2]=o,o){if(C=0|r[d[d[i>>2]+16>>2]](i,32,o),h=d[C+8>>2],d[t>>2]=r[d[d[i>>2]+28>>2]](i,h),(0|(S=0|r[d[d[e>>2]+28>>2]](e)))>0)for(;;){r[d[d[e>>2]+16>>2]](e,n+28|0,n+4|0,n+16|0,n+8|0,n+24|0,n+20|0,n,n+12|0,A),o=d[n>>2],d[h+24>>2]=o,a=d[n+4>>2],d[h>>2]=0,d[h+4>>2]=0,d[h+28>>2]=a,d[h+8>>2]=0,d[h+12>>2]=0,d[h+16>>2]=0,d[h+20>>2]=0;e:{t:switch(d[n+12>>2]+-2|0){case 0:if(!o)break e;if(a=0|r[d[d[i>>2]+16>>2]](i,4,b(o,3)),f=d[a+8>>2],d[h+8>>2]=r[d[d[i>>2]+28>>2]](i,f),d[n>>2]>=1)for(o=0,m=d[n+24>>2];l=f+b(o,12)|0,c=m+b(d[n+20>>2],o)|0,d[l>>2]=d[c>>2],d[l+4>>2]=d[c+4>>2],d[l+8>>2]=d[c+8>>2],(0|(o=o+1|0))>2];);r[d[d[i>>2]+20>>2]](i,a,16074,1497453121,d[a+8>>2]);break e;case 1:if(!o)break e;if(a=0|r[d[d[i>>2]+16>>2]](i,8,o),f=d[a+8>>2],d[h+12>>2]=r[d[d[i>>2]+28>>2]](i,f),(0|(m=d[n>>2]))>=1)for(o=0,g=d[n+20>>2],y=d[n+24>>2];l=f+(o<<3)|0,c=y+b(o,g)|0,_[l>>1]=p[c>>1],_[l+2>>1]=p[c+2>>1],_[l+4>>1]=p[c+4>>1],(0|m)!=(0|(o=o+1|0)););r[d[d[i>>2]+20>>2]](i,a,16089,1497453121,d[a+8>>2]);break e;case 3:break t;default:break e}if(o){if(a=0|r[d[d[i>>2]+16>>2]](i,4,o),f=d[a+8>>2],d[h+16>>2]=r[d[d[i>>2]+28>>2]](i,f),o=0,d[n>>2]>=1)for(;l=f+(o<<2)|0,c=d[n+24>>2]+b(d[n+20>>2],o)|0,s[0|l]=u[0|c],s[l+1|0]=u[c+1|0],s[l+2|0]=u[c+2|0],(0|(o=o+1|0))>2];);r[d[d[i>>2]+20>>2]](i,a,16116,1497453121,d[a+8>>2])}}e:{t:switch(d[n+16>>2]){case 0:if(!(o=d[n+4>>2]))break e;if(a=0|r[d[d[i>>2]+16>>2]](i,16,o),f=d[a+8>>2],d[h>>2]=r[d[d[i>>2]+28>>2]](i,f),(0|(m=d[n+4>>2]))>=1)for(o=0,g=d[n+8>>2],y=d[n+28>>2];l=f+(o<<4)|0,c=y+b(o,g)|0,d[l>>2]=d[c>>2],d[l+4>>2]=d[c+4>>2],d[l+8>>2]=d[c+8>>2],(0|m)!=(0|(o=o+1|0)););r[d[d[i>>2]+20>>2]](i,a,16139,1497453121,d[a+8>>2]);break e;case 1:break t;default:break e}if(o=d[n+4>>2]){if(c=0|r[d[d[i>>2]+16>>2]](i,32,o),f=d[c+8>>2],d[h+4>>2]=r[d[d[i>>2]+28>>2]](i,f),(0|(m=d[n+4>>2]))>=1)for(o=0,g=d[n+8>>2],y=d[n+28>>2];l=y+b(o,g)|0,v=d[l+4>>2],d[(a=f+(o<<5)|0)>>2]=d[l>>2],d[a+4>>2]=v,v=d[l+12>>2],d[a+8>>2]=d[l+8>>2],d[a+12>>2]=v,v=d[l+20>>2],d[a+16>>2]=d[l+16>>2],d[a+20>>2]=v,(0|m)!=(0|(o=o+1|0)););r[d[d[i>>2]+20>>2]](i,c,16158,1497453121,d[c+8>>2])}}if(r[d[d[e>>2]+24>>2]](e,A),h=h+32|0,(0|S)==(0|(A=A+1|0)))break}r[d[d[i>>2]+20>>2]](i,C,16178,1497453121,d[C+8>>2])}return d[t+4>>2]=d[e+4>>2],d[t+8>>2]=d[e+8>>2],d[t+12>>2]=d[e+12>>2],d[t+16>>2]=d[e+16>>2],O=n+32|0,16193},r[571]=Yn,r[572]=function(e){(e=Yn(e|=0))&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[573]=function(e,t){t|=0;var i=0,n=0,o=0,a=0,l=0,c=0;e:{if(u[165+(e|=0)|0]){if(d[e+92>>2]>=(0|t))break e;if(t?(d[7717]=d[7717]+1,o=0|r[d[6606]](t<<4,16)):o=0,(0|(l=d[e+88>>2]))>=1)for(;a=(n=i<<4)+o|0,n=n+d[e+96>>2]|0,c=d[n+4>>2],d[a>>2]=d[n>>2],d[a+4>>2]=c,c=d[n+12>>2],d[a+8>>2]=d[n+8>>2],d[a+12>>2]=c,(0|l)!=(0|(i=i+1|0)););return(i=d[e+96>>2])&&(u[e+100|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+96>>2]=0),d[e+96>>2]=o,d[e+92>>2]=t,void(s[e+100|0]=1)}if(!(d[e+112>>2]>=(0|t))){t&&(d[7717]=d[7717]+1,n=0|r[d[6606]](t<<2,16)),o=d[e+116>>2];t:{i:{if((0|(a=d[e+108>>2]))>=1)for(;;)if(d[(l=i<<2)+n>>2]=d[o+l>>2],(0|a)==(0|(i=i+1|0)))break i;if(!o)break t}u[e+120|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+116>>2]=0}d[e+116>>2]=n,d[e+112>>2]=t,s[e+120|0]=1}}},r[574]=function(e,t){t|=0;var i=0,n=0,o=0,a=0,l=0;e:{if(u[164+(e|=0)|0]){if(d[e+132>>2]>=(0|t))break e;t&&(d[7717]=d[7717]+1,o=0|r[d[6606]](t<<2,16)),i=d[e+136>>2];t:{i:{if((0|(a=d[e+128>>2]))>=1)for(;;)if(d[(l=n<<2)+o>>2]=d[i+l>>2],(0|a)==(0|(n=n+1|0)))break i;if(!i)break t}u[e+140|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+136>>2]=0}return d[e+136>>2]=o,d[e+132>>2]=t,void(s[e+140|0]=1)}if(!(d[e+152>>2]>=(0|t))){t&&(d[7717]=d[7717]+1,o=0|r[d[6606]](t<<1,16)),i=d[e+156>>2];t:{i:{if((0|(a=d[e+148>>2]))>=1)for(;;)if(_[(l=n<<1)+o>>1]=p[i+l>>1],(0|a)==(0|(n=n+1|0)))break i;if(!i)break t}u[e+160|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+156>>2]=0}d[e+156>>2]=o,d[e+152>>2]=t,s[e+160|0]=1}}},r[575]=rr,r[576]=function(e){rr(e|=0),e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[577]=function(e,t,i,n,s,o,a,l,c){var h;return n|=0,c=function(e,t,i,n,r,s,o,a){var l,c,h,u=0,f=0;if(O=c=O-16|0,Vn(e,c+10|0,t,0),Vn(e,c+4|0,i,1),l=(t=d[e+60>>2])+((h=p[e+64>>1])<<6)|0,_[e+64>>1]=p[l+48>>1],i=p[e+56>>1]+1|0,_[e+56>>1]=i,d[l+8>>2]=a,_[l+6>>1]=s,_[l+4>>1]=r,d[l>>2]=n,d[l+12>>2]=h,_[t+54>>1]=p[t+54>>1]+2,a=(t=d[e+68>>2])+(s=4|(n=(r=65534&(i<<=1))<<2))|0,u=p[(u=(u=t)+(t=(r=r+-1|0)<<2)|0)>>1]|p[u+2>>1]<<16,_[a>>1]=u,_[a+2>>1]=u>>>16,a=p[c+10>>1],u=d[e+68>>2],_[2+(f=u+t|0)>>1]=h,_[f>>1]=a,a=p[c+4>>1],_[2+(u=n+u|0)>>1]=h,_[u>>1]=a,_[l+54>>1]=i,_[l+48>>1]=r,a=d[e+60>>2],_[a+56>>1]=p[a+56>>1]+2,u=(a=d[e+72>>2])+s|0,a=p[(a=t+a|0)>>1]|p[a+2>>1]<<16,_[u>>1]=a,_[u+2>>1]=a>>>16,a=p[c+12>>1],u=d[e+72>>2],_[2+(f=u+t|0)>>1]=h,_[f>>1]=a,a=p[c+6>>1],_[2+(u=n+u|0)>>1]=h,_[u>>1]=a,_[l+56>>1]=i,_[l+50>>1]=r,a=d[e+60>>2],_[a+58>>1]=p[a+58>>1]+2,a=(a=s)+(s=d[e+76>>2])|0,s=p[(s=t+s|0)>>1]|p[s+2>>1]<<16,_[a>>1]=s,_[a+2>>1]=s>>>16,s=p[c+14>>1],a=t,t=d[e+76>>2],_[2+(a=a+t|0)>>1]=h,_[a>>1]=s,s=p[c+8>>1],_[2+(t=t+n|0)>>1]=h,_[t>>1]=s,_[l+58>>1]=i,_[l+52>>1]=r,n=d[e+68>>2],s=p[l+48>>1]<<2,r=p[(t=(i=n+s|0)-4|0)>>1],p[i>>1]>>0){for(s=(a=d[e+60>>2])+(p[2+(n+s|0)>>1]<<6)|0;a=(p[2+(n=i+-4|0)>>1]<<6)+a|0,_[(r=1&r?a+54|0:a+48|0)>>1]=p[r>>1]+1,_[s+48>>1]=p[s+48>>1]+-1,r=p[i>>1]|p[i+2>>1]<<16,a=p[t>>1]|p[t+2>>1]<<16,_[i>>1]=a,_[i+2>>1]=a>>>16,_[t>>1]=r,_[t+2>>1]=r>>>16,r=p[(t=t+-4|0)>>1],p[n>>1]>>0;)a=d[e+60>>2],i=n;n=d[e+68>>2]}s=p[l+54>>1],r=p[(t=(i=(s<<2)+n|0)-4|0)>>1];e:if(!(p[i>>1]>=r>>>0))for(s=(a=d[e+60>>2])+(p[2+((s<<2)+n|0)>>1]<<6)|0;;){if(a=(p[2+(n=i+-4|0)>>1]<<6)+a|0,_[(r=1&r?a+54|0:a+48|0)>>1]=p[r>>1]+1,_[s+54>>1]=p[s+54>>1]+-1,r=p[i>>1]|p[i+2>>1]<<16,a=p[t>>1]|p[t+2>>1]<<16,_[i>>1]=a,_[i+2>>1]=a>>>16,_[t>>1]=r,_[t+2>>1]=r>>>16,r=p[(t=t+-4|0)>>1],p[n>>1]>=r>>>0)break e;a=d[e+60>>2],i=n}if(n=d[e+72>>2],s=p[l+50>>1]<<2,r=p[(t=(i=n+s|0)-4|0)>>1],p[i>>1]>>0){for(s=(a=d[e+60>>2])+(p[2+(n+s|0)>>1]<<6)|0;a=(p[2+(n=i+-4|0)>>1]<<6)+a|0,_[(r=1&r?a+56|0:a+50|0)>>1]=p[r>>1]+1,_[s+50>>1]=p[s+50>>1]+-1,r=p[i>>1]|p[i+2>>1]<<16,a=p[t>>1]|p[t+2>>1]<<16,_[i>>1]=a,_[i+2>>1]=a>>>16,_[t>>1]=r,_[t+2>>1]=r>>>16,r=p[(t=t+-4|0)>>1],p[n>>1]>>0;)a=d[e+60>>2],i=n;n=d[e+72>>2]}s=p[l+56>>1],r=p[(t=(i=(s<<2)+n|0)-4|0)>>1];e:if(!(p[i>>1]>=r>>>0))for(s=(a=d[e+60>>2])+(p[2+((s<<2)+n|0)>>1]<<6)|0;;){if(a=(p[2+(n=i+-4|0)>>1]<<6)+a|0,_[(r=1&r?a+56|0:a+50|0)>>1]=p[r>>1]+1,_[s+56>>1]=p[s+56>>1]+-1,r=p[i>>1]|p[i+2>>1]<<16,a=p[t>>1]|p[t+2>>1]<<16,_[i>>1]=a,_[i+2>>1]=a>>>16,_[t>>1]=r,_[t+2>>1]=r>>>16,r=p[(t=t+-4|0)>>1],p[n>>1]>=r>>>0)break e;a=d[e+60>>2],i=n}return cn(e,2,p[l+52>>1]),sn(e,2,p[l+58>>1],o),O=c+16|0,h}(e|=0,t|=0,i|=0,s|=0,o|=0,a|=0,l|=0,c|=0),h=d[e+60>>2],(e=d[e+108>>2])&&(d[60+((c<<6)+h|0)>>2]=r[d[d[e>>2]+8>>2]](e,t,i,n,s,o,a,l,0)),(c<<6)+h|0},r[578]=function(e,t,i){var n;t|=0,i|=0,(n=d[108+(e|=0)>>2])&&r[d[d[n>>2]+12>>2]](n,d[t+60>>2],i),function(e,t,i){var n,s,o=0,a=0,l=0,c=0,h=0,u=0,f=0,m=0,g=0;for(n=d[e+60>>2],o=d[e+92>>2],r[d[d[o>>2]+56>>2]](o)||(o=d[e+92>>2],r[d[d[o>>2]+16>>2]](o,(t<<6)+n|0,i)),o=p[e+56>>1],i=d[e+60>>2],_[i+54>>1]=p[i+54>>1]+-2,_[i+56>>1]=p[i+56>>1]+-2,_[i+58>>1]=p[i+58>>1]+-2,i=p[e+6>>1],s=(o<<1)-1<<2;;){if(h=d[68+(m=(f<<2)+e|0)>>2],l=p[54+(g=(u=f<<1)+((t<<6)+n|0)|0)>>1]<<2,_[(o=h+l|0)>>1]=i,c=h,a=p[o+6>>1]){for(l=(d[e+60>>2]+(p[2+(l+h|0)>>1]<<6)|0)+u|0;(c=65535&i)>>>0>=(i=p[o+4>>1])>>>0&&(a=(d[e+60>>2]+(a<<6)|0)+u|0,_[(i=1&i?a+54|0:a+48|0)>>1]=p[i>>1]+-1,_[l+54>>1]=p[l+54>>1]+1,a=p[o+4>>1]|p[o+6>>1]<<16,i=p[o>>1]|p[o+2>>1]<<16,_[o+4>>1]=i,_[o+6>>1]=i>>>16,_[o>>1]=a,_[o+2>>1]=a>>>16,a=o,o=o+4|0,a=p[a+10>>1]););i=p[e+6>>1],c=d[m+68>>2]}if(a=c,o=p[g+48>>1]<<2,_[o+h>>1]=i,a=p[6+(o=o+a|0)>>1]){for(l=(d[e+60>>2]+(p[o+2>>1]<<6)|0)+u|0,i=p[o>>1];(c=65535&i)>>>0>=(i=p[o+4>>1])>>>0&&(a=(d[e+60>>2]+(a<<6)|0)+u|0,_[(i=1&i?a+54|0:a+48|0)>>1]=p[i>>1]+-1,_[l+48>>1]=p[l+48>>1]+1,a=p[o+4>>1]|p[o+6>>1]<<16,i=p[o>>1]|p[o+2>>1]<<16,_[o+4>>1]=i,_[o+6>>1]=i>>>16,_[o>>1]=a,_[o+2>>1]=a>>>16,a=o,o=o+4|0,a=p[a+10>>1]););i=p[e+6>>1]}if(_[(o=h+s|0)>>1]=i,_[o+2>>1]=0,3==(0|(f=f+1|0)))break}_[48+(d[e+60>>2]+(t<<6)|0)>>1]=p[e+64>>1],_[e+64>>1]=t,_[e+56>>1]=p[e+56>>1]+-1}(e,p[t+12>>1],i)},r[579]=function(e,t,i,n,s){e|=0,t|=0,n|=0,s|=0;var o=0,a=0;o=d[4+(i|=0)>>2],d[t+16>>2]=d[i>>2],d[t+20>>2]=o,o=d[i+12>>2],d[t+24>>2]=d[i+8>>2],d[t+28>>2]=o,a=d[(o=n)+4>>2],d[t+32>>2]=d[o>>2],d[t+36>>2]=a,a=d[o+12>>2],d[t+40>>2]=d[o+8>>2],d[t+44>>2]=a,function(e,t,i,n,r){var s,o=0,a=0,l=0,c=0,h=0,u=0,f=0,m=0;for(O=s=O-16|0,l=d[e+60>>2],Vn(e,s+10|0,i,0),Vn(e,s+4|0,n,1),l=l+(t<<6)|0;a=d[68+((o<<2)+e|0)>>2],i=p[48+(n=(t=o<<1)+l|0)>>1],u=p[(c=a+(i<<2)|0)>>1],n=p[n+54>>1],f=p[(a=a+(n<<2)|0)>>1],m=p[(h=t+(s+4|0)|0)>>1],t=p[t+(s+10|0)>>1],_[c>>1]=t,_[a>>1]=p[h>>1],(0|(t=t-u|0))<=-1&&cn(e,o,i),(0|(a=m-f|0))>=1&&on(e,o,n),(0|t)>=1&&hn(e,o,i,r),(0|a)<=-1&&sn(e,o,n,r),3!=(0|(o=o+1|0)););O=s+16|0}(e,p[t+12>>1],i,o,s),(e=d[e+108>>2])&&r[d[d[e>>2]+16>>2]](e,d[t+60>>2],i,n,s)},r[580]=Js,r[581]=function(e,t,i,n,o,a){var l;if(t|=0,i|=0,n|=0,o|=0,a|=0,l=d[108+(e|=0)>>2])r[d[d[l>>2]+24>>2]](l,t,i,n,o,a);else if(i=p[e+56>>1])for(o=1,t=1;o=d[e+68>>2]+(o<<2)|0,1&s[0|o]&&(r[d[d[n>>2]+8>>2]](n,d[e+60>>2]+(p[o+2>>1]<<6)|0),i=p[e+56>>1]),((65535&i)<<1|1)>>>0>(o=65535&(t=t+1|0))>>>0;);},r[582]=function(e,t,i,n){t|=0,i|=0,n|=0;var o=0,a=0,l=0,c=0,h=0;if(o=d[108+(e|=0)>>2])r[d[d[o>>2]+28>>2]](o,t,i,n);else if(l=p[e+56>>1])for(o=1,c=1;a=d[e+68>>2]+(o<<2)|0,1&s[0|a]&&(h=0,a=d[e+60>>2]+(p[a+2>>1]<<6)|0,o=0,m[t>>2]>m[a+32>>2]||(o=0,m[i>>2]>2]||(o=1)),h=m[i+8>>2]>2]|m[t+8>>2]>m[a+40>>2]?h:o,m[i+4>>2]>2]|m[t+4>>2]>m[a+36>>2]|1^h||(r[d[d[n>>2]+8>>2]](n,a),l=p[e+56>>1])),(l<<1|1)>>>0>(o=65535&(c=c+1|0))>>>0;);},r[583]=function(e,t){t|=0;var i,n=0,o=0,a=0,l=0,c=0,h=0,_=0,f=0,m=0,g=0;if(O=i=O-16|0,o=d[92+(e|=0)>>2],r[d[d[o>>2]+56>>2]](o)){if(o=d[e+92>>2],a=0|r[d[d[o>>2]+28>>2]](o),(0|(_=d[a+4>>2]))>=2&&(Ii(a,i+8|0,0,_+-1|0),_=d[a+4>>2]),o=_-(n=d[e+104>>2])|0,(0|n)<=-1){if(d[a+8>>2]<(0|o)){if(o?(d[7717]=d[7717]+1,c=0|r[d[6606]](o<<4,16),n=d[a+4>>2]):n=_,(0|n)>=1)for(;h=(l=f<<4)+c|0,l=l+d[a+12>>2]|0,d[h>>2]=d[l>>2],d[h+4>>2]=d[l+4>>2],d[h+8>>2]=d[l+8>>2],d[h+12>>2]=d[l+12>>2],(0|n)!=(0|(f=f+1|0)););(n=d[a+12>>2])&&(u[a+16|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[a+12>>2]=0),d[a+12>>2]=c,s[a+16|0]=1,d[a+8>>2]=o}for(;n=d[a+12>>2]+(_<<4)|0,d[n>>2]=0,d[n+4>>2]=0,d[n+8>>2]=0,d[n+12>>2]=0,(0|o)!=(0|(_=_+1|0)););}if(d[a+4>>2]=o,d[e+104>>2]=0,_=a,(0|o)>=1){for(l=0,c=0,f=0;h=d[a+12>>2]+(l<<4)|0,n=d[h+4>>2],g=c,c=d[h>>2],!(((0|n)==(0|f)?(0|g)==(0|c):0)|p[c+54>>1]>1]|p[n+54>>1]>1]|p[c+56>>1]>1]||p[n+56>>1]>1]|p[c+58>>1]>1])&&p[n+58>>1]>=p[c+52>>1]||(o=d[e+92>>2],r[d[d[o>>2]+32>>2]](o,h,t),d[h>>2]=0,d[h+4>>2]=0,m=d[e+104>>2]+1|0,d[e+104>>2]=m,d[7305]=d[7305]+-1,o=d[a+4>>2]),f=n,(0|(l=l+1|0))<(0|o););if((0|o)>=2&&(Ii(a,i,0,o+-1|0),m=d[e+104>>2],o=d[a+4>>2]),n=o-m|0,(0|m)<=-1){if(d[a+8>>2]<(0|n)){if(n?(d[7717]=d[7717]+1,c=0|r[d[6606]](n<<4,16),t=d[a+4>>2]):(c=0,t=o),(0|t)>=1)for(f=0;h=(l=f<<4)+c|0,l=l+d[a+12>>2]|0,d[h>>2]=d[l>>2],d[h+4>>2]=d[l+4>>2],d[h+8>>2]=d[l+8>>2],d[h+12>>2]=d[l+12>>2],(0|t)!=(0|(f=f+1|0)););(t=d[a+12>>2])&&(u[a+16|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[a+12>>2]=0),d[a+12>>2]=c,s[a+16|0]=1,d[a+8>>2]=n}for(;t=d[a+12>>2]+(o<<4)|0,d[t>>2]=0,d[t+4>>2]=0,d[t+8>>2]=0,d[t+12>>2]=0,(0|n)!=(0|(o=o+1|0)););}o=n}d[_+4>>2]=o,d[e+104>>2]=0}O=i+16|0},r[584]=ad,r[585]=ad,r[586]=function(e,t,i){t|=0,i|=0;var n=0;n=d[12+(e|=0)>>2],d[t>>2]=d[e+8>>2],d[t+4>>2]=n,n=d[e+20>>2],d[t+8>>2]=d[e+16>>2],d[t+12>>2]=n,t=d[e+36>>2],d[i+8>>2]=d[e+32>>2],d[i+12>>2]=t,t=d[e+28>>2],d[i>>2]=d[e+24>>2],d[i+4>>2]=t},r[587]=function(e,t){t|=0;var i=0,n=0;if(!p[56+(e|=0)>>1]){if(t=1,_[e+64>>1]=1,n=d[e+60>>2],(i=p[e+58>>1])>>>0>1)for(;i=(t<<6)+n|0,t=t+1|0,_[i+48>>1]=t,t>>>0<(i=p[e+58>>1])>>>0;);_[((i<<6)+n|0)-16>>1]=0}},r[588]=Fd,r[589]=function(e){(e=rr(e|=0))&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[590]=function(e){var t;return d[(e|=0)>>2]=16704,(t=d[e+16>>2])&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+16>>2]=0,s[e+20|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,0|e},r[591]=function(e){var t;d[(e|=0)>>2]=16704,!(t=d[e+16>>2])|!u[e+20|0]||t&&(d[7718]=d[7718]+1,r[d[6607]](t)),ve(e)},r[592]=$_,r[593]=function(e,t,i,n){return 0},r[594]=fd,r[595]=ld,r[596]=ld,r[597]=md,r[598]=fd,r[599]=Cd,r[600]=fd,r[601]=Rd,r[602]=fd,r[603]=$_,r[604]=xd,r[605]=Rd,r[606]=Rd,r[607]=Or,r[608]=function(e){ve(Or(e|=0))},r[609]=function(e,t,i){e|=0,t|=0,i|=0;var n,o=0;d[7307]=d[7307]+1;e:{t:{if(n=d[e+24>>2]){if(r[d[d[n>>2]+8>>2]](n,t,i))break t;break e}if(!(p[i+6>>1]&p[t+4>>1])|!(p[t+6>>1]&p[i+4>>1]))break e}o=function(e,t,i){var n,o,a,l=0,c=0,h=0,_=0,p=0,f=0,m=0;l=d[t+12>>2]>d[i+12>>2],f=d[(n=l?t:i)+12>>2],h=d[(o=l?i:t)+12>>2],t=b((t=((t=f<<16|h)<<15^-1)+t|0)>>10^t,9),m=(a=(t=((t^=t>>6)<<11^-1)+t|0)>>16^t)&(l=d[e+12>>2])+-1;t:{if(-1!=(0|(t=d[d[e+44>>2]+(m<<2)>>2])))for(c=d[e+16>>2];;){if(i=(_=t<<4)+c|0,(0|f)==d[d[4+(c+_|0)>>2]+12>>2]&&(0|h)==d[d[i>>2]+12>>2])break t;if(-1==(0|(t=d[d[e+64>>2]+(t<<2)>>2])))break}if((0|(t=l))==(0|(i=h=d[e+8>>2]))&&(i=l,!((0|t)>=(0|(c=t?t<<1:1))))){if(c?(d[7717]=d[7717]+1,i=0|r[d[6606]](c<<4,16),t=d[e+8>>2]):(i=0,t=l),(0|(f=t))>=1)for(t=0;_=(p=t<<4)+i|0,p=p+d[e+16>>2]|0,d[_>>2]=d[p>>2],d[_+4>>2]=d[p+4>>2],d[_+8>>2]=d[p+8>>2],d[_+12>>2]=d[p+12>>2],(0|f)!=(0|(t=t+1|0)););(t=d[e+16>>2])&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+16>>2]=i,d[e+12>>2]=c,s[e+20|0]=1,i=d[e+8>>2],t=c}d[e+8>>2]=i+1,c=d[e+16>>2],(i=d[e+72>>2])&&(r[d[d[i>>2]+8>>2]](i,o,n),t=d[e+12>>2]),i=c+(h<<4)|0,(0|l)<(0|t)&&(ti(e),m=d[e+12>>2]+-1&a),l=d[o+12>>2]>2],d[i>>2]=l?o:n,d[8+(t=c+(h<<4)|0)>>2]=0,d[t+12>>2]=0,d[t+4>>2]=l?n:o,t=d[e- -64>>2]+(h<<2)|0,e=d[e+44>>2]+(m<<2)|0,d[t>>2]=d[e>>2],d[e>>2]=h}return i}(e,t,i)}return 0|o},r[610]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s=0,o=0,a=0,l=0,c=0,h=0,_=0;d[7306]=d[7306]+1,s=d[t+12>>2]>d[i+12>>2],o=d[(l=s?t:i)+12>>2],a=d[(c=s?i:t)+12>>2],t=b((t=((t=o<<16|a)<<15^-1)+t|0)>>10^t,9),t=((t^=t>>6)<<11^-1)+t|0,h=d[e+12>>2]+-1&(t>>16^t);e:if(-1!=(0|(t=d[d[e+44>>2]+(h<<2)>>2]))){for(s=d[e+16>>2];;){if((0|o)!=d[d[4+(i=s+(t<<4)|0)>>2]+12>>2]||(0|a)!=d[d[i>>2]+12>>2]){if(-1!=(0|(t=d[d[e+64>>2]+(t<<2)>>2])))continue;break e}break}r[d[d[e>>2]+32>>2]](e,i,n),_=d[12+(s+(t<<4)|0)>>2],o=d[e+64>>2];t:{if(a=d[e+44>>2]+(h<<2)|0,(0|(t=d[a>>2]))!=(0|(s=i-d[e+16>>2]>>4))){for(;i=t,(0|s)!=(0|(t=d[o+(t<<2)>>2])););if(t=d[o+(s<<2)>>2],-1!=(0|i)){d[o+(i<<2)>>2]=t;break t}}else t=d[o+(s<<2)>>2];d[a>>2]=t}if(o=d[e+8>>2]+-1|0,(t=d[e+72>>2])&&r[d[d[t>>2]+12>>2]](t,c,l,n),(0|o)==(0|s))return d[e+8>>2]=d[e+8>>2]+-1,0|_;l=d[e+64>>2];t:{if(c=d[e+16>>2],t=d[d[4+(n=c+(o<<4)|0)>>2]+12>>2]<<16|d[d[n>>2]+12>>2],t=b((t=(t<<15^-1)+t|0)>>10^t,9),t=((t^=t>>6)<<11^-1)+t|0,a=d[e+12>>2]+-1&(t>>16^t),h=d[e+44>>2]+(a<<2)|0,(0|o)!=(0|(t=d[h>>2]))){for(;i=t,(0|o)!=(0|(t=d[l+(t<<2)>>2])););if(t=d[l+(o<<2)>>2],-1!=(0|i)){d[l+(i<<2)>>2]=t;break t}}else t=d[l+(o<<2)>>2];d[h>>2]=t}i=d[n+4>>2],d[(t=c+(s<<4)|0)>>2]=d[n>>2],d[t+4>>2]=i,i=d[n+12>>2],d[t+8>>2]=d[n+8>>2],d[t+12>>2]=i,t=d[e+44>>2]+(a<<2)|0,d[d[e+64>>2]+(s<<2)>>2]=d[t>>2],d[t>>2]=s,d[e+8>>2]=d[e+8>>2]+-1}return 0|_},r[611]=function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=t,d[n+8>>2]=17112,r[d[d[e>>2]+48>>2]](e,n+8|0,i),O=n+16|0},r[612]=ld,r[613]=ld,r[614]=md,r[615]=function(e,t,i){e|=0,t|=0,(i|=0)&&(e=d[t+8>>2])&&(r[d[d[e>>2]>>2]](e),r[d[d[i>>2]+60>>2]](i,d[t+8>>2]),d[t+8>>2]=0)},r[616]=ud,r[617]=function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=i,d[n+8>>2]=e,d[n+4>>2]=t,d[n>>2]=16968,r[d[d[e>>2]+48>>2]](e,n,i),O=n+16|0},r[618]=function(e,t){t|=0,d[24+(e|=0)>>2]=t},r[619]=function(e,t,i){t|=0,i|=0;var n=0,s=0;if(d[8+(e|=0)>>2]>=1)for(;s=d[e+16>>2]+(n<<4)|0,r[d[d[t>>2]+8>>2]](t,s)?(r[d[d[e>>2]+12>>2]](e,d[s>>2],d[s+4>>2],i),d[7305]=d[7305]+-1):n=n+1|0,(0|n)>2];);},r[620]=function(e,t,i){e|=0,t|=0,i|=0;var n,r,s=0,o=0;d[7308]=d[7308]+1,s=d[t+12>>2]>d[i+12>>2],n=d[(s?t:i)+12>>2],r=d[(s?i:t)+12>>2],t=b((t=((t=r|n<<16)<<15^-1)+t|0)>>10^t,9),t=((t^=t>>6)<<11^-1)+t|0;e:{if(!((0|(t=d[e+12>>2]+-1&(t>>16^t)))>=d[e+36>>2])&&-1!=(0|(t=d[d[e+44>>2]+(t<<2)>>2])))for(i=d[e+16>>2];;){if(s=i+(o=t<<4)|0,d[d[4+(i+o|0)>>2]+12>>2]==(0|n)&&d[d[s>>2]+12>>2]==(0|r))break e;if(-1==(0|(t=d[d[e+64>>2]+(t<<2)>>2])))break}s=0}return 0|s},r[621]=Cd,r[622]=sd,r[623]=function(e,t){e|=0,t|=0;var i,n=0,o=0,a=0,l=0,c=0,h=0,_=0,p=0;if(O=i=O-32|0,d[i+20>>2]=0,d[i+12>>2]=0,d[i+16>>2]=0,s[i+24|0]=1,!(d[e+8>>2]<1)){for(;;){if(a=d[e+16>>2]+(p<<4)|0,(0|n)==(0|o))if((0|n)>=(0|(o=n?n<<1:1)))o=n;else{if(h=0,l=0,o&&(d[7717]=d[7717]+1,l=0|r[d[6606]](o<<4,16)),(0|n)>=1)for(;_=(c=h<<4)+l|0,c=c+d[i+20>>2]|0,d[_>>2]=d[c>>2],d[_+4>>2]=d[c+4>>2],d[_+8>>2]=d[c+8>>2],d[_+12>>2]=d[c+12>>2],(0|(h=h+1|0))!=(0|n););(n=d[i+20>>2])&&(u[i+24|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+20>>2]=0),d[i+20>>2]=l,s[i+24|0]=1,d[i+16>>2]=o,o=d[i+12>>2]}if(n=d[i+20>>2]+(o<<4)|0,d[n>>2]=d[a>>2],d[n+4>>2]=d[a+4>>2],d[n+8>>2]=d[a+8>>2],d[n+12>>2]=d[a+12>>2],o=(a=d[i+12>>2])+1|0,d[i+12>>2]=o,!((0|(p=p+1|0))>2]))break;n=d[i+16>>2]}if(n=0,!((0|a)<0))for(h=d[i+20>>2];l=h+(n<<4)|0,r[d[d[e>>2]+12>>2]](e,d[l>>2],d[l+4>>2],t),l=(0|n)==(0|a),n=n+1|0,!l;);}if(d[e+56>>2]>=1){for(t=d[e- -64>>2],o=0;d[t+(o<<2)>>2]=-1,(0|(o=o+1|0))>2];);o=d[i+12>>2]}if((0|o)>=2&&(Ii(i+8|0,i,0,o+-1|0),o=d[i+12>>2]),n=d[i+20>>2],(0|o)>=1)for(o=0;t=(o<<4)+n|0,r[d[d[e>>2]+8>>2]](e,d[t>>2],d[t+4>>2]),n=d[i+20>>2],(0|(o=o+1|0))>2];);n&&(u[i+24|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[i+20>>2]=0),O=i+32|0},r[624]=Pd,r[625]=function(e,t){t|=0;var i=0;return(0|(i=d[4+(e|=0)>>2]))!=d[t+4>>2]&&(0|i)!=d[t>>2]||(i=d[e+8>>2],r[d[d[i>>2]+32>>2]](i,t,d[e+12>>2])),0},r[626]=Pd,r[627]=function(e,t){return t|=0,(0|(e=d[4+(e|=0)>>2]))==d[t>>2]|(0|e)==d[t+4>>2]},r[628]=function(e){var t=0;return d[(e|=0)>>2]=17276,u[e+192|0]&&(t=d[e+136>>2],r[d[d[t>>2]>>2]](t),(t=d[e+136>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),ar(e- -64|0),ar(e+4|0),0|e},r[629]=function(e){var t=0;d[(e|=0)>>2]=17276,u[e+192|0]&&(t=d[e+136>>2],r[d[d[t>>2]>>2]](t),(t=d[e+136>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t))),ar(e- -64|0),ar(e+4|0),ve(e)},r[630]=function(e,t,i,n,s,o,a,l,c){return e|=0,t|=0,i|=0,n|=0,s|=0,o|=0,a|=0,l|=0,O=l=O-48|0,d[7717]=d[7717]+1,n=0|r[d[6606]](64,16),_[n+6>>1]=a,_[n+4>>1]=o,d[n>>2]=s,s=d[t+4>>2],d[n+16>>2]=d[t>>2],d[n+20>>2]=s,s=d[t+12>>2],d[n+24>>2]=d[t+8>>2],d[n+28>>2]=s,s=d[i+4>>2],d[n+32>>2]=d[i>>2],d[n+36>>2]=s,s=d[i+12>>2],d[n+40>>2]=d[i+8>>2],d[n+44>>2]=s,d[n+8>>2]=0,d[n+52>>2]=0,d[n+56>>2]=0,s=d[t+12>>2],d[l+24>>2]=d[t+8>>2],d[l+28>>2]=s,s=d[t+4>>2],d[l+16>>2]=d[t>>2],d[l+20>>2]=s,t=d[i+12>>2],d[l+40>>2]=d[i+8>>2],d[l+44>>2]=t,t=d[i+4>>2],d[l+32>>2]=d[i>>2],d[l+36>>2]=t,d[n+60>>2]=d[e+144>>2],t=d[e+188>>2]+1|0,d[e+188>>2]=t,d[n+12>>2]=t,i=e+4|0,d[n+48>>2]=br(i,l+16|0,n),t=d[e+144>>2],d[n+52>>2]=0,t=(t<<2)+e|0,d[n+56>>2]=d[t+124>>2],(s=d[t+124>>2])&&(d[s+52>>2]=n),d[t+124>>2]=n,u[e+193|0]||(d[l+8>>2]=n,d[l>>2]=17372,d[l+4>>2]=e,Si(i,d[e+4>>2],l+16|0,l),Si(e=e- -64|0,d[e>>2],l+16|0,l)),O=l+48|0,0|n},r[631]=function(e,t,i){e|=0,i|=0;var n,o=0;ec(2==d[60+(t|=0)>>2]?e- -64|0:e+4|0,d[t+48>>2]),n=d[t+56>>2],o=(o=d[t+52>>2])?o+56|0:124+((d[t+60>>2]<<2)+e|0)|0,d[o>>2]=n,(o=d[t+56>>2])&&(d[o+52>>2]=d[t+52>>2]),o=d[e+136>>2],r[d[d[o>>2]+16>>2]](o,t,i),t&&(d[7718]=d[7718]+1,r[d[6607]](t)),s[e+194|0]=1},r[632]=function(e,t,i,n,r){e|=0,t|=0,i|=0,n|=0,r|=0;var o,a=0,l=0,c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0);O=r=O-48|0,a=d[i+12>>2],d[r+24>>2]=d[i+8>>2],d[r+28>>2]=a,a=d[i+4>>2],d[r+16>>2]=d[i>>2],d[r+20>>2]=a,l=d[(a=n)+12>>2],d[r+40>>2]=d[a+8>>2],d[r+44>>2]=l,l=d[a+4>>2],d[r+32>>2]=d[a>>2],d[r+36>>2]=l;e:if(2!=d[t+60>>2])if(l=1,d[e+168>>2]=d[e+168>>2]+1,a=d[t+48>>2],m[a>>2]<=m[r+32>>2]^1|m[a+16>>2]>=m[r+16>>2]^1|m[a+4>>2]<=m[r+36>>2]^1|m[a+20>>2]>=m[r+20>>2]^1||m[a+8>>2]<=m[r+40>>2]^1|m[a+24>>2]>=m[r+24>>2]^1)Qr(e+4|0,a,r+16|0),d[e+172>>2]=d[e+172>>2]+1;else{if(p=m[t+20>>2],f=m[t+24>>2],b=m[i>>2],v=m[i+4>>2],A=m[i+8>>2],g=m[t+16>>2],h=m[t+36>>2],_=m[t+40>>2],C=m[t+32>>2],c=m[e+140>>2],d[r+12>>2]=0,_=y(c*y(y(_-f)*y(.5))),m[r+8>>2]=_,h=y(c*y(y(h-p)*y(.5))),m[r+4>>2]=h,c=y(c*y(y(C-g)*y(.5))),m[r>>2]=c,y(b-g)>2]=-c),y(v-p)>2]=-h),y(A-f)>2]=-_),l=0,!zi(e+4|0,a,r+16|0,r,y(.05000000074505806)))break e;l=1,d[e+172>>2]=d[e+172>>2]+1}else ec(e- -64|0,d[t+48>>2]),d[t+48>>2]=br(e+4|0,r+16|0,t),l=1;o=d[t+56>>2],a=(a=d[t+52>>2])?a+56|0:124+((d[t+60>>2]<<2)+e|0)|0,d[a>>2]=o,(a=d[t+56>>2])&&(d[a+52>>2]=d[t+52>>2]),a=d[i+4>>2],d[t+16>>2]=d[i>>2],d[t+20>>2]=a,a=d[i+12>>2],d[t+24>>2]=d[i+8>>2],d[t+28>>2]=a,i=d[n+4>>2],d[t+32>>2]=d[n>>2],d[t+36>>2]=i,i=d[n+12>>2],d[t+40>>2]=d[n+8>>2],d[t+44>>2]=i,i=d[e+144>>2],d[t+60>>2]=i,d[t+52>>2]=0,i=(i<<2)+e|0,d[t+56>>2]=d[i+124>>2],(n=d[i+124>>2])&&(d[n+52>>2]=t),d[i+124>>2]=t,l&&(s[e+194|0]=1,u[e+193|0]||(d[r>>2]=17372,d[r+4>>2]=e,ut(i=e- -64|0,d[i>>2],d[t+48>>2],r),ut(e+4|0,d[e+4>>2],d[t+48>>2],r))),O=r+48|0},r[633]=Js,r[634]=function(e,t,i,n,r,s){var o,a;e|=0,t|=0,i|=0,n|=0,r|=0,s|=0,O=i=O-16|0,d[i+8>>2]=17444,d[i+12>>2]=n,o=n+4|0,a=n+20|0,bt(e+4|0,d[e+4>>2],t,o,a,m[n+32>>2],r,s,i+8|0),bt(e=e- -64|0,d[e>>2],t,o,a,m[n+32>>2],r,s,i+8|0),O=i+16|0},r[635]=function(e,t,i,n){var r;e|=0,t|=0,i|=0,n|=0,O=r=O-48|0,d[r+44>>2]=n,d[r+40>>2]=17516,n=d[t+12>>2],d[r+16>>2]=d[t+8>>2],d[r+20>>2]=n,n=d[t+4>>2],d[r+8>>2]=d[t>>2],d[r+12>>2]=n,t=d[i+12>>2],d[r+32>>2]=d[i+8>>2],d[r+36>>2]=t,t=d[i+4>>2],d[r+24>>2]=d[i>>2],d[r+28>>2]=t,Si(e+4|0,d[e+4>>2],r+8|0,r+40|0),Si(e=e- -64|0,d[e>>2],r+8|0,r+40|0),O=r+48|0},r[636]=function(e,t){(function(e,t){var i,n=0,o=0,a=0,l=0,c=0,h=0,_=0,p=y(0);if(O=i=O-32|0,ei(c=e+4|0,1+((0|b(d[e+152>>2],d[e+16>>2]))/100|0)|0),d[e+164>>2]&&(ei(e- -64|0,n=1+((0|b(d[e+148>>2],d[e+76>>2]))/100|0)|0),n=d[e+164>>2]-n|0,d[e+164>>2]=(0|n)>0?n:0),n=(d[e+144>>2]+1|0)%2|0,d[e+144>>2]=n,o=d[124+((n<<2)+e|0)>>2]){for(l=e- -64|0;n=d[o+56>>2],h=(a=d[o+52>>2])?a+56|0:124+((d[o+60>>2]<<2)+e|0)|0,d[h>>2]=n,(a=d[o+56>>2])&&(d[a+52>>2]=d[o+52>>2]),d[o+52>>2]=0,d[o+56>>2]=d[e+132>>2],(a=d[e+132>>2])&&(d[a+52>>2]=o),d[e+132>>2]=o,ec(c,d[o+48>>2]),a=d[o+28>>2],d[i+8>>2]=d[o+24>>2],d[i+12>>2]=a,a=d[o+20>>2],d[i>>2]=d[o+16>>2],d[i+4>>2]=a,a=d[o+44>>2],d[i+24>>2]=d[o+40>>2],d[i+28>>2]=a,a=d[o+36>>2],d[i+16>>2]=d[o+32>>2],d[i+20>>2]=a,a=br(l,i,o),d[o+60>>2]=2,d[o+48>>2]=a,o=n;);s[e+194|0]=1,d[e+164>>2]=d[e+76>>2]}if(d[i>>2]=17372,d[i+4>>2]=e,u[e+193|0]&&(ut(c,d[e+4>>2],d[e- -64>>2],i),u[e+193|0]&&ut(c,n=d[c>>2],n,i)),u[e+194|0]&&(n=d[e+136>>2],c=0|r[d[d[n>>2]+28>>2]](n),!((0|(l=d[c+4>>2]))<1))){a=e+184|0;e:{if((0|(h=(0|l)<(0|(n=(0|(o=d[e+160>>2]))>(0|(n=(0|b(d[e+156>>2],l))/100|0))?o:n))?l:n))>=1){for(o=0;n=d[c+12>>2]+((d[e+184>>2]+o|0)%(0|l)<<4)|0,l=d[n>>2],_=d[l+48>>2],a=d[n+4>>2],n=d[a+48>>2],!(m[_>>2]<=m[n+16>>2]^1|m[_+16>>2]>=m[n>>2]^1|m[_+4>>2]<=m[n+20>>2]^1|m[_+20>>2]>=m[n+4>>2]^1)&&m[_+8>>2]<=m[n+24>>2]&&m[_+24>>2]>=m[n+8>>2]||(n=d[e+136>>2],r[d[d[n>>2]+12>>2]](n,l,a,t),o=o+-1|0,h=h+-1|0),l=d[c+4>>2],(0|(o=o+1|0))<(0|h););if(a=e+184|0,t=0,(0|l)<=0)break e}t=(d[a>>2]+h|0)%(0|l)|0}d[a>>2]=t}s[e+194|0]=0,d[e+160>>2]=1,d[e+180>>2]=d[e+180>>2]+1,o=d[e+172>>2],t=e,n=d[e+168>>2],p=y(0),n&&(p=y(y(o>>>0)/y(n>>>0))),m[t+176>>2]=p,d[e+172>>2]=o>>>1,d[e+168>>2]=n>>>1,O=i+32|0})(e|=0,t|=0),function(e,t){var i,n=0,o=0,a=0,l=0,c=0,h=0,_=0,p=0,f=0;if(O=i=O-16|0,n=d[e+136>>2],r[d[d[n>>2]+56>>2]](n)){if(n=d[e+136>>2],o=0|r[d[d[n>>2]+28>>2]](n),(0|(n=d[o+4>>2]))>=2&&(Ii(o,i+8|0,0,n+-1|0),n=d[o+4>>2]),(0|n)>=1){for(;p=d[o+12>>2]+(f<<4)|0,l=d[p+4>>2],h=c,c=d[p>>2],((0|a)!=(0|l)||(0|h)!=(0|c))&&(a=d[c+48>>2],h=d[l+48>>2],!(m[a>>2]<=m[h+16>>2]^1|m[a+16>>2]>=m[h>>2]^1|m[a+4>>2]<=m[h+20>>2]^1|m[a+20>>2]>=m[h+4>>2]^1)&&m[a+8>>2]<=m[h+24>>2]&&m[a+24>>2]>=m[h+8>>2])||(n=d[e+136>>2],r[d[d[n>>2]+32>>2]](n,p,t),d[p>>2]=0,d[p+4>>2]=0,_=_+1|0,n=d[o+4>>2]),a=l,(0|(f=f+1|0))<(0|n););if((0|n)>=2&&(Ii(o,i,0,n+-1|0),n=d[o+4>>2]),l=n-_|0,(0|_)<=-1){if(d[o+8>>2]<(0|l)){if(l?(d[7717]=d[7717]+1,_=0|r[d[6606]](l<<4,16),e=d[o+4>>2]):(_=0,e=n),(0|e)>=1)for(t=0;c=(a=t<<4)+_|0,a=a+d[o+12>>2]|0,d[c>>2]=d[a>>2],d[c+4>>2]=d[a+4>>2],d[c+8>>2]=d[a+8>>2],d[c+12>>2]=d[a+12>>2],(0|e)!=(0|(t=t+1|0)););(e=d[o+12>>2])&&(u[o+16|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[o+12>>2]=0),d[o+12>>2]=_,s[o+16|0]=1,d[o+8>>2]=l}for(;e=d[o+12>>2]+(n<<4)|0,d[e>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,(0|l)!=(0|(n=n+1|0)););}n=l}d[o+4>>2]=n}O=i+16|0}(e,t)},r[637]=od,r[638]=od,r[639]=function(e,t,i){e|=0,t|=0,i|=0;var n,r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);n=d[e- -64>>2];e:if(e=d[e+4>>2]){if(o=m[e>>2],n){if(a=(r=m[e+20>>2])>(s=m[n+20>>2])?r:s,l=(r=m[e+8>>2])<(s=m[n+8>>2])?r:s,c=(r=m[e+4>>2])<(s=m[n+4>>2])?r:s,h=(r=m[e+16>>2])>(s=m[n+16>>2])?r:s,o=o<(r=m[n>>2])?o:r,!((r=m[e+24>>2])>(s=m[n+24>>2]))){r=s;break e}break e}s=m[e+28>>2],r=m[e+24>>2],a=m[e+20>>2],h=m[e+16>>2],_=m[e+12>>2],l=m[e+8>>2],c=m[e+4>>2]}else n&&(s=m[n+28>>2],r=m[n+24>>2],a=m[n+20>>2],h=m[n+16>>2],_=m[n+12>>2],l=m[n+8>>2],c=m[n+4>>2],o=m[n>>2]);m[t+12>>2]=_,m[t+8>>2]=l,m[t+4>>2]=c,m[t>>2]=o,m[i+12>>2]=s,m[i+8>>2]=r,m[i+4>>2]=a,m[i>>2]=h},r[640]=function(e,t){d[16+(e|=0)>>2]==(0-d[e+76>>2]|0)&&(Is(e+4|0),Is(e- -64|0),s[e+193|0]=256,s[e+194|0]=1,d[e+164>>2]=0,d[e+144>>2]=0,d[e+156>>2]=10,d[e+160>>2]=1,d[e+148>>2]=1,d[e+152>>2]=0,d[e+124>>2]=0,d[e+128>>2]=0,d[e+132>>2]=0,d[e+168>>2]=0,d[e+172>>2]=0,d[e+176>>2]=0,d[e+180>>2]=0,d[e+184>>2]=0,d[e+188>>2]=0)},r[641]=Fd,r[642]=Pd,r[643]=function(e,t,i){e|=0;var n=0;(0|(t|=0))!=(0|(i|=0))&&(n=d[d[e+4>>2]+136>>2],r[d[d[n>>2]+8>>2]](n,d[t+36>>2],d[i+36>>2]),e=d[e+4>>2],d[e+160>>2]=d[e+160>>2]+1)},r[644]=function(e,t){t|=0,r[d[d[(e|=0)>>2]+8>>2]](e,t,d[d[e+8>>2]+48>>2])},r[645]=Pd,r[646]=y_,r[647]=Pd,r[648]=y_,r[649]=Cn,r[650]=function(e){(e=Cn(e|=0))&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[651]=Id,r[652]=function(e,t){e|=0;var i=0,n=0,r=0,s=0;i=1;e:if(!(!(2&u[236+(t|=0)|0])|!t||(0|(r=d[e+488>>2]))<1))for(s=d[e+496>>2],e=0;;){if(n=d[(e<<2)+s>>2],u[n+20|0]&&(i=0,d[n+28>>2]==(0|t)|d[n+32>>2]==(0|t)))break e;if(i=1,!((0|(e=e+1|0))<(0|r)))break}return 0|i},r[653]=function(e){var t;return d[(e|=0)>>2]=17792,(t=d[e+496>>2])&&(u[e+500|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+496>>2]=0),d[e+496>>2]=0,s[e+500|0]=1,d[e+488>>2]=0,d[e+492>>2]=0,d[e>>2]=3948,0|e},r[654]=function(e){var t;d[(e|=0)>>2]=17792,(t=d[e+496>>2])&&(u[e+500|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+496>>2]=0),d[e+496>>2]=0,s[e+500|0]=1,d[e+488>>2]=0,d[e+492>>2]=0,d[e>>2]=3948,e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[655]=function(e){return 488},r[656]=function(e,t,i){return Mt(e|=0,t|=0,i|=0),d[t+256>>2]=d[e+264>>2],d[t+260>>2]=d[e+268>>2],d[t+264>>2]=d[e+272>>2],d[t+268>>2]=d[e+276>>2],d[t+272>>2]=d[e+280>>2],d[t+276>>2]=d[e+284>>2],d[t+280>>2]=d[e+288>>2],d[t+284>>2]=d[e+292>>2],d[t+288>>2]=d[e+296>>2],d[t+292>>2]=d[e+300>>2],d[t+296>>2]=d[e+304>>2],d[t+300>>2]=d[e+308>>2],d[t+304>>2]=d[e+312>>2],d[t+308>>2]=d[e+316>>2],d[t+312>>2]=d[e+320>>2],d[t+316>>2]=d[e+324>>2],d[t+320>>2]=d[e+328>>2],d[t+324>>2]=d[e+332>>2],d[t+328>>2]=d[e+336>>2],d[t+332>>2]=d[e+340>>2],d[t+448>>2]=d[e+344>>2],d[t+336>>2]=d[e+544>>2],d[t+340>>2]=d[e+548>>2],d[t+344>>2]=d[e+552>>2],d[t+348>>2]=d[e+556>>2],d[t+352>>2]=d[e+348>>2],d[t+356>>2]=d[e+352>>2],d[t+360>>2]=d[e+356>>2],d[t+364>>2]=d[e+360>>2],d[t+368>>2]=d[e+364>>2],d[t+372>>2]=d[e+368>>2],d[t+376>>2]=d[e+372>>2],d[t+380>>2]=d[e+376>>2],d[t+384>>2]=d[e+380>>2],d[t+388>>2]=d[e+384>>2],d[t+392>>2]=d[e+388>>2],d[t+396>>2]=d[e+392>>2],d[t+400>>2]=d[e+396>>2],d[t+404>>2]=d[e+400>>2],d[t+408>>2]=d[e+404>>2],d[t+412>>2]=d[e+408>>2],d[t+416>>2]=d[e+412>>2],d[t+420>>2]=d[e+416>>2],d[t+424>>2]=d[e+420>>2],d[t+428>>2]=d[e+424>>2],d[t+432>>2]=d[e+428>>2],d[t+436>>2]=d[e+432>>2],d[t+440>>2]=d[e+436>>2],d[t+444>>2]=d[e+440>>2],d[t+452>>2]=d[e+444>>2],d[t+456>>2]=d[e+448>>2],d[t+484>>2]=u[e+452|0],d[t+460>>2]=d[e+456>>2],d[t+464>>2]=d[e+460>>2],d[t+468>>2]=d[e+464>>2],d[t+472>>2]=d[e+468>>2],d[t+476>>2]=d[e+472>>2],d[t+480>>2]=d[e+476>>2],17820},r[657]=function(e,t){var i,n,s=0,o=0,a=0,l=0;o=t|=0,a=0|r[d[d[(e|=0)>>2]+16>>2]](e),l=1,s=d[d[t>>2]+16>>2],n=0|r[s](0|o,0|a,0|l),l=t,a=n,o=0|r[d[d[e>>2]+20>>2]](e,d[n+8>>2],t),i=e,s=d[d[t>>2]+20>>2],r[s](0|l,0|a,0|o,1497645650,0|i)},r[658]=function(e){var t=0;return d[(e|=0)>>2]=17876,(t=d[e+56>>2])&&(u[e+60|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+56>>2]=0),d[e+56>>2]=0,s[e+60|0]=1,d[e+48>>2]=0,d[e+52>>2]=0,(t=d[e+36>>2])&&(u[e+40|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+36>>2]=0),d[e+36>>2]=0,s[e+40|0]=1,d[e+28>>2]=0,d[e+32>>2]=0,Na(e+4|0),0|e},r[659]=function(e){var t=0;d[(e|=0)>>2]=17876,(t=d[e+56>>2])&&(u[e+60|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+56>>2]=0),d[e+56>>2]=0,s[e+60|0]=1,d[e+48>>2]=0,d[e+52>>2]=0,(t=d[e+36>>2])&&(u[e+40|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+36>>2]=0),d[e+36>>2]=0,s[e+40|0]=1,d[e+28>>2]=0,d[e+32>>2]=0,Na(e+4|0),ve(e)},r[660]=function(e,t,i){e|=0,i|=0;var n,o=0,a=0,l=0;if((0|(n=d[8+(t|=0)>>2]))<1)i=0;else for(l=d[t+16>>2],i=0;o=d[(a<<2)+l>>2],3&u[o+204|0]||(d[o+208>>2]=i,i=i+1|0),d[o+244>>2]=1065353216,d[o+212>>2]=-1,(0|n)!=(0|(a=a+1|0)););!function(e,t){var i=0,n=0,o=0,a=0,l=0,c=0,h=0;if((0|(n=d[e+4>>2]))<(0|t)){if(d[e+8>>2]<(0|t)){if(t?(d[7717]=d[7717]+1,l=0|r[d[6606]](t<<3,16),i=d[e+4>>2]):i=n,(0|i)>=1)for(;c=(o=a<<3)+l|0,o=d[e+12>>2]+o|0,h=d[o+4>>2],d[c>>2]=d[o>>2],d[c+4>>2]=h,(0|i)!=(0|(a=a+1|0)););(i=d[e+12>>2])&&(u[e+16|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+12>>2]=0),d[e+12>>2]=l,s[e+16|0]=1,d[e+8>>2]=t}for(;i=d[e+12>>2]+(n<<3)|0,d[i>>2]=0,d[i+4>>2]=0,(0|(n=n+1|0))!=(0|t););}if(d[e+4>>2]=t,(0|t)>=1)for(e=d[e+12>>2],n=0;d[4+(i=e+(n<<3)|0)>>2]=1,d[i>>2]=n,(0|(n=n+1|0))!=(0|t););}(e+4|0,i),function(e,t){var i,n=0,s=0,o=0,a=0,l=0,c=0;if(t=d[t+68>>2],t=0|r[d[d[t>>2]+36>>2]](t),(i=0|r[d[d[t>>2]+36>>2]](t))&&(c=0|r[d[d[t>>2]+20>>2]](t),!((0|i)<1)))for(;;){if((n=d[d[(t=(l<<4)+c|0)>>2]>>2])&&!(!(t=d[d[t+4>>2]>>2])|7&d[n+204>>2]|7&u[t+204|0])){if(t=d[t+208>>2],o=d[e+16>>2],a=d[n+208>>2],(0|(n=d[(s=o+(a<<3)|0)>>2]))!=(0|a))for(;n=(n<<3)+o|0,d[s>>2]=d[n>>2],a=d[n>>2],(0|(n=d[(s=(a<<3)+o|0)>>2]))!=(0|a););if((0|(n=d[(s=(t<<3)+o|0)>>2]))!=(0|t))for(;t=(n<<3)+o|0,d[s>>2]=d[t>>2],(0|(t=d[t>>2]))!=(0|(n=d[(s=(t<<3)+o|0)>>2])););(0|t)!=(0|a)&&(d[(n=(a<<3)+o|0)>>2]=t,d[4+(t=(t<<3)+o|0)>>2]=d[t+4>>2]+d[n+4>>2])}if((0|(l=l+1|0))==(0|i))break}}(e,t)},r[661]=function(e,t){e|=0;var i,n=0,r=0,s=0,o=0,a=0,l=0,c=0,h=0;if((0|(i=d[8+(t|=0)>>2]))>=1)for(h=d[t+16>>2],t=0;;){if(r=d[(s<<2)+h>>2],3&u[r+204|0])d[r+208>>2]=-1,d[r+212>>2]=-2;else{if(n=t,o=d[e+16>>2],(0|(l=d[(a=o+(c=t<<3)|0)>>2]))!=(0|t))for(;n=(l<<3)+o|0,d[a>>2]=d[n>>2],(0|(n=d[n>>2]))!=(0|(l=d[(a=(n<<3)+o|0)>>2])););d[r+208>>2]=n,d[4+(o+c|0)>>2]=s,d[r+212>>2]=-1,t=t+1|0}if((0|i)==(0|(s=s+1|0)))break}},r[662]=Di,r[663]=function(e){(e=Di(e|=0))&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[664]=Wn,r[665]=function(e,t,i,n){Li(e|=0,t|=0,i|=0,n|=0)},r[666]=xh,r[667]=function(e,t){var i,n;e|=0,r[d[d[(t|=0)>>2]+32>>2]](t),n=0|r[d[d[t>>2]+16>>2]](t,104,1),i=Mn(d[n+8>>2],0,104),d[i+88>>2]=d[e+248>>2],d[i+92>>2]=d[e+252>>2],d[i+96>>2]=d[e+256>>2],d[i+100>>2]=d[e+260>>2],d[i>>2]=d[e+92>>2],d[i+4>>2]=d[e+96>>2],d[i+8>>2]=d[e+100>>2],d[i+12>>2]=d[e+104>>2],d[i+16>>2]=d[e+108>>2],d[i+20>>2]=d[e+116>>2],d[i+24>>2]=d[e+120>>2],d[i+28>>2]=d[e+124>>2],d[i+32>>2]=d[e+128>>2],d[i+36>>2]=d[e+132>>2],d[i+40>>2]=d[e+140>>2],d[i+44>>2]=d[e+144>>2],d[i+48>>2]=d[e+148>>2],d[i+52>>2]=d[e+152>>2],d[i+56>>2]=d[e+168>>2],d[i+60>>2]=d[e+172>>2],d[i+64>>2]=d[e+112>>2],d[i+68>>2]=d[e+156>>2],d[i+72>>2]=d[e+160>>2],d[i+76>>2]=d[e+164>>2],d[i+80>>2]=d[e+136>>2],r[d[d[t>>2]+20>>2]](t,n,18516,1145853764,i),Un(e,t),Gt(e,t),r[d[d[t>>2]+36>>2]](t)},r[668]=function(e,t,i,n){e|=0,t=y(t),i|=0,n=y(n);var o=0,a=0,l=y(0);!function(){var e,t=0;O=e=O-16|0,R(d[7705],0),cc(30824),d[7707]=d[7707]+1,t=d[7710],d[7710]=t+1,t||(R(e+8|0,0),t=d[7705],d[7709]=(d[e+12>>2]-d[t+4>>2]|0)+b(d[e+8>>2]-d[t>>2]|0,1e6)),d[7715]=0,R(e+8|0,0),t=d[7705],d[7716]=(d[e+12>>2]-d[t+4>>2]|0)+b(d[e+8>>2]-d[t>>2]|0,1e6),O=e+16|0}(),yr(18199);e:if(i){if(m[e+268>>2]=n,t=y(m[e+264>>2]+t),m[e+264>>2]=t,!(t>=n))break e;o=e,l=t,t=y(t/n),a=y(v(t))>2]=l-y(y(0|a)*n)}else d[e+268>>2]=0,m[e+264>>2]=u[e+300|0]?y(0):t,n=t,i=a=y(v(t))>2]+20>>2]](e)&&(o=0|r[d[d[e>>2]+20>>2]](e),s[29240]=r[d[d[o>>2]+48>>2]](o)>>>4&1);e:if(a){if(o=(0|a)>(0|i)?i:a,r[d[d[e>>2]+164>>2]](e,y(n*y(0|o))),r[d[d[e>>2]+168>>2]](e),(0|o)<1)break e;for(i=0;r[d[d[e>>2]+160>>2]](e,n),r[d[d[e>>2]+80>>2]](e),(0|o)!=(0|(i=i+1|0)););}else r[d[d[e>>2]+80>>2]](e);return r[d[d[e>>2]+120>>2]](e),d[7715]=d[7715]+1,As(),0|a},r[669]=function(e,t,i){t|=0,i|=0;var n=0,o=0,a=0,l=0,c=0;if((0|(n=d[212+(e|=0)>>2]))==d[e+216>>2]&&!((0|n)>=(0|(a=n?n<<1:1)))){if(a&&(d[7717]=d[7717]+1,l=0|r[d[6606]](a<<2,16),n=d[e+212>>2]),(0|n)>=1)for(;d[(c=o<<2)+l>>2]=d[d[e+220>>2]+c>>2],(0|(o=o+1|0))!=(0|n););(o=d[e+220>>2])&&(u[e+224|0]&&(o&&(d[7718]=d[7718]+1,r[d[6607]](o)),n=d[e+212>>2]),d[e+220>>2]=0),d[e+220>>2]=l,d[e+216>>2]=a,s[e+224|0]=1}d[d[e+220>>2]+(n<<2)>>2]=t,d[e+212>>2]=n+1,i&&(Hn(d[t+28>>2],t),Hn(d[t+32>>2],t))},r[670]=function(e,t){t|=0;var i=0,n=0,r=0,s=0;e:if(!((0|(i=d[212+(e|=0)>>2]))<1)){for(r=d[e+220>>2];;){if(d[(s=(n<<2)+r|0)>>2]!=(0|t)){if((0|i)!=(0|(n=n+1|0)))continue;break e}break}(0|n)>=(0|i)||(n=(i=i+-1|0)<<2,d[s>>2]=d[n+r>>2],d[n+d[e+220>>2]>>2]=t,d[e+212>>2]=i)}xs(d[t+28>>2],t),xs(d[t+32>>2],t)},r[671]=function(e,t){t|=0;var i=0,n=0,o=0,a=0,l=0;if((0|(i=d[280+(e|=0)>>2]))==d[e+284>>2]&&!((0|i)>=(0|(o=i?i<<1:1)))){if(o&&(d[7717]=d[7717]+1,a=0|r[d[6606]](o<<2,16),i=d[e+280>>2]),(0|i)>=1)for(;d[(l=n<<2)+a>>2]=d[d[e+288>>2]+l>>2],(0|(n=n+1|0))!=(0|i););(n=d[e+288>>2])&&(u[e+292|0]&&(n&&(d[7718]=d[7718]+1,r[d[6607]](n)),i=d[e+280>>2]),d[e+288>>2]=0),d[e+288>>2]=a,d[e+284>>2]=o,s[e+292|0]=1}d[d[e+288>>2]+(i<<2)>>2]=t,d[e+280>>2]=i+1},r[672]=function(e,t){t|=0;var i=0,n=0,r=0,s=0;e:if(!((0|(i=d[280+(e|=0)>>2]))<1)){for(r=d[e+288>>2];;){if(d[(s=(n<<2)+r|0)>>2]!=(0|t)){if((0|i)!=(0|(n=n+1|0)))continue;break e}break}(0|n)>=(0|i)||(n=(i=i+-1|0)<<2,d[s>>2]=d[n+r>>2],d[n+d[e+288>>2]>>2]=t,d[e+280>>2]=i)}},r[673]=function(e,t){e|=0;var i=0,n=0,r=0;if(n=d[4+(i=t|=0)>>2],d[e+248>>2]=d[i>>2],d[e+252>>2]=n,n=d[i+12>>2],d[e+256>>2]=d[i+8>>2],d[e+260>>2]=n,(0|(i=d[e+232>>2]))>=1)for(;;){e:{switch(n=d[d[e+240>>2]+(r<<2)>>2],d[n+216>>2]+-2|0){case 0:case 3:break e}1&s[n+504|0]||(Ts(n,t),i=d[e+232>>2])}if(!((0|(r=r+1|0))<(0|i)))break}},r[674]=function(e,t){e|=0;var i=0;i=d[252+(t|=0)>>2],d[e>>2]=d[t+248>>2],d[e+4>>2]=i,i=d[t+260>>2],d[e+8>>2]=d[t+256>>2],d[e+12>>2]=i},r[675]=function(e){e|=0;var t,i=0,n=0,s=y(0),o=0;O=t=O+-64|0,yr(18175);e:if(u[e+274|0]){if((0|(n=d[e+8>>2]))<1)break e;for(;!(i=d[d[e+16>>2]+(o<<2)>>2])|!(2&d[i+236>>2])|!d[i+480>>2]|3&u[i+204|0]||(mi(n=i+68|0,i+132|0,i+148|0,s=u[e+300|0]&&(s=m[e+268>>2])!=y(0)?y(m[e+264>>2]-s):y(m[e+264>>2]*m[i+244>>2]),t),i=d[i+480>>2],r[d[d[i>>2]+12>>2]](i,t),n=d[e+8>>2]),(0|(o=o+1|0))<(0|n););}else if(!((0|(n=d[e+232>>2]))<1))for(;;){t:{switch(i=d[d[e+240>>2]+(o<<2)>>2],d[i+216>>2]+-2|0){case 0:case 3:break t}!d[i+480>>2]|3&u[i+204|0]||(mi(n=i+68|0,i+132|0,i+148|0,s=u[e+300|0]&&(s=m[e+268>>2])!=y(0)?y(m[e+264>>2]-s):y(m[e+264>>2]*m[i+244>>2]),t),i=d[i+480>>2],r[d[d[i>>2]+12>>2]](i,t),n=d[e+232>>2])}if(!((0|(o=o+1|0))<(0|n)))break}As(),O=t- -64|0},r[676]=function(e,t){e|=0;var i=0,n=0,o=0,a=0,l=0;if(3&u[204+(t|=0)|0]|1&s[t+504|0]||Ts(t,e+248|0),d[t+192>>2]){if(1&s[t+204|0])4!=(-2&d[t+216>>2])&&(d[t+216>>2]=2);else{if((0|(i=d[e+232>>2]))==d[e+236>>2]&&!((0|i)>=(0|(o=i?i<<1:1)))){if(o&&(d[7717]=d[7717]+1,a=0|r[d[6606]](o<<2,16),i=d[e+232>>2]),(0|i)>=1)for(;d[(l=n<<2)+a>>2]=d[d[e+240>>2]+l>>2],(0|(n=n+1|0))!=(0|i););(n=d[e+240>>2])&&(u[e+244|0]&&(n&&(d[7718]=d[7718]+1,r[d[6607]](n)),i=d[e+232>>2]),d[e+240>>2]=0),d[e+240>>2]=a,d[e+236>>2]=o,s[e+244|0]=1}d[d[e+240>>2]+(i<<2)>>2]=t,d[e+232>>2]=i+1}i=t,t=3&d[t+204>>2],r[d[d[e>>2]+36>>2]](e,i,t?2:1,t?-3:-1)}},r[677]=function(e,t,i,n){e|=0,i|=0,n|=0;var o=0,a=0,l=0,c=0,h=0;if(3&u[204+(t|=0)|0]|1&s[t+504|0]||Ts(t,e+248|0),d[t+192>>2]){if(1&s[t+204|0])4!=(-2&d[t+216>>2])&&(d[t+216>>2]=2);else{if((0|(o=d[e+232>>2]))==d[e+236>>2]&&!((0|o)>=(0|(l=o?o<<1:1)))){if(l&&(d[7717]=d[7717]+1,c=0|r[d[6606]](l<<2,16),o=d[e+232>>2]),(0|o)>=1)for(;d[(h=a<<2)+c>>2]=d[d[e+240>>2]+h>>2],(0|(a=a+1|0))!=(0|o););(a=d[e+240>>2])&&(u[e+244|0]&&(a&&(d[7718]=d[7718]+1,r[d[6607]](a)),o=d[e+232>>2]),d[e+240>>2]=0),d[e+240>>2]=c,d[e+236>>2]=l,s[e+244|0]=1}d[d[e+240>>2]+(o<<2)>>2]=t,d[e+232>>2]=o+1}r[d[d[e>>2]+36>>2]](e,t,i,n)}},r[678]=function(e,t){t|=0;var i=0,n=0,r=0,s=0;e:if(!((0|(i=d[232+(e|=0)>>2]))<1)){for(r=d[e+240>>2];;){if(d[(s=(n<<2)+r|0)>>2]!=(0|t)){if((0|i)!=(0|(n=n+1|0)))continue;break e}break}(0|n)>=(0|i)||(n=(i=i+-1|0)<<2,d[s>>2]=d[n+r>>2],d[n+d[e+240>>2]>>2]=t,d[e+232>>2]=i)}Nr(e,t)},r[679]=function(e,t){t|=0;var i=0;u[273+(e|=0)|0]&&(i=d[e+200>>2])&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+200>>2]=t,s[e+273|0]=0,d[d[e+196>>2]+8>>2]=t},r[680]=function(e){return d[200+(e|=0)>>2]},r[681]=function(e){return d[212+(e|=0)>>2]},r[682]=W_,r[683]=W_,r[684]=Sd,r[685]=function(e){var t=0,i=0;if(d[232+(e|=0)>>2]>=1)for(;t=d[d[e+240>>2]+(i<<2)>>2],d[t+412>>2]=0,d[t+416>>2]=0,d[t+436>>2]=0,d[t+440>>2]=0,d[t+428>>2]=0,d[t+432>>2]=0,d[t+420>>2]=0,d[t+424>>2]=0,(0|(i=i+1|0))>2];);},r[686]=X_,r[687]=Y_,r[688]=X_,r[689]=Y_,r[690]=no,r[691]=function(e,t){e|=0,t=y(t);var i,n=0,s=0,o=y(0),a=0,l=0,c=0,h=y(0),f=y(0),g=y(0),v=0,A=y(0),C=y(0),S=y(0),x=y(0);if(O=i=O-304|0,yr(18412),d[e+232>>2]>=1)for(;;){n=d[d[e+240>>2]+(l<<2)>>2],d[n+244>>2]=1065353216;e:{switch(d[n+216>>2]+-2|0){case 0:case 3:break e}if(!(3&u[n+204|0])){if(q_(n,t,i+240|0),u[e+44|0]&&(o=m[n+252>>2],(o=y(o*o))!=y(0)&&(f=o,o=y(m[i+288>>2]-m[n+52>>2]),h=y(o*o),o=y(m[i+292>>2]-m[n+56>>2]),h=y(h+y(o*o)),o=y(m[i+296>>2]-m[n+60>>2]),f>2]+4>>2]<=19&&(d[7312]=d[7312]+1,s=d[e+68>>2],s=0|r[d[d[s>>2]+36>>2]](s),a=d[e+24>>2],d[i+148>>2]=1065353216,d[i+152>>2]=-65535,c=d[n+64>>2],d[i+164>>2]=d[n+60>>2],d[i+168>>2]=c,c=d[n+56>>2],d[i+156>>2]=d[n+52>>2],d[i+160>>2]=c,c=d[i+300>>2],d[i+180>>2]=d[i+296>>2],d[i+184>>2]=c,c=d[i+292>>2],d[i+172>>2]=d[i+288>>2],d[i+176>>2]=c,d[i+220>>2]=0,d[i+144>>2]=18736,d[i+232>>2]=s,d[i+236>>2]=a,d[i+228>>2]=0,d[i+224>>2]=n,a=d[n+248>>2],d[4+(s=i+88|0)>>2]=35,d[s+8>>2]=0,d[s>>2]=13316,d[s+44>>2]=1025758986,d[s+20>>2]=1065353216,d[s+24>>2]=0,d[s+12>>2]=1065353216,d[s+16>>2]=1065353216,d[s>>2]=13444,d[i+132>>2]=a,d[i+116>>2]=a,d[i+92>>2]=8,d[i+88>>2]=11556,d[i+228>>2]=d[e+56>>2],s=d[n+188>>2],_[i+152>>1]=p[s+4>>1],_[i+154>>1]=p[s+6>>1],s=d[i+252>>2],d[i+32>>2]=d[i+248>>2],d[i+36>>2]=s,s=d[i+244>>2],d[i+24>>2]=d[i+240>>2],d[i+28>>2]=s,s=d[i+268>>2],d[i+48>>2]=d[i+264>>2],d[i+52>>2]=s,s=d[i+260>>2],d[i+40>>2]=d[i+256>>2],d[i+44>>2]=s,s=d[i+284>>2],d[i+64>>2]=d[i+280>>2],d[i+68>>2]=s,s=d[i+276>>2],d[i+56>>2]=d[i+272>>2],d[i+60>>2]=s,s=d[i+300>>2],d[i+80>>2]=d[i+296>>2],d[i+84>>2]=s,s=d[i+292>>2],d[i+72>>2]=d[i+288>>2],d[i+76>>2]=s,a=d[12+(s=n+4|0)>>2],d[i+32>>2]=d[s+8>>2],d[i+36>>2]=a,a=d[s+4>>2],d[i+24>>2]=d[s>>2],d[i+28>>2]=a,a=d[n+32>>2],d[i+48>>2]=d[n+28>>2],d[i+52>>2]=a,a=d[n+24>>2],d[i+40>>2]=d[n+20>>2],d[i+44>>2]=a,a=d[n+48>>2],d[i+64>>2]=d[n+44>>2],d[i+68>>2]=a,a=d[n+40>>2],d[i+56>>2]=d[n+36>>2],d[i+60>>2]=a,Ae(e,i+88|0,s,i+24|0,i+144|0,y(0)),(o=m[i+148>>2])>2]=o,q_(n,y(o*t),i+240|0),d[n+244>>2]=0,Yt(n,i+240|0),As();break e}As()}Yt(n,i+240|0)}}if(!((0|(l=l+1|0))>2]))break}if(u[e+275|0]){if(yr(18452),(0|(l=d[e+308>>2]))>=1)for(;;){if(a=d[d[e+316>>2]+(v<<2)>>2],d[a+748>>2]>=1){for(n=d[a+744>>2],l=d[n+236>>2]<<30>>31&n,n=d[a+740>>2],s=d[n+236>>2]<<30>>31&n,c=0;(t=y(m[s+228>>2]*m[l+228>>2]))>y(0)&&(n=a+b(c,184)|0,(o=m[n+124>>2])!=y(0)&&(f=m[n+68>>2],h=m[n+72>>2],g=m[n+76>>2],d[i+156>>2]=0,g=y(t*y(o*y(-g))),m[i+152>>2]=g,h=y(t*y(o*y(-h))),m[i+148>>2]=h,t=y(t*y(o*y(-f))),m[i+144>>2]=t,o=m[n+52>>2],f=m[n+56>>2],A=m[n+60>>2],C=m[s+52>>2],S=m[s+56>>2],x=m[s+60>>2],d[i+36>>2]=0,m[i+32>>2]=A-x,m[i+28>>2]=f-S,m[i+24>>2]=o-C,o=m[n+36>>2],f=m[n+40>>2],A=m[n+44>>2],C=m[l+52>>2],S=m[l+56>>2],x=m[l+60>>2],d[i+100>>2]=0,m[i+96>>2]=A-x,m[i+92>>2]=f-S,m[i+88>>2]=o-C,s&&(Vs(s,i+144|0,i+24|0),g=m[i+152>>2],h=m[i+148>>2],t=m[i+144>>2]),d[i+20>>2]=0,m[i+16>>2]=-g,m[i+12>>2]=-h,m[i+8>>2]=-t,Vs(l,i+8|0,i+88|0))),(0|(c=c+1|0))>2];);l=d[e+308>>2]}if(!((0|(v=v+1|0))<(0|l)))break}As()}As(),O=i+304|0},r[692]=function(e){e|=0;var t=0,i=0,n=0,s=0,o=0,a=0,l=0,c=0;if(yr(18296),t=d[e+204>>2],r[d[d[t>>2]+8>>2]](t,e,d[e+24>>2]),(0|(l=d[e+308>>2]))>=1)for(c=d[e+316>>2];;){if(t=d[c+(a<<2)>>2],(i=d[t+740>>2])&&!(!(t=d[t+744>>2])|3&d[i+204>>2]|3&u[t+204|0])){if(t=d[t+208>>2],n=d[d[e+204>>2]+16>>2],s=d[i+208>>2],(0|(i=d[(o=n+(s<<3)|0)>>2]))!=(0|s))for(;i=n+(i<<3)|0,d[o>>2]=d[i>>2],s=d[i>>2],(0|(i=d[(o=n+(s<<3)|0)>>2]))!=(0|s););if((0|(i=d[(o=n+(t<<3)|0)>>2]))!=(0|t))for(;t=n+(i<<3)|0,d[o>>2]=d[t>>2],(0|(t=d[t>>2]))!=(0|(i=d[(o=n+(t<<3)|0)>>2])););(0|t)!=(0|s)&&(d[(i=n+(s<<3)|0)>>2]=t,d[4+(t=n+(t<<3)|0)>>2]=d[t+4>>2]+d[i+4>>2])}if((0|l)==(0|(a=a+1|0)))break}if((0|(l=d[e+212>>2]))>=1)for(c=d[e+220>>2],o=0;;){if(t=d[c+(o<<2)>>2],u[t+20|0]&&(i=d[t+28>>2],!(3&u[i+204|0]||(t=d[t+32>>2],3&u[t+204|0])))){if(t=d[t+208>>2],n=d[d[e+204>>2]+16>>2],s=d[i+208>>2],(0|(a=d[(i=n+(s<<3)|0)>>2]))!=(0|s))for(;s=i,i=n+(a<<3)|0,d[s>>2]=d[i>>2],s=d[i>>2],(0|(a=d[(i=n+(s<<3)|0)>>2]))!=(0|s););if((0|(a=d[(i=n+(t<<3)|0)>>2]))!=(0|t))for(;t=n+(a<<3)|0,d[i>>2]=d[t>>2],(0|(t=d[t>>2]))!=(0|(a=d[(i=n+(t<<3)|0)>>2])););(0|t)!=(0|s)&&(d[(i=n+(s<<3)|0)>>2]=t,d[4+(t=n+(t<<3)|0)>>2]=d[t+4>>2]+d[i+4>>2])}if((0|l)==(0|(o=o+1|0)))break}t=d[e+204>>2],r[d[d[t>>2]+12>>2]](t,e),As()},r[693]=function(e,t){e|=0,t|=0;var i,n,o,a,l,c,h=0,_=0,p=0,f=0,m=0;if(O=n=O-16|0,yr(18279),(0|(_=d[e+180>>2]))<(0|(i=d[e+212>>2]))){if(d[e+184>>2]<(0|i)){if(i?(d[7717]=d[7717]+1,f=0|r[d[6606]](i<<2,16),h=d[e+180>>2]):h=_,(0|h)>=1)for(;d[(m=p<<2)+f>>2]=d[d[e+188>>2]+m>>2],(0|h)!=(0|(p=p+1|0)););(h=d[e+188>>2])&&(u[e+192|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+188>>2]=0),d[e+188>>2]=f,d[e+184>>2]=i,s[e+192|0]=1}for(;d[d[e+188>>2]+(_<<2)>>2]=0,(0|i)!=(0|(_=_+1|0)););}if(d[e+180>>2]=i,(0|r[d[d[e>>2]+104>>2]](e))>=1)for(_=0;d[(h=_<<2)+d[e+188>>2]>>2]=d[h+d[e+220>>2]>>2],(0|(_=_+1|0))<(0|r[d[d[e>>2]+104>>2]](e)););(0|(h=d[e+180>>2]))>=2&&Bn(e+176|0,n+8|0,0,h+-1|0),h=0,r[d[d[e>>2]+104>>2]](e)&&(h=d[e+188>>2]),function(e,t,i,n,o){if(d[e+20>>2]=o,d[e+16>>2]=n,d[e+12>>2]=i,d[e+4>>2]=t,(0|(t=d[e+32>>2]))<=-1)for(d[e+36>>2]<=-1&&((i=d[e+40>>2])&&(u[e+44|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+40>>2]=0),d[e+36>>2]=0,d[e+40>>2]=0,s[e+44|0]=1);d[d[e+40>>2]+(t<<2)>>2]=0,n=(i=t+1|0)>>>0>=t>>>0,t=i,n;);if(d[e+32>>2]=0,(0|(t=d[e+52>>2]))<=-1)for(d[e+56>>2]<=-1&&((i=d[e+60>>2])&&(u[e- -64|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+60>>2]=0),d[e+56>>2]=0,d[e+60>>2]=0,s[e- -64|0]=1);d[d[e+60>>2]+(t<<2)>>2]=0,n=(i=t+1|0)>>>0>=t>>>0,t=i,n;);if(d[e+52>>2]=0,(0|(t=d[e+72>>2]))<=-1)for(d[e+76>>2]<=-1&&((i=d[e+80>>2])&&(u[e+84|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+80>>2]=0),d[e+76>>2]=0,d[e+80>>2]=0,s[e+84|0]=1);d[d[e+80>>2]+(t<<2)>>2]=0,n=(i=t+1|0)>>>0>=t>>>0,t=i,n;);d[e+72>>2]=0}(d[e+196>>2],t,h,d[e+180>>2],0|r[d[d[e>>2]+20>>2]](e)),h=d[e+200>>2],_=d[e+24>>2],a=h,l=d[e+8>>2],c=0|r[d[d[_>>2]+36>>2]](_),o=d[d[h>>2]+8>>2],r[o](0|a,0|l,0|c),Ct(d[e+204>>2],d[e+24>>2],e,d[e+196>>2]),Oi(d[e+196>>2]),h=d[e+200>>2],r[d[d[h>>2]+16>>2]](h,t,d[e+72>>2]),As(),O=n+16|0},r[694]=function(e,t){e|=0,t=y(t);var i=0,n=y(0),r=y(0),s=0,o=0;if(yr(18257),d[e+232>>2]>=1)for(;;){e:if(i=d[d[e+240>>2]+(o<<2)>>2]){t:{i:{switch((s=d[i+216>>2])+-2|0){case 0:case 2:break i}if(n=m[i+312>>2],r=y(n*n),n=m[i+316>>2],r=y(r+y(n*n)),n=m[i+320>>2],r=y(r+y(n*n)),n=m[i+472>>2],r>2],r=y(n*n),n=m[i+332>>2],r=y(r+y(n*n)),n=m[i+336>>2],r=y(r+y(n*n)),n=m[i+476>>2],r>2]=m[i+220>>2]+t;break t}d[i+220>>2]=0,4!=(-2&d[i+216>>2])&&(d[i+216>>2]=0),s=d[i+216>>2]}if(4==(0|s))break e}if(u[29240]||(n=m[6603])==y(0)|(m[i+220>>2]>n^1?2!=(-2&s):0))4!=(-2&d[i+216>>2])&&(d[i+216>>2]=1);else{if(3&u[i+204|0]){4!=(-2&d[i+216>>2])&&(d[i+216>>2]=2);break e}if(1==(0|s)&&(4!=(-2&d[i+216>>2])&&(d[i+216>>2]=3),s=d[i+216>>2]),2!=(0|s))break e;d[i+328>>2]=0,d[i+332>>2]=0,d[i+312>>2]=0,d[i+316>>2]=0,d[i+336>>2]=0,d[i+340>>2]=0,d[i+320>>2]=0,d[i+324>>2]=0,d[i+260>>2]=d[i+260>>2]+2}}if(!((0|(o=o+1|0))>2]))break}As()},r[695]=vr,r[696]=function(e,t){e|=0,t=y(t);var i=0,n=0,r=0;if((0|(n=d[e+8>>2]))>=1)for(;!(i=d[d[e+16>>2]+(r<<2)>>2])|!(2&d[i+236>>2])|!(2&u[i+204|0])|2==d[i+216>>2]||(Bi(i,t),n=d[e+8>>2]),(0|(r=r+1|0))<(0|n););},r[697]=function(e){var t=0,i=0,n=0;if((0|(t=d[232+(e|=0)>>2]))>=1)for(;;){e:{switch(n=d[d[e+240>>2]+(i<<2)>>2],d[n+216>>2]+-2|0){case 0:case 3:break e}Po(n),t=d[e+232>>2]}if(!((0|(i=i+1|0))<(0|t)))break}},r[698]=Rd,r[699]=function(e,t){e|=0,t=y(t);var i=0,n=0;if(yr(18243),d[e+280>>2]>=1)for(;n=d[d[e+288>>2]+(i<<2)>>2],r[d[d[n>>2]+8>>2]](n,e,t),(0|(i=i+1|0))>2];);As()},r[700]=function(e){var t=0;return d[(e|=0)>>2]=18620,(t=d[e+80>>2])&&(u[e+84|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+80>>2]=0),d[e+80>>2]=0,s[e+84|0]=1,d[e+72>>2]=0,d[e+76>>2]=0,(t=d[e+60>>2])&&(u[e- -64|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+60>>2]=0),d[e+60>>2]=0,s[e- -64|0]=1,d[e+52>>2]=0,d[e+56>>2]=0,(t=d[e+40>>2])&&(u[e+44|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+40>>2]=0),d[e+40>>2]=0,s[e+44|0]=1,d[e+32>>2]=0,d[e+36>>2]=0,0|e},r[701]=function(e){var t=0;d[(e|=0)>>2]=18620,(t=d[e+80>>2])&&(u[e+84|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+80>>2]=0),d[e+80>>2]=0,s[e+84|0]=1,d[e+72>>2]=0,d[e+76>>2]=0,(t=d[e+60>>2])&&(u[e- -64|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+60>>2]=0),d[e+60>>2]=0,s[e- -64|0]=1,d[e+52>>2]=0,d[e+56>>2]=0,!(t=d[e+40>>2])|!u[e+44|0]||t&&(d[7718]=d[7718]+1,r[d[6607]](t)),ve(e)},r[702]=function(e,t,i,n,o,a){e|=0,t|=0,i|=0,n|=0,o|=0;var l=0,c=0,h=0,_=0,p=0,f=0,m=0,g=0;if(!((0|(a|=0))>=0))return a=d[e+8>>2],void y(r[d[d[a>>2]+12>>2]](a,t,i,n,o,d[e+12>>2],d[e+16>>2],d[e+4>>2],d[e+20>>2],d[e+24>>2]));e:{if((0|(c=d[e+16>>2]))>=1)for(f=d[e+12>>2];;){if(p=d[(m=f+(l<<2)|0)>>2],(0|(h=d[d[p+28>>2]+208>>2]))<=-1&&(h=d[d[p+32>>2]+208>>2]),(0|a)==(0|h))break e;if(!((0|(l=l+1|0))<(0|c)))break}m=0}if(p=0,(0|l)<(0|c))for(g=d[e+12>>2];f=d[g+(l<<2)>>2],(0|(h=d[d[f+28>>2]+208>>2]))<=-1&&(h=d[d[f+32>>2]+208>>2]),p=((0|a)==(0|h))+p|0,(0|c)!=(0|(l=l+1|0)););if(l=d[e+4>>2],d[l+72>>2]<2)a=d[e+8>>2],y(r[d[d[a>>2]+12>>2]](a,t,i,n,o,m,p,l,d[e+20>>2],d[e+24>>2]));else{if(!((0|i)<1))for(a=d[e+36>>2],l=d[e+32>>2];;){if(g=(_<<2)+t|0,(0|a)==(0|l))if((0|a)>=(0|(h=a?a<<1:1)))l=a;else{if(l=0,c=0,h&&(d[7717]=d[7717]+1,c=0|r[d[6606]](h<<2,16),a=d[e+32>>2]),(0|a)>=1)for(;d[(f=l<<2)+c>>2]=d[d[e+40>>2]+f>>2],(0|(l=l+1|0))!=(0|a););(l=d[e+40>>2])&&(u[e+44|0]&&(l&&(d[7718]=d[7718]+1,r[d[6607]](l)),a=d[e+32>>2]),d[e+40>>2]=0),l=a,d[e+40>>2]=c,s[e+44|0]=1,d[e+36>>2]=h,a=h}if(d[d[e+40>>2]+(l<<2)>>2]=d[g>>2],l=l+1|0,d[e+32>>2]=l,(0|(_=_+1|0))==(0|i))break}if((0|o)>=1)for(a=d[e+56>>2],l=d[e+52>>2],_=0;;){if(h=(_<<2)+n|0,(0|a)==(0|l))if((0|a)>=(0|(t=a?a<<1:1)))l=a;else{if(l=0,c=0,t&&(d[7717]=d[7717]+1,c=0|r[d[6606]](t<<2,16),a=d[e+52>>2]),(0|a)>=1)for(;d[(i=l<<2)+c>>2]=d[i+d[e+60>>2]>>2],(0|(l=l+1|0))!=(0|a););(i=d[e+60>>2])&&(u[e+64|0]&&(i&&(d[7718]=d[7718]+1,r[d[6607]](i)),a=d[e+52>>2]),d[e+60>>2]=0),l=a,d[e+60>>2]=c,s[e+64|0]=1,d[e+56>>2]=t,a=t}if(d[d[e+60>>2]+(l<<2)>>2]=d[h>>2],l=l+1|0,d[e+52>>2]=l,(0|(_=_+1|0))==(0|o))break}if(p)for(a=d[e+76>>2],l=d[e+72>>2],_=0;;){if(n=(_<<2)+m|0,(0|a)==(0|l))if((0|a)>=(0|(t=a?a<<1:1)))l=a;else{if(l=0,c=0,t&&(d[7717]=d[7717]+1,c=0|r[d[6606]](t<<2,16),a=d[e+72>>2]),(0|a)>=1)for(;d[(i=l<<2)+c>>2]=d[i+d[e+80>>2]>>2],(0|(l=l+1|0))!=(0|a););(i=d[e+80>>2])&&(u[e+84|0]&&(i&&(d[7718]=d[7718]+1,r[d[6607]](i)),a=d[e+72>>2]),d[e+80>>2]=0),l=a,d[e+80>>2]=c,s[e+84|0]=1,d[e+76>>2]=t,a=t}if(d[d[e+80>>2]+(l<<2)>>2]=d[n>>2],l=l+1|0,d[e+72>>2]=l,(0|p)==(0|(_=_+1|0)))break}else l=d[e+72>>2];(d[e+52>>2]+l|0)>d[d[e+4>>2]+72>>2]&&Oi(e)}},r[703]=Pd,r[704]=function(e,t){e|=0;var i,n,s=0;return i=d[(t|=0)>>2],n=d[e+80>>2],!(p[t+6>>1]&p[e+8>>1])|!(p[e+10>>1]&p[t+4>>1])|(0|i)==(0|n)||(e=d[e+92>>2],s=0|r[d[d[e>>2]+28>>2]](e,n,i)),0|s},r[705]=function(e,t,i){e|=0,t|=0,i|=0;var n=0,r=y(0),s=y(0),o=y(0),a=0,l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0);return r=y(1),(0|(n=d[t>>2]))==d[e+80>>2]|4&u[n+204|0]|y(y(y(y(m[e+28>>2]-m[e+12>>2])*m[t+8>>2])+y(y(m[e+32>>2]-m[e+16>>2])*m[t+12>>2]))+y(y(m[e+36>>2]-m[e+20>>2])*m[t+16>>2]))>=y(-m[e+84>>2])||(a=d[t+40>>2],d[e+76>>2]=n,d[e+4>>2]=a,i?(n=d[4+(i=t+8|0)>>2],d[e+44>>2]=d[i>>2],d[e+48>>2]=n,n=d[i+12>>2],d[e+52>>2]=d[i+8>>2],d[e+56>>2]=n):(l=m[n+12>>2],c=m[n+8>>2],h=m[n+28>>2],_=m[n+20>>2],p=m[n+24>>2],f=m[n+44>>2],g=m[n+36>>2],b=m[n+40>>2],v=m[n+4>>2],r=m[t+16>>2],s=m[t+8>>2],o=m[t+12>>2],d[e+56>>2]=0,m[e+52>>2]=y(y(s*g)+y(o*b))+y(r*f),m[e+48>>2]=y(y(s*_)+y(o*p))+y(r*h),m[e+44>>2]=y(y(v*s)+y(c*o))+y(l*r)),i=d[t+28>>2],d[e+60>>2]=d[t+24>>2],d[e+64>>2]=i,i=d[t+36>>2],d[e+68>>2]=d[t+32>>2],d[e+72>>2]=i,r=m[t+40>>2]),y(r)},r[706]=Z_,r[707]=O_,r[708]=Fd,r[709]=function(e,t,i,n,r){r=y(r)},r[710]=function(e,t){d[(t|=0)>>2]=6,d[t+4>>2]=6},r[711]=function(e,t){e|=0,t|=0;var i,n,r,s,o,a,l=y(0),c=0,h=0,_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=0,T=y(0),E=y(0),R=0,P=y(0),I=y(0),M=y(0),D=0,w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0);O=i=O-96|0,n=d[e+32>>2],r=d[e+28>>2],c=d[t+8>>2],d[c>>2]=1065353216,s=d[t+24>>2],d[(h=s+1<<2)+c>>2]=1065353216,d[c+(o=2+(D=s<<1)<<2)>>2]=1065353216,g=m[r+8>>2],u=m[r+12>>2],p=m[r+20>>2],S=m[r+24>>2],v=m[r+28>>2],f=m[r+36>>2],A=m[r+40>>2],l=m[e+52>>2],T=m[r+44>>2],C=m[e+56>>2],E=m[r+4>>2],_=m[e+48>>2],x=d[t+12>>2],d[x+12>>2]=0,d[x>>2]=0,f=y(y(y(_*f)+y(l*A))+y(C*T)),m[x+4>>2]=f,p=y(y(y(_*p)+y(l*S))+y(C*v)),m[x+8>>2]=-p,d[12+(c=(R=s<<2)+x|0)>>2]=0,g=y(y(y(E*_)+y(g*l))+y(u*C)),m[c+8>>2]=g,d[c+4>>2]=0,m[c>>2]=-f,d[8+(c=(a=s<<3)+x|0)>>2]=0,d[c+12>>2]=0,m[c+4>>2]=-g,m[c>>2]=p,(c=d[t+16>>2])&&(d[c>>2]=-1082130432,d[c+h>>2]=-1082130432,d[c+o>>2]=-1082130432),v=m[n+8>>2],A=m[n+12>>2],S=m[n+36>>2],T=m[n+40>>2],E=m[n+44>>2],u=m[n+20>>2],P=m[n+24>>2],l=m[e+68>>2],I=m[n+28>>2],C=m[e+72>>2],M=m[n+4>>2],_=m[e+64>>2],c=d[t+20>>2],d[c+12>>2]=0,d[c>>2]=0,u=y(y(y(_*u)+y(l*P))+y(C*I)),m[c+8>>2]=u,S=y(y(y(_*S)+y(l*T))+y(C*E)),m[c+4>>2]=-S,d[12+(h=c+R|0)>>2]=0,l=y(y(y(M*_)+y(v*l))+y(A*C)),m[h+8>>2]=-l,d[h+4>>2]=0,m[h>>2]=S,d[8+(h=c+(D<<2)|0)>>2]=0,d[h+12>>2]=0,m[h+4>>2]=l,m[h>>2]=-u,_=m[r+60>>2],v=m[n+60>>2],A=m[r+56>>2],T=m[n+56>>2],h=d[t+28>>2],C=y(m[t>>2]*m[t+4>>2]),m[h>>2]=C*y(y(y(l+m[n+52>>2])-g)-m[r+52>>2]),m[h+R>>2]=C*y(y(y(u+T)-p)-A),m[h+a>>2]=C*y(y(y(S+v)-f)-_),h=b(s,3),d[(h<<2)+x>>2]=1065353216,d[((R|=1)<<2)+x>>2]=1065353216,D=x,x=b(s,5)+2|0,d[D+(x<<2)>>2]=1065353216,c&&(d[c+(h<<2)>>2]=-1082130432,d[c+(R<<2)>>2]=-1082130432,d[c+(x<<2)>>2]=-1082130432),E=m[r+12>>2],P=m[r+4>>2],I=m[r+8>>2],M=m[r+28>>2],w=m[r+20>>2],F=m[r+24>>2],B=m[r+44>>2],N=m[r+36>>2],L=m[r+40>>2],_=m[n+12>>2],f=m[n+4>>2],g=m[n+24>>2],u=m[n+40>>2],p=m[n+8>>2],S=m[n+36>>2],v=m[n+28>>2],A=m[n+20>>2],T=m[n+44>>2],d[i+68>>2]=0,d[i+52>>2]=0,V=y(y(g*T)-y(v*u)),U=y(y(v*S)-y(T*A)),G=y(y(u*A)-y(g*S)),l=y(y(1)/y(y(y(f*V)+y(p*U))+y(_*G))),k=y(y(y(v*p)-y(g*_))*l),v=y(y(y(A*_)-y(v*f))*l),g=y(y(y(g*f)-y(A*p))*l),m[i- -64>>2]=y(y(N*k)+y(L*v))+y(B*g),A=y(y(y(u*_)-y(T*p))*l),_=y(y(y(T*f)-y(S*_))*l),f=y(y(y(S*p)-y(u*f))*l),m[i+60>>2]=y(y(N*A)+y(L*_))+y(B*f),m[i+48>>2]=y(y(k*w)+y(v*F))+y(g*M),m[i+44>>2]=y(y(A*w)+y(_*F))+y(f*M),d[i+36>>2]=0,p=y(V*l),u=y(U*l),l=y(G*l),m[i+56>>2]=y(y(N*p)+y(L*u))+y(B*l),m[i+40>>2]=y(y(p*w)+y(u*F))+y(l*M),m[i+32>>2]=y(E*g)+y(y(P*k)+y(I*v)),m[i+28>>2]=y(E*f)+y(y(P*A)+y(I*_)),m[i+24>>2]=y(E*l)+y(y(P*p)+y(I*u)),st(i+24|0,i+8|0),ln(e+80|0,i+8|0,i+80|0,i+76|0),l=y(-m[i+76>>2]),m[i+84>>2]=m[i+84>>2]*l,m[i+88>>2]=m[i+88>>2]*l,l=y(m[i+80>>2]*l),m[i+80>>2]=l,e=d[t+24>>2],t=d[t+28>>2],m[b(e,12)+t>>2]=C*l,m[t+(e<<4)>>2]=C*m[i+84>>2],m[t+b(e,20)>>2]=C*m[i+88>>2],O=i+96|0},r[712]=J_,r[713]=function(e,t,i,n){i=y(i)},r[714]=function(e,t,i){return y(y(0))},r[715]=yd,r[716]=Sn,r[717]=Z_,r[718]=O_,r[719]=function(e){var t,i=0,n=0,s=0;O=t=O-48|0,u[1308+(e|=0)|0]&&(d[e+1056>>2]=0,d[e+992>>2]=0,d[e+928>>2]=0,d[e+712>>2]=0,d[e+716>>2]=0,d[e+720>>2]=0,d[e+724>>2]=0,nt(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0),r[d[d[e>>2]+44>>2]](e),s=d[4+(i=e+1292|0)>>2],d[t+40>>2]=d[i>>2],d[t+44>>2]=s,n=d[e+1288>>2],d[t+32>>2]=d[e+1284>>2],d[t+36>>2]=n,n=d[i+4>>2],d[t+24>>2]=d[i>>2],d[t+28>>2]=n,i=d[e+1288>>2],d[t+16>>2]=d[e+1284>>2],d[t+20>>2]=i,m[e+696>>2]>=m[e+680>>2]&&(i=u[e+1300|0],n=d[(i?e+1064|0:e+1128|0)>>2],s=d[(i?e+1080|0:e+1144|0)>>2],i=d[(i?e+1096|0:e+1160|0)>>2],d[t+12>>2]=0,d[t+8>>2]=i,d[t+4>>2]=s,d[t>>2]=n,Yi(e,e+176|0,t,t+32|0,t+16|0)),m[e+700>>2]>=m[e+684>>2]&&(i=u[e+1300|0],n=d[(i?e+1068|0:e+1132|0)>>2],s=d[(i?e+1084|0:e+1148|0)>>2],i=d[(i?e+1100|0:e+1164|0)>>2],d[t+12>>2]=0,d[t+8>>2]=i,d[t+4>>2]=s,d[t>>2]=n,Yi(e,e+260|0,t,t+32|0,t+16|0)),m[e+704>>2]>=m[e+688>>2]&&(i=u[e+1300|0],n=d[(i?e+1072|0:e+1136|0)>>2],s=d[(i?e+1088|0:e+1152|0)>>2],i=d[(i?e+1104|0:e+1168|0)>>2],d[t+12>>2]=0,d[t+8>>2]=i,d[t+4>>2]=s,d[t>>2]=n,Yi(e,e+344|0,t,t+32|0,t+16|0)),Ft(e,0)&&(n=d[4+(i=e+1216|0)>>2],d[t+8>>2]=d[i>>2],d[t+12>>2]=n,i=d[e+1212>>2],d[t>>2]=d[e+1208>>2],d[t+4>>2]=i,Ei(e,e+428|0,t)),Ft(e,1)&&(n=d[4+(i=e+1232|0)>>2],d[t+8>>2]=d[i>>2],d[t+12>>2]=n,n=d[4+(i=e+1224|0)>>2],d[t>>2]=d[i>>2],d[t+4>>2]=n,Ei(e,e+512|0,t)),Ft(e,2)&&(n=d[4+(i=e+1248|0)>>2],d[t+8>>2]=d[i>>2],d[t+12>>2]=n,n=d[4+(i=e+1240|0)>>2],d[t>>2]=d[i>>2],d[t+4>>2]=n,Ei(e,e+596|0,t))),O=t+48|0},r[720]=function(e,t){t|=0;var i=0,n=0;u[1308+(e|=0)|0]?(d[t>>2]=0,d[t+4>>2]=0):(nt(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0),d[t>>2]=0,d[t+4>>2]=6,d[e+856>>2]|u[e+788|0]?(d[t>>2]=1,d[t+4>>2]=5,i=5,n=1):(i=6,n=0),(u[e+789|0]||d[e+860>>2])&&(i=i+-1|0,d[t+4>>2]=i,n=n+1|0,d[t>>2]=n),(u[e+790|0]||d[e+864>>2])&&(d[t+4>>2]=i+-1,d[t>>2]=n+1),Ft(e,0)&&(d[t>>2]=d[t>>2]+1,d[t+4>>2]=d[t+4>>2]+-1),Ft(e,1)&&(d[t>>2]=d[t>>2]+1,d[t+4>>2]=d[t+4>>2]+-1),Ft(e,2)&&(d[t>>2]=d[t>>2]+1,d[t+4>>2]=d[t+4>>2]+-1))},r[721]=Fi,r[722]=function(e,t,i,n){e|=0,t|=0,i=y(i);var r=0;e:{t:{i:{if((n|=0)>>>0<=2){n:switch(t+-2|0){case 0:m[756+((n<<2)+e|0)>>2]=i;break t;case 2:m[772+((n<<2)+e|0)>>2]=i;break e;case 1:break n;default:break i}return m[740+((n<<2)+e|0)>>2]=i,void(d[e+1304>>2]=d[e+1304>>2]|1<>>0>2)){n:switch(t+-2|0){case 0:m[900+((r<<6)+e|0)>>2]=i;break t;case 2:m[904+((r<<6)+e|0)>>2]=i;break e;case 1:break n;default:break i}m[896+((r<<6)+e|0)>>2]=i,d[e+1304>>2]=d[e+1304>>2]|1<>2]=d[e+1304>>2]|4<>2]=d[e+1304>>2]|2<>>0<=2){t:switch(t+-2|0){case 0:return y(m[756+((i<<2)+e|0)>>2]);case 2:return y(m[772+((i<<2)+e|0)>>2]);case 1:break t;default:break e}return y(m[740+((i<<2)+e|0)>>2])}if(!((i=i+-3|0)>>>0>2)){t:switch(t+-2|0){case 0:return y(m[900+((i<<6)+e|0)>>2]);case 2:return y(m[904+((i<<6)+e|0)>>2]);case 1:break t;default:break e}n=m[896+((i<<6)+e|0)>>2]}}return y(n)},r[724]=function(e){return 252},r[725]=function(e,t,i){return Sn(e|=0,t|=0,i|=0),d[t+52>>2]=d[e+48>>2],d[t+56>>2]=d[e+52>>2],d[t+60>>2]=d[e+56>>2],d[t+64>>2]=d[e+60>>2],d[t+68>>2]=d[e- -64>>2],d[t+72>>2]=d[e+68>>2],d[t+76>>2]=d[e+72>>2],d[t+80>>2]=d[e+76>>2],d[t+84>>2]=d[e+80>>2],d[t+88>>2]=d[e+84>>2],d[t+92>>2]=d[e+88>>2],d[t+96>>2]=d[e+92>>2],d[t+100>>2]=d[e+96>>2],d[t+104>>2]=d[e+100>>2],d[t+108>>2]=d[e+104>>2],d[t+112>>2]=d[e+108>>2],d[t+116>>2]=d[e+112>>2],d[t+120>>2]=d[e+116>>2],d[t+124>>2]=d[e+120>>2],d[t+128>>2]=d[e+124>>2],d[t+132>>2]=d[e+128>>2],d[t+136>>2]=d[e+132>>2],d[t+140>>2]=d[e+136>>2],d[t+144>>2]=d[e+140>>2],d[t+148>>2]=d[e+144>>2],d[t+152>>2]=d[e+148>>2],d[t+156>>2]=d[e+152>>2],d[t+160>>2]=d[e+156>>2],d[t+164>>2]=d[e+160>>2],d[t+168>>2]=d[e+164>>2],d[t+172>>2]=d[e+168>>2],d[t+176>>2]=d[e+172>>2],d[t+228>>2]=d[e+868>>2],d[t+212>>2]=d[e+872>>2],d[t+196>>2]=d[e+680>>2],d[t+180>>2]=d[e+696>>2],d[t+232>>2]=d[e+932>>2],d[t+216>>2]=d[e+936>>2],d[t+200>>2]=d[e+684>>2],d[t+184>>2]=d[e+700>>2],d[t+236>>2]=d[e+996>>2],d[t+220>>2]=d[e+1e3>>2],d[t+204>>2]=d[e+688>>2],d[t+188>>2]=d[e+704>>2],d[t+244>>2]=u[e+1300|0],d[t+248>>2]=u[e+1301|0],18984},r[726]=function(e){e|=0;var t=y(0),i=y(0);t=y(1),(i=m[d[e+32>>2]+344>>2])!=y(0)&&(t=m[d[e+28>>2]+344>>2],t=y(t/y(t+i))),d[e+1296>>2]=0,i=y(y(1)-t),m[e+1292>>2]=y(t*m[e+1120>>2])+y(i*m[e+1184>>2]),m[e+1288>>2]=y(t*m[e+1116>>2])+y(i*m[e+1180>>2]),m[e+1284>>2]=y(t*m[e+1112>>2])+y(i*m[e+1176>>2])},r[727]=O_,r[728]=function(e,t){(function(e,t){var i=y(0),n=y(0);u[e+1309|0]&&(i=y(y(m[e+1256>>2]-m[e+1316>>2])*m[e+1340>>2]),m[e+792>>2]=i*y(y(m[t>>2]*m[e+1364>>2])/y(d[t+48>>2])),m[e+808>>2]=y(v(i))/m[t>>2]),u[e+1310|0]&&(i=y(y(m[e+1260>>2]-m[e+1320>>2])*m[e+1344>>2]),m[e+796>>2]=i*y(y(m[t>>2]*m[e+1368>>2])/y(d[t+48>>2])),m[e+812>>2]=y(v(i))/m[t>>2]),u[e+1311|0]&&(i=y(y(m[e+1264>>2]-m[e+1324>>2])*m[e+1348>>2]),m[e+800>>2]=i*y(y(m[t>>2]*m[e+1372>>2])/y(d[t+48>>2])),m[e+816>>2]=y(v(i))/m[t>>2]),u[e+1312|0]&&(i=y(m[e+1352>>2]*y(-y(m[e+1192>>2]-m[e+1328>>2]))),n=m[t>>2],m[e+876>>2]=i*y(y(n*m[e+1376>>2])/y(d[t+48>>2])),m[e+880>>2]=y(v(i))/n),u[e+1313|0]&&(i=y(m[e+1356>>2]*y(-y(m[e+1196>>2]-m[e+1332>>2]))),n=m[t>>2],m[e+940>>2]=i*y(y(n*m[e+1380>>2])/y(d[t+48>>2])),m[e+944>>2]=y(v(i))/n),u[e+1314|0]&&(i=y(m[e+1360>>2]*y(-y(m[e+1200>>2]-m[e+1336>>2]))),n=m[t>>2],m[e+1004>>2]=i*y(y(n*m[e+1384>>2])/y(d[t+48>>2])),m[e+1008>>2]=y(v(i))/n)})(e|=0,t|=0),Fi(e,t)},r[729]=function(e){return 348},r[730]=function(e,t,i){return Sn(e|=0,t|=0,i|=0),d[t+52>>2]=d[e+48>>2],d[t+56>>2]=d[e+52>>2],d[t+60>>2]=d[e+56>>2],d[t+64>>2]=d[e+60>>2],d[t+68>>2]=d[e- -64>>2],d[t+72>>2]=d[e+68>>2],d[t+76>>2]=d[e+72>>2],d[t+80>>2]=d[e+76>>2],d[t+84>>2]=d[e+80>>2],d[t+88>>2]=d[e+84>>2],d[t+92>>2]=d[e+88>>2],d[t+96>>2]=d[e+92>>2],d[t+100>>2]=d[e+96>>2],d[t+104>>2]=d[e+100>>2],d[t+108>>2]=d[e+104>>2],d[t+112>>2]=d[e+108>>2],d[t+116>>2]=d[e+112>>2],d[t+120>>2]=d[e+116>>2],d[t+124>>2]=d[e+120>>2],d[t+128>>2]=d[e+124>>2],d[t+132>>2]=d[e+128>>2],d[t+136>>2]=d[e+132>>2],d[t+140>>2]=d[e+136>>2],d[t+144>>2]=d[e+140>>2],d[t+148>>2]=d[e+144>>2],d[t+152>>2]=d[e+148>>2],d[t+156>>2]=d[e+152>>2],d[t+160>>2]=d[e+156>>2],d[t+164>>2]=d[e+160>>2],d[t+168>>2]=d[e+164>>2],d[t+172>>2]=d[e+168>>2],d[t+176>>2]=d[e+172>>2],d[t+228>>2]=d[e+868>>2],d[t+212>>2]=d[e+872>>2],d[t+196>>2]=d[e+680>>2],d[t+180>>2]=d[e+696>>2],d[t+232>>2]=d[e+932>>2],d[t+216>>2]=d[e+936>>2],d[t+200>>2]=d[e+684>>2],d[t+184>>2]=d[e+700>>2],d[t+236>>2]=d[e+996>>2],d[t+220>>2]=d[e+1e3>>2],d[t+204>>2]=d[e+688>>2],d[t+188>>2]=d[e+704>>2],d[t+244>>2]=u[e+1300|0],d[t+248>>2]=u[e+1301|0],d[t+276>>2]=d[e+1316>>2],d[t+324>>2]=d[e+1364>>2],d[t+252>>2]=u[e+1309|0],d[t+300>>2]=d[e+1340>>2],d[t+280>>2]=d[e+1320>>2],d[t+328>>2]=d[e+1368>>2],d[t+256>>2]=u[e+1310|0],d[t+304>>2]=d[e+1344>>2],d[t+284>>2]=d[e+1324>>2],d[t+332>>2]=d[e+1372>>2],d[t+260>>2]=u[e+1311|0],d[t+308>>2]=d[e+1348>>2],d[t+288>>2]=d[e+1328>>2],d[t+336>>2]=d[e+1376>>2],d[t+264>>2]=u[e+1312|0],d[t+312>>2]=d[e+1352>>2],d[t+292>>2]=d[e+1332>>2],d[t+340>>2]=d[e+1380>>2],d[t+268>>2]=u[e+1313|0],d[t+316>>2]=d[e+1356>>2],d[t+296>>2]=d[e+1336>>2],d[t+344>>2]=d[e+1384>>2],d[t+272>>2]=u[e+1314|0],d[t+320>>2]=d[e+1360>>2],19116},r[731]=function(e,t,i){e|=0,t|=0,i|=0;var n,r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0);n=d[e+28>>2],g=m[n+20>>2],b=m[n+36>>2],v=m[n+40>>2],A=m[n+24>>2],C=m[n+8>>2],s=m[n+60>>2],a=m[n+44>>2],l=m[n+28>>2],o=m[n+56>>2],c=m[n+52>>2],h=m[n+12>>2],_=m[i+8>>2],u=m[i>>2],p=m[i+4>>2],f=m[t+8>>2],r=m[t>>2],S=m[t+4>>2],T=m[n+4>>2],d[e+108>>2]=0,d[e+92>>2]=0,d[e+76>>2]=0,d[e+60>>2]=0,o=y(-o),m[e+104>>2]=y(y(y(h*y(0))+y(l*y(0)))+y(a*y(0)))+y(y(y(l*o)-y(h*c))-y(a*s)),m[e+100>>2]=y(y(y(C*y(0))+y(A*y(0)))+y(v*y(0)))+y(y(y(A*o)-y(C*c))-y(v*s)),m[e+96>>2]=y(y(y(T*y(0))+y(g*y(0)))+y(b*y(0)))+y(y(y(g*o)-y(T*c))-y(b*s)),o=r,r=y(y(1)/y(x(y(y(y(r*r)+y(S*S))+y(f*f))))),s=y(o*r),c=y(S*r),f=y(f*r),m[e+88>>2]=y(y(h*s)+y(l*c))+y(a*f),r=y(y(1)/y(x(y(y(y(u*u)+y(p*p))+y(_*_))))),u=y(u*r),p=y(p*r),_=y(_*r),m[e+84>>2]=y(y(h*u)+y(l*p))+y(a*_),m[e+72>>2]=y(y(s*C)+y(c*A))+y(f*v),m[e+68>>2]=y(y(u*C)+y(p*A))+y(_*v),m[e+56>>2]=y(y(T*s)+y(c*g))+y(f*b),m[e+52>>2]=y(b*_)+y(y(T*u)+y(g*p)),r=h,h=y(y(f*p)-y(c*_)),o=l,l=y(y(s*_)-y(f*u)),S=a,a=y(y(c*u)-y(s*p)),m[e+80>>2]=y(y(r*h)+y(o*l))+y(S*a),m[e- -64>>2]=y(a*v)+y(y(C*h)+y(A*l)),m[e+48>>2]=y(b*a)+y(y(T*h)+y(g*l)),t=d[e+32>>2],E=m[t+60>>2],P=m[t+56>>2],R=m[t+52>>2],g=m[t+20>>2],b=m[t+36>>2],v=m[t+40>>2],A=m[t+8>>2],C=m[t+24>>2],T=m[t+44>>2],r=m[t+12>>2],S=m[t+28>>2],o=m[t+4>>2],d[e+172>>2]=0,d[e+156>>2]=0,d[e+140>>2]=0,d[e+124>>2]=0,m[e+152>>2]=y(y(s*r)+y(c*S))+y(f*T),m[e+148>>2]=y(y(u*r)+y(p*S))+y(_*T),m[e+144>>2]=y(y(h*r)+y(l*S))+y(a*T),m[e+136>>2]=y(y(s*A)+y(c*C))+y(f*v),m[e+132>>2]=y(y(u*A)+y(p*C))+y(_*v),m[e+128>>2]=y(y(h*A)+y(l*C))+y(a*v),m[e+120>>2]=y(y(s*o)+y(c*g))+y(f*b),m[e+116>>2]=y(y(u*o)+y(p*g))+y(_*b),m[e+112>>2]=y(y(h*o)+y(l*g))+y(a*b),s=y(-P),m[e+168>>2]=y(y(y(r*y(0))+y(S*y(0)))+y(T*y(0)))+y(y(y(S*s)-y(r*R))-y(T*E)),m[e+164>>2]=y(y(y(A*y(0))+y(C*y(0)))+y(v*y(0)))+y(y(y(C*s)-y(A*R))-y(v*E)),m[e+160>>2]=y(y(y(o*y(0))+y(g*y(0)))+y(b*y(0)))+y(y(y(g*s)-y(o*R))-y(b*E)),Q_(e)},r[732]=O_,r[733]=function(e){e|=0;var t,i=0,n=0,r=y(0),s=y(0),o=y(0),a=0,l=y(0),c=y(0),h=y(0),_=0,u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=0;for(O=t=O-144|0,d[e+36>>2]=0,d[t+136>>2]=0,d[t+140>>2]=0,d[t+128>>2]=0,d[t+132>>2]=0;d[(T=(t+128|0)+(_<<2)|0)>>2]=1065353216,n=d[e+28>>2],d[t+80>>2]=d[n+4>>2],d[t+84>>2]=d[n+20>>2],i=d[n+36>>2],d[t+92>>2]=0,d[t+88>>2]=i,d[t+96>>2]=d[n+8>>2],d[t+100>>2]=d[n+24>>2],i=d[n+40>>2],d[t+108>>2]=0,d[t+104>>2]=i,d[t+112>>2]=d[n+12>>2],d[t+116>>2]=d[n+28>>2],i=d[n+44>>2],d[t+124>>2]=0,d[t+120>>2]=i,i=d[e+32>>2],d[t+32>>2]=d[i+4>>2],d[t+36>>2]=d[i+20>>2],a=d[i+36>>2],d[t+44>>2]=0,d[t+40>>2]=a,d[t+48>>2]=d[i+8>>2],d[t+52>>2]=d[i+24>>2],a=d[i+40>>2],d[t+60>>2]=0,d[t+56>>2]=a,d[t+64>>2]=d[i+12>>2],d[t+68>>2]=d[i+28>>2],a=d[i+44>>2],d[t+76>>2]=0,d[t+72>>2]=a,l=m[n+52>>2],u=m[n+12>>2],p=m[n+8>>2],c=m[n+56>>2],f=m[n+28>>2],g=m[n+20>>2],v=m[n+24>>2],h=m[n+60>>2],A=m[n+44>>2],C=m[n+36>>2],S=m[n+40>>2],x=m[n+4>>2],r=m[e+308>>2],s=m[e+300>>2],o=m[e+304>>2],d[t+28>>2]=0,m[t+24>>2]=y(h+y(y(y(s*C)+y(o*S))+y(r*A)))-h,m[t+20>>2]=y(c+y(y(y(s*g)+y(o*v))+y(r*f)))-c,m[t+16>>2]=y(l+y(y(y(s*x)+y(o*p))+y(r*u)))-l,l=m[i+52>>2],u=m[i+12>>2],p=m[i+8>>2],c=m[i+56>>2],f=m[i+28>>2],g=m[i+20>>2],v=m[i+24>>2],h=m[i+60>>2],A=m[i+44>>2],C=m[i+36>>2],S=m[i+40>>2],x=m[i+4>>2],r=m[e+324>>2],s=m[e+316>>2],o=m[e+320>>2],d[t+12>>2]=0,m[t+8>>2]=y(h+y(y(y(s*C)+y(o*S))+y(r*A)))-h,m[t+4>>2]=y(c+y(y(y(s*g)+y(o*v))+y(r*f)))-c,m[t>>2]=y(l+y(y(y(s*x)+y(o*p))+y(r*u)))-l,ai(48+(b(_,84)+e|0)|0,t+80|0,t+32|0,t+16|0,t,t+128|0,n+396|0,m[n+344>>2],i+396|0,m[i+344>>2]),d[T>>2]=0,3!=(0|(_=_+1|0)););O=t+144|0},r[734]=function(e,t){t|=0,e=u[344+(e|=0)|0]?0:3,d[t+4>>2]=e,d[t>>2]=e},r[735]=function(e,t){!function(e,t,i,n){var r,s,o,a,l,c=0,h=y(0),_=y(0),u=0,p=0,f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0);p=d[t+8>>2],d[p>>2]=1065353216,s=d[t+24>>2],d[p+(a=4+(r=s<<2)|0)>>2]=1065353216,d[p+(l=8+(o=s<<3)|0)>>2]=1065353216,f=m[i+20>>2],v=m[i+24>>2],g=m[i+36>>2],h=m[e+304>>2],A=m[i+40>>2],_=m[e+308>>2],C=m[i+8>>2],S=m[i>>2],x=m[i+4>>2],T=m[i+16>>2],E=m[i+32>>2],b=m[e+300>>2],d[12+(p=O-16|0)>>2]=0,g=y(y(y(b*E)+y(h*g))+y(_*A)),m[p+8>>2]=g,f=y(y(y(b*T)+y(h*f))+y(_*v)),m[p+4>>2]=f,h=y(y(y(S*b)+y(x*h))+y(C*_)),m[p>>2]=h,c=d[t+12>>2],d[c+12>>2]=0,m[c+8>>2]=-f,m[c+4>>2]=g,d[c>>2]=0,d[12+(u=c+r|0)>>2]=0,m[u+8>>2]=h,d[u+4>>2]=0,m[u>>2]=-g,d[8+(c=c+o|0)>>2]=0,d[c+12>>2]=0,m[c+4>>2]=-h,m[c>>2]=f,c=d[t+16>>2],d[c>>2]=-1082130432,d[c+a>>2]=-1082130432,d[c+l>>2]=-1082130432,f=m[n+36>>2],v=m[n+40>>2],g=m[n+20>>2],h=m[e+320>>2],A=m[n+24>>2],_=m[e+324>>2],C=m[n+8>>2],S=m[n>>2],x=m[n+4>>2],T=m[n+32>>2],E=m[n+16>>2],b=m[e+316>>2],c=d[t+20>>2],d[c+12>>2]=0,d[c>>2]=0,g=y(y(y(b*E)+y(h*g))+y(_*A)),m[c+8>>2]=g,f=y(y(y(b*T)+y(h*f))+y(_*v)),m[c+4>>2]=-f,d[12+(u=c+r|0)>>2]=0,h=y(y(y(S*b)+y(x*h))+y(C*_)),m[u+8>>2]=-h,d[u+4>>2]=0,m[u>>2]=f,d[8+(c=c+o|0)>>2]=0,d[c+12>>2]=0,m[c+4>>2]=h,m[c>>2]=-g,c=d[t+28>>2],u=d[e+332>>2],_=y(m[(1&u?e+336|0:t+4|0)>>2]*m[t>>2]),m[c>>2]=_*y(y(y(h+m[n+48>>2])-m[p>>2])-m[i+48>>2]),m[c+r>>2]=_*y(y(y(g+m[n+52>>2])-m[p+4>>2])-m[i+52>>2]),m[c+o>>2]=_*y(y(y(f+m[n+56>>2])-m[p+8>>2])-m[i+56>>2]),i=s<<1,2&u&&(n=d[t+32>>2],d[n>>2]=d[e+340>>2],d[n+r>>2]=d[e+340>>2],d[n+(i<<2)>>2]=d[e+340>>2]),_=m[e+356>>2],b=y(-_),h=_,_>y(0)&&(m[d[t+36>>2]>>2]=b,m[d[t+40>>2]>>2]=_,h=m[e+356>>2]),h>y(0)&&(m[(n=s<<2)+d[t+36>>2]>>2]=b,m[n+d[t+40>>2]>>2]=_,h=m[e+356>>2]),h>y(0)&&(m[(i<<=2)+d[t+36>>2]>>2]=b,m[i+d[t+40>>2]>>2]=_),d[t+52>>2]=d[e+352>>2]}(e|=0,t|=0,d[e+28>>2]+4|0,d[e+32>>2]+4|0)},r[736]=function(e,t,i,n){e|=0,t|=0,i=y(i);e:if(-1==(0|(n|=0))){t:switch(t+-1|0){case 0:case 1:return m[e+336>>2]=i,void(d[e+332>>2]=1|d[e+332>>2]);case 2:case 3:break t;default:break e}m[e+340>>2]=i,d[e+332>>2]=2|d[e+332>>2]}},r[737]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0);n=y(34028234663852886e22);e:if(-1==(0|i)){t:switch(t+-1|0){case 0:case 1:return y(m[e+336>>2]);case 2:case 3:break t;default:break e}n=m[e+340>>2]}return y(n)},r[738]=bd,r[739]=function(e,t,i){return Sn(e|=0,t|=0,i|=0),d[t+52>>2]=d[e+300>>2],d[t+56>>2]=d[e+304>>2],d[t+60>>2]=d[e+308>>2],d[t+64>>2]=d[e+312>>2],d[t+68>>2]=d[e+316>>2],d[t+72>>2]=d[e+320>>2],d[t+76>>2]=d[e+324>>2],d[t+80>>2]=d[e+328>>2],19244},r[740]=function(e){e|=0,d[7313]=17792,(e=d[7437])&&(u[29752]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[7437]=0),s[29752]=1,d[7435]=0,d[7436]=0,d[7437]=0,d[7313]=3948},r[741]=Id,r[742]=O_,r[743]=function(e,t){e|=0,t|=0;var i=y(0),n=y(0),r=y(0);if(u[e+48|0])return d[t>>2]=0,void(d[t+4>>2]=0);d[t>>2]=4,d[t+4>>2]=2,te(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0),function(e){var t=y(0),i=y(0),n=y(0),r=y(0),o=y(0);if(s[e+297|0]=0,d[e+1088>>2]=0,(n=m[e+192>>2])<=(r=m[e+196>>2])){if(t=m[e+892>>2],i=m[e+908>>2],o=m[e+924>>2],i=tn(y(y(y(m[e+832>>2]*t)+y(m[e+848>>2]*i))+y(m[e+864>>2]*o)),y(y(y(m[e+828>>2]*t)+y(m[e+844>>2]*i))+y(m[e+860>>2]*o))),n>=r||(iy(3.1415927410125732)&&(t=y(t+y(-6.2831854820251465))),o=y(v(t)),(t=Ji(y(r-i),y(6.2831854820251465)))y(3.1415927410125732)&&(t=y(t+y(-6.2831854820251465))),i=or&&((t=Ji(y(i-r),y(6.2831854820251465)))y(3.1415927410125732)&&(t=y(t+y(-6.2831854820251465))),o=y(v(t)),(t=Ji(y(i-n),y(6.2831854820251465)))y(3.1415927410125732)&&(t=y(t+y(-6.2831854820251465))),i=y(v(t))>2]=i,i>2]=i-n);i>r&&(s[e+297|0]=1,m[e+1088>>2]=i-r)}}(e),s[e+296|0]=0,n=m[e+1032>>2],d[e+1080>>2]=d[e+1032>>2];e:{t:{i:{if((r=m[e+184>>2])<=(i=m[e+188>>2])){if(in)break i}if(d[e+1032>>2]=0,u[e+1096|0])break t;break e}s[e+296|0]=1,m[e+1032>>2]=n-i}d[t>>2]=d[t>>2]+1,d[t+4>>2]=d[t+4>>2]+-1}(u[e+1112|0]||u[e+297|0])&&(d[t>>2]=d[t>>2]+1,d[t+4>>2]=d[t+4>>2]+-1)},r[744]=function(e,t){!function(e,t,i,n,r,o,_,p){var f,g,A=y(0),C=0,S=y(0),T=y(0),E=0,R=y(0),P=y(0),I=0,M=y(0),D=y(0),w=y(0),F=0,B=0,N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=0,W=0,z=0,H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=0,Z=0,$=0,J=0,ee=0,te=0,ie=0,ne=y(0),re=y(0),se=y(0),oe=y(0),ae=y(0),le=y(0),ce=y(0),he=y(0),_e=y(0);O=f=O-48|0,g=u[e+180|0],oe=m[e+880>>2],ae=m[e+944>>2],le=m[e+876>>2],ce=m[e+940>>2],he=m[e+872>>2],_e=m[e+936>>2],M=(A=y(_+p))>y(0)?y(p/A):y(.5),w=y(y(1)-M),F=d[t+24>>2],U=m[e+920>>2],L=m[e+904>>2],k=m[e+856>>2],Z=d[e+856>>2],H=m[e+840>>2],$=d[e+840>>2],Y=m[e+888>>2],X=m[e+824>>2],J=d[e+824>>2],(B=u[e+49|0])?(T=y(y(M*X)+y(w*Y)),S=y(y(M*H)+y(w*L)),D=y(y(M*k)+y(w*U)),A=y(y(1)/y(x(y(y(y(T*T)+y(S*S))+y(D*D))))),S=y(S*A),P=y(T*A),N=y(D*A),y(v(N))>y(.7071067690849304)?(A=y(y(N*N)+y(S*S)),V=y(y(1)/y(x(A))),A=y(A*V),T=y(V*y(-N)),D=y(P*T),G=y(S*V),V=y(G*y(-P))):(T=y(y(P*P)+y(S*S)),A=y(y(1)/y(x(T))),D=y(T*A),R=y(A*y(-S)),V=y(N*R),T=y(P*A),A=y(T*y(-N))),l(S),$=c(0),l(P),J=c(0),m[f+40>>2]=G,m[f+36>>2]=T,m[f+24>>2]=D,m[f+20>>2]=V,m[f+16>>2]=A,m[f+32>>2]=R,l(R),C=c(0),l(N),Z=c(0)):(C=d[e+828>>2],E=d[e+844>>2],I=d[e+860>>2],d[f+44>>2]=0,d[f+40>>2]=I,d[f+36>>2]=E,d[f+32>>2]=C,E=d[e+832>>2],I=d[e+848>>2],W=d[e+864>>2],d[f+28>>2]=0,d[f+24>>2]=W,d[f+20>>2]=I,d[f+16>>2]=E),E=d[t+12>>2],d[E>>2]=C,d[E+4>>2]=d[f+36>>2],d[E+8>>2]=d[f+40>>2],d[(I=F<<2)+E>>2]=d[f+16>>2],d[(W=I+4|0)+E>>2]=d[f+20>>2],d[(j=I+8|0)+E>>2]=d[f+24>>2],C=d[t+20>>2],T=m[f+32>>2],q=y(-T),m[C>>2]=q,S=m[f+36>>2],m[C+4>>2]=-S,D=m[f+40>>2],m[C+8>>2]=-D,V=m[f+16>>2],m[C+I>>2]=-V,G=m[f+20>>2],m[C+W>>2]=-G,P=m[f+24>>2],m[C+j>>2]=-P,A=m[e+280>>2],j=W=d[t+28>>2],128&(z=d[e+300>>2])||(A=y(A*m[t+4>>2])),A=y(A*m[t>>2]),R=y(y(H*U)-y(k*L)),N=y(y(k*Y)-y(X*U)),U=y(y(X*L)-y(H*Y)),m[j>>2]=A*y(y(y(R*T)+y(N*S))+y(U*D)),m[I+W>>2]=A*y(y(y(R*V)+y(N*G))+y(U*P)),64&z&&(I=d[t+32>>2],d[I>>2]=d[e+292>>2],d[I+(F<<2)>>2]=d[e+292>>2]),K=_>2],p=m[n+52>>2],A=m[i+56>>2],N=m[i+52>>2],R=m[n+48>>2],U=m[i+48>>2],d[f+8>>2]=0,d[f+12>>2]=0,d[f>>2]=0,d[f+4>>2]=0,W=b(F,3),i=F<<1,B?(V=m[e+1032>>2],G=m[e+1080>>2],T=m[e+944>>2],S=m[e+936>>2],D=m[e+940>>2],P=m[e+880>>2],H=m[e+872>>2],Y=m[e+876>>2],d[f+44>>2]=0,X=y(S-R),a(0,J),R=h(),q=y(D-p),a(0,$),L=h(),p=y(T-_),a(0,Z),k=h(),_=y(y(y(X*R)+y(q*L))+y(p*k)),S=y(_*k),U=y(H-U),T=y(Y-N),P=y(P-A),A=y(y(y(U*R)+y(T*L))+y(P*k)),D=y(A*k),N=y(p-S),H=y(P-D),p=y(y(M*N)+y(w*H)),m[f+40>>2]=p,Y=y(_*L),q=y(q-Y),ne=y(A*L),re=y(T-ne),T=y(y(M*q)+y(w*re)),m[f+36>>2]=T,Q=X,X=y(_*R),se=y(Q-X),A=y(A*R),Q=y(U-A),P=y(y(M*se)+y(w*Q)),m[f+32>>2]=P,_=y(G-V),S=y(y(D+y(_*k))-S),V=y(N-y(w*S)),D=y(y(ne+y(_*L))-Y),N=y(q-y(w*D)),A=y(y(A+y(_*R))-X),_=y(se-y(w*A)),U=y(H+y(M*S)),D=y(re+y(M*D)),G=y(Q+y(M*A)),(A=y(y(p*p)+y(y(P*P)+y(T*T))))>y(1.1920928955078125e-7)?(Q=p,p=y(y(1)/y(x(A))),A=y(Q*p),m[f+40>>2]=A,S=y(T*p),m[f+36>>2]=S,T=y(P*p),m[f+32>>2]=T,l(A),I=c(0),l(S),F=c(0)):(T=m[e+828>>2],n=d[e+828>>2],S=m[e+844>>2],F=d[e+844>>2],A=m[e+860>>2],I=d[e+860>>2],d[f+44>>2]=0,d[f+40>>2]=I,d[f+36>>2]=F,d[f+32>>2]=n),m[f+8>>2]=y(G*S)-y(D*T),d[f+28>>2]=0,m[f+4>>2]=y(U*T)-y(G*A),m[f>>2]=y(D*A)-y(U*S),p=y(y(S*R)-y(T*L)),m[f+24>>2]=p,P=y(y(T*k)-y(A*R)),m[f+20>>2]=P,m[f+16>>2]=y(A*L)-y(S*k),d[8+(n=(B=i<<2)+E|0)>>2]=d[f+8>>2],E=d[f+4>>2],d[n>>2]=d[f>>2],d[n+4>>2]=E,m[C+B>>2]=-y(y(N*A)-y(V*S)),m[(j=(1|i)<<2)+C>>2]=-y(y(V*T)-y(_*A)),m[(z=i+2<<2)+C>>2]=-y(y(_*S)-y(N*T)),d[f+12>>2]=0,T=y(y(D*p)-y(U*P)),m[f>>2]=T,A=m[f+16>>2],L=y(y(G*P)-y(D*A)),m[f+8>>2]=L,k=y(y(U*A)-y(G*p)),m[f+4>>2]=k,S=y(y(N*p)-y(V*P)),R=y(y(_*P)-y(N*A)),A=y(y(V*A)-y(_*p)),!K|!u[e+297|0]||(m[f+8>>2]=M*L,m[f+4>>2]=M*k,m[f>>2]=M*T,R=y(w*R),S=y(w*S),A=y(w*A)),E=d[f+4>>2],C=(n=W<<2)+d[t+12>>2]|0,d[C>>2]=d[f>>2],d[C+4>>2]=E,d[C+8>>2]=d[f+8>>2],C=d[t+20>>2],m[C+(ee=n+4|0)>>2]=-A,m[n+C>>2]=-S,m[(te=n+8|0)+C>>2]=-R,C=d[t+8>>2],d[B+C>>2]=d[f+32>>2],d[C+j>>2]=F,d[C+z>>2]=I,E=d[f+16>>2],m[C+te>>2]=p,m[C+ee>>2]=P,d[n+C>>2]=E,E=d[t+16>>2],m[B+E>>2]=-m[f+32>>2],a(0,F),S=h(),m[E+j>>2]=-S,a(0,I),H=h(),m[E+z>>2]=-H,T=m[f+16>>2],m[E+ee>>2]=-P,m[n+E>>2]=-T,B=E+te|0,R=y(0),L=y(0),k=y(0),A=y(-p)):(n=i<<2,L=y(p-N),k=y(_-A),_=y(y(L*D)-y(k*S)),m[n+E>>2]=M*_,I=4|n,R=y(R-U),p=y(y(k*T)-y(R*D)),m[I+E>>2]=M*p,B=n+8|0,A=y(y(R*S)-y(L*T)),m[B+E>>2]=M*A,m[n+C>>2]=w*_,m[C+I>>2]=w*p,m[C+B>>2]=w*A,j=8+(F=W<<2)|0,_=y(y(R*G)-y(L*V)),m[j+E>>2]=M*_,z=F+4|0,p=y(y(k*V)-y(R*P)),m[z+E>>2]=M*p,A=y(y(L*P)-y(k*G)),m[E+F>>2]=M*A,m[C+j>>2]=w*_,m[C+z>>2]=w*p,m[C+F>>2]=w*A,C=d[t+8>>2],m[n+C>>2]=T,m[C+I>>2]=S,m[C+B>>2]=D,m[C+j>>2]=P,m[C+z>>2]=G,m[C+F>>2]=V,E=d[t+16>>2],m[n+E>>2]=q,S=m[f+36>>2],m[E+I>>2]=-S,H=m[f+40>>2],m[E+B>>2]=-H,T=m[f+16>>2],m[E+F>>2]=-T,P=m[f+20>>2],m[E+z>>2]=-P,B=E+j|0,_=y(0),N=y(0),V=y(0),G=y(0),D=y(0),U=y(0),p=m[f+24>>2],A=y(-p)),m[B>>2]=A,A=m[e+264>>2],n=(B=d[t+28>>2])+(i<<=2)|0,32&(j=d[e+300>>2])||(A=y(A*m[t+4>>2])),A=y(A*m[t>>2]),Y=y(_e-he),X=y(ce-le),Q=y(y(Y*m[f+32>>2])+y(X*S)),S=y(ae-oe),m[n>>2]=A*y(Q+y(S*H)),m[(n=W<<2)+B>>2]=A*y(y(y(Y*T)+y(X*P))+y(S*p)),16&j&&(ie=i,i=d[t+32>>2],d[ie+i>>2]=d[e+276>>2],d[i+n>>2]=d[e+276>>2]),P=y(g?1:-1);e:{t:{if(u[e+296|0])W=(A=y(P*m[e+1032>>2]))>y(0)?2:1,z=u[e+1096|0],i=1;else{if(!u[e+1096|0])break t;A=y(0),z=1,W=0,i=0}n=d[t+24>>2],d[(ee=n<<4)+C>>2]=J,d[(n=(te=1|(I=n<<2))<<2)+C>>2]=$,d[(ie=C)+(C=(F=2|I)<<2)>>2]=Z,a(0,J),p=h(),m[E+ee>>2]=-p,a(0,$),T=h(),m[n+E>>2]=-T,a(0,Z),S=h(),m[C+E>>2]=-S;i:{if(u[e+49|0]){if(K)break i;d[f+12>>2]=0,M=y(y(G*T)-y(D*p)),m[f+8>>2]=M,w=y(y(U*p)-y(G*S)),m[f+4>>2]=w,R=y(y(D*S)-y(U*T)),m[f>>2]=R,n=d[t+12>>2],m[n+(E=I<<2)>>2]=R,m[(K=te<<2)+n>>2]=w,m[n+(F<<2)>>2]=M,C=d[t+20>>2],m[E+C>>2]=-y(y(N*S)-y(V*T)),m[C+K>>2]=-y(y(V*p)-y(_*S)),_=y(-y(y(_*T)-y(N*p)))}else E=d[t+12>>2],K=I<<2,_=y(y(L*S)-y(k*T)),m[E+K>>2]=M*_,D=y(y(k*p)-y(R*S)),m[n+E>>2]=M*D,Q=M,M=y(y(R*T)-y(L*p)),m[C+E>>2]=Q*M,C=d[t+20>>2],m[K+C>>2]=w*_,m[n+C>>2]=w*D,_=y(w*M);m[(F<<2)+C>>2]=_}if(_=m[e+188>>2],M=m[e+184>>2],d[(C=I<<2)+B>>2]=0,n=d[t+36>>2],d[C+n>>2]=0,F=d[t+40>>2],d[C+F>>2]=0,w=m[(512&j?e+232|0:t+4|0)>>2],!z|i&M==_||(1&j&&(d[d[t+32>>2]+(I<<2)>>2]=d[e+212>>2]),R=Os(m[e+1080>>2],m[e+184>>2],m[e+188>>2],m[e+1100>>2],y(w*m[t>>2])),B=d[t+28>>2],m[(n=B+(C=I<<2)|0)>>2]=m[n>>2]-y(y(P*R)*m[e+1100>>2]),n=d[t+36>>2],m[(E=C+n|0)>>2]=m[E>>2]-y(m[e+1104>>2]*m[t>>2]),F=d[t+40>>2],m[(C=C+F|0)>>2]=y(m[e+1104>>2]*m[t>>2])+m[C>>2]),E=5,!i)break e;m[(i=(C=I<<2)+B|0)>>2]=m[i>>2]+y(A*y(w*m[t>>2])),1&s[e+301|0]&&(d[C+d[t+32>>2]>>2]=d[e+244>>2]),ie=(I<<2)+F|0;i:{if(M!=_){if(n=(I<<2)+n|0,1==(0|W)){d[n>>2]=-8388609,_=y(0);break i}d[n>>2]=0}else d[(I<<2)+n>>2]=-8388609;_=y(34028234663852886e22)}m[ie>>2]=_;i:if(!((_=y(y(1)-m[e+240>>2]))==y(0)|_!=_))if(A=y(v(_)),_=y(P*y(y(y(y(m[r>>2]*p)+y(m[r+4>>2]*T))+y(m[r+8>>2]*S))-y(y(y(m[o>>2]*p)+y(m[o+4>>2]*T))+y(m[o+8>>2]*S)))),1!=(0|W))_>y(0)&&(_=y(_*y(-A)))>2]&&(m[i>>2]=_);else{if(!(_m[i>>2]))break i;m[i>>2]=_}m[i>>2]=m[e+232>>2]*m[i>>2];break e}E=4}e:{if(u[e+297|0])r=(R=m[e+1088>>2])>y(0)?1:2,F=!u[e+1112|0],i=1;else{if(!u[e+1112|0])break e;R=y(0),F=0,r=0,i=0}if(C=d[t+12>>2],n=b(d[t+24>>2],E),d[C+(o=n<<2)>>2]=J,d[(E=o+8|0)+C>>2]=Z,d[(I=o+4|0)+C>>2]=$,C=d[t+20>>2],a(0,Z),S=h(),m[C+E>>2]=-S,a(0,$),M=h(),m[C+I>>2]=-M,a(0,J),w=h(),m[o+C>>2]=-w,o=d[e+300>>2],D=m[(2048&o?e+248|0:t+4|0)>>2],i&(p=m[e+192>>2])==(_=m[e+196>>2])|F||(A=_,T=p,4&o&&(d[d[t+32>>2]+(n<<2)>>2]=d[e+228>>2],T=m[e+192>>2],A=m[e+196>>2]),A=Os(m[e+1084>>2],T,A,m[e+1116>>2],y(D*m[t>>2])),B=d[t+28>>2],m[B+(o=n<<2)>>2]=A*m[e+1116>>2],m[o+d[t+36>>2]>>2]=m[t>>2]*y(-m[e+1120>>2]),m[o+d[t+40>>2]>>2]=m[e+1120>>2]*m[t>>2]),i){m[(i=(o=n<<2)+B|0)>>2]=m[i>>2]+y(R*y(D*m[t>>2])),4&u[e+301|0]&&(d[o+d[t+32>>2]>>2]=d[e+260>>2]),p!=_?(o=d[t+36>>2]+(n<<2)|0,1!=(0|r)?(d[o>>2]=-8388609,_=y(0)):(d[o>>2]=0,_=y(34028234663852886e22))):(d[d[t+36>>2]+(n<<2)>>2]=-8388609,_=y(34028234663852886e22)),m[d[t+40>>2]+(n<<2)>>2]=_;t:if(!((_=y(y(1)-m[e+256>>2]))==y(0)|_!=_))if(p=y(v(_)),t=d[e+28>>2],_=y(y(y(m[t+328>>2]*w)+y(m[t+332>>2]*M))+y(m[t+336>>2]*S)),t=d[e+32>>2],_=y(_-y(y(y(m[t+328>>2]*w)+y(m[t+332>>2]*M))+y(m[t+336>>2]*S))),1!=(0|r))_>y(0)&&(_=y(_*y(-p)))>2]&&(m[i>>2]=_);else{if(!(_m[i>>2]))break t;m[i>>2]=_}m[i>>2]=m[e+248>>2]*m[i>>2]}}O=f+48|0}(e|=0,t|=0,(t=d[e+28>>2])+4|0,(e=d[e+32>>2])+4|0,t+312|0,e+312|0,m[t+344>>2],m[e+344>>2])},r[745]=function(e,t,i,n){e|=0,t|=0,i=y(i),n|=0;e:{t:switch(t+-2|0){case 0:if((0|n)<=0)return m[e+232>>2]=i,void(d[e+300>>2]=512|d[e+300>>2]);if((0|n)<=2)return m[e+264>>2]=i,void(d[e+300>>2]=32|d[e+300>>2]);if(3==(0|n))return m[e+248>>2]=i,void(d[e+300>>2]=2048|d[e+300>>2]);if((0|n)>5)break e;return m[e+280>>2]=i,void(d[e+300>>2]=128|d[e+300>>2]);case 1:if((0|n)<=0)return m[e+212>>2]=i,void(d[e+300>>2]=1|d[e+300>>2]);if(3!=(0|n))break e;return m[e+228>>2]=i,void(d[e+300>>2]=4|d[e+300>>2]);case 2:break t;default:break e}if((0|n)<=0)return m[e+244>>2]=i,void(d[e+300>>2]=256|d[e+300>>2]);if((0|n)<=2)return m[e+276>>2]=i,void(d[e+300>>2]=16|d[e+300>>2]);if(3==(0|n))return m[e+260>>2]=i,void(d[e+300>>2]=1024|d[e+300>>2]);(0|n)>5||(m[e+292>>2]=i,d[e+300>>2]=64|d[e+300>>2])}},r[746]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0);n=y(34028234663852886e22);e:{t:switch(t+-2|0){case 0:if((0|i)<=0)return y(m[e+232>>2]);if((0|i)<=2)return y(m[e+264>>2]);if(3==(0|i))return y(m[e+248>>2]);if((0|i)>5)break e;return y(m[e+280>>2]);case 1:if((0|i)<=0)return y(m[e+212>>2]);if(3!=(0|i))break e;return y(m[e+228>>2]);case 2:break t;default:break e}if((0|i)<=0)return y(m[e+244>>2]);if((0|i)<=2)return y(m[e+276>>2]);if(3==(0|i))return y(m[e+260>>2]);(0|i)>5||(n=m[e+292>>2])}return y(n)},r[747]=function(e){return 204},r[748]=function(e,t,i){return Sn(e|=0,t|=0,i|=0),d[t+52>>2]=d[e+52>>2],d[t+56>>2]=d[e+56>>2],d[t+60>>2]=d[e+60>>2],d[t+64>>2]=d[e- -64>>2],d[t+68>>2]=d[e+68>>2],d[t+72>>2]=d[e+72>>2],d[t+76>>2]=d[e+76>>2],d[t+80>>2]=d[e+80>>2],d[t+84>>2]=d[e+84>>2],d[t+88>>2]=d[e+88>>2],d[t+92>>2]=d[e+92>>2],d[t+96>>2]=d[e+96>>2],d[t+100>>2]=d[e+100>>2],d[t+104>>2]=d[e+104>>2],d[t+108>>2]=d[e+108>>2],d[t+112>>2]=d[e+112>>2],d[t+116>>2]=d[e+116>>2],d[t+120>>2]=d[e+120>>2],d[t+124>>2]=d[e+124>>2],d[t+128>>2]=d[e+128>>2],d[t+132>>2]=d[e+132>>2],d[t+136>>2]=d[e+136>>2],d[t+140>>2]=d[e+140>>2],d[t+144>>2]=d[e+144>>2],d[t+148>>2]=d[e+148>>2],d[t+152>>2]=d[e+152>>2],d[t+156>>2]=d[e+156>>2],d[t+160>>2]=d[e+160>>2],d[t+164>>2]=d[e+164>>2],d[t+168>>2]=d[e+168>>2],d[t+172>>2]=d[e+172>>2],d[t+176>>2]=d[e+176>>2],d[t+180>>2]=d[e+188>>2],d[t+184>>2]=d[e+184>>2],d[t+188>>2]=d[e+196>>2],d[t+192>>2]=d[e+192>>2],d[t+196>>2]=u[e+180|0],d[t+200>>2]=u[e+49|0],19516},r[749]=O_,r[750]=function(e){e|=0;var t,i=0,n=0,r=y(0),s=y(0),o=y(0),a=0,l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),A=0,C=y(0),S=y(0),T=y(0),E=y(0);if(O=t=O-176|0,u[e+527|0]){d[e+36>>2]=0,d[e+576>>2]=0,d[e+580>>2]=0,d[e+516>>2]=0,d[e+520>>2]=0,d[e+584>>2]=0,d[e+588>>2]=0;e:if(!u[e+524|0])for(l=m[e+412>>2],i=d[e+32>>2],_=m[e+416>>2],p=m[e+420>>2],C=y(y(y(y(l*m[i+4>>2])+y(_*m[i+8>>2]))+y(p*m[i+12>>2]))+m[i+52>>2]),f=m[e+348>>2],n=d[e+28>>2],o=m[e+352>>2],r=m[e+356>>2],S=y(y(y(y(f*m[n+4>>2])+y(o*m[n+8>>2]))+y(r*m[n+12>>2]))+m[n+52>>2]),g=y(C-S),T=y(y(y(y(l*m[i+20>>2])+y(_*m[i+24>>2]))+y(p*m[i+28>>2]))+m[i+56>>2]),E=y(y(y(y(f*m[n+20>>2])+y(o*m[n+24>>2]))+y(r*m[n+28>>2]))+m[n+56>>2]),s=y(T-E),p=y(y(y(y(l*m[i+36>>2])+y(_*m[i+40>>2]))+y(p*m[i+44>>2]))+m[i+60>>2]),f=y(y(y(y(f*m[n+36>>2])+y(o*m[n+40>>2]))+y(r*m[n+44>>2]))+m[n+60>>2]),o=y(p-f),(r=y(y(y(g*g)+y(s*s))+y(o*o)))>y(1.1920928955078125e-7)?(d[t+140>>2]=0,r=y(y(1)/y(x(r))),c=y(o*r),m[t+136>>2]=c,h=y(s*r),m[t+132>>2]=h,l=y(g*r),m[t+128>>2]=l):(d[t+136>>2]=0,d[t+140>>2]=0,d[t+128>>2]=1065353216,d[t+132>>2]=0,l=y(1)),y(v(c))>y(.7071067690849304)?(r=y(y(c*c)+y(h*h)),_=y(y(1)/y(x(r))),g=y(r*_),s=y(_*y(-c)),o=y(l*s),c=y(h*_),h=y(c*y(-l)),r=y(0)):(r=y(y(l*l)+y(h*h)),s=y(y(1)/y(x(r))),o=y(r*s),r=y(s*y(-h)),h=y(c*r),s=y(l*s),g=y(s*y(-c)),c=y(0)),m[t+168>>2]=o,m[t+164>>2]=h,m[t+152>>2]=c,m[t+148>>2]=s,m[t+160>>2]=g,m[t+144>>2]=r;;){if(a=d[e+28>>2],d[t+80>>2]=d[a+4>>2],d[t+84>>2]=d[a+20>>2],n=d[a+36>>2],d[t+92>>2]=0,d[t+88>>2]=n,d[t+96>>2]=d[a+8>>2],d[t+100>>2]=d[a+24>>2],n=d[a+40>>2],d[t+108>>2]=0,d[t+104>>2]=n,d[t+112>>2]=d[a+12>>2],d[t+116>>2]=d[a+28>>2],n=d[a+44>>2],d[t+124>>2]=0,d[t+120>>2]=n,d[t+32>>2]=d[i+4>>2],d[t+36>>2]=d[i+20>>2],n=d[i+36>>2],d[t+44>>2]=0,d[t+40>>2]=n,d[t+48>>2]=d[i+8>>2],d[t+52>>2]=d[i+24>>2],n=d[i+40>>2],d[t+60>>2]=0,d[t+56>>2]=n,d[t+64>>2]=d[i+12>>2],d[t+68>>2]=d[i+28>>2],n=d[i+44>>2],d[t+76>>2]=0,d[t+72>>2]=n,s=m[a+52>>2],o=m[a+56>>2],r=m[a+60>>2],d[t+28>>2]=0,m[t+24>>2]=f-r,m[t+20>>2]=E-o,m[t+16>>2]=S-s,s=m[i+52>>2],o=m[i+56>>2],r=m[i+60>>2],d[t+12>>2]=0,m[t+8>>2]=p-r,m[t+4>>2]=T-o,m[t>>2]=C-s,ai(48+(b(A,84)+e|0)|0,t+80|0,t+32|0,t+16|0,t,(t+128|0)+(A<<4)|0,a+396|0,m[a+344>>2],i+396|0,m[i+344>>2]),3==(0|(A=A+1|0)))break e;i=d[e+32>>2]}k(i=e,(n=d[e+28>>2])+4|0,(e=d[e+32>>2])+4|0,n+264|0,e+264|0)}O=t+176|0},r[751]=function(e,t){e|=0,t|=0;var i=0,n=0,r=y(0);if(u[e+527|0])return d[t>>2]=0,void(d[t+4>>2]=0);d[t>>2]=3,d[t+4>>2]=3,k(e,(i=d[e+28>>2])+4|0,(n=d[e+32>>2])+4|0,i+264|0,n+264|0),u[e+526|0]&&(i=d[t>>2],d[t>>2]=i+1,n=d[t+4>>2],d[t+4>>2]=n+-1,r=m[e+456>>2],m[e+444>>2]>2]>2]=n+-2,d[t>>2]=i+2)),u[e+525|0]&&(d[t>>2]=d[t>>2]+1,d[t+4>>2]=d[t+4>>2]+-1)},r[752]=function(e,t){!function(e,t,i,n,r,s){var o,a,l,c,h=y(0),_=y(0),p=y(0),f=y(0),g=0,v=y(0),A=0,C=y(0),S=0,x=y(0),T=y(0),E=y(0),R=y(0),P=0,I=0,M=0,D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),V=y(0);if(O=a=O-16|0,k(e,i,n,r,s),r=d[t+8>>2],d[r>>2]=1065353216,l=d[t+24>>2],d[(s=4+(A=l<<2)|0)+r>>2]=1065353216,d[r+(r=8+(S=l<<3)|0)>>2]=1065353216,w=m[i+20>>2],D=m[i+24>>2],T=m[e+348>>2],x=m[i+36>>2],E=m[e+352>>2],f=m[i+40>>2],R=m[e+356>>2],_=m[i+8>>2],v=m[i>>2],C=m[i+4>>2],p=m[i+16>>2],h=m[i+32>>2],d[a+12>>2]=0,f=y(y(y(T*h)+y(E*x))+y(R*f)),m[a+8>>2]=f,p=y(y(y(T*p)+y(E*w))+y(R*D)),m[a+4>>2]=p,h=y(y(y(v*T)+y(C*E))+y(_*R)),m[a>>2]=h,c=d[t+12>>2],d[c+12>>2]=0,m[c+8>>2]=-p,m[c+4>>2]=f,d[c>>2]=0,d[12+(g=c+A|0)>>2]=0,m[g+8>>2]=h,d[g+4>>2]=0,m[g>>2]=-f,d[8+(g=c+S|0)>>2]=0,d[g+12>>2]=0,m[g+4>>2]=-h,m[g>>2]=p,g=d[t+16>>2],d[g>>2]=-1082130432,d[s+g>>2]=-1082130432,d[r+g>>2]=-1082130432,w=m[n+36>>2],D=m[n+40>>2],T=m[e+412>>2],x=m[n+20>>2],E=m[e+416>>2],f=m[n+24>>2],R=m[e+420>>2],_=m[n+8>>2],v=m[n>>2],C=m[n+4>>2],p=m[n+32>>2],h=m[n+16>>2],o=d[t+20>>2],d[o+12>>2]=0,d[o>>2]=0,x=y(y(y(T*h)+y(E*x))+y(R*f)),m[o+8>>2]=x,f=y(y(y(T*p)+y(E*w))+y(R*D)),m[o+4>>2]=-f,d[12+(r=o+A|0)>>2]=0,p=y(y(y(v*T)+y(C*E))+y(_*R)),m[r+8>>2]=-p,d[r+4>>2]=0,m[r>>2]=f,d[8+(r=o+S|0)>>2]=0,d[r+12>>2]=0,m[r+4>>2]=p,m[r>>2]=-x,I=d[t+40>>2],P=d[t+36>>2],M=d[t+28>>2],g=d[e+592>>2],h=y(m[(2&g?e+600|0:t+4|0)>>2]*m[t>>2]),m[M>>2]=h*y(y(y(p+m[n+48>>2])-m[a>>2])-m[i+48>>2]),d[P>>2]=-8388609,d[I>>2]=2139095039,(s=1&g)&&(d[d[t+32>>2]>>2]=d[e+596>>2]),m[A+M>>2]=h*y(y(y(x+m[n+52>>2])-m[a+4>>2])-m[i+52>>2]),d[A+P>>2]=-8388609,d[A+I>>2]=2139095039,s&&(d[d[t+32>>2]+(l<<2)>>2]=d[e+596>>2]),m[(r=l<<3)+M>>2]=h*y(y(y(f+m[n+56>>2])-m[a+8>>2])-m[i+56>>2]),d[r+P>>2]=-8388609,d[r+I>>2]=2139095039,s&&(d[d[t+32>>2]+(l<<3)>>2]=d[e+596>>2]),n=r=b(l,3),u[e+526|0]&&(h=m[e+456>>2],m[e+444>>2]>2]>2],h=m[e+468>>2],r<<=2,_=m[e+436>>2],C=y(_*y(_*m[e+460>>2])),m[r+c>>2]=C,n=r+8|0,p=y(_*y(_*h)),m[n+c>>2]=p,i=r+4|0,h=y(_*y(_*v)),m[i+c>>2]=h,m[n+o>>2]=-p,m[i+o>>2]=-h,m[r+o>>2]=-C,m[r+M>>2]=y(m[t>>2]*m[e+432>>2])*m[e+504>>2],4&g&&(d[r+d[t+32>>2]>>2]=d[e+604>>2]),d[r+P>>2]=0,d[r+I>>2]=2139095039,n=l<<2):(F=m[e+340>>2],B=m[e+308>>2],N=m[e+324>>2],L=m[i+8>>2],V=m[i>>2],T=m[i+4>>2],E=m[i+24>>2],R=m[i+16>>2],w=m[i+20>>2],s=8+(A=r<<2)|0,f=m[e+304>>2],C=m[i+32>>2],_=m[e+320>>2],p=m[i+36>>2],v=m[e+336>>2],h=m[i+40>>2],D=y(y(y(f*C)+y(_*p))+y(v*h)),m[s+c>>2]=D,r=A+4|0,x=y(y(y(f*R)+y(_*w))+y(v*E)),m[r+c>>2]=x,f=y(y(y(V*f)+y(T*_))+y(L*v)),m[c+A>>2]=f,S=l<<4,_=y(y(y(V*B)+y(T*N))+y(L*F)),m[S+c>>2]=_,n=4|S,v=y(y(y(B*R)+y(N*w))+y(F*E)),m[n+c>>2]=v,i=8|S,p=y(y(y(B*C)+y(N*p))+y(F*h)),m[i+c>>2]=p,m[s+o>>2]=-D,m[r+o>>2]=-x,m[o+A>>2]=-f,m[o+S>>2]=-_,m[n+o>>2]=-v,m[i+o>>2]=-p,M=d[t+28>>2],h=y(m[t>>2]*m[e+436>>2]),m[A+M>>2]=h*y(y(y(f*m[e+460>>2])+y(x*m[e+464>>2]))+y(D*m[e+468>>2])),m[S+M>>2]=h*y(y(y(_*m[e+460>>2])+y(v*m[e+464>>2]))+y(p*m[e+468>>2])),P=d[t+36>>2],d[A+P>>2]=-8388609,I=d[t+40>>2],d[A+I>>2]=2139095039,d[S+P>>2]=-8388609,d[S+I>>2]=2139095039,n=b(l,5))),u[e+525|0]){v=m[e+480>>2],h=m[e+484>>2],s=n<<2,_=m[e+436>>2],C=y(_*y(_*m[e+476>>2])),m[s+c>>2]=C,r=s+8|0,p=y(_*y(_*h)),m[r+c>>2]=p,i=s+4|0,h=y(_*y(_*v)),m[i+c>>2]=h,m[r+o>>2]=-p,m[i+o>>2]=-h,m[s+o>>2]=-C,m[s+M>>2]=y(m[t>>2]*m[e+432>>2])*m[e+508>>2],4&g&&(d[s+d[t+32>>2]>>2]=d[e+604>>2]),t=(n<<2)+I|0;e:{t:{if(m[e+452>>2]>y(0)){if(i=(n<<2)+P|0,m[e+508>>2]>y(0)){d[i>>2]=0;break t}d[i>>2]=-8388609,h=y(0);break e}d[(n<<2)+P>>2]=-8388609}h=y(34028234663852886e22)}m[t>>2]=h}O=a+16|0}(e|=0,t|=0,(t=d[e+28>>2])+4|0,(e=d[e+32>>2])+4|0,t+264|0,e+264|0)},r[753]=function(e,t,i,n){e|=0,t|=0,i|=0,n=y(n);var r,s=y(0),o=y(0),a=y(0),l=y(0),c=0,h=y(0),_=0,p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=0,I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=0,se=0,oe=0,ae=y(0),le=y(0),ce=y(0);if(O=r=O-464|0,u[e+527|0]){if(c=d[e+32>>2],_=d[e+28>>2],!u[e+524|0])for(s=m[e+348>>2],o=m[e+352>>2],a=m[e+356>>2],l=m[_+56>>2],v=y(y(y(y(s*m[_+20>>2])+y(o*m[_+24>>2]))+y(a*m[_+28>>2]))+l),h=y(v-l),A=y(m[t+192>>2]+m[t+80>>2]),l=m[_+52>>2],E=y(y(y(y(s*m[_+4>>2])+y(o*m[_+8>>2]))+y(a*m[_+12>>2]))+l),f=y(E-l),R=y(m[t+196>>2]+m[t+84>>2]),l=m[e+412>>2],C=m[e+416>>2],p=m[e+420>>2],g=m[c+56>>2],I=y(y(y(y(l*m[c+20>>2])+y(C*m[c+24>>2]))+y(p*m[c+28>>2]))+g),g=y(I-g),D=y(m[i+192>>2]+m[i+80>>2]),S=m[c+52>>2],M=y(y(y(y(l*m[c+4>>2])+y(C*m[c+8>>2]))+y(p*m[c+12>>2]))+S),S=y(M-S),F=y(m[i+196>>2]+m[i+84>>2]),B=y(y(y(m[t+184>>2]+m[t+72>>2])+y(y(h*A)-y(f*R)))-y(y(m[i+184>>2]+m[i+72>>2])+y(y(g*D)-y(S*F)))),N=y(m[t+200>>2]+m[t+88>>2]),a=y(y(y(s*m[_+36>>2])+y(o*m[_+40>>2]))+y(a*m[_+44>>2])),s=m[_+60>>2],o=y(a+s),T=y(o-s),s=y(m[i+200>>2]+m[i+88>>2]),a=m[c+60>>2],l=y(y(y(y(l*m[c+36>>2])+y(C*m[c+40>>2]))+y(p*m[c+44>>2]))+a),C=y(l-a),D=y(y(y(m[t+180>>2]+m[t+68>>2])+y(y(f*N)-y(T*A)))-y(y(m[i+180>>2]+m[i+68>>2])+y(y(S*s)-y(C*D)))),R=y(y(y(m[t+176>>2]+m[t+64>>2])+y(y(T*R)-y(h*N)))-y(y(m[i+176>>2]+m[i+64>>2])+y(y(C*F)-y(g*s)))),F=y(o-l),I=y(v-I),E=y(E-M),se=d[i+240>>2],oe=d[t+240>>2];P=b(re,84)+e|0,s=y(y(1)/m[P+128>>2]),o=m[P+48>>2],a=m[P+52>>2],l=m[P+56>>2],s=y(y(s*y(y(y(y(y(E*o)+y(I*a))+y(F*l))*y(-.30000001192092896))/n))-y(s*y(y(y(R*o)+y(D*a))+y(B*l)))),m[e+36>>2]=m[e+36>>2]+s,o=m[P+48>>2],a=m[P+52>>2],l=m[P+56>>2],oe&&(M=m[_+304>>2],N=m[_+296>>2],L=m[_+300>>2],k=m[_+288>>2],j=m[_+280>>2],w=m[_+284>>2],A=m[_+272>>2],v=m[_+264>>2],U=m[_+268>>2],p=m[_+344>>2],m[t+64>>2]=y(y(s*y(o*p))*m[t+112>>2])+m[t+64>>2],m[t+68>>2]=y(y(s*y(a*p))*m[t+116>>2])+m[t+68>>2],m[t+72>>2]=y(y(s*y(l*p))*m[t+120>>2])+m[t+72>>2],p=y(y(h*l)-y(T*a)),V=y(v*p),v=y(y(T*o)-y(f*l)),G=A,A=y(y(f*a)-y(h*o)),m[t+80>>2]=y(y(y(V+y(U*v))+y(G*A))*y(s*m[t+96>>2]))+m[t+80>>2],U=m[t+104>>2],m[t+84>>2]=y(y(y(y(p*j)+y(v*w))+y(A*k))*y(s*m[t+100>>2]))+m[t+84>>2],m[t+88>>2]=y(y(y(y(p*N)+y(v*L))+y(A*M))*y(s*U))+m[t+88>>2]),se&&(v=m[c+304>>2],A=m[c+296>>2],M=m[c+300>>2],N=m[c+288>>2],L=m[c+280>>2],k=m[c+284>>2],j=m[c+272>>2],w=m[c+264>>2],U=m[c+268>>2],ee=m[P+56>>2],J=m[P+52>>2],p=m[c+344>>2],s=y(-s),m[i+64>>2]=y(m[i+112>>2]*y(y(p*m[P+48>>2])*s))+m[i+64>>2],m[i+68>>2]=y(y(y(p*J)*s)*m[i+116>>2])+m[i+68>>2],m[i+72>>2]=y(y(y(p*ee)*s)*m[i+120>>2])+m[i+72>>2],p=y(y(g*l)-y(C*a)),l=y(y(C*o)-y(S*l)),o=y(y(S*a)-y(g*o)),m[i+80>>2]=y(y(y(y(w*p)+y(U*l))+y(j*o))*y(m[i+96>>2]*s))+m[i+80>>2],a=m[i+104>>2],m[i+84>>2]=y(y(y(y(p*L)+y(l*k))+y(o*N))*y(m[i+100>>2]*s))+m[i+84>>2],m[i+88>>2]=y(y(y(y(p*A)+y(l*M))+y(o*v))*y(a*s))+m[i+88>>2]),3!=(0|(re=re+1|0)););e:if(u[e+552|0]){if(P=d[_+16>>2],d[r+384>>2]=d[_+12>>2],d[r+388>>2]=P,P=d[_+8>>2],d[r+376>>2]=d[_+4>>2],d[r+380>>2]=P,P=d[_+32>>2],d[r+400>>2]=d[_+28>>2],d[r+404>>2]=P,P=d[_+24>>2],d[r+392>>2]=d[_+20>>2],d[r+396>>2]=P,P=d[_+48>>2],d[r+416>>2]=d[_+44>>2],d[r+420>>2]=P,P=d[_+40>>2],d[r+408>>2]=d[_+36>>2],d[r+412>>2]=P,P=d[_+64>>2],d[r+432>>2]=d[_+60>>2],d[r+436>>2]=P,P=d[_+56>>2],d[r+424>>2]=d[_+52>>2],d[r+428>>2]=P,_=d[c+16>>2],d[r+320>>2]=d[c+12>>2],d[r+324>>2]=_,_=d[c+8>>2],d[r+312>>2]=d[c+4>>2],d[r+316>>2]=_,_=d[c+32>>2],d[r+336>>2]=d[c+28>>2],d[r+340>>2]=_,_=d[c+24>>2],d[r+328>>2]=d[c+20>>2],d[r+332>>2]=_,_=d[c+48>>2],d[r+352>>2]=d[c+44>>2],d[r+356>>2]=_,_=d[c+40>>2],d[r+344>>2]=d[c+36>>2],d[r+348>>2]=_,_=d[c+64>>2],d[r+368>>2]=d[c+60>>2],d[r+372>>2]=_,_=d[c+56>>2],d[r+360>>2]=d[c+52>>2],d[r+364>>2]=_,s=m[t+84>>2],o=m[t+196>>2],a=m[t+88>>2],l=m[t+200>>2],h=m[t+80>>2],f=m[t+192>>2],d[r+308>>2]=0,m[r+304>>2]=l+a,m[r+300>>2]=o+s,m[r+296>>2]=f+h,s=m[i+84>>2],o=m[i+196>>2],a=m[i+88>>2],l=m[i+200>>2],h=m[i+80>>2],f=m[i+192>>2],d[r+292>>2]=0,m[r+288>>2]=l+a,m[r+284>>2]=o+s,m[r+280>>2]=f+h,d[r+228>>2]=0,d[r+232>>2]=0,d[r+240>>2]=0,d[r+244>>2]=0,d[r+236>>2]=1065353216,d[r+260>>2]=0,d[r+264>>2]=0,d[r+256>>2]=1065353216,d[r+268>>2]=0,d[r+272>>2]=0,d[r+276>>2]=0,d[r+220>>2]=0,d[r+224>>2]=0,d[r+216>>2]=1065353216,d[r+248>>2]=0,d[r+252>>2]=0,d[r+208>>2]=0,d[r+212>>2]=0,d[r+200>>2]=0,d[r+204>>2]=0,mi(r+376|0,r+200|0,r+296|0,n,r+216|0),d[r+148>>2]=0,d[r+152>>2]=0,d[r+160>>2]=0,d[r+164>>2]=0,d[r+156>>2]=1065353216,d[r+180>>2]=0,d[r+184>>2]=0,d[r+176>>2]=1065353216,d[r+188>>2]=0,d[r+192>>2]=0,d[r+196>>2]=0,d[r+140>>2]=0,d[r+144>>2]=0,d[r+136>>2]=1065353216,d[r+168>>2]=0,d[r+172>>2]=0,mi(r+312|0,r+200|0,r+280|0,n,r+136|0),T=m[e+308>>2],v=m[e+304>>2],l=m[e+324>>2],f=m[e+316>>2],C=m[e+320>>2],p=m[e+404>>2],A=m[e+400>>2],E=m[e+396>>2],R=m[e+372>>2],I=m[e+368>>2],D=m[e+340>>2],M=m[e+332>>2],F=m[e+336>>2],B=m[e+388>>2],N=m[e+384>>2],L=m[e+380>>2],o=m[e+568>>2],h=m[e+564>>2],a=m[e+560>>2],ae=m[e+420>>2],G=m[e+412>>2],le=m[e+416>>2],k=m[e+300>>2],U=m[e+356>>2],ce=m[e+352>>2],ee=m[e+348>>2],j=m[e+364>>2],s=m[e+556>>2],d[r+132>>2]=0,d[r+116>>2]=0,d[r+100>>2]=0,S=y(y(2)/y(y(y(y(s*s)+y(a*a))+y(h*h))+y(o*o))),g=y(h*S),X=y(s*g),w=y(a*S),Y=y(o*w),V=y(X-Y),Q=y(s*w),q=y(o*g),W=y(Q+q),K=y(a*w),w=y(h*g),h=y(y(1)-y(K+w)),J=y(y(R*V)+y(y(I*W)+y(j*h))),Z=y(a*g),a=o,o=y(s*S),$=y(a*o),a=y(Z+$),g=y(Q-q),s=y(s*o),S=y(y(1)-y(s+w)),Q=y(y(R*a)+y(y(j*g)+y(I*S))),w=y(X+Y),z=y(Z-$),H=y(y(1)-y(s+K)),X=y(y(y(j*w)+y(I*z))+y(R*H)),s=y(y(y(M*J)+y(F*Q))+y(D*X)),Y=m[r+168>>2],q=y(y(V*B)+y(y(N*W)+y(L*h))),K=y(y(a*B)+y(y(L*g)+y(N*S))),Z=y(y(y(L*w)+y(N*z))+y(B*H)),o=y(y(y(M*q)+y(F*K))+y(D*Z)),$=m[r+172>>2],V=y(y(y(h*E)+y(W*A))+y(V*p)),W=y(y(y(g*E)+y(S*A))+y(a*p)),z=y(y(y(w*E)+y(z*A))+y(H*p)),a=y(y(y(M*V)+y(F*W))+y(D*z)),H=m[r+176>>2],m[r+112>>2]=y(y(s*Y)+y(o*$))+y(a*H),g=y(y(y(J*f)+y(Q*C))+y(X*l)),S=y(y(y(q*f)+y(K*C))+y(Z*l)),h=y(y(y(V*f)+y(W*C))+y(z*l)),m[r+108>>2]=y(y(Y*g)+y($*S))+y(H*h),te=m[r+152>>2],ie=m[r+156>>2],ne=m[r+160>>2],m[r+96>>2]=y(y(s*te)+y(o*ie))+y(a*ne),m[r+92>>2]=y(y(g*te)+y(S*ie))+y(h*ne),w=y(0),R=y(G+y(y(y(j*y(0))+y(I*y(0)))+y(R*y(0)))),G=l,l=y(-ce),I=y(y(y(G*l)-y(T*ee))-y(D*U)),f=y(y(y(f*l)-y(k*ee))-y(M*U)),l=y(y(y(C*l)-y(v*ee))-y(F*U)),C=y(R+y(y(X*I)+y(y(J*f)+y(Q*l)))),R=y(y(le+y(y(y(L*y(0))+y(N*y(0)))+y(B*y(0))))+y(y(Z*I)+y(y(q*f)+y(K*l)))),p=y(y(ae+y(y(y(E*y(0))+y(A*y(0)))+y(p*y(0))))+y(y(z*I)+y(y(V*f)+y(W*l)))),N=y(y(y(y(Y*C)+y($*R))+y(H*p))+m[r+192>>2]),m[r+128>>2]=N,L=y(y(y(y(te*C)+y(R*ie))+y(p*ne))+m[r+188>>2]),m[r+124>>2]=L,d[r+84>>2]=0,f=y(y(y(J*k)+y(Q*v))+y(X*T)),l=y(y(y(q*k)+y(K*v))+y(Z*T)),T=y(y(y(V*k)+y(W*v))+y(z*T)),m[r+104>>2]=y(y(Y*f)+y($*l))+y(H*T),m[r+88>>2]=y(y(f*te)+y(l*ie))+y(T*ne),v=m[r+136>>2],A=m[r+140>>2],E=m[r+144>>2],m[r+80>>2]=y(y(s*v)+y(o*A))+y(a*E),m[r+76>>2]=y(y(g*v)+y(S*A))+y(h*E),m[r+72>>2]=y(y(f*v)+y(l*A))+y(T*E),k=y(y(y(E*p)+y(y(v*C)+y(A*R)))+m[r+184>>2]),m[r+120>>2]=k,d[r+68>>2]=0,d[r+52>>2]=0,d[r+36>>2]=0,v=m[r+248>>2],A=m[r+252>>2],E=m[r+256>>2],m[r+48>>2]=y(y(T*v)+y(h*A))+y(a*E),m[r+44>>2]=y(y(l*v)+y(S*A))+y(o*E),I=m[r+232>>2],D=m[r+236>>2],M=m[r+240>>2],m[r+32>>2]=y(y(T*I)+y(h*D))+y(a*M),m[r+28>>2]=y(y(l*I)+y(S*D))+y(o*M),R=y(-R),F=y(y(y(l*R)-y(f*C))-y(T*p)),B=y(y(y(S*R)-y(g*C))-y(h*p)),C=y(y(y(o*R)-y(s*C))-y(a*p)),p=y(y(y(y(v*F)+y(A*B))+y(E*C))+m[r+272>>2]),m[r- -64>>2]=p,R=y(y(y(y(F*I)+y(B*D))+y(C*M))+m[r+268>>2]),m[r+60>>2]=R,d[r+20>>2]=0,m[r+40>>2]=y(y(f*v)+y(g*A))+y(s*E),m[r+24>>2]=y(y(f*I)+y(g*D))+y(s*M),A=T,T=m[r+216>>2],G=h,h=m[r+220>>2],M=a,a=m[r+224>>2],m[r+16>>2]=y(y(A*T)+y(G*h))+y(M*a),m[r+12>>2]=y(y(l*T)+y(S*h))+y(o*a),m[r+8>>2]=y(y(f*T)+y(g*h))+y(s*a),o=y(y(y(y(F*T)+y(B*h))+y(C*a))+m[r+264>>2]),m[r+56>>2]=o,d[r+212>>2]=0,s=y(y(1)/n),m[r+208>>2]=s*y(N-m[r+432>>2]),m[r+200>>2]=s*y(k-m[r+424>>2]),m[r+204>>2]=s*y(L-m[r+428>>2]),kt(r+376|0,r+72|0,r+448|0,r+444|0),d[r+212>>2]=0,m[r+208>>2]=s*y(p-m[r+368>>2]),m[r+204>>2]=s*y(R-m[r+364>>2]),m[r+200>>2]=s*y(o-m[r+360>>2]),g=m[r+452>>2],o=m[r+444>>2],A=m[r+456>>2],p=m[r+448>>2],kt(r+312|0,r+8|0,r+448|0,r+444|0),a=m[r+444>>2],S=y(y(s*y(a*m[r+456>>2]))-m[r+288>>2]),T=y(y(s*y(a*m[r+452>>2]))-m[r+284>>2]),C=y(y(s*y(m[r+448>>2]*a))-m[r+280>>2]),a=y(0),p=y(y(s*y(p*o))-m[r+296>>2]),v=y(y(s*y(o*g))-m[r+300>>2]),A=y(y(s*y(o*A))-m[r+304>>2]),(s=y(y(y(p*p)+y(v*v))+y(A*A)))>y(1.1920928955078125e-7)&&(s=y(y(1)/y(x(s))),f=y(p*s),c=d[e+28>>2],l=y(v*s),h=y(A*s),a=y(y(y(f*y(y(y(f*m[c+264>>2])+y(l*m[c+280>>2]))+y(h*m[c+296>>2])))+y(l*y(y(y(f*m[c+268>>2])+y(l*m[c+284>>2]))+y(h*m[c+300>>2]))))+y(h*y(y(y(f*m[c+272>>2])+y(l*m[c+288>>2]))+y(h*m[c+304>>2]))))),(E=y(y(y(C*C)+y(T*T))+y(S*S)))>y(1.1920928955078125e-7)&&(g=y(y(1)/y(x(E))),s=y(C*g),c=d[e+32>>2],o=y(T*g),g=y(S*g),w=y(y(y(s*y(y(y(s*m[c+264>>2])+y(o*m[c+280>>2]))+y(g*m[c+296>>2])))+y(o*y(y(y(s*m[c+268>>2])+y(o*m[c+284>>2]))+y(g*m[c+300>>2]))))+y(g*y(y(y(s*m[c+272>>2])+y(o*m[c+288>>2]))+y(g*m[c+304>>2]))))),s=y(y(a*f)+y(w*s)),o=y(y(a*l)+y(w*o)),a=y(y(a*h)+y(w*g)),!((l=y(y(y(s*s)+y(o*o))+y(a*a)))>y(1.1920928955078125e-7)))break e;if(l=y(y(1)/y(x(l))),s=y(s*l),c=d[e+28>>2],o=y(o*l),a=y(a*l),f=y(y(y(s*y(y(y(s*m[c+264>>2])+y(o*m[c+280>>2]))+y(a*m[c+296>>2])))+y(o*y(y(y(s*m[c+268>>2])+y(o*m[c+284>>2]))+y(a*m[c+300>>2]))))+y(a*y(y(y(s*m[c+272>>2])+y(o*m[c+288>>2]))+y(a*m[c+304>>2])))),_=d[e+32>>2],o=y(y(y(s*y(y(y(s*m[_+264>>2])+y(o*m[_+280>>2]))+y(a*m[_+296>>2])))+y(o*y(y(y(s*m[_+268>>2])+y(o*m[_+284>>2]))+y(a*m[_+300>>2]))))+y(a*y(y(y(s*m[_+272>>2])+y(o*m[_+288>>2]))+y(a*m[_+304>>2])))),s=y(f+o),l=y(y(1)/y(s*s)),s=y(y(y(A*f)-y(S*o))*l),a=y(y(y(v*f)-y(T*o))*l),o=y(y(y(p*f)-y(C*o))*l),(S=m[e+572>>2])>=y(0)&&(T=m[e+576>>2],h=y(o+T),C=m[e+580>>2],g=y(a+C),p=m[e+584>>2],l=y(s+p),(v=y(x(y(y(y(h*h)+y(g*g))+y(l*l)))))>(f=u[e+553|0]?y(S/f):S)&&(o=y(y(1)/v),s=y(y(f*y(l*o))-p),l=y(p+s),a=y(y(f*y(g*o))-C),g=y(C+a),o=y(y(f*y(h*o))-T),h=y(T+o)),m[e+584>>2]=l,m[e+580>>2]=g,m[e+576>>2]=h),l=s,s=y(x(y(y(y(o*o)+y(a*a))+y(s*s)))),h=y(y(1)/s),l=y(l*h),a=y(a*h),o=y(o*h),d[t+240>>2]&&(f=m[c+304>>2],g=m[c+296>>2],S=m[c+300>>2],T=m[c+288>>2],C=m[c+280>>2],p=m[c+284>>2],v=m[c+272>>2],A=m[c+264>>2],E=m[c+268>>2],h=y(s*y(0)),m[t+64>>2]=y(h*m[t+112>>2])+m[t+64>>2],m[t+68>>2]=y(h*m[t+116>>2])+m[t+68>>2],m[t+72>>2]=y(h*m[t+120>>2])+m[t+72>>2],m[t+80>>2]=y(y(y(y(o*A)+y(a*E))+y(l*v))*y(s*m[t+96>>2]))+m[t+80>>2],h=m[t+104>>2],m[t+84>>2]=y(y(y(y(o*C)+y(a*p))+y(l*T))*y(s*m[t+100>>2]))+m[t+84>>2],m[t+88>>2]=y(y(y(y(o*g)+y(a*S))+y(l*f))*y(s*h))+m[t+88>>2]),!d[i+240>>2])break e;f=m[_+304>>2],g=m[_+296>>2],S=m[_+300>>2],T=m[_+288>>2],C=m[_+280>>2],p=m[_+284>>2],v=m[_+272>>2],A=m[_+264>>2],E=m[_+268>>2],h=y(s*y(-0)),m[i+64>>2]=y(h*m[i+112>>2])+m[i+64>>2],m[i+68>>2]=y(h*m[i+116>>2])+m[i+68>>2],m[i+72>>2]=y(h*m[i+120>>2])+m[i+72>>2],s=y(-s),m[i+80>>2]=y(y(y(y(o*A)+y(a*E))+y(l*v))*y(m[i+96>>2]*s))+m[i+80>>2],h=m[i+104>>2],m[i+84>>2]=y(y(y(y(o*C)+y(a*p))+y(l*T))*y(m[i+100>>2]*s))+m[i+84>>2],m[i+88>>2]=y(y(y(y(o*g)+y(a*S))+y(l*f))*y(h*s))+m[i+88>>2]}else(s=m[e+440>>2])>y(1.1920928955078125e-7)&&(g=m[t+80>>2],l=y(y(m[i+192>>2]+m[i+80>>2])-y(m[t+192>>2]+g)),S=m[t+84>>2],h=y(y(m[i+196>>2]+m[i+84>>2])-y(m[t+196>>2]+S)),T=m[t+88>>2],a=y(y(m[i+200>>2]+m[i+88>>2])-y(m[t+200>>2]+T)),(o=y(y(y(l*l)+y(h*h))+y(a*a)))>y(1.1920928955078125e-7)&&(G=a,M=s,f=y(y(1)/y(x(o))),s=y(l*f),C=m[_+264>>2],o=y(h*f),p=m[_+280>>2],a=y(a*f),f=m[_+296>>2],v=m[_+268>>2],A=m[_+284>>2],E=m[_+300>>2],R=m[_+272>>2],I=m[_+288>>2],D=m[_+304>>2],s=y(M*y(y(1)/y(y(y(y(s*y(y(y(s*C)+y(o*p))+y(a*f)))+y(o*y(y(y(s*v)+y(o*A))+y(a*E))))+y(a*y(y(y(s*R)+y(o*I))+y(a*D))))+y(y(y(s*y(y(y(s*m[c+264>>2])+y(o*m[c+280>>2]))+y(a*m[c+296>>2])))+y(o*y(y(y(s*m[c+268>>2])+y(o*m[c+284>>2]))+y(a*m[c+300>>2]))))+y(a*y(y(y(s*m[c+272>>2])+y(o*m[c+288>>2]))+y(a*m[c+304>>2]))))))),o=y(G*s),l=y(l*s),a=y(h*s),s=y(x(y(y(o*o)+y(y(l*l)+y(a*a))))),h=y(y(1)/s),o=y(o*h),a=y(a*h),l=y(l*h),d[t+240>>2]&&(h=y(s*y(0)),m[t+64>>2]=y(h*m[t+112>>2])+m[t+64>>2],m[t+68>>2]=y(h*m[t+116>>2])+m[t+68>>2],m[t+72>>2]=y(h*m[t+120>>2])+m[t+72>>2],m[t+88>>2]=T+y(y(y(y(l*f)+y(a*E))+y(o*D))*y(s*m[t+104>>2])),m[t+84>>2]=S+y(y(y(y(l*p)+y(a*A))+y(o*I))*y(s*m[t+100>>2])),m[t+80>>2]=g+y(y(y(y(l*C)+y(a*v))+y(o*R))*y(s*m[t+96>>2]))),d[i+240>>2]&&(f=m[c+304>>2],g=m[c+296>>2],S=m[c+300>>2],T=m[c+288>>2],C=m[c+280>>2],p=m[c+284>>2],v=m[c+272>>2],A=m[c+264>>2],E=m[c+268>>2],h=y(s*y(-0)),m[i+64>>2]=y(h*m[i+112>>2])+m[i+64>>2],m[i+68>>2]=y(h*m[i+116>>2])+m[i+68>>2],m[i+72>>2]=y(h*m[i+120>>2])+m[i+72>>2],s=y(-s),m[i+80>>2]=y(y(y(y(l*A)+y(a*E))+y(o*v))*y(m[i+96>>2]*s))+m[i+80>>2],h=m[i+104>>2],m[i+84>>2]=y(y(y(y(l*C)+y(a*p))+y(o*T))*y(m[i+100>>2]*s))+m[i+84>>2],m[i+88>>2]=y(y(y(y(l*g)+y(a*S))+y(o*f))*y(h*s))+m[i+88>>2])));h=y(m[i+200>>2]+m[i+88>>2]),f=y(m[i+196>>2]+m[i+84>>2]),g=y(m[t+200>>2]+m[t+88>>2]),S=y(m[t+196>>2]+m[t+84>>2]),T=y(m[i+192>>2]+m[i+80>>2]),C=y(m[t+192>>2]+m[t+80>>2]),u[e+526|0]&&(o=m[e+528>>2],s=y(y(y(o*m[e+504>>2])*m[e+432>>2])/n),a=m[e+460>>2],l=m[e+464>>2],p=m[e+468>>2],(v=y(y(y(y(T-C)*a)+y(y(f-S)*l))+y(y(h-g)*p)))>y(0)&&(s=y(s+y(y(o*v)*m[e+436>>2]))),o=m[e+516>>2],s=y(o+y(s*m[e+492>>2])),m[r+376>>2]=s,d[r+312>>2]=0,c=s>y(0)?r+376|0:r+312|0,s=m[c>>2],d[e+516>>2]=d[c>>2],s=y(s-o),o=y(p*s),a=y(a*s),p=m[e+536>>2],l=y(l*s),v=m[e+540>>2],A=m[e+544>>2],s=y(y(y(a*p)+y(l*v))+y(o*A)),o=y(o-y(A*s)),p=y(a-y(p*s)),a=y(l-y(v*s)),s=y(x(y(y(o*o)+y(y(p*p)+y(a*a))))),l=y(y(1)/s),o=y(o*l),a=y(a*l),l=y(p*l),d[t+240>>2]&&(c=d[e+28>>2],v=m[c+304>>2],A=m[c+296>>2],E=m[c+300>>2],R=m[c+288>>2],I=m[c+280>>2],D=m[c+284>>2],M=m[c+272>>2],F=m[c+268>>2],B=m[c+264>>2],p=y(s*y(0)),m[t+64>>2]=y(p*m[t+112>>2])+m[t+64>>2],m[t+68>>2]=y(p*m[t+116>>2])+m[t+68>>2],m[t+72>>2]=y(p*m[t+120>>2])+m[t+72>>2],m[t+80>>2]=y(y(y(y(l*B)+y(a*F))+y(o*M))*y(s*m[t+96>>2]))+m[t+80>>2],p=m[t+104>>2],m[t+84>>2]=y(y(y(y(l*I)+y(a*D))+y(o*R))*y(s*m[t+100>>2]))+m[t+84>>2],m[t+88>>2]=y(y(y(y(l*A)+y(a*E))+y(o*v))*y(s*p))+m[t+88>>2]),d[i+240>>2]&&(c=d[e+32>>2],v=m[c+304>>2],A=m[c+296>>2],E=m[c+300>>2],R=m[c+288>>2],I=m[c+280>>2],D=m[c+284>>2],M=m[c+272>>2],F=m[c+268>>2],B=m[c+264>>2],p=y(s*y(-0)),m[i+64>>2]=y(p*m[i+112>>2])+m[i+64>>2],m[i+68>>2]=y(p*m[i+116>>2])+m[i+68>>2],m[i+72>>2]=y(p*m[i+120>>2])+m[i+72>>2],s=y(-s),m[i+80>>2]=y(y(y(y(l*B)+y(a*F))+y(o*M))*y(m[i+96>>2]*s))+m[i+80>>2],p=m[i+104>>2],m[i+84>>2]=y(y(y(y(l*I)+y(a*D))+y(o*R))*y(m[i+100>>2]*s))+m[i+84>>2],m[i+88>>2]=y(y(y(y(l*A)+y(a*E))+y(o*v))*y(p*s))+m[i+88>>2])),u[e+525|0]&&(l=m[e+532>>2],n=y(y(y(l*m[e+508>>2])*m[e+432>>2])/n),s=m[e+476>>2],a=m[e+480>>2],o=m[e+484>>2],(h=y(y(y(y(T-C)*s)+y(y(f-S)*a))+y(y(h-g)*o)))>y(0)&&(n=y(n+y(y(l*h)*m[e+436>>2]))),l=m[e+520>>2],n=y(l+y(n*m[e+496>>2])),m[r+376>>2]=n,d[r+312>>2]=0,c=n>y(0)?r+376|0:r+312|0,n=m[c>>2],d[e+520>>2]=d[c>>2],n=y(n-l),d[t+240>>2]&&(c=d[e+28>>2],h=m[c+304>>2],f=m[c+296>>2],g=m[c+300>>2],S=m[c+288>>2],T=m[c+280>>2],C=m[c+284>>2],p=m[c+272>>2],v=m[c+268>>2],A=m[c+264>>2],l=y(n*y(0)),m[t+64>>2]=y(l*m[t+112>>2])+m[t+64>>2],m[t+68>>2]=y(l*m[t+116>>2])+m[t+68>>2],m[t+72>>2]=y(l*m[t+120>>2])+m[t+72>>2],m[t+80>>2]=y(y(y(y(s*A)+y(a*v))+y(o*p))*y(n*m[t+96>>2]))+m[t+80>>2],l=m[t+104>>2],m[t+84>>2]=y(y(y(y(s*T)+y(a*C))+y(o*S))*y(n*m[t+100>>2]))+m[t+84>>2],m[t+88>>2]=y(y(y(y(s*f)+y(a*g))+y(o*h))*y(n*l))+m[t+88>>2],o=m[e+484>>2],a=m[e+480>>2],s=m[e+476>>2]),d[i+240>>2]&&(e=d[e+32>>2],h=m[e+304>>2],f=m[e+296>>2],g=m[e+300>>2],S=m[e+288>>2],T=m[e+280>>2],C=m[e+284>>2],p=m[e+272>>2],v=m[e+268>>2],A=m[e+264>>2],l=y(n*y(-0)),m[i+64>>2]=y(l*m[i+112>>2])+m[i+64>>2],m[i+68>>2]=y(l*m[i+116>>2])+m[i+68>>2],m[i+72>>2]=y(l*m[i+120>>2])+m[i+72>>2],n=y(-n),m[i+80>>2]=y(y(y(y(s*A)+y(a*v))+y(o*p))*y(m[i+96>>2]*n))+m[i+80>>2],l=m[i+104>>2],m[i+84>>2]=y(y(y(y(s*T)+y(a*C))+y(o*S))*y(m[i+100>>2]*n))+m[i+84>>2],m[i+88>>2]=y(y(y(y(s*f)+y(a*g))+y(o*h))*y(l*n))+m[i+88>>2]))}O=r+464|0},r[754]=function(e,t,i,n){switch(e|=0,t|=0,i=y(i),n|=0,t+-1|0){case 0:case 1:return n>>>0<=2?(m[e+600>>2]=i,void(d[e+592>>2]=2|d[e+592>>2])):void(m[e+432>>2]=i);case 2:case 3:if(n>>>0<=2)return m[e+596>>2]=i,void(d[e+592>>2]=1|d[e+592>>2]);m[e+604>>2]=i,d[e+592>>2]=4|d[e+592>>2]}},r[755]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0);e:{t:switch(t+-1|0){case 0:case 1:if(i>>>0<=2)return y(m[e+600>>2]);if(i+-3>>>0>2)break e;return y(m[e+432>>2]);case 2:case 3:break t;default:break e}if(i>>>0<=2)return y(m[e+596>>2]);i+-3>>>0>2||(n=m[e+604>>2])}return y(n)},r[756]=function(e){return 212},r[757]=function(e,t,i){return Sn(e|=0,t|=0,i|=0),d[t+52>>2]=d[e+300>>2],d[t+56>>2]=d[e+304>>2],d[t+60>>2]=d[e+308>>2],d[t+64>>2]=d[e+312>>2],d[t+68>>2]=d[e+316>>2],d[t+72>>2]=d[e+320>>2],d[t+76>>2]=d[e+324>>2],d[t+80>>2]=d[e+328>>2],d[t+84>>2]=d[e+332>>2],d[t+88>>2]=d[e+336>>2],d[t+92>>2]=d[e+340>>2],d[t+96>>2]=d[e+344>>2],d[t+100>>2]=d[e+348>>2],d[t+104>>2]=d[e+352>>2],d[t+108>>2]=d[e+356>>2],d[t+112>>2]=d[e+360>>2],d[t+116>>2]=d[e+364>>2],d[t+120>>2]=d[e+368>>2],d[t+124>>2]=d[e+372>>2],d[t+128>>2]=d[e+376>>2],d[t+132>>2]=d[e+380>>2],d[t+136>>2]=d[e+384>>2],d[t+140>>2]=d[e+388>>2],d[t+144>>2]=d[e+392>>2],d[t+148>>2]=d[e+396>>2],d[t+152>>2]=d[e+400>>2],d[t+156>>2]=d[e+404>>2],d[t+160>>2]=d[e+408>>2],d[t+164>>2]=d[e+412>>2],d[t+168>>2]=d[e+416>>2],d[t+172>>2]=d[e+420>>2],d[t+176>>2]=d[e+424>>2],d[t+180>>2]=d[e+444>>2],d[t+184>>2]=d[e+448>>2],d[t+188>>2]=d[e+452>>2],d[t+192>>2]=d[e+428>>2],d[t+196>>2]=d[e+432>>2],d[t+200>>2]=d[e+436>>2],d[t+204>>2]=d[e+440>>2],19632},r[758]=function(e,t,i){e|=0,i|=0;var n=0;n=d[4+(t|=0)>>2],d[e+300>>2]=d[t>>2],d[e+304>>2]=n,n=d[t+12>>2],d[e+308>>2]=d[t+8>>2],d[e+312>>2]=n,n=d[t+28>>2],d[e+324>>2]=d[t+24>>2],d[e+328>>2]=n,n=d[t+20>>2],d[e+316>>2]=d[t+16>>2],d[e+320>>2]=n,n=d[t+44>>2],d[e+340>>2]=d[t+40>>2],d[e+344>>2]=n,n=d[t+36>>2],d[e+332>>2]=d[t+32>>2],d[e+336>>2]=n,n=d[t+60>>2],d[e+356>>2]=d[t+56>>2],d[e+360>>2]=n,n=d[t+52>>2],d[e+348>>2]=d[t+48>>2],d[e+352>>2]=n,t=d[i+12>>2],d[e+372>>2]=d[i+8>>2],d[e+376>>2]=t,t=d[i+4>>2],d[e+364>>2]=d[i>>2],d[e+368>>2]=t,t=d[i+20>>2],d[e+380>>2]=d[i+16>>2],d[e+384>>2]=t,t=d[i+28>>2],d[e+388>>2]=d[i+24>>2],d[e+392>>2]=t,t=d[i+36>>2],d[e+396>>2]=d[i+32>>2],d[e+400>>2]=t,t=d[i+44>>2],d[e+404>>2]=d[i+40>>2],d[e+408>>2]=t,t=d[i+60>>2],d[e+420>>2]=d[i+56>>2],d[e+424>>2]=t,t=d[i+52>>2],d[e+412>>2]=d[i+48>>2],d[e+416>>2]=t,r[d[d[e>>2]+8>>2]](e)},r[759]=O_,r[760]=function(e){e|=0;var t,i=0,n=y(0),r=y(0),s=y(0),o=y(0),a=0,l=y(0),c=y(0),h=y(0),_=y(0),p=0,f=y(0),g=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=0,P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0);if(O=t=O-176|0,u[e+738|0]){d[e+744>>2]=0,d[e+36>>2]=0;e:if(!u[e+736|0])for(P=m[e+664>>2],p=d[e+32>>2],c=m[e+668>>2],l=m[e+672>>2],g=y(y(y(y(P*m[p+4>>2])+y(c*m[p+8>>2]))+y(l*m[p+12>>2]))+m[p+52>>2]),s=m[e+600>>2],i=d[e+28>>2],o=m[e+604>>2],n=m[e+608>>2],A=y(y(y(y(s*m[i+4>>2])+y(o*m[i+8>>2]))+y(n*m[i+12>>2]))+m[i+52>>2]),_=y(g-A),f=y(y(y(y(P*m[p+20>>2])+y(c*m[p+24>>2]))+y(l*m[p+28>>2]))+m[p+56>>2]),h=y(y(y(y(s*m[i+20>>2])+y(o*m[i+24>>2]))+y(n*m[i+28>>2]))+m[i+56>>2]),r=y(f-h),l=y(y(y(y(P*m[p+36>>2])+y(c*m[p+40>>2]))+y(l*m[p+44>>2]))+m[p+60>>2]),s=y(y(y(y(s*m[i+36>>2])+y(o*m[i+40>>2]))+y(n*m[i+44>>2]))+m[i+60>>2]),o=y(l-s),(n=y(y(y(_*_)+y(r*r))+y(o*o)))>y(1.1920928955078125e-7)?(d[t+140>>2]=0,n=y(y(1)/y(x(n))),c=y(o*n),m[t+136>>2]=c,o=y(r*n),m[t+132>>2]=o,n=y(_*n),m[t+128>>2]=n):(d[t+136>>2]=0,d[t+140>>2]=0,d[t+128>>2]=1065353216,d[t+132>>2]=0,n=y(1),o=y(0),c=y(0)),y(v(c))>y(.7071067690849304)?(r=y(y(c*c)+y(o*o)),_=y(y(1)/y(x(r))),S=y(r*_),C=y(_*y(-c)),E=y(n*C),c=y(o*_),o=y(c*y(-n)),r=y(0)):(r=y(y(n*n)+y(o*o)),_=y(y(1)/y(x(r))),E=y(r*_),r=y(_*y(-o)),o=y(c*r),C=y(n*_),S=y(C*y(-c)),c=y(0)),m[t+168>>2]=E,m[t+164>>2]=o,m[t+152>>2]=c,m[t+148>>2]=C,m[t+160>>2]=S,m[t+144>>2]=r;;){if(R=d[e+28>>2],d[t+80>>2]=d[R+4>>2],d[t+84>>2]=d[R+20>>2],i=d[R+36>>2],d[t+92>>2]=0,d[t+88>>2]=i,d[t+96>>2]=d[R+8>>2],d[t+100>>2]=d[R+24>>2],i=d[R+40>>2],d[t+108>>2]=0,d[t+104>>2]=i,d[t+112>>2]=d[R+12>>2],d[t+116>>2]=d[R+28>>2],i=d[R+44>>2],d[t+124>>2]=0,d[t+120>>2]=i,d[t+32>>2]=d[p+4>>2],d[t+36>>2]=d[p+20>>2],i=d[p+36>>2],d[t+44>>2]=0,d[t+40>>2]=i,d[t+48>>2]=d[p+8>>2],d[t+52>>2]=d[p+24>>2],i=d[p+40>>2],d[t+60>>2]=0,d[t+56>>2]=i,d[t+64>>2]=d[p+12>>2],d[t+68>>2]=d[p+28>>2],i=d[p+44>>2],d[t+76>>2]=0,d[t+72>>2]=i,r=m[R+52>>2],o=m[R+56>>2],n=m[R+60>>2],d[t+28>>2]=0,m[t+24>>2]=s-n,m[t+20>>2]=h-o,m[t+16>>2]=A-r,r=m[p+52>>2],o=m[p+56>>2],n=m[p+60>>2],d[t+12>>2]=0,m[t+8>>2]=l-n,m[t+4>>2]=f-o,m[t>>2]=g-r,ai(48+(b(a,84)+e|0)|0,t+80|0,t+32|0,t+16|0,t,(t+128|0)+(a<<4)|0,R+396|0,m[R+344>>2],p+396|0,m[p+344>>2]),3==(0|(a=a+1|0)))break e;p=d[e+32>>2]}o=m[e+576>>2],n=m[e+560>>2],F=m[e+592>>2],y(v(F))>y(.7071067690849304)?(r=y(y(F*F)+y(o*o)),s=y(y(1)/y(x(r))),C=y(r*s),S=y(s*y(-F)),E=y(S*n),I=y(s*o),r=y(I*y(-n))):(r=y(y(n*n)+y(o*o)),s=y(y(1)/y(x(r))),E=y(r*s),S=y(s*n),C=y(S*y(-F)),M=y(s*y(-o)),r=y(F*M)),a=d[e+32>>2],P=m[a+36>>2],c=m[a+20>>2],_=m[a+40>>2],g=m[a+24>>2],A=m[a+8>>2],f=m[a+44>>2],h=m[a+28>>2],l=m[a+12>>2],i=d[e+28>>2],k=m[i+44>>2],V=m[i+36>>2],U=m[i+40>>2],G=m[i+12>>2],j=m[i+8>>2],W=m[i+28>>2],z=m[i+20>>2],H=m[i+24>>2],s=m[a+4>>2],X=m[i+4>>2],d[e+344>>2]=0,d[e+328>>2]=0,d[e+308>>2]=0,d[e+312>>2]=0,d[e+300>>2]=0,d[e+304>>2]=0,D=y(y(y(M*X)+y(S*j))+y(I*G)),T=y(y(y(M*z)+y(S*H))+y(I*W)),w=y(y(y(M*V)+y(S*U))+y(I*k)),B=y(y(y(G*D)+y(W*T))+y(k*w)),m[e+324>>2]=B,S=y(y(y(D*j)+y(T*H))+y(w*U)),m[e+320>>2]=S,M=y(y(y(D*X)+y(T*z))+y(w*V)),m[e+316>>2]=M,N=h,h=y(-T),I=y(y(y(N*h)-y(D*l))-y(w*f)),m[e+340>>2]=I,T=y(y(y(g*h)-y(D*A))-y(w*_)),m[e+336>>2]=T,c=y(y(y(c*h)-y(D*s))-y(w*P)),m[e+332>>2]=c,h=m[i+400>>2],l=m[i+404>>2],s=m[i+396>>2],d[e+360>>2]=0,_=y(B*l),m[e+356>>2]=_,g=y(S*h),m[e+352>>2]=g,A=y(M*s),m[e+348>>2]=A,f=m[a+400>>2],l=m[a+404>>2],s=m[a+396>>2],d[e+376>>2]=0,h=y(I*l),m[e+372>>2]=h,l=y(T*f),m[e+368>>2]=l,s=y(c*s),m[e+364>>2]=s,m[e+380>>2]=y(y(y(M*A)+y(S*g))+y(B*_))+y(y(y(c*s)+y(T*l))+y(I*h)),L=m[i+36>>2],Q=m[i+20>>2],D=m[i+40>>2],w=m[i+8>>2],B=m[i+24>>2],S=m[i+44>>2],M=m[i+12>>2],I=m[i+28>>2],T=m[a+36>>2],P=m[a+20>>2],c=m[a+40>>2],_=m[a+24>>2],g=m[a+8>>2],A=m[a+44>>2],f=m[a+28>>2],h=m[a+12>>2],l=m[i+4>>2],s=m[a+4>>2],d[e+428>>2]=0,d[e+412>>2]=0,d[e+392>>2]=0,d[e+396>>2]=0,d[e+384>>2]=0,d[e+388>>2]=0,N=f,Y=y(y(y(C*z)+y(r*H))+y(E*W)),f=y(-Y),q=h,h=y(y(y(C*X)+y(r*j))+y(E*G)),r=y(y(y(C*V)+y(r*U))+y(E*k)),C=y(y(y(N*f)-y(q*h))-y(A*r)),m[e+424>>2]=C,E=y(y(y(_*f)-y(h*g))-y(r*c)),m[e+420>>2]=E,T=y(y(y(P*f)-y(h*s))-y(r*T)),m[e+416>>2]=T,P=y(y(y(h*M)+y(Y*I))+y(r*S)),m[e+408>>2]=P,c=y(y(y(h*w)+y(Y*B))+y(r*D)),m[e+404>>2]=c,_=y(y(y(h*l)+y(Y*Q))+y(r*L)),m[e+400>>2]=_,l=m[i+400>>2],s=m[i+404>>2],r=m[i+396>>2],d[e+444>>2]=0,g=y(P*s),m[e+440>>2]=g,A=y(c*l),m[e+436>>2]=A,f=y(_*r),m[e+432>>2]=f,h=m[a+400>>2],s=m[a+404>>2],r=m[a+396>>2],d[e+460>>2]=0,l=y(C*s),m[e+456>>2]=l,s=y(E*h),m[e+452>>2]=s,r=y(T*r),m[e+448>>2]=r,m[e+464>>2]=y(y(y(_*f)+y(c*A))+y(P*g))+y(y(y(T*r)+y(E*s))+y(C*l)),Q=m[i+36>>2],D=m[i+20>>2],w=m[i+40>>2],B=m[i+8>>2],S=m[i+24>>2],M=m[i+44>>2],I=m[i+12>>2],T=m[i+28>>2],P=m[a+36>>2],c=m[a+20>>2],_=m[a+40>>2],g=m[a+24>>2],A=m[a+8>>2],f=m[a+44>>2],h=m[a+28>>2],l=m[a+12>>2],s=m[i+4>>2],r=m[a+4>>2],d[e+512>>2]=0,d[e+496>>2]=0,d[e+476>>2]=0,d[e+480>>2]=0,d[e+468>>2]=0,d[e+472>>2]=0,N=h,C=y(y(y(z*n)+y(H*o))+y(F*W)),h=y(-C),q=l,l=y(y(y(X*n)+y(j*o))+y(F*G)),n=y(y(y(V*n)+y(U*o))+y(F*k)),E=y(y(y(N*h)-y(q*l))-y(f*n)),m[e+508>>2]=E,L=y(y(y(g*h)-y(l*A))-y(n*_)),m[e+504>>2]=L,c=y(y(y(c*h)-y(l*r))-y(n*P)),m[e+500>>2]=c,_=y(y(y(l*I)+y(C*T))+y(n*M)),m[e+492>>2]=_,g=y(y(y(l*B)+y(C*S))+y(n*w)),m[e+488>>2]=g,A=y(y(y(l*s)+y(C*D))+y(n*Q)),m[e+484>>2]=A,r=m[i+400>>2],o=m[i+404>>2],n=m[i+396>>2],d[e+528>>2]=0,f=y(_*o),m[e+524>>2]=f,h=y(g*r),m[e+520>>2]=h,l=y(A*n),m[e+516>>2]=l,s=m[a+400>>2],o=m[a+404>>2],n=m[a+396>>2],d[e+724>>2]=0,d[e+544>>2]=0,r=y(E*o),m[e+540>>2]=r,o=y(L*s),m[e+536>>2]=o,n=y(c*n),m[e+532>>2]=n,m[e+548>>2]=y(y(y(A*l)+y(g*h))+y(_*f))+y(y(y(c*n)+y(L*o))+y(E*r)),n=pn(e,i+4|0,a+4|0),m[e+728>>2]=n,Lr(e+688|0,n),a=e,r=m[e+560>>2],i=d[e+28>>2],o=m[e+576>>2],n=m[e+592>>2],l=y(y(y(r*m[i+4>>2])+y(o*m[i+8>>2]))+y(n*m[i+12>>2])),s=y(y(y(r*m[i+20>>2])+y(o*m[i+24>>2]))+y(n*m[i+28>>2])),n=y(y(y(r*m[i+36>>2])+y(o*m[i+40>>2]))+y(n*m[i+44>>2])),e=d[e+32>>2],m[a+720>>2]=y(1)/y(y(y(y(l*y(y(y(l*m[i+264>>2])+y(s*m[i+280>>2]))+y(n*m[i+296>>2])))+y(s*y(y(y(l*m[i+268>>2])+y(s*m[i+284>>2]))+y(n*m[i+300>>2]))))+y(n*y(y(y(l*m[i+272>>2])+y(s*m[i+288>>2]))+y(n*m[i+304>>2]))))+y(y(y(l*y(y(y(l*m[e+264>>2])+y(s*m[e+280>>2]))+y(n*m[e+296>>2])))+y(s*y(y(y(l*m[e+268>>2])+y(s*m[e+284>>2]))+y(n*m[e+300>>2]))))+y(n*y(y(y(l*m[e+272>>2])+y(s*m[e+288>>2]))+y(n*m[e+304>>2])))))}O=t+176|0},r[761]=function(e,t){e|=0,t|=0;var i=y(0);if(u[e+738|0])return d[t>>2]=0,void(d[t+4>>2]=0);d[t>>2]=5,d[t+4>>2]=1,i=pn(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0),m[e+728>>2]=i,Lr(e+688|0,i),(u[e+737|0]||u[e+716|0])&&(d[t>>2]=d[t>>2]+1,d[t+4>>2]=d[t+4>>2]+-1)},r[762]=function(e,t){t|=0;var i,n,r=0,o=0;i=(r=d[32+(e|=0)>>2])+328|0,n=(o=d[e+28>>2])+328|0,r=r+4|0,o=o+4|0,u[e+739|0]?function(e,t,i,n,r,o){var a,l=y(0),c=y(0),h=y(0),_=y(0),p=0,f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=0,P=y(0),I=y(0),M=0,D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=0,k=y(0),V=0,U=0,G=0,j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0),se=y(0),oe=y(0),ae=y(0),le=y(0),ce=y(0),he=y(0),_e=y(0),de=y(0),ue=y(0),pe=y(0),fe=y(0),me=y(0),ge=y(0),be=y(0);O=a=O+-64|0,l=m[e+588>>2],w=m[e+572>>2],F=m[e+556>>2],Q=m[n+56>>2],q=m[n+52>>2],g=m[e+664>>2],v=m[e+668>>2],P=m[e+672>>2],K=m[i+56>>2],Z=m[i+52>>2],I=m[e+600>>2],D=m[e+604>>2],h=m[e+608>>2],$=m[n+36>>2],J=m[n+40>>2],N=m[i+36>>2],j=m[i+40>>2],c=m[e+624>>2],k=m[n+20>>2],f=m[e+640>>2],ee=m[n+24>>2],E=m[e+656>>2],A=m[e+560>>2],W=m[i+20>>2],C=m[e+576>>2],z=m[i+24>>2],S=m[e+592>>2],M=d[t+24>>2],te=m[n+48>>2],ie=m[i+48>>2],ne=m[n+32>>2],H=m[i+32>>2],re=m[n+8>>2],B=m[n>>2],me=m[n+4>>2],X=m[i+8>>2],se=m[i>>2],oe=m[i+4>>2],ge=m[n+16>>2],Y=m[d[e+32>>2]+344>>2],be=m[d[e+28>>2]+344>>2],ae=m[i+16>>2],d[a+60>>2]=0,_=(_=y(be+Y))>y(0)?y(Y/_):y(.5),T=y(y(1)-_),le=y(y(y(A*H)+y(C*N))+y(S*j)),ce=y(y(y(c*ne)+y(f*$))+y(E*J)),he=y(y(le*_)+y(ce*T)),_e=y(y(y(se*A)+y(oe*C))+y(X*S)),de=y(y(y(B*c)+y(me*f))+y(re*E)),ue=y(y(_e*_)+y(de*T)),pe=y(y(y(A*ae)+y(C*W))+y(S*z)),fe=y(y(y(c*ge)+y(f*k))+y(E*ee)),f=y(y(pe*_)+y(fe*T)),E=y(y(1)/y(x(y(y(he*he)+y(y(ue*ue)+y(f*f)))))),c=y(he*E),m[a+56>>2]=c,f=y(f*E),m[a+52>>2]=f,E=y(ue*E),m[a+48>>2]=E,d[a+28>>2]=0,$=y(Q+y(y(y(ne*g)+y($*v))+y(J*P))),C=y($-Q),Q=y(te+y(y(y(B*g)+y(me*v))+y(re*P))),S=y(Q-te),J=y(q+y(y(y(ge*g)+y(k*v))+y(ee*P))),v=y(J-q),P=y(y(C*c)+y(y(S*E)+y(v*f))),A=y(c*P),q=y(K+y(y(y(H*I)+y(N*D))+y(j*h))),g=y(q-K),K=y(ie+y(y(y(se*I)+y(oe*D))+y(X*h))),k=y(K-ie),ee=y(Z+y(y(y(ae*I)+y(W*D))+y(z*h))),h=y(ee-Z),I=y(y(g*c)+y(y(k*E)+y(h*f))),D=y(c*I),C=y(C-A),Z=y(g-D),g=y(y(_*C)+y(T*Z)),m[a+24>>2]=g,te=y(f*P),ie=y(v-te),B=h,h=y(f*I),ne=y(B-h),v=y(y(_*ie)+y(T*ne)),m[a+20>>2]=v,B=S,S=y(E*P),re=y(B-S),B=k,k=y(E*I),B=y(B-k),P=y(y(_*re)+y(T*B)),m[a+16>>2]=P,A=y(D-A),I=y(C-y(T*A)),C=y(h-te),D=y(ie-y(T*C)),S=y(k-S),h=y(re-y(T*S)),A=y(Z+y(_*A)),C=y(ne+y(_*C)),S=y(B+y(_*S)),n=bey(1.1920928955078125e-7)?(l=y(y(1)/y(x(Y))),g=y(g*l),m[a+24>>2]=g,v=y(v*l),m[a+20>>2]=v,l=y(P*l)):(d[a+28>>2]=0,g=y(y(y(F*H)+y(w*N))+y(l*j)),m[a+24>>2]=g,v=y(y(y(F*ae)+y(w*W))+y(l*z)),m[a+20>>2]=v,l=y(y(y(se*F)+y(oe*w))+y(X*l))),m[i+16>>2]=l,d[a+12>>2]=0,w=y(y(E*v)-y(f*l)),m[a+8>>2]=w,F=y(y(c*l)-y(E*g)),m[a+4>>2]=F,P=y(y(f*g)-y(c*v)),m[a>>2]=P,m[a+40>>2]=y(S*v)-y(C*l),m[a+36>>2]=y(A*l)-y(S*g),m[a+32>>2]=y(C*g)-y(A*v),p=d[a+36>>2],i=d[t+12>>2],d[i>>2]=d[a+32>>2],d[i+4>>2]=p,d[i+8>>2]=d[a+40>>2],i=d[t+20>>2],m[i+8>>2]=-y(y(h*v)-y(D*l)),m[i+4>>2]=-y(y(I*l)-y(h*g)),m[i>>2]=-y(y(D*g)-y(I*v)),d[a+44>>2]=0,z=y(y(S*F)-y(C*P)),m[a+40>>2]=z,H=y(y(A*P)-y(S*w)),m[a+36>>2]=H,X=y(y(C*w)-y(A*F)),m[a+32>>2]=X,N=y(y(h*F)-y(D*P)),j=y(y(I*P)-y(h*w)),W=y(y(D*w)-y(I*F)),!n|!u[e+716|0]||(m[a+40>>2]=_*z,m[a+36>>2]=_*H,m[a+32>>2]=_*X,j=y(T*j),W=y(T*W),N=y(T*N)),R=d[a+36>>2],i=(p=M<<2)+d[t+12>>2]|0,d[i>>2]=d[a+32>>2],d[i+4>>2]=R,d[i+8>>2]=d[a+40>>2],i=d[t+20>>2],m[i+p>>2]=-W,m[i+((L=M+1|0)<<2)>>2]=-j,m[i+((V=M+2|0)<<2)>>2]=-N,N=y(y(S*f)-y(C*E)),m[a+40>>2]=N,d[a+44>>2]=0,S=y(y(A*E)-y(S*c)),m[a+36>>2]=S,C=y(y(C*c)-y(A*f)),m[a+32>>2]=C,A=y(y(h*f)-y(D*E)),h=y(y(I*E)-y(h*c)),I=y(y(D*c)-y(I*f)),n&&(m[a+40>>2]=_*N,m[a+36>>2]=_*S,m[a+32>>2]=_*C,A=y(T*A),h=y(T*h),I=y(T*I)),R=d[a+36>>2],i=(p=(n=M<<1)<<2)+d[t+12>>2]|0,d[i>>2]=d[a+32>>2],d[i+4>>2]=R,d[i+8>>2]=d[a+40>>2],i=d[t+20>>2],m[p+i>>2]=-I,m[((U=1|n)<<2)+i>>2]=-h,m[((G=n+2|0)<<2)+i>>2]=-A,u[e+736|0]?(_=y(-w),T=y(-F),I=y(-P),D=y(-l),n=d[t+28>>2]):(h=m[t+4>>2],A=m[t>>2],p=d[a+20>>2],i=d[t+8>>2],d[i>>2]=d[a+16>>2],d[i+4>>2]=p,d[i+8>>2]=d[a+24>>2],R=d[a+4>>2],i=(p=M<<2)+d[t+8>>2]|0,d[i>>2]=d[a>>2],d[i+4>>2]=R,d[i+8>>2]=d[a+8>>2],i=(R=n<<2)+d[t+8>>2]|0,n=d[a+52>>2],d[i>>2]=d[a+48>>2],d[i+4>>2]=n,d[i+8>>2]=d[a+56>>2],i=d[t+16>>2],D=y(-l),m[i>>2]=D,m[i+4>>2]=-v,m[i+8>>2]=-g,I=y(-P),m[i+p>>2]=I,T=y(-F),m[i+(L<<2)>>2]=T,_=y(-w),m[i+(V<<2)>>2]=_,m[i+R>>2]=-E,m[i+(U<<2)>>2]=-f,m[i+(G<<2)>>2]=-c,n=d[t+28>>2],h=y(A*h),A=y(Q-K),C=y(J-ee),S=y($-q),m[n>>2]=h*y(y(y(A*l)+y(C*v))+y(S*g)),m[n+p>>2]=h*y(y(y(A*P)+y(C*F))+y(S*w)),m[n+R>>2]=h*y(y(y(A*E)+y(C*f))+y(S*c)),i=d[t+20>>2]),p=d[t+12>>2],R=b(M,12),m[p+R>>2]=l,m[(L=R+8|0)+p>>2]=g,m[(V=R+4|0)+p>>2]=v,m[(M<<=4)+p>>2]=P,m[(U=4|M)+p>>2]=F,m[(G=8|M)+p>>2]=w,m[i+R>>2]=D,c=m[a+20>>2],m[i+V>>2]=-c,f=m[a+24>>2],m[i+L>>2]=-f,m[i+M>>2]=I,m[i+U>>2]=T,m[i+G>>2]=_,_=y(m[t>>2]*m[t+4>>2]),T=y(y(pe*ce)-y(le*fe)),h=y(T*l),l=y(y(le*de)-y(_e*ce)),h=y(h+y(c*l)),c=y(y(_e*fe)-y(pe*de)),m[n+R>>2]=_*y(h+y(f*c)),m[n+M>>2]=_*y(y(y(T*P)+y(l*F))+y(c*w));e:{if(u[e+716|0])L=(E=y(m[e+708>>2]*m[e+732>>2]))>y(0)?1:2,V=!u[e+737|0],n=1;else{if(!u[e+737|0])break e;E=y(0),V=0,L=0,n=0}if(_=m[a+48>>2],M=b(d[t+24>>2],5),d[(R=M<<2)+p>>2]=d[a+48>>2],l=m[a+52>>2],d[(U=R+4|0)+p>>2]=d[a+52>>2],T=m[a+56>>2],d[p+(G=R+8|0)>>2]=d[a+56>>2],m[i+U>>2]=-l,m[i+R>>2]=-_,m[i+G>>2]=-T,c=mo(i=e+688|0),f=fo(i),i=d[t+28>>2],d[R+i>>2]=0,p=d[e+748>>2],g=m[(2&p?e+760|0:t+4|0)>>2],n&c==f|V||(4&p&&(d[d[t+32>>2]+(M<<2)>>2]=d[e+752>>2]),v=Os(m[e+728>>2],c,f,m[e+680>>2],y(g*m[t>>2])),i=d[t+28>>2],m[(R=i+(p=M<<2)|0)>>2]=y(y(v*m[e+680>>2])*m[e+732>>2])+m[R>>2],m[p+d[t+36>>2]>>2]=-m[e+684>>2],d[p+d[t+40>>2]>>2]=d[e+684>>2]),n){m[(i=(n=M<<2)+i|0)>>2]=m[i>>2]+y(E*y(g*m[t>>2])),1&s[e+748|0]&&(d[n+d[t+32>>2]>>2]=d[e+756>>2]),c!=f?(n=d[t+36>>2]+(M<<2)|0,1!=(0|L)?(d[n>>2]=-8388609,c=y(0)):(d[n>>2]=0,c=y(34028234663852886e22))):(d[d[t+36>>2]+(M<<2)>>2]=-8388609,c=y(34028234663852886e22)),m[d[t+40>>2]+(M<<2)>>2]=c;t:if((c=m[e+704>>2])>y(0))if(l=y(y(y(y(m[r>>2]*_)+y(m[r+4>>2]*l))+y(m[r+8>>2]*T))-y(y(y(m[o>>2]*_)+y(m[o+4>>2]*l))+y(m[o+8>>2]*T))),1!=(0|L))l>y(0)&&(l=y(l*y(-c)))>2]&&(m[i>>2]=l);else{if(!(lm[i>>2]))break t;m[i>>2]=l}m[i>>2]=m[e+700>>2]*m[i>>2]}}O=a- -64|0}(e,t,o,r,n,i):function(e,t,i,n,r,o){var a,l=y(0),c=0,h=y(0),_=y(0),p=0,f=y(0),g=0,v=y(0),A=y(0),C=y(0),S=0,x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=0,O=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=0,V=y(0),U=0,G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0),se=y(0),oe=y(0),ae=y(0),le=y(0),ce=y(0);x=m[e+656>>2],P=m[n+40>>2],K=y(x*P),h=m[e+624>>2],v=m[n+32>>2],_=m[e+640>>2],w=m[n+36>>2],Z=y(y(h*v)+y(_*w)),N=m[n+24>>2],$=y(x*N),F=m[n+16>>2],B=m[n+20>>2],J=y(y(h*F)+y(_*B)),T=m[e+592>>2],l=m[i+40>>2],ee=y(T*l),I=m[e+560>>2],f=m[i+32>>2],M=m[e+576>>2],A=m[i+36>>2],te=y(y(I*f)+y(M*A)),G=m[e+588>>2],ie=y(G*l),j=m[e+556>>2],W=m[e+572>>2],ne=y(y(j*f)+y(W*A)),z=m[e+584>>2],re=y(z*l),H=m[e+552>>2],X=m[e+568>>2],se=y(y(H*f)+y(X*A)),R=m[i+24>>2],oe=y(T*R),C=m[i+16>>2],E=m[i+20>>2],ae=y(y(I*C)+y(M*E)),O=v,v=m[e+664>>2],L=w,w=m[e+668>>2],V=P,P=m[e+672>>2],V=y(y(y(y(O*v)+y(L*w))+y(V*P))+m[n+56>>2]),N=y(y(y(y(F*v)+y(B*w))+y(N*P))+m[n+52>>2]),F=m[e+600>>2],B=m[e+604>>2],O=l,l=m[e+608>>2],L=m[i+56>>2],Y=y(y(y(y(f*F)+y(A*B))+y(O*l))+L),O=m[i+52>>2],Q=y(y(y(y(C*F)+y(E*B))+y(R*l))+O),q=m[n>>2],f=y(q*h),h=m[n+4>>2],le=y(f+y(h*_)),_=m[n+8>>2],ce=y(_*x),f=m[i>>2],A=m[i+4>>2],I=y(y(f*I)+y(A*M)),x=m[i+8>>2],M=y(x*T),h=y(m[n+48>>2]+y(y(y(q*v)+y(h*w))+y(_*P))),_=y(m[i+48>>2]+y(y(y(f*F)+y(A*B))+y(x*l))),p=(g=d[t+24>>2])<<1,(D=u[e+736|0])||(c=d[t+8>>2],d[c>>2]=1065353216,d[(p=4+(g<<2)|0)+c>>2]=1065353216,d[(S=8+(g<<3)|0)+c>>2]=1065353216,c=d[t+16>>2],d[c>>2]=-1082130432,d[c+p>>2]=-1082130432,d[c+S>>2]=-1082130432,L=m[i+56>>2],O=m[i+52>>2],p=g<<1),l=m[i+48>>2],i=d[t+12>>2],d[i+12>>2]=0,T=y(Y-L),m[i+4>>2]=T,d[i>>2]=0,v=y(Q-O),m[i+8>>2]=-v,d[12+(c=(S=g<<2)+i|0)>>2]=0,l=y(_-l),m[c+8>>2]=l,d[c+4>>2]=0,m[c>>2]=-T,d[8+(c=(p<<=2)+i|0)>>2]=0,d[c+12>>2]=0,m[c+4>>2]=-l,m[c>>2]=v,l=m[n+48>>2],T=m[n+56>>2],v=m[n+52>>2],n=d[t+20>>2],d[n+12>>2]=0,d[n>>2]=0,v=y(N-v),m[n+8>>2]=v,T=y(V-T),m[n+4>>2]=-T,d[12+(c=n+S|0)>>2]=0,l=y(h-l),m[c+8>>2]=-l,d[c+4>>2]=0,m[c>>2]=T,d[8+(c=n+p|0)>>2]=0,d[c+12>>2]=0,m[c+4>>2]=l,m[c>>2]=-v,l=y(m[t>>2]*m[t+4>>2]),c=d[t+28>>2],D||(m[c>>2]=l*y(h-_),m[c+S>>2]=l*y(N-Q),m[c+(g<<3)>>2]=l*y(V-Y)),p=b(g,12),h=y(y(y(H*f)+y(X*A))+y(z*x)),m[p+i>>2]=h,D=p+8|0,_=y(se+re),m[D+i>>2]=_,k=p+4|0,T=y(y(y(H*C)+y(X*E))+y(z*R)),m[k+i>>2]=T,S=g<<4,x=y(y(y(f*j)+y(A*W))+y(x*G)),m[S+i>>2]=x,U=4|S,C=y(y(y(j*C)+y(W*E))+y(G*R)),m[U+i>>2]=C,a=8|S,E=y(ne+ie),m[i+a>>2]=E,m[n+p>>2]=-h,m[n+D>>2]=-_,m[n+k>>2]=-T,m[n+S>>2]=-x,m[n+U>>2]=-C,m[n+a>>2]=-E,v=_,f=y(I+M),_=y(J+$),A=y(ae+oe),I=y(le+ce),M=y(y(f*_)-y(A*I)),P=h,h=y(Z+K),R=y(te+ee),_=y(y(A*h)-y(R*_)),h=y(y(R*I)-y(f*h)),m[c+p>>2]=y(y(v*M)+y(y(P*_)+y(T*h)))*l,m[c+S>>2]=y(y(E*M)+y(y(x*_)+y(C*h)))*l;e:{if(u[e+716|0])S=(E=y(m[e+708>>2]*m[e+732>>2]))>y(0)?1:2,D=!u[e+737|0],p=1;else{if(!u[e+737|0])break e;E=y(0),S=0,D=0,p=0}if(g=b(g,5),m[(c=g<<2)+i>>2]=f,m[(k=c+8|0)+i>>2]=R,m[(U=i)+(i=c+4|0)>>2]=A,m[n+k>>2]=-R,m[i+n>>2]=-A,m[n+c>>2]=-f,l=mo(i=e+688|0),C=fo(i),n=d[t+28>>2],d[c+n>>2]=0,i=d[e+748>>2],x=m[(2&i?e+760|0:t+4|0)>>2],l==C&p|D||(4&i&&(d[d[t+32>>2]+(g<<2)>>2]=d[e+752>>2]),h=Os(m[e+728>>2],l,C,m[e+680>>2],y(x*m[t>>2])),n=d[t+28>>2],m[(c=n+(i=g<<2)|0)>>2]=y(y(h*m[e+680>>2])*m[e+732>>2])+m[c>>2],m[i+d[t+36>>2]>>2]=-m[e+684>>2],d[i+d[t+40>>2]>>2]=d[e+684>>2]),p){m[(i=(i=n)+(n=g<<2)|0)>>2]=m[i>>2]+y(E*y(x*m[t>>2])),1&s[e+748|0]&&(d[n+d[t+32>>2]>>2]=d[e+756>>2]),l!=C?(n=d[t+36>>2]+(g<<2)|0,1!=(0|S)?(d[n>>2]=-8388609,l=y(0)):(d[n>>2]=0,l=y(34028234663852886e22))):(d[d[t+36>>2]+(g<<2)>>2]=-8388609,l=y(34028234663852886e22)),m[d[t+40>>2]+(g<<2)>>2]=l;t:if((C=m[e+704>>2])>y(0))if(l=y(y(y(y(f*m[r>>2])+y(A*m[r+4>>2]))+y(R*m[r+8>>2]))-y(y(y(f*m[o>>2])+y(A*m[o+4>>2]))+y(R*m[o+8>>2]))),1!=(0|S))l>y(0)&&(l=y(l*y(-C)))>2]&&(m[i>>2]=l);else{if(!(lm[i>>2]))break t;m[i>>2]=l}m[i>>2]=m[e+700>>2]*m[i>>2]}}}(e,t,o,r,n,i)},r[763]=function(e,t,i,n){e|=0,t|=0,i=y(i);e:{t:switch(1+(n|=0)|0){case 0:case 6:break t;default:break e}t:switch(t+-2|0){case 0:return m[e+760>>2]=i,void(d[e+748>>2]=2|d[e+748>>2]);case 2:return m[e+756>>2]=i,void(d[e+748>>2]=1|d[e+748>>2]);case 1:break t;default:break e}m[e+752>>2]=i,d[e+748>>2]=4|d[e+748>>2]}},r[764]=function(e,t,i){e|=0,t|=0,i|=0;var n=y(0);e:{t:switch(i+1|0){case 0:case 6:break t;default:break e}t:switch(t+-2|0){case 0:return y(m[e+760>>2]);case 2:return y(m[e+756>>2]);case 1:break t;default:break e}n=m[e+752>>2]}return y(n)},r[765]=function(e){return 220},r[766]=function(e,t,i){return Sn(e|=0,t|=0,i|=0),d[t+52>>2]=d[e+552>>2],d[t+56>>2]=d[e+556>>2],d[t+60>>2]=d[e+560>>2],d[t+64>>2]=d[e+564>>2],d[t+68>>2]=d[e+568>>2],d[t+72>>2]=d[e+572>>2],d[t+76>>2]=d[e+576>>2],d[t+80>>2]=d[e+580>>2],d[t+84>>2]=d[e+584>>2],d[t+88>>2]=d[e+588>>2],d[t+92>>2]=d[e+592>>2],d[t+96>>2]=d[e+596>>2],d[t+100>>2]=d[e+600>>2],d[t+104>>2]=d[e+604>>2],d[t+108>>2]=d[e+608>>2],d[t+112>>2]=d[e+612>>2],d[t+116>>2]=d[e+616>>2],d[t+120>>2]=d[e+620>>2],d[t+124>>2]=d[e+624>>2],d[t+128>>2]=d[e+628>>2],d[t+132>>2]=d[e+632>>2],d[t+136>>2]=d[e+636>>2],d[t+140>>2]=d[e+640>>2],d[t+144>>2]=d[e+644>>2],d[t+148>>2]=d[e+648>>2],d[t+152>>2]=d[e+652>>2],d[t+156>>2]=d[e+656>>2],d[t+160>>2]=d[e+660>>2],d[t+164>>2]=d[e+664>>2],d[t+168>>2]=d[e+668>>2],d[t+172>>2]=d[e+672>>2],d[t+176>>2]=d[e+676>>2],d[t+184>>2]=u[e+736|0],d[t+188>>2]=u[e+737|0],d[t+196>>2]=d[e+684>>2],d[t+192>>2]=d[e+680>>2],d[t+180>>2]=u[e+740|0],i=e+688|0,m[t+200>>2]=mo(i),m[t+204>>2]=fo(i),d[t+208>>2]=d[e+696>>2],d[t+212>>2]=d[e+700>>2],d[t+216>>2]=d[e+704>>2],19744},r[767]=ri,r[768]=function(e){(e=ri(e|=0))&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[769]=fd,r[770]=function(e,t,i,n,s,o,a,l,c,h){return e|=0,t|=0,i|=0,n|=0,s|=0,o|=0,a|=0,l|=0,c|=0,yr(19895),y(r[d[d[e>>2]+44>>2]](e,t,i,n,s,o,a,l,c)),y(r[d[d[e>>2]+48>>2]](e,t,i,n,s,o,a,l,c)),y(r[d[d[e>>2]+36>>2]](e,t,i,l)),As(),y(y(0))},r[771]=fd,r[772]=function(e){d[192+(e|=0)>>2]=0},r[773]=xd,r[774]=function(e,t,i,n){e|=0,t|=0,n|=0;var r=0;if((0|(i|=0))>=1)for(;U(e,d[(r<<2)+t>>2],n),(0|(r=r+1|0))!=(0|i););},r[775]=function(e,t,i,n,r,o,a,l,c){e|=0,t|=0,i|=0,n|=0,r|=0,o|=0;e:if(d[44+(l|=0)>>2])if(i=d[l+20>>2],1&s[l+65|0]){if((0|i)<1)break e;for(n=0;;){if(t=0,(0|(r=d[e+28>>2]))>=1){for(;o=d[e+16>>2],i=d[e+36>>2]+b(d[d[e+116>>2]+(t<<2)>>2],152)|0,Kt(o+b(d[i+144>>2],244)|0,o+b(d[i+148>>2],244)|0,i),(0|r)!=(0|(t=t+1|0)););i=d[l+20>>2]}if(!((0|(n=n+1|0))<(0|i)))break}}else if(!((0|i)<1))for(n=0;;){if(t=0,(0|(r=d[e+28>>2]))>=1){for(;o=d[e+16>>2],i=d[e+36>>2]+b(d[d[e+116>>2]+(t<<2)>>2],152)|0,Kt(o+b(d[i+144>>2],244)|0,o+b(d[i+148>>2],244)|0,i),(0|r)!=(0|(t=t+1|0)););i=d[l+20>>2]}if(!((0|(n=n+1|0))<(0|i)))break}},r[776]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var o=0,a=y(0),l=y(0),c=0,h=0,_=0,p=y(0),f=y(0),g=y(0),A=y(0),C=0,S=0;if(4&(t=d[n+64>>2])&&!((0|(c=d[e+28>>2]))<1))for(h=16&t,_=d[e+76>>2],C=d[e+36>>2],i=0;t=C+b(i,152)|0,o=d[t+132>>2],d[o+120>>2]=d[t+100>>2],t=_+b(d[t+140>>2],152)|0,d[o+124>>2]=d[t+100>>2],h&&(d[o+128>>2]=d[t+252>>2]),(0|c)!=(0|(i=i+1|0)););if((0|(C=d[e+48>>2]))>=1)for(S=d[e+56>>2],o=0;i=b(o,152)+S|0,c=d[i+132>>2],(t=d[c+44>>2])&&(h=d[c+28>>2],p=m[h+356>>2],f=m[i+24>>2],g=m[h+352>>2],A=m[i+20>>2],a=m[i+100>>2],l=y(y(1)/m[n+12>>2]),m[t>>2]=m[t>>2]+y(y(y(m[i+16>>2]*a)*m[h+348>>2])*l),m[t+4>>2]=y(y(g*y(a*A))*l)+m[t+4>>2],m[t+8>>2]=y(y(p*y(a*f))*l)+m[t+8>>2],_=d[c+32>>2],p=m[_+356>>2],f=m[i+56>>2],g=m[_+352>>2],A=m[i+52>>2],a=m[i+100>>2],l=y(y(1)/m[n+12>>2]),m[t+32>>2]=m[t+32>>2]+y(y(y(m[i+48>>2]*a)*m[_+348>>2])*l),m[t+36>>2]=y(y(g*y(a*A))*l)+m[t+36>>2],m[t+40>>2]=y(y(p*y(a*f))*l)+m[t+40>>2],p=m[h+552>>2],f=m[i+8>>2],g=m[h+548>>2],A=m[i+4>>2],a=m[i+100>>2],l=y(y(1)/m[n+12>>2]),m[t+16>>2]=m[t+16>>2]+y(y(y(m[i>>2]*m[h+544>>2])*a)*l),m[t+20>>2]=y(y(a*y(A*g))*l)+m[t+20>>2],m[t+24>>2]=y(y(a*y(f*p))*l)+m[t+24>>2],p=m[_+552>>2],f=m[i+40>>2],g=m[_+548>>2],A=m[i+36>>2],a=m[i+100>>2],l=y(y(1)/m[n+12>>2]),m[t+48>>2]=m[t+48>>2]+y(y(y(m[i+32>>2]*m[_+544>>2])*a)*l),m[t+52>>2]=y(y(a*y(A*g))*l)+m[t+52>>2],m[t+56>>2]=y(y(a*y(f*p))*l)+m[t+56>>2]),a=m[i+100>>2],m[c+36>>2]=a,y(v(a))>=m[c+16>>2]&&(s[c+20|0]=0),(0|C)!=(0|(o=o+1|0)););if((0|(o=d[e+8>>2]))>=1)for(h=d[e+16>>2],_=0;c=b(_,244),(i=d[240+(t=c+h|0)>>2])&&(d[n+44>>2]?(Hi(t,m[n+12>>2],m[n+52>>2]),h=d[e+16>>2],a=m[176+(t=c+h|0)>>2],i=d[t+240>>2],l=m[t+184>>2],p=m[t+180>>2]):(a=y(m[t+64>>2]+m[t+176>>2]),m[t+176>>2]=a,m[t+192>>2]=m[t+80>>2]+m[t+192>>2],p=y(m[t+68>>2]+m[t+180>>2]),m[t+180>>2]=p,l=y(m[t+72>>2]+m[t+184>>2]),m[t+184>>2]=l,m[t+196>>2]=m[t+84>>2]+m[t+196>>2],m[t+200>>2]=m[t+88>>2]+m[t+200>>2]),f=m[212+(t=c+h|0)>>2],g=m[t+216>>2],A=m[t+208>>2],d[i+324>>2]=0,m[i+312>>2]=a+A,d[i+260>>2]=d[i+260>>2]+1,m[i+320>>2]=l+g,m[i+316>>2]=p+f,t=c+d[e+16>>2]|0,a=m[t+228>>2],l=m[t+196>>2],p=m[t+232>>2],f=m[t+200>>2],g=m[t+224>>2],A=m[t+192>>2],t=d[t+240>>2],d[t+340>>2]=0,m[t+328>>2]=A+g,m[t+336>>2]=f+p,m[t+332>>2]=l+a,d[t+260>>2]=d[t+260>>2]+1,d[n+44>>2]&&(i=c+d[e+16>>2]|0,t=d[i+240>>2],d[t+260>>2]=d[t+260>>2]+1,o=d[i+12>>2],d[t+12>>2]=d[i+8>>2],d[t+16>>2]=o,o=d[i+4>>2],d[t+4>>2]=d[i>>2],d[t+8>>2]=o,o=d[i+28>>2],d[t+28>>2]=d[i+24>>2],d[t+32>>2]=o,o=d[i+20>>2],d[t+20>>2]=d[i+16>>2],d[t+24>>2]=o,o=d[i+36>>2],d[t+36>>2]=d[i+32>>2],d[t+40>>2]=o,o=d[i+44>>2],d[t+44>>2]=d[i+40>>2],d[t+48>>2]=o,o=d[i+60>>2],d[t+60>>2]=d[i+56>>2],d[t+64>>2]=o,o=d[i+52>>2],d[t+52>>2]=d[i+48>>2],d[t+56>>2]=o),h=d[e+16>>2],d[d[240+(c+h|0)>>2]+212>>2]=-1,o=d[e+8>>2]),(0|(_=_+1|0))<(0|o););return d[e+28>>2]>-1|d[e+32>>2]>-1||((t=d[e+36>>2])&&(u[e+40|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+36>>2]=0),d[e+32>>2]=0,d[e+36>>2]=0,s[e+40|0]=1),d[e+28>>2]=0,d[e+48>>2]>-1|d[e+52>>2]>-1||((t=d[e+56>>2])&&(u[e+60|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+56>>2]=0),d[e+52>>2]=0,d[e+56>>2]=0,s[e+60|0]=1),d[e+48>>2]=0,d[e+68>>2]>-1|d[e+72>>2]>-1||((t=d[e+76>>2])&&(u[e+80|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+76>>2]=0),d[e+72>>2]=0,d[e+76>>2]=0,s[e+80|0]=1),d[e+68>>2]=0,d[e+88>>2]>-1|d[e+92>>2]>-1||((t=d[e+96>>2])&&(u[e+100|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+96>>2]=0),d[e+92>>2]=0,d[e+96>>2]=0,s[e+100|0]=1),d[e+88>>2]=0,d[e+8>>2]>-1|d[e+12>>2]>-1||((t=d[e+16>>2])&&(u[e+20|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+16>>2]=0),d[e+12>>2]=0,d[e+16>>2]=0,s[e+20|0]=1),d[e+8>>2]=0,y(y(0))},r[777]=function(e,t,i,n,o,a,l,c,h,_){e|=0,t|=0,i|=0,n|=0,o|=0,a|=0,l|=0,c|=0,h|=0,_|=0;var p=0,f=y(0),g=y(0),v=0,A=0,C=0,S=0,x=0;if(1&s[h+64|0]){if(_=d[e+68>>2],A=d[e+28>>2],(0|(v=d[e+48>>2]))>=1){if(a=b(d[e+192>>2],1664525)+1013904223|0,1!=(0|v)&&(i=2,o=d[e+136>>2],n=d[o+4>>2],p=(a=b(a,1664525)+1013904223|0)^a>>>16,p^=p>>>8,p^=p>>>4,p=o+((1&((p^=p>>>2)>>>1^p))<<2)|0,d[o+4>>2]=d[p>>2],d[p>>2]=n,2!=(0|v)))for(;i=(n=i)+1|0,x=d[(p=o+(n<<2)|0)>>2],S=p,p=a=b(a,1664525)+1013904223|0,n>>>0>65535||(p=C=a>>>16^a,n>>>0>255||(p=C^=C>>>8,n>>>0>15||(p=C^=C>>>4,n>>>0>3||(p=C^C>>>2)))),n=((p>>>0)%(i>>>0)<<2)+o|0,d[S>>2]=d[n>>2],d[n>>2]=x,(0|i)!=(0|v););d[e+192>>2]=a}if(!(d[h+20>>2]<=(0|t))){if((0|A)>=1){if(a=b(d[e+192>>2],1664525)+1013904223|0,1!=(0|A)&&(i=2,o=d[e+116>>2],n=d[o+4>>2],p=(a=b(a,1664525)+1013904223|0)^a>>>16,p^=p>>>8,p^=p>>>4,p=o+((1&((p^=p>>>2)>>>1^p))<<2)|0,d[o+4>>2]=d[p>>2],d[p>>2]=n,2!=(0|A)))for(;i=(n=i)+1|0,C=d[(p=o+(n<<2)|0)>>2],S=p,p=a=b(a,1664525)+1013904223|0,n>>>0>65535||(p=v=a>>>16^a,n>>>0>255||(p=v^=v>>>8,n>>>0>15||(p=v^=v>>>4,n>>>0>3||(p=v^v>>>2)))),n=((p>>>0)%(i>>>0)<<2)+o|0,d[S>>2]=d[n>>2],d[n>>2]=C,(0|i)!=(0|A););d[e+192>>2]=a}if(!((0|_)<1)){if(a=b(d[e+192>>2],1664525)+1013904223|0,1!=(0|_)&&(i=2,o=d[e+156>>2],n=d[o+4>>2],p=(a=b(a,1664525)+1013904223|0)^a>>>16,p^=p>>>8,p^=p>>>4,p=o+((1&((p^=p>>>2)>>>1^p))<<2)|0,d[o+4>>2]=d[p>>2],d[p>>2]=n,2!=(0|_)))for(;i=(n=i)+1|0,v=d[(p=o+(n<<2)|0)>>2],C=p,p=a=b(a,1664525)+1013904223|0,n>>>0>65535||(p=A=a>>>16^a,n>>>0>255||(p=A^=A>>>8,n>>>0>15||(p=A^=A>>>4,n>>>0>3||(p=A^A>>>2)))),n=((p>>>0)%(i>>>0)<<2)+o|0,d[C>>2]=d[n>>2],d[n>>2]=v,(0|i)!=(0|_););d[e+192>>2]=a}}}i=d[e+48>>2];e:{t:{if(1&s[h+65|0]){if((0|i)>=1)for(n=0;o=d[e+56>>2]+b(d[d[e+136>>2]+(n<<2)>>2],152)|0,d[o+136>>2]>(0|t)&&($t((i=d[e+16>>2])+b(d[o+144>>2],244)|0,i+b(d[o+148>>2],244)|0,o),i=d[e+48>>2]),(0|(n=n+1|0))<(0|i););if(d[h+20>>2]<=(0|t))break e;if((0|c)>=1)for(i=0;n=d[(t=(i<<2)+l|0)>>2],u[n+20|0]&&(n=ci(e,d[n+28>>2],m[h+12>>2]),o=ci(e,d[d[t>>2]+32>>2],m[h+12>>2]),t=d[t>>2],a=b(n,244),n=d[e+16>>2],r[d[d[t>>2]+24>>2]](t,a+n|0,n+b(o,244)|0,m[h+12>>2])),(0|c)!=(0|(i=i+1|0)););if(n=d[e+28>>2],512&(t=d[h+64>>2]))break t;if((0|n)>=1)for(i=0;o=d[e+16>>2],t=d[e+36>>2]+b(d[d[e+116>>2]+(i<<2)>>2],152)|0,ni(o+b(d[t+144>>2],244)|0,o+b(d[t+148>>2],244)|0,t),(0|n)!=(0|(i=i+1|0)););if((0|(i=d[e+68>>2]))>=1)for(n=0;t=d[e+76>>2]+b(d[d[e+156>>2]+(n<<2)>>2],152)|0,(f=m[100+(d[e+36>>2]+b(d[t+140>>2],152)|0)>>2])>y(0)&&(g=m[t+104>>2],m[t+124>>2]=f*g,m[t+120>>2]=f*y(-g),$t((o=d[e+16>>2])+b(d[t+144>>2],244)|0,o+b(d[t+148>>2],244)|0,t)),(0|i)!=(0|(n=n+1|0)););if((0|(i=d[e+88>>2]))<1)break e;for(n=0;t=d[e+96>>2]+b(n,152)|0,(f=m[100+(d[e+36>>2]+b(d[t+140>>2],152)|0)>>2])>y(0)&&(g=f,f=m[t+104>>2],f=(g=y(g*f))>f?f:g,m[t+124>>2]=f,m[t+120>>2]=-f,$t((o=d[e+16>>2])+b(d[t+144>>2],244)|0,o+b(d[t+148>>2],244)|0,t)),(0|i)!=(0|(n=n+1|0)););break e}if((0|i)>=1)for(n=0;o=d[e+56>>2]+b(d[d[e+136>>2]+(n<<2)>>2],152)|0,d[o+136>>2]>(0|t)&&($t((i=d[e+16>>2])+b(d[o+144>>2],244)|0,i+b(d[o+148>>2],244)|0,o),i=d[e+48>>2]),(0|(n=n+1|0))<(0|i););if(d[h+20>>2]<=(0|t))break e;if((0|c)>=1)for(i=0;n=d[(t=(i<<2)+l|0)>>2],u[n+20|0]&&(n=ci(e,d[n+28>>2],m[h+12>>2]),o=ci(e,d[d[t>>2]+32>>2],m[h+12>>2]),t=d[t>>2],a=b(n,244),n=d[e+16>>2],r[d[d[t>>2]+24>>2]](t,a+n|0,n+b(o,244)|0,m[h+12>>2])),(0|c)!=(0|(i=i+1|0)););if((0|(n=d[e+28>>2]))>=1)for(i=0;o=d[e+16>>2],t=d[e+36>>2]+b(d[d[e+116>>2]+(i<<2)>>2],152)|0,ni(o+b(d[t+144>>2],244)|0,o+b(d[t+148>>2],244)|0,t),(0|n)!=(0|(i=i+1|0)););if((0|(i=d[e+68>>2]))>=1)for(n=0;t=d[e+76>>2]+b(d[d[e+156>>2]+(n<<2)>>2],152)|0,(f=m[100+(d[e+36>>2]+b(d[t+140>>2],152)|0)>>2])>y(0)&&(g=m[t+104>>2],m[t+124>>2]=f*g,m[t+120>>2]=f*y(-g),$t((o=d[e+16>>2])+b(d[t+144>>2],244)|0,o+b(d[t+148>>2],244)|0,t)),(0|i)!=(0|(n=n+1|0)););if((0|(i=d[e+88>>2]))<1)break e;for(n=0;t=d[e+96>>2]+b(n,152)|0,(f=m[100+(d[e+36>>2]+b(d[t+140>>2],152)|0)>>2])>y(0)&&(g=f,f=m[t+104>>2],f=(g=y(g*f))>f?f:g,m[t+124>>2]=f,m[t+120>>2]=-f,$t((o=d[e+16>>2])+b(d[t+144>>2],244)|0,o+b(d[t+148>>2],244)|0,t)),(0|i)!=(0|(n=n+1|0)););break e}if(!((0|n)<1))for(a=16&t?2:1,i=0;o=d[e+16>>2],t=d[e+36>>2]+b(d[d[e+116>>2]+(i<<2)>>2],152)|0,ni(o+b(d[t+144>>2],244)|0,o+b(d[t+148>>2],244)|0,t),o=b(i,a)<<2,(l=(f=m[t+100>>2])>y(0)^1)||(t=d[e+76>>2]+b(d[o+d[e+156>>2]>>2],152)|0,g=m[t+104>>2],m[t+124>>2]=f*g,m[t+120>>2]=f*y(-g),$t((c=d[e+16>>2])+b(d[t+144>>2],244)|0,c+b(d[t+148>>2],244)|0,t)),l|!(16&u[h+64|0])||(t=d[e+76>>2]+b(d[4+(o+d[e+156>>2]|0)>>2],152)|0,g=m[t+104>>2],m[t+124>>2]=f*g,m[t+120>>2]=f*y(-g),$t((o=d[e+16>>2])+b(d[t+144>>2],244)|0,o+b(d[t+148>>2],244)|0,t)),(0|n)!=(0|(i=i+1|0)););}return y(y(0))},r[778]=function(e,t,i,n,o,a,l,c,h){e|=0,t|=0,i|=0,n|=0,o|=0,a|=0,l|=0,c|=0,h|=0;var _,p=0,f=0,g=0,A=0,C=y(0),S=y(0),x=0,T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=0,w=y(0),F=y(0),B=0,N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=0,j=y(0),W=0,z=y(0),H=y(0),X=0,Y=0,Q=0,q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),ie=y(0),ne=y(0),re=y(0),se=y(0),oe=y(0),ae=y(0),le=y(0),ce=y(0),he=y(0),_e=y(0),de=y(0),ue=y(0),pe=y(0);if(O=_=O-256|0,d[e+188>>2]=-1,yr(19832),h=0,d[e+184>>2]=0,(0|i)>0)for(;d[d[(h<<2)+t>>2]+212>>2]=-1,(0|(h=h+1|0))!=(0|i););if((0|(D=d[e+12>>2]))<=(0|i)){if(h=0,(D=i+1|0)&&(d[7717]=d[7717]+1,h=0|r[d[6606]](b(D,244),16)),(0|(x=d[e+8>>2]))>=1)for(;g=(p=b(f,244))+h|0,p=p+d[e+16>>2]|0,B=d[p+4>>2],d[g>>2]=d[p>>2],d[g+4>>2]=B,A=d[p+12>>2],d[g+8>>2]=d[p+8>>2],d[g+12>>2]=A,A=d[p+28>>2],d[g+24>>2]=d[p+24>>2],d[g+28>>2]=A,A=d[p+20>>2],d[g+16>>2]=d[p+16>>2],d[g+20>>2]=A,A=d[p+44>>2],d[g+40>>2]=d[p+40>>2],d[g+44>>2]=A,A=d[p+36>>2],d[g+32>>2]=d[p+32>>2],d[g+36>>2]=A,A=d[p+52>>2],d[g+48>>2]=d[p+48>>2],d[g+52>>2]=A,A=d[p+60>>2],d[g+56>>2]=d[p+56>>2],d[g+60>>2]=A,Mi(g- -64|0,p- -64|0,180),(0|x)!=(0|(f=f+1|0)););(p=d[e+16>>2])&&(u[e+20|0]&&p&&(d[7718]=d[7718]+1,r[d[6607]](p)),d[e+16>>2]=0),d[e+16>>2]=h,d[e+12>>2]=D,s[e+20|0]=1}if(Mn(_+8|0,0,244),(0|(h=d[e+8>>2]))<=-1)for((0|D)<=-1&&((p=d[e+16>>2])&&(u[e+20|0]&&p&&(d[7718]=d[7718]+1,r[d[6607]](p)),d[e+16>>2]=0),d[e+12>>2]=0,d[e+16>>2]=0,s[e+20|0]=1),g=_+72|0;f=d[_+12>>2],p=d[e+16>>2]+b(h,244)|0,d[p>>2]=d[_+8>>2],d[p+4>>2]=f,f=d[_+20>>2],d[p+8>>2]=d[_+16>>2],d[p+12>>2]=f,f=d[_+36>>2],d[p+24>>2]=d[_+32>>2],d[p+28>>2]=f,f=d[_+28>>2],d[p+16>>2]=d[_+24>>2],d[p+20>>2]=f,f=d[_+52>>2],d[p+40>>2]=d[_+48>>2],d[p+44>>2]=f,f=d[_+44>>2],d[p+32>>2]=d[_+40>>2],d[p+36>>2]=f,f=d[_+60>>2],d[p+48>>2]=d[_+56>>2],d[p+52>>2]=f,f=d[_+68>>2],d[p+56>>2]=d[_+64>>2],d[p+60>>2]=f,Mi(p- -64|0,g,180),f=(p=h+1|0)>>>0>=h>>>0,h=p,f;);if(d[e+8>>2]=0,(0|i)>=1)for(h=0;g=ci(e,d[(p=(h<<2)+t|0)>>2],m[c+12>>2]),!(p=d[p>>2])|!(2&d[p+236>>2])|!(2&u[p+504|0])|m[p+344>>2]==y(0)||(f=d[e+16>>2],Gi(_+8|0,p,m[c+76>>2]),T=m[p+304>>2],E=m[p+272>>2],N=m[p+288>>2],w=m[p+300>>2],M=m[p+268>>2],F=m[p+284>>2],g=f+b(g,244)|0,C=m[_+8>>2],R=m[_+12>>2],P=m[_+16>>2],S=m[c+12>>2],m[g+224>>2]=m[g+224>>2]-y(y(y(y(C*m[p+264>>2])+y(R*m[p+280>>2]))+y(P*m[p+296>>2]))*S),m[g+228>>2]=m[g+228>>2]-y(S*y(y(y(C*M)+y(R*F))+y(P*w))),m[g+232>>2]=m[g+232>>2]-y(S*y(y(y(C*E)+y(R*N))+y(P*T)))),(0|(h=h+1|0))!=(0|i););if(h=0,(0|l)>0)for(;t=d[(h<<2)+a>>2],r[d[d[t>>2]+8>>2]](t),d[t+36>>2]=0,(0|(h=h+1|0))!=(0|l););if(!((0|(i=d[e+168>>2]))>=(0|l)|d[e+172>>2]>=(0|l))){if(l?(d[7717]=d[7717]+1,t=0|r[d[6606]](l<<3,16),i=d[e+168>>2]):t=0,(0|i)>=1)for(h=0;g=(p=h<<3)+t|0,p=p+d[e+176>>2]|0,f=d[p+4>>2],d[g>>2]=d[p>>2],d[g+4>>2]=f,(0|(h=h+1|0))!=(0|i););(i=d[e+176>>2])&&(u[e+180|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+176>>2]=0),d[e+176>>2]=t,d[e+172>>2]=l,s[e+180|0]=1}if(d[e+168>>2]=l,t=0,(0|l)>=1)for(h=0;g=d[e+176>>2],i=d[(f=(h<<2)+a|0)>>2],(p=d[i+44>>2])&&(d[p>>2]=0,d[p+4>>2]=0,d[p+56>>2]=0,d[p+60>>2]=0,d[p+48>>2]=0,d[p+52>>2]=0,d[p+40>>2]=0,d[p+44>>2]=0,d[p+32>>2]=0,d[p+36>>2]=0,d[p+24>>2]=0,d[p+28>>2]=0,d[p+16>>2]=0,d[p+20>>2]=0,d[p+8>>2]=0,d[p+12>>2]=0,i=d[f>>2]),p=g+(h<<3)|0,u[i+20|0]?(r[d[d[i>>2]+16>>2]](i,p),i=d[p>>2]):(d[p>>2]=0,d[p+4>>2]=0,i=0),t=i+t|0,(0|(h=h+1|0))!=(0|l););if(!((0|(i=d[e+48>>2]))>=(0|t)|d[e+52>>2]>=(0|t))){if(t?(d[7717]=d[7717]+1,f=0|r[d[6606]](b(t,152),16),i=d[e+48>>2]):f=0,(0|i)>=1)for(h=0;Mi((p=b(h,152))+f|0,p+d[e+56>>2]|0,152),(0|(h=h+1|0))!=(0|i););(i=d[e+56>>2])&&(u[e+60|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+56>>2]=0),d[e+56>>2]=f,d[e+52>>2]=t,s[e+60|0]=1}if(d[e+48>>2]=t,(0|l)>=1)for(h=d[e+176>>2],D=0;;){if(d[(G=(Y=W<<3)+h|0)>>2]){if(B=d[(X=(W<<2)+a|0)>>2],h=d[B+32>>2],t=d[e+56>>2],f=ci(e,p=d[B+28>>2],m[c+12>>2]),A=ci(e,h,m[c+12>>2]),Q=d[e+16>>2],(0|(x=(0|(i=d[B+24>>2]))>0?i:d[c+20>>2]))>d[e+184>>2]&&(d[e+184>>2]=x),g=t+b(D,152)|0,t=0,d[G>>2]>=1)for(;i=Mn(g+b(t,152)|0,0,152),d[i+120>>2]=-8388609,d[i+124>>2]=2139095039,d[i+148>>2]=A,d[i+144>>2]=f,d[i+96>>2]=0,d[i+100>>2]=0,d[i+136>>2]=x,(0|(t=t+1|0))>2];);if(x=Q+b(f,244)|0,d[(t=x)+64>>2]=0,d[t+68>>2]=0,d[t+144>>2]=0,d[t+148>>2]=0,d[t+88>>2]=0,d[t+92>>2]=0,d[t+80>>2]=0,d[t+84>>2]=0,d[t+72>>2]=0,d[t+76>>2]=0,d[t+152>>2]=0,d[t+156>>2]=0,d[t+160>>2]=0,d[t+164>>2]=0,d[t+168>>2]=0,d[t+172>>2]=0,A=Q+b(A,244)|0,d[(t=A)+88>>2]=0,d[t+92>>2]=0,d[t+80>>2]=0,d[t+84>>2]=0,d[t+72>>2]=0,d[t+76>>2]=0,d[t+64>>2]=0,d[t+68>>2]=0,d[t+144>>2]=0,d[t+148>>2]=0,d[t+152>>2]=0,d[t+156>>2]=0,d[t+160>>2]=0,d[t+164>>2]=0,d[t+168>>2]=0,d[t+172>>2]=0,m[_+8>>2]=y(1)/m[c+12>>2],t=d[c+32>>2],d[_+36>>2]=g+112,d[_+32>>2]=38,d[_+28>>2]=g+32,d[_+24>>2]=g+48,d[_+20>>2]=g,d[_+16>>2]=g+16,d[_+12>>2]=t,d[g+116>>2]=d[c+40>>2],t=d[c+4>>2],d[_+48>>2]=g+124,d[_+44>>2]=g+120,d[_+40>>2]=g+116,d[_+60>>2]=t,d[_+56>>2]=d[c+20>>2],t=d[X>>2],r[d[d[t>>2]+20>>2]](t,_+8|0),d[G>>2]>=1)for(i=0;t=g+b(i,152)|0,C=m[d[X>>2]+16>>2],m[t+124>>2]>=C&&(m[t+124>>2]=C),C=y(-C),m[t+120>>2]<=C&&(m[t+120>>2]=C),d[t+132>>2]=B,f=d[B+28>>2],S=m[f+268>>2],T=m[f+272>>2],E=m[f+548>>2],N=m[f+288>>2],w=m[f+280>>2],M=m[f+284>>2],C=m[f+552>>2],P=m[f+304>>2],R=m[f+296>>2],F=m[f+300>>2],k=m[f+544>>2],I=m[f+264>>2],d[t+76>>2]=0,L=C,C=m[t>>2],V=y(R*C),R=m[t+4>>2],U=P,P=m[t+8>>2],m[t+72>>2]=L*y(y(V+y(F*R))+y(U*P)),m[t+68>>2]=E*y(y(y(C*w)+y(R*M))+y(P*N)),m[t+64>>2]=k*y(y(y(I*C)+y(S*R))+y(T*P)),f=d[B+32>>2],N=m[f+268>>2],w=m[f+272>>2],M=m[f+548>>2],F=m[f+288>>2],k=m[f+280>>2],I=m[f+284>>2],S=m[f+552>>2],E=m[f+304>>2],T=m[f+296>>2],V=m[f+300>>2],j=m[f+544>>2],z=m[f+264>>2],d[t+92>>2]=0,L=S,S=m[t+32>>2],H=y(T*S),T=m[t+36>>2],U=E,E=m[t+40>>2],m[t+88>>2]=L*y(y(H+y(V*T))+y(U*E)),m[t+84>>2]=M*y(y(y(S*k)+y(T*I))+y(E*F)),m[t+80>>2]=j*y(y(y(z*S)+y(N*T))+y(w*E)),N=y(0),w=m[t+16>>2],M=m[p+344>>2],F=m[t+20>>2],k=m[t+24>>2],L=y(y(y(y(w*y(w*M))+y(F*y(M*F)))+y(k*y(M*k)))+y(y(y(C*y(y(y(C*m[p+264>>2])+y(R*m[p+268>>2]))+y(P*m[p+272>>2])))+y(R*y(y(y(C*m[p+280>>2])+y(R*m[p+284>>2]))+y(P*m[p+288>>2]))))+y(P*y(y(y(C*m[p+296>>2])+y(R*m[p+300>>2]))+y(P*m[p+304>>2]))))),M=m[t+48>>2],I=m[h+344>>2],V=m[t+52>>2],j=m[t+56>>2],I=y(y(L+y(y(y(M*y(M*I))+y(V*y(I*V)))+y(j*y(I*j))))+y(y(y(S*y(y(y(S*m[h+264>>2])+y(T*m[h+268>>2]))+y(E*m[h+272>>2])))+y(T*y(y(y(S*m[h+280>>2])+y(T*m[h+284>>2]))+y(E*m[h+288>>2]))))+y(E*y(y(y(S*m[h+296>>2])+y(T*m[h+300>>2]))+y(E*m[h+304>>2]))))),I=y(v(I))>y(1.1920928955078125e-7)?y(y(1)/I):y(0),m[t+108>>2]=I,z=y(0),L=y(0),U=y(0),H=y(0),q=y(0),K=y(0),d[x+240>>2]&&(K=m[x+232>>2],q=m[x+228>>2],H=m[x+224>>2],L=m[x+212>>2],U=m[x+208>>2],z=m[x+216>>2]),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),d[A+240>>2]&&(te=m[A+232>>2],ee=m[A+228>>2],J=m[A+224>>2],Z=m[A+212>>2],$=m[A+208>>2],N=m[A+216>>2]),ie=m[p+320>>2],ne=m[p+312>>2],re=m[p+316>>2],se=m[p+336>>2],oe=m[p+328>>2],ae=m[p+332>>2],le=m[h+320>>2],ce=m[h+312>>2],he=m[h+316>>2],_e=m[h+336>>2],de=m[h+328>>2],ue=m[h+332>>2],pe=m[_+60>>2],d[t+100>>2]=0,m[t+112>>2]=y(I*m[t+112>>2])+y(I*y(y(0)-y(pe*y(y(y(y(y(w*y(U+ne))+y(F*y(L+re)))+y(k*y(z+ie)))+y(y(y(C*y(H+oe))+y(R*y(q+ae)))+y(P*y(K+se))))+y(y(y(y(M*y($+ce))+y(V*y(Z+he)))+y(j*y(N+le)))+y(y(y(S*y(J+de))+y(T*y(ee+ue)))+y(E*y(te+_e)))))))),(0|(i=i+1|0))>2];);h=d[e+176>>2]}if(D=d[h+Y>>2]+D|0,(0|(W=W+1|0))==(0|l))break}if(r[d[d[e>>2]+28>>2]](e,n,o,c),o=d[e+68>>2],n=d[e+28>>2],!((0|(i=d[e+128>>2]))>=(0|(a=d[e+48>>2]))|d[e+132>>2]>=(0|a))){h=0,t=0,a&&(d[7717]=d[7717]+1,t=0|r[d[6606]](a<<2,16),i=d[e+128>>2]),l=d[e+136>>2];e:{t:{if((0|i)>=1)for(;;)if(d[(p=h<<2)+t>>2]=d[l+p>>2],(0|i)==(0|(h=h+1|0)))break t;if(!l)break e}u[e+140|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+136>>2]=0}d[e+136>>2]=t,d[e+132>>2]=a,s[e+140|0]=1}if(d[e+128>>2]=a,16&u[c+64|0]){if(!((0|(i=d[e+108>>2]))>=(0|(c=n<<1))|d[e+112>>2]>=(0|c))){h=0,t=0,n&&(d[7717]=d[7717]+1,t=0|r[d[6606]](n<<3,16),i=d[e+108>>2]),l=d[e+116>>2];e:{t:{if((0|i)>=1)for(;;)if(d[(p=h<<2)+t>>2]=d[l+p>>2],(0|i)==(0|(h=h+1|0)))break t;if(!l)break e}u[e+120|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+116>>2]=0}d[e+116>>2]=t,d[e+112>>2]=c,s[e+120|0]=1}d[e+108>>2]=c}else{if(!((0|(i=d[e+108>>2]))>=(0|n)|d[e+112>>2]>=(0|n))){h=0,t=0,n&&(d[7717]=d[7717]+1,t=0|r[d[6606]](n<<2,16),i=d[e+108>>2]),l=d[e+116>>2];e:{t:{if((0|i)>=1)for(;;)if(d[(c=h<<2)+t>>2]=d[l+c>>2],(0|i)==(0|(h=h+1|0)))break t;if(!l)break e}u[e+120|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+116>>2]=0}d[e+116>>2]=t,d[e+112>>2]=n,s[e+120|0]=1}d[e+108>>2]=n}if(!((0|(i=d[e+148>>2]))>=(0|o)|d[e+152>>2]>=(0|o))){h=0,t=0,o&&(d[7717]=d[7717]+1,t=0|r[d[6606]](o<<2,16),i=d[e+148>>2]),l=d[e+156>>2];e:{t:{if((0|i)>=1)for(;;)if(d[(c=h<<2)+t>>2]=d[l+c>>2],(0|i)==(0|(h=h+1|0)))break t;if(!l)break e}u[e+160|0]&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),d[e+156>>2]=0}d[e+156>>2]=t,d[e+152>>2]=o,s[e+160|0]=1}if(d[e+148>>2]=o,(0|a)>=1)for(t=d[e+136>>2],h=0;d[t+(h<<2)>>2]=h,(0|a)!=(0|(h=h+1|0)););if((0|n)>=1)for(t=d[e+116>>2],h=0;d[t+(h<<2)>>2]=h,(0|n)!=(0|(h=h+1|0)););if((0|o)>=1)for(e=d[e+156>>2],h=0;d[e+(h<<2)>>2]=h,(0|o)!=(0|(h=h+1|0)););return As(),O=_+256|0,y(y(0))},r[779]=function(e,t,i,n,s,o,a,l,c){e|=0,t|=0,i|=0,n|=0,s|=0,o|=0,a|=0,l|=0,c|=0;var h=0,_=0;if(yr(19861),r[d[d[e>>2]+32>>2]](e,t,i,n,s,o,a,l,c),(0|(_=(0|(h=d[e+184>>2]))>(0|(_=d[l+20>>2]))?h:_))>=1)for(h=0;y(r[d[d[e>>2]+40>>2]](e,h,t,i,n,s,o,a,l,c)),(0|_)!=(0|(h=h+1|0)););return As(),y(y(0))},r[780]=function(e){e|=0,d[7469]=17792,(e=d[7593])&&(u[30376]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[7593]=0),s[30376]=1,d[7591]=0,d[7592]=0,d[7593]=0,d[7469]=3948},r[781]=Rn,r[782]=function(e){ve(Rn(e|=0))},r[783]=function(e,t,i){e|=0,i=y(i),r[d[d[e>>2]+16>>2]](e,i)},r[784]=function(e,t){e|=0,t|=0;var i,n=0,s=0,o=0,a=0,l=y(0),c=y(0),h=y(0);if(O=i=O-48|0,d[e+136>>2]>=1)for(;n=(a=b(o,284))+d[e+144>>2]|0,s=u[n+84|0],d[i+44>>2]=0,d[i+36>>2]=0,d[i+40>>2]=1065353216,d[i+32>>2]=s?0:1065353216,s=d[n+152>>2],d[i+24>>2]=d[n+148>>2],d[i+28>>2]=s,s=d[n+144>>2],d[i+16>>2]=d[n+140>>2],d[i+20>>2]=s,n=n+(d[e+120>>2]<<2)|0,l=m[n+92>>2],c=m[n+108>>2],h=m[n+124>>2],d[i+12>>2]=0,m[i+8>>2]=h+m[i+24>>2],m[i+4>>2]=c+m[i+20>>2],m[i>>2]=l+m[i+16>>2],r[d[d[t>>2]+8>>2]](t,i+16|0,i,i+32|0),r[d[d[t>>2]+8>>2]](t,i+16|0,16+(d[e+144>>2]+a|0)|0,i+32|0),(0|(o=o+1|0))>2];);O=i+48|0},r[785]=function(e,t){e|=0,t=y(t);var i,n,s=0,o=y(0),a=0,l=y(0),c=0,h=y(0),_=y(0),p=y(0),f=0,g=y(0),v=y(0),A=y(0),S=y(0),T=y(0),E=y(0),R=0,P=y(0);if(O=i=O-32|0,(0|(a=d[e+136>>2]))>0)for(;lt(e,s,0),(0|(s=s+1|0))<(0|(a=d[e+136>>2])););if(s=d[e+116>>2],o=m[s+312>>2],l=y(o*o),o=m[s+316>>2],l=y(l+y(o*o)),o=m[s+320>>2],o=y(y(x(y(l+y(o*o))))*y(3.5999999046325684)),m[e+112>>2]=o,c=s+(d[e+128>>2]<<2)|0,y(y(y(m[c+4>>2]*m[s+312>>2])+y(m[c+20>>2]*m[s+316>>2]))+y(m[c+36>>2]*m[s+320>>2]))>2]=-o),!((0|a)<1)){for(s=0;jt(e,d[e+144>>2]+b(s,284)|0),(0|(s=s+1|0))<(0|(a=d[e+136>>2])););if(!((0|a)<1)){for(l=y(y(1)/m[d[e+116>>2]+344>>2]),a=0;o=y(0),s=d[e+144>>2]+b(a,284)|0,u[s+84|0]&&(o=m[s+272>>2],o=y(C(y(l*y(y(y(m[s+216>>2]*y(m[s+204>>2]-m[s+32>>2]))*m[s+268>>2])-y(o*m[(o>2]))),y(0)))),m[s+276>>2]=o,(0|(a=a+1|0))<(0|(s=d[e+136>>2])););if(!((0|s)<1))for(c=0;s=d[e+144>>2]+b(c,284)|0,o=m[s+248>>2],l=m[s+276>>2],h=m[s>>2],_=m[s+4>>2],p=m[s+8>>2],d[i+28>>2]=0,o=l>o?o:l,m[i+24>>2]=y(p*o)*t,m[i+20>>2]=y(o*_)*t,m[i+16>>2]=y(h*o)*t,o=m[s+16>>2],a=d[e+116>>2],l=m[a+52>>2],h=m[s+20>>2],_=m[a+56>>2],p=m[s+24>>2],v=m[a+60>>2],d[i+12>>2]=0,m[i+8>>2]=p-v,m[i+4>>2]=h-_,m[i>>2]=o-l,Vs(a,i+16|0,i),(0|(c=c+1|0))>2];);}}if(r[d[d[e>>2]+20>>2]](e,t),(0|(n=d[e+136>>2]))>=1)for(R=d[e+144>>2],a=d[e+116>>2],c=0;s=b(c,284)+R|0,u[s+84|0]?(f=a+(d[e+128>>2]<<2)|0,l=m[f+36>>2],h=m[f+4>>2],_=m[s>>2],p=m[f+20>>2],v=m[s+4>>2],g=m[s+8>>2],o=y(y(y(h*_)+y(p*v))+y(l*g)),A=y(m[s+40>>2]-m[a+56>>2]),S=m[a+328>>2],T=y(m[s+36>>2]-m[a+52>>2]),E=m[a+332>>2],P=y(y(y(y(A*S)-y(T*E))+m[a+320>>2])*y(l-y(g*o))),l=y(m[s+44>>2]-m[a+60>>2]),g=m[a+336>>2],o=y(y(y(P+y(y(y(y(y(E*l)-y(A*g))+m[a+312>>2])*y(h-y(_*o)))+y(y(y(y(T*g)-y(l*S))+m[a+316>>2])*y(p-y(v*o)))))*t)/m[s+212>>2]),m[s+240>>2]=o,f=s+236|0,h=m[s+236>>2],l=o):(f=s+236|0,o=m[s+236>>2],l=h=m[s+240>>2]),m[f>>2]=h+o,m[s+240>>2]=l*y(.9900000095367432),(0|n)!=(0|(c=c+1|0)););O=i+32|0},r[786]=function(e,t){e|=0,t=y(t);var i,n=0,o=0,a=0,l=y(0),c=0,h=0,_=y(0),p=0,f=y(0),g=y(0),v=0,A=0,C=y(0),S=y(0),T=0,E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0);if(O=i=O-96|0,o=d[e+136>>2]){if((0|(a=d[e+8>>2]))<(0|o)){if(d[e+12>>2]<(0|o)){if(d[7717]=d[7717]+1,h=0|r[d[6606]](o<<4,16),(0|(v=d[e+8>>2]))>=1)for(;p=(c=n<<4)+h|0,c=c+d[e+16>>2]|0,T=d[c+4>>2],d[p>>2]=d[c>>2],d[p+4>>2]=T,A=d[c+12>>2],d[p+8>>2]=d[c+8>>2],d[p+12>>2]=A,(0|v)!=(0|(n=n+1|0)););(n=d[e+16>>2])&&(u[e+20|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+16>>2]=0),d[e+16>>2]=h,d[e+12>>2]=o,s[e+20|0]=1}for(;c=d[i+52>>2],n=d[e+16>>2]+(a<<4)|0,d[n>>2]=d[i+48>>2],d[n+4>>2]=c,c=d[i+60>>2],d[n+8>>2]=d[i+56>>2],d[n+12>>2]=c,(0|o)!=(0|(a=a+1|0)););}if(d[e+8>>2]=o,(0|(a=d[e+28>>2]))<(0|o)){if(d[e+32>>2]<(0|o)){if(d[7717]=d[7717]+1,h=0|r[d[6606]](o<<4,16),(0|(v=d[e+28>>2]))>=1)for(n=0;p=(c=n<<4)+h|0,c=c+d[e+36>>2]|0,T=d[c+4>>2],d[p>>2]=d[c>>2],d[p+4>>2]=T,A=d[c+12>>2],d[p+8>>2]=d[c+8>>2],d[p+12>>2]=A,(0|v)!=(0|(n=n+1|0)););(n=d[e+36>>2])&&(u[e+40|0]&&n&&(d[7718]=d[7718]+1,r[d[6607]](n)),d[e+36>>2]=0),d[e+36>>2]=h,d[e+32>>2]=o,s[e+40|0]=1}for(;c=d[i+52>>2],n=d[e+36>>2]+(a<<4)|0,d[n>>2]=d[i+48>>2],d[n+4>>2]=c,c=d[i+60>>2],d[n+8>>2]=d[i+56>>2],d[n+12>>2]=c,(0|o)!=(0|(a=a+1|0)););}if(d[e+28>>2]=o,(0|(p=d[e+48>>2]))<(0|o)){e:if(d[e+52>>2]>=(0|o))c=o<<2,n=d[e+56>>2];else{if(d[7717]=d[7717]+1,c=o<<2,n=0|r[d[6606]](c,16),h=d[e+56>>2],(0|(v=d[e+48>>2]))>=1)for(a=0;d[(A=a<<2)+n>>2]=d[h+A>>2],(0|v)!=(0|(a=a+1|0)););else if(!h){d[e+56>>2]=n,d[e+52>>2]=o,s[e+60|0]=1;break e}u[e+60|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+56>>2]=n,s[e+60|0]=1,d[e+52>>2]=o}Mn((a=p<<2)+n|0,0,c-a|0)}if(d[e+48>>2]=o,(0|(p=d[e+68>>2]))<(0|o)){e:if(d[e+72>>2]>=(0|o))c=o<<2,n=d[e+76>>2];else{if(d[7717]=d[7717]+1,c=o<<2,n=0|r[d[6606]](c,16),h=d[e+76>>2],(0|(v=d[e+68>>2]))>=1)for(a=0;d[(A=a<<2)+n>>2]=d[h+A>>2],(0|v)!=(0|(a=a+1|0)););else if(!h){d[e+76>>2]=n,d[e+72>>2]=o,s[e+80|0]=1;break e}u[e+80|0]&&h&&(d[7718]=d[7718]+1,r[d[6607]](h)),d[e+76>>2]=n,s[e+80|0]=1,d[e+72>>2]=o}Mn((a=p<<2)+n|0,0,c-a|0)}if(d[e+68>>2]=o,!((0|(n=d[e+136>>2]))<1)){for(o=d[e+56>>2],c=d[e+76>>2],a=0;d[(h=a<<2)+c>>2]=0,d[o+h>>2]=0,(0|(a=a+1|0))!=(0|n););if(!((0|n)<1)){for(c=i- -64|0,a=0;o=d[e+144>>2]+b(a,284)|0,(p=d[o+88>>2])&&(n=d[o+104>>2],d[i+56>>2]=d[o+100>>2],d[i+60>>2]=n,n=d[o+96>>2],d[i+48>>2]=d[o+92>>2],d[i+52>>2]=n,n=d[o+120>>2],d[c+8>>2]=d[o+116>>2],d[c+12>>2]=n,n=d[o+112>>2],d[c>>2]=d[o+108>>2],d[c+4>>2]=n,n=d[o+136>>2],d[i+88>>2]=d[o+132>>2],d[i+92>>2]=n,n=d[o+128>>2],d[i+80>>2]=d[o+124>>2],d[i+84>>2]=n,n=(i+48|0)+(d[e+120>>2]<<2)|0,v=d[n>>2],A=d[n+16>>2],T=d[n+32>>2],n=(h=a<<4)+d[e+36>>2]|0,d[n+12>>2]=0,d[n+8>>2]=T,d[n+4>>2]=A,d[n>>2]=v,n=h+d[e+36>>2]|0,f=m[n+8>>2],_=m[n>>2],g=m[o>>2],C=m[n+4>>2],S=m[o+4>>2],E=m[o+8>>2],l=y(y(y(_*g)+y(C*S))+y(f*E)),f=y(f-y(E*l)),_=y(_-y(g*l)),g=y(C-y(S*l)),l=y(y(1)/y(x(y(y(f*f)+y(y(_*_)+y(g*g)))))),f=y(f*l),m[n+8>>2]=f,g=y(g*l),m[n+4>>2]=g,l=y(_*l),m[n>>2]=l,_=m[o+8>>2],C=m[o>>2],S=m[o+4>>2],n=h+d[e+16>>2]|0,d[n+12>>2]=0,m[n+8>>2]=y(g*C)-y(S*l),m[n+4>>2]=y(_*l)-y(f*C),m[n>>2]=y(S*f)-y(_*g),n=h+d[e+16>>2]|0,g=l=m[n+8>>2],f=m[n>>2],_=m[n+4>>2],l=y(y(1)/y(x(y(y(y(f*f)+y(_*_))+y(l*l))))),m[n+8>>2]=g*l,m[n+4>>2]=_*l,m[n>>2]=f*l,A=n=o+16|0,n=a<<2,zt(d[e+116>>2],A,p,A,h+d[e+36>>2]|0,n+d[e+76>>2]|0),n=n+d[e+76>>2]|0,m[n>>2]=m[6604]*m[n>>2],n=d[e+136>>2]),(0|(a=a+1|0))<(0|n););if(!((0|n)<1)){for(n=d[e+144>>2],c=0,a=0;;){e:{t:{i:{if(p=b(a,284),o=d[88+(h=p+n|0)>>2]){if((l=m[h+252>>2])==y(0))break i;l=y(l*t);break t}d[d[e+56>>2]+(a<<2)>>2]=0,d[h+280>>2]=1065353216;break e}l=m[h+256>>2],vi(i+48|0,d[e+116>>2],o,h+16|0,d[e+16>>2]+(a<<4)|0,l==y(0)?y(0):l),l=m[i+92>>2],f=y(-l),_=m[i+64>>2],n=d[i+48>>2],g=y(_-m[n+60>>2]),C=m[n+332>>2],S=m[i+60>>2],E=y(S-m[n+56>>2]),R=m[n+336>>2],o=d[i+52>>2],_=y(_-m[o+60>>2]),I=m[o+332>>2],S=y(S-m[o+56>>2]),M=m[o+336>>2],F=y(y(y(y(y(g*C)-y(E*R))+m[n+312>>2])-y(y(y(_*I)-y(S*M))+m[o+312>>2]))*m[i+72>>2]),D=m[i+56>>2],w=y(D-m[n+52>>2]),P=g,g=m[n+328>>2],B=y(m[n+316>>2]+y(y(w*R)-y(P*g))),R=y(D-m[o+52>>2]),P=_,_=m[o+328>>2],l=(l=l<(_=y(m[i+88>>2]*y(-y(y(F+y(y(B-y(m[o+316>>2]+y(y(R*M)-y(P*_))))*m[i+76>>2]))+y(y(y(y(y(E*g)-y(w*C))+m[n+320>>2])-y(y(y(S*_)-y(R*I))+m[o+320>>2]))*m[i+80>>2])))))?l:_)>2]}A=(v=a<<2)+d[e+56>>2]|0,d[A>>2]=0,d[280+(o=n+p|0)>>2]=1065353216,f=m[h+228>>2],_=m[h+276>>2],m[A>>2]=l,l=y(l*y(.5)),g=y(l*l),l=m[v+d[e+76>>2]>>2],g=y(g+y(l*l)),l=y(f*y(_*t)),g>y(l*l)&&(m[o+280>>2]=y(l/y(x(g)))*m[o+280>>2],c=1)}if(!((0|(a=a+1|0))<(0|(o=d[e+136>>2]))))break}if(!(1&((p=-1^c)|(c=(0|o)<1))))for(h=d[e+76>>2],a=0;m[(n=(p=a<<2)+h|0)>>2]!=y(0)&&(v=d[e+144>>2]+b(a,284)|0,(t=m[v+280>>2])>2]|0,m[p>>2]=t*m[p>>2],m[n>>2]=m[v+280>>2]*m[n>>2])),(0|o)!=(0|(a=a+1|0)););if(!c)for(a=0;n=(h=b(a,284))+d[e+144>>2]|0,t=m[n+16>>2],o=d[e+116>>2],l=m[o+52>>2],f=m[n+20>>2],_=m[o+56>>2],g=m[n+24>>2],C=m[o+60>>2],d[i+60>>2]=0,m[i+56>>2]=g-C,m[i+52>>2]=f-_,m[i+48>>2]=t-l,(t=m[(p=a<<2)+d[e+56>>2]>>2])!=y(0)&&(c=d[e+16>>2]+(a<<4)|0,l=m[c>>2],f=m[c+4>>2],_=m[c+8>>2],d[i+44>>2]=0,m[i+40>>2]=t*_,m[i+36>>2]=t*f,m[i+32>>2]=l*t,Vs(o,i+32|0,i+48|0)),p=p+d[e+76>>2]|0,m[p>>2]!=y(0)&&(o=d[88+(h+d[e+144>>2]|0)>>2],t=m[o+52>>2],l=m[o+56>>2],f=m[o+60>>2],_=m[n+16>>2],g=m[n+20>>2],C=m[n+24>>2],d[i+44>>2]=0,m[i+40>>2]=C-f,m[i+36>>2]=g-l,m[i+32>>2]=_-t,c=d[e+36>>2]+(a<<4)|0,l=m[c>>2],f=m[c+4>>2],_=m[c+8>>2],t=m[p>>2],d[i+28>>2]=0,m[i+24>>2]=t*_,m[i+20>>2]=t*f,m[i+16>>2]=l*t,c=(h=d[e+116>>2])+(d[e+124>>2]<<2)|0,l=m[c+36>>2],f=m[c+4>>2],_=m[i+48>>2],g=m[c+20>>2],C=m[i+52>>2],S=m[i+56>>2],t=y(y(y(y(f*_)+y(g*C))+y(l*S))*y(y(1)-m[n+244>>2])),m[i+56>>2]=S-y(l*t),m[i+52>>2]=C-y(g*t),m[i+48>>2]=_-y(f*t),Vs(h,i+16|0,i+48|0),d[i+12>>2]=0,m[i+8>>2]=-m[i+24>>2],m[i+4>>2]=-m[i+20>>2],m[i>>2]=-m[i+16>>2],Vs(o,i,i+32|0)),(0|(a=a+1|0))>2];);}}}}O=i+96|0},r[787]=function(e,t,i,n){t|=0,i|=0,n|=0,d[128+(e|=0)>>2]=n,d[e+124>>2]=i,d[e+120>>2]=t},r[788]=Pd,r[789]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o=0,a=y(0),l=y(0),c=y(0),h=y(0);return O=s=O-96|0,d[s+20>>2]=-65535,d[s+24>>2]=0,d[s+12>>2]=1065353216,d[s+16>>2]=0,d[s+8>>2]=1740,o=d[t+12>>2],d[s+36>>2]=d[t+8>>2],d[s+40>>2]=o,o=d[t+4>>2],d[s+28>>2]=d[t>>2],d[s+32>>2]=o,o=d[i+12>>2],d[s+52>>2]=d[i+8>>2],d[s+56>>2]=o,o=d[i+4>>2],d[s+44>>2]=d[i>>2],d[s+48>>2]=o,e=d[e+4>>2],r[d[d[e>>2]+32>>2]](e,t,i,s+8|0),i=0,!(e=d[s+16>>2])|!(2&u[e+236|0])|4&u[e+204|0]||(t=d[s+80>>2],d[n>>2]=d[s+76>>2],d[n+4>>2]=t,t=d[s+88>>2],d[n+8>>2]=d[s+84>>2],d[n+12>>2]=t,t=d[s+64>>2],d[n+16>>2]=d[s+60>>2],d[n+20>>2]=t,t=d[s+72>>2],d[n+24>>2]=d[s+68>>2],d[n+28>>2]=t,a=m[n+16>>2],l=m[n+20>>2],c=m[n+24>>2],h=y(y(1)/y(x(y(y(y(a*a)+y(l*l))+y(c*c))))),m[n+16>>2]=a*h,m[n+24>>2]=c*h,m[n+20>>2]=l*h,d[n+32>>2]=d[s+12>>2],i=e),O=s+96|0,0|i},r[790]=function(e){var t;return d[(e|=0)>>2]=20152,(t=d[e+140>>2])&&(u[e+144|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+140>>2]=0),d[e+140>>2]=0,s[e+144|0]=1,d[e+132>>2]=0,d[e+136>>2]=0,0|e},r[791]=function(e){var t;d[(e|=0)>>2]=20152,(t=d[e+140>>2])&&(u[e+144|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+140>>2]=0),d[e+140>>2]=0,s[e+144|0]=1,d[e+132>>2]=0,d[e+136>>2]=0,e&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[792]=function(e,t,i){e|=0,t|=0,i=y(i),r[d[d[e>>2]+32>>2]](e,t),r[d[d[e>>2]+36>>2]](e,t,i)},r[793]=Rd,r[794]=function(e,t){e|=0,t|=0;var i=y(0),n=y(0),r=y(0),o=0,a=y(0);s[e+171|0]=1,o=d[t+4>>2],d[e+60>>2]=d[t>>2],d[e+64>>2]=o,o=d[t+12>>2],d[e+68>>2]=d[t+8>>2],d[e+72>>2]=o,i=m[e+60>>2],a=m[e- -64>>2],n=m[e+68>>2],r=y(y(1)/y(x(y(y(y(i*i)+y(a*a))+y(n*n))))),n=y(n*r),i=y(i*r),r=y(a*r),t=d[e+72>>2],y(x(y(y(n*n)+y(y(i*i)+y(r*r)))))>2]=i,d[e+88>>2]=t,m[e+84>>2]=n,m[e+80>>2]=r},r[795]=function(e,t,i){e|=0,t|=0,i=y(i);var n=y(0),r=y(0),o=y(0),a=0,l=y(0),c=0;s[e+171|0]=0,a=d[t+4>>2],d[e+60>>2]=d[t>>2],d[e+64>>2]=a,a=d[t+12>>2],d[e+68>>2]=d[t+8>>2],d[e+72>>2]=a,n=m[e+60>>2],l=m[e- -64>>2],r=m[e+68>>2],o=y(y(1)/y(x(y(y(y(n*n)+y(l*l))+y(r*r))))),r=y(r*o),n=y(n*o),o=y(l*o),y(x(y(y(r*r)+y(y(n*n)+y(o*o)))))>2],m[e+76>>2]=n,d[e+88>>2]=c,m[e+84>>2]=r,m[e+80>>2]=o,m[e+172>>2]=m[e+172>>2]+i},r[796]=function(e,t){t|=0;var i=0,n=0,s=0,o=0,a=0;if(d[172+(e|=0)>>2]=0,_[e+168>>1]=0,d[e+16>>2]=0,d[e+20>>2]=0,d[e+60>>2]=0,d[e+64>>2]=0,d[e+68>>2]=0,d[e+72>>2]=0,e=d[d[e+8>>2]+284>>2],d[4+(0|r[d[d[e>>2]+28>>2]](e))>>2]>=1)for(;n=e,s=d[d[12+(0|r[d[d[e>>2]+28>>2]](e))>>2]>>2],o=d[d[12+(0|r[d[d[e>>2]+28>>2]](e))>>2]+4>>2],a=d[t+24>>2],i=d[d[e>>2]+12>>2],r[i](0|n,0|s,0|o,0|a),d[4+(0|r[d[d[e>>2]+28>>2]](e))>>2]>0;);},r[797]=function(e,t){e|=0,t|=0;var i,n=0;d[12+(i=O-32|0)>>2]=0,n=d[t+12>>2],d[i+24>>2]=d[t+8>>2],d[i+28>>2]=n,n=d[t+4>>2],d[i+16>>2]=d[t>>2],d[i+20>>2]=n,e=d[e+8>>2],d[e+4>>2]=1065353216,d[e+44>>2]=1065353216,d[e+48>>2]=0,d[e+36>>2]=0,d[e+40>>2]=0,d[e+28>>2]=0,d[e+32>>2]=0,d[e+24>>2]=1065353216,d[e+16>>2]=0,d[e+20>>2]=0,d[e+8>>2]=0,d[e+12>>2]=0,d[e+260>>2]=d[e+260>>2]+1,t=d[i+20>>2],d[e+52>>2]=d[i+16>>2],d[e+56>>2]=t,t=d[i+28>>2],d[e+60>>2]=d[i+24>>2],d[e+64>>2]=t},r[798]=function(e,t){t|=0;var i,n=0,r=0;s[148+(e|=0)|0]=0,ke(e,t)&&(s[e+148|0]=1,ke(e,t)&&(s[e+148|0]=1,ke(e,t)&&(s[e+148|0]=1,ke(e,t)&&(s[e+148|0]=1,ke(e,t)&&(s[e+148|0]=1))))),t=d[e+8>>2],r=d[4+(n=t+52|0)>>2],d[e+92>>2]=d[n>>2],d[e+96>>2]=r,n=d[t+64>>2],d[e+100>>2]=d[t+60>>2],d[e+104>>2]=n,n=d[t+52>>2],r=d[t+56>>2],i=d[t+64>>2],d[e+120>>2]=d[t+60>>2],d[e+124>>2]=i,d[e+112>>2]=n,d[e+116>>2]=r},r[799]=function(e,t,i){e|=0,t|=0,i=y(i);var n,o=0,a=y(0),l=0,c=y(0),h=y(0),f=y(0);O=n=O-80|0,m[e+172>>2]<=y(0)&&!u[e+171|0]||(s[e+168|0]=r[d[d[e>>2]+48>>2]](e),a=y(m[e+16>>2]-y(m[e+44>>2]*i)),m[e+16>>2]=a,a>y(0)&&a>(c=m[e+28>>2])&&(m[e+16>>2]=c,a=c),a>2])),y(v(a))>c&&(a=y(-c),m[e+16>>2]=a)),m[e+20>>2]=a*i,o=d[e+8>>2],l=d[o+16>>2],d[n+24>>2]=d[o+12>>2],d[n+28>>2]=l,l=d[o+8>>2],d[n+16>>2]=d[o+4>>2],d[n+20>>2]=l,l=d[o+32>>2],d[n+40>>2]=d[o+28>>2],d[n+44>>2]=l,l=d[o+24>>2],d[n+32>>2]=d[o+20>>2],d[n+36>>2]=l,l=d[o+48>>2],d[n+56>>2]=d[o+44>>2],d[n+60>>2]=l,l=d[o+40>>2],d[n+48>>2]=d[o+36>>2],d[n+52>>2]=l,l=d[o+64>>2],d[n+72>>2]=d[o+60>>2],d[n+76>>2]=l,l=d[o+56>>2],d[n+64>>2]=d[o+52>>2],d[n+68>>2]=l,function(e,t){var i,n=0,o=y(0),a=y(0),l=0,c=y(0),h=y(0),f=y(0);O=i=O-240|0,1&s[30544]||mc(30544)&&(d[7625]=0,d[7626]=0,d[7624]=1065353216,d[7627]=0,d[7628]=0,d[7630]=0,d[7631]=0,d[7629]=1065353216,d[7632]=0,d[7633]=0,d[7634]=1065353216,d[7635]=0,uh(30544)),n=d[e+176>>2]<<4,c=m[n+30496>>2],a=m[n+30500>>2],o=m[n+30504>>2],d[e+124>>2]=0,h=o,o=m[e+20>>2],o=y(m[e+52>>2]+(o>y(0)?o:y(0))),m[e+120>>2]=y(h*o)+m[e+100>>2],m[e+116>>2]=y(a*o)+m[e+96>>2],m[e+112>>2]=m[e+92>>2]+y(c*o),d[i+132>>2]=1065353216,d[i+136>>2]=0,d[i+140>>2]=0,d[i+124>>2]=0,d[i+128>>2]=0,d[i+152>>2]=1065353216,d[i+236>>2]=0,d[i+228>>2]=0,d[i+232>>2]=0,d[i+216>>2]=1065353216,d[i+220>>2]=0,d[i+224>>2]=0,d[i+172>>2]=0,d[i+164>>2]=0,d[i+168>>2]=0,d[i+156>>2]=0,d[i+160>>2]=0,d[i+196>>2]=1065353216,d[i+200>>2]=0,d[i+204>>2]=0,d[i+188>>2]=0,d[i+192>>2]=0,d[i+144>>2]=0,d[i+148>>2]=0,d[i+112>>2]=1065353216,d[i+116>>2]=0,d[i+120>>2]=0,d[i+208>>2]=0,d[i+212>>2]=0,d[i+180>>2]=0,d[i+184>>2]=0,d[i+176>>2]=1065353216,1&s[30544]||mc(30544)&&(d[7625]=0,d[7626]=0,d[7624]=1065353216,d[7627]=0,d[7628]=0,d[7630]=0,d[7631]=0,d[7629]=1065353216,d[7632]=0,d[7633]=0,d[7634]=1065353216,d[7635]=0,uh(30544)),l=d[e+176>>2],n=d[e+12>>2],h=y(r[d[d[n>>2]+48>>2]](n)),f=m[e+92>>2],c=m[e+96>>2],a=m[e+100>>2],o=m[e+56>>2],d[i+236>>2]=0,o=y(h+o),n=l<<4,m[i+232>>2]=a+y(o*m[n+30504>>2]),m[i+228>>2]=c+y(o*m[n+30500>>2]),m[i+224>>2]=f+y(m[n+30496>>2]*o),n=d[e+124>>2],d[i+168>>2]=d[e+120>>2],d[i+172>>2]=n,n=d[e+116>>2],d[i+160>>2]=d[e+112>>2],d[i+164>>2]=n,l=d[e+8>>2],1&s[30544]||mc(30544)&&(d[7625]=0,d[7626]=0,d[7624]=1065353216,d[7627]=0,d[7628]=0,d[7630]=0,d[7631]=0,d[7629]=1065353216,d[7632]=0,d[7633]=0,d[7634]=1065353216,d[7635]=0,uh(30544)),n=d[e+176>>2],d[i+28>>2]=0,d[i+32>>2]=0,d[i+36>>2]=0,d[i+40>>2]=0,d[i+44>>2]=0,d[i+48>>2]=0,d[i+104>>2]=0,d[i+108>>2]=1060439169,n<<=4,m[i+100>>2]=-m[n+30504>>2],m[i+96>>2]=-m[n+30500>>2],d[i+84>>2]=0,d[i+12>>2]=1065353216,d[i+20>>2]=0,d[i+24>>2]=0,d[i+88>>2]=l,d[i+8>>2]=20308,m[i+92>>2]=-m[n+30496>>2],l=d[e+8>>2],n=d[l+188>>2],_[i+16>>1]=p[n+4>>1],_[i+18>>1]=p[n+6>>1],u[e+170|0]?Ye(l,d[e+12>>2],i+176|0,i+112|0,i+8|0,m[t+56>>2]):Ae(t,d[e+12>>2],i+176|0,i+112|0,i+8|0,y(0)),m[i+12>>2]>2]<<4,y(y(y(m[i+52>>2]*m[t+30496>>2])+y(m[i+56>>2]*m[t+30500>>2]))+y(m[i+60>>2]*m[t+30504>>2]))>y(0)&&(a=m[i+12>>2],m[e+108>>2]=m[e+52>>2]*a,u[e+180|0]?(o=y(y(1)-a),m[e+92>>2]=y(o*m[e+92>>2])+y(a*m[e+112>>2]),m[e+96>>2]=y(o*m[e+96>>2])+y(a*m[e+116>>2]),m[e+100>>2]=y(o*m[e+100>>2])+y(a*m[e+120>>2])):(t=d[e+116>>2],d[e+92>>2]=d[e+112>>2],d[e+96>>2]=t,t=d[e+124>>2],d[e+100>>2]=d[e+120>>2],d[e+104>>2]=t)),d[e+16>>2]=0,d[e+20>>2]=0):(d[e+108>>2]=d[e+52>>2],t=d[e+124>>2],d[e+100>>2]=d[e+120>>2],d[e+104>>2]=t,t=d[e+116>>2],d[e+92>>2]=d[e+112>>2],d[e+96>>2]=t),O=i+240|0}(e,t),o=n- -64|0,u[e+171|0]?Je(e,t,e+60|0):(a=m[e+172>>2],m[e+172>>2]=a-i,c=m[e- -64>>2],h=m[e+68>>2],f=m[e+60>>2],d[n+12>>2]=0,a=a>i?i:a,m[n+8>>2]=h*a,m[n+4>>2]=a*c,m[n>>2]=a*f,Je(e,t,n)),function(e,t,i){var n,r=0,o=y(0),a=y(0),l=0,c=0,h=0,f=0,g=y(0),b=y(0),v=y(0),A=y(0),C=0,S=y(0),x=y(0);O=n=O-416|0,r=d[e+124>>2],d[n+216>>2]=d[e+120>>2],d[n+220>>2]=r,r=d[e+116>>2],d[n+208>>2]=d[e+112>>2],d[n+212>>2]=r,o=m[e+16>>2],(o=y((oy(0)&&(o>(a=m[e+24>>2])^1|(u[e+169|0]?!u[e+168|0]:0)||(o=a)),1&s[30544]||mc(30544)&&(d[7625]=0,d[7626]=0,d[7624]=1065353216,d[7627]=0,d[7628]=0,d[7630]=0,d[7631]=0,d[7629]=1065353216,d[7632]=0,d[7633]=0,d[7634]=1065353216,d[7635]=0,uh(30544)),r=d[e+176>>2]<<4,a=m[r+30504>>2],g=m[r+30500>>2],o=y(o+m[e+108>>2]),b=y(m[r+30496>>2]*o),m[e+112>>2]=m[e+112>>2]-b,g=y(o*g),m[e+116>>2]=m[e+116>>2]-g,v=y(o*a),m[e+120>>2]=m[e+120>>2]-v,r=d[e+8>>2],1&s[30544]||mc(30544)&&(d[7625]=0,d[7626]=0,d[7624]=1065353216,d[7627]=0,d[7628]=0,d[7630]=0,d[7631]=0,d[7629]=1065353216,d[7632]=0,d[7633]=0,d[7634]=1065353216,d[7635]=0,uh(30544)),l=d[e+40>>2],c=d[e+176>>2],d[n+124>>2]=0,d[n+128>>2]=0,d[n+132>>2]=0,d[n+136>>2]=0,d[n+140>>2]=0,d[n+144>>2]=0,h=d[4+(f=30504+(c<<=4)|0)>>2],d[n+196>>2]=d[f>>2],d[n+200>>2]=h,d[n+108>>2]=1065353216,d[n+116>>2]=0,d[n+120>>2]=0,d[n+184>>2]=r,d[n+104>>2]=20308,d[n+204>>2]=l,l=d[4+(r=c+30496|0)>>2],d[n+188>>2]=d[r>>2],d[n+192>>2]=l,d[n+180>>2]=0,r=d[e+8>>2],l=d[r+188>>2],_[n+112>>1]=p[l+4>>1],_[n+114>>1]=p[l+6>>1],1&s[30544]||mc(30544)&&(d[7625]=0,d[7626]=0,d[7624]=1065353216,d[7627]=0,d[7628]=0,d[7630]=0,d[7631]=0,d[7629]=1065353216,d[7632]=0,d[7633]=0,d[7634]=1065353216,d[7635]=0,uh(30544)),l=d[e+40>>2],c=d[e+176>>2],d[n+20>>2]=0,d[n+24>>2]=0,d[n+28>>2]=0,d[n+32>>2]=0,d[n+36>>2]=0,d[n+40>>2]=0,h=d[4+(f=30504+(c<<=4)|0)>>2],d[n+92>>2]=d[f>>2],d[n+96>>2]=h,d[n+76>>2]=0,d[n+4>>2]=1065353216,d[n+12>>2]=0,d[n+16>>2]=0,d[n+80>>2]=r,d[n>>2]=20308,d[n+100>>2]=l,l=d[4+(r=c+30496|0)>>2],d[n+84>>2]=d[r>>2],d[n+88>>2]=l,r=d[d[e+8>>2]+188>>2],_[n+8>>1]=p[r+4>>1],_[n+10>>1]=p[r+6>>1],l=n+224|4,c=n+288|4,f=n+352|4,o=m[e+120>>2],a=m[e+116>>2],A=m[e+112>>2],h=0;e:{for(;;){d[n+352>>2]=1065353216,d[(r=f)+8>>2]=0,d[r+12>>2]=0,d[r>>2]=0,d[r+4>>2]=0,d[n+372>>2]=1065353216,d[n+384>>2]=0,d[n+388>>2]=0,d[n+376>>2]=0,d[n+380>>2]=0,d[n+392>>2]=1065353216,d[n+396>>2]=0,d[n+288>>2]=1065353216,d[(r=c)+8>>2]=0,d[r+12>>2]=0,d[r>>2]=0,d[r+4>>2]=0,d[n+308>>2]=1065353216,d[n+320>>2]=0,d[n+324>>2]=0,d[n+312>>2]=0,d[n+316>>2]=0,d[n+328>>2]=1065353216,d[n+332>>2]=0,d[n+224>>2]=1065353216,d[(r=l)+8>>2]=0,d[r+12>>2]=0,d[r>>2]=0,d[r+4>>2]=0,d[n+244>>2]=1065353216,d[n+256>>2]=0,d[n+260>>2]=0,d[n+248>>2]=0,d[n+252>>2]=0,d[n+264>>2]=1065353216,d[n+268>>2]=0,r=d[e+104>>2],d[n+408>>2]=d[e+100>>2],d[n+412>>2]=r,r=d[e+96>>2],d[n+400>>2]=d[e+92>>2],d[n+404>>2]=r,r=d[e+124>>2],d[n+344>>2]=d[e+120>>2],d[n+348>>2]=r,r=d[e+116>>2],d[n+336>>2]=d[e+112>>2],d[n+340>>2]=r,m[n+276>>2]=a-g,m[n+280>>2]=o-v,d[n+284>>2]=0,m[n+272>>2]=A-b;t:if(u[e+170|0]){if(Ye(d[e+8>>2],d[e+12>>2],n+352|0,n+288|0,n+104|0,m[t+56>>2]),m[n+108>>2]>2],d[e+12>>2],n+352|0,n+224|0,n,m[t+56>>2])}else Ae(t,d[e+12>>2],n+352|0,n+288|0,n+104|0,m[t+56>>2]),m[n+108>>2]>2],n+352|0,n+224|0,n,m[t+56>>2]);o=m[e+16>>2],o=y((o>2]>2]>2]y(0)&&!(1&(o<(a=m[e+52>>2])^-1|-1^r|h))){if(u[e+168|0]|!u[e+169|0])break i;h=0}if((a=m[n+108>>2])>2],a=C?u[e+181|0]?a:y(y(i-m[n+168>>2])*y(.5)):a,s[e+181|0]=0,s[e+169|0]=0,d[e+16>>2]=0,d[e+20>>2]=0,o=y(y(1)-a),m[e+92>>2]=y(o*m[e+92>>2])+y(a*m[e+112>>2]),m[e+96>>2]=y(i*o)+y(a*m[e+116>>2]),m[e+100>>2]=y(o*m[e+100>>2])+y(a*m[e+120>>2]);break e}r=d[n+212>>2],d[e+112>>2]=d[n+208>>2],d[e+116>>2]=r,r=d[n+220>>2],d[e+120>>2]=d[n+216>>2],d[e+124>>2]=r,1&s[30544]||mc(30544)&&(d[7625]=0,d[7626]=0,d[7624]=1065353216,d[7627]=0,d[7628]=0,d[7630]=0,d[7631]=0,d[7629]=1065353216,d[7632]=0,d[7633]=0,d[7634]=1065353216,d[7635]=0,uh(30544)),r=d[e+176>>2]<<4,S=m[r+30504>>2],x=m[r+30500>>2],o=y(a+m[e+108>>2]),A=y(m[e+112>>2]-y(m[r+30496>>2]*o)),m[e+112>>2]=A,a=y(m[e+116>>2]-y(o*x)),m[e+116>>2]=a,o=y(m[e+120>>2]-y(o*S)),m[e+120>>2]=o,h=1;continue}break}s[e+181|0]=1,C&&(o>(i=m[e+24>>2])^1|(u[e+169|0]?!u[e+168|0]:0)||(m[e+112>>2]=b+m[e+112>>2],m[e+116>>2]=g+m[e+116>>2],m[e+120>>2]=v+m[e+120>>2],1&s[30544]||mc(30544)&&(d[7625]=0,d[7626]=0,d[7624]=1065353216,d[7627]=0,d[7628]=0,d[7630]=0,d[7631]=0,d[7629]=1065353216,d[7632]=0,d[7633]=0,d[7634]=1065353216,d[7635]=0,uh(30544)),t=d[e+176>>2]<<4,o=m[t+30504>>2],a=m[t+30500>>2],i=y(i+m[e+108>>2]),m[e+112>>2]=m[e+112>>2]-y(m[t+30496>>2]*i),m[e+116>>2]=m[e+116>>2]-y(i*a),m[e+120>>2]=m[e+120>>2]-y(i*o))),t=d[e+116>>2],d[e+92>>2]=d[e+112>>2],d[e+96>>2]=t,t=d[e+124>>2],d[e+100>>2]=d[e+120>>2],d[e+104>>2]=t}O=n+416|0}(e,t,i),t=d[e+104>>2],d[o+8>>2]=d[e+100>>2],d[o+12>>2]=t,t=d[e+96>>2],d[o>>2]=d[e+92>>2],d[o+4>>2]=t,e=d[e+8>>2],d[e+260>>2]=d[e+260>>2]+1,t=d[n+28>>2],d[e+12>>2]=d[n+24>>2],d[e+16>>2]=t,t=d[n+20>>2],d[e+4>>2]=d[n+16>>2],d[e+8>>2]=t,t=d[n+44>>2],d[e+28>>2]=d[n+40>>2],d[e+32>>2]=t,t=d[n+36>>2],d[e+20>>2]=d[n+32>>2],d[e+24>>2]=t,t=d[n+52>>2],d[e+36>>2]=d[n+48>>2],d[e+40>>2]=t,t=d[n+60>>2],d[e+44>>2]=d[n+56>>2],d[e+48>>2]=t,t=d[o+4>>2],d[e+52>>2]=d[o>>2],d[e+56>>2]=t,t=d[o+12>>2],d[e+60>>2]=d[o+8>>2],d[e+64>>2]=t),O=n+80|0},r[800]=function(e){return 0|r[d[d[(e|=0)>>2]+48>>2]](e)},r[801]=function(e){r[d[d[(e|=0)>>2]+40>>2]](e)&&(s[e+169|0]=1,d[e+16>>2]=d[e+28>>2])},r[802]=function(e){return m[16+(e|=0)>>2]!=y(0)?0:m[e+20>>2]==y(0)|0},r[803]=function(e,t){t|=0,s[180+(e|=0)|0]=t},r[804]=Pd,r[805]=function(e,t,i){e|=0,t|=0,i|=0;var n,r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=0,_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0);return s=y(1),(0|(n=d[t>>2]))==d[e+80>>2]|4&u[n+204|0]||(i?(o=m[t+16>>2],a=m[t+12>>2],r=m[t+8>>2]):(r=m[t+8>>2],l=m[t+12>>2],c=m[t+16>>2],o=y(y(y(r*m[n+36>>2])+y(l*m[n+40>>2]))+y(c*m[n+44>>2])),a=y(y(y(r*m[n+20>>2])+y(l*m[n+24>>2]))+y(c*m[n+28>>2])),r=y(y(y(m[n+4>>2]*r)+y(m[n+8>>2]*l))+y(m[n+12>>2]*c))),y(y(y(r*m[e+84>>2])+y(a*m[e+88>>2]))+y(o*m[e+92>>2]))>2]||(h=d[t+40>>2],d[e+76>>2]=n,d[e+4>>2]=h,i?(i=d[t+12>>2],d[e+44>>2]=d[t+8>>2],d[e+48>>2]=i,i=d[t+20>>2],d[e+52>>2]=d[t+16>>2],d[e+56>>2]=i):(r=m[n+8>>2],l=m[n+12>>2],c=m[n+20>>2],_=m[n+24>>2],p=m[n+28>>2],f=m[n+36>>2],g=m[n+40>>2],s=m[t+12>>2],b=m[n+44>>2],o=m[t+16>>2],v=m[n+4>>2],a=m[t+8>>2],d[e+56>>2]=0,m[e+52>>2]=y(y(a*f)+y(s*g))+y(o*b),m[e+48>>2]=y(y(a*c)+y(s*_))+y(o*p),m[e+44>>2]=y(y(v*a)+y(r*s))+y(l*o)),i=d[t+28>>2],d[e+60>>2]=d[t+24>>2],d[e+64>>2]=i,i=d[t+36>>2],d[e+68>>2]=d[t+32>>2],d[e+72>>2]=i,s=m[t+40>>2])),y(s)},r[806]=function(e){var t;return d[(e|=0)>>2]=20392,(t=d[e+32>>2])&&(u[e+36|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+32>>2]=0),d[e+32>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0,0|e},r[807]=function(e){var t;d[(e|=0)>>2]=20392,!(t=d[e+32>>2])|!u[e+36|0]||t&&(d[7718]=d[7718]+1,r[d[6607]](t)),ve(e)},r[808]=Cd,r[809]=xd,r[810]=function(e,t,i){t|=0,i|=0;var n,o=0,a=0,l=0,c=0;if((0|(i=d[24+(e|=0)>>2]))<(0|(n=d[t+4>>2]))){if(d[e+28>>2]<(0|n)){if(n?(d[7717]=d[7717]+1,l=0|r[d[6606]](n<<2,16),o=d[e+24>>2]):o=i,(0|o)>=1)for(;d[(c=a<<2)+l>>2]=d[d[e+32>>2]+c>>2],(0|o)!=(0|(a=a+1|0)););(o=d[e+32>>2])&&(u[e+36|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+32>>2]=0),d[e+32>>2]=l,d[e+28>>2]=n,s[e+36|0]=1}for(;d[d[e+32>>2]+(i<<2)>>2]=0,(0|n)!=(0|(i=i+1|0)););}if(d[e+24>>2]=n,(0|n)>=1)for(e=d[e+32>>2],i=0;d[(o=i<<2)+e>>2]=d[o+d[t+12>>2]>>2],(0|n)!=(0|(i=i+1|0)););},r[811]=Rd,r[812]=function(e,t){e|=0,t=y(t);var i=0,n=0,r=0;if((0|(i=d[e+24>>2]))>=1)for(;;){e:{switch(r=d[d[e+32>>2]+(n<<2)>>2],d[r+216>>2]+-2|0){case 0:case 3:break e}Y(r,t),i=d[e+24>>2]}if(!((0|(n=n+1|0))<(0|i)))break}},r[813]=function(e,t){e|=0,t=y(t);var i=0,n=0,r=0;if((0|(i=d[e+24>>2]))>=1)for(;;){e:{switch(r=d[d[e+32>>2]+(n<<2)>>2],d[r+216>>2]+-2|0){case 0:case 3:break e}ue(r),i=d[e+24>>2]}if(!((0|(n=n+1|0))<(0|i)))break}},r[814]=function(e){var t=0,i=0,n=0;if((0|(t=d[24+(e|=0)>>2]))>=1)for(;;){e:{switch(n=d[d[e+32>>2]+(i<<2)>>2],d[n+216>>2]+-2|0){case 0:case 3:break e}yi(n),t=d[e+24>>2]}if(!((0|(i=i+1|0))<(0|t)))break}},r[815]=function(e,t,i){!function(e,t){var i,n=y(0),s=0,o=y(0),a=y(0),l=y(0),c=0,h=0,_=y(0);O=i=O-160|0;e:{t:switch((15&d[e+388>>2])-1|0){case 0:d[i>>2]=21644,s=d[t+12>>2],o=m[s+56>>2],a=m[s+52>>2],c=d[t+8>>2],h=d[c+236>>2],l=m[s+48>>2],s=d[e+192>>2],n=y(r[d[d[s>>2]+48>>2]](s)),s=d[t+4>>2],r[d[d[s>>2]+8>>2]](s,d[t+12>>2],i+144|0,i+128|0),s=d[i+156>>2],d[i+104>>2]=d[i+152>>2],d[i+108>>2]=s,s=d[i+132>>2],d[i+112>>2]=d[i+128>>2],d[i+116>>2]=s,s=d[i+140>>2],d[i+120>>2]=d[i+136>>2],d[i+124>>2]=s,m[i+104>>2]=m[i+104>>2]-n,m[i+112>>2]=n+m[i+112>>2],s=d[i+148>>2],d[i+96>>2]=d[i+144>>2],d[i+100>>2]=s,m[i+96>>2]=m[i+96>>2]-n,m[i+100>>2]=m[i+100>>2]-n,m[i+116>>2]=n+m[i+116>>2],m[i+120>>2]=n+m[i+120>>2],m[i+20>>2]=n,_=n,n=y(l-l),l=y(n*n),n=y(a-a),a=y(l+y(n*n)),n=y(o-o),m[i+16>>2]=_+y(x(y(a+y(n*n)))),d[i+12>>2]=h<<30>>31&c,d[i+8>>2]=t,d[i+4>>2]=e,Si(e+928|0,d[e+928>>2],i+96|0,i);break e;case 1:break t;default:break e}d[i+20>>2]=0,d[i+4>>2]=1065353216,d[i>>2]=21728,d[i+24>>2]=e,d[i+28>>2]=t,d[i+8>>2]=d[e+456>>2],s=d[t+4>>2],n=y(r[d[d[s>>2]+48>>2]](s)),s=d[e+192>>2],n=y(n+y(r[d[d[s>>2]+48>>2]](s))),m[i+12>>2]=n,o=m[d[t+8>>2]+224>>2],m[i+96>>2]=o,d[i+16>>2]=d[(m[e+316>>2]>2],s=d[t+4>>2],r[d[d[s>>2]+8>>2]](s,d[t+12>>2],i+144|0,i+128|0),t=d[i+156>>2],d[i+104>>2]=d[i+152>>2],d[i+108>>2]=t,t=d[i+132>>2],d[i+112>>2]=d[i+128>>2],d[i+116>>2]=t,t=d[i+140>>2],d[i+120>>2]=d[i+136>>2],d[i+124>>2]=t,m[i+104>>2]=m[i+104>>2]-n,m[i+112>>2]=n+m[i+112>>2],m[i+116>>2]=n+m[i+116>>2],t=d[i+148>>2],d[i+96>>2]=d[i+144>>2],d[i+100>>2]=t,m[i+96>>2]=m[i+96>>2]-n,m[i+100>>2]=m[i+100>>2]-n,m[i+120>>2]=n+m[i+120>>2],Si(e+1048|0,d[e+1048>>2],i+96|0,i)}O=i+160|0}(t|=0,i|=0)},r[816]=function(e,t,i){Fn(t|=0,i|=0)},r[817]=function(e,t){t|=0,d[4+(e|=0)>>2]=t},r[818]=function(e){return d[4+(e|=0)>>2]},r[819]=function(e,t){t|=0,d[8+(e|=0)>>2]=t},r[820]=ud,r[821]=function(e,t,i){e|=0,t|=0;var n=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0;if(!r[d[d[(i|=0)>>2]+16>>2]](i)){if(o=d[t+712>>2],a=0|r[d[d[i>>2]+36>>2]](i),r[d[d[i>>2]+8>>2]](i)&&(e=0|r[d[d[i>>2]+20>>2]](i),s=0|r[d[d[i>>2]+24>>2]](i),!((0|o)<1)))for(e=a+(e<<2)|0,l=d[t+720>>2],c=s<<2;s=b(n,104)+l|0,h=d[s+12>>2],_=d[s+8>>2],d[e+8>>2]=d[s+16>>2],d[e>>2]=_,d[e+4>>2]=h,e=e+c|0,(0|o)!=(0|(n=n+1|0)););if(r[d[d[i>>2]+12>>2]](i)&&(e=0|r[d[d[i>>2]+28>>2]](i),i=0|r[d[d[i>>2]+32>>2]](i),!((0|o)<1)))for(e=a+(e<<2)|0,a=d[t+720>>2],n=0,i<<=2;t=a+b(n,104)|0,s=d[t+76>>2],l=d[t+72>>2],d[e+8>>2]=d[t+80>>2],d[e>>2]=l,d[e+4>>2]=s,e=e+i|0,(0|o)!=(0|(n=n+1|0)););}},r[822]=function(e){var t=0;return d[(e|=0)>>2]=20532,t=d[e+92>>2],r[d[d[t>>2]>>2]](t),(t=d[e+92>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+96>>2],r[d[d[t>>2]>>2]](t),(t=d[e+96>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+100>>2],r[d[d[t>>2]>>2]](t),(t=d[e+100>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+104>>2],r[d[d[t>>2]>>2]](t),(t=d[e+104>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+108>>2],r[d[d[t>>2]>>2]](t),(t=d[e+108>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),Bt(e),0|e},r[823]=function(e){var t=0;d[(e|=0)>>2]=20532,t=d[e+92>>2],r[d[d[t>>2]>>2]](t),(t=d[e+92>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+96>>2],r[d[d[t>>2]>>2]](t),(t=d[e+96>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+100>>2],r[d[d[t>>2]>>2]](t),(t=d[e+100>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+104>>2],r[d[d[t>>2]>>2]](t),(t=d[e+104>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),t=d[e+108>>2],r[d[d[t>>2]>>2]](t),(t=d[e+108>>2])&&(d[7718]=d[7718]+1,r[d[6607]](t)),Bt(e),ve(e)},r[824]=function(e,t,i){var n;if(e|=0,!((n=32!=(0|(t|=0)))|32!=(0|(i|=0))))return d[e+92>>2];e:{t:{i:{if(!n){if((0|i)>19)break i;return d[e+96>>2]}if(32!=(0|i)|(0|t)>19)break t;return d[e+100>>2]}if(i+-21>>>0>8)break e;return d[e+104>>2]}if(!(32!=(0|i)|t+-21>>>0>8))return d[e+108>>2]}return 0|cr(e,t,i)},r[825]=Pd,r[826]=function(e,t,i,n){return e|=0,e=d[(t|=0)>>2],e=0|r[d[d[e>>2]+56>>2]](e,24),d[e>>2]=17764,d[e+4>>2]=d[t>>2],d[e>>2]=22960,0|e},r[827]=Pd,r[828]=function(e,t,i,n){return e|=0,i|=0,i=d[(t|=0)>>2],i=0|r[d[d[i>>2]+56>>2]](i,20),e=u[e+4|0],d[i>>2]=17764,d[i+4>>2]=d[t>>2],s[i+16|0]=e,d[i>>2]=22200,0|i},r[829]=Pd,r[830]=function(e,t,i,n){return e|=0,i|=0,n|=0,e=d[(t|=0)>>2],jr(e=0|r[d[d[e>>2]+56>>2]](e,156),t,i,n,0),0|e},r[831]=Pd,r[832]=function(e,t,i,n){return e|=0,i|=0,n|=0,e=d[(t|=0)>>2],jr(e=0|r[d[d[e>>2]+56>>2]](e,156),t,i,n,1),0|e},r[833]=function(e,t){e|=0,t=y(t);var i,n=0,r=0,s=y(0),o=y(0),a=y(0),l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=0;if((0|(i=d[e+732>>2]))>=1)for(f=d[e+740>>2];n=b(l,52)+f|0,r=d[n+8>>2],o=m[r+48>>2],a=m[r+40>>2],e=d[n+12>>2],c=m[n+36>>2],h=m[r+44>>2],_=m[n+40>>2],u=m[n+44>>2],p=y(y(m[n+32>>2]*y(-y(y(y(y(a-m[e+40>>2])*c)+y(y(h-m[e+44>>2])*_))+y(u*y(o-m[e+48>>2])))))*t),s=y(m[r+88>>2]*p),m[r+48>>2]=o+y(u*s),m[r+44>>2]=h+y(_*s),m[r+40>>2]=a+y(c*s),o=m[n+44>>2],a=m[n+40>>2],s=y(p*m[e+88>>2]),m[e+40>>2]=m[e+40>>2]-y(m[n+36>>2]*s),m[e+44>>2]=m[e+44>>2]-y(s*a),m[e+48>>2]=m[e+48>>2]-y(s*o),(0|i)!=(0|(l=l+1|0)););},r[834]=fe,r[835]=function(e){(e=fe(e|=0))&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[836]=Rd,r[837]=function(e){return 428},r[838]=function(e,t,i){var n,o=0,a=0,l=0,c=0,h=0,_=0,p=0,f=0,m=0,g=0,y=0,v=0,A=0,C=0,S=0,x=0;if(O=n=O-96|0,Mt(e|=0,t|=0,i|=0),s[n+52|0]=1,d[n+48>>2]=0,s[n+72|0]=1,d[n+40>>2]=0,d[n+44>>2]=0,d[n+68>>2]=0,s[n+92|0]=1,d[n+60>>2]=0,d[n+64>>2]=0,d[n+88>>2]=0,d[n+80>>2]=0,d[n+84>>2]=0,d[n+28>>2]=0,s[n+32|0]=1,d[n+20>>2]=0,d[n+24>>2]=0,o=d[e+872>>2],d[t+292>>2]=o,o){if(c=e+868|0,o=0|r[d[d[i>>2]+28>>2]](i,c),d[t+260>>2]=o,o){if(_=d[t+292>>2],f=0|r[d[d[i>>2]+16>>2]](i,4,_),(0|_)>0)for(h=d[f+8>>2];o=h,p=0,(a=d[d[e+880>>2]+(l<<2)>>2])&&(p=0|r[d[d[i>>2]+28>>2]](i,a)),d[o>>2]=p,r[d[d[i>>2]+24>>2]](i,a)||(p=0|r[d[d[i>>2]+16>>2]](i,16,1),o=d[p+8>>2],d[o+12>>2]=d[a+16>>2],d[o+4>>2]=d[a+8>>2],d[o>>2]=d[a+4>>2],d[o+8>>2]=d[a+12>>2],r[d[d[i>>2]+20>>2]](i,p,21122,1414349395,a)),h=h+4|0,(0|_)!=(0|(l=l+1|0)););r[d[d[i>>2]+20>>2]](i,f,21122,1497453121,c)}}else d[t+260>>2]=0;if(o=d[e+712>>2],d[t+296>>2]=o,o){if(p=e+708|0,o=0|r[d[d[i>>2]+28>>2]](i,p),d[t+264>>2]=o,o){if(f=d[t+296>>2],c=0|r[d[d[i>>2]+16>>2]](i,100,f),o=d[c+8>>2],h=0,d[n+12>>2]=0,(0|f)>=1)for(;l=(_=d[e+720>>2])+b(h,104)|0,d[o+52>>2]=d[l+56>>2],d[o+56>>2]=d[l+60>>2],d[o+60>>2]=d[l- -64>>2],d[o- -64>>2]=d[l+68>>2],d[o+88>>2]=d[l+92>>2],a=0,d[o+92>>2]=0-(1&s[l+100|0]),d[o+84>>2]=d[l+88>>2],(l=d[l+4>>2])&&(a=0|r[d[d[i>>2]+28>>2]](i,l),_=d[e+720>>2],h=d[n+12>>2]),d[o>>2]=a,l=b(h,104)+_|0,d[o+68>>2]=d[l+72>>2],d[o+72>>2]=d[l+76>>2],d[o+76>>2]=d[l+80>>2],d[o+80>>2]=d[l+84>>2],d[o+4>>2]=d[l+8>>2],d[o+8>>2]=d[l+12>>2],d[o+12>>2]=d[l+16>>2],d[o+16>>2]=d[l+20>>2],d[o+20>>2]=d[l+24>>2],d[o+24>>2]=d[l+28>>2],d[o+28>>2]=d[l+32>>2],d[o+32>>2]=d[l+36>>2],d[o+36>>2]=d[l+40>>2],d[o+40>>2]=d[l+44>>2],d[o+44>>2]=d[l+48>>2],d[o+48>>2]=d[l+52>>2],d[n>>2]=l,Nt(n+16|0,n,n+12|0),h=d[n+12>>2]+1|0,d[n+12>>2]=h,o=o+100|0,(0|h)<(0|f););r[d[d[i>>2]+20>>2]](i,c,21143,1145979475,p)}}else d[t+264>>2]=0;if(o=d[e+732>>2],d[t+300>>2]=o,o){if(o=0|r[d[d[i>>2]+28>>2]](i,d[e+740>>2]),d[t+268>>2]=o,o){if(a=d[t+300>>2],f=0|r[d[d[i>>2]+16>>2]](i,20,a),_=d[e+740>>2],(0|a)>=1)for(o=d[f+8>>2],l=0;c=(p=b(l,52))+_|0,d[o+16>>2]=0-(1&s[c+20|0]),h=0,(c=d[c+4>>2])&&(h=0|r[d[d[i>>2]+28>>2]](i,c),_=d[e+740>>2]),d[o>>2]=h,h=o,c=(c=d[8+(p=_+p|0)>>2])?(c-d[e+720>>2]|0)/104|0:-1,d[h+4>>2]=c,h=o,c=(c=d[p+12>>2])?(c-d[e+720>>2]|0)/104|0:-1,d[h+8>>2]=c,d[o+12>>2]=d[p+16>>2],o=o+20|0,(0|a)!=(0|(l=l+1|0)););r[d[d[i>>2]+20>>2]](i,f,21160,1497453121,_)}}else d[t+268>>2]=0;if(o=d[e+752>>2],d[t+304>>2]=o,o){if(o=0|r[d[d[i>>2]+28>>2]](i,d[e+760>>2]),d[t+272>>2]=o,o){if(f=d[t+304>>2],p=0|r[d[d[i>>2]+16>>2]](i,36,f),_=d[e+760>>2],(0|f)>=1)for(o=d[p+8>>2],h=0;l=0,a=b(h,44),(c=d[4+(a+_|0)>>2])&&(l=0|r[d[d[i>>2]+28>>2]](i,c),_=d[e+760>>2]),d[o+16>>2]=l,a=a+_|0,d[o>>2]=d[a+20>>2],d[o+4>>2]=d[a+24>>2],d[o+8>>2]=d[a+28>>2],d[o+12>>2]=d[a+32>>2],l=o,c=(c=d[a+8>>2])?(c-d[e+720>>2]|0)/104|0:-1,d[l+20>>2]=c,l=o,c=(c=d[a+12>>2])?(c-d[e+720>>2]|0)/104|0:-1,d[l+24>>2]=c,l=o,c=-1,(m=d[a+16>>2])&&(c=(m-d[e+720>>2]|0)/104|0),d[l+28>>2]=c,d[o+32>>2]=d[a+36>>2],o=o+36|0,(0|f)!=(0|(h=h+1|0)););r[d[d[i>>2]+20>>2]](i,p,21177,1497453121,_)}}else d[t+272>>2]=0;if(o=d[e+772>>2],d[t+308>>2]=o,o){if(o=0|r[d[d[i>>2]+28>>2]](i,d[e+780>>2]),d[t+276>>2]=o,o){if(_=0,f=d[t+308>>2],p=0|r[d[d[i>>2]+16>>2]](i,100,f),(0|f)<=0)h=d[e+780>>2];else for(h=d[e+780>>2],o=d[p+8>>2];a=(m=b(_,104))+h|0,d[o>>2]=d[a+32>>2],d[o+4>>2]=d[a+36>>2],d[o+8>>2]=d[a+40>>2],d[o+12>>2]=d[a+44>>2],l=o,c=(c=d[h+8>>2])?(c-d[e+720>>2]|0)/104|0:-1,d[l+68>>2]=c,d[o+16>>2]=d[a+48>>2],d[o+20>>2]=d[a+52>>2],d[o+24>>2]=d[a+56>>2],d[o+28>>2]=d[a+60>>2],l=o,c=(c=d[h+116>>2])?(c-d[e+720>>2]|0)/104|0:-1,d[l+72>>2]=c,d[o+32>>2]=d[a- -64>>2],d[o+36>>2]=d[a+68>>2],d[o+40>>2]=d[a+72>>2],d[o+44>>2]=d[a+76>>2],l=o,c=(c=d[h+224>>2])?(c-d[e+720>>2]|0)/104|0:-1,d[l+76>>2]=c,d[o+48>>2]=d[a+80>>2],d[o+52>>2]=d[a+84>>2],d[o+56>>2]=d[a+88>>2],d[o+60>>2]=d[a+92>>2],l=o,c=(c=d[h+332>>2])?(c-d[e+720>>2]|0)/104|0:-1,d[l+80>>2]=c,d[o+88>>2]=d[a+96>>2],d[o+92>>2]=d[a+100>>2],(l=d[a+4>>2])?(l=0|r[d[d[i>>2]+28>>2]](i,l),h=d[e+780>>2]):l=0,d[o+64>>2]=l,d[o+84>>2]=d[24+(h+m|0)>>2],o=o+100|0,(0|f)!=(0|(_=_+1|0)););r[d[d[i>>2]+20>>2]](i,p,21194,1497453121,h)}}else d[t+276>>2]=0;if(o=d[e+792>>2],d[t+312>>2]=o,o){if(o=0|r[d[d[i>>2]+28>>2]](i,d[e+800>>2]),d[t+280>>2]=o,o){if(_=d[t+312>>2],f=0|r[d[d[i>>2]+16>>2]](i,92,_),l=d[e+800>>2],(0|_)>=1)for(o=d[f+8>>2],h=0;a=b(h,96)+l|0,d[o>>2]=d[a+28>>2],d[o+4>>2]=d[a+32>>2],d[o+8>>2]=d[a+36>>2],d[o+12>>2]=d[a+40>>2],d[o+16>>2]=d[a+44>>2],d[o+20>>2]=d[a+48>>2],d[o+24>>2]=d[a+52>>2],d[o+28>>2]=d[a+56>>2],d[o+32>>2]=d[a+60>>2],d[o+36>>2]=d[a- -64>>2],d[o+40>>2]=d[a+68>>2],d[o+44>>2]=d[a+72>>2],d[o+48>>2]=d[a+76>>2],d[o+52>>2]=d[a+80>>2],d[o+56>>2]=d[a+84>>2],d[o+60>>2]=d[a+88>>2],d[o+88>>2]=d[a+92>>2],d[o+64>>2]=d[a+4>>2],d[o+68>>2]=d[a+8>>2],d[o+72>>2]=d[a+12>>2],d[o+76>>2]=d[a+16>>2],l=o,p=-1,(c=d[a>>2])&&(p=(c-d[e+720>>2]|0)/104|0),d[l+84>>2]=p,l=o,c=0,(a=d[a+20>>2])&&(c=0|r[d[d[i>>2]+28>>2]](i,a)),d[l+80>>2]=c,o=o+92|0,l=d[e+800>>2],(0|_)!=(0|(h=h+1|0)););r[d[d[i>>2]+20>>2]](i,f,21212,1497453121,l)}}else d[t+280>>2]=0;if(d[t+352>>2]=d[e+316>>2],d[t+328>>2]=d[e+292>>2],d[t+344>>2]=d[e+308>>2],d[t+324>>2]=d[e+288>>2],d[t+340>>2]=d[e+304>>2],d[t+336>>2]=d[e+300>>2],d[t+412>>2]=d[e+376>>2],d[t+416>>2]=d[e+380>>2],d[t+420>>2]=d[e+384>>2],d[t+408>>2]=d[e+372>>2],o=d[e+364>>2],d[t+332>>2]=d[e+296>>2],d[t+356>>2]=d[e+320>>2],d[t+424>>2]=d[e+388>>2],d[t+348>>2]=d[e+312>>2],d[t+360>>2]=d[e+324>>2],d[t+364>>2]=d[e+328>>2],d[t+368>>2]=d[e+332>>2],d[t+372>>2]=d[e+336>>2],l=d[e+368>>2],d[t+400>>2]=o,d[t+404>>2]=l,d[t+376>>2]=d[e+340>>2],d[t+380>>2]=d[e+344>>2],d[t+384>>2]=d[e+348>>2],d[t+388>>2]=d[e+352>>2],d[t+392>>2]=d[e+356>>2],d[t+396>>2]=d[e+360>>2],c=e+472|0,d[t+256>>2]=r[d[d[i>>2]+28>>2]](i,c),m=0|r[d[d[i>>2]+16>>2]](i,192,1),o=d[m+8>>2],d[o+96>>2]=d[e+632>>2],d[o+100>>2]=d[e+636>>2],d[o+104>>2]=d[e+640>>2],d[o+108>>2]=d[e+644>>2],d[o+112>>2]=d[e+648>>2],d[o+116>>2]=d[e+652>>2],d[o+120>>2]=d[e+656>>2],d[o+124>>2]=d[e+660>>2],d[o+128>>2]=d[e+664>>2],d[o+132>>2]=d[e+668>>2],d[o+136>>2]=d[e+672>>2],d[o+140>>2]=d[e+676>>2],d[o+180>>2]=u[e+473|0],d[o+176>>2]=u[e+472|0],d[o+144>>2]=d[e+520>>2],d[o+148>>2]=d[e+524>>2],d[o+152>>2]=d[e+528>>2],d[o+156>>2]=d[e+532>>2],l=d[e+484>>2],d[o+168>>2]=l,l){if(d[o+160>>2]=r[d[d[i>>2]+28>>2]](i,d[e+492>>2]),h=d[o+168>>2]){if(f=0|r[d[d[i>>2]+16>>2]](i,16,h),p=d[e+492>>2],(0|h)>=1)for(l=d[f+8>>2],_=0;a=p+(_<<4)|0,d[l>>2]=d[a>>2],d[l+4>>2]=d[a+4>>2],d[l+8>>2]=d[a+8>>2],d[l+12>>2]=d[a+12>>2],l=l+16|0,(0|h)!=(0|(_=_+1|0)););r[d[d[i>>2]+20>>2]](i,f,21232,1497453121,p)}}else d[o+160>>2]=0;if(d[o+184>>2]=d[e+476>>2],d[o>>2]=d[e+536>>2],d[o+4>>2]=d[e+540>>2],d[o+8>>2]=d[e+544>>2],d[o+12>>2]=d[e+548>>2],d[o+16>>2]=d[e+552>>2],d[o+20>>2]=d[e+556>>2],d[o+24>>2]=d[e+560>>2],d[o+28>>2]=d[e+564>>2],d[o+32>>2]=d[e+568>>2],d[o+36>>2]=d[e+572>>2],d[o+40>>2]=d[e+576>>2],d[o+44>>2]=d[e+580>>2],d[o+48>>2]=d[e+584>>2],d[o+52>>2]=d[e+588>>2],d[o+56>>2]=d[e+592>>2],d[o+60>>2]=d[e+596>>2],d[o- -64>>2]=d[e+600>>2],d[o+68>>2]=d[e+604>>2],d[o+72>>2]=d[e+608>>2],d[o+76>>2]=d[e+612>>2],d[o+80>>2]=d[e+616>>2],d[o+84>>2]=d[e+620>>2],d[o+88>>2]=d[e+624>>2],d[o+92>>2]=d[e+628>>2],l=d[e+504>>2],d[o+172>>2]=l,l){if(d[o+164>>2]=r[d[d[i>>2]+28>>2]](i,d[e+512>>2]),h=d[o+172>>2]){if(a=0|r[d[d[i>>2]+16>>2]](i,4,h),_=d[e+512>>2],(0|h)>=1)for(o=d[a+8>>2],l=0;d[o>>2]=d[_+(l<<2)>>2],o=o+4|0,(0|h)!=(0|(l=l+1|0)););r[d[d[i>>2]+20>>2]](i,a,21251,1497453121,_)}}else d[o+164>>2]=0;if(r[d[d[i>>2]+20>>2]](i,m,21257,1497453121,c),o=d[e+1112>>2],d[t+316>>2]=o,o){if(d[t+284>>2]=r[d[d[i>>2]+28>>2]](i,d[d[e+1120>>2]>>2]),f=d[t+316>>2]){if(c=0|r[d[d[i>>2]+16>>2]](i,348,f),o=d[e+1120>>2],(0|f)>=1)for(a=d[c+8>>2],p=0;;){if(o=d[(_=p<<2)+o>>2],d[a+320>>2]=d[o+360>>2],d[a+256>>2]=d[o+332>>2],d[a+260>>2]=d[o+336>>2],d[a+264>>2]=d[o+340>>2],d[a+268>>2]=d[o+344>>2],d[a+344>>2]=d[o+380>>2],d[a+340>>2]=u[o+377|0],d[a+160>>2]=d[o+228>>2],d[a+164>>2]=d[o+232>>2],d[a+168>>2]=d[o+236>>2],d[a+172>>2]=d[o+240>>2],d[a+336>>2]=u[o+376|0],d[a+208>>2]=d[o+276>>2],d[a+212>>2]=d[o+280>>2],d[a+216>>2]=d[o+284>>2],d[a+220>>2]=d[o+288>>2],d[a+224>>2]=d[o+292>>2],d[a+228>>2]=d[o+296>>2],d[a+232>>2]=d[o+300>>2],d[a+236>>2]=d[o+304>>2],d[a>>2]=d[o+60>>2],d[a+4>>2]=d[o- -64>>2],d[a+8>>2]=d[o+68>>2],d[a+12>>2]=d[o+72>>2],d[a+16>>2]=d[o+76>>2],d[a+20>>2]=d[o+80>>2],d[a+24>>2]=d[o+84>>2],d[a+28>>2]=d[o+88>>2],d[a+32>>2]=d[o+92>>2],d[a+36>>2]=d[o+96>>2],d[a+40>>2]=d[o+100>>2],d[a+44>>2]=d[o+104>>2],d[a+48>>2]=d[o+108>>2],d[a+52>>2]=d[o+112>>2],d[a+56>>2]=d[o+116>>2],d[a+60>>2]=d[o+120>>2],d[a+296>>2]=d[o+124>>2],d[a+300>>2]=d[o+128>>2],d[a+112>>2]=d[o+180>>2],d[a+116>>2]=d[o+184>>2],d[a+120>>2]=d[o+188>>2],d[a+124>>2]=d[o+192>>2],d[a+128>>2]=d[o+196>>2],d[a+132>>2]=d[o+200>>2],d[a+136>>2]=d[o+204>>2],d[a+140>>2]=d[o+208>>2],d[a+144>>2]=d[o+212>>2],d[a+148>>2]=d[o+216>>2],d[a+152>>2]=d[o+220>>2],d[a+156>>2]=d[o+224>>2],d[a+316>>2]=d[o+356>>2],d[a+64>>2]=d[o+132>>2],d[a+68>>2]=d[o+136>>2],d[a+72>>2]=d[o+140>>2],d[a+76>>2]=d[o+144>>2],d[a+80>>2]=d[o+148>>2],d[a+84>>2]=d[o+152>>2],d[a+88>>2]=d[o+156>>2],d[a+92>>2]=d[o+160>>2],d[a+96>>2]=d[o+164>>2],d[a+100>>2]=d[o+168>>2],d[a+104>>2]=d[o+172>>2],d[a+108>>2]=d[o+176>>2],d[a+240>>2]=d[o+316>>2],d[a+244>>2]=d[o+320>>2],d[a+248>>2]=d[o+324>>2],d[a+252>>2]=d[o+328>>2],d[a+324>>2]=d[o+364>>2],d[a+328>>2]=d[o+368>>2],d[a+312>>2]=d[o+352>>2],d[a+316>>2]=d[o+356>>2],d[a+320>>2]=d[o+360>>2],d[a+332>>2]=d[o+372>>2],l=d[o+44>>2],d[a+284>>2]=l,d[a+292>>2]=d[o+4>>2],d[a+288>>2]=d[o+24>>2],d[a+304>>2]=d[o+308>>2],d[a+176>>2]=d[o+244>>2],d[a+180>>2]=d[o+248>>2],d[a+184>>2]=d[o+252>>2],d[a+188>>2]=d[o+256>>2],d[a+192>>2]=d[o+260>>2],d[a+196>>2]=d[o+264>>2],d[a+200>>2]=d[o+268>>2],d[a+204>>2]=d[o+272>>2],d[a+308>>2]=d[o+312>>2],l){if(o=0|r[d[d[i>>2]+28>>2]](i,d[o+52>>2]),d[a+272>>2]=o,o){if(m=d[a+284>>2],g=0|r[d[d[i>>2]+16>>2]](i,16,m),y=d[d[_+d[e+1120>>2]>>2]+52>>2],(0|m)>=1)for(o=d[g+8>>2],h=0;l=y+(h<<4)|0,d[o>>2]=d[l>>2],d[o+4>>2]=d[l+4>>2],d[o+8>>2]=d[l+8>>2],d[o+12>>2]=d[l+12>>2],o=o+16|0,(0|m)!=(0|(h=h+1|0)););r[d[d[i>>2]+20>>2]](i,g,21232,1497453121,y)}}else d[a+272>>2]=0;if(d[a+292>>2]){if(o=0|r[d[d[i>>2]+28>>2]](i,d[d[_+d[e+1120>>2]>>2]+12>>2]),d[a+280>>2]=o,o){if(h=d[a+292>>2],m=0|r[d[d[i>>2]+16>>2]](i,4,h),g=d[d[_+d[e+1120>>2]>>2]+12>>2],(0|h)>=1)for(o=d[m+8>>2],l=0;d[o>>2]=d[g+(l<<2)>>2],o=o+4|0,(0|h)!=(0|(l=l+1|0)););r[d[d[i>>2]+20>>2]](i,m,21251,1497453121,g)}}else d[a+280>>2]=0;if(d[a+288>>2]){if(o=0|r[d[d[i>>2]+28>>2]](i,d[_+d[e+1120>>2]>>2]+20|0),d[a+276>>2]=o,o){if(m=d[a+292>>2],g=0|r[d[d[i>>2]+16>>2]](i,4,m),y=d[_+d[e+1120>>2]>>2],(0|m)>=1)for(A=d[y+32>>2],h=d[g+8>>2],l=0,C=d[n+68>>2],S=d[n+48>>2],v=d[n+88>>2],x=d[n+28>>2];;){if(_=d[(l<<2)+A>>2],o=b((o=(_<<15^-1)+_|0)>>10^o,9),o=((o^=o>>6)<<11^-1)+o|0,o=d[((d[n+64>>2]+-1&(o>>16^o))<<2)+x>>2],d[(o<<3)+v>>2]!=(0|_))for(;o=d[(o<<2)+S>>2],(0|_)!=d[(o<<3)+v>>2];);if(d[h>>2]=d[(o<<2)+C>>2],h=h+4|0,(0|m)==(0|(l=l+1|0)))break}r[d[d[i>>2]+20>>2]](i,g,21274,1497453121,y+20|0)}}else d[a+276>>2]=0;if(a=a+348|0,o=d[e+1120>>2],(0|f)==(0|(p=p+1|0)))break}r[d[d[i>>2]+20>>2]](i,c,21278,1497453121,d[o>>2])}}else d[t+284>>2]=0;if(o=d[e+852>>2],d[t+320>>2]=o,o){if(o=t,t=0|r[d[d[i>>2]+28>>2]](i,d[e+860>>2]),d[o+288>>2]=t,t){if(f=d[e+852>>2],p=0|r[d[d[i>>2]+16>>2]](i,104,f),_=d[e+860>>2],(0|f)>=1)for(o=d[p+8>>2],a=0;t=d[(h=a<<2)+_>>2],d[o+96>>2]=r[d[d[t>>2]+20>>2]](t),l=h+d[e+860>>2]|0,t=d[l>>2],d[o+8>>2]=d[t+28>>2],d[o+12>>2]=d[t+32>>2],d[o+16>>2]=d[t+36>>2],d[o+20>>2]=d[t+40>>2],d[o+24>>2]=d[t+44>>2],d[o+28>>2]=d[t+48>>2],d[o+32>>2]=d[t+52>>2],d[o+36>>2]=d[t+56>>2],d[o+40>>2]=d[t+60>>2],d[o+44>>2]=d[t+64>>2],d[o+48>>2]=d[t+68>>2],t=u[t+152|0],d[o+56>>2]=0,d[o+60>>2]=0,d[o>>2]=0,d[o+4>>2]=0,d[o+52>>2]=t,d[(t=o- -64|0)>>2]=0,d[t+4>>2]=0,d[o+72>>2]=0,d[o+76>>2]=0,d[o+80>>2]=0,d[o+84>>2]=0,(t=d[d[l>>2]+4>>2])&&(d[o+88>>2]=1,d[o>>2]=r[d[d[i>>2]+28>>2]](i,t)),_=d[e+860>>2],l=d[h+_>>2],(t=d[l+12>>2])&&(d[o+88>>2]=3,d[o>>2]=r[d[d[i>>2]+28>>2]](i,t),_=d[e+860>>2],l=d[h+_>>2]),(t=d[l+8>>2])&&(d[o+88>>2]=2,d[o>>2]=r[d[d[i>>2]+28>>2]](i,t),_=d[e+860>>2],l=d[h+_>>2]),(t=d[l+16>>2])&&(d[o+92>>2]=1,d[o+4>>2]=r[d[d[i>>2]+28>>2]](i,t),_=d[e+860>>2],l=d[h+_>>2]),(t=d[l+24>>2])&&(d[o+92>>2]=3,d[o+4>>2]=r[d[d[i>>2]+28>>2]](i,t),_=d[e+860>>2],l=d[h+_>>2]),(t=d[l+20>>2])&&(d[o+92>>2]=2,d[o+4>>2]=r[d[d[i>>2]+28>>2]](i,t),_=d[e+860>>2]),o=o+104|0,(0|f)!=(0|(a=a+1|0)););r[d[d[i>>2]+20>>2]](i,p,21298,1497453121,_)}}else d[t+288>>2]=0;return(e=d[n+88>>2])&&(u[n+92|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[n+88>>2]=0),d[n+88>>2]=0,s[n+92|0]=1,d[n+80>>2]=0,d[n+84>>2]=0,(e=d[n+68>>2])&&(u[n+72|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[n+68>>2]=0),d[n+68>>2]=0,s[n+72|0]=1,d[n+60>>2]=0,d[n+64>>2]=0,(e=d[n+48>>2])&&(u[n+52|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[n+48>>2]=0),d[n+48>>2]=0,s[n+52|0]=1,d[n+40>>2]=0,d[n+44>>2]=0,(e=d[n+28>>2])&&(u[n+32|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[n+28>>2]=0),O=n+96|0,21318},r[839]=function(e,t,i){t|=0,i|=0;var n=0;n=d[896+(e|=0)>>2],d[t>>2]=d[e+892>>2],d[t+4>>2]=n,n=d[e+904>>2],d[t+8>>2]=d[e+900>>2],d[t+12>>2]=n,t=d[e+920>>2],d[i+8>>2]=d[e+916>>2],d[i+12>>2]=t,t=d[e+912>>2],d[i>>2]=d[e+908>>2],d[i+4>>2]=t},r[840]=Pd,r[841]=function(e,t){e|=0,t|=0;var i=y(0);t=d[t+36>>2],(i=Ti(e+4|0,e+36|0,d[t+8>>2]+8|0,d[t+12>>2]+8|0,d[t+16>>2]+8|0,m[e+52>>2]))>y(0)^1|i>2]^1||(d[e+56>>2]=t,m[e+52>>2]=i),d[e+60>>2]=d[e+60>>2]+1},r[842]=gd,r[843]=Pd,r[844]=function(e,t,i){e|=0,t=y(t),i|=0;var n=0,r=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0);if((n=d[e+8>>2])&&Eh(n,0),(n=d[e+12>>2])&&Eh(n,0),(n=d[e+20>>2])&&Eh(n,0),(n=d[e+24>>2])&&Eh(n,0),n=d[e+156>>2],d[e+156>>2]=n+1,s[e+152|0]=(0|n)>=d[e+160>>2],!n)return d[e+84>>2]=0,r=y(y(1)/t),a=m[e+64>>2],t=y(r*y(m[e+72>>2]*a)),m[e+72>>2]=t,o=y(r*y(a*m[e+80>>2])),m[e+80>>2]=o,r=y(r*y(a*m[e+76>>2])),m[e+76>>2]=r,(c=m[e+68>>2])>y(0)?(d[e+100>>2]=0,l=y(y(1)-c),a=y(l*o),m[e+80>>2]=a,h=y(l*r),m[e+76>>2]=h,l=y(l*t),m[e+72>>2]=l,t=y(c*t),r=y(c*r),o=y(c*o),m[e+96>>2]=y(y(t*m[e+136>>2])+y(r*m[e+140>>2]))+y(o*m[e+144>>2]),m[e+92>>2]=y(y(t*m[e+120>>2])+y(r*m[e+124>>2]))+y(o*m[e+128>>2]),m[e+88>>2]=y(y(t*m[e+104>>2])+y(r*m[e+108>>2]))+y(o*m[e+112>>2])):(a=o,h=r,l=t),t=y(y(1)/y(0|i)),m[e+80>>2]=t*a,m[e+76>>2]=t*h,void(m[e+72>>2]=t*l);d[e+88>>2]=0,d[e+92>>2]=0,d[e+72>>2]=0,d[e+76>>2]=0,d[e+96>>2]=0,d[e+100>>2]=0,d[e+80>>2]=0,d[e+84>>2]=0},r[845]=function(e,t,i){e|=0,t=y(t),i=y(i);var n,r,o,a,l,c=0,h=y(0),_=y(0),p=y(0),f=y(0),g=0,b=y(0),v=y(0),A=0,C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=0;O=n=O-80|0,r=e+4|0,l=e+16|0;e:{t:{if(!(g=d[e+8>>2])){if(c=d[r>>2])break t;t=y(0);break e}t=m[g+332>>2],p=m[e+172>>2],f=m[g+336>>2],_=m[e+168>>2],h=y(y(t*p)-y(f*_)),b=m[g+328>>2],v=t,t=m[e+164>>2],_=y(y(_*b)-y(v*t)),f=y(y(f*t)-y(p*b)),p=m[g+316>>2],b=m[g+312>>2],t=m[g+320>>2];break e}t=m[c+336>>2],p=m[e+172>>2],f=m[c+340>>2],_=m[e+168>>2],h=y(y(t*p)-y(f*_)),b=m[c+332>>2],v=t,t=m[e+164>>2],_=y(y(_*b)-y(v*t)),f=y(y(f*t)-y(p*b)),p=m[c+320>>2],b=m[c+316>>2],t=m[c+324>>2]}E=y(t+_),R=y(p+f),P=y(b+h);e:{t:{if(!(c=d[e+20>>2])){if(c=d[l>>2])break t;p=y(0),_=y(0),b=y(0),h=y(0),f=y(0),t=y(0);break e}t=m[c+332>>2],_=m[e+188>>2],p=m[c+336>>2],h=m[e+184>>2],b=y(y(t*_)-y(p*h)),C=h,h=m[c+328>>2],v=t,t=m[e+180>>2],f=y(y(C*h)-y(v*t)),h=y(y(p*t)-y(_*h)),p=m[c+316>>2],_=m[c+312>>2],t=m[c+320>>2];break e}t=m[c+336>>2],_=m[e+188>>2],p=m[c+340>>2],h=m[e+184>>2],b=y(y(t*_)-y(p*h)),C=h,h=m[c+332>>2],v=t,t=m[e+180>>2],f=y(y(C*h)-y(v*t)),h=y(y(p*t)-y(_*h)),p=m[c+320>>2],_=m[c+316>>2],t=m[c+324>>2]}S=m[e+200>>2],T=m[e+204>>2],v=m[e+196>>2],d[(c=n- -64|0)>>2]=0,d[c+4>>2]=0,d[n+56>>2]=0,d[n+60>>2]=0,s[n+72|0]=1,c=d[e+84>>2],d[n+48>>2]=d[e+80>>2],d[n+52>>2]=c,c=d[e+76>>2],d[n+40>>2]=d[e+72>>2],d[n+44>>2]=c,_=y(P-y(_+b)),p=y(R-y(p+h)),f=y(E-y(t+f)),(t=y(y(y(v*_)+y(S*p))+y(T*f)))>2],_=y(m[n+40>>2]+y(v+y(C*h))),m[n+40>>2]=_,b=y(S*t),p=y(y(b+y(h*y(p-b)))+m[n+44>>2]),m[n+44>>2]=p,t=y(T*t),t=y(y(t+y(h*y(f-t)))+m[n+48>>2]),m[n+48>>2]=t):(t=m[n+48>>2],p=m[n+44>>2],_=m[n+40>>2]),o=e+164|0,a=e+180|0,b=m[e+112>>2],S=m[e+108>>2],f=m[e+128>>2],T=m[e+120>>2],v=m[e+124>>2],h=m[e+144>>2],E=m[e+136>>2],R=m[e+140>>2],P=m[e+104>>2],d[n+52>>2]=0,h=y(y(y(y(_*E)+y(p*R))+y(t*h))*i),m[n+48>>2]=h,f=y(y(y(y(_*T)+y(p*v))+y(t*f))*i),m[n+44>>2]=f,t=y(y(y(y(P*_)+y(S*p))+y(b*t))*i),m[n+40>>2]=t;e:if((0|(c=d[e+4>>2]))!=d[e+16>>2])A=d[n+52>>2],d[n+8>>2]=d[n+48>>2],d[n+12>>2]=A,A=d[n+60>>2],d[n+16>>2]=d[n+56>>2],d[n+20>>2]=A,I=d[4+(A=n- -64|0)>>2],d[n+24>>2]=d[A>>2],d[n+28>>2]=I,d[n+32>>2]=d[n+72>>2],m[n+8>>2]=-m[n+8>>2],m[n+16>>2]=-m[n+16>>2],A=d[n+44>>2],d[n>>2]=d[n+40>>2],d[n+4>>2]=A,m[n>>2]=-m[n>>2],m[n+4>>2]=-m[n+4>>2],d[n+12>>2]=0,t=m[n+20>>2],i=m[n+24>>2],d[n+28>>2]=0,m[n+24>>2]=-i,m[n+20>>2]=-t,1&s[n+32|0]&&(g&&(Vs(g,n,o),c=d[r>>2]),c&&rn(c,o,n)),2&u[n+32|0]&&In(r,n+16|0,o),1&s[n+72|0]&&((e=d[e+20>>2])&&Vs(e,n+40|0,a),(e=d[l>>2])&&rn(e,a,n+40|0)),2&u[n+72|0]&&In(l,n+56|0,a);else{if(t!=t|f!=f|h!=h|y(x(y(y(y(t*t)+y(f*f))+y(h*h))))>2])break e;if(i=m[c+372>>2],d[n+28>>2]=0,_=y(i*y(-0)),m[n+24>>2]=_,m[n+20>>2]=_,A=d[n+72>>2],d[n+32>>2]=A,d[n+12>>2]=0,m[n+16>>2]=_,m[n+8>>2]=i*y(-h),m[n+4>>2]=i*y(-f),m[n>>2]=i*y(-t),1&A&&(!g||(Vs(g,n,o),c=d[r>>2]))&&rn(c,o,n),2&u[n+32|0]&&In(r,n+16|0,o),t=m[d[r>>2]+372>>2],g=d[n+52>>2],d[n+8>>2]=d[n+48>>2],d[n+12>>2]=g,g=d[n+60>>2],d[n+16>>2]=d[n+56>>2],d[n+20>>2]=g,d[n+32>>2]=d[n+72>>2],c=d[4+(g=n- -64|0)>>2],d[n+24>>2]=d[g>>2],d[n+28>>2]=c,m[n+8>>2]=t*m[n+8>>2],m[n+16>>2]=t*m[n+16>>2],g=d[n+44>>2],d[n>>2]=d[n+40>>2],d[n+4>>2]=g,m[n>>2]=t*m[n>>2],m[n+4>>2]=t*m[n+4>>2],m[n+20>>2]=t*m[n+20>>2],m[n+24>>2]=t*m[n+24>>2],1&s[n+32|0]&&((e=d[e+20>>2])&&Vs(e,n,a),(e=d[l>>2])&&rn(e,a,n)),!(2&u[n+32|0]))break e;In(l,n+16|0,a)}O=n+80|0},r[846]=function(e,t){e|=0,t=y(t);var i,n=y(0),r=y(0);O=i=O-16|0,m[e+68>>2]>y(0)&&(t=m[e+92>>2],n=m[e+96>>2],r=m[e+88>>2],d[i+12>>2]=0,m[i>>2]=-r,m[i+8>>2]=-n,m[i+4>>2]=-t,In(e+4|0,i,e+164|0),In(e+16|0,e+88|0,e+180|0)),O=i+16|0},r[847]=Sd,r[848]=z_,r[849]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=0,R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0);for(e=d[e+16>>2],r=m[e+900>>2],l=m[e+896>>2],c=m[e+908>>2],u=m[e+912>>2],v=m[e+916>>2],A=m[e+892>>2],s=m[t+52>>2],p=m[t+20>>2],C=m[t+24>>2],o=m[t+56>>2],f=m[t+36>>2],S=m[t+40>>2],a=m[t+48>>2],R=m[t+8>>2],P=m[t>>2],I=m[t+4>>2],g=m[t+16>>2],b=m[t+32>>2],d[124+(t=O-128|0)>>2]=0,d[t+108>>2]=0,d[t+92>>2]=0,d[t+76>>2]=0,d[t+60>>2]=0,d[t+44>>2]=0,d[t+28>>2]=0,M=y(A*b),x=y(u*f),D=y(M+x),h=y(v*S),m[t+120>>2]=o+y(D+h),w=y(A*g),T=y(u*p),F=y(w+T),_=y(v*C),m[t+116>>2]=s+y(F+_),b=y(c*b),x=y(b+x),m[t+104>>2]=o+y(x+h),g=y(c*g),T=y(g+T),m[t+100>>2]=s+y(T+_),f=y(l*f),b=y(b+f),m[t+88>>2]=o+y(b+h),p=y(l*p),g=y(g+p),m[t+84>>2]=s+y(g+_),f=y(M+f),m[t+72>>2]=o+y(f+h),p=y(w+p),m[t+68>>2]=s+y(p+_),h=y(r*S),m[t+56>>2]=o+y(D+h),_=y(r*C),m[t+52>>2]=s+y(F+_),m[t+40>>2]=o+y(x+h),m[t+36>>2]=s+y(T+_),m[t+24>>2]=o+y(b+h),m[t+20>>2]=s+y(g+_),d[t+12>>2]=0,A=y(A*P),C=y(u*I),S=y(A+C),u=y(v*R),m[t+112>>2]=a+y(S+u),c=y(c*P),v=y(c+C),m[t+96>>2]=a+y(v+u),l=y(l*I),c=y(c+l),m[t+80>>2]=a+y(c+u),l=y(A+l),m[t+64>>2]=a+y(l+u),r=y(r*R),m[t+48>>2]=a+y(S+r),m[t+32>>2]=a+y(v+r),m[t+16>>2]=a+y(c+r),m[t+8>>2]=o+y(f+h),m[t+4>>2]=s+y(p+_),m[t>>2]=a+y(l+r),e=d[t+12>>2],d[n+8>>2]=d[t+8>>2],d[n+12>>2]=e,e=d[t+4>>2],d[n>>2]=d[t>>2],d[n+4>>2]=e,e=d[t+12>>2],d[i+8>>2]=d[t+8>>2],d[i+12>>2]=e,e=d[t+4>>2],d[i>>2]=d[t>>2],d[i+4>>2]=e,e=1;(s=m[(E=t+(e<<4)|0)>>2])>2]&&(m[i>>2]=s),(o=m[E+4>>2])>2]&&(m[i+4>>2]=o),(a=m[E+8>>2])>2]&&(m[i+8>>2]=a),(r=m[E+12>>2])>2]&&(m[i+12>>2]=r),m[n>>2]>2]=s),m[n+4>>2]>2]=o),m[n+8>>2]>2]=a),m[n+12>>2]>2]=r),8!=(0|(e=e+1|0)););},r[850]=Rd,r[851]=function(e){return 1&s[30564]||mc(30564)&&(d[7639]=1065353216,d[7640]=0,d[7637]=1065353216,d[7638]=1065353216,uh(30564)),30548},r[852]=pd,r[853]=function(e){return 21624},r[854]=td,r[855]=Pd,r[856]=function(e,t){!function(e,t){var i,n=0,r=y(0),o=y(0),a=y(0),l=y(0),c=0,h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=0,C=y(0),S=y(0),x=y(0),T=y(0),E=y(0);O=i=O-176|0;e:if(!(1&s[t+100|0])&&function(e,t,i,n,r){var s,o,a,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=0;return O=s=O-32|0,o=d[t+4>>2],a=d[e+684>>2],e=d[t+12>>2],_=m[e+20>>2],u=m[e+36>>2],c=m[e+24>>2],h=m[e+52>>2],f=m[e+40>>2],g=m[e+56>>2],b=m[e+32>>2],v=m[e>>2],A=m[e+16>>2],C=m[e+4>>2],l=m[e+8>>2],p=m[e+48>>2],S=m[i>>2],x=m[i+4>>2],T=m[i+8>>2],d[s+12>>2]=0,E=l,l=y(S-p),p=c,c=y(x-h),h=y(T-g),m[s+8>>2]=y(y(E*l)+y(p*c))+y(f*h),m[s+4>>2]=y(y(l*C)+y(c*_))+y(h*u),m[s>>2]=y(y(l*v)+y(c*A))+y(h*b),!((n=Oe(a+56|0,s,o,s+16|0,n))>2]=d[t+8>>2],f=m[e+8>>2],g=m[e>>2],b=m[e+4>>2],u=m[e+24>>2],v=m[e+16>>2],A=m[e+20>>2],_=m[e+40>>2],C=m[e+32>>2],p=m[e+36>>2],l=m[s+24>>2],c=m[s+16>>2],h=m[s+20>>2],d[r+16>>2]=0,_=y(y(y(c*C)+y(h*p))+y(l*_)),m[r+12>>2]=_,u=y(y(y(c*v)+y(h*A))+y(l*u)),m[r+8>>2]=u,l=y(y(y(g*c)+y(b*h))+y(f*l)),m[r+4>>2]=l,m[r+20>>2]=-y(y(y(l*y(m[i>>2]-y(n*l)))+y(u*y(m[i+4>>2]-y(n*u))))+y(_*y(m[i+8>>2]-y(n*_)))),R=1),O=s+32|0,R}(d[e+4>>2],d[e+8>>2],t+8|0,m[(m[t+88>>2]>y(0)?16:20)+e>>2],i+72|0)){if(a=m[t+88>>2],n=d[e+12>>2]){if(v=m[n+344>>2],!(y(a+v)>y(0)))break e;n=n+4|0}else{if(!(y(a+y(0))>y(0)))break e;n=d[d[e+8>>2]+8>>2]+4|0}1&s[30748]||mc(30748)&&(d[7685]=0,d[7686]=0,d[7683]=0,d[7684]=0,d[7681]=0,d[7682]=0,d[7679]=0,d[7680]=0,d[7677]=0,d[7678]=0,d[7675]=0,d[7676]=0,uh(30748)),c=d[e+12>>2],r=m[n+52>>2],h=m[t+12>>2],l=m[n+56>>2],o=m[t+16>>2],_=m[n+48>>2],p=m[t+8>>2],d[i+68>>2]=0,l=y(o-l),m[i+64>>2]=l,u=y(h-r),m[i+60>>2]=u,_=y(p-_),m[i+56>>2]=_,A=c?c+264|0:30700,c?(f=m[c+328>>2],g=m[c+332>>2],n=d[e+4>>2],r=m[n+452>>2],C=y(y(y(y(u*f)-y(_*g))+m[c+320>>2])*r),b=m[c+336>>2],_=y(y(m[c+316>>2]+y(y(_*b)-y(l*f)))*r),l=y(y(y(y(l*g)-y(u*b))+m[c+312>>2])*r)):(n=d[e+4>>2],r=m[n+452>>2],_=y(0),l=y(0)),b=m[n+316>>2],S=m[t+32>>2],x=m[t+28>>2],T=m[d[d[e+8>>2]+8>>2]+224>>2],E=m[t+24>>2],d[i+96>>2]=t,u=m[i+84>>2],f=m[i+80>>2],g=m[i+76>>2],Rt(i+8|0,r,a,v,A,i+56|0),t=d[i+20>>2],d[i+108>>2]=d[i+16>>2],d[i+112>>2]=t,t=d[i+28>>2],d[i+116>>2]=d[i+24>>2],d[i+120>>2]=t,t=d[i+36>>2],d[i+124>>2]=d[i+32>>2],d[i+128>>2]=t,t=d[i+44>>2],d[i+132>>2]=d[i+40>>2],d[i+136>>2]=t,t=d[i+52>>2],d[i+140>>2]=d[i+48>>2],d[i+144>>2]=t,n=d[4+(t=i- -64|0)>>2],d[i+156>>2]=d[t>>2],d[i+160>>2]=n,t=d[i+12>>2],d[i+100>>2]=d[i+8>>2],d[i+104>>2]=t,t=d[i+60>>2],d[i+148>>2]=d[i+56>>2],d[i+152>>2]=t,t=d[e+4>>2],m[i+164>>2]=a*m[t+452>>2],p=y(y(p-E)-l),h=y(y(h-x)-_),o=y(y(o-S)-C),a=y(y(y(g*p)+y(f*h))+y(o*u)),r=y(b*T),o=y(o-y(u*a)),l=y(o*o),o=y(p-y(g*a)),h=y(h-y(f*a)),m[i+168>>2]=y(l+y(y(o*o)+y(h*h)))>2]=d[(3&d[d[d[e+8>>2]+8>>2]+204>>2]?t+328|0:t+324|0)>>2],Et(t+808|0,i+72|0),(e=d[e+12>>2])&&Eh(e,0)}O=i+176|0}(e|=0,d[36+(t|=0)>>2])},r[857]=Pd,r[858]=function(e,t){e|=0;var i,n=0,o=0,a=0,l=0,c=0,h=0;if(O=i=O-400|0,n=d[36+(t|=0)>>2],d[4+(t=i+344|0)>>2]=35,d[t+8>>2]=0,d[t>>2]=13316,d[t+44>>2]=1025758986,d[t+20>>2]=1065353216,d[t+24>>2]=0,d[t+12>>2]=1065353216,d[t+16>>2]=1065353216,d[t>>2]=13444,d[i+396>>2]=n,d[i+344>>2]=21856,d[i+388>>2]=0,t=d[e+28>>2],o=d[t+4>>2],!(u[n+376|0]&&3&u[d[t+8>>2]+204|0])&&(1&s[26880]||mc(26880)&&(1&s[26932]||mc(26932)&&(d[6722]=0,d[6723]=0,d[6721]=1065353216,d[6724]=0,d[6725]=0,d[6727]=0,d[6728]=0,d[6726]=1065353216,d[6729]=0,d[6730]=0,d[6731]=1065353216,d[6732]=0,uh(26932)),d[6716]=0,d[6717]=0,d[6718]=0,d[6719]=0,t=d[6724],d[6706]=d[6723],d[6707]=t,t=d[6722],d[6704]=d[6721],d[6705]=t,t=d[6726],d[6708]=d[6725],d[6709]=t,t=d[6728],d[6710]=d[6727],d[6711]=t,t=d[6730],d[6712]=d[6729],d[6713]=t,t=d[6732],d[6714]=d[6731],d[6715]=t,uh(26880)),t=d[d[e+28>>2]+12>>2],d[i+80>>2]=0,d[i+84>>2]=0,d[i+72>>2]=1065353216,d[i+76>>2]=0,Bh(i+344|0,o,t,i+72|0,i+288|0)&&(d[(t=i)+92>>2]=0,d[t+96>>2]=0,d[t+84>>2]=0,d[t+88>>2]=0,d[t+76>>2]=0,d[t+80>>2]=0,s[t+224|0]=0,d[t+72>>2]=21376,d[t+60>>2]=0,d[t+64>>2]=0,d[t+56>>2]=n,n=d[d[e+28>>2]+8>>2],d[t+48>>2]=n,d[t+40>>2]=0,o=d[n+236>>2],d[t+32>>2]=0,d[t+16>>2]=n,d[t+44>>2]=n&o<<30>>31,n=d[t+60>>2],d[t+24>>2]=d[t+56>>2],d[t+28>>2]=n,n=d[t+44>>2],d[t+8>>2]=d[t+40>>2],d[t+12>>2]=n,he(e,t+288|0,t+24|0,t+8|0,t+72|0)))){if(d[7717]=d[7717]+1,n=Mn(4+(t=0|r[d[6606]](216,16))|0,0,212),d[t>>2]=21376,Mi(n,i+72|4,100),o=d[(n=i)+188>>2],d[t+112>>2]=d[n+184>>2],d[t+116>>2]=o,o=d[n+180>>2],d[t+104>>2]=d[n+176>>2],d[t+108>>2]=o,o=d[n+204>>2],d[t+128>>2]=d[n+200>>2],d[t+132>>2]=o,o=d[n+196>>2],d[t+120>>2]=d[n+192>>2],d[t+124>>2]=o,o=d[n+212>>2],d[t+136>>2]=d[n+208>>2],d[t+140>>2]=o,o=d[n+220>>2],d[t+144>>2]=d[n+216>>2],d[t+148>>2]=o,s[t+152|0]=u[n+224|0],d[t+212>>2]=d[n+284>>2],o=d[n+280>>2],d[t+204>>2]=d[n+276>>2],d[t+208>>2]=o,o=d[n+272>>2],d[t+196>>2]=d[n+268>>2],d[t+200>>2]=o,o=d[n+264>>2],d[t+188>>2]=d[n+260>>2],d[t+192>>2]=o,o=d[n+256>>2],d[t+180>>2]=d[n+252>>2],d[t+184>>2]=o,o=d[n+248>>2],d[t+172>>2]=d[n+244>>2],d[t+176>>2]=o,o=d[n+240>>2],d[t+164>>2]=d[n+236>>2],d[t+168>>2]=o,o=d[n+232>>2],d[t+156>>2]=d[n+228>>2],d[t+160>>2]=o,n=d[e+24>>2],(0|(o=d[n+852>>2]))==d[n+856>>2]&&!((0|o)>=(0|(l=o?o<<1:1)))){if(l&&(d[7717]=d[7717]+1,c=0|r[d[6606]](l<<2,16),o=d[n+852>>2]),(0|o)>=1)for(;d[(h=a<<2)+c>>2]=d[d[n+860>>2]+h>>2],(0|(a=a+1|0))!=(0|o););(a=d[n+860>>2])&&(u[n+864|0]&&(a&&(d[7718]=d[7718]+1,r[d[6607]](a)),o=d[n+852>>2]),d[n+860>>2]=0),d[n+860>>2]=c,d[n+856>>2]=l,s[n+864|0]=1}d[d[n+860>>2]+(o<<2)>>2]=t,d[n+852>>2]=o+1,o=d[e+24>>2],n=t,3&u[d[d[e+28>>2]+8>>2]+204|0]?(m[t+64>>2]=m[o+344>>2]*m[t+64>>2],e=o+356|0):(m[t+64>>2]=m[o+340>>2]*m[t+64>>2],e=o+352|0),m[n+68>>2]=m[e>>2]*m[t+68>>2]}O=i+400|0},r[859]=z_,r[860]=td,r[861]=pd,r[862]=function(e){return 21996},r[863]=rd,r[864]=function(e){return y(y(r[d[d[(e|=0)>>2]+48>>2]](e)))},r[865]=function(e,t,i){e|=0,t|=0,i|=0;var n,r,s=0,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0);if(s=d[t+52>>2],n=d[s+32>>2],t=d[n>>2],(0|(r=d[s+24>>2]))>=2){for(a=m[i>>2],l=m[i+4>>2],c=m[i+8>>2],o=y(y(y(a*m[t+8>>2])+y(l*m[t+12>>2]))+y(c*m[t+16>>2])),i=0,t=1;s=d[(t<<2)+n>>2],o=(s=(h=y(y(y(a*m[s+8>>2])+y(l*m[s+12>>2]))+y(c*m[s+16>>2])))>o)?h:o,i=s?t:i,(0|r)!=(0|(t=t+1|0)););t=d[(i<<2)+n>>2]}i=d[t+12>>2],d[e>>2]=d[t+8>>2],d[e+4>>2]=i,i=d[t+20>>2],d[e+8>>2]=d[t+16>>2],d[e+12>>2]=i},r[866]=function(e,t,i){e|=0,i|=0,r[d[d[(t|=0)>>2]+64>>2]](e,t,i)},r[867]=td,r[868]=function(e){return 32},r[869]=Pd,r[870]=function(e,t,i){e|=0,t|=0,i|=0;var n,o=0,a=0,l=y(0),c=y(0),h=0,_=0,p=0,f=y(0),g=y(0),v=y(0),A=y(0);if(O=n=O-448|0,i=d[i+36>>2],o=d[t+36>>2],t=d[e+24>>2],!u[d[t+1140>>2]+(d[o+380>>2]+b(d[i+380>>2],d[t+1112>>2])|0)|0]||(0|t)!=d[e+28>>2]|!d[t+1132>>2]){if(d[4+(t=n+392|0)>>2]=35,d[t+8>>2]=0,d[t>>2]=13316,d[t+44>>2]=1025758986,d[t+20>>2]=1065353216,d[t+24>>2]=0,d[t+12>>2]=1065353216,d[t+16>>2]=1065353216,d[t>>2]=13444,d[n+444>>2]=o,d[n+392>>2]=21856,d[n+436>>2]=0,d[4+(t=n+336|0)>>2]=35,d[t+8>>2]=0,d[t>>2]=13316,d[t+44>>2]=1025758986,d[t+20>>2]=1065353216,d[t+24>>2]=0,d[t+12>>2]=1065353216,d[t+16>>2]=1065353216,d[t>>2]=13444,d[n+388>>2]=i,d[n+336>>2]=21856,d[n+380>>2]=0,1&s[26880]||mc(26880)&&(1&s[26932]||mc(26932)&&(d[6722]=0,d[6723]=0,d[6721]=1065353216,d[6724]=0,d[6725]=0,d[6727]=0,d[6728]=0,d[6726]=1065353216,d[6729]=0,d[6730]=0,d[6731]=1065353216,d[6732]=0,uh(26932)),d[6716]=0,d[6717]=0,d[6718]=0,d[6719]=0,t=d[6724],d[6706]=d[6723],d[6707]=t,t=d[6722],d[6704]=d[6721],d[6705]=t,t=d[6726],d[6708]=d[6725],d[6709]=t,t=d[6728],d[6710]=d[6727],d[6711]=t,t=d[6730],d[6712]=d[6729],d[6713]=t,t=d[6732],d[6714]=d[6731],d[6715]=t,uh(26880)),1&s[26880]||mc(26880)&&(1&s[26932]||mc(26932)&&(d[6722]=0,d[6723]=0,d[6721]=1065353216,d[6724]=0,d[6725]=0,d[6727]=0,d[6728]=0,d[6726]=1065353216,d[6729]=0,d[6730]=0,d[6731]=1065353216,d[6732]=0,uh(26932)),d[6716]=0,d[6717]=0,d[6718]=0,d[6719]=0,t=d[6724],d[6706]=d[6723],d[6707]=t,t=d[6722],d[6704]=d[6721],d[6705]=t,t=d[6726],d[6708]=d[6725],d[6709]=t,t=d[6728],d[6710]=d[6727],d[6711]=t,t=d[6730],d[6712]=d[6729],d[6713]=t,t=d[6732],d[6714]=d[6731],d[6715]=t,uh(26880)),l=m[i+232>>2],c=m[o+232>>2],f=m[i+236>>2],g=m[o+236>>2],v=m[i+228>>2],A=m[o+228>>2],d[n+76>>2]=0,m[n+64>>2]=A-v,m[n+72>>2]=g-f,m[n+68>>2]=c-l,Bh(n+392|0,n+336|0,26816,n- -64|0,n+280|0)&&(d[n+84>>2]=0,d[n+88>>2]=0,d[n+76>>2]=0,d[n+80>>2]=0,d[n+24>>2]=0,d[n+8>>2]=0,d[n+52>>2]=0,d[n+56>>2]=0,d[n+48>>2]=o,d[n+36>>2]=0,d[n+40>>2]=0,d[n+32>>2]=i,d[n+68>>2]=0,d[n+72>>2]=0,s[n+216|0]=0,d[n+64>>2]=21376,t=d[n+52>>2],d[n+16>>2]=d[n+48>>2],d[n+20>>2]=t,t=d[n+36>>2],d[n>>2]=d[n+32>>2],d[n+4>>2]=t,he(e,n+280|0,n+16|0,n,n- -64|0))){if(d[7717]=d[7717]+1,t=Mn(4+(i=0|r[d[6606]](216,16))|0,0,212),d[i>>2]=21376,Mi(t,n- -64|4,100),t=d[n+180>>2],d[i+112>>2]=d[n+176>>2],d[i+116>>2]=t,t=d[n+172>>2],d[i+104>>2]=d[n+168>>2],d[i+108>>2]=t,t=d[n+196>>2],d[i+128>>2]=d[n+192>>2],d[i+132>>2]=t,t=d[n+188>>2],d[i+120>>2]=d[n+184>>2],d[i+124>>2]=t,t=d[n+204>>2],d[i+136>>2]=d[n+200>>2],d[i+140>>2]=t,t=d[n+212>>2],d[i+144>>2]=d[n+208>>2],d[i+148>>2]=t,s[i+152|0]=u[n+216|0],d[i+212>>2]=d[n+276>>2],t=d[n+272>>2],d[i+204>>2]=d[n+268>>2],d[i+208>>2]=t,t=d[n+264>>2],d[i+196>>2]=d[n+260>>2],d[i+200>>2]=t,t=d[n+256>>2],d[i+188>>2]=d[n+252>>2],d[i+192>>2]=t,t=d[n+248>>2],d[i+180>>2]=d[n+244>>2],d[i+184>>2]=t,t=d[n+240>>2],d[i+172>>2]=d[n+236>>2],d[i+176>>2]=t,t=d[n+232>>2],d[i+164>>2]=d[n+228>>2],d[i+168>>2]=t,t=d[n+224>>2],d[i+156>>2]=d[n+220>>2],d[i+160>>2]=t,o=d[e+24>>2],(0|(a=d[o+852>>2]))==d[o+856>>2]&&!((0|a)>=(0|(h=a?a<<1:1)))){if(h&&(d[7717]=d[7717]+1,_=0|r[d[6606]](h<<2,16),a=d[o+852>>2]),(0|a)>=1)for(t=0;d[(p=t<<2)+_>>2]=d[d[o+860>>2]+p>>2],(0|a)!=(0|(t=t+1|0)););(t=d[o+860>>2])&&(u[o+864|0]&&(t&&(d[7718]=d[7718]+1,r[d[6607]](t)),a=d[o+852>>2]),d[o+860>>2]=0),d[o+860>>2]=_,d[o+856>>2]=h,s[o+864|0]=1}d[d[o+860>>2]+(a<<2)>>2]=i,d[o+852>>2]=a+1,t=d[e+24>>2],l=m[t+348>>2],e=d[e+28>>2],c=m[e+348>>2],m[i+64>>2]=m[i+64>>2]*(l>c?l:c),m[i+68>>2]=m[i+68>>2]*y(y(m[t+360>>2]+m[e+360>>2])*y(.5))}}else d[7688]=d[7688]+1;O=n+448|0},r[871]=Pd,r[872]=function(e,t,i){e|=0,t|=0,i|=0;var n,o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=0,g=0,v=y(0),C=y(0),S=y(0),T=0,E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0),J=y(0),ee=y(0),te=y(0),ie=0,ne=y(0),re=y(0),se=0;if(o=d[i+36>>2],f=d[o+12>>2],w=m[f+8>>2],n=d[t+36>>2],Q=m[n+8>>2],q=y(w-Q),i=d[o+8>>2],re=m[i+8>>2],F=y(re-Q),k=y(q-F),t=d[o+16>>2],B=m[t+12>>2],K=m[n+12>>2],V=y(B-K),U=m[i+12>>2],N=y(U-K),l=y(V-N),E=m[f+12>>2],Z=y(E-K),G=y(Z-N),O=m[t+8>>2],j=y(O-Q),a=y(j-F),W=y(y(k*l)-y(G*a)),R=m[t+16>>2],$=m[n+16>>2],z=y(R-$),J=m[i+16>>2],L=y(J-$),h=y(z-L),C=m[f+16>>2],ee=y(C-$),H=y(ee-L),X=y(y(G*h)-y(H*l)),Y=y(y(H*a)-y(k*h)),(a=y(y(W*W)+y(y(X*X)+y(Y*Y))))>y(1.1920928955078125e-7)?(h=y(34028234663852886e22),a=y(y(1)/y(x(a))),_=y(W*a),c=y(X*a),l=y(Y*a),p=y(y(L*_)+y(y(F*c)+y(N*l))),(a=y(p*p))y(0)&&(_=y(V-S),c=y(j-P),ne=y(W*y(y(_*D)-y(l*c))),te=l,l=y(z-v),y(ne+y(y(X*y(y(te*l)-y(h*_)))+y(Y*y(y(h*c)-y(l*D)))))>y(0)&&(h=a,y(y(W*y(y(M*c)-y(_*I)))+y(y(X*y(y(_*p)-y(l*M)))+y(Y*y(y(l*I)-y(p*c)))))>y(0)))||(a=y(y(y(k*k)+y(G*G))+y(H*H)),h=y(34028234663852886e22),a>y(1.1920928955078125e-7)&&(S=(v=y(y(-y(y(y(F*k)+y(N*G))+y(L*H)))/a))y(1.1920928955078125e-7)&&(a=(a=y(y(-y(y(y(q*c)+y(Z*p))+y(ee*l)))/a))y(1.1920928955078125e-7)&&(a=(a=y(y(-y(y(y(j*c)+y(V*p))+y(z*l)))/a))>2]),l=y(a*a),a=y(K-m[n+28>>2]),l=y(l+y(a*a)),a=y($-m[n+32>>2]),a=y(x(y(l+y(a*a)))),p=y(m[e+12>>2]+y(a+a)),h>2],O=y(l*C),c=m[i+88>>2],R=y(_*C),l=m[f+88>>2],J=y(a*C),a=m[t+88>>2],C=c<=y(0)||l<=y(0)||a<=y(0)?y(0):y(y(y(O*c)+y(R*l))+y(J*a)),(U=y(E+C))>y(0))){if(g=d[e+4>>2],l=m[g+316>>2],e=d[e+8>>2],_=l>(a=m[e+316>>2])?l:a,c=y(y(E/U)*m[g+332>>2]),l=y(y(C/U)*m[e+332>>2]),h=y(y(-1)/y(x(h))),a=y(h*v),v=y(h*S),h=y(P*h),(0|(e=d[g+832>>2]))==d[g+836>>2]&&!((0|e)>=(0|(ie=e?e<<1:1)))){if(ie&&(d[7717]=d[7717]+1,se=0|r[d[6606]](b(ie,56),16),e=d[g+832>>2]),(0|e)>=1)for(i=0;f=(t=b(i,56))+se|0,T=t+d[g+840>>2]|0,t=d[T+4>>2],d[f>>2]=d[T>>2],d[f+4>>2]=t,t=d[T+52>>2],d[f+48>>2]=d[T+48>>2],d[f+52>>2]=t,t=d[T+44>>2],d[f+40>>2]=d[T+40>>2],d[f+44>>2]=t,t=d[T+36>>2],d[f+32>>2]=d[T+32>>2],d[f+36>>2]=t,t=d[T+28>>2],d[f+24>>2]=d[T+24>>2],d[f+28>>2]=t,t=d[T+20>>2],d[f+16>>2]=d[T+16>>2],d[f+20>>2]=t,t=d[T+12>>2],d[f+8>>2]=d[T+8>>2],d[f+12>>2]=t,(0|(i=i+1|0))!=(0|e););(e=d[g+840>>2])&&(u[g+844|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[g+840>>2]=0),d[g+840>>2]=se,d[g+836>>2]=ie,s[g+844|0]=1,e=d[g+832>>2]}e=d[g+840>>2]+b(e,56)|0,m[e+48>>2]=c,m[e+44>>2]=_,m[e+40>>2]=p,m[e+24>>2]=h,m[e+8>>2]=O,d[e+4>>2]=o,d[e>>2]=n,m[e+52>>2]=l,d[e+36>>2]=0,m[e+32>>2]=a,m[e+28>>2]=v,d[e+20>>2]=0,m[e+16>>2]=J,m[e+12>>2]=R,d[g+832>>2]=d[g+832>>2]+1}},r[873]=function(e,t,i){e|=0,t=y(t),i=y(i);var n,r=0,s=y(0),o=y(0),a=y(0),l=y(0),c=0,h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=0;if((0|(n=d[e+732>>2]))>=1)for(g=d[e+740>>2];r=b(c,52)+g|0,(s=m[r+24>>2])>y(0)&&(o=m[r+28>>2],e=d[r+12>>2],r=d[r+8>>2],h=m[r+8>>2],i=y(m[e+8>>2]-h),_=m[r+12>>2],a=y(m[e+12>>2]-_),u=m[r+16>>2],l=y(m[e+16>>2]-u),p=y(y(y(i*i)+y(a*a))+y(l*l)),(f=y(o+p))>y(1.1920928955078125e-7)&&(o=y(y(y(o-p)/y(s*f))*t),s=y(o*m[r+88>>2]),m[r+16>>2]=u-y(l*s),m[r+12>>2]=_-y(a*s),m[r+8>>2]=h-y(i*s),s=i,i=y(o*m[e+88>>2]),m[e+8>>2]=m[e+8>>2]+y(s*i),m[e+16>>2]=y(l*i)+m[e+16>>2],m[e+12>>2]=y(a*i)+m[e+12>>2])),(0|n)!=(0|(c=c+1|0)););},r[874]=function(e,t,i){e|=0,t=y(t),i=y(i);var n,r,s=0,o=0,a=y(0),l=0,c=y(0),h=y(0),_=y(0),u=y(0),p=0,f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0);if(O=n=O-16|0,(0|(r=d[e+792>>2]))>=1)for(t=y(m[e+336>>2]*t),i=m[e+452>>2];s=d[e+800>>2]+b(p,96)|0,R=m[s+36>>2],P=m[s+28>>2],I=m[s+32>>2],M=m[s+52>>2],D=m[s+44>>2],w=m[s+48>>2],l=d[s>>2],a=m[l+16>>2],o=d[s+20>>2],_=m[o+332>>2],F=a,f=m[s+92>>2],g=m[s+24>>2],c=m[s+4>>2],v=m[s+8>>2],A=m[s+12>>2],C=m[l+8>>2],h=m[s+84>>2],u=m[o+336>>2],T=m[s+80>>2],S=y(y(t*y(y(y(y(y(c*m[o+4>>2])+y(v*m[o+8>>2]))+y(A*m[o+12>>2]))+m[o+52>>2])-C))+y(y(i*y(y(y(_*h)-y(u*T))+m[o+312>>2]))-y(C-m[l+24>>2]))),x=m[l+12>>2],B=u,u=m[s+76>>2],E=m[o+328>>2],h=y(y(t*y(y(y(y(y(c*m[o+20>>2])+y(v*m[o+24>>2]))+y(A*m[o+28>>2]))+m[o+56>>2])-x))+y(y(i*y(m[o+316>>2]+y(y(B*u)-y(h*E))))-y(x-m[l+28>>2]))),a=y(y(t*y(y(y(y(y(c*m[o+36>>2])+y(v*m[o+40>>2]))+y(A*m[o+44>>2]))+m[o+60>>2])-a))+y(y(i*y(y(y(T*E)-y(_*u))+m[o+320>>2]))-y(a-m[l+32>>2]))),_=y(g*y(y(y(S*m[s+60>>2])+y(h*m[s- -64>>2]))+y(a*m[s+68>>2]))),m[l+16>>2]=F+y(f*_),c=y(g*y(y(y(S*D)+y(h*w))+y(a*M))),m[l+12>>2]=x+y(f*c),a=y(g*y(y(y(S*P)+y(h*I))+y(R*a))),m[l+8>>2]=C+y(f*a),d[n+12>>2]=0,m[n+8>>2]=-_,m[n+4>>2]=-c,m[n>>2]=-a,Vs(o,n,s+76|0),(0|r)!=(0|(p=p+1|0)););O=n+16|0},r[875]=function(e,t,i){e|=0,t=y(t),i=y(i);var n,s,o=0,a=y(0),l=y(0),c=0,h=y(0),_=y(0),u=y(0),p=0,f=y(0),g=0,v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0);if(O=n=O-16|0,i=m[e+452>>2],o=d[e+192>>2],x=y(r[d[d[o>>2]+48>>2]](o)),(0|(s=d[e+812>>2]))>=1)for(;o=d[e+820>>2]+b(g,104)|0,c=d[o>>2],(p=d[c+236>>2]<<30>>31&c)?(l=m[p+332>>2],u=m[o+84>>2],f=m[p+336>>2],h=m[o+80>>2],a=y(i*y(y(y(l*u)-y(f*h))+m[p+312>>2])),_=m[p+328>>2],v=l,l=m[o+76>>2],h=y(i*y(y(y(h*_)-y(v*l))+m[p+320>>2])),l=y(i*y(m[p+316>>2]+y(y(f*l)-y(u*_))))):(a=y(0),h=y(0),l=y(0)),c=d[o+24>>2],T=m[c+8>>2],_=y(y(T-m[c+24>>2])-a),a=m[o+4>>2],E=m[c+12>>2],A=y(y(E-m[c+28>>2])-l),l=m[o+8>>2],C=m[c+16>>2],S=y(y(C-m[c+32>>2])-h),h=m[o+12>>2],(u=y(y(y(_*a)+y(A*l))+y(S*h)))<=y(1.1920928955078125e-7)&&(R=m[o+20>>2],P=m[o+36>>2],I=m[o+28>>2],M=m[o+32>>2],D=m[o+52>>2],w=m[o+44>>2],F=m[o+48>>2],B=m[o+68>>2],N=m[o+60>>2],L=m[o- -64>>2],f=m[o+96>>2],k=m[o+100>>2],d[n+12>>2]=0,_=y(_-y(f*y(_-y(a*u)))),v=a,a=y(R+y(y(y(T*a)+y(E*l))+y(C*h))),a=y(k*(a>2]=h,u=y(y(y(_*w)+y(l*F))+y(a*D)),m[n+4>>2]=u,a=y(y(y(I*_)+y(M*l))+y(P*a)),m[n>>2]=a,l=a,a=m[o+92>>2],m[c+8>>2]=m[c+8>>2]-y(l*a),m[c+12>>2]=m[c+12>>2]-y(u*a),m[c+16>>2]=C-y(h*a),p&&Vs(p,n,o+76|0)),(0|s)!=(0|(g=g+1|0)););O=n+16|0},r[876]=function(e,t,i){e|=0,t=y(t),i=y(i);var n,r=0,s=0,o=y(0),a=0,l=0,c=y(0),h=0,_=y(0),u=y(0),p=y(0),f=y(0),g=0,v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=0;if((0|(n=d[e+832>>2]))>=1)for(P=d[e+840>>2];e=r=b(g,56)+P|0,S=y(0),x=y(0),T=y(0),h=d[r>>2],v=m[h+8>>2],s=d[r+4>>2],a=d[s+8>>2],o=m[r+8>>2],l=d[s+12>>2],c=m[r+12>>2],s=d[s+16>>2],t=m[r+16>>2],E=y(y(y(m[a+8>>2]*o)+y(m[l+8>>2]*c))+y(m[s+8>>2]*t)),R=y(y(v-m[h+24>>2])-y(E-y(y(y(o*m[a+24>>2])+y(c*m[l+24>>2]))+y(t*m[s+24>>2])))),p=m[r+24>>2],A=m[h+12>>2],_=y(y(y(o*m[a+12>>2])+y(c*m[l+12>>2]))+y(t*m[s+12>>2])),u=y(y(A-m[h+28>>2])-y(_-y(y(y(o*m[a+28>>2])+y(c*m[l+28>>2]))+y(t*m[s+28>>2])))),f=m[r+28>>2],C=m[h+16>>2],i=y(y(y(o*m[a+16>>2])+y(c*m[l+16>>2]))+y(t*m[s+16>>2])),t=y(y(C-m[h+32>>2])-y(i-y(y(y(o*m[a+32>>2])+y(c*m[l+32>>2]))+y(t*m[s+32>>2])))),o=m[r+32>>2],(c=y(y(y(R*p)+y(u*f))+y(t*o)))>2]-y(y(y(y(v*p)+y(A*f))+y(C*o))-y(y(y(E*p)+y(_*f))+y(i*o)))),T=y(y(o*i)+y(0)),S=y(y(p*i)+y(0)),x=y(y(f*i)+y(0))),i=m[r+48>>2],o=y(t-y(o*c)),t=m[r+44>>2],_=y(T-y(o*t)),m[h+16>>2]=C+y(i*_),u=y(x-y(t*y(u-y(f*c)))),m[h+12>>2]=A+y(i*u),o=i,i=y(S-y(t*y(R-y(p*c)))),m[h+8>>2]=v+y(o*i),t=y(m[r+52>>2]*m[e+8>>2]),m[a+8>>2]=m[a+8>>2]-y(i*t),m[a+12>>2]=m[a+12>>2]-y(u*t),m[a+16>>2]=m[a+16>>2]-y(_*t),t=y(m[r+52>>2]*m[r+12>>2]),m[l+8>>2]=m[l+8>>2]-y(i*t),m[l+12>>2]=m[l+12>>2]-y(u*t),m[l+16>>2]=m[l+16>>2]-y(_*t),t=y(m[r+52>>2]*m[r+16>>2]),m[s+8>>2]=m[s+8>>2]-y(i*t),m[s+12>>2]=m[s+12>>2]-y(u*t),m[s+16>>2]=m[s+16>>2]-y(_*t),(0|n)!=(0|(g=g+1|0)););},r[877]=gd,r[878]=Pd,r[879]=function(e,t,i,n,s){t|=0,i|=0,n|=0,s|=0;var o=0;n=(e=u[16+(e|=0)|0])?t:i,e=d[(e?i:t)+8>>2];e:{t:if(!((0|(t=d[e+268>>2]))<1)){for(s=d[n+8>>2],o=d[e+276>>2],i=0;;){if(d[(i<<2)+o>>2]!=(0|s)){if((0|t)!=(0|(i=i+1|0)))continue;break t}break}if((0|t)!=(0|i))break e}t=d[e+284>>2],r[d[d[t>>2]+36>>2]](t,e,n)}},r[880]=U_,r[881]=Rd,r[882]=function(e){return d[12+(e|=0)>>2]=22300,d[e>>2]=22272,Er(e+12|0),ir(e+72|0),0|e},r[883]=function(e){d[12+(e|=0)>>2]=22300,d[e>>2]=22272,Er(e+12|0),ir(e+72|0),ve(e)},r[884]=function(e,t,i,n,s){t|=0,i|=0,n|=0,s|=0;var o=0;i=u[8+(e|=0)|0]?t:i,d[d[i+4>>2]+4>>2]+-21>>>0<=8&&(o=e+12|0,t=d[d[i+8>>2]+192>>2],function(e,t,i,n,s){var o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0);O=o=O-32|0,d[e+52>>2]=n,d[e+44>>2]=s,m[e+56>>2]=t+y(.05999999865889549),n=d[e+4>>2],r[d[d[n>>2]+28>>2]](n,o+16|0,o),i=d[i+12>>2],t=m[i+20>>2],u=m[i+36>>2],p=m[i+24>>2],c=m[i+40>>2],b=m[i+56>>2],S=m[i+52>>2],x=m[i+4>>2],f=m[i+8>>2],h=m[e+56>>2],E=m[i+48>>2],_=m[i+32>>2],l=m[i>>2],a=m[i+16>>2],A=m[o+24>>2],g=m[o+8>>2],C=m[o+16>>2],M=m[o>>2],D=m[o+20>>2],w=m[o+4>>2],d[e+40>>2]=0,d[e+24>>2]=0,R=y(y(M+C)*y(.5)),P=y(y(w+D)*y(.5)),I=y(y(g+A)*y(.5)),S=y(-S),F=y(y(y(y(l*R)+y(a*P))+y(_*I))+y(y(y(a*S)-y(l*E))-y(_*b))),B=y(l*y(0)),T=y(a*y(0)),A=y(h+y(y(g-A)*y(.5))),g=y(y(v(y(_+y(B+T))))*A),T=y(l+T),l=y(_*y(0)),_=y(h+y(y(M-C)*y(.5))),C=y(y(v(y(T+l)))*_),a=y(v(y(y(B+a)+l))),l=y(h+y(y(w-D)*y(.5))),a=y(g+y(C+y(a*l))),m[e+28>>2]=F+a,m[e+12>>2]=F-a,a=y(y(y(y(R*f)+y(P*p))+y(I*c))+y(y(y(p*S)-y(f*E))-y(c*b))),h=y(f*y(0)),g=y(p*y(0)),C=y(y(v(y(c+y(h+g))))*A),c=y(c*y(0)),p=y(C+y(y(y(v(y(y(f+g)+c)))*_)+y(y(v(y(y(h+p)+c)))*l))),m[e+36>>2]=a+p,c=y(y(y(y(R*x)+y(P*t))+y(I*u))+y(y(y(t*S)-y(x*E))-y(u*b))),f=y(x*y(0)),b=y(t*y(0)),h=y(y(v(y(u+y(f+b))))*A),u=y(u*y(0)),t=y(h+y(y(y(v(y(y(x+b)+u)))*_)+y(y(v(y(y(f+t)+u)))*l))),m[e+32>>2]=c+t,m[e+20>>2]=a-p,m[e+16>>2]=c-t,O=o+32|0}(o,y(r[d[d[t>>2]+48>>2]](t)),i,n,s),r[d[d[t>>2]+64>>2]](t,o,e+24|0,e+40|0))},r[885]=function(e,t,i,n,s){e|=0,t|=0,i|=0,n|=0,s|=0;var o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),w=y(0),F=y(0),B=y(0),N=y(0),L=y(0),k=y(0),V=y(0),U=y(0),G=y(0),j=y(0),W=y(0),z=y(0),H=y(0),X=y(0),Y=y(0),Q=y(0),q=y(0),K=y(0),Z=y(0),$=y(0);return O=n=O-240|0,Z=y(1),s=u[e+8|0],o=y(m[(e=s?i:t)+116>>2]-m[e+52>>2]),a=y(o*o),o=y(m[e+120>>2]-m[e+56>>2]),a=y(a+y(o*o)),o=y(m[e+124>>2]-m[e+60>>2]),a=y(a+y(o*o)),o=m[e+252>>2],a>2],d[i+4>>2]+-21>>>0>8||(w=m[e+92>>2],F=m[e+76>>2],B=m[e+108>>2],N=m[e+88>>2],L=m[e+72>>2],k=m[e+104>>2],V=m[e+100>>2],U=m[e+84>>2],G=m[e+68>>2],p=m[t+36>>2],f=m[t+20>>2],g=m[t+4>>2],j=m[e+28>>2],W=m[e+12>>2],z=m[e+44>>2],H=m[e+24>>2],X=m[e+8>>2],Y=m[e+40>>2],Q=m[e+36>>2],q=m[e+20>>2],K=m[e+4>>2],b=m[t+12>>2],E=m[e+116>>2],v=m[t+28>>2],a=m[e+120>>2],A=m[t+44>>2],R=m[e+124>>2],$=y(y(y(b*E)+y(v*a))+y(A*R)),C=m[t+24>>2],P=y(-m[t+56>>2]),S=m[t+8>>2],x=m[t+52>>2],T=m[t+40>>2],I=m[t+60>>2],_=y(y(y(C*P)-y(S*x))-y(T*I)),o=y(_+y(y(y(S*E)+y(C*a))+y(T*R))),l=m[e+56>>2],c=m[e+52>>2],h=m[e+60>>2],d[n+236>>2]=0,D=y(y(y(v*P)-y(b*x))-y(A*I)),M=y(D+y(y(y(b*c)+y(v*l))+y(A*h))),m[n+232>>2]=M,_=y(_+y(y(y(S*c)+y(C*l))+y(T*h))),m[n+228>>2]=_,x=y(y(y(f*P)-y(g*x))-y(p*I)),l=y(x+y(y(y(g*c)+y(f*l))+y(p*h))),m[n+224>>2]=l,P=l,(c=y(x+y(y(y(g*E)+y(f*a))+y(p*R))))>2]=c,P=c),E=_,o<_&&(m[n+228>>2]=o,E=o),(h=y(D+$))<(a=M)&&(m[n+232>>2]=h,a=h),d[n+220>>2]=0,m[n+216>>2]=M,m[n+212>>2]=_,m[n+208>>2]=l,R=l,l>2]=c,R=c),x=_,_>2]=o,x=o),I=M,M>2]=h,I=h),D=a,a=m[e+248>>2],m[n+232>>2]=D-a,m[n+228>>2]=E-a,m[n+224>>2]=P-a,m[n+216>>2]=a+I,m[n+212>>2]=a+x,m[n+208>>2]=a+R,d[n+128>>2]=0,m[n+124>>2]=h,m[n+120>>2]=o,m[n+116>>2]=c,d[n+112>>2]=0,m[n+108>>2]=y(y(b*F)+y(v*w))+y(A*B),m[n+104>>2]=y(y(b*L)+y(v*N))+y(A*k),m[n+100>>2]=y(y(b*G)+y(v*U))+y(A*V),d[n+96>>2]=0,m[n+92>>2]=y(y(S*F)+y(C*w))+y(T*B),m[n+88>>2]=y(y(S*L)+y(C*N))+y(T*k),m[n+84>>2]=y(y(S*G)+y(C*U))+y(T*V),d[n+80>>2]=0,m[n+76>>2]=y(y(g*F)+y(f*w))+y(p*B),m[n+72>>2]=y(y(g*L)+y(f*N))+y(p*k),d[n- -64>>2]=0,m[n+60>>2]=M,m[n+56>>2]=_,m[n+52>>2]=l,d[n+48>>2]=0,m[n+44>>2]=y(y(b*W)+y(v*j))+y(A*z),m[n+40>>2]=y(y(b*X)+y(v*H))+y(A*Y),m[n+36>>2]=y(y(b*K)+y(v*q))+y(A*Q),d[n+32>>2]=0,m[n+28>>2]=y(y(S*W)+y(C*j))+y(T*z),m[n+24>>2]=y(y(S*X)+y(C*H))+y(T*Y),m[n+20>>2]=y(y(S*K)+y(C*q))+y(T*Q),d[n+16>>2]=0,m[n+12>>2]=y(y(g*W)+y(f*j))+y(p*z),m[n+8>>2]=y(y(g*X)+y(f*H))+y(p*Y),m[n+196>>2]=a,m[n+68>>2]=y(y(g*G)+y(f*U))+y(p*V),m[n+4>>2]=y(y(g*K)+y(f*q))+y(p*Q),d[n>>2]=22416,d[n+200>>2]=d[e+244>>2],i&&(r[d[d[i>>2]+64>>2]](i,n,n+224|0,n+208|0),(o=m[n+200>>2])>2]&&(m[e+244>>2]=o,Z=o)))),O=n+240|0,y(Z)},r[886]=Rd,r[887]=function(e){return d[(e|=0)>>2]=22300,Er(e),ir(e+60|0),0|e},r[888]=function(e){d[(e|=0)>>2]=22300,Er(e),ir(e+60|0),ve(e)},r[889]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o,a=0,l=y(0),c=y(0),h=0,_=y(0),u=y(0),p=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=0,D=0,w=y(0),F=y(0);O=s=O-176|0,o=d[e+48>>2],(a=d[e+52>>2])&&(a=d[a+20>>2])&&1&r[d[d[a>>2]+48>>2]](a)&&(d[s+40>>2]=0,d[s+44>>2]=0,d[s+32>>2]=1065353216,d[s+36>>2]=1065353216,h=d[d[e+52>>2]+20>>2],a=d[e+8>>2],v=m[a+52>>2],u=m[a+12>>2],g=m[a+8>>2],A=m[a+56>>2],C=m[a+28>>2],T=m[a+20>>2],E=m[a+24>>2],R=m[a+60>>2],P=m[a+44>>2],I=m[a+36>>2],p=m[a+40>>2],S=m[a+4>>2],l=m[t+8>>2],c=m[t>>2],_=m[t+4>>2],d[s+148>>2]=0,m[s+144>>2]=R+y(y(y(c*I)+y(_*p))+y(l*P)),m[s+140>>2]=A+y(y(y(c*T)+y(_*E))+y(l*C)),m[s+136>>2]=v+y(y(y(c*S)+y(_*g))+y(l*u)),u=m[a+8>>2],g=m[a+12>>2],l=m[t+20>>2],c=m[t+24>>2],S=m[a+4>>2],_=m[t+16>>2],d[s+20>>2]=0,m[s+16>>2]=R+y(y(y(_*I)+y(l*p))+y(c*P)),m[s+12>>2]=A+y(y(y(_*T)+y(l*E))+y(c*C)),m[s+8>>2]=v+y(y(y(_*S)+y(l*u))+y(c*g)),r[d[d[h>>2]+8>>2]](h,s+136|0,s+8|0,s+32|0),h=d[d[e+52>>2]+20>>2],v=m[a+52>>2],u=m[a+8>>2],g=m[a+12>>2],A=m[a+56>>2],C=m[a+20>>2],T=m[a+24>>2],E=m[a+28>>2],R=m[a+60>>2],P=m[a+36>>2],I=m[a+40>>2],l=m[t+20>>2],p=m[a+44>>2],c=m[t+24>>2],S=m[a+4>>2],_=m[t+16>>2],d[s+148>>2]=0,m[s+144>>2]=R+y(y(y(_*P)+y(l*I))+y(c*p)),m[s+140>>2]=A+y(y(y(_*C)+y(l*T))+y(c*E)),m[s+136>>2]=v+y(y(y(_*S)+y(l*u))+y(c*g)),u=m[a+8>>2],g=m[a+12>>2],l=m[t+36>>2],c=m[t+40>>2],S=m[a+4>>2],_=m[t+32>>2],d[s+20>>2]=0,m[s+16>>2]=R+y(y(y(_*P)+y(l*I))+y(c*p)),m[s+12>>2]=A+y(y(y(_*C)+y(l*T))+y(c*E)),m[s+8>>2]=v+y(y(y(_*S)+y(l*u))+y(c*g)),r[d[d[h>>2]+8>>2]](h,s+136|0,s+8|0,s+32|0),h=d[d[e+52>>2]+20>>2],v=m[a+52>>2],u=m[a+8>>2],g=m[a+12>>2],A=m[a+56>>2],C=m[a+20>>2],T=m[a+24>>2],E=m[a+28>>2],R=m[a+60>>2],P=m[a+36>>2],I=m[a+40>>2],l=m[t+36>>2],p=m[a+44>>2],c=m[t+40>>2],S=m[a+4>>2],_=m[t+32>>2],d[s+148>>2]=0,m[s+144>>2]=R+y(y(y(_*P)+y(l*I))+y(c*p)),m[s+140>>2]=A+y(y(y(_*C)+y(l*T))+y(c*E)),m[s+136>>2]=v+y(y(y(_*S)+y(l*u))+y(c*g)),u=m[a+12>>2],g=m[a+8>>2],S=m[a+4>>2],l=m[t+8>>2],c=m[t>>2],_=m[t+4>>2],d[s+20>>2]=0,m[s+16>>2]=R+y(y(y(c*P)+y(_*I))+y(l*p)),m[s+12>>2]=A+y(y(y(c*C)+y(_*T))+y(l*E)),m[s+8>>2]=v+y(y(y(c*S)+y(_*g))+y(l*u)),r[d[d[h>>2]+8>>2]](h,s+136|0,s+8|0,s+32|0)),d[s+172>>2]=0,a=i<<21|n,d[s+168>>2]=a,d[s+160>>2]=a;e:{t:if(h=b((h=a+(n<<15^-1)|0)>>10^h,9),h=((h^=h>>6)<<11^-1)+h|0,!((h=d[e+108>>2]+-1&(h>>16^h))>>>0>=f[e- -64>>2])&&-1!=(0|(h=d[d[e+72>>2]+(h<<2)>>2]))){for(M=d[e+132>>2];;){if((0|a)!=d[M+(D=h<<2)>>2]){if(-1!=(0|(h=d[d[e+92>>2]+D>>2])))continue;break t}break}if(a=d[e+112>>2]){h=d[4+(a+(h<<3)|0)>>2],t=d[e+8>>2],d[h+8>>2]=d[d[t+192>>2]+8>>2],a=d[e+4>>2],M=d[a+192>>2],d[s+48>>2]=-1,d[s+52>>2]=-1,d[s+44>>2]=a+4,d[s+40>>2]=a,d[s+36>>2]=M,d[s+32>>2]=0,d[s+156>>2]=n,d[s+152>>2]=i,d[s+148>>2]=t+4,d[s+144>>2]=t,d[s+140>>2]=h,d[s+136>>2]=0,t=0|r[d[d[o>>2]+8>>2]](o,s+32|0,s+136|0,0),r[d[d[t>>2]+8>>2]](t,s+32|0,s+136|0,d[e+52>>2],d[e+44>>2]),r[d[d[t>>2]>>2]](t),r[d[d[o>>2]+60>>2]](o,t);break e}}_=m[t+20>>2],T=m[t+36>>2],E=m[t+24>>2],R=m[t+40>>2],v=m[t+4>>2],P=m[t+32>>2],A=m[t+8>>2],C=m[t>>2],I=m[t+16>>2],d[s+124>>2]=0,d[s+108>>2]=0,d[s+92>>2]=0,d[s+76>>2]=0,d[s+60>>2]=0,c=y(I-C),p=y(T-v),u=y(_-v),g=y(P-C),S=l=y(y(c*p)-y(u*g)),w=y(l*l),l=y(R-A),F=y(u*l),u=y(E-A),p=y(F-y(u*p)),c=y(y(u*g)-y(c*l)),u=y(y(1)/y(x(y(w+y(y(p*p)+y(c*c)))))),l=y(y(S*u)*y(.05999999865889549)),m[s+120>>2]=R-l,c=y(y(c*u)*y(.05999999865889549)),m[s+116>>2]=T-c,m[s+104>>2]=E-l,m[s+100>>2]=_-c,m[s+88>>2]=A-l,m[s+84>>2]=v-c,m[s+72>>2]=R+l,m[s+68>>2]=T+c,m[s+56>>2]=E+l,m[s+52>>2]=_+c,d[s+44>>2]=0,_=y(y(p*u)*y(.05999999865889549)),m[s+112>>2]=P-_,m[s+96>>2]=I-_,m[s+80>>2]=C-_,m[s+64>>2]=P+_,m[s+48>>2]=I+_,m[s+40>>2]=A+l,m[s+36>>2]=v+c,m[s+32>>2]=C+_,d[7717]=d[7717]+1,ki(a=0|r[d[6606]](112,16),s+32|0,6),t=d[e+8>>2],d[a+8>>2]=d[d[t+192>>2]+8>>2],h=d[e+4>>2],M=d[h+192>>2],d[s+152>>2]=-1,d[s+156>>2]=-1,d[s+148>>2]=h+4,d[s+144>>2]=h,d[s+140>>2]=M,d[s+136>>2]=0,d[s+28>>2]=n,d[s+24>>2]=i,d[s+20>>2]=t+4,d[s+16>>2]=t,d[s+12>>2]=a,d[s+8>>2]=0,t=0|r[d[d[o>>2]+8>>2]](o,s+136|0,s+8|0,0),r[d[d[t>>2]+8>>2]](t,s+136|0,s+8|0,d[e+52>>2],d[e+44>>2]),r[d[d[t>>2]>>2]](t),r[d[d[o>>2]+60>>2]](o,t),d[s+172>>2]=a,Ot(e+60|0,s+160|0,s+168|0)}O=s+176|0},r[890]=Pd,r[891]=Ai,r[892]=Br,r[893]=function(e){(e=Br(e|=0))&&(d[7718]=d[7718]+1,r[d[6607]](e))},r[894]=function(e){var t=0,i=0,n=0;if(Wn(e|=0),!(!r[d[d[e>>2]+20>>2]](e)|d[e+328>>2]<1))for(;i=d[d[e+336>>2]+(n<<2)>>2],r[d[d[e>>2]+20>>2]](e)&&(t=0|r[d[d[e>>2]+20>>2]](e),1&r[d[d[t>>2]+48>>2]](t)&&(Ie(i,d[e+72>>2]),F(i,d[e+72>>2],d[e+344>>2]))),(t=d[e+72>>2])&&2&r[d[d[t>>2]+48>>2]](t)&&(u[e+348|0]&&qs(i,d[e+72>>2]),u[e+349|0]&&yo(i,d[e+72>>2]),u[e+350|0]&&co(i,d[e+72>>2])),(0|(n=n+1|0))>2];);},r[895]=function(e,t,i,n){e|=0,t|=0,i|=0,n|=0;var s,o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0);O=s=O-256|0,yr(22843),d[s+32>>2]=22900,a=d[t+12>>2],d[s+76>>2]=d[t+8>>2],d[s+80>>2]=a,a=d[t+4>>2],d[s+68>>2]=d[t>>2],d[s+72>>2]=a,a=d[i+12>>2],d[s+92>>2]=d[i+8>>2],d[s+96>>2]=a,a=d[i>>2],o=d[i+4>>2],d[s+104>>2]=0,d[s+108>>2]=0,d[s+112>>2]=0,d[s+116>>2]=0,d[s+124>>2]=0,d[s+128>>2]=0,d[s+120>>2]=1065353216,d[s+132>>2]=0,d[s+136>>2]=0,d[s+140>>2]=1065353216,d[s+144>>2]=0,d[s+84>>2]=a,d[s+88>>2]=o,d[s+248>>2]=n,d[s+100>>2]=1065353216,d[s+244>>2]=e,n=d[s+72>>2],d[s+148>>2]=d[s+68>>2],d[s+152>>2]=n,n=d[s+80>>2],d[s+156>>2]=d[s+76>>2],d[s+160>>2]=n,d[s+164>>2]=1065353216,d[s+176>>2]=0,d[s+180>>2]=0,d[s+168>>2]=0,d[s+172>>2]=0,d[s+184>>2]=1065353216,d[s+196>>2]=0,d[s+200>>2]=0,d[s+188>>2]=0,d[s+192>>2]=0,d[s+204>>2]=1065353216,d[s+208>>2]=0,n=d[i+12>>2],d[s+220>>2]=d[i+8>>2],d[s+224>>2]=n,n=d[i+4>>2],d[s+212>>2]=d[i>>2],d[s+216>>2]=n,_=y(m[i>>2]-m[t>>2]),l=y(m[i+4>>2]-m[t+4>>2]),c=y(m[i+8>>2]-m[t+8>>2]),h=y(y(1)/y(x(y(y(y(_*_)+y(l*l))+y(c*c))))),u=(c=y(c*h))==y(0)?y(1.0000000150474662e30):y(y(1)/c),m[s+44>>2]=u,p=(l=y(l*h))==y(0)?y(1.0000000150474662e30):y(y(1)/l),m[s+40>>2]=p,d[s+60>>2]=u>2]=p>2]=_,d[s+52>>2]=_>2]=y(y(h*y(m[s+84>>2]-m[s+68>>2]))+y(l*y(m[s+88>>2]-m[s+72>>2])))+y(c*y(m[s+92>>2]-m[s+76>>2])),e=d[e+68>>2],d[s+24>>2]=0,d[s+28>>2]=0,d[s+16>>2]=0,d[s+20>>2]=0,d[s+8>>2]=0,d[s+12>>2]=0,d[s>>2]=0,d[s+4>>2]=0,r[d[d[e>>2]+24>>2]](e,t,i,s+32|0,s+16|0,s),As(),O=s+256|0},r[896]=function(e,t){e|=0;var i=0,n=0,r=0,s=0;if(!(t|=0)|8!=d[t+236>>2])xh(e,t);else{e:if(!((0|(i=d[e+328>>2]))<1)){for(r=d[e+336>>2];;){if(d[(s=(n<<2)+r|0)>>2]!=(0|t)){if((0|i)!=(0|(n=n+1|0)))continue;break e}break}(0|n)>=(0|i)||(n=(i=i+-1|0)<<2,d[s>>2]=d[n+r>>2],d[n+d[e+336>>2]>>2]=t,d[e+328>>2]=i)}Nr(e,t)}},r[897]=function(e,t){e|=0;var i=0,n=0,s=0,o=0,a=0,l=0,c=0,h=0,_=0;if(r[d[d[(t|=0)>>2]+32>>2]](t),function(e,t){var i,n;n=0|r[d[d[t>>2]+16>>2]](t,104,1),i=Mn(d[n+8>>2],0,104),d[i+88>>2]=d[e+248>>2],d[i+92>>2]=d[e+252>>2],d[i+96>>2]=d[e+256>>2],d[i+100>>2]=d[e+260>>2],d[i>>2]=d[e+92>>2],d[i+4>>2]=d[e+96>>2],d[i+8>>2]=d[e+100>>2],d[i+12>>2]=d[e+104>>2],d[i+16>>2]=d[e+108>>2],d[i+20>>2]=d[e+116>>2],d[i+24>>2]=d[e+120>>2],d[i+28>>2]=d[e+124>>2],d[i+32>>2]=d[e+128>>2],d[i+36>>2]=d[e+132>>2],d[i+40>>2]=d[e+140>>2],d[i+44>>2]=d[e+144>>2],d[i+48>>2]=d[e+148>>2],d[i+52>>2]=d[e+152>>2],d[i+56>>2]=d[e+168>>2],d[i+60>>2]=d[e+172>>2],d[i+64>>2]=d[e+112>>2],d[i+68>>2]=d[e+156>>2],d[i+72>>2]=d[e+160>>2],d[i+76>>2]=d[e+164>>2],d[i+80>>2]=d[e+136>>2],r[d[d[t>>2]+20>>2]](t,n,18516,1145853764,i)}(e,t),(0|(i=d[e+8>>2]))>=1)for(;n=d[d[e+16>>2]+(s<<2)>>2],8&u[n+236|0]&&(a=t,l=0|r[d[d[n>>2]+16>>2]](n),c=1,o=d[d[t>>2]+16>>2],i=0|r[o](0|a,0|l,0|c),c=t,l=i,a=0|r[d[d[n>>2]+20>>2]](n,d[i+8>>2],t),h=1497645651,_=n,o=d[d[t>>2]+20>>2],r[o](0|c,0|l,0|a,0|h,0|_),i=d[e+8>>2]),(0|(s=s+1|0))<(0|i););Un(e,t),Gt(e,t),r[d[d[t>>2]+36>>2]](t)},r[898]=function(e){return 4},r[899]=function(e,t){no(e|=0,t=y(t)),yr(22788),e=d[e+452>>2],r[d[d[e>>2]+24>>2]](e,t),As()},r[900]=function(e,t){e|=0,t=y(t);var i=0,n=0;if(i=d[e+452>>2],n=e+324|0,r[d[d[i>>2]+16>>2]](i,n,0),i=d[e+452>>2],r[d[d[i>>2]+12>>2]](i),vr(e,t),yr(22822),d[e+328>>2]&&function(e){var t,i=0,n=0,s=0,o=0,a=0,l=0,c=0;if(!((0|(t=d[e+4>>2]))<1)){for(s=d[e+12>>2];a=(0|a)>(0|(n=d[d[s+(i<<2)>>2]+384>>2]))?a:n,(0|t)!=(0|(i=i+1|0)););if((0|t)>=1)for(i=0;;){if(n=d[d[e+12>>2]+(i<<2)>>2],d[n+852>>2]>=1)for(s=0;o=d[d[n+860>>2]+(s<<2)>>2],r[d[d[o>>2]+8>>2]](o,m[n+452>>2],a),(0|(s=s+1|0))>2];);if((0|t)==(0|(i=i+1|0)))break}if((0|a)>=1)for(s=0;;){if(n=0,(0|t)>0)for(;;){if(o=d[d[e+12>>2]+(n<<2)>>2],(0|(l=d[o+852>>2]))>=1)for(i=0;c=d[d[o+860>>2]+(i<<2)>>2],r[d[d[c>>2]+12>>2]](c,m[o+452>>2],y(1)),(0|l)!=(0|(i=i+1|0)););if((0|t)==(0|(n=n+1|0)))break}if((0|a)==(0|(s=s+1|0)))break}if(!((0|t)<1))for(i=0;hr(d[d[e+12>>2]+(i<<2)>>2]),(0|t)!=(0|(i=i+1|0)););}}(n),i=d[e+452>>2],r[d[d[i>>2]+28>>2]](i,y(m[i+12>>2]*t)),As(),d[e+328>>2]>=1)for(i=0;Fn(n=d[d[e+336>>2]+(i<<2)>>2],n),(0|(i=i+1|0))>2];);e=d[e+452>>2],r[d[d[e>>2]+32>>2]](e)},r[901]=Pd,r[902]=function(e,t){t|=0;var i,n=0;return i=d[216+(e|=0)>>2],m[i+4>>2]!=y(0)&&(n=1,t=d[t>>2],r[d[d[i>>2]+8>>2]](i,d[t+188>>2])&&function(e,t,i,n,s,o){var a,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0);O=a=O+-64|0;e:if(32!=d[n+4>>2])!function(e,t,i,n,r,s){var o;O=o=O-32|0,d[o+24>>2]=-1,d[o+28>>2]=-1,d[o+20>>2]=r,d[o+16>>2]=i,d[o+12>>2]=n,d[o+8>>2]=0,G(e,t,o+8|0,s),O=o+32|0}(e,t,i,n,s,o);else{if(!i|8!=d[i+236>>2])break e;if(!function(e,t,i,n){var r,s=0,o=0,a=0;if(O=r=O-32|0,!(d[e+988>>2]|!d[e+752>>2]||(Is(a=e+988|0),d[e+752>>2]<1)))for(;Ui(r,o=d[e+760>>2]+b(s,44)|0,y(0)),d[o+40>>2]=br(a,r,o),(0|(s=s+1|0))>2];);return d[n+12>>2]=1065353216,d[n>>2]=e,d[n+4>>2]=0,d[n+8>>2]=-1,e=function(e,t,i,n,r,s){var o,a=0,l=0,c=0,h=y(0),_=0,u=0,p=0,f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=0;O=o=O-112|0,h=m[t>>2],v=m[i>>2],f=m[t+4>>2],A=m[i+4>>2],g=m[t+8>>2],C=m[i+8>>2],d[o+108>>2]=0,g=y(C-g),m[o+104>>2]=g,f=y(A-f),m[o+100>>2]=f,h=y(v-h),m[o+96>>2]=h;t:if(c=d[e+988>>2])a=d[n>>2],d[o+32>>2]=20996,l=d[t+12>>2],d[o+44>>2]=d[t+8>>2],d[o+48>>2]=l,l=d[t+4>>2],p=d[t>>2],d[o+80>>2]=0,m[o+76>>2]=g,m[o+72>>2]=f,d[o+36>>2]=p,d[o+40>>2]=l,m[o+68>>2]=h,l=d[i+12>>2],d[o+60>>2]=d[i+8>>2],d[o+64>>2]=l,l=d[i+4>>2],d[o+52>>2]=d[i>>2],d[o+56>>2]=l,d[o+88>>2]=0,d[o+92>>2]=0,d[o+84>>2]=a,At(c,t,i,o+32|0),(i=d[o+88>>2])&&(d[n>>2]=d[o+84>>2],d[r>>2]=3,d[s>>2]=(i-d[e+760>>2]|0)/44,u=1);else{if((0|(a=d[e+752>>2]))<1)break t;for(i=0;c=d[e+760>>2]+b(i,44)|0,(h=Ti(t,o+96|0,d[c+8>>2]+8|0,d[c+12>>2]+8|0,d[c+16>>2]+8|0,m[n>>2]))>y(0)&&(d[r>>2]=3,d[s>>2]=i,m[n>>2]=h,u=u+1|0),(0|a)!=(0|(i=i+1|0)););}if(d[e+772>>2]>=1)for(c=0;;){for(S=d[e+780>>2],i=0;p=8+(b(c,104)+S|0)|0,l=b(i,12),a=d[p+(d[l+21024>>2]<<2)>>2],_=d[a+20>>2],d[o+40>>2]=d[a+16>>2],d[o+44>>2]=_,_=d[a+12>>2],d[o+32>>2]=d[a+8>>2],d[o+36>>2]=_,a=d[p+(d[l+21028>>2]<<2)>>2],_=d[a+20>>2],d[o+24>>2]=d[a+16>>2],d[o+28>>2]=_,_=d[a+12>>2],d[o+16>>2]=d[a+8>>2],d[o+20>>2]=_,a=d[p+(d[l+21032>>2]<<2)>>2],l=d[a+20>>2],d[o+8>>2]=d[a+16>>2],d[o+12>>2]=l,l=d[a+12>>2],d[o>>2]=d[a+8>>2],d[o+4>>2]=l,(h=Ti(t,o+96|0,o+32|0,o+16|0,o,m[n>>2]))>y(0)&&(d[r>>2]=4,d[s>>2]=c,m[n>>2]=h,u=u+1|0),4!=(0|(i=i+1|0)););if(!((0|(c=c+1|0))>2]))break}return O=o+112|0,u}(e,t,i,n+12|0,n+4|0,n+8|0),O=r+32|0,0!=(0|e)}(i,e+48|0,t+48|0,a+48|0))break e;if(!((u=m[a+60>>2])<=m[o+4>>2]))break e;d[a+40>>2]=0,n=d[a+56>>2],d[a+44>>2]=n,l=y(m[t+52>>2]-m[e+52>>2]),c=y(m[t+48>>2]-m[e+48>>2]),h=y(m[t+56>>2]-m[e+56>>2]),3==d[a+52>>2]?(p=c,e=d[i+760>>2]+b(n,44)|0,c=m[e+20>>2],f=l,l=m[e+24>>2],g=h,h=m[e+28>>2],y(y(y(p*c)+y(f*l))+y(g*h))>y(0)?(h=y(-h),l=y(-l),c=y(-c)):_=m[e+32>>2]):(_=y(y(1)/y(x(y(y(y(c*c)+y(l*l))+y(h*h))))),h=y(_*y(-h)),l=y(_*y(-l)),c=y(_*y(-c)),_=y(0)),m[a+28>>2]=_,m[a+24>>2]=h,m[a+20>>2]=l,m[a+32>>2]=u,m[a+16>>2]=c,d[a+8>>2]=i,d[a+12>>2]=a+40,y(r[d[d[o>>2]+12>>2]](o,a+8|0,1))}O=a- -64|0}(e+68|0,e+132|0,t,d[t+192>>2],t+4|0,d[e+216>>2])),0|n},r[903]=gd,r[904]=Pd,r[905]=function(e,t,i,n,s){e|=0,i|=0,e=d[8+(t|=0)>>2],t=d[e+284>>2],r[d[d[t>>2]+40>>2]](t,e,d[i+8>>2])},r[906]=U_,r[907]=gr,r[908]=function(e){e|=0,(e=d[7705])&&ve(e)},r[909]=function(e){Mh(30824)},r[910]=function(e,t){e|=0,t|=0;var i=0;return(e=0|r[d[6608]](3+(e+t|0)|0))&&(d[(i=3+(e+t|0)&0-t)-4>>2]=e),0|i},r[911]=function(e){(e|=0)&&r[d[6609]](d[e+-4>>2])},r[912]=function(e){return 0|L(e|=0)},r[913]=Pd,r[914]=gd,r[915]=Pd,r[916]=Fd,r[917]=Fd,r[918]=function(e,t,i){i|=0;var n,s=0;return O=n=O+-64|0,s=1,bc(e|=0,t|=0,0)||(s=0,t&&(t=function(e){var t,i,n,s=0;O=t=O+-64|0,s=d[e>>2],i=d[s+-4>>2],n=d[s+-8>>2],d[t+20>>2]=0,d[t+16>>2]=26120,d[t+12>>2]=e,d[t+8>>2]=26168,s=0,Mn(t+24|0,0,39),e=e+n|0;e:if(bc(i,26168,0))d[t+56>>2]=1,r[d[d[i>>2]+20>>2]](i,t+8|0,e,e,1,0),s=1==d[t+32>>2]?e:0;else{r[d[d[i>>2]+24>>2]](i,t+8|0,e,1,0);t:switch(d[t+44>>2]){case 0:s=1==d[t+48>>2]&&1==d[t+36>>2]&&1==d[t+40>>2]?d[t+28>>2]:0;break e;case 1:break t;default:break e}1!=d[t+32>>2]&&d[t+48>>2]|1!=d[t+36>>2]|1!=d[t+40>>2]||(s=d[t+24>>2])}return O=t- -64|0,s}(t),s=0,t&&(d[n+20>>2]=-1,d[n+16>>2]=e,d[n+12>>2]=0,d[n+8>>2]=t,Mn(n+24|0,0,39),d[n+56>>2]=1,r[d[d[t>>2]+28>>2]](t,n+8|0,d[i>>2],1),s=0,1==d[n+32>>2]&&(d[i>>2]=d[n+24>>2],s=1)))),O=n- -64|0,0|s},r[919]=function(e,t,i,n,r,s){i|=0,n|=0,r|=0,s|=0,bc(e|=0,d[8+(t|=0)>>2],s)&&_s(t,i,n,r)},r[920]=function(e,t,i,n,r){if(i|=0,n|=0,r|=0,bc(e|=0,d[8+(t|=0)>>2],r))1==d[t+28>>2]|d[t+4>>2]!=(0|i)||(d[t+28>>2]=n);else e:if(bc(e,d[t>>2],r)){if(d[t+20>>2]==(0|i)||d[t+16>>2]==(0|i)){if(1!=(0|n))break e;return void(d[t+32>>2]=1)}d[t+20>>2]=i,d[t+32>>2]=n,d[t+40>>2]=d[t+40>>2]+1,1!=d[t+36>>2]|2!=d[t+24>>2]||(s[t+54|0]=1),d[t+44>>2]=4}},r[921]=function(e,t,i,n){i|=0,n|=0,bc(e|=0,d[8+(t|=0)>>2],0)&&_o(t,i,n)},r[922]=Pd,r[923]=function(e,t,i,n,s,o){i|=0,n|=0,s|=0,o|=0,bc(e|=0,d[8+(t|=0)>>2],o)?_s(t,i,n,s):(e=d[e+8>>2],r[d[d[e>>2]+20>>2]](e,t,i,n,s,o))},r[924]=function(e,t,i,n,o){if(i|=0,n|=0,o|=0,bc(e|=0,d[8+(t|=0)>>2],o))1==d[t+28>>2]|d[t+4>>2]!=(0|i)||(d[t+28>>2]=n);else e:{if(bc(e,d[t>>2],o)){if(d[t+20>>2]==(0|i)||d[t+16>>2]==(0|i)){if(1!=(0|n))break e;return void(d[t+32>>2]=1)}d[t+32>>2]=n;t:if(4!=d[t+44>>2]){if(_[t+52>>1]=0,e=d[e+8>>2],r[d[d[e>>2]+20>>2]](e,t,i,i,1,o),u[t+53|0]){if(d[t+44>>2]=3,!u[t+52|0])break t;break e}d[t+44>>2]=4}if(d[t+20>>2]=i,d[t+40>>2]=d[t+40>>2]+1,1!=d[t+36>>2]|2!=d[t+24>>2])break e;return void(s[t+54|0]=1)}e=d[e+8>>2],r[d[d[e>>2]+24>>2]](e,t,i,n,o)}},r[925]=function(e,t,i,n){i|=0,n|=0,bc(e|=0,d[8+(t|=0)>>2],0)?_o(t,i,n):(e=d[e+8>>2],r[d[d[e>>2]+28>>2]](e,t,i,n))},r[926]=Pd,r[927]=function(e,t,i,n,r,o){i|=0,n|=0,r|=0,o|=0;var a=0,l=0,c=0,h=0,p=0,f=0;if(bc(e|=0,d[8+(t|=0)>>2],o))_s(t,i,n,r);else{l=u[t+53|0],a=d[e+12>>2],s[t+53|0]=0,c=u[t+52|0],s[t+52|0]=0,Qa(h=e+16|0,t,i,n,r,o),l|=p=u[t+53|0],c|=f=u[t+52|0];e:if(!((0|a)<2))for(h=h+(a<<3)|0,a=e+24|0;;){if(u[t+54|0])break e;t:{if(f){if(1==d[t+24>>2])break e;if(2&u[e+8|0])break t;break e}if(p&&!(1&s[e+8|0]))break e}if(_[t+52>>1]=0,Qa(a,t,i,n,r,o),l|=p=u[t+53|0],c|=f=u[t+52|0],!((a=a+8|0)>>>0>>0))break}s[t+53|0]=0!=(255&l),s[t+52|0]=0!=(255&c)}},r[928]=function(e,t,i,n,r){i|=0,n|=0,r|=0;var o=0,a=0,l=0,c=0,h=0;if(bc(e|=0,d[8+(t|=0)>>2],r))1==d[t+28>>2]|d[t+4>>2]!=(0|i)||(d[t+28>>2]=n);else e:{if(bc(e,d[t>>2],r)){if(d[t+20>>2]==(0|i)||d[t+16>>2]==(0|i)){if(1!=(0|n))break e;return void(d[t+32>>2]=1)}if(d[t+32>>2]=n,4!=d[t+44>>2]){c=(o=e+16|0)+(d[e+12>>2]<<3)|0,h=t;t:{i:{for(;!(o>>>0>=c>>>0||(_[t+52>>1]=0,Qa(o,t,i,i,1,r),u[t+54|0]));){n:if(u[t+53|0]){if(u[t+52|0]){if(n=1,1==d[t+24>>2])break i;if(l=1,a=1,2&u[e+8|0])break n;break i}if(l=1,n=a,!(1&s[e+8|0]))break i}o=o+8|0}if(n=a,e=4,!l)break t}e=3}if(d[h+44>>2]=e,1&n)break e}if(d[t+20>>2]=i,d[t+40>>2]=d[t+40>>2]+1,1!=d[t+36>>2]|2!=d[t+24>>2])break e;return void(s[t+54|0]=1)}if(a=d[e+12>>2],Za(o=e+16|0,t,i,n,r),!((0|a)<2))if(a=o+(a<<3)|0,o=e+24|0,e=d[e+8>>2],1==d[t+36>>2]||2&e)for(;;){if(u[t+54|0])break e;if(Za(o,t,i,n,r),!((o=o+8|0)>>>0>>0))break}else{if(!(1&e))for(;;){if(u[t+54|0]|1==d[t+36>>2])break e;if(Za(o,t,i,n,r),!((o=o+8|0)>>>0>>0))break e}for(;;){if(u[t+54|0]|(1==d[t+24>>2]?1==d[t+36>>2]:0))break e;if(Za(o,t,i,n,r),!((o=o+8|0)>>>0>>0))break}}}},r[929]=function(e,t,i,n){i|=0,n|=0;var r,s=0;if(bc(e|=0,d[8+(t|=0)>>2],0))_o(t,i,n);else{s=d[e+12>>2],ea(r=e+16|0,t,i,n);e:if(!((0|s)<2))for(s=(s<<3)+r|0,e=e+24|0;;){if(ea(e,t,i,n),u[t+54|0])break e;if(!((e=e+8|0)>>>0>>0))break}}},{__wasm_call_ctors:function(){var e;e=ic(8),d[7705]=e,R(0|e,0),d[7707]=0,d[7708]=0,d[7706]=23024,d[7709]=0,d[7710]=0,d[7711]=0,d[7712]=0,d[7713]=0,d[7714]=0,cc(30824)},__em_js__array_bounds_check_error:function(){return 1024},emscripten_bind_btCollisionWorld_getDispatcher_0:Yl,emscripten_bind_btCollisionWorld_rayTest_3:Xo,emscripten_bind_btCollisionWorld_getPairCache_0:Ph,emscripten_bind_btCollisionWorld_getDispatchInfo_0:sc,emscripten_bind_btCollisionWorld_addCollisionObject_1:ol,emscripten_bind_btCollisionWorld_addCollisionObject_2:Ea,emscripten_bind_btCollisionWorld_addCollisionObject_3:To,emscripten_bind_btCollisionWorld_removeCollisionObject_1:bl,emscripten_bind_btCollisionWorld_getBroadphase_0:Kl,emscripten_bind_btCollisionWorld_convexSweepTest_5:Xs,emscripten_bind_btCollisionWorld_contactPairTest_3:Aa,emscripten_bind_btCollisionWorld_contactTest_2:Ja,emscripten_bind_btCollisionWorld_updateSingleAabb_1:Mc,emscripten_bind_btCollisionWorld_setDebugDrawer_1:Sl,emscripten_bind_btCollisionWorld_getDebugDrawer_0:uc,emscripten_bind_btCollisionWorld_debugDrawWorld_0:gh,emscripten_bind_btCollisionWorld_debugDrawObject_3:zo,emscripten_bind_btCollisionWorld___destroy___0:Nc,emscripten_bind_btCollisionShape_setLocalScaling_1:gl,emscripten_bind_btCollisionShape_getLocalScaling_0:hc,emscripten_bind_btCollisionShape_calculateLocalInertia_2:Ma,emscripten_bind_btCollisionShape_setMargin_1:fl,emscripten_bind_btCollisionShape_getMargin_0:jl,emscripten_bind_btCollisionShape___destroy___0:Nc,emscripten_bind_btCollisionObject_setAnisotropicFriction_2:tl,emscripten_bind_btCollisionObject_getCollisionShape_0:Xl,emscripten_bind_btCollisionObject_setContactProcessingThreshold_1:la,emscripten_bind_btCollisionObject_setActivationState_1:Xa,emscripten_bind_btCollisionObject_forceActivationState_1:pc,emscripten_bind_btCollisionObject_activate_0:n_,emscripten_bind_btCollisionObject_activate_1:yc,emscripten_bind_btCollisionObject_isActive_0:Rh,emscripten_bind_btCollisionObject_isKinematicObject_0:dl,emscripten_bind_btCollisionObject_isStaticObject_0:ul,emscripten_bind_btCollisionObject_isStaticOrKinematicObject_0:pl,emscripten_bind_btCollisionObject_getRestitution_0:Bl,emscripten_bind_btCollisionObject_getFriction_0:Nl,emscripten_bind_btCollisionObject_getRollingFriction_0:Ll,emscripten_bind_btCollisionObject_setRestitution_1:Ac,emscripten_bind_btCollisionObject_setFriction_1:Cc,emscripten_bind_btCollisionObject_setRollingFriction_1:Sc,emscripten_bind_btCollisionObject_getWorldTransform_0:lc,emscripten_bind_btCollisionObject_getCollisionFlags_0:Wl,emscripten_bind_btCollisionObject_setCollisionFlags_1:ha,emscripten_bind_btCollisionObject_setWorldTransform_1:Ec,emscripten_bind_btCollisionObject_setCollisionShape_1:ml,emscripten_bind_btCollisionObject_setCcdMotionThreshold_1:oa,emscripten_bind_btCollisionObject_setCcdSweptSphereRadius_1:aa,emscripten_bind_btCollisionObject_getUserIndex_0:Hl,emscripten_bind_btCollisionObject_setUserIndex_1:ua,emscripten_bind_btCollisionObject_getUserPointer_0:Hl,emscripten_bind_btCollisionObject_setUserPointer_1:ua,emscripten_bind_btCollisionObject_getBroadphaseHandle_0:zl,emscripten_bind_btCollisionObject___destroy___0:Bc,emscripten_bind_btDynamicsWorld_addAction_1:vl,emscripten_bind_btDynamicsWorld_removeAction_1:Rl,emscripten_bind_btDynamicsWorld_getSolverInfo_0:oc,emscripten_bind_btDynamicsWorld_setInternalTickCallback_1:fc,emscripten_bind_btDynamicsWorld_setInternalTickCallback_2:Ka,emscripten_bind_btDynamicsWorld_setInternalTickCallback_3:ma,emscripten_bind_btDynamicsWorld_getDispatcher_0:Yl,emscripten_bind_btDynamicsWorld_rayTest_3:Xo,emscripten_bind_btDynamicsWorld_getPairCache_0:Ph,emscripten_bind_btDynamicsWorld_getDispatchInfo_0:sc,emscripten_bind_btDynamicsWorld_addCollisionObject_1:ol,emscripten_bind_btDynamicsWorld_addCollisionObject_2:Ea,emscripten_bind_btDynamicsWorld_addCollisionObject_3:To,emscripten_bind_btDynamicsWorld_removeCollisionObject_1:bl,emscripten_bind_btDynamicsWorld_getBroadphase_0:Kl,emscripten_bind_btDynamicsWorld_convexSweepTest_5:Xs,emscripten_bind_btDynamicsWorld_contactPairTest_3:Aa,emscripten_bind_btDynamicsWorld_contactTest_2:Ja,emscripten_bind_btDynamicsWorld_updateSingleAabb_1:Mc,emscripten_bind_btDynamicsWorld_setDebugDrawer_1:Sl,emscripten_bind_btDynamicsWorld_getDebugDrawer_0:uc,emscripten_bind_btDynamicsWorld_debugDrawWorld_0:gh,emscripten_bind_btDynamicsWorld_debugDrawObject_3:zo,emscripten_bind_btDynamicsWorld___destroy___0:Nc,emscripten_bind_btTypedConstraint_enableFeedback_1:sa,emscripten_bind_btTypedConstraint_getBreakingImpulseThreshold_0:kl,emscripten_bind_btTypedConstraint_setBreakingImpulseThreshold_1:_a,emscripten_bind_btTypedConstraint_getParam_2:Ko,emscripten_bind_btTypedConstraint_setParam_3:Lo,emscripten_bind_btTypedConstraint___destroy___0:Nc,emscripten_bind_btConcaveShape_setLocalScaling_1:gl,emscripten_bind_btConcaveShape_getLocalScaling_0:hc,emscripten_bind_btConcaveShape_calculateLocalInertia_2:Ma,emscripten_bind_btConcaveShape___destroy___0:Nc,emscripten_bind_btCapsuleShape_btCapsuleShape_2:function(e,t){var i,n;return e=y(e),t=y(t),O=i=O-16|0,m[i+12>>2]=e,m[i+8>>2]=t,function(e,t,i){d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,d[e+52>>2]=1,d[e+4>>2]=10,d[e>>2]=14020,d[e+40>>2]=0,m[e+36>>2]=t,m[e+32>>2]=i*y(.5),m[e+28>>2]=t}(n=nc(56),m[i+12>>2],m[i+8>>2]),O=i+16|0,0|n},emscripten_bind_btCapsuleShape_setMargin_1:fl,emscripten_bind_btCapsuleShape_getMargin_0:jl,emscripten_bind_btCapsuleShape_getUpAxis_0:ql,emscripten_bind_btCapsuleShape_getRadius_0:fh,emscripten_bind_btCapsuleShape_getHalfHeight_0:mh,emscripten_bind_btCapsuleShape_setLocalScaling_1:gl,emscripten_bind_btCapsuleShape_getLocalScaling_0:hc,emscripten_bind_btCapsuleShape_calculateLocalInertia_2:Ma,emscripten_bind_btCapsuleShape___destroy___0:Nc,emscripten_bind_btIDebugDraw_drawLine_3:Qo,emscripten_bind_btIDebugDraw_drawContactPoint_5:Ns,emscripten_bind_btIDebugDraw_reportErrorWarning_1:Tl,emscripten_bind_btIDebugDraw_draw3dText_2:wa,emscripten_bind_btIDebugDraw_setDebugMode_1:Pl,emscripten_bind_btIDebugDraw_getDebugMode_0:dc,emscripten_bind_btIDebugDraw___destroy___0:Nc,emscripten_bind_btDefaultCollisionConfiguration_btDefaultCollisionConfiguration_0:function(){var e,t,i;return O=e=O-32|0,t=ic(92),rl(i=e+8|0),et(t,i),O=e+32|0,0|t},emscripten_bind_btDefaultCollisionConfiguration_btDefaultCollisionConfiguration_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,et(e=ic(92),d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btDefaultCollisionConfiguration___destroy___0:Nc,emscripten_bind_btTriangleMeshShape_setLocalScaling_1:gl,emscripten_bind_btTriangleMeshShape_getLocalScaling_0:hc,emscripten_bind_btTriangleMeshShape_calculateLocalInertia_2:Ma,emscripten_bind_btTriangleMeshShape___destroy___0:Nc,emscripten_bind_btGhostObject_btGhostObject_0:function(){var e;return function(e){kn(e),s[e+280|0]=1,d[e>>2]=4040,d[e+276>>2]=0,d[e+268>>2]=0,d[e+272>>2]=0,d[e+236>>2]=4}(e=nc(284)),0|e},emscripten_bind_btGhostObject_getNumOverlappingObjects_0:Ih,emscripten_bind_btGhostObject_getOverlappingObject_1:Zl,emscripten_bind_btGhostObject_setAnisotropicFriction_2:tl,emscripten_bind_btGhostObject_getCollisionShape_0:Xl,emscripten_bind_btGhostObject_setContactProcessingThreshold_1:la,emscripten_bind_btGhostObject_setActivationState_1:Xa,emscripten_bind_btGhostObject_forceActivationState_1:pc,emscripten_bind_btGhostObject_activate_0:n_,emscripten_bind_btGhostObject_activate_1:yc,emscripten_bind_btGhostObject_isActive_0:Rh,emscripten_bind_btGhostObject_isKinematicObject_0:dl,emscripten_bind_btGhostObject_isStaticObject_0:ul,emscripten_bind_btGhostObject_isStaticOrKinematicObject_0:pl,emscripten_bind_btGhostObject_getRestitution_0:Bl,emscripten_bind_btGhostObject_getFriction_0:Nl,emscripten_bind_btGhostObject_getRollingFriction_0:Ll,emscripten_bind_btGhostObject_setRestitution_1:Ac,emscripten_bind_btGhostObject_setFriction_1:Cc,emscripten_bind_btGhostObject_setRollingFriction_1:Sc,emscripten_bind_btGhostObject_getWorldTransform_0:lc,emscripten_bind_btGhostObject_getCollisionFlags_0:Wl,emscripten_bind_btGhostObject_setCollisionFlags_1:ha,emscripten_bind_btGhostObject_setWorldTransform_1:Ec,emscripten_bind_btGhostObject_setCollisionShape_1:ml,emscripten_bind_btGhostObject_setCcdMotionThreshold_1:oa,emscripten_bind_btGhostObject_setCcdSweptSphereRadius_1:aa,emscripten_bind_btGhostObject_getUserIndex_0:Hl,emscripten_bind_btGhostObject_setUserIndex_1:ua,emscripten_bind_btGhostObject_getUserPointer_0:Hl,emscripten_bind_btGhostObject_setUserPointer_1:ua,emscripten_bind_btGhostObject_getBroadphaseHandle_0:zl,emscripten_bind_btGhostObject___destroy___0:Bc,emscripten_bind_btConeShape_btConeShape_2:function(e,t){var i,n;return e=y(e),t=y(t),O=i=O-16|0,m[i+12>>2]=e,m[i+8>>2]=t,function(e,t,i){d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,m[e+60>>2]=i,m[e+56>>2]=t,d[e>>2]=10900,d[e+72>>2]=2,d[e+64>>2]=0,d[e+68>>2]=1,d[e+4>>2]=11,m[e+36>>2]=t,m[e+32>>2]=i,m[e+28>>2]=t,m[e+52>>2]=t/y(x(y(y(t*t)+y(i*i))))}(n=nc(76),m[i+12>>2],m[i+8>>2]),O=i+16|0,0|n},emscripten_bind_btConeShape_setLocalScaling_1:gl,emscripten_bind_btConeShape_getLocalScaling_0:hc,emscripten_bind_btConeShape_calculateLocalInertia_2:Ma,emscripten_bind_btConeShape___destroy___0:Nc,emscripten_bind_btActionInterface_updateAction_2:Da,emscripten_bind_btActionInterface___destroy___0:Nc,emscripten_bind_btVector3_btVector3_0:function(){var e;return e=nc(16),d[12+(O-16|0)>>2]=e,0|e},emscripten_bind_btVector3_btVector3_3:function(e,t,i){var n,r;return e=y(e),t=y(t),i=y(i),O=n=O-16|0,m[n+12>>2]=e,m[n+8>>2]=t,m[n+4>>2]=i,Zo(r=nc(16),n+12|0,n+8|0,n+4|0),O=n+16|0,0|r},emscripten_bind_btVector3_length_0:hh,emscripten_bind_btVector3_x_0:Ql,emscripten_bind_btVector3_y_0:Ul,emscripten_bind_btVector3_z_0:Gl,emscripten_bind_btVector3_setX_1:ga,emscripten_bind_btVector3_setY_1:pa,emscripten_bind_btVector3_setZ_1:fa,emscripten_bind_btVector3_setValue_3:function(e,t,i,n){var r;e|=0,t=y(t),i=y(i),n=y(n),O=r=O-16|0,d[r+12>>2]=e,m[r+8>>2]=t,m[r+4>>2]=i,m[r>>2]=n,Zo(d[r+12>>2],r+8|0,r+4|0,r),O=r+16|0},emscripten_bind_btVector3_normalize_0:l_,emscripten_bind_btVector3_rotate_2:function(e,t,i){var n;return e|=0,t|=0,i=y(i),O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,m[n+20>>2]=i,1&s[26464]||mc(26464)&&(d[12+(O-16|0)>>2]=26448,uh(26464)),Rr(n,d[n+28>>2],d[n+24>>2],m[n+20>>2]),e=d[n+4>>2],d[6612]=d[n>>2],d[6613]=e,e=d[n+12>>2],d[6614]=d[n+8>>2],d[6615]=e,O=n+32|0,26448},emscripten_bind_btVector3_dot_1:El,emscripten_bind_btVector3_op_mul_1:rc,emscripten_bind_btVector3_op_add_1:$l,emscripten_bind_btVector3_op_sub_1:Jl,emscripten_bind_btVector3___destroy___0:Fh,emscripten_bind_btVehicleRaycaster_castRay_3:Mo,emscripten_bind_btVehicleRaycaster___destroy___0:Nc,emscripten_bind_btQuadWord_x_0:Ql,emscripten_bind_btQuadWord_y_0:Ul,emscripten_bind_btQuadWord_z_0:Gl,emscripten_bind_btQuadWord_w_0:Vl,emscripten_bind_btQuadWord_setX_1:ga,emscripten_bind_btQuadWord_setY_1:pa,emscripten_bind_btQuadWord_setZ_1:fa,emscripten_bind_btQuadWord_setW_1:ca,emscripten_bind_btQuadWord___destroy___0:Dh,emscripten_bind_btCylinderShape_btCylinderShape_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,zn(e=nc(56),d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btCylinderShape_setMargin_1:fl,emscripten_bind_btCylinderShape_getMargin_0:jl,emscripten_bind_btCylinderShape_setLocalScaling_1:gl,emscripten_bind_btCylinderShape_getLocalScaling_0:hc,emscripten_bind_btCylinderShape_calculateLocalInertia_2:Ma,emscripten_bind_btCylinderShape___destroy___0:Nc,emscripten_bind_btDiscreteDynamicsWorld_btDiscreteDynamicsWorld_4:function(e,t,i,n){var r;return e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,Xt(e=nc(324),d[r+12>>2],d[r+8>>2],d[r+4>>2]),O=r+16|0,0|e},emscripten_bind_btDiscreteDynamicsWorld_setGravity_1:yl,emscripten_bind_btDiscreteDynamicsWorld_getGravity_0:function(e){var t;return e|=0,O=t=O-32|0,d[t+28>>2]=e,1&s[26484]||mc(26484)&&(d[12+(O-16|0)>>2]=26468,uh(26484)),e=d[t+28>>2],r[d[d[e>>2]+76>>2]](t+8|0,e),e=d[t+12>>2],d[6617]=d[t+8>>2],d[6618]=e,e=d[t+20>>2],d[6619]=d[t+16>>2],d[6620]=e,O=t+32|0,26468},emscripten_bind_btDiscreteDynamicsWorld_addRigidBody_1:Al,emscripten_bind_btDiscreteDynamicsWorld_addRigidBody_3:Eo,emscripten_bind_btDiscreteDynamicsWorld_removeRigidBody_1:Cl,emscripten_bind_btDiscreteDynamicsWorld_addConstraint_1:hl,emscripten_bind_btDiscreteDynamicsWorld_addConstraint_2:Oa,emscripten_bind_btDiscreteDynamicsWorld_removeConstraint_1:xl,emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_1:da,emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_2:vo,emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_3:bo,emscripten_bind_btDiscreteDynamicsWorld_setContactAddedCallback_1:ka,emscripten_bind_btDiscreteDynamicsWorld_setContactProcessedCallback_1:Va,emscripten_bind_btDiscreteDynamicsWorld_setContactDestroyedCallback_1:Ba,emscripten_bind_btDiscreteDynamicsWorld_getDispatcher_0:Yl,emscripten_bind_btDiscreteDynamicsWorld_rayTest_3:Xo,emscripten_bind_btDiscreteDynamicsWorld_getPairCache_0:Ph,emscripten_bind_btDiscreteDynamicsWorld_getDispatchInfo_0:sc,emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_1:sl,emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_2:xa,emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_3:To,emscripten_bind_btDiscreteDynamicsWorld_removeCollisionObject_1:bl,emscripten_bind_btDiscreteDynamicsWorld_getBroadphase_0:Kl,emscripten_bind_btDiscreteDynamicsWorld_convexSweepTest_5:Xs,emscripten_bind_btDiscreteDynamicsWorld_contactPairTest_3:Aa,emscripten_bind_btDiscreteDynamicsWorld_contactTest_2:Ja,emscripten_bind_btDiscreteDynamicsWorld_updateSingleAabb_1:Mc,emscripten_bind_btDiscreteDynamicsWorld_setDebugDrawer_1:Sl,emscripten_bind_btDiscreteDynamicsWorld_getDebugDrawer_0:uc,emscripten_bind_btDiscreteDynamicsWorld_debugDrawWorld_0:gh,emscripten_bind_btDiscreteDynamicsWorld_debugDrawObject_3:zo,emscripten_bind_btDiscreteDynamicsWorld_addAction_1:vl,emscripten_bind_btDiscreteDynamicsWorld_removeAction_1:Rl,emscripten_bind_btDiscreteDynamicsWorld_getSolverInfo_0:oc,emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_1:fc,emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_2:Ka,emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_3:ma,emscripten_bind_btDiscreteDynamicsWorld___destroy___0:Nc,emscripten_bind_btConvexShape_setLocalScaling_1:gl,emscripten_bind_btConvexShape_getLocalScaling_0:hc,emscripten_bind_btConvexShape_calculateLocalInertia_2:Ma,emscripten_bind_btConvexShape_setMargin_1:fl,emscripten_bind_btConvexShape_getMargin_0:jl,emscripten_bind_btConvexShape___destroy___0:Nc,emscripten_bind_btDispatcher_getNumManifolds_0:_c,emscripten_bind_btDispatcher_getManifoldByIndexInternal_1:Ya,emscripten_bind_btDispatcher___destroy___0:Nc,emscripten_bind_btGeneric6DofConstraint_btGeneric6DofConstraint_3:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,Se(e=nc(1312),d[n+12>>2],d[n+8>>2],1&s[n+7|0]),O=n+16|0,0|e},emscripten_bind_btGeneric6DofConstraint_btGeneric6DofConstraint_5:function(e,t,i,n,r){var o;return e|=0,t|=0,i|=0,n|=0,r|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,s[o+15|0]=r,ze(e=nc(1312),d[o+28>>2],d[o+24>>2],d[o+20>>2],d[o+16>>2],1&s[o+15|0]),O=o+32|0,0|e},emscripten_bind_btGeneric6DofConstraint_setLinearLowerLimit_1:xc,emscripten_bind_btGeneric6DofConstraint_setLinearUpperLimit_1:Tc,emscripten_bind_btGeneric6DofConstraint_setAngularLowerLimit_1:Rc,emscripten_bind_btGeneric6DofConstraint_setAngularUpperLimit_1:Pc,emscripten_bind_btGeneric6DofConstraint_getFrameOffsetA_0:ac,emscripten_bind_btGeneric6DofConstraint_enableFeedback_1:sa,emscripten_bind_btGeneric6DofConstraint_getBreakingImpulseThreshold_0:kl,emscripten_bind_btGeneric6DofConstraint_setBreakingImpulseThreshold_1:_a,emscripten_bind_btGeneric6DofConstraint_getParam_2:Ko,emscripten_bind_btGeneric6DofConstraint_setParam_3:Lo,emscripten_bind_btGeneric6DofConstraint___destroy___0:Nc,emscripten_bind_btStridingMeshInterface_setScaling_1:Ic,emscripten_bind_btStridingMeshInterface___destroy___0:Nc,emscripten_bind_btMotionState_getWorldTransform_1:Il,emscripten_bind_btMotionState_setWorldTransform_1:ml,emscripten_bind_btMotionState___destroy___0:Nc,emscripten_bind_ConvexResultCallback_hasHit_0:Dl,emscripten_bind_ConvexResultCallback_get_m_collisionFilterGroup_0:b_,emscripten_bind_ConvexResultCallback_set_m_collisionFilterGroup_1:$c,emscripten_bind_ConvexResultCallback_get_m_collisionFilterMask_0:u_,emscripten_bind_ConvexResultCallback_set_m_collisionFilterMask_1:Vc,emscripten_bind_ConvexResultCallback_get_m_closestHitFraction_0:s_,emscripten_bind_ConvexResultCallback_set_m_closestHitFraction_1:ah,emscripten_bind_ConvexResultCallback___destroy___0:Nc,emscripten_bind_ContactResultCallback_addSingleResult_7:ds,emscripten_bind_ContactResultCallback___destroy___0:Nc,emscripten_bind_btSoftBodySolver___destroy___0:Nc,emscripten_bind_RayResultCallback_hasHit_0:Fl,emscripten_bind_RayResultCallback_get_m_collisionFilterGroup_0:h_,emscripten_bind_RayResultCallback_set_m_collisionFilterGroup_1:Lc,emscripten_bind_RayResultCallback_get_m_collisionFilterMask_0:__,emscripten_bind_RayResultCallback_set_m_collisionFilterMask_1:kc,emscripten_bind_RayResultCallback_get_m_closestHitFraction_0:s_,emscripten_bind_RayResultCallback_set_m_closestHitFraction_1:ah,emscripten_bind_RayResultCallback_get_m_collisionObject_0:g_,emscripten_bind_RayResultCallback_set_m_collisionObject_1:_h,emscripten_bind_RayResultCallback___destroy___0:Nc,emscripten_bind_btMatrix3x3_setEulerZYX_3:function(e,t,i,n){var r;e|=0,t=y(t),i=y(i),n=y(n),O=r=O-16|0,d[r+12>>2]=e,m[r+8>>2]=t,m[r+4>>2]=i,m[r>>2]=n,function(e,t,i,n){var r;O=r=O-96|0,d[r+92>>2]=e,m[r+88>>2]=t,m[r+84>>2]=i,m[r+80>>2]=n,e=d[r+92>>2],m[r+76>>2]=Uh(m[r+88>>2]),m[r+72>>2]=Uh(m[r+84>>2]),m[r+68>>2]=Uh(m[r+80>>2]),m[r+64>>2]=Vh(m[r+88>>2]),m[r+60>>2]=Vh(m[r+84>>2]),m[r+56>>2]=Vh(m[r+80>>2]),m[r+52>>2]=m[r+76>>2]*m[r+68>>2],m[r+48>>2]=m[r+76>>2]*m[r+56>>2],m[r+44>>2]=m[r+64>>2]*m[r+68>>2],m[r+40>>2]=m[r+64>>2]*m[r+56>>2],m[r+36>>2]=m[r+72>>2]*m[r+68>>2],m[r+32>>2]=y(m[r+60>>2]*m[r+44>>2])-m[r+48>>2],m[r+28>>2]=y(m[r+60>>2]*m[r+52>>2])+m[r+40>>2],m[r+24>>2]=m[r+72>>2]*m[r+56>>2],m[r+20>>2]=y(m[r+60>>2]*m[r+40>>2])+m[r+52>>2],m[r+16>>2]=y(m[r+60>>2]*m[r+48>>2])-m[r+44>>2],m[r+12>>2]=-m[r+60>>2],m[r+8>>2]=m[r+72>>2]*m[r+64>>2],m[r+4>>2]=m[r+72>>2]*m[r+76>>2],vs(e,r+36|0,r+32|0,r+28|0,r+24|0,r+20|0,r+16|0,r+12|0,r+8|0,r+4|0),O=r+96|0}(d[r+12>>2],m[r+8>>2],m[r+4>>2],m[r>>2]),O=r+16|0},emscripten_bind_btMatrix3x3_getRotation_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,st(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btMatrix3x3_getRow_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,1&s[26504]||mc(26504)&&(d[12+(O-16|0)>>2]=26488,uh(26504)),t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,e=d[e+12>>2]+(d[e+8>>2]<<4)|0,t=d[e+4>>2],d[6622]=d[e>>2],d[6623]=t,t=d[e+12>>2],d[6624]=d[e+8>>2],d[6625]=t,O=i+16|0,26488},emscripten_bind_btMatrix3x3___destroy___0:Dh,emscripten_bind_btScalarArray_size_0:tc,emscripten_bind_btScalarArray_at_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,O=i+16|0,y(m[d[d[e+12>>2]+12>>2]+(d[e+8>>2]<<2)>>2])},emscripten_bind_btScalarArray___destroy___0:Th,emscripten_bind_Material_get_m_kLST_0:s_,emscripten_bind_Material_set_m_kLST_1:ah,emscripten_bind_Material_get_m_kAST_0:o_,emscripten_bind_Material_set_m_kAST_1:lh,emscripten_bind_Material_get_m_kVST_0:t_,emscripten_bind_Material_set_m_kVST_1:th,emscripten_bind_Material_get_m_flags_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+16>>2]},emscripten_bind_Material_set_m_flags_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+16>>2]=d[i+8>>2]},emscripten_bind_Material___destroy___0:Dh,emscripten_bind_btDispatcherInfo_get_m_timeStep_0:d_,emscripten_bind_btDispatcherInfo_set_m_timeStep_1:bh,emscripten_bind_btDispatcherInfo_get_m_stepCount_0:m_,emscripten_bind_btDispatcherInfo_set_m_stepCount_1:dh,emscripten_bind_btDispatcherInfo_get_m_dispatchFunc_0:g_,emscripten_bind_btDispatcherInfo_set_m_dispatchFunc_1:_h,emscripten_bind_btDispatcherInfo_get_m_timeOfImpact_0:t_,emscripten_bind_btDispatcherInfo_set_m_timeOfImpact_1:th,emscripten_bind_btDispatcherInfo_get_m_useContinuous_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,1&s[d[t+12>>2]+16|0]},emscripten_bind_btDispatcherInfo_set_m_useContinuous_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,s[d[i+12>>2]+16|0]=1&s[i+11|0]},emscripten_bind_btDispatcherInfo_get_m_enableSatConvex_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,1&s[d[t+12>>2]+24|0]},emscripten_bind_btDispatcherInfo_set_m_enableSatConvex_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,s[d[i+12>>2]+24|0]=1&s[i+11|0]},emscripten_bind_btDispatcherInfo_get_m_enableSPU_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,1&s[d[t+12>>2]+25|0]},emscripten_bind_btDispatcherInfo_set_m_enableSPU_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,s[d[i+12>>2]+25|0]=1&s[i+11|0]},emscripten_bind_btDispatcherInfo_get_m_useEpa_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,1&s[d[t+12>>2]+26|0]},emscripten_bind_btDispatcherInfo_set_m_useEpa_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,s[d[i+12>>2]+26|0]=1&s[i+11|0]},emscripten_bind_btDispatcherInfo_get_m_allowedCcdPenetration_0:jh,emscripten_bind_btDispatcherInfo_set_m_allowedCcdPenetration_1:Gc,emscripten_bind_btDispatcherInfo_get_m_useConvexConservativeDistanceUtil_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,1&s[d[t+12>>2]+32|0]},emscripten_bind_btDispatcherInfo_set_m_useConvexConservativeDistanceUtil_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,s[d[i+12>>2]+32|0]=1&s[i+11|0]},emscripten_bind_btDispatcherInfo_get_m_convexConservativeDistanceThreshold_0:Kh,emscripten_bind_btDispatcherInfo_set_m_convexConservativeDistanceThreshold_1:Qc,emscripten_bind_btDispatcherInfo___destroy___0:Dh,emscripten_bind_btWheelInfoConstructionInfo_get_m_chassisConnectionCS_0:V_,emscripten_bind_btWheelInfoConstructionInfo_set_m_chassisConnectionCS_1:$o,emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelDirectionCS_0:D_,emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelDirectionCS_1:jo,emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelAxleCS_0:x_,emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelAxleCS_1:Bo,emscripten_bind_btWheelInfoConstructionInfo_get_m_suspensionRestLength_0:Wh,emscripten_bind_btWheelInfoConstructionInfo_set_m_suspensionRestLength_1:jc,emscripten_bind_btWheelInfoConstructionInfo_get_m_maxSuspensionTravelCm_0:zh,emscripten_bind_btWheelInfoConstructionInfo_set_m_maxSuspensionTravelCm_1:Wc,emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelRadius_0:Xh,emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelRadius_1:zc,emscripten_bind_btWheelInfoConstructionInfo_get_m_suspensionStiffness_0:Yh,emscripten_bind_btWheelInfoConstructionInfo_set_m_suspensionStiffness_1:Hc,emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelsDampingCompression_0:Qh,emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelsDampingCompression_1:Xc,emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelsDampingRelaxation_0:qh,emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelsDampingRelaxation_1:Yc,emscripten_bind_btWheelInfoConstructionInfo_get_m_frictionSlip_0:Zh,emscripten_bind_btWheelInfoConstructionInfo_set_m_frictionSlip_1:qc,emscripten_bind_btWheelInfoConstructionInfo_get_m_maxSuspensionForce_0:r_,emscripten_bind_btWheelInfoConstructionInfo_set_m_maxSuspensionForce_1:Kc,emscripten_bind_btWheelInfoConstructionInfo_get_m_bIsFrontWheel_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,1&s[d[t+12>>2]+80|0]},emscripten_bind_btWheelInfoConstructionInfo_set_m_bIsFrontWheel_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,s[d[i+12>>2]+80|0]=1&s[i+11|0]},emscripten_bind_btWheelInfoConstructionInfo___destroy___0:Dh,emscripten_bind_btConvexTriangleMeshShape_btConvexTriangleMeshShape_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,Nh(e=nc(96),d[t+12>>2],1),O=t+16|0,0|e},emscripten_bind_btConvexTriangleMeshShape_btConvexTriangleMeshShape_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,Nh(e=nc(96),d[i+12>>2],1&s[i+11|0]),O=i+16|0,0|e},emscripten_bind_btConvexTriangleMeshShape_setLocalScaling_1:gl,emscripten_bind_btConvexTriangleMeshShape_getLocalScaling_0:hc,emscripten_bind_btConvexTriangleMeshShape_calculateLocalInertia_2:Ma,emscripten_bind_btConvexTriangleMeshShape_setMargin_1:fl,emscripten_bind_btConvexTriangleMeshShape_getMargin_0:jl,emscripten_bind_btConvexTriangleMeshShape___destroy___0:Nc,emscripten_bind_btBroadphaseInterface_getOverlappingPairCache_0:_c,emscripten_bind_btBroadphaseInterface___destroy___0:Nc,emscripten_bind_btRigidBodyConstructionInfo_btRigidBodyConstructionInfo_3:function(e,t,i){var n,r,s;return e=y(e),t|=0,i|=0,O=n=O-48|0,m[n+44>>2]=e,d[n+40>>2]=t,d[n+36>>2]=i,t=ic(140),e=m[n+44>>2],i=d[n+40>>2],s=d[n+36>>2],m[n+12>>2]=0,m[n+8>>2]=0,m[n+4>>2]=0,Zo(r=n+16|0,n+12|0,n+8|0,n+4|0),nr(t,e,i,s,r),O=n+48|0,0|t},emscripten_bind_btRigidBodyConstructionInfo_btRigidBodyConstructionInfo_4:function(e,t,i,n){var r;return e=y(e),t|=0,i|=0,n|=0,O=r=O-16|0,m[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,nr(t=ic(140),m[r+12>>2],d[r+8>>2],d[r+4>>2],d[r>>2]),O=r+16|0,0|t},emscripten_bind_btRigidBodyConstructionInfo_get_m_linearDamping_0:$h,emscripten_bind_btRigidBodyConstructionInfo_set_m_linearDamping_1:nh,emscripten_bind_btRigidBodyConstructionInfo_get_m_angularDamping_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+96>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_angularDamping_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+96>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo_get_m_friction_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+100>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_friction_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+100>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo_get_m_rollingFriction_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+104>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_rollingFriction_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+104>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo_get_m_restitution_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+108>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_restitution_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+108>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo_get_m_linearSleepingThreshold_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+112>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_linearSleepingThreshold_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+112>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo_get_m_angularSleepingThreshold_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+116>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_angularSleepingThreshold_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+116>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalDamping_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,1&s[d[t+12>>2]+120|0]},emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalDamping_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,s[d[i+12>>2]+120|0]=1&s[i+11|0]},emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalDampingFactor_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+124>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalDampingFactor_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+124>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalLinearDampingThresholdSqr_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+128>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalLinearDampingThresholdSqr_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+128>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalAngularDampingThresholdSqr_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+132>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalAngularDampingThresholdSqr_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+132>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalAngularDampingFactor_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+136>>2])},emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalAngularDampingFactor_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+136>>2]=m[i+8>>2]},emscripten_bind_btRigidBodyConstructionInfo___destroy___0:Dh,emscripten_bind_btCollisionConfiguration___destroy___0:Nc,emscripten_bind_btPersistentManifold_btPersistentManifold_0:function(){var e;return function(e){d[e>>2]=1025,d[e+124>>2]=0,d[e+128>>2]=0,s[e+120|0]=0,d[e+116>>2]=0,d[e+132>>2]=0,d[e+136>>2]=0,d[e+140>>2]=0,d[e+144>>2]=0,d[e+148>>2]=0,d[e+152>>2]=0,d[e+308>>2]=0,d[e+312>>2]=0,s[e+304|0]=0,d[e+300>>2]=0,d[e+316>>2]=0,d[e+320>>2]=0,d[e+324>>2]=0,d[e+328>>2]=0,d[e+332>>2]=0,d[e+336>>2]=0,d[e+492>>2]=0,d[e+496>>2]=0,s[e+488|0]=0,d[e+484>>2]=0,d[e+500>>2]=0,d[e+504>>2]=0,d[e+508>>2]=0,d[e+512>>2]=0,d[e+516>>2]=0,d[e+520>>2]=0,s[e+672|0]=0,d[e+668>>2]=0,d[e+676>>2]=0,d[e+680>>2]=0,d[e+684>>2]=0,d[e+688>>2]=0,d[e+692>>2]=0,d[e+696>>2]=0,d[e+700>>2]=0,d[e+704>>2]=0,d[e+748>>2]=0,d[e+768>>2]=0,d[e+740>>2]=0,d[e+744>>2]=0}(e=nc(772)),0|e},emscripten_bind_btPersistentManifold_getBody0_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+740>>2]},emscripten_bind_btPersistentManifold_getBody1_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+744>>2]},emscripten_bind_btPersistentManifold_getNumContacts_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+748>>2]},emscripten_bind_btPersistentManifold_getContactPoint_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,O=i+16|0,(d[e+12>>2]+4|0)+b(d[e+8>>2],184)|0},emscripten_bind_btPersistentManifold___destroy___0:Fh,emscripten_bind_btCompoundShape_btCompoundShape_0:function(){var e;return wr(e=nc(92),1),0|e},emscripten_bind_btCompoundShape_btCompoundShape_1:function(e){var t;return e|=0,O=t=O-16|0,s[t+15|0]=e,wr(e=nc(92),1&s[t+15|0]),O=t+16|0,0|e},emscripten_bind_btCompoundShape_addChildShape_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e,t,i){var n,o,a=y(0),l=0;O=n=O-144|0,d[e+68>>2]=d[e+68>>2]+1,d[n+140>>2]=0,l=d[t+12>>2],d[n+72>>2]=d[t+8>>2],d[n+76>>2]=l,l=d[t+4>>2],d[n+64>>2]=d[t>>2],d[n+68>>2]=l,l=d[t+28>>2],d[n+88>>2]=d[t+24>>2],d[n+92>>2]=l,l=d[t+20>>2],d[n+80>>2]=d[t+16>>2],d[n+84>>2]=l,l=d[t+44>>2],d[n+104>>2]=d[t+40>>2],d[n+108>>2]=l,l=d[t+36>>2],d[n+96>>2]=d[t+32>>2],d[n+100>>2]=l,l=d[t+60>>2],d[n+120>>2]=d[t+56>>2],d[n+124>>2]=l,l=d[t+52>>2],o=d[t+48>>2],d[n+128>>2]=i,d[n+112>>2]=o,d[n+116>>2]=l,d[n+132>>2]=d[i+4>>2],m[n+136>>2]=r[d[d[i>>2]+48>>2]](i),r[d[d[i>>2]+8>>2]](i,t,n+48|0,n+32|0),a=m[n+48>>2],m[e+32>>2]>a&&(m[e+32>>2]=a),a=m[n+32>>2],m[e+48>>2]>2]=a),a=m[n+52>>2],m[e+36>>2]>a&&(m[e+36>>2]=a),a=m[n+36>>2],m[e+52>>2]>2]=a),a=m[n+56>>2],m[e+40>>2]>a&&(m[e+40>>2]=a),a=m[n+40>>2],m[e+56>>2]>2]=a),(t=d[e+64>>2])&&(i=d[n+60>>2],d[n+8>>2]=d[n+56>>2],d[n+12>>2]=i,i=d[n+44>>2],d[n+24>>2]=d[n+40>>2],d[n+28>>2]=i,i=d[n+36>>2],d[n+16>>2]=d[n+32>>2],d[n+20>>2]=i,i=d[n+52>>2],d[n>>2]=d[n+48>>2],d[n+4>>2]=i,d[n+140>>2]=br(t,n,d[e+16>>2])),function(e,t){var i=0,n=0,o=0,a=0,l=0,c=0,h=0;if((0|(a=d[e+4>>2]))==d[e+8>>2]&&!((0|a)>=(0|(l=a?a<<1:1)))){if(l&&(d[7717]=d[7717]+1,h=0|r[d[6606]](b(l,80),16),a=d[e+4>>2]),(0|a)>=1)for(;n=(i=b(c,80))+h|0,i=i+d[e+12>>2]|0,o=d[i+4>>2],d[n>>2]=d[i>>2],d[n+4>>2]=o,o=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=o,o=d[i+28>>2],d[n+24>>2]=d[i+24>>2],d[n+28>>2]=o,o=d[i+20>>2],d[n+16>>2]=d[i+16>>2],d[n+20>>2]=o,o=d[i+44>>2],d[n+40>>2]=d[i+40>>2],d[n+44>>2]=o,o=d[i+36>>2],d[n+32>>2]=d[i+32>>2],d[n+36>>2]=o,o=d[i+60>>2],d[n+56>>2]=d[i+56>>2],d[n+60>>2]=o,o=d[i+52>>2],d[n+48>>2]=d[i+48>>2],d[n+52>>2]=o,o=d[i+68>>2],d[n+64>>2]=d[i+64>>2],d[n+68>>2]=o,o=d[i+76>>2],d[n+72>>2]=d[i+72>>2],d[n+76>>2]=o,(0|(c=c+1|0))!=(0|a););(i=d[e+12>>2])&&(u[e+16|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+12>>2]=0),d[e+12>>2]=h,s[e+16|0]=1,d[e+8>>2]=l,a=d[e+4>>2]}i=d[e+12>>2]+b(a,80)|0,a=d[t+4>>2],d[i>>2]=d[t>>2],d[i+4>>2]=a,n=d[t+12>>2],d[i+8>>2]=d[t+8>>2],d[i+12>>2]=n,n=d[t+28>>2],d[i+24>>2]=d[t+24>>2],d[i+28>>2]=n,n=d[t+20>>2],d[i+16>>2]=d[t+16>>2],d[i+20>>2]=n,n=d[t+44>>2],d[i+40>>2]=d[t+40>>2],d[i+44>>2]=n,n=d[t+36>>2],d[i+32>>2]=d[t+32>>2],d[i+36>>2]=n,n=d[t+60>>2],d[i+56>>2]=d[t+56>>2],d[i+60>>2]=n,n=d[t+52>>2],d[i+48>>2]=d[t+48>>2],d[i+52>>2]=n,n=d[t+76>>2],d[i+72>>2]=d[t+72>>2],d[i+76>>2]=n,n=d[t+68>>2],d[i+64>>2]=d[t+64>>2],d[i+68>>2]=n,d[e+4>>2]=d[e+4>>2]+1}(e+12|0,n- -64|0),O=n+144|0}(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0},emscripten_bind_btCompoundShape_removeChildShape_1:vl,emscripten_bind_btCompoundShape_removeChildShapeByIndex_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,St(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btCompoundShape_getNumChildShapes_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=function(e){var t;return O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2]+12,O=t+16|0,d[d[e+12>>2]+4>>2]}(d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btCompoundShape_getChildShape_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2]+12,d[e+8>>2]=t,O=i+16|0,d[64+(d[d[e+12>>2]+12>>2]+b(d[e+8>>2],80)|0)>>2]}(d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btCompoundShape_updateChildTransform_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,un(d[n+12>>2],d[n+8>>2],d[n+4>>2],1),O=n+16|0},emscripten_bind_btCompoundShape_updateChildTransform_3:function(e,t,i,n){var r;e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,s[r+3|0]=n,un(d[r+12>>2],d[r+8>>2],d[r+4>>2],1&s[r+3|0]),O=r+16|0},emscripten_bind_btCompoundShape_setMargin_1:fl,emscripten_bind_btCompoundShape_getMargin_0:jl,emscripten_bind_btCompoundShape_setLocalScaling_1:gl,emscripten_bind_btCompoundShape_getLocalScaling_0:hc,emscripten_bind_btCompoundShape_calculateLocalInertia_2:Ma,emscripten_bind_btCompoundShape___destroy___0:Nc,emscripten_bind_ClosestConvexResultCallback_ClosestConvexResultCallback_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t,i){var n;O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e){var t;d[12+(t=O-16|0)>>2]=e,e=d[t+12>>2],d[e>>2]=1272,m[e+4>>2]=1,_[e+8>>1]=1,_[e+10>>1]=65535}(e=d[n+12>>2]),d[e>>2]=1132,t=d[n+8>>2],i=d[t+4>>2],d[e+12>>2]=d[t>>2],d[e+16>>2]=i,i=d[t+12>>2],d[e+20>>2]=d[t+8>>2],d[e+24>>2]=i,t=d[n+4>>2],i=d[t+4>>2],d[e+28>>2]=d[t>>2],d[e+32>>2]=i,i=d[t+12>>2],d[e+36>>2]=d[t+8>>2],d[e+40>>2]=i,d[12+(O-16|0)>>2]=e+44,d[12+(O-16|0)>>2]=e+60,d[e+76>>2]=0,O=n+16|0}(e=ic(80),d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_ClosestConvexResultCallback_hasHit_0:Dl,emscripten_bind_ClosestConvexResultCallback_get_m_convexFromWorld_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+12|0},emscripten_bind_ClosestConvexResultCallback_set_m_convexFromWorld_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+12>>2]=d[e>>2],d[t+16>>2]=i,i=d[e+12>>2],d[t+20>>2]=d[e+8>>2],d[t+24>>2]=i},emscripten_bind_ClosestConvexResultCallback_get_m_convexToWorld_0:S_,emscripten_bind_ClosestConvexResultCallback_set_m_convexToWorld_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+28>>2]=d[e>>2],d[t+32>>2]=i,i=d[e+12>>2],d[t+36>>2]=d[e+8>>2],d[t+40>>2]=i},emscripten_bind_ClosestConvexResultCallback_get_m_hitNormalWorld_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+44|0},emscripten_bind_ClosestConvexResultCallback_set_m_hitNormalWorld_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+44>>2]=d[e>>2],d[t+48>>2]=i,i=d[e+12>>2],d[t+52>>2]=d[e+8>>2],d[t+56>>2]=i},emscripten_bind_ClosestConvexResultCallback_get_m_hitPointWorld_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+60|0},emscripten_bind_ClosestConvexResultCallback_set_m_hitPointWorld_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+60>>2]=d[e>>2],d[t+64>>2]=i,i=d[e+12>>2],d[t+68>>2]=d[e+8>>2],d[t+72>>2]=i},emscripten_bind_ClosestConvexResultCallback_get_m_collisionFilterGroup_0:b_,emscripten_bind_ClosestConvexResultCallback_set_m_collisionFilterGroup_1:$c,emscripten_bind_ClosestConvexResultCallback_get_m_collisionFilterMask_0:u_,emscripten_bind_ClosestConvexResultCallback_set_m_collisionFilterMask_1:Vc,emscripten_bind_ClosestConvexResultCallback_get_m_closestHitFraction_0:s_,emscripten_bind_ClosestConvexResultCallback_set_m_closestHitFraction_1:ah,emscripten_bind_ClosestConvexResultCallback___destroy___0:Nc,emscripten_bind_AllHitsRayResultCallback_AllHitsRayResultCallback_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t,i){var n;O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,nl(e=d[n+12>>2]),d[e>>2]=1296,Sh(e+20|0),t=d[n+8>>2],i=d[t+4>>2],d[e+40>>2]=d[t>>2],d[e+44>>2]=i,i=d[t+12>>2],d[e+48>>2]=d[t+8>>2],d[e+52>>2]=i,t=d[n+4>>2],i=d[t+4>>2],d[e+56>>2]=d[t>>2],d[e+60>>2]=i,i=d[t+12>>2],d[e+64>>2]=d[t+8>>2],d[e+68>>2]=i,Sh(e+72|0),Sh(e+92|0),Sh(e+112|0),O=n+16|0}(e=ic(132),d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_AllHitsRayResultCallback_hasHit_0:Fl,emscripten_bind_AllHitsRayResultCallback_get_m_collisionObjects_0:E_,emscripten_bind_AllHitsRayResultCallback_set_m_collisionObjects_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ch(d[i+12>>2]+20|0,d[i+8>>2]),O=i+16|0},emscripten_bind_AllHitsRayResultCallback_get_m_rayFromWorld_0:R_,emscripten_bind_AllHitsRayResultCallback_set_m_rayFromWorld_1:Vo,emscripten_bind_AllHitsRayResultCallback_get_m_rayToWorld_0:P_,emscripten_bind_AllHitsRayResultCallback_set_m_rayToWorld_1:Uo,emscripten_bind_AllHitsRayResultCallback_get_m_hitNormalWorld_0:I_,emscripten_bind_AllHitsRayResultCallback_set_m_hitNormalWorld_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ah(d[i+12>>2]+72|0,d[i+8>>2]),O=i+16|0},emscripten_bind_AllHitsRayResultCallback_get_m_hitPointWorld_0:T_,emscripten_bind_AllHitsRayResultCallback_set_m_hitPointWorld_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ah(d[i+12>>2]+92|0,d[i+8>>2]),O=i+16|0},emscripten_bind_AllHitsRayResultCallback_get_m_hitFractions_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+112|0},emscripten_bind_AllHitsRayResultCallback_set_m_hitFractions_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],d[i+4>>2]=d[d[t+12>>2]+4>>2],t=d[i+4>>2],m[i>>2]=0,function(e,t,i){var n;if(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,t=O-16|0,e=d[n+28>>2],d[t+12>>2]=e,d[n+16>>2]=d[d[t+12>>2]+4>>2],d[n+24>>2]>2])for(d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)d[n+12>>2]=d[n+12>>2]+1;else for(t=d[n+24>>2],d[12+(i=O-16|0)>>2]=e,(0|t)>d[d[i+12>>2]+4>>2]&&ms(e,d[n+24>>2]),d[n+8>>2]=d[n+16>>2];d[n+8>>2]>2];)m[d[e+12>>2]+(d[n+8>>2]<<2)>>2]=m[d[n+20>>2]>>2],d[n+8>>2]=d[n+8>>2]+1;d[e+4>>2]=d[n+24>>2],O=n+32|0}(e,t,i),Ds(d[i+8>>2],d[i+4>>2],d[e+12>>2]),O=i+16|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0}(d[i+12>>2]+112|0,d[i+8>>2]),O=i+16|0},emscripten_bind_AllHitsRayResultCallback_get_m_collisionFilterGroup_0:h_,emscripten_bind_AllHitsRayResultCallback_set_m_collisionFilterGroup_1:Lc,emscripten_bind_AllHitsRayResultCallback_get_m_collisionFilterMask_0:__,emscripten_bind_AllHitsRayResultCallback_set_m_collisionFilterMask_1:kc,emscripten_bind_AllHitsRayResultCallback_get_m_closestHitFraction_0:s_,emscripten_bind_AllHitsRayResultCallback_set_m_closestHitFraction_1:ah,emscripten_bind_AllHitsRayResultCallback_get_m_collisionObject_0:g_,emscripten_bind_AllHitsRayResultCallback_set_m_collisionObject_1:_h,emscripten_bind_AllHitsRayResultCallback___destroy___0:Nc,emscripten_bind_tMaterialArray_size_0:tc,emscripten_bind_tMaterialArray_at_1:Fo,emscripten_bind_tMaterialArray___destroy___0:Th,emscripten_bind_btDefaultVehicleRaycaster_btDefaultVehicleRaycaster_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=O-16|0,e=d[i+12>>2],d[t+12>>2]=e,d[d[t+12>>2]>>2]=1452,d[e>>2]=20032,d[e+4>>2]=d[i+8>>2],O=i+16|0}(e=ic(8),d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btDefaultVehicleRaycaster_castRay_3:Mo,emscripten_bind_btDefaultVehicleRaycaster___destroy___0:Nc,emscripten_bind_btEmptyShape_btEmptyShape_0:function(){var e;return e=nc(32),d[e+4>>2]=35,d[e+8>>2]=0,d[e+12>>2]=0,d[e>>2]=14720,d[e+4>>2]=27,d[e>>2]=13156,0|e},emscripten_bind_btEmptyShape_setLocalScaling_1:gl,emscripten_bind_btEmptyShape_getLocalScaling_0:hc,emscripten_bind_btEmptyShape_calculateLocalInertia_2:Ma,emscripten_bind_btEmptyShape___destroy___0:Nc,emscripten_bind_btConstraintSetting_btConstraintSetting_0:function(){var e,t=0;return e=ic(12),d[12+(t=O-16|0)>>2]=e,t=d[t+12>>2],m[t>>2]=.30000001192092896,m[t+4>>2]=1,m[t+8>>2]=0,0|e},emscripten_bind_btConstraintSetting_get_m_tau_0:d_,emscripten_bind_btConstraintSetting_set_m_tau_1:bh,emscripten_bind_btConstraintSetting_get_m_damping_0:s_,emscripten_bind_btConstraintSetting_set_m_damping_1:ah,emscripten_bind_btConstraintSetting_get_m_impulseClamp_0:o_,emscripten_bind_btConstraintSetting_set_m_impulseClamp_1:lh,emscripten_bind_btConstraintSetting___destroy___0:Dh,emscripten_bind_LocalShapeInfo_get_m_shapePart_0:v_,emscripten_bind_LocalShapeInfo_set_m_shapePart_1:yh,emscripten_bind_LocalShapeInfo_get_m_triangleIndex_0:m_,emscripten_bind_LocalShapeInfo_set_m_triangleIndex_1:dh,emscripten_bind_LocalShapeInfo___destroy___0:Dh,emscripten_bind_btRigidBody_btRigidBody_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e,t){kn(e),s[e+500|0]=1,d[e>>2]=17792,d[e+496>>2]=0,d[e+488>>2]=0,d[e+492>>2]=0,Te(e,t)}(e=nc(616),d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btRigidBody_getCenterOfMassTransform_0:lc,emscripten_bind_btRigidBody_setCenterOfMassTransform_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Yt(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_setSleepingThresholds_2:function(e,t,i){var n;e|=0,t=y(t),i=y(i),O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,m[n+4>>2]=i,function(e,t,i){var n;d[12+(n=O-16|0)>>2]=e,m[n+8>>2]=t,m[n+4>>2]=i,e=d[n+12>>2],m[e+472>>2]=m[n+8>>2],m[e+476>>2]=m[n+4>>2]}(d[n+12>>2],m[n+8>>2],m[n+4>>2]),O=n+16|0},emscripten_bind_btRigidBody_getLinearDamping_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+444>>2])},emscripten_bind_btRigidBody_getAngularDamping_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+448>>2])},emscripten_bind_btRigidBody_setDamping_2:function(e,t,i){var n;e|=0,t=y(t),i=y(i),O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,m[n+4>>2]=i,function(e,t,i){var n;m[8+(n=O-16|0)>>2]=i,m[n+12>>2]=t,d[n+4>>2]=0,d[n>>2]=1065353216,d[e+444>>2]=d[(ty(1)?n:n+12|0)>>2],d[n+4>>2]=0,d[n>>2]=1065353216,d[e+448>>2]=d[(iy(1)?n:n+8|0)>>2]}(d[n+12>>2],m[n+8>>2],m[n+4>>2]),O=n+16|0},emscripten_bind_btRigidBody_setMassProps_2:function(e,t,i){var n;e|=0,t=y(t),i|=0,O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,d[n+4>>2]=i,Pr(d[n+12>>2],m[n+8>>2],d[n+4>>2]),O=n+16|0},emscripten_bind_btRigidBody_getLinearFactor_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+348|0},emscripten_bind_btRigidBody_setLinearFactor_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n=0;O=i=O-32|0,d[i+28>>2]=e,d[i+24>>2]=t,e=d[i+24>>2],n=d[e+4>>2],t=d[i+28>>2],d[t+348>>2]=d[e>>2],d[t+352>>2]=n,n=d[e+12>>2],d[t+356>>2]=d[e+8>>2],d[t+360>>2]=n,zs(e=i+8|0,t+348|0,t+344|0),n=d[e+4>>2],d[t+560>>2]=d[e>>2],d[t+564>>2]=n,n=d[e+12>>2],d[t+568>>2]=d[e+8>>2],d[t+572>>2]=n,O=i+32|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_applyTorque_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,ll(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_applyLocalTorque_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n;O=i=O-48|0,d[i+44>>2]=e,d[i+40>>2]=t,t=O-16|0,e=d[i+44>>2],d[t+12>>2]=e+4,Zr(n=i+8|0,d[t+12>>2],d[i+40>>2]),Gs(t=i+24|0,n,e+544|0),Ro(e+428|0,t),O=i+48|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_applyForce_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e,t,i){var n;O=n=O-48|0,d[n+44>>2]=e,d[n+40>>2]=t,d[n+36>>2]=i,cl(e=d[n+44>>2],d[n+40>>2]),t=d[n+36>>2],Gs(n,d[n+40>>2],e+348|0),ps(i=n+16|0,t,n),ll(e,i),O=n+48|0}(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0},emscripten_bind_btRigidBody_applyCentralForce_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,cl(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_applyCentralLocalForce_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n;O=i=O-48|0,d[i+44>>2]=e,d[i+40>>2]=t,t=O-16|0,e=d[i+44>>2],d[t+12>>2]=e+4,Zr(n=i+8|0,d[t+12>>2],d[i+40>>2]),Gs(t=i+24|0,n,e+348|0),Ro(e+412|0,t),O=i+48|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_applyTorqueImpulse_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ra(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_applyImpulse_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,Vs(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0},emscripten_bind_btRigidBody_applyCentralImpulse_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Pa(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_updateInertiaTensor_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,Tn(d[t+12>>2]),O=t+16|0},emscripten_bind_btRigidBody_getLinearVelocity_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+312|0},emscripten_bind_btRigidBody_getAngularVelocity_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+328|0},emscripten_bind_btRigidBody_setLinearVelocity_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[e+260>>2]=d[e+260>>2]+1,t=d[i+8>>2],i=d[t+4>>2],d[e+312>>2]=d[t>>2],d[e+316>>2]=i,i=d[t+12>>2],d[e+320>>2]=d[t+8>>2],d[e+324>>2]=i}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_setAngularVelocity_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[e+260>>2]=d[e+260>>2]+1,t=d[i+8>>2],i=d[t+4>>2],d[e+328>>2]=d[t>>2],d[e+332>>2]=i,i=d[t+12>>2],d[e+336>>2]=d[t+8>>2],d[e+340>>2]=i}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_getMotionState_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+480>>2]},emscripten_bind_btRigidBody_setMotionState_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[e+480>>2]=d[i+8>>2],d[e+480>>2]&&(t=d[i+8>>2],r[d[d[t>>2]+8>>2]](t,e+4|0)),O=i+16|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_getAngularFactor_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+544|0},emscripten_bind_btRigidBody_setAngularFactor_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[e+260>>2]=d[e+260>>2]+1,t=d[i+8>>2],i=d[t+4>>2],d[e+544>>2]=d[t>>2],d[e+548>>2]=i,i=d[t+12>>2],d[e+552>>2]=d[t+8>>2],d[e+556>>2]=i}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_upcast_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=function(e){var t;return O=t=O-16|0,d[t+8>>2]=e,d[12+(e=O-16|0)>>2]=d[t+8>>2],2&d[d[e+12>>2]+236>>2]?d[t+12>>2]=d[t+8>>2]:d[t+12>>2]=0,O=t+16|0,d[t+12>>2]}(d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btRigidBody_getAabb_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,e=d[n+12>>2],t=d[e+192>>2],r[d[d[t>>2]+8>>2]](t,e+4|0,d[n+8>>2],d[n+4>>2]),O=n+16|0},emscripten_bind_btRigidBody_applyGravity_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,Po(d[t+12>>2]),O=t+16|0},emscripten_bind_btRigidBody_getGravity_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+380|0},emscripten_bind_btRigidBody_setGravity_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ts(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btRigidBody_getBroadphaseProxy_0:zl,emscripten_bind_btRigidBody_clearForces_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e){var t;O=t=O-32|0,d[t+28>>2]=e,e=d[t+28>>2],m[t+24>>2]=0,m[t+20>>2]=0,m[t+16>>2]=0,Zo(e+412|0,t+24|0,t+20|0,t+16|0),m[t+12>>2]=0,m[t+8>>2]=0,m[t+4>>2]=0,Zo(e+428|0,t+12|0,t+8|0,t+4|0),O=t+32|0}(d[t+12>>2]),O=t+16|0},emscripten_bind_btRigidBody_setAnisotropicFriction_2:tl,emscripten_bind_btRigidBody_getCollisionShape_0:Xl,emscripten_bind_btRigidBody_setContactProcessingThreshold_1:la,emscripten_bind_btRigidBody_setActivationState_1:Xa,emscripten_bind_btRigidBody_forceActivationState_1:pc,emscripten_bind_btRigidBody_activate_0:n_,emscripten_bind_btRigidBody_activate_1:yc,emscripten_bind_btRigidBody_isActive_0:Rh,emscripten_bind_btRigidBody_isKinematicObject_0:dl,emscripten_bind_btRigidBody_isStaticObject_0:ul,emscripten_bind_btRigidBody_isStaticOrKinematicObject_0:pl,emscripten_bind_btRigidBody_getRestitution_0:Bl,emscripten_bind_btRigidBody_getFriction_0:Nl,emscripten_bind_btRigidBody_getRollingFriction_0:Ll,emscripten_bind_btRigidBody_setRestitution_1:Ac,emscripten_bind_btRigidBody_setFriction_1:Cc,emscripten_bind_btRigidBody_setRollingFriction_1:Sc,emscripten_bind_btRigidBody_getWorldTransform_0:lc,emscripten_bind_btRigidBody_getCollisionFlags_0:Wl,emscripten_bind_btRigidBody_setCollisionFlags_1:ha,emscripten_bind_btRigidBody_setWorldTransform_1:Ec,emscripten_bind_btRigidBody_setCollisionShape_1:ml,emscripten_bind_btRigidBody_setCcdMotionThreshold_1:oa,emscripten_bind_btRigidBody_setCcdSweptSphereRadius_1:aa,emscripten_bind_btRigidBody_getUserIndex_0:Hl,emscripten_bind_btRigidBody_setUserIndex_1:ua,emscripten_bind_btRigidBody_getUserPointer_0:Hl,emscripten_bind_btRigidBody_setUserPointer_1:ua,emscripten_bind_btRigidBody_getBroadphaseHandle_0:zl,emscripten_bind_btRigidBody___destroy___0:Bc,emscripten_bind_btIndexedMeshArray_size_0:tc,emscripten_bind_btIndexedMeshArray_at_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,O=i+16|0,d[d[e+12>>2]+12>>2]+(d[e+8>>2]<<5)|0},emscripten_bind_btIndexedMeshArray___destroy___0:Th,emscripten_bind_btDbvtBroadphase_btDbvtBroadphase_0:function(){var e;return Jr(e=ic(196),0),0|e},emscripten_bind_btDbvtBroadphase___destroy___0:Nc,emscripten_bind_btHeightfieldTerrainShape_btHeightfieldTerrainShape_9:function(e,t,i,n,r,o,a,l,c){var h;return e|=0,t|=0,i|=0,n=y(n),r=y(r),o=y(o),a|=0,l|=0,c|=0,O=h=O-48|0,d[h+44>>2]=e,d[h+40>>2]=t,d[h+36>>2]=i,m[h+32>>2]=n,m[h+28>>2]=r,m[h+24>>2]=o,d[h+20>>2]=a,d[h+16>>2]=l,s[h+15|0]=c,function(e,t,i,n,r,o,a,l,c,h){d[e+4>>2]=35,d[e+8>>2]=0,d[e+12>>2]=0,d[e>>2]=14720,d[e>>2]=15492,function(e,t,i,n,r,o,a,l,c,h){var _=y(0),u=y(0),p=y(0),f=y(0);d[e+108>>2]=1065353216,d[e+112>>2]=1065353216,d[e+104>>2]=l,s[e+101|0]=0,s[e+102|0]=0,s[e+100|0]=h,d[e+96>>2]=c,d[e+92>>2]=n,m[e+88>>2]=r,m[e+76>>2]=a,m[e+72>>2]=o,d[e+68>>2]=i,d[e+64>>2]=t,d[e+4>>2]=24,d[e+116>>2]=1065353216,d[e+120>>2]=0,r=y(i+-1|0),m[e+84>>2]=r,_=y(t+-1|0),m[e+80>>2]=_;e:{t:{switch(0|l){default:u=m[e+40>>2],p=m[e+24>>2],r=m[e+36>>2],f=m[e+20>>2],a=m[e+32>>2],o=m[e+16>>2];break e;case 0:m[e+32>>2]=a,m[e+16>>2]=o,d[e+44>>2]=0,m[e+40>>2]=r,m[e+36>>2]=_,d[e+28>>2]=0,d[e+20>>2]=0,d[e+24>>2]=0,u=r,r=_;break e;case 1:m[e+32>>2]=_,d[e+16>>2]=0,d[e+44>>2]=0,m[e+40>>2]=r,m[e+36>>2]=a,d[e+24>>2]=0,d[e+28>>2]=0,m[e+20>>2]=o,u=r,r=a,f=o,o=y(0);break t;case 2:}m[e+32>>2]=_,d[e+16>>2]=0,d[e+20>>2]=0,d[e+44>>2]=0,m[e+40>>2]=a,m[e+36>>2]=r,d[e+28>>2]=0,m[e+24>>2]=o,u=a}p=o,a=_,o=y(0)}d[e+60>>2]=0,m[e+56>>2]=y(p+u)*y(.5),m[e+52>>2]=y(f+r)*y(.5),m[e+48>>2]=y(o+a)*y(.5)}(e,t,i,n,r,o,a,l,c,h)}(e=nc(124),d[h+44>>2],d[h+40>>2],d[h+36>>2],m[h+32>>2],m[h+28>>2],m[h+24>>2],d[h+20>>2],d[h+16>>2],1&s[h+15|0]),O=h+48|0,0|e},emscripten_bind_btHeightfieldTerrainShape_setMargin_1:fl,emscripten_bind_btHeightfieldTerrainShape_getMargin_0:jl,emscripten_bind_btHeightfieldTerrainShape_setLocalScaling_1:gl,emscripten_bind_btHeightfieldTerrainShape_getLocalScaling_0:hc,emscripten_bind_btHeightfieldTerrainShape_calculateLocalInertia_2:Ma,emscripten_bind_btHeightfieldTerrainShape___destroy___0:Nc,emscripten_bind_btDefaultSoftBodySolver_btDefaultSoftBodySolver_0:function(){var e;return il(e=ic(40)),0|e},emscripten_bind_btDefaultSoftBodySolver___destroy___0:Nc,emscripten_bind_btCollisionDispatcher_btCollisionDispatcher_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e,t){var i=0,n=0;for(d[e+4>>2]=2,d[e>>2]=4196,d[e+5256>>2]=t,d[e+28>>2]=7088,d[e+60>>2]=78,s[e+24|0]=1,d[e+20>>2]=0,d[e+12>>2]=0,d[e+16>>2]=0,d[e+64>>2]=r[d[d[t>>2]+12>>2]](t),d[e+68>>2]=r[d[d[t>>2]+8>>2]](t);;){for(t=0;n=d[e+5256>>2],d[72+((b(i,144)+e|0)+(t<<2)|0)>>2]=r[d[d[n>>2]+16>>2]](n,i,t),36!=(0|(t=t+1|0)););if(36==(0|(i=i+1|0)))break}}(e=ic(5260),d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btCollisionDispatcher_getNumManifolds_0:_c,emscripten_bind_btCollisionDispatcher_getManifoldByIndexInternal_1:Ya,emscripten_bind_btCollisionDispatcher___destroy___0:Nc,emscripten_bind_btAxisSweep3_btAxisSweep3_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,H_(e=nc(116),d[i+12>>2],d[i+8>>2],16384,0,0),O=i+16|0,0|e},emscripten_bind_btAxisSweep3_btAxisSweep3_3:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,H_(e=nc(116),d[n+12>>2],d[n+8>>2],65535&d[n+4>>2],0,0),O=n+16|0,0|e},emscripten_bind_btAxisSweep3_btAxisSweep3_4:function(e,t,i,n){var r;return e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,H_(e=nc(116),d[r+12>>2],d[r+8>>2],65535&d[r+4>>2],d[r>>2],0),O=r+16|0,0|e},emscripten_bind_btAxisSweep3_btAxisSweep3_5:function(e,t,i,n,r){var o;return e|=0,t|=0,i|=0,n|=0,r|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,s[o+15|0]=r,H_(e=nc(116),d[o+28>>2],d[o+24>>2],65535&d[o+20>>2],d[o+16>>2],1&s[o+15|0]),O=o+32|0,0|e},emscripten_bind_btAxisSweep3___destroy___0:Nc,emscripten_bind_VoidPtr___destroy___0:Dh,emscripten_bind_btSoftBodyWorldInfo_btSoftBodyWorldInfo_0:function(){var e;return function(e){var t;O=t=O-32|0,d[t+28>>2]=e,e=d[t+28>>2],m[e>>2]=1.2000000476837158,m[e+4>>2]=0,m[e+8>>2]=0,m[e+12>>2]=1e3,m[t+24>>2]=0,m[t+20>>2]=0,m[t+16>>2]=0,Zo(e+16|0,t+24|0,t+20|0,t+16|0),d[e+32>>2]=0,d[e+36>>2]=0,m[t+12>>2]=0,m[t+8>>2]=-10,m[t+4>>2]=0,Zo(e+40|0,t+12|0,t+8|0,t+4|0),L_(e+56|0),O=t+32|0}(e=ic(100)),0|e},emscripten_bind_btSoftBodyWorldInfo_get_air_density_0:d_,emscripten_bind_btSoftBodyWorldInfo_set_air_density_1:bh,emscripten_bind_btSoftBodyWorldInfo_get_water_density_0:s_,emscripten_bind_btSoftBodyWorldInfo_set_water_density_1:ah,emscripten_bind_btSoftBodyWorldInfo_get_water_offset_0:o_,emscripten_bind_btSoftBodyWorldInfo_set_water_offset_1:lh,emscripten_bind_btSoftBodyWorldInfo_get_m_maxDisplacement_0:t_,emscripten_bind_btSoftBodyWorldInfo_set_m_maxDisplacement_1:th,emscripten_bind_btSoftBodyWorldInfo_get_water_normal_0:D_,emscripten_bind_btSoftBodyWorldInfo_set_water_normal_1:jo,emscripten_bind_btSoftBodyWorldInfo_get_m_broadphase_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+32>>2]},emscripten_bind_btSoftBodyWorldInfo_set_m_broadphase_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+32>>2]=d[i+8>>2]},emscripten_bind_btSoftBodyWorldInfo_get_m_dispatcher_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+36>>2]},emscripten_bind_btSoftBodyWorldInfo_set_m_dispatcher_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+36>>2]=d[i+8>>2]},emscripten_bind_btSoftBodyWorldInfo_get_m_gravity_0:R_,emscripten_bind_btSoftBodyWorldInfo_set_m_gravity_1:Vo,emscripten_bind_btSoftBodyWorldInfo___destroy___0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&(function(e){var t;O=t=O-16|0,d[t+12>>2]=e,B_(d[t+12>>2]+56|0),O=t+16|0}(e),ve(e)),O=t+16|0},emscripten_bind_btConeTwistConstraint_btConeTwistConstraint_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t,i){var n,r;go(e,5,t),d[e>>2]=19548,t=d[i+12>>2],d[e+308>>2]=d[i+8>>2],d[e+312>>2]=t,t=d[i+4>>2],d[e+300>>2]=d[i>>2],d[e+304>>2]=t,t=d[i+28>>2],d[e+324>>2]=d[i+24>>2],d[e+328>>2]=t,t=d[i+20>>2],d[e+316>>2]=d[i+16>>2],d[e+320>>2]=t,t=d[i+36>>2],d[e+332>>2]=d[i+32>>2],d[e+336>>2]=t,t=d[i+44>>2],d[e+340>>2]=d[i+40>>2],d[e+344>>2]=t,t=d[i+56>>2],n=d[i+60>>2],r=d[i+48>>2],i=d[i+52>>2],s[e+527|0]=0,d[e+356>>2]=t,d[e+360>>2]=n,d[e+348>>2]=r,d[e+352>>2]=i,t=d[e+304>>2],d[e+364>>2]=d[e+300>>2],d[e+368>>2]=t,t=d[e+312>>2],d[e+372>>2]=d[e+308>>2],d[e+376>>2]=t,t=d[e+320>>2],d[e+380>>2]=d[e+316>>2],d[e+384>>2]=t,t=d[e+328>>2],d[e+388>>2]=d[e+324>>2],d[e+392>>2]=t,t=d[e+344>>2],d[e+404>>2]=d[e+340>>2],d[e+408>>2]=t,t=d[e+336>>2],d[e+396>>2]=d[e+332>>2],d[e+400>>2]=t,s[e+552|0]=0,s[e+526|0]=0,_[e+524>>1]=0,d[e+420>>2]=0,d[e+424>>2]=0,d[e+412>>2]=0,d[e+416>>2]=0,d[e+572>>2]=-1082130432,d[e+452>>2]=1566444395,d[e+444>>2]=1566444395,d[e+448>>2]=1566444395,d[e+604>>2]=0,d[e+596>>2]=0,d[e+600>>2]=1060320051,d[e+592>>2]=0,d[e+456>>2]=1028443341,d[e+436>>2]=1065353216,d[e+440>>2]=1008981770,d[e+428>>2]=1065353216,d[e+432>>2]=1050253722}(e=nc(608),d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btConeTwistConstraint_btConeTwistConstraint_4:function(e,t,i,n){var r;return e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,function(e,t,i,n,r){Ao(e,5,t,i),d[e>>2]=19548,t=d[n+12>>2],d[e+308>>2]=d[n+8>>2],d[e+312>>2]=t,t=d[n+4>>2],d[e+300>>2]=d[n>>2],d[e+304>>2]=t,t=d[n+28>>2],d[e+324>>2]=d[n+24>>2],d[e+328>>2]=t,t=d[n+20>>2],d[e+316>>2]=d[n+16>>2],d[e+320>>2]=t,t=d[n+44>>2],d[e+340>>2]=d[n+40>>2],d[e+344>>2]=t,t=d[n+36>>2],d[e+332>>2]=d[n+32>>2],d[e+336>>2]=t,t=d[n+60>>2],d[e+356>>2]=d[n+56>>2],d[e+360>>2]=t,t=d[n+52>>2],d[e+348>>2]=d[n+48>>2],d[e+352>>2]=t,t=d[r+12>>2],d[e+372>>2]=d[r+8>>2],d[e+376>>2]=t,t=d[r+4>>2],d[e+364>>2]=d[r>>2],d[e+368>>2]=t,t=d[r+20>>2],d[e+380>>2]=d[r+16>>2],d[e+384>>2]=t,t=d[r+28>>2],d[e+388>>2]=d[r+24>>2],d[e+392>>2]=t,t=d[r+36>>2],d[e+396>>2]=d[r+32>>2],d[e+400>>2]=t,t=d[r+44>>2],d[e+404>>2]=d[r+40>>2],d[e+408>>2]=t,t=d[r+52>>2],d[e+412>>2]=d[r+48>>2],d[e+416>>2]=t,t=d[r+60>>2],d[e+420>>2]=d[r+56>>2],d[e+424>>2]=t,s[e+552|0]=0,d[e+572>>2]=-1082130432,d[e+524>>2]=0,d[e+444>>2]=1566444395,d[e+448>>2]=1566444395,d[e+592>>2]=0,d[e+428>>2]=1065353216,d[e+432>>2]=1050253722,d[e+436>>2]=1065353216,d[e+440>>2]=1008981770,d[e+596>>2]=0,d[e+600>>2]=1060320051,d[e+604>>2]=0,d[e+452>>2]=1566444395,d[e+456>>2]=1028443341}(e=nc(608),d[r+12>>2],d[r+8>>2],d[r+4>>2],d[r>>2]),O=r+16|0,0|e},emscripten_bind_btConeTwistConstraint_setLimit_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,function(e,t,i){var n;d[12+(n=O-16|0)>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,e=d[n+12>>2];e:{t:switch(d[n+8>>2]+-3|0){case 0:m[e+452>>2]=m[n+4>>2];break e;case 1:m[e+448>>2]=m[n+4>>2];break e;case 2:break t;default:break e}m[e+444>>2]=m[n+4>>2]}}(d[n+12>>2],d[n+8>>2],m[n+4>>2]),O=n+16|0},emscripten_bind_btConeTwistConstraint_setAngularOnly_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,t=1&s[i+11|0],d[12+(e=O-16|0)>>2]=d[i+12>>2],s[e+11|0]=t,s[d[e+12>>2]+524|0]=1&s[e+11|0],O=i+16|0},emscripten_bind_btConeTwistConstraint_setDamping_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+440>>2]=m[e+8>>2],O=i+16|0},emscripten_bind_btConeTwistConstraint_enableMotor_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,t=1&s[i+11|0],d[12+(e=O-16|0)>>2]=d[i+12>>2],s[e+11|0]=t,s[d[e+12>>2]+552|0]=1&s[e+11|0],O=i+16|0},emscripten_bind_btConeTwistConstraint_setMaxMotorImpulse_1:function(e,t){var i,n;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,n=d[e+12>>2],m[n+572>>2]=m[e+8>>2],s[n+553|0]=0,O=i+16|0},emscripten_bind_btConeTwistConstraint_setMaxMotorImpulseNormalized_1:function(e,t){var i,n;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,n=d[e+12>>2],m[n+572>>2]=m[e+8>>2],s[n+553|0]=1,O=i+16|0},emscripten_bind_btConeTwistConstraint_setMotorTarget_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),d=y(0),u=y(0),p=y(0),f=y(0),g=y(0);O=i=O-48|0,st(e+364|0,i+16|0),n=m[t+4>>2],r=m[t+8>>2],s=m[t>>2],o=m[t+12>>2],a=m[i+24>>2],l=m[i+20>>2],c=m[i+28>>2],h=m[i+16>>2],st(e+300|0,i),_=y(y(a*r)+y(y(y(h*s)+y(c*o))+y(l*n))),d=m[i+12>>2],u=y(y(y(y(c*s)-y(h*o))-y(l*r))+y(a*n)),p=m[i>>2],f=y(y(h*r)+y(y(y(c*n)-y(l*o))-y(a*s))),g=m[i+4>>2],n=y(y(l*s)+y(y(y(c*r)-y(a*o))-y(h*n))),r=m[i+8>>2],m[i+44>>2]=y(y(y(_*d)-y(u*p))-y(f*g))-y(n*r),m[i+40>>2]=y(y(y(n*d)+y(_*r))+y(u*g))-y(p*f),m[i+36>>2]=y(y(p*n)+y(y(d*f)+y(_*g)))-y(u*r),m[i+32>>2]=y(y(y(_*p)+y(u*d))+y(f*r))-y(n*g),Xe(e,i+32|0),O=i+48|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btConeTwistConstraint_setMotorTargetInConstraintSpace_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Xe(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btConeTwistConstraint_enableFeedback_1:sa,emscripten_bind_btConeTwistConstraint_getBreakingImpulseThreshold_0:kl,emscripten_bind_btConeTwistConstraint_setBreakingImpulseThreshold_1:_a,emscripten_bind_btConeTwistConstraint_getParam_2:Ko,emscripten_bind_btConeTwistConstraint_setParam_3:Lo,emscripten_bind_btConeTwistConstraint___destroy___0:Nc,emscripten_bind_btHingeConstraint_btHingeConstraint_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ut(e=nc(764),d[i+12>>2],d[i+8>>2],0),O=i+16|0,0|e},emscripten_bind_btHingeConstraint_btHingeConstraint_3:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,Ut(e=nc(764),d[n+12>>2],d[n+8>>2],1&s[n+7|0]),O=n+16|0,0|e},emscripten_bind_btHingeConstraint_btHingeConstraint_4:function(e,t,i,n){var r;return e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,wi(e=nc(764),d[r+12>>2],d[r+8>>2],d[r+4>>2],d[r>>2],0),O=r+16|0,0|e},emscripten_bind_btHingeConstraint_btHingeConstraint_5:function(e,t,i,n,r){var o;return e|=0,t|=0,i|=0,n|=0,r|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,s[o+15|0]=r,wi(e=nc(764),d[o+28>>2],d[o+24>>2],d[o+20>>2],d[o+16>>2],1&s[o+15|0]),O=o+32|0,0|e},emscripten_bind_btHingeConstraint_btHingeConstraint_6:function(e,t,i,n,r,s){var o;return e|=0,t|=0,i|=0,n|=0,r|=0,s|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,d[o+12>>2]=r,d[o+8>>2]=s,Ze(e=nc(764),d[o+28>>2],d[o+24>>2],d[o+20>>2],d[o+16>>2],d[o+12>>2],d[o+8>>2],0),O=o+32|0,0|e},emscripten_bind_btHingeConstraint_btHingeConstraint_7:function(e,t,i,n,r,o,a){var l;return e|=0,t|=0,i|=0,n|=0,r|=0,o|=0,a|=0,O=l=O-32|0,d[l+28>>2]=e,d[l+24>>2]=t,d[l+20>>2]=i,d[l+16>>2]=n,d[l+12>>2]=r,d[l+8>>2]=o,s[l+7|0]=a,Ze(e=nc(764),d[l+28>>2],d[l+24>>2],d[l+20>>2],d[l+16>>2],d[l+12>>2],d[l+8>>2],1&s[l+7|0]),O=l+32|0,0|e},emscripten_bind_btHingeConstraint_setLimit_4:function(e,t,i,n,r){var s;e|=0,t=y(t),i=y(i),n=y(n),r=y(r),O=s=O-32|0,d[s+28>>2]=e,m[s+24>>2]=t,m[s+20>>2]=i,m[s+16>>2]=n,m[s+12>>2]=r,uo(d[s+28>>2],m[s+24>>2],m[s+20>>2],m[s+16>>2],m[s+12>>2],y(1)),O=s+32|0},emscripten_bind_btHingeConstraint_setLimit_5:function(e,t,i,n,r,s){var o;e|=0,t=y(t),i=y(i),n=y(n),r=y(r),s=y(s),O=o=O-32|0,d[o+28>>2]=e,m[o+24>>2]=t,m[o+20>>2]=i,m[o+16>>2]=n,m[o+12>>2]=r,m[o+8>>2]=s,uo(d[o+28>>2],m[o+24>>2],m[o+20>>2],m[o+16>>2],m[o+12>>2],m[o+8>>2]),O=o+32|0},emscripten_bind_btHingeConstraint_enableAngularMotor_3:function(e,t,i,n){var r;e|=0,t|=0,i=y(i),n=y(n),O=r=O-16|0,d[r+12>>2]=e,s[r+11|0]=t,m[r+4>>2]=i,m[r>>2]=n,function(e,t,i,n){var r;d[12+(r=O-16|0)>>2]=e,s[r+11|0]=t,m[r+4>>2]=i,m[r>>2]=n,e=d[r+12>>2],s[e+737|0]=1&s[r+11|0],m[e+680>>2]=m[r+4>>2],m[e+684>>2]=m[r>>2]}(d[r+12>>2],1&s[r+11|0],m[r+4>>2],m[r>>2]),O=r+16|0},emscripten_bind_btHingeConstraint_setAngularOnly_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,t=1&s[i+11|0],d[12+(e=O-16|0)>>2]=d[i+12>>2],s[e+11|0]=t,s[d[e+12>>2]+736|0]=1&s[e+11|0],O=i+16|0},emscripten_bind_btHingeConstraint_enableMotor_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,t=1&s[i+11|0],d[12+(e=O-16|0)>>2]=d[i+12>>2],s[e+11|0]=t,s[d[e+12>>2]+737|0]=1&s[e+11|0],O=i+16|0},emscripten_bind_btHingeConstraint_setMaxMotorImpulse_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+684>>2]=m[e+8>>2],O=i+16|0},emscripten_bind_btHingeConstraint_setMotorTarget_2:function(e,t,i){var n;e|=0,t=y(t),i=y(i),O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,m[n+4>>2]=i,function(e,t,i){var n;O=n=O-16|0,m[n+12>>2]=t,function(e,t){var i=y(0),n=y(0),r=y(0);if((n=m[e+4>>2])>y(0)&&(r=m[e>>2],(i=Ji(y(m[t>>2]-r),y(6.2831854820251465)))y(3.1415927410125732)&&(i=y(i+y(-6.2831854820251465))),!(iy(0))return(i=Ji(y(n+r),y(6.2831854820251465)))>2]=i+y(6.2831854820251465)):void(m[t>>2]=i>y(3.1415927410125732)^1?i:y(i+y(-6.2831854820251465)));(i=Ji(y(r-n),y(6.2831854820251465)))y(3.1415927410125732)&&(i=y(i+y(-6.2831854820251465))),m[t>>2]=i}}(e+688|0,n+12|0),m[e+680>>2]=y(m[n+12>>2]-pn(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0))/i,O=n+16|0}(d[n+12>>2],m[n+8>>2],m[n+4>>2]),O=n+16|0},emscripten_bind_btHingeConstraint_enableFeedback_1:sa,emscripten_bind_btHingeConstraint_getBreakingImpulseThreshold_0:kl,emscripten_bind_btHingeConstraint_setBreakingImpulseThreshold_1:_a,emscripten_bind_btHingeConstraint_getParam_2:Ko,emscripten_bind_btHingeConstraint_setParam_3:Lo,emscripten_bind_btHingeConstraint___destroy___0:Nc,emscripten_bind_btConeShapeZ_btConeShapeZ_2:function(e,t){var i,n;return e=y(e),t=y(t),O=i=O-16|0,m[i+12>>2]=e,m[i+8>>2]=t,function(e,t,i){d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,m[e+60>>2]=i,m[e+56>>2]=t,d[e+4>>2]=11,d[e+72>>2]=1,d[e+64>>2]=0,d[e+68>>2]=2,d[e>>2]=11e3,m[e+36>>2]=i,m[e+28>>2]=t,m[e+32>>2]=t,m[e+52>>2]=t/y(x(y(y(t*t)+y(i*i))))}(n=nc(76),m[i+12>>2],m[i+8>>2]),O=i+16|0,0|n},emscripten_bind_btConeShapeZ_setLocalScaling_1:gl,emscripten_bind_btConeShapeZ_getLocalScaling_0:hc,emscripten_bind_btConeShapeZ_calculateLocalInertia_2:Ma,emscripten_bind_btConeShapeZ___destroy___0:Nc,emscripten_bind_btConeShapeX_btConeShapeX_2:function(e,t){var i,n;return e=y(e),t=y(t),O=i=O-16|0,m[i+12>>2]=e,m[i+8>>2]=t,function(e,t,i){d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,m[e+60>>2]=i,m[e+56>>2]=t,d[e+4>>2]=11,d[e+72>>2]=2,d[e+64>>2]=1,d[e+68>>2]=0,d[e>>2]=11100,m[e+32>>2]=t,m[e+36>>2]=t,m[e+28>>2]=i,m[e+52>>2]=t/y(x(y(y(t*t)+y(i*i))))}(n=nc(76),m[i+12>>2],m[i+8>>2]),O=i+16|0,0|n},emscripten_bind_btConeShapeX_setLocalScaling_1:gl,emscripten_bind_btConeShapeX_getLocalScaling_0:hc,emscripten_bind_btConeShapeX_calculateLocalInertia_2:Ma,emscripten_bind_btConeShapeX___destroy___0:Nc,emscripten_bind_btTriangleMesh_btTriangleMesh_0:function(){var e;return _i(e=nc(172),1,1),0|e},emscripten_bind_btTriangleMesh_btTriangleMesh_1:function(e){var t;return e|=0,O=t=O-16|0,s[t+15|0]=e,_i(e=nc(172),1&s[t+15|0],1),O=t+16|0,0|e},emscripten_bind_btTriangleMesh_btTriangleMesh_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,s[i+15|0]=e,s[i+14|0]=t,_i(e=nc(172),1&s[i+15|0],1&s[i+14|0]),O=i+16|0,0|e},emscripten_bind_btTriangleMesh_addTriangle_3:function(e,t,i,n){var r;e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,vc(d[r+12>>2],d[r+8>>2],d[r+4>>2],d[r>>2],0),O=r+16|0},emscripten_bind_btTriangleMesh_addTriangle_4:function(e,t,i,n,r){var o;e|=0,t|=0,i|=0,n|=0,r|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,s[o+15|0]=r,vc(d[o+28>>2],d[o+24>>2],d[o+20>>2],d[o+16>>2],1&s[o+15|0]),O=o+32|0},emscripten_bind_btTriangleMesh_findOrAddVertex_2:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,e=Fe(d[n+12>>2],d[n+8>>2],1&s[n+7|0]),O=n+16|0,0|e},emscripten_bind_btTriangleMesh_addIndex_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,ji(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btTriangleMesh_getIndexedMeshArray_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+20|0},emscripten_bind_btTriangleMesh_setScaling_1:Ic,emscripten_bind_btTriangleMesh___destroy___0:Nc,emscripten_bind_btConvexHullShape_btConvexHullShape_0:function(){var e;return ki(e=nc(112),0,0),0|e},emscripten_bind_btConvexHullShape_btConvexHullShape_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,ki(e=nc(112),d[t+12>>2],0),O=t+16|0,0|e},emscripten_bind_btConvexHullShape_btConvexHullShape_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,ki(e=nc(112),d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btConvexHullShape_addPoint_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Gn(d[i+12>>2],d[i+8>>2],1),O=i+16|0},emscripten_bind_btConvexHullShape_addPoint_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,Gn(d[n+12>>2],d[n+8>>2],1&s[n+7|0]),O=n+16|0},emscripten_bind_btConvexHullShape_setMargin_1:fl,emscripten_bind_btConvexHullShape_getMargin_0:jl,emscripten_bind_btConvexHullShape_getNumVertices_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],e=0|r[d[d[e>>2]+96>>2]](e),O=t+16|0,0|e},emscripten_bind_btConvexHullShape_initializePolyhedralFeatures_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],e=1&r[d[d[e>>2]+92>>2]](e,d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btConvexHullShape_recalcLocalAabb_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,Qn(d[t+12>>2]),O=t+16|0},emscripten_bind_btConvexHullShape_getConvexPolyhedron_0:ql,emscripten_bind_btConvexHullShape_setLocalScaling_1:gl,emscripten_bind_btConvexHullShape_getLocalScaling_0:hc,emscripten_bind_btConvexHullShape_calculateLocalInertia_2:Ma,emscripten_bind_btConvexHullShape___destroy___0:Nc,emscripten_bind_btVehicleTuning_btVehicleTuning_0:function(){var e;return function(e){var t;d[12+(t=O-16|0)>>2]=e,e=d[t+12>>2],m[e>>2]=5.880000114440918,m[e+4>>2]=.8299999833106995,m[e+8>>2]=.8799999952316284,m[e+12>>2]=500,m[e+16>>2]=10.5,m[e+20>>2]=6e3}(e=ic(24)),0|e},emscripten_bind_btVehicleTuning_get_m_suspensionStiffness_0:d_,emscripten_bind_btVehicleTuning_set_m_suspensionStiffness_1:bh,emscripten_bind_btVehicleTuning_get_m_suspensionCompression_0:s_,emscripten_bind_btVehicleTuning_set_m_suspensionCompression_1:ah,emscripten_bind_btVehicleTuning_get_m_suspensionDamping_0:o_,emscripten_bind_btVehicleTuning_set_m_suspensionDamping_1:lh,emscripten_bind_btVehicleTuning_get_m_maxSuspensionTravelCm_0:t_,emscripten_bind_btVehicleTuning_set_m_maxSuspensionTravelCm_1:th,emscripten_bind_btVehicleTuning_get_m_frictionSlip_0:Hh,emscripten_bind_btVehicleTuning_set_m_frictionSlip_1:Jc,emscripten_bind_btVehicleTuning_get_m_maxSuspensionForce_0:e_,emscripten_bind_btVehicleTuning_set_m_maxSuspensionForce_1:eh,emscripten_bind_btCollisionObjectWrapper_getWorldTransform_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+12>>2]},emscripten_bind_btCollisionObjectWrapper_getCollisionObject_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+8>>2]},emscripten_bind_btCollisionObjectWrapper_getCollisionShape_0:tc,emscripten_bind_btShapeHull_btShapeHull_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e,t){s[e+16|0]=1,d[e+44>>2]=t,d[e+12>>2]=0,d[e+4>>2]=0,d[e+8>>2]=0,d[e+40>>2]=0,s[e+36|0]=1,d[e+32>>2]=0,d[e+24>>2]=0,d[e+28>>2]=0}(e=nc(48),d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btShapeHull_buildHull_1:function(e,t){var i;return e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,e=1&function(e){var t,i=0,n=0,o=0,a=0,l=0,c=0,h=0,_=0;if(O=t=O-1136|0,l=42,o=d[e+44>>2],(0|(i=0|r[d[d[o>>2]+84>>2]](o)))>=1)for(o=0;n=d[e+44>>2],r[d[d[n>>2]+88>>2]](n,o,t+144|0),De(),n=d[t+156>>2],d[(c=28008+(a=l<<4)|0)>>2]=d[t+152>>2],d[c+4>>2]=n,n=d[t+148>>2],d[(a=a+28e3|0)>>2]=d[t+144>>2],d[a+4>>2]=n,l=l+1|0,(0|i)!=(0|(o=o+1|0)););for(o=0;i=d[e+44>>2],De(),n=o<<4,r[d[d[i>>2]+64>>2]](t+16|0,i,n+28e3|0),a=d[t+28>>2],d[8+(n=i=n+(t+144|0)|0)>>2]=d[t+24>>2],d[n+12>>2]=a,n=d[t+20>>2],d[i>>2]=d[t+16>>2],d[i+4>>2]=n,(0|l)!=(0|(o=o+1|0)););if(d[t+132>>2]=4096,d[t+136>>2]=4096,d[t+124>>2]=16,d[t+128>>2]=981668463,d[t+116>>2]=l,d[t+112>>2]=1,d[t+120>>2]=t+144,s[t+108|0]=1,i=0,d[t+104>>2]=0,d[t+96>>2]=0,d[t+100>>2]=0,d[t+84>>2]=0,s[t+88|0]=1,d[t+76>>2]=0,d[t+80>>2]=0,d[t+36>>2]=0,s[t+40|0]=1,s[t+68|0]=1,d[t+28>>2]=0,d[t+32>>2]=0,d[t- -64>>2]=0,d[t+56>>2]=0,d[t+60>>2]=0,d[t+44>>2]=0,d[t+48>>2]=0,d[t+20>>2]=0,s[t+16|0]=1,1!=(0|ie(t+72|0,t+112|0,t+16|0))){if(i=n=d[t+20>>2],(0|(o=d[e+4>>2]))<(0|n)){if(d[e+8>>2]<(0|n)){if(n?(d[7717]=d[7717]+1,l=0|r[d[6606]](n<<4,16),i=d[e+4>>2]):(l=0,i=o),(0|(h=i))>=1)for(i=0;c=(a=i<<4)+l|0,a=a+d[e+12>>2]|0,_=d[a+4>>2],d[c>>2]=d[a>>2],d[c+4>>2]=_,_=d[a+12>>2],d[c+8>>2]=d[a+8>>2],d[c+12>>2]=_,(0|h)!=(0|(i=i+1|0)););(i=d[e+12>>2])&&(u[e+16|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+12>>2]=0),d[e+12>>2]=l,s[e+16|0]=1,d[e+8>>2]=n}for(;a=d[t+4>>2],i=d[e+12>>2]+(o<<4)|0,d[i>>2]=d[t>>2],d[i+4>>2]=a,a=d[t+12>>2],d[i+8>>2]=d[t+8>>2],d[i+12>>2]=a,(0|n)!=(0|(o=o+1|0)););i=d[t+20>>2]}if(d[e+4>>2]=n,(0|i)>=1)for(o=0;n=(i=o<<4)+d[e+12>>2]|0,i=i+d[t+36>>2]|0,l=d[i+4>>2],d[n>>2]=d[i>>2],d[n+4>>2]=l,a=d[i+12>>2],d[n+8>>2]=d[i+8>>2],d[n+12>>2]=a,(0|(o=o+1|0))>2];);if(n=d[t+48>>2],d[e+40>>2]=n,o=n,(0|n)>(0|(a=d[e+24>>2]))){e:if(d[e+28>>2]>=(0|n))l=d[e+32>>2];else{o=0,i=a,l=0,n&&(d[7717]=d[7717]+1,l=0|r[d[6606]](n<<2,16),i=d[e+24>>2]),c=d[e+32>>2];t:{if((0|i)>=1)for(;;)if(d[(h=o<<2)+l>>2]=d[c+h>>2],(0|(o=o+1|0))==(0|i))break t;if(!c){d[e+32>>2]=l,d[e+28>>2]=n,s[e+36|0]=1;break e}}u[e+36|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[e+32>>2]=l,s[e+36|0]=1,d[e+28>>2]=n}Mn((a<<2)+l|0,0,n-a<<2),o=d[e+40>>2]}if(d[e+24>>2]=n,i=1,(0|o)>=1)for(n=d[e+32>>2],o=0,a=d[t+64>>2];d[(l=o<<2)+n>>2]=d[a+l>>2],(0|(o=o+1|0))>2];);os(t+16|0)}return(e=d[t+64>>2])&&(u[t+68|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[t+64>>2]=0),d[t+64>>2]=0,s[t+68|0]=1,d[t+56>>2]=0,d[t+60>>2]=0,(e=d[t+36>>2])&&(u[t+40|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[t+36>>2]=0),(e=d[t+104>>2])&&(u[t+108|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[t+104>>2]=0),d[t+104>>2]=0,s[t+108|0]=1,d[t+96>>2]=0,d[t+100>>2]=0,(e=d[t+84>>2])&&(u[t+88|0]&&e&&(d[7718]=d[7718]+1,r[d[6607]](e)),d[t+84>>2]=0),O=t+1136|0,i}(d[i+12>>2]),O=i+16|0,0|e},emscripten_bind_btShapeHull_numVertices_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,O=t+16|0,d[d[t+12>>2]+4>>2]},emscripten_bind_btShapeHull_getVertexPointer_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=function(e){var t;return O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],d[e+8>>2]=0,O=t+16|0,d[d[e+12>>2]+12>>2]+(d[e+8>>2]<<4)|0}(d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btShapeHull___destroy___0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&(function(e){var t,i=0;(i=d[e+32>>2])&&(u[e+36|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+32>>2]=0),d[e+32>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0,i=0,(t=d[e+12>>2])&&(u[e+16|0]&&(t&&(d[7718]=d[7718]+1,r[d[6607]](t)),i=d[e+32>>2]),d[e+12>>2]=0),d[e+12>>2]=0,s[e+16|0]=1,d[e+4>>2]=0,d[e+8>>2]=0,i&&u[e+36|0]?(i&&(d[7718]=d[7718]+1,r[d[6607]](i)),s[e+36|0]=1,d[e+32>>2]=0,d[e+24>>2]=0,d[e+28>>2]=0,(i=d[e+12>>2])&&(u[e+16|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+12>>2]=0)):(d[e+32>>2]=0,s[e+36|0]=1,d[e+24>>2]=0,d[e+28>>2]=0),d[e+12>>2]=0,s[e+16|0]=1,d[e+4>>2]=0,d[e+8>>2]=0}(e),Dc(e)),O=t+16|0},emscripten_bind_btDefaultMotionState_btDefaultMotionState_0:function(){var e;return Ys(e=nc(200),so(),so()),0|e},emscripten_bind_btDefaultMotionState_btDefaultMotionState_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,Ys(e=nc(200),d[t+12>>2],so()),O=t+16|0,0|e},emscripten_bind_btDefaultMotionState_btDefaultMotionState_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ys(e=nc(200),d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btDefaultMotionState_getWorldTransform_1:Il,emscripten_bind_btDefaultMotionState_setWorldTransform_1:ml,emscripten_bind_btDefaultMotionState_get_m_graphicsWorldTrans_0:k_,emscripten_bind_btDefaultMotionState_set_m_graphicsWorldTrans_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,ao(d[i+12>>2]+4|0,d[i+8>>2]),O=i+16|0},emscripten_bind_btDefaultMotionState___destroy___0:Nc,emscripten_bind_btWheelInfo_btWheelInfo_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e,t){var i,n=0;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e){var t;O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],d[12+(O-16|0)>>2]=e,d[12+(O-16|0)>>2]=e+16,d[12+(O-16|0)>>2]=e+36,d[12+(O-16|0)>>2]=e+52,d[12+(O-16|0)>>2]=e+68,O=t+16|0}(e=d[i+12>>2]),ph(e+92|0),d[12+(O-16|0)>>2]=e+156,d[12+(O-16|0)>>2]=e+172,d[12+(O-16|0)>>2]=e+188,m[e+204>>2]=m[d[i+8>>2]+48>>2],m[e+208>>2]=m[d[i+8>>2]+52>>2],m[e+212>>2]=m[d[i+8>>2]+56>>2],m[e+216>>2]=m[d[i+8>>2]+60>>2],m[e+220>>2]=m[d[i+8>>2]+64>>2],m[e+224>>2]=m[d[i+8>>2]+68>>2],t=d[i+8>>2],n=d[t+4>>2],d[e+156>>2]=d[t>>2],d[e+160>>2]=n,n=d[t+12>>2],d[e+164>>2]=d[t+8>>2],d[e+168>>2]=n,t=d[i+8>>2],n=d[t+20>>2],d[e+172>>2]=d[t+16>>2],d[e+176>>2]=n,n=d[t+28>>2],d[e+180>>2]=d[t+24>>2],d[e+184>>2]=n,t=d[i+8>>2],n=d[t+36>>2],d[e+188>>2]=d[t+32>>2],d[e+192>>2]=n,n=d[t+44>>2],d[e+196>>2]=d[t+40>>2],d[e+200>>2]=n,m[e+228>>2]=m[d[i+8>>2]+72>>2],m[e+232>>2]=0,m[e+252>>2]=0,m[e+236>>2]=0,m[e+240>>2]=0,m[e+256>>2]=0,m[e+244>>2]=.10000000149011612,s[e+260|0]=1&s[d[i+8>>2]+80|0],m[e+248>>2]=m[d[i+8>>2]+76>>2],O=i+16|0}(e=ic(284),d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btWheelInfo_getSuspensionRestLength_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,O=t+16|0,y(m[d[t+12>>2]+204>>2])},emscripten_bind_btWheelInfo_updateWheel_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e,t){var i=y(0),n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);if(u[e+84|0])return i=m[e>>2],n=m[e+4>>2],a=m[e+8>>2],(r=y(y(y(i*m[e+52>>2])+y(n*m[e+56>>2]))+y(a*m[e+60>>2])))>=y(-.10000000149011612)?(d[e+272>>2]=0,void(m[e+268>>2]=10)):(r=y(y(-1)/r),o=i,i=m[t+332>>2],s=y(m[e+24>>2]-m[t+60>>2]),l=y(m[e+20>>2]-m[t+56>>2]),c=m[t+336>>2],h=y(o*y(y(y(i*s)-y(l*c))+m[t+312>>2])),_=n,n=y(m[e+16>>2]-m[t+52>>2]),o=s,s=m[t+328>>2],m[e+272>>2]=r*y(y(h+y(_*y(y(y(n*c)-y(o*s))+m[t+316>>2])))+y(a*y(y(y(l*s)-y(n*i))+m[t+320>>2]))),void(m[e+268>>2]=r));d[e+272>>2]=0,d[e+12>>2]=0,d[e+32>>2]=d[e+204>>2],m[e>>2]=-m[e+52>>2],m[e+8>>2]=-m[e+60>>2],m[e+4>>2]=-m[e+56>>2],m[e+268>>2]=1}(d[n+12>>2],d[n+8>>2]),O=n+16|0},emscripten_bind_btWheelInfo_get_m_suspensionStiffness_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+216>>2])},emscripten_bind_btWheelInfo_set_m_suspensionStiffness_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+216>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_frictionSlip_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+228>>2])},emscripten_bind_btWheelInfo_set_m_frictionSlip_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+228>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_engineForce_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+252>>2])},emscripten_bind_btWheelInfo_set_m_engineForce_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+252>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_rollInfluence_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+244>>2])},emscripten_bind_btWheelInfo_set_m_rollInfluence_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+244>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_suspensionRestLength1_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+204>>2])},emscripten_bind_btWheelInfo_set_m_suspensionRestLength1_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+204>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_wheelsRadius_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+212>>2])},emscripten_bind_btWheelInfo_set_m_wheelsRadius_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+212>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_wheelsDampingCompression_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+220>>2])},emscripten_bind_btWheelInfo_set_m_wheelsDampingCompression_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+220>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_wheelsDampingRelaxation_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+224>>2])},emscripten_bind_btWheelInfo_set_m_wheelsDampingRelaxation_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+224>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_steering_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+232>>2])},emscripten_bind_btWheelInfo_set_m_steering_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+232>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_maxSuspensionForce_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+248>>2])},emscripten_bind_btWheelInfo_set_m_maxSuspensionForce_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+248>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_maxSuspensionTravelCm_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+208>>2])},emscripten_bind_btWheelInfo_set_m_maxSuspensionTravelCm_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+208>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_wheelsSuspensionForce_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+276>>2])},emscripten_bind_btWheelInfo_set_m_wheelsSuspensionForce_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+276>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_bIsFrontWheel_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,1&s[d[t+12>>2]+260|0]},emscripten_bind_btWheelInfo_set_m_bIsFrontWheel_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,s[d[i+12>>2]+260|0]=1&s[i+11|0]},emscripten_bind_btWheelInfo_get_m_raycastInfo_0:V_,emscripten_bind_btWheelInfo_set_m_raycastInfo_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Mi(d[i+12>>2],d[i+8>>2],92),O=i+16|0},emscripten_bind_btWheelInfo_get_m_chassisConnectionPointCS_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+156|0},emscripten_bind_btWheelInfo_set_m_chassisConnectionPointCS_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+156>>2]=d[e>>2],d[t+160>>2]=i,i=d[e+12>>2],d[t+164>>2]=d[e+8>>2],d[t+168>>2]=i},emscripten_bind_btWheelInfo_get_m_worldTransform_0:T_,emscripten_bind_btWheelInfo_set_m_worldTransform_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,ao(d[i+12>>2]+92|0,d[i+8>>2]),O=i+16|0},emscripten_bind_btWheelInfo_get_m_wheelDirectionCS_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+172|0},emscripten_bind_btWheelInfo_set_m_wheelDirectionCS_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+172>>2]=d[e>>2],d[t+176>>2]=i,i=d[e+12>>2],d[t+180>>2]=d[e+8>>2],d[t+184>>2]=i},emscripten_bind_btWheelInfo_get_m_wheelAxleCS_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+188|0},emscripten_bind_btWheelInfo_set_m_wheelAxleCS_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+188>>2]=d[e>>2],d[t+192>>2]=i,i=d[e+12>>2],d[t+196>>2]=d[e+8>>2],d[t+200>>2]=i},emscripten_bind_btWheelInfo_get_m_rotation_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+236>>2])},emscripten_bind_btWheelInfo_set_m_rotation_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+236>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_deltaRotation_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+240>>2])},emscripten_bind_btWheelInfo_set_m_deltaRotation_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+240>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_brake_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+256>>2])},emscripten_bind_btWheelInfo_set_m_brake_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+256>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_clippedInvContactDotSuspension_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+268>>2])},emscripten_bind_btWheelInfo_set_m_clippedInvContactDotSuspension_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+268>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_suspensionRelativeVelocity_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+272>>2])},emscripten_bind_btWheelInfo_set_m_suspensionRelativeVelocity_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+272>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo_get_m_skidInfo_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+280>>2])},emscripten_bind_btWheelInfo_set_m_skidInfo_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+280>>2]=m[i+8>>2]},emscripten_bind_btWheelInfo___destroy___0:Dh,emscripten_bind_btVector4_btVector4_0:function(){var e;return wc(e=nc(16)),0|e},emscripten_bind_btVector4_btVector4_4:function(e,t,i,n){var r,s;return e=y(e),t=y(t),i=y(i),n=y(n),O=r=O-16|0,m[r+12>>2]=e,m[r+8>>2]=t,m[r+4>>2]=i,m[r>>2]=n,function(e,t,i,n,r){var s;O=s=O-32|0,d[s+28>>2]=e,d[s+24>>2]=t,d[s+20>>2]=i,d[s+16>>2]=n,d[s+12>>2]=r,Zo(e=d[s+28>>2],d[s+24>>2],d[s+20>>2],d[s+16>>2]),m[e+12>>2]=m[d[s+12>>2]>>2],O=s+32|0}(s=nc(16),r+12|0,r+8|0,r+4|0,r),O=r+16|0,0|s},emscripten_bind_btVector4_w_0:Vl,emscripten_bind_btVector4_setValue_4:So,emscripten_bind_btVector4_length_0:hh,emscripten_bind_btVector4_x_0:Ql,emscripten_bind_btVector4_y_0:Ul,emscripten_bind_btVector4_z_0:Gl,emscripten_bind_btVector4_setX_1:ga,emscripten_bind_btVector4_setY_1:pa,emscripten_bind_btVector4_setZ_1:fa,emscripten_bind_btVector4_normalize_0:l_,emscripten_bind_btVector4_rotate_2:function(e,t,i){var n;return e|=0,t|=0,i=y(i),O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,m[n+20>>2]=i,1&s[26524]||mc(26524)&&(d[12+(O-16|0)>>2]=26508,uh(26524)),Rr(n,d[n+28>>2],d[n+24>>2],m[n+20>>2]),e=d[n+4>>2],d[6627]=d[n>>2],d[6628]=e,e=d[n+12>>2],d[6629]=d[n+8>>2],d[6630]=e,O=n+32|0,26508},emscripten_bind_btVector4_dot_1:El,emscripten_bind_btVector4_op_mul_1:rc,emscripten_bind_btVector4_op_add_1:$l,emscripten_bind_btVector4_op_sub_1:Jl,emscripten_bind_btVector4___destroy___0:Fh,emscripten_bind_btDefaultCollisionConstructionInfo_btDefaultCollisionConstructionInfo_0:function(){var e;return rl(e=ic(24)),0|e},emscripten_bind_btDefaultCollisionConstructionInfo___destroy___0:Dh,emscripten_bind_Anchor_get_m_node_0:v_,emscripten_bind_Anchor_set_m_node_1:yh,emscripten_bind_Anchor_get_m_local_0:k_,emscripten_bind_Anchor_set_m_local_1:Yo,emscripten_bind_Anchor_get_m_body_0:p_,emscripten_bind_Anchor_set_m_body_1:ch,emscripten_bind_Anchor_get_m_influence_0:i_,emscripten_bind_Anchor_set_m_influence_1:ih,emscripten_bind_Anchor_get_m_c0_0:S_,emscripten_bind_Anchor_set_m_c0_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,$r(d[i+12>>2]+28|0,d[i+8>>2]),O=i+16|0},emscripten_bind_Anchor_get_m_c1_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+76|0},emscripten_bind_Anchor_set_m_c1_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+76>>2]=d[e>>2],d[t+80>>2]=i,i=d[e+12>>2],d[t+84>>2]=d[e+8>>2],d[t+88>>2]=i},emscripten_bind_Anchor_get_m_c2_0:$h,emscripten_bind_Anchor_set_m_c2_1:nh,emscripten_bind_Anchor___destroy___0:Dh,emscripten_bind_btVehicleRaycasterResult_get_m_hitPointInWorld_0:V_,emscripten_bind_btVehicleRaycasterResult_set_m_hitPointInWorld_1:$o,emscripten_bind_btVehicleRaycasterResult_get_m_hitNormalInWorld_0:D_,emscripten_bind_btVehicleRaycasterResult_set_m_hitNormalInWorld_1:jo,emscripten_bind_btVehicleRaycasterResult_get_m_distFraction_0:Jh,emscripten_bind_btVehicleRaycasterResult_set_m_distFraction_1:Zc,emscripten_bind_btVehicleRaycasterResult___destroy___0:Dh,emscripten_bind_btVector3Array_size_0:tc,emscripten_bind_btVector3Array_at_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,O=i+16|0,d[d[e+12>>2]+12>>2]+(d[e+8>>2]<<4)|0},emscripten_bind_btVector3Array___destroy___0:Th,emscripten_bind_btConstraintSolver___destroy___0:Nc,emscripten_bind_btRaycastVehicle_btRaycastVehicle_3:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e,t,i){d[e>>2]=19996,d[e+104>>2]=0,d[e+100>>2]=i,s[e+20|0]=1,d[e+16>>2]=0,s[e+40|0]=1,d[e+8>>2]=0,d[e+12>>2]=0,d[e+36>>2]=0,s[e+60|0]=1,d[e+28>>2]=0,d[e+32>>2]=0,d[e+56>>2]=0,s[e+80|0]=1,d[e+48>>2]=0,d[e+52>>2]=0,d[e+76>>2]=0,s[e+148|0]=1,d[e+68>>2]=0,d[e+72>>2]=0,d[e+144>>2]=0,d[e+136>>2]=0,d[e+140>>2]=0,d[e+128>>2]=1,d[e+120>>2]=0,d[e+124>>2]=2,d[e+116>>2]=t,d[e+108>>2]=0,d[e+112>>2]=0}(e=ic(152),d[n+8>>2],d[n+4>>2]),O=n+16|0,0|e},emscripten_bind_btRaycastVehicle_applyEngineForce_2:function(e,t,i){var n;e|=0,t=y(t),i|=0,O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,d[n+4>>2]=i,m[252+(d[d[n+12>>2]+144>>2]+b(d[n+4>>2],284)|0)>>2]=m[n+8>>2],O=n+16|0},emscripten_bind_btRaycastVehicle_setSteeringValue_2:function(e,t,i){var n;e|=0,t=y(t),i|=0,O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,d[n+4>>2]=i,m[232+(d[d[n+12>>2]+144>>2]+b(d[n+4>>2],284)|0)>>2]=m[n+8>>2],O=n+16|0},emscripten_bind_btRaycastVehicle_getWheelTransformWS_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,O=i+16|0,92+(d[d[i+12>>2]+144>>2]+b(d[i+8>>2],284)|0)|0},emscripten_bind_btRaycastVehicle_updateWheelTransform_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,lt(d[n+12>>2],d[n+8>>2],1&s[n+7|0]),O=n+16|0},emscripten_bind_btRaycastVehicle_addWheel_7:function(e,t,i,n,o,a,l,c){var h;return e|=0,t|=0,i|=0,n|=0,o=y(o),a=y(a),l|=0,c|=0,O=h=O-32|0,d[h+28>>2]=e,d[h+24>>2]=t,d[h+20>>2]=i,d[h+16>>2]=n,m[h+12>>2]=o,m[h+8>>2]=a,d[h+4>>2]=l,s[h+3|0]=c,e=function(e,t,i,n,o,a,l,c){var h,_,p,f,g,y,v,A,C,S,x,T,E=0,R=0,P=0,I=0;if(O=h=O-288|0,P=d[t+12>>2],d[h+248>>2]=d[t+8>>2],d[h+252>>2]=P,P=d[t+4>>2],d[h+240>>2]=d[t>>2],d[h+244>>2]=P,t=d[i+12>>2],d[h+264>>2]=d[i+8>>2],d[h+268>>2]=t,t=d[i+4>>2],d[h+256>>2]=d[i>>2],d[h+260>>2]=t,t=d[n+12>>2],d[h+280>>2]=d[n+8>>2],d[h+284>>2]=t,t=d[n+4>>2],d[h+272>>2]=d[n>>2],d[h+276>>2]=t,p=d[l>>2],f=d[l+4>>2],g=d[l+8>>2],y=d[l+16>>2],v=d[l+12>>2],A=d[l+20>>2],t=d[h+252>>2],d[h+196>>2]=d[h+248>>2],d[h+200>>2]=t,t=d[h+244>>2],d[h+188>>2]=d[h+240>>2],d[h+192>>2]=t,t=d[h+268>>2],d[h+212>>2]=d[h+264>>2],d[h+216>>2]=t,t=d[h+260>>2],d[h+204>>2]=d[h+256>>2],d[h+208>>2]=t,t=d[h+284>>2],d[h+228>>2]=d[h+280>>2],d[h+232>>2]=t,t=d[h+276>>2],d[h+220>>2]=d[h+272>>2],d[h+224>>2]=t,(0|(t=d[e+136>>2]))==d[e+140>>2]&&!((0|t)>=(0|(R=t?t<<1:1)))){if(R&&(d[7717]=d[7717]+1,I=0|r[d[6606]](b(R,284),16),t=d[e+136>>2]),(0|t)>=1)for(i=0;E=Mi((l=b(i,284))+I|0,n=l+d[e+144>>2]|0,92),l=d[n+104>>2],d[E+100>>2]=d[n+100>>2],d[E+104>>2]=l,l=d[n+96>>2],d[E+92>>2]=d[n+92>>2],d[E+96>>2]=l,l=d[n+120>>2],d[E+116>>2]=d[n+116>>2],d[E+120>>2]=l,l=d[n+112>>2],d[E+108>>2]=d[n+108>>2],d[E+112>>2]=l,l=d[n+136>>2],d[E+132>>2]=d[n+132>>2],d[E+136>>2]=l,l=d[n+128>>2],d[E+124>>2]=d[n+124>>2],d[E+128>>2]=l,l=d[n+144>>2],d[E+140>>2]=d[n+140>>2],d[E+144>>2]=l,l=d[n+152>>2],d[E+148>>2]=d[n+148>>2],d[E+152>>2]=l,Mi(E+156|0,n+156|0,128),(0|(i=i+1|0))!=(0|t););(t=d[e+144>>2])&&(u[e+148|0]&&t&&(d[7718]=d[7718]+1,r[d[6607]](t)),d[e+144>>2]=0),d[e+144>>2]=I,d[e+140>>2]=R,s[e+148|0]=1,t=d[e+136>>2]}return _=Mi(d[e+144>>2]+b(t,284)|0,h+32|0,92),t=d[h+136>>2],d[_+100>>2]=d[h+132>>2],d[_+104>>2]=t,t=d[h+128>>2],d[_+92>>2]=d[h+124>>2],d[_+96>>2]=t,t=d[h+152>>2],d[_+116>>2]=d[h+148>>2],d[_+120>>2]=t,t=d[h+144>>2],d[_+108>>2]=d[h+140>>2],d[_+112>>2]=t,t=d[h+168>>2],d[_+132>>2]=d[h+164>>2],d[_+136>>2]=t,t=d[h+160>>2],d[_+124>>2]=d[h+156>>2],d[_+128>>2]=t,t=d[h+184>>2],d[_+148>>2]=d[h+180>>2],d[_+152>>2]=t,t=d[h+176>>2],d[_+140>>2]=d[h+172>>2],d[_+144>>2]=t,C=d[h+228>>2],S=d[h+232>>2],x=d[h+220>>2],T=d[h+224>>2],E=d[h+212>>2],R=d[h+216>>2],I=d[h+204>>2],P=d[h+208>>2],l=d[h+196>>2],n=d[h+200>>2],i=d[h+188>>2],t=d[h+192>>2],m[_+204>>2]=o,d[_+208>>2]=v,m[_+212>>2]=a,d[_+216>>2]=p,d[_+220>>2]=f,d[_+224>>2]=g,d[_+228>>2]=y,d[_+248>>2]=A,d[_+232>>2]=0,d[_+236>>2]=0,d[_+240>>2]=0,d[_+244>>2]=1036831949,d[_+252>>2]=0,d[_+256>>2]=0,d[_+156>>2]=i,d[_+160>>2]=t,d[_+164>>2]=l,d[_+168>>2]=n,d[_+172>>2]=I,d[_+176>>2]=P,d[_+180>>2]=E,d[_+184>>2]=R,d[_+188>>2]=x,d[_+192>>2]=T,d[_+196>>2]=C,d[_+200>>2]=S,s[_+260|0]=c,i=u[h+28|0]|u[h+29|0]<<8|u[h+30|0]<<16|u[h+31|0]<<24,t=u[h+24|0]|u[h+25|0]<<8|u[h+26|0]<<16|u[h+27|0]<<24,s[_+276|0]=t,s[_+277|0]=t>>>8,s[_+278|0]=t>>>16,s[_+279|0]=t>>>24,s[_+280|0]=i,s[_+281|0]=i>>>8,s[_+282|0]=i>>>16,s[_+283|0]=i>>>24,i=u[h+21|0]|u[h+22|0]<<8|u[h+23|0]<<16|u[h+24|0]<<24,t=u[h+17|0]|u[h+18|0]<<8|u[h+19|0]<<16|u[h+20|0]<<24,s[_+269|0]=t,s[_+270|0]=t>>>8,s[_+271|0]=t>>>16,s[_+272|0]=t>>>24,s[_+273|0]=i,s[_+274|0]=i>>>8,s[_+275|0]=i>>>16,s[_+276|0]=i>>>24,i=u[h+13|0]|u[h+14|0]<<8|u[h+15|0]<<16|u[h+16|0]<<24,t=u[h+9|0]|u[h+10|0]<<8|u[h+11|0]<<16|u[h+12|0]<<24,s[_+261|0]=t,s[_+262|0]=t>>>8,s[_+263|0]=t>>>16,s[_+264|0]=t>>>24,s[_+265|0]=i,s[_+266|0]=i>>>8,s[_+267|0]=i>>>16,s[_+268|0]=i>>>24,t=d[e+136>>2],d[e+136>>2]=t+1,oi(e,t=d[e+144>>2]+b(t,284)|0,0),lt(e,d[e+136>>2]+-1|0,0),O=h+288|0,t}(d[h+28>>2],d[h+24>>2],d[h+20>>2],d[h+16>>2],m[h+12>>2],m[h+8>>2],d[h+4>>2],1&s[h+3|0]),O=h+32|0,0|e},emscripten_bind_btRaycastVehicle_getNumWheels_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=function(e){var t;return O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2]+132,O=t+16|0,d[d[e+12>>2]+4>>2]}(d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btRaycastVehicle_getRigidBody_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+116>>2]},emscripten_bind_btRaycastVehicle_getWheelInfo_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,O=i+16|0,d[d[i+12>>2]+144>>2]+b(d[i+8>>2],284)|0},emscripten_bind_btRaycastVehicle_setBrake_2:function(e,t,i){var n;e|=0,t=y(t),i|=0,O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,d[n+4>>2]=i,m[256+(d[d[n+12>>2]+144>>2]+b(d[n+4>>2],284)|0)>>2]=m[n+8>>2],O=n+16|0},emscripten_bind_btRaycastVehicle_setCoordinateSystem_3:function(e,t,i,n){var s;e|=0,t|=0,i|=0,n|=0,O=s=O-16|0,d[s+12>>2]=e,d[s+8>>2]=t,d[s+4>>2]=i,d[s>>2]=n,e=d[s+12>>2],r[d[d[e>>2]+24>>2]](e,d[s+8>>2],d[s+4>>2],d[s>>2]),O=s+16|0},emscripten_bind_btRaycastVehicle_getCurrentSpeedKmHour_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,y(m[d[e+12>>2]+112>>2])},emscripten_bind_btRaycastVehicle_getChassisWorldTransform_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,O=t+16|0,d[d[t+12>>2]+116>>2]+4|0},emscripten_bind_btRaycastVehicle_rayCast_1:function(e,t){e|=0,t|=0;var i,n=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,n=jt(d[i+12>>2],d[i+8>>2]),O=i+16|0,y(n)},emscripten_bind_btRaycastVehicle_updateVehicle_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+16>>2]](e,m[i+8>>2]),O=i+16|0},emscripten_bind_btRaycastVehicle_resetSuspension_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e){var t=0,i=0,n=y(0);if(d[e+136>>2]>=1)for(;t=d[e+144>>2]+b(i,284)|0,n=m[t+204>>2],d[t+12>>2]=0,d[t+268>>2]=1065353216,d[t+272>>2]=0,m[t+32>>2]=n,m[t+8>>2]=-m[t+60>>2],m[t+4>>2]=-m[t+56>>2],m[t>>2]=-m[t+52>>2],(0|(i=i+1|0))>2];);}(d[t+12>>2]),O=t+16|0},emscripten_bind_btRaycastVehicle_getSteeringValue_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,O=i+16|0,y(m[232+(d[d[i+12>>2]+144>>2]+b(d[i+8>>2],284)|0)>>2])},emscripten_bind_btRaycastVehicle_updateWheelTransformsWS_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,oi(d[i+12>>2],d[i+8>>2],1),O=i+16|0},emscripten_bind_btRaycastVehicle_updateWheelTransformsWS_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,oi(d[n+12>>2],d[n+8>>2],1&s[n+7|0]),O=n+16|0},emscripten_bind_btRaycastVehicle_setPitchControl_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+104>>2]=m[e+8>>2],O=i+16|0},emscripten_bind_btRaycastVehicle_updateSuspension_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,function(e){var t=0,i=y(0),n=0,r=y(0);if(d[e+136>>2]>=1)for(r=y(y(1)/m[d[e+116>>2]+344>>2]);i=y(0),t=d[e+144>>2]+b(n,284)|0,u[t+84|0]&&(i=m[t+272>>2],i=y(C(y(r*y(y(y(m[t+216>>2]*y(m[t+204>>2]-m[t+32>>2]))*m[t+268>>2])-y(i*m[(i>2]))),y(0)))),m[t+276>>2]=i,(0|(n=n+1|0))>2];);}(d[i+12>>2]),O=i+16|0},emscripten_bind_btRaycastVehicle_updateFriction_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+20>>2]](e,m[i+8>>2]),O=i+16|0},emscripten_bind_btRaycastVehicle_getRightAxis_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+120>>2]},emscripten_bind_btRaycastVehicle_getUpAxis_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+124>>2]},emscripten_bind_btRaycastVehicle_getForwardAxis_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+128>>2]},emscripten_bind_btRaycastVehicle_getForwardVector_0:function(e){var t;return e|=0,O=t=O-32|0,d[t+28>>2]=e,1&s[26544]||mc(26544)&&(d[12+(O-16|0)>>2]=26528,uh(26544)),function(e,t){var i,n=0,r=0,s=0,o=0;O=i=O-16|0,d[i+12>>2]=t,t=d[i+12>>2],d[i+8>>2]=d[t+116>>2]+4,d[12+(r=O-16|0)>>2]=d[i+8>>2],d[12+(n=O-16|0)>>2]=d[r+12>>2],d[n+8>>2]=0,d[12+(r=O-16|0)>>2]=d[n+12>>2]+(d[n+8>>2]<<4),r=d[r+12>>2]+(d[t+128>>2]<<2)|0,d[12+(s=O-16|0)>>2]=d[i+8>>2],d[12+(n=O-16|0)>>2]=d[s+12>>2],d[n+8>>2]=1,d[12+(s=O-16|0)>>2]=d[n+12>>2]+(d[n+8>>2]<<4),s=d[s+12>>2]+(d[t+128>>2]<<2)|0,d[12+(o=O-16|0)>>2]=d[i+8>>2],d[12+(n=O-16|0)>>2]=d[o+12>>2],d[n+8>>2]=2,d[12+(o=O-16|0)>>2]=d[n+12>>2]+(d[n+8>>2]<<4),Zo(e,r,s,d[o+12>>2]+(d[t+128>>2]<<2)|0),O=i+16|0}(t+8|0,d[t+28>>2]),e=d[t+12>>2],d[6632]=d[t+8>>2],d[6633]=e,e=d[t+20>>2],d[6634]=d[t+16>>2],d[6635]=e,O=t+32|0,26528},emscripten_bind_btRaycastVehicle_getUserConstraintType_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+84>>2]},emscripten_bind_btRaycastVehicle_setUserConstraintType_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,d[d[e+12>>2]+84>>2]=d[e+8>>2],O=i+16|0},emscripten_bind_btRaycastVehicle_setUserConstraintId_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,d[d[e+12>>2]+88>>2]=d[e+8>>2],O=i+16|0},emscripten_bind_btRaycastVehicle_getUserConstraintId_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[d[e+12>>2]+88>>2]},emscripten_bind_btRaycastVehicle_updateAction_2:Da,emscripten_bind_btRaycastVehicle___destroy___0:Nc,emscripten_bind_btCylinderShapeX_btCylinderShapeX_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,zn(e=nc(56),d[t+12>>2]),d[e+52>>2]=0,d[e>>2]=15728,O=t+16|0,0|e},emscripten_bind_btCylinderShapeX_setMargin_1:fl,emscripten_bind_btCylinderShapeX_getMargin_0:jl,emscripten_bind_btCylinderShapeX_setLocalScaling_1:gl,emscripten_bind_btCylinderShapeX_getLocalScaling_0:hc,emscripten_bind_btCylinderShapeX_calculateLocalInertia_2:Ma,emscripten_bind_btCylinderShapeX___destroy___0:Nc,emscripten_bind_btCylinderShapeZ_btCylinderShapeZ_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,zn(e=nc(56),d[t+12>>2]),d[e+52>>2]=2,d[e>>2]=15832,O=t+16|0,0|e},emscripten_bind_btCylinderShapeZ_setMargin_1:fl,emscripten_bind_btCylinderShapeZ_getMargin_0:jl,emscripten_bind_btCylinderShapeZ_setLocalScaling_1:gl,emscripten_bind_btCylinderShapeZ_getLocalScaling_0:hc,emscripten_bind_btCylinderShapeZ_calculateLocalInertia_2:Ma,emscripten_bind_btCylinderShapeZ___destroy___0:Nc,emscripten_bind_btConvexPolyhedron_get_m_vertices_0:k_,emscripten_bind_btConvexPolyhedron_set_m_vertices_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ah(d[i+12>>2]+4|0,d[i+8>>2]),O=i+16|0},emscripten_bind_btConvexPolyhedron_get_m_faces_0:M_,emscripten_bind_btConvexPolyhedron_set_m_faces_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-48|0,d[i+44>>2]=e,d[i+40>>2]=t,e=d[i+44>>2],d[12+(t=O-16|0)>>2]=d[i+40>>2],d[i+36>>2]=d[d[t+12>>2]+4>>2],t=d[i+36>>2],d[i>>2]=0,d[i+4>>2]=0,d[i+32>>2]=0,d[i+24>>2]=0,d[i+28>>2]=0,d[i+16>>2]=0,d[i+20>>2]=0,d[i+8>>2]=0,d[i+12>>2]=0,L_(i),function(e,t,i){var n;if(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,t=O-16|0,e=d[n+28>>2],d[t+12>>2]=e,d[n+16>>2]=d[d[t+12>>2]+4>>2],d[n+24>>2]>2])for(d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)B_(d[e+12>>2]+b(d[n+12>>2],36)|0),d[n+12>>2]=d[n+12>>2]+1;else for(t=d[n+24>>2],d[12+(i=O-16|0)>>2]=e,(0|t)>d[d[i+12>>2]+4>>2]&&bs(e,d[n+24>>2]),d[n+8>>2]=d[n+16>>2];d[n+8>>2]>2];)lo(d[e+12>>2]+b(d[n+8>>2],36)|0,d[n+20>>2]),d[n+8>>2]=d[n+8>>2]+1;d[e+4>>2]=d[n+24>>2],O=n+32|0}(e,t,i),B_(i),Rs(d[i+40>>2],d[i+36>>2],d[e+12>>2]),O=i+48|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0}(d[i+12>>2]+24|0,d[i+8>>2]),O=i+16|0},emscripten_bind_btConvexPolyhedron___destroy___0:Nc,emscripten_bind_btSequentialImpulseConstraintSolver_btSequentialImpulseConstraintSolver_0:function(){var e;return fr(e=nc(196)),0|e},emscripten_bind_btSequentialImpulseConstraintSolver___destroy___0:Nc,emscripten_bind_tAnchorArray_size_0:tc,emscripten_bind_tAnchorArray_at_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,1&s[26644]||mc(26644)&&(wl(26548),uh(26644)),t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,function(e){var t,i=0,n=0;O=t=O-16|0,d[t+12>>2]=26548,d[t+8>>2]=e,i=d[t+8>>2],n=d[i+4>>2],e=d[t+12>>2],d[e>>2]=d[i>>2],d[e+4>>2]=n,d[e+24>>2]=d[i+24>>2],n=d[i+20>>2],d[e+16>>2]=d[i+16>>2],d[e+20>>2]=n,n=d[i+12>>2],d[e+8>>2]=d[i+8>>2],d[e+12>>2]=n,$r(e+28|0,d[t+8>>2]+28|0),i=d[t+8>>2],n=d[i+80>>2],d[e+76>>2]=d[i+76>>2],d[e+80>>2]=n,d[e+92>>2]=d[i+92>>2],n=d[i+88>>2],d[e+84>>2]=d[i+84>>2],d[e+88>>2]=n,O=t+16|0}(d[d[e+12>>2]+12>>2]+b(d[e+8>>2],96)|0),O=i+16|0,26548},emscripten_bind_tAnchorArray_clear_0:c_,emscripten_bind_tAnchorArray_push_back_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Kr(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_tAnchorArray_pop_back_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],e=d[e+12>>2],d[e+4>>2]=d[e+4>>2]+-1,O=t+16|0},emscripten_bind_tAnchorArray___destroy___0:Th,emscripten_bind_RaycastInfo_get_m_contactNormalWS_0:V_,emscripten_bind_RaycastInfo_set_m_contactNormalWS_1:$o,emscripten_bind_RaycastInfo_get_m_contactPointWS_0:D_,emscripten_bind_RaycastInfo_set_m_contactPointWS_1:jo,emscripten_bind_RaycastInfo_get_m_suspensionLength_0:Jh,emscripten_bind_RaycastInfo_set_m_suspensionLength_1:Zc,emscripten_bind_RaycastInfo_get_m_hardPointWS_0:F_,emscripten_bind_RaycastInfo_set_m_hardPointWS_1:Wo,emscripten_bind_RaycastInfo_get_m_wheelDirectionWS_0:A_,emscripten_bind_RaycastInfo_set_m_wheelDirectionWS_1:Do,emscripten_bind_RaycastInfo_get_m_wheelAxleWS_0:C_,emscripten_bind_RaycastInfo_set_m_wheelAxleWS_1:Oo,emscripten_bind_RaycastInfo_get_m_isInContact_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,1&s[d[t+12>>2]+84|0]},emscripten_bind_RaycastInfo_set_m_isInContact_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,s[d[i+12>>2]+84|0]=1&s[i+11|0]},emscripten_bind_RaycastInfo_get_m_groundObject_0:f_,emscripten_bind_RaycastInfo_set_m_groundObject_1:rh,emscripten_bind_RaycastInfo___destroy___0:Dh,emscripten_bind_btMultiSphereShape_btMultiSphereShape_3:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e,t,i,n){var o,a,l=0,c=0,h=0,_=0,p=0,f=0;if(O=o=O-16|0,a=function(e){return d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,s[e+84|0]=0,d[e+76>>2]=-1082130432,d[e+80>>2]=0,d[e+68>>2]=-1082130432,d[e+72>>2]=-1082130432,d[e+60>>2]=1065353216,d[e+64>>2]=0,d[e+52>>2]=1065353216,d[e+56>>2]=1065353216,d[e>>2]=13544,e}(e),s[e+104|0]=1,d[e>>2]=11368,d[e+100>>2]=0,s[e+124|0]=1,d[e+92>>2]=0,d[e+96>>2]=0,d[e+120>>2]=0,d[e+112>>2]=0,d[e+116>>2]=0,d[e+4>>2]=9,(0|n)>=1){if(d[7717]=d[7717]+1,l=0|r[d[6606]](n<<4,16),(0|(p=d[e+92>>2]))>=1)for(;_=(c=h<<4)+l|0,c=c+d[e+100>>2]|0,f=d[c+4>>2],d[_>>2]=d[c>>2],d[_+4>>2]=f,f=d[c+12>>2],d[_+8>>2]=d[c+8>>2],d[_+12>>2]=f,(0|p)!=(0|(h=h+1|0)););if((c=d[e+100>>2])&&(u[e+104|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[e+100>>2]=0),d[e+100>>2]=l,h=1,s[e+104|0]=1,d[e+96>>2]=n,c=d[o+12>>2],d[l+8>>2]=d[o+8>>2],d[l+12>>2]=c,c=d[o+4>>2],d[l>>2]=d[o>>2],d[l+4>>2]=c,1!=(0|n))for(;_=d[o+4>>2],l=d[e+100>>2]+(h<<4)|0,d[l>>2]=d[o>>2],d[l+4>>2]=_,c=d[o+12>>2],d[l+8>>2]=d[o+8>>2],d[l+12>>2]=c,(0|(h=h+1|0))!=(0|n););l=d[e+112>>2]}if(d[e+92>>2]=n,(0|l)<(0|n)){if(d[e+116>>2]>=(0|n))_=d[e+120>>2];else{h=0,c=l,_=0,n&&(d[7717]=d[7717]+1,_=0|r[d[6606]](n<<2,16),c=d[e+112>>2]),p=d[e+120>>2];e:{t:{if((0|c)>=1)for(;;)if(d[(f=h<<2)+_>>2]=d[p+f>>2],(0|c)==(0|(h=h+1|0)))break t;if(!p)break e}u[e+124|0]&&p&&(d[7718]=d[7718]+1,r[d[6607]](p))}d[e+120>>2]=_,s[e+124|0]=1,d[e+116>>2]=n}Mn((l<<2)+_|0,0,n-l<<2)}if(d[e+112>>2]=n,h=0,(0|n)>0)for(;c=(l=h<<4)+d[e+100>>2]|0,p=d[4+(l=t+l|0)>>2],d[c>>2]=d[l>>2],d[c+4>>2]=p,_=d[l+12>>2],d[c+8>>2]=d[l+8>>2],d[c+12>>2]=_,d[(l=h<<2)+d[e+120>>2]>>2]=d[i+l>>2],(0|(h=h+1|0))!=(0|n););qn(a),O=o+16|0}(e=nc(128),d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0,0|e},emscripten_bind_btMultiSphereShape_setLocalScaling_1:gl,emscripten_bind_btMultiSphereShape_getLocalScaling_0:hc,emscripten_bind_btMultiSphereShape_calculateLocalInertia_2:Ma,emscripten_bind_btMultiSphereShape___destroy___0:Nc,emscripten_bind_btSoftBody_btSoftBody_4:function(e,t,i,n){var r;return e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,Ce(e=nc(1252),d[r+12>>2],d[r+8>>2],d[r+4>>2],d[r>>2]),O=r+16|0,0|e},emscripten_bind_btSoftBody_checkLink_2:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,e=1&function(e,t,i){var n,r=0,s=0,o=0;if((0|(n=d[e+732>>2]))>=1)for(i=(r=d[e+720>>2])+b(i,104)|0,t=r+b(t,104)|0,o=d[e+740>>2],e=0;;){if(r=b(e,52)+o|0,!((0|t)!=(0|(s=d[r+8>>2]))|(0|i)!=d[r+12>>2]))return 1;if(!((0|i)!=(0|s)|(0|t)!=d[r+12>>2]))return 1;if((0|n)==(0|(e=e+1|0)))break}return 0}(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0,0|e},emscripten_bind_btSoftBody_checkFace_3:function(e,t,i,n){var r;return e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,e=1&function(e,t,i,n){var r,s,o=0,a=0;if((0|(r=d[e+752>>2]))<1)return 0;n=(o=d[e+720>>2])+b(n,104)|0,i=o+b(i,104)|0,t=o+b(t,104)|0,s=d[e+760>>2],e=0;e:{for(;;){if(o=b(e,44)+s|0,((0|i)==(0|(a=d[o+8>>2]))||(0|a)==(0|n)|(0|t)==(0|a))&&((0|i)==(0|(a=d[o+12>>2]))||(0|a)==(0|n)|(0|t)==(0|a))&&(0|(o=d[o+16>>2]))==(0|n)|(0|t)==(0|o)|(0|i)==(0|o))break e;if((0|r)==(0|(e=e+1|0)))break}return 0}return 1}(d[r+12>>2],d[r+8>>2],d[r+4>>2],d[r>>2]),O=r+16|0,0|e},emscripten_bind_btSoftBody_appendMaterial_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=mn(d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btSoftBody_appendNode_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,function(e,t,i){var n,o=0,a=0,l=0,c=0,h=y(0),_=0,p=y(0),f=y(0);if(O=n=O-112|0,d[e+716>>2]==d[e+712>>2]){if(function(e){var t,i=0,n=0,r=0,s=0,o=0;if((n=d[e+712>>2])&&(o=d[e+720>>2],!((0|n)<1)))for(;(r=d[96+(d[e+720>>2]+b(i,104)|0)>>2])&&(d[r+36>>2]=i),(0|n)!=(0|(i=i+1|0)););if((0|(n=d[e+732>>2]))>=1)for(i=0;s=(r=b(i,52))+d[e+740>>2]|0,d[s+8>>2]=(d[s+8>>2]-o|0)/104,r=r+d[e+740>>2]|0,d[r+12>>2]=(d[r+12>>2]-o|0)/104,(0|n)!=(0|(i=i+1|0)););if((0|(r=d[e+752>>2]))>=1)for(n=0;s=(i=b(n,44))+d[e+760>>2]|0,d[s+8>>2]=(d[s+8>>2]-o|0)/104,s=i+d[e+760>>2]|0,d[s+12>>2]=(d[s+12>>2]-o|0)/104,s=i+d[e+760>>2]|0,d[s+16>>2]=(d[s+16>>2]-o|0)/104,(i=d[40+(i+d[e+760>>2]|0)>>2])&&(d[i+36>>2]=n),(0|r)!=(0|(n=n+1|0)););if((0|(n=d[e+792>>2]))>=1)for(r=d[e+800>>2],i=0;s=r+b(i,96)|0,d[s>>2]=(d[s>>2]-o|0)/104,(0|n)!=(0|(i=i+1|0)););if((0|(t=d[e+692>>2]))>=1)for(n=d[e+700>>2],r=0;;){if(i=0,s=b(r,60),d[24+(s+n|0)>>2]>0)for(;d[28+(n=(n+s|0)+(i<<2)|0)>>2]=(d[n+28>>2]-o|0)/104,i=i+1|0,n=d[e+700>>2],(0|i)>2];);if((0|t)==(0|(r=r+1|0)))break}}(e),o=d[e+712>>2]<<1|1,d[e+716>>2]<(0|o)){if(d[7717]=d[7717]+1,l=0|r[d[6606]](b(o,104),16),(0|(c=d[e+712>>2]))>=1)for(;Mi((_=b(a,104))+l|0,_+d[e+720>>2]|0,104),(0|c)!=(0|(a=a+1|0)););(a=d[e+720>>2])&&(u[e+724|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[e+720>>2]=0),d[e+720>>2]=l,d[e+716>>2]=o,s[e+724|0]=1}!function(e){var t,i=0,n=0,r=0,s=0,o=0;if((i=d[e+712>>2])&&(o=d[e+720>>2],!((0|i)<1)))for(;n=d[e+720>>2]+b(r,104)|0,(s=d[n+96>>2])&&(d[s+36>>2]=n),(0|i)!=(0|(r=r+1|0)););if((0|(n=d[e+732>>2]))>=1)for(r=0;i=(s=b(r,52))+d[e+740>>2]|0,d[i+8>>2]=b(d[i+8>>2],104)+o,i=12+(s+d[e+740>>2]|0)|0,d[i>>2]=b(d[i>>2],104)+o,(0|n)!=(0|(r=r+1|0)););if((0|(s=d[e+752>>2]))>=1)for(i=0;n=(r=b(i,44))+d[e+760>>2]|0,d[n+8>>2]=b(d[n+8>>2],104)+o,n=12+(r+d[e+760>>2]|0)|0,d[n>>2]=b(d[n>>2],104)+o,n=16+(r+d[e+760>>2]|0)|0,d[n>>2]=b(d[n>>2],104)+o,r=r+d[e+760>>2]|0,(n=d[r+40>>2])&&(d[n+36>>2]=r),(0|s)!=(0|(i=i+1|0)););if((0|(n=d[e+792>>2]))>=1)for(s=d[e+800>>2],r=0;i=s+b(r,96)|0,d[i>>2]=b(d[i>>2],104)+o,(0|n)!=(0|(r=r+1|0)););if((0|(t=d[e+692>>2]))>=1)for(i=d[e+700>>2],n=0;;){if(r=0,s=b(n,60),d[24+(s+i|0)>>2]>0)for(;d[(i=28+((i+s|0)+(r<<2)|0)|0)>>2]=b(d[i>>2],104)+o,r=r+1|0,i=d[e+700>>2],(0|r)>2];);if((0|t)==(0|(n=n+1|0)))break}}(e)}if(o=d[e+192>>2],h=y(r[d[d[o>>2]+48>>2]](o)),Mn(n+8|0,0,100),(0|(o=d[e+712>>2]))==d[e+716>>2]&&!((0|o)>=(0|(l=o?o<<1:1)))){if(l?(d[7717]=d[7717]+1,c=0|r[d[6606]](b(l,104),16),o=d[e+712>>2]):c=0,(0|o)>=1)for(a=0;Mi((_=b(a,104))+c|0,_+d[e+720>>2]|0,104),(0|(a=a+1|0))!=(0|o););(o=d[e+720>>2])&&(u[e+724|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[e+720>>2]=0),d[e+720>>2]=c,d[e+716>>2]=l,s[e+724|0]=1,o=d[e+712>>2]}o=d[e+720>>2]+b(o,104)|0,d[o>>2]=0,Mi(o+4|0,n+8|0,100),o=d[e+712>>2],d[e+712>>2]=o+1,o=Mn(d[e+720>>2]+b(o,104)|0,0,104),a=d[t+12>>2],d[o+16>>2]=d[t+8>>2],d[o+20>>2]=a,a=d[t+4>>2],d[o+8>>2]=d[t>>2],d[o+12>>2]=a,a=d[t>>2],l=d[t+4>>2],c=d[t+12>>2],d[o+32>>2]=d[t+8>>2],d[o+36>>2]=c,d[o+24>>2]=a,d[o+28>>2]=l,m[o+88>>2]=i>y(0)?y(y(1)/i):y(0),d[o+4>>2]=d[d[e+880>>2]>>2],i=m[o+8>>2],p=m[o+12>>2],f=m[o+16>>2],d[n+36>>2]=0,m[n+32>>2]=h+f,m[n+28>>2]=h+p,d[n+20>>2]=0,m[n+24>>2]=h+i,m[n+16>>2]=f-h,m[n+12>>2]=p-h,m[n+8>>2]=i-h,d[o+96>>2]=br(e+928|0,n+8|0,o),O=n+112|0}(d[n+12>>2],d[n+8>>2],m[n+4>>2]),O=n+16|0},emscripten_bind_btSoftBody_appendLink_4:function(e,t,i,n,r){var o;e|=0,t|=0,i|=0,n|=0,r|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,s[o+15|0]=r,Lh(d[o+28>>2],d[o+24>>2],d[o+20>>2],d[o+16>>2],1&s[o+15|0]),O=o+32|0},emscripten_bind_btSoftBody_appendFace_4:function(e,t,i,n,r){var s;e|=0,t|=0,i|=0,n|=0,r|=0,O=s=O-32|0,d[s+28>>2]=e,d[s+24>>2]=t,d[s+20>>2]=i,d[s+16>>2]=n,d[s+12>>2]=r,lr(d[s+28>>2],d[s+24>>2],d[s+20>>2],d[s+16>>2],d[s+12>>2]),O=s+32|0},emscripten_bind_btSoftBody_appendTetra_5:function(e,t,i,n,r,o){var a;e|=0,t|=0,i|=0,n|=0,r|=0,o|=0,O=a=O-32|0,d[a+28>>2]=e,d[a+24>>2]=t,d[a+20>>2]=i,d[a+16>>2]=n,d[a+12>>2]=r,d[a+8>>2]=o,function(e,t,i,n,r,o){var a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0);Jn(e,o),o=d[e+780>>2]+b(d[e+772>>2],104)|0,t=d[e+720>>2]+b(t,104)|0,d[o+-96>>2]=t,i=d[e+720>>2]+b(i,104)|0,d[o+-92>>2]=i,n=d[e+720>>2]+b(n,104)|0,d[o+-88>>2]=n,r=d[e+720>>2]+b(r,104)|0,d[o+-84>>2]=r,a=m[t+16>>2],h=y(m[r+16>>2]-a),l=m[t+8>>2],_=y(m[n+8>>2]-l),c=m[t+12>>2],u=y(m[r+12>>2]-c),p=y(m[n+12>>2]-c),f=y(m[r+8>>2]-l),g=y(y(m[i+16>>2]-a)*y(y(_*u)-y(p*f))),a=y(m[n+16>>2]-a),m[o+-80>>2]=g+y(y(y(m[i+8>>2]-l)*y(y(p*h)-y(a*u)))+y(y(m[i+12>>2]-c)*y(y(a*f)-y(_*h)))),s[e+924|0]=1}(d[a+28>>2],d[a+24>>2],d[a+20>>2],d[a+16>>2],d[a+12>>2],d[a+8>>2]),O=a+32|0},emscripten_bind_btSoftBody_appendAnchor_4:function(e,t,i,n,r){var o;e|=0,t|=0,i|=0,n|=0,r=y(r),O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,s[o+19|0]=n,m[o+12>>2]=r,function(e,t,i,n,r){var s,o,a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0);O=s=O-16|0,o=d[e+720>>2]+b(t,104)|0,l=m[o+16>>2],c=m[o+12>>2],h=m[o+8>>2],p=m[i+20>>2],f=m[i+36>>2],g=m[i+40>>2],v=m[i+24>>2],A=m[i+8>>2],_=m[i+60>>2],C=m[i+44>>2],S=m[i+28>>2],a=m[i+56>>2],u=m[i+52>>2],x=m[i+12>>2],T=m[i+4>>2],d[s+12>>2]=0,a=y(-a),m[s+8>>2]=y(y(y(S*a)-y(x*u))-y(C*_))+y(y(y(x*h)+y(S*c))+y(C*l)),m[s+4>>2]=y(y(y(v*a)-y(A*u))-y(g*_))+y(y(y(A*h)+y(v*c))+y(g*l)),m[s>>2]=y(y(y(p*a)-y(T*u))-y(f*_))+y(y(y(T*h)+y(p*c))+y(f*l)),nn(e,t,i,s,n,r),O=s+16|0}(d[o+28>>2],d[o+24>>2],d[o+20>>2],1&s[o+19|0],m[o+12>>2]),O=o+32|0},emscripten_bind_btSoftBody_addForce_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n=0,r=0;if((0|(i=d[e+712>>2]))>=1)for(r=d[e+720>>2],e=0;n=b(e,104)+r|0,m[n+88>>2]>y(0)&&(m[n+56>>2]=m[t>>2]+m[n+56>>2],m[n+60>>2]=m[t+4>>2]+m[n+60>>2],m[(n=n- -64|0)>>2]=m[t+8>>2]+m[n>>2]),(0|i)!=(0|(e=e+1|0)););}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody_addForce_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e,t,i){e=d[e+720>>2]+b(i,104)|0,m[e+88>>2]>y(0)&&(m[e+56>>2]=m[t>>2]+m[e+56>>2],m[e+60>>2]=m[t+4>>2]+m[e+60>>2],m[(e=e- -64|0)>>2]=m[t+8>>2]+m[e>>2])}(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0},emscripten_bind_btSoftBody_addAeroForceToNode_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,Ke(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0},emscripten_bind_btSoftBody_getTotalMass_0:function(e){e|=0;var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=function(e){var t,i=y(0),n=0,r=y(0);if((0|(t=d[e+712>>2]))>=1)for(n=d[e+720>>2],e=0;r=i,i=m[88+(b(e,104)+n|0)>>2],i=y(r+(i>y(0)?y(y(1)/i):y(0))),(0|t)!=(0|(e=e+1|0)););return i}(d[t+12>>2]),O=t+16|0,y(i)},emscripten_bind_btSoftBody_setTotalMass_2:function(e,t,i){var n;e|=0,t=y(t),i|=0,O=n=O-16|0,d[n+12>>2]=e,m[n+8>>2]=t,s[n+7|0]=i,function(e,t,i){var n,r=y(0),o=0,a=0,l=y(0),c=y(0),h=y(0),_=0,u=y(0),p=0,f=y(0),g=0,v=y(0);n=d[e+712>>2];e:{if(i){if((0|n)>=1)for(a=d[e+720>>2],i=0;d[88+(a+b(i,104)|0)>>2]=0,(0|n)!=(0|(i=i+1|0)););if((0|(p=d[e+752>>2]))>=1)for(g=d[e+760>>2];o=b(_,44)+g|0,i=d[o+8>>2],a=d[o+12>>2],r=m[i+8>>2],f=y(m[a+8>>2]-r),o=d[o+16>>2],l=m[i+12>>2],c=y(m[o+12>>2]-l),l=y(m[a+12>>2]-l),r=y(m[o+8>>2]-r),h=y(y(f*c)-y(l*r)),v=y(h*h),u=l,l=m[i+16>>2],h=y(m[o+16>>2]-l),l=y(m[a+16>>2]-l),c=y(y(u*h)-y(l*c)),r=y(y(l*r)-y(f*h)),r=y(x(y(v+y(y(c*c)+y(r*r))))),m[i+88>>2]=r+m[i+88>>2],m[a+88>>2]=r+m[a+88>>2],m[o+88>>2]=r+m[o+88>>2],(0|p)!=(0|(_=_+1|0)););if((0|n)<1)break e;for(a=d[e+720>>2],i=0;o=a+b(i,104)|0,m[o+88>>2]=y(1)/m[o+88>>2],(0|n)!=(0|(i=i+1|0)););}if(!((0|n)<1)){for(a=d[e+720>>2],i=0,r=y(0);u=r,r=m[88+(a+b(i,104)|0)>>2],r=y(u+(r>y(0)?y(y(1)/r):y(0))),(0|n)!=(0|(i=i+1|0)););if(!((0|n)<1))for(t=y(y(y(1)/r)*t),a=d[e+720>>2],i=0;o=a+b(i,104)|0,m[o+88>>2]=m[o+88>>2]/t,(0|n)!=(0|(i=i+1|0)););}}s[e+924|0]=1}(d[n+12>>2],m[n+8>>2],1&s[n+7|0]),O=n+16|0},emscripten_bind_btSoftBody_setMass_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,e=d[n+12>>2],i=m[n+4>>2],m[88+(d[e+720>>2]+b(d[n+8>>2],104)|0)>>2]=i>y(0)?y(y(1)/i):y(0),s[e+924|0]=1,O=n+16|0},emscripten_bind_btSoftBody_transform_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,je(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody_translate_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n=0;O=i=O+-64|0,d[i+12>>2]=0,d[i+16>>2]=0,d[i+24>>2]=0,d[i+28>>2]=0,d[i+20>>2]=1065353216,d[i+40>>2]=1065353216,d[i+44>>2]=0,d[i+4>>2]=0,d[i+8>>2]=0,d[i>>2]=1065353216,d[i+32>>2]=0,d[i+36>>2]=0,n=d[t+12>>2],d[i+56>>2]=d[t+8>>2],d[i+60>>2]=n,n=d[t+4>>2],d[i+48>>2]=d[t>>2],d[i+52>>2]=n,je(e,i),O=i- -64|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody_rotate_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n=y(0),r=y(0),s=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0);O=i=O+-64|0,d[i+56>>2]=0,d[i+60>>2]=0,d[i+48>>2]=0,d[i+52>>2]=0,s=m[t+12>>2],a=m[t+8>>2],n=m[t>>2],r=m[t+4>>2],d[i+44>>2]=0,d[i+28>>2]=0,c=y(y(2)/y(y(y(y(n*n)+y(r*r))+y(a*a))+y(s*s))),h=y(a*c),o=y(r*h),l=y(n*c),_=y(s*l),m[i+36>>2]=o+_,m[i+24>>2]=o-_,o=y(n*l),l=r,r=y(r*c),c=y(l*r),m[i+40>>2]=y(1)-y(o+c),a=y(a*h),m[i+20>>2]=y(1)-y(o+a),d[i+12>>2]=0,o=y(n*h),l=y(s*r),m[i+32>>2]=o-l,n=y(n*r),s=y(s*h),m[i+16>>2]=n+s,m[i+8>>2]=o+l,m[i+4>>2]=n-s,m[i>>2]=y(1)-y(c+a),je(e,i),O=i- -64|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody_scale_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i,n=0,s=y(0),o=y(0),a=y(0),l=y(0),c=0,h=0,_=0;if(O=i=O-32|0,n=d[e+192>>2],s=y(r[d[d[n>>2]+48>>2]](n)),(0|(h=d[e+712>>2]))>=1)for(_=e+928|0;n=d[e+720>>2]+b(c,104)|0,o=y(m[t>>2]*m[n+8>>2]),m[n+8>>2]=o,a=y(m[t+4>>2]*m[n+12>>2]),m[n+12>>2]=a,l=y(m[t+8>>2]*m[n+16>>2]),m[n+16>>2]=l,m[n+24>>2]=m[t>>2]*m[n+24>>2],m[n+28>>2]=m[t+4>>2]*m[n+28>>2],m[n+32>>2]=m[t+8>>2]*m[n+32>>2],d[i+28>>2]=0,m[i+24>>2]=s+l,m[i+20>>2]=s+a,m[i+16>>2]=s+o,d[i+12>>2]=0,m[i+8>>2]=l-s,m[i+4>>2]=a-s,m[i>>2]=o-s,Qr(_,d[n+96>>2],i),(0|h)!=(0|(c=c+1|0)););yi(e);e:if(t=d[e+928>>2]){if(n=d[e+192>>2],s=y(r[d[d[n>>2]+48>>2]](n)),o=m[t>>2],a=m[t+4>>2],l=m[t+8>>2],d[e+904>>2]=0,m[e+900>>2]=l-s,m[e+896>>2]=a-s,m[e+892>>2]=o-s,o=m[t+20>>2],a=m[t+24>>2],l=m[t+16>>2],d[e+920>>2]=0,m[e+916>>2]=s+a,m[e+912>>2]=s+o,m[(t=e+908|0)>>2]=s+l,!(n=d[e+188>>2]))break e;c=d[e+684>>2],h=d[c+32>>2],r[d[d[h>>2]+16>>2]](h,n,e+892|0,t,d[c+36>>2])}else d[e+892>>2]=0,d[e+896>>2]=0,d[e+916>>2]=0,d[e+920>>2]=0,d[e+908>>2]=0,d[e+912>>2]=0,d[e+900>>2]=0,d[e+904>>2]=0;Ir(e),O=i+32|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody_generateClusters_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=N(d[i+12>>2],d[i+8>>2],8192),O=i+16|0,0|e},emscripten_bind_btSoftBody_generateClusters_2:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,e=N(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0,0|e},emscripten_bind_btSoftBody_generateBendingConstraints_2:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,e=function(e,t,i){var n,o=0,a=0,l=0,c=0,h=0,_=0,p=0,g=0,v=0,A=0,C=0,S=y(0),E=0,R=0,P=y(0),I=0,M=0,D=0,w=0,F=0;if(O=n=O-32|0,(0|t)>=2){if(h=d[e+712>>2],v=ic((0|(a=b(h,h)))!=(1073741823&a)?-1:a<<2),(0|h)>=1)for(;;){for(c=((p=b(o,h))+o<<2)+v|0,a=0;l=(b(a,h)+o<<2)+v|0,(0|o)==(0|a)?(d[l>>2]=0,d[c>>2]=0):(d[l>>2]=2147483647,d[(a+p<<2)+v>>2]=2147483647),(0|h)!=(0|(a=a+1|0)););if((0|h)==(0|(o=o+1|0)))break}if((0|(l=d[e+732>>2]))>=1)for(o=d[e+720>>2],p=d[e+740>>2],a=0;c=p+b(a,52)|0,_=(d[c+12>>2]-o|0)/104|0,c=(d[c+8>>2]-o|0)/104|0,d[(b(_,h)+c<<2)+v>>2]=1,d[(_+b(c,h)<<2)+v>>2]=1,(0|l)!=(0|(a=a+1|0)););e:{if(2==(0|t)){c=0,d[n+20>>2]=0,s[n+24|0]=1,d[n+12>>2]=0,d[n+16>>2]=0;t:{i:{if((0|h)>-1){if(h)for(function(e,t){var i=0,n=0,o=0,a=0,l=0,c=0,h=0,_=0,p=0,f=0,m=0,g=0;if(d[e+8>>2]<(0|t)){if(t?(d[7717]=d[7717]+1,c=0|r[d[6606]](b(t,20),16)):c=0,!((0|(_=d[e+4>>2]))<1)){for(;;){if(n=d[e+12>>2],o=b(h,20),d[12+(i=o+c|0)>>2]=0,s[i+16|0]=1,d[i+4>>2]=0,d[i+8>>2]=0,(0|(o=d[4+(p=n+o|0)>>2]))>=1){d[7717]=d[7717]+1,f=o<<2,l=0|r[d[6606]](f,16),a=d[i+12>>2],n=0;n:{r:{if((0|(m=d[i+4>>2]))>=1)for(;;)if(d[l+(g=n<<2)>>2]=d[a+g>>2],(0|m)==(0|(n=n+1|0)))break r;if(!a)break n}u[i+16|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a))}for(s[i+16|0]=1,d[i+12>>2]=l,d[i+8>>2]=o,n=0,Mn(l,0,f),d[i+4>>2]=o,a=d[p+12>>2],i=d[i+12>>2];d[(l=n<<2)+i>>2]=d[a+l>>2],(0|o)!=(0|(n=n+1|0)););}else d[i+4>>2]=o;if((0|_)==(0|(h=h+1|0)))break}if(!((0|(l=d[e+4>>2]))<1))for(n=0;o=i=d[e+12>>2]+b(n,20)|0,(a=d[i+12>>2])&&(u[i+16|0]&&a&&(d[7718]=d[7718]+1,r[d[6607]](a)),d[o+12>>2]=0),s[i+16|0]=1,d[o+12>>2]=0,d[i+4>>2]=0,d[i+8>>2]=0,(0|l)!=(0|(n=n+1|0)););}(i=d[e+12>>2])&&(u[e+16|0]&&i&&(d[7718]=d[7718]+1,r[d[6607]](i)),d[e+12>>2]=0),d[e+12>>2]=c,s[e+16|0]=1,d[e+8>>2]=t}}(n+8|0,h),c=d[n+20>>2],a=0;o=b(a,20)+c|0,d[o+4>>2]=0,d[o+8>>2]=0,s[o+16|0]=1,d[o+12>>2]=0,(0|h)!=(0|(a=a+1|0)););if(d[n+12>>2]=h,l=h,d[e+732>>2]<1)break t;for(p=0;;){o=d[e+740>>2]+b(p,52)|0,a=d[e+720>>2],g=(d[o+12>>2]-a|0)/104|0,C=(d[o+8>>2]-a|0)/104|0,l=b(C,20)+c|0;n:{r:if(!((0|(o=d[l+4>>2]))<1)){for(_=d[l+12>>2],a=0;;){if((0|g)!=d[_+(a<<2)>>2]){if((0|(a=a+1|0))!=(0|o))continue;break r}break}if((0|o)!=(0|a))break n}if(d[l+8>>2]==(0|o)&&!((0|o)>=(0|(A=o?o<<1:1)))){a=0,c=0,A&&(d[7717]=d[7717]+1,c=0|r[d[6606]](A<<2,16),o=d[l+4>>2]),_=d[l+12>>2];r:{s:{if((0|o)>=1)for(;;)if(d[(E=a<<2)+c>>2]=d[_+E>>2],(0|(a=a+1|0))==(0|o))break s;if(!_)break r}u[l+16|0]&&_&&(d[7718]=d[7718]+1,r[d[6607]](_)),d[l+12>>2]=0,o=d[l+4>>2]}s[l+16|0]=1,d[l+12>>2]=c,d[l+8>>2]=A}d[d[l+12>>2]+(o<<2)>>2]=g,d[l+4>>2]=d[l+4>>2]+1,c=d[n+20>>2]}l=b(g,20)+c|0;n:{r:if(!((0|(o=d[l+4>>2]))<1)){for(c=d[l+12>>2],a=0;;){if((0|C)!=d[c+(a<<2)>>2]){if((0|(a=a+1|0))!=(0|o))continue;break r}break}if((0|o)!=(0|a))break n}if(d[l+8>>2]==(0|o)&&!((0|o)>=(0|(_=o?o<<1:1)))){a=0,g=0,_&&(d[7717]=d[7717]+1,g=0|r[d[6606]](_<<2,16),o=d[l+4>>2]),c=d[l+12>>2];r:{s:{if((0|o)>=1)for(;;)if(d[(A=a<<2)+g>>2]=d[c+A>>2],(0|(a=a+1|0))==(0|o))break s;if(!c)break r}u[l+16|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[l+12>>2]=0,o=d[l+4>>2]}s[l+16|0]=1,d[l+12>>2]=g,d[l+8>>2]=_}d[d[l+12>>2]+(o<<2)>>2]=C,d[l+4>>2]=d[l+4>>2]+1}if((0|(p=p+1|0))>=d[e+732>>2])break i;c=d[n+20>>2]}}T()}l=d[n+12>>2]}if(!((0|l)<1)){for(o=0,c=d[n+20>>2];;){if(_=c+b(o,20)|0,d[_+4>>2]>=1)for(M=b(o,h),D=d[_+12>>2],p=0;;){if(g=d[(p<<2)+D>>2],A=c+b(g,20)|0,(0|(C=d[A+4>>2]))>=1)for(w=(b(h,g)+o<<2)+v|0,F=d[A+12>>2],a=0;(0|(E=d[(a<<2)+F>>2]))!=(0|o)&&(I=((R=b(h,E))+o<<2)+v|0,R=d[(g+R<<2)+v>>2]+d[w>>2]|0,f[I>>2]<=R>>>0||(d[(E+M<<2)+v>>2]=R,d[I>>2]=R,C=d[A+4>>2])),(0|(a=a+1|0))<(0|C););if(!((0|(p=p+1|0))>2]))break}if((0|l)==(0|(o=o+1|0)))break}if(!((0|l)<1))for(o=0;p=a=d[n+20>>2]+b(o,20)|0,(c=d[a+12>>2])&&(u[a+16|0]&&c&&(d[7718]=d[7718]+1,r[d[6607]](c)),d[p+12>>2]=0),s[a+16|0]=1,d[p+12>>2]=0,d[a+4>>2]=0,d[a+8>>2]=0,(0|l)!=(0|(o=o+1|0)););}(o=d[n+20>>2])&&(u[n+24|0]&&o&&(d[7718]=d[7718]+1,r[d[6607]](o)),d[n+20>>2]=0)}else{if(p=0,(0|h)<=0)break e;for(;;){for(_=b(h,p),o=0;;){if(l=o,(0|(o=o+1|0))<(0|h))for(A=((g=b(l,h))+p<<2)+v|0,a=o;C=(a+g<<2)+v|0,c=d[A>>2]+d[(a+_<<2)+v>>2]|0,f[C>>2]>c>>>0&&(d[(l+b(a,h)<<2)+v>>2]=c,d[C>>2]=c),(0|h)!=(0|(a=a+1|0)););if((0|o)==(0|h))break}if((0|(p=p+1|0))==(0|h))break}}if(p=0,!((0|h)<1))for(o=0;;){if(l=o,(0|(o=o+1|0))<(0|h))for(A=b(l,h),a=o;d[(a+A<<2)+v>>2]==(0|t)&&(_=d[e+720>>2],di(e,i),g=(C=b(d[e+732>>2],52)+-52|0)+d[e+740>>2]|0,c=_+b(a,104)|0,d[g+8>>2]=c,_=_+b(l,104)|0,d[g+12>>2]=_,S=y(m[c+8>>2]-m[_+8>>2]),P=y(S*S),S=y(m[c+12>>2]-m[_+12>>2]),P=y(P+y(S*S)),S=y(m[c+16>>2]-m[_+16>>2]),m[g+16>>2]=x(y(P+y(S*S))),s[e+924|0]=1,c=C+d[e+740>>2]|0,s[c+20|0]=1|u[c+20|0],p=p+1|0),(0|h)!=(0|(a=a+1|0)););if((0|o)==(0|h))break}}ve(v)}return O=n+32|0,p}(d[n+12>>2],d[n+8>>2],d[n+4>>2]),O=n+16|0,0|e},emscripten_bind_btSoftBody_upcast_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=function(e){var t;return O=t=O-16|0,d[t+8>>2]=e,d[12+(e=O-16|0)>>2]=d[t+8>>2],8!=d[d[e+12>>2]+236>>2]?d[t+12>>2]=0:d[t+12>>2]=d[t+8>>2],O=t+16|0,d[t+12>>2]}(d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btSoftBody_setAnisotropicFriction_2:tl,emscripten_bind_btSoftBody_getCollisionShape_0:Xl,emscripten_bind_btSoftBody_setContactProcessingThreshold_1:la,emscripten_bind_btSoftBody_setActivationState_1:Xa,emscripten_bind_btSoftBody_forceActivationState_1:pc,emscripten_bind_btSoftBody_activate_0:n_,emscripten_bind_btSoftBody_activate_1:yc,emscripten_bind_btSoftBody_isActive_0:Rh,emscripten_bind_btSoftBody_isKinematicObject_0:dl,emscripten_bind_btSoftBody_isStaticObject_0:ul,emscripten_bind_btSoftBody_isStaticOrKinematicObject_0:pl,emscripten_bind_btSoftBody_getRestitution_0:Bl,emscripten_bind_btSoftBody_getFriction_0:Nl,emscripten_bind_btSoftBody_getRollingFriction_0:Ll,emscripten_bind_btSoftBody_setRestitution_1:Ac,emscripten_bind_btSoftBody_setFriction_1:Cc,emscripten_bind_btSoftBody_setRollingFriction_1:Sc,emscripten_bind_btSoftBody_getWorldTransform_0:lc,emscripten_bind_btSoftBody_getCollisionFlags_0:Wl,emscripten_bind_btSoftBody_setCollisionFlags_1:ha,emscripten_bind_btSoftBody_setWorldTransform_1:Ec,emscripten_bind_btSoftBody_setCollisionShape_1:ml,emscripten_bind_btSoftBody_setCcdMotionThreshold_1:oa,emscripten_bind_btSoftBody_setCcdSweptSphereRadius_1:aa,emscripten_bind_btSoftBody_getUserIndex_0:Hl,emscripten_bind_btSoftBody_setUserIndex_1:ua,emscripten_bind_btSoftBody_getUserPointer_0:Hl,emscripten_bind_btSoftBody_setUserPointer_1:ua,emscripten_bind_btSoftBody_getBroadphaseHandle_0:zl,emscripten_bind_btSoftBody_get_m_cfg_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+288|0},emscripten_bind_btSoftBody_set_m_cfg_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Mi(e=d[i+12>>2],d[i+8>>2],104),Ch(e+104|0,d[i+8>>2]+104|0),Ch(e+124|0,d[i+8>>2]+124|0),Ch(e+144|0,d[i+8>>2]+144|0),O=i+16|0}(d[i+12>>2]+288|0,d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody_get_m_nodes_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+708|0},emscripten_bind_btSoftBody_set_m_nodes_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Us(d[i+12>>2],d[i+8>>2]),O=i+16|0}(d[i+12>>2]+708|0,d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody_get_m_faces_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+748|0},emscripten_bind_btSoftBody_set_m_faces_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,is(d[i+12>>2],d[i+8>>2]),O=i+16|0}(d[i+12>>2]+748|0,d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody_get_m_materials_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+868|0},emscripten_bind_btSoftBody_set_m_materials_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ch(d[i+12>>2]+868|0,d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody_get_m_anchors_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+788|0},emscripten_bind_btSoftBody_set_m_anchors_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-112|0,d[i+108>>2]=e,d[i+104>>2]=t,e=d[i+108>>2],d[12+(t=O-16|0)>>2]=d[i+104>>2],d[i+100>>2]=d[d[t+12>>2]+4>>2],t=d[i+100>>2],Mn(i,0,96),wl(i),function(e,t,i){var n;if(O=n=O-32|0,d[n+28>>2]=e,d[n+24>>2]=t,d[n+20>>2]=i,t=O-16|0,e=d[n+28>>2],d[t+12>>2]=e,d[n+16>>2]=d[d[t+12>>2]+4>>2],d[n+24>>2]>2])for(d[n+12>>2]=d[n+24>>2];d[n+12>>2]>2];)d[n+12>>2]=d[n+12>>2]+1;else for(t=d[n+24>>2],d[12+(i=O-16|0)>>2]=e,(0|t)>d[d[i+12>>2]+4>>2]&&gs(e,d[n+24>>2]),d[n+8>>2]=d[n+16>>2];d[n+8>>2]>2];)Wr(d[e+12>>2]+b(d[n+8>>2],96)|0,d[n+20>>2]),d[n+8>>2]=d[n+8>>2]+1;d[e+4>>2]=d[n+24>>2],O=n+32|0}(e,t,i),Ps(d[i+104>>2],d[i+100>>2],d[e+12>>2]),O=i+112|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0}(d[i+12>>2]+788|0,d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftBody___destroy___0:Bc,emscripten_bind_btIntArray_size_0:tc,emscripten_bind_btIntArray_at_1:Fo,emscripten_bind_btIntArray___destroy___0:Th,emscripten_bind_Config_get_kVCF_0:s_,emscripten_bind_Config_set_kVCF_1:ah,emscripten_bind_Config_get_kDP_0:o_,emscripten_bind_Config_set_kDP_1:lh,emscripten_bind_Config_get_kDG_0:t_,emscripten_bind_Config_set_kDG_1:th,emscripten_bind_Config_get_kLF_0:Hh,emscripten_bind_Config_set_kLF_1:Jc,emscripten_bind_Config_get_kPR_0:e_,emscripten_bind_Config_set_kPR_1:eh,emscripten_bind_Config_get_kVC_0:i_,emscripten_bind_Config_set_kVC_1:ih,emscripten_bind_Config_get_kDF_0:jh,emscripten_bind_Config_set_kDF_1:Gc,emscripten_bind_Config_get_kMT_0:Jh,emscripten_bind_Config_set_kMT_1:Zc,emscripten_bind_Config_get_kCHR_0:Kh,emscripten_bind_Config_set_kCHR_1:Qc,emscripten_bind_Config_get_kKHR_0:Gh,emscripten_bind_Config_set_kKHR_1:Uc,emscripten_bind_Config_get_kSHR_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+44>>2])},emscripten_bind_Config_set_kSHR_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+44>>2]=m[i+8>>2]},emscripten_bind_Config_get_kAHR_0:Wh,emscripten_bind_Config_set_kAHR_1:jc,emscripten_bind_Config_get_kSRHR_CL_0:zh,emscripten_bind_Config_set_kSRHR_CL_1:Wc,emscripten_bind_Config_get_kSKHR_CL_0:Xh,emscripten_bind_Config_set_kSKHR_CL_1:zc,emscripten_bind_Config_get_kSSHR_CL_0:Yh,emscripten_bind_Config_set_kSSHR_CL_1:Hc,emscripten_bind_Config_get_kSR_SPLT_CL_0:Qh,emscripten_bind_Config_set_kSR_SPLT_CL_1:Xc,emscripten_bind_Config_get_kSK_SPLT_CL_0:qh,emscripten_bind_Config_set_kSK_SPLT_CL_1:Yc,emscripten_bind_Config_get_kSS_SPLT_CL_0:Zh,emscripten_bind_Config_set_kSS_SPLT_CL_1:qc,emscripten_bind_Config_get_maxvolume_0:r_,emscripten_bind_Config_set_maxvolume_1:Kc,emscripten_bind_Config_get_timescale_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+80>>2])},emscripten_bind_Config_set_timescale_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+80>>2]=m[i+8>>2]},emscripten_bind_Config_get_viterations_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+84>>2]},emscripten_bind_Config_set_viterations_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+84>>2]=d[i+8>>2]},emscripten_bind_Config_get_piterations_0:f_,emscripten_bind_Config_set_piterations_1:rh,emscripten_bind_Config_get_diterations_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+92>>2]},emscripten_bind_Config_set_diterations_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+92>>2]=d[i+8>>2]},emscripten_bind_Config_get_citerations_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+96>>2]},emscripten_bind_Config_set_citerations_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+96>>2]=d[i+8>>2]},emscripten_bind_Config_get_collisions_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+100>>2]},emscripten_bind_Config_set_collisions_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+100>>2]=d[i+8>>2]},emscripten_bind_Config___destroy___0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&(function(e){var t;O=t=O-16|0,d[t+12>>2]=e,c_((e=d[t+12>>2])+144|0),c_(e+124|0),c_(e+104|0),O=t+16|0}(e),ve(e)),O=t+16|0},emscripten_bind_Node_get_m_x_0:N_,emscripten_bind_Node_set_m_x_1:Ho,emscripten_bind_Node_get_m_q_0:M_,emscripten_bind_Node_set_m_q_1:wo,emscripten_bind_Node_get_m_v_0:R_,emscripten_bind_Node_set_m_v_1:Vo,emscripten_bind_Node_get_m_f_0:P_,emscripten_bind_Node_set_m_f_1:Uo,emscripten_bind_Node_get_m_n_0:I_,emscripten_bind_Node_set_m_n_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+72>>2]=d[e>>2],d[t+76>>2]=i,i=d[e+12>>2],d[t+80>>2]=d[e+8>>2],d[t+84>>2]=i},emscripten_bind_Node_get_m_im_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,y(m[d[t+12>>2]+88>>2])},emscripten_bind_Node_set_m_im_1:function(e,t){var i;e|=0,t=y(t),d[12+(i=O-16|0)>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+88>>2]=m[i+8>>2]},emscripten_bind_Node_get_m_area_0:$h,emscripten_bind_Node_set_m_area_1:nh,emscripten_bind_Node___destroy___0:Dh,emscripten_bind_btGhostPairCallback_btGhostPairCallback_0:function(){var e;return function(e){var t,i;O=t=O-16|0,d[t+12>>2]=e,e=O-16|0,i=d[t+12>>2],d[e+12>>2]=i,d[d[e+12>>2]>>2]=1712,d[i>>2]=1612,O=t+16|0}(e=ic(4)),0|e},emscripten_bind_btGhostPairCallback___destroy___0:Nc,emscripten_bind_btOverlappingPairCallback___destroy___0:Nc,emscripten_bind_btKinematicCharacterController_btKinematicCharacterController_3:function(e,t,i){var n;return e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,Fr(e=nc(184),d[n+12>>2],d[n+8>>2],m[n+4>>2],1),O=n+16|0,0|e},emscripten_bind_btKinematicCharacterController_btKinematicCharacterController_4:function(e,t,i,n){var r;return e|=0,t|=0,i=y(i),n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,m[r+4>>2]=i,d[r>>2]=n,Fr(e=nc(184),d[r+12>>2],d[r+8>>2],m[r+4>>2],d[r>>2]),O=r+16|0,0|e},emscripten_bind_btKinematicCharacterController_setUpAxis_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[i+8>>2]<0&&(d[i+8>>2]=0),d[i+8>>2]>2&&(d[i+8>>2]=2),d[e+176>>2]=d[i+8>>2]}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btKinematicCharacterController_setWalkDirection_1:Sl,emscripten_bind_btKinematicCharacterController_setVelocityForTimeInterval_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,e=d[n+12>>2],r[d[d[e>>2]+20>>2]](e,d[n+8>>2],m[n+4>>2]),O=n+16|0},emscripten_bind_btKinematicCharacterController_warp_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+28>>2]](e,d[i+8>>2]),O=i+16|0},emscripten_bind_btKinematicCharacterController_preStep_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],r[d[d[e>>2]+32>>2]](e,d[i+8>>2]),O=i+16|0},emscripten_bind_btKinematicCharacterController_playerStep_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,e=d[n+12>>2],r[d[d[e>>2]+36>>2]](e,d[n+8>>2],m[n+4>>2]),O=n+16|0},emscripten_bind_btKinematicCharacterController_setFallSpeed_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+24>>2]=m[i+8>>2],O=i+16|0},emscripten_bind_btKinematicCharacterController_setJumpSpeed_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+28>>2]=m[i+8>>2],O=i+16|0},emscripten_bind_btKinematicCharacterController_setMaxJumpHeight_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+32>>2]=m[i+8>>2],O=i+16|0},emscripten_bind_btKinematicCharacterController_canJump_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],e=1&r[d[d[e>>2]+40>>2]](e),O=t+16|0,0|e},emscripten_bind_btKinematicCharacterController_jump_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],r[d[d[e>>2]+44>>2]](e),O=t+16|0},emscripten_bind_btKinematicCharacterController_setGravity_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+44>>2]=m[i+8>>2],O=i+16|0},emscripten_bind_btKinematicCharacterController_getGravity_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,O=t+16|0,y(m[d[t+12>>2]+44>>2])},emscripten_bind_btKinematicCharacterController_setMaxSlope_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,e=d[i+12>>2],t=m[i+8>>2],m[e+36>>2]=t,m[e+40>>2]=yn(t),O=i+16|0},emscripten_bind_btKinematicCharacterController_getMaxSlope_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,O=t+16|0,y(m[d[t+12>>2]+36>>2])},emscripten_bind_btKinematicCharacterController_getGhostObject_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,O=t+16|0,d[d[t+12>>2]+8>>2]},emscripten_bind_btKinematicCharacterController_setUseGhostSweepTest_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,t=1&s[i+11|0],d[12+(e=O-16|0)>>2]=d[i+12>>2],s[e+11|0]=t,s[d[e+12>>2]+170|0]=1&s[e+11|0],O=i+16|0},emscripten_bind_btKinematicCharacterController_onGround_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],e=1&r[d[d[e>>2]+48>>2]](e),O=t+16|0,0|e},emscripten_bind_btKinematicCharacterController_setUpInterpolate_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,e=d[i+12>>2],r[d[d[e>>2]+52>>2]](e,1&s[i+11|0]),O=i+16|0},emscripten_bind_btKinematicCharacterController_updateAction_2:Da,emscripten_bind_btKinematicCharacterController___destroy___0:Nc,emscripten_bind_btSoftBodyArray_size_0:tc,emscripten_bind_btSoftBodyArray_at_1:Fo,emscripten_bind_btSoftBodyArray___destroy___0:Th,emscripten_bind_btFaceArray_size_0:tc,emscripten_bind_btFaceArray_at_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,O=i+16|0,d[d[e+12>>2]+12>>2]+b(d[e+8>>2],36)|0},emscripten_bind_btFaceArray___destroy___0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&(function(e){var t;O=t=O-16|0,d[t+12>>2]=e,function(e){var t,i;O=t=O-16|0,d[t+12>>2]=e,i=O-16|0,e=d[t+12>>2],d[i+12>>2]=e,ho(e,d[d[i+12>>2]+4>>2]),_l(e),Fc(e),O=t+16|0}(d[t+12>>2]),O=t+16|0}(e),ve(e)),O=t+16|0},emscripten_bind_btStaticPlaneShape_btStaticPlaneShape_2:function(e,t){var i;return e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,function(e,t,i){var n=y(0),r=y(0),s=y(0);d[e+4>>2]=35,d[e+8>>2]=0,d[e+12>>2]=0,d[e>>2]=14720,d[e>>2]=12652,n=m[t+8>>2],r=m[t>>2],s=m[t+4>>2],t=d[t+12>>2],d[e+68>>2]=0,d[e+72>>2]=0,m[e+64>>2]=i,d[e+60>>2]=t,d[e+76>>2]=0,d[e+80>>2]=0,d[e+4>>2]=28,i=y(y(1)/y(x(y(y(y(r*r)+y(s*s))+y(n*n))))),m[e+56>>2]=n*i,m[e+52>>2]=s*i,m[e+48>>2]=r*i}(e=nc(84),d[i+12>>2],m[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btStaticPlaneShape_setLocalScaling_1:gl,emscripten_bind_btStaticPlaneShape_getLocalScaling_0:hc,emscripten_bind_btStaticPlaneShape_calculateLocalInertia_2:Ma,emscripten_bind_btStaticPlaneShape___destroy___0:Nc,emscripten_bind_btOverlappingPairCache_setInternalGhostPairCallback_1:xl,emscripten_bind_btOverlappingPairCache_getNumOverlappingPairs_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],e=0|r[d[d[e>>2]+36>>2]](e),O=t+16|0,y(y(0|e))},emscripten_bind_btOverlappingPairCache___destroy___0:Nc,emscripten_bind_btIndexedMesh_get_m_numTriangles_0:v_,emscripten_bind_btIndexedMesh_set_m_numTriangles_1:yh,emscripten_bind_btIndexedMesh___destroy___0:Fh,emscripten_bind_btSoftRigidDynamicsWorld_btSoftRigidDynamicsWorld_5:function(e,t,i,n,o){var a;return e|=0,t|=0,i|=0,n|=0,o|=0,O=a=O-32|0,d[a+28>>2]=e,d[a+24>>2]=t,d[a+20>>2]=i,d[a+16>>2]=n,d[a+12>>2]=o,function(e,t,i,n,o){var a;if(Xt(e,t,i,n),s[e+340|0]=1,d[e>>2]=22608,n=0,d[e+336>>2]=0,d[e+368>>2]=0,d[e+372>>2]=0,d[e+360>>2]=0,d[e+364>>2]=1148846080,d[e+352>>2]=1067030938,d[e+356>>2]=0,d[e+328>>2]=0,d[e+332>>2]=0,d[e+376>>2]=0,d[e+380>>2]=0,d[e+384>>2]=0,d[e+388>>2]=0,d[e+392>>2]=0,s[e+424|0]=1,d[e+404>>2]=0,d[e+396>>2]=-1054867456,d[e+400>>2]=0,d[e+420>>2]=0,s[e+456|0]=0,d[e+452>>2]=o,d[e+412>>2]=0,d[e+416>>2]=0,o||(d[7717]=d[7717]+1,il(o=0|r[d[6606]](40,16)),s[e+456|0]=1,d[e+452>>2]=o),s[e+350|0]=0,_[e+348>>1]=1,d[e+344>>2]=4302,d[e+388>>2]=t,d[e+384>>2]=i,wn(i=e+408|0),(0|(a=d[e+412>>2]))>=1)for(;;){if(t=d[e+420>>2]+(n<<2)|0,o=d[t>>2],d[t>>2]=0,o)for(;t=d[o+280>>2],ve(o),o=t;);if((0|a)==(0|(n=n+1|0)))break}d[e+360>>2]=0,d[e+352>>2]=1067030938,d[e+356>>2]=0,d[e+444>>2]=1,d[e+448>>2]=1,d[e+436>>2]=0,d[e+428>>2]=1048576e3,d[e+432>>2]=0,d[e+392>>2]=0,d[e+376>>2]=0,d[e+380>>2]=0,d[e+368>>2]=0,d[e+372>>2]=0,d[e+404>>2]=0,d[e+396>>2]=-1054867456,d[e+400>>2]=0,wn(i)}(e=nc(460),d[a+28>>2],d[a+24>>2],d[a+20>>2],d[a+12>>2]),O=a+32|0,0|e},emscripten_bind_btSoftRigidDynamicsWorld_addSoftBody_3:function(e,t,i,n){var o;e|=0,t|=0,i|=0,n|=0,O=o=O-16|0,d[o+12>>2]=e,d[o+8>>2]=t,_[o+6>>1]=i,_[o+4>>1]=n,function(e,t,i,n){var o=0,a=0,l=0,c=0,h=0;if((0|(o=d[e+328>>2]))==d[e+332>>2]&&!((0|o)>=(0|(l=o?o<<1:1)))){if(l&&(d[7717]=d[7717]+1,c=0|r[d[6606]](l<<2,16),o=d[e+328>>2]),(0|o)>=1)for(;d[(h=a<<2)+c>>2]=d[d[e+336>>2]+h>>2],(0|(a=a+1|0))!=(0|o););(a=d[e+336>>2])&&(u[e+340|0]&&(a&&(d[7718]=d[7718]+1,r[d[6607]](a)),o=d[e+328>>2]),d[e+336>>2]=0),d[e+336>>2]=c,d[e+332>>2]=l,s[e+340|0]=1}d[d[e+336>>2]+(o<<2)>>2]=t,d[e+328>>2]=o+1,d[t+284>>2]=d[e+452>>2],Li(e,t,i,n)}(d[o+12>>2],d[o+8>>2],_[o+6>>1],_[o+4>>1]),O=o+16|0},emscripten_bind_btSoftRigidDynamicsWorld_removeSoftBody_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i=0,n=0,r=0,s=0;e:if(!((0|(i=d[e+328>>2]))<1)){for(r=d[e+336>>2];;){if(d[(s=(n<<2)+r|0)>>2]!=(0|t)){if((0|i)!=(0|(n=n+1|0)))continue;break e}break}(0|n)>=(0|i)||(n=(i=i+-1|0)<<2,d[s>>2]=d[n+r>>2],d[n+d[e+336>>2]>>2]=t,d[e+328>>2]=i)}Nr(e,t)}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btSoftRigidDynamicsWorld_removeCollisionObject_1:bl,emscripten_bind_btSoftRigidDynamicsWorld_getWorldInfo_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+352|0},emscripten_bind_btSoftRigidDynamicsWorld_getSoftBodyArray_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+324|0},emscripten_bind_btSoftRigidDynamicsWorld_getDispatcher_0:Yl,emscripten_bind_btSoftRigidDynamicsWorld_rayTest_3:Xo,emscripten_bind_btSoftRigidDynamicsWorld_getPairCache_0:Ph,emscripten_bind_btSoftRigidDynamicsWorld_getDispatchInfo_0:sc,emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_1:sl,emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_2:xa,emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_3:To,emscripten_bind_btSoftRigidDynamicsWorld_getBroadphase_0:Kl,emscripten_bind_btSoftRigidDynamicsWorld_convexSweepTest_5:Xs,emscripten_bind_btSoftRigidDynamicsWorld_contactPairTest_3:Aa,emscripten_bind_btSoftRigidDynamicsWorld_contactTest_2:Ja,emscripten_bind_btSoftRigidDynamicsWorld_updateSingleAabb_1:Mc,emscripten_bind_btSoftRigidDynamicsWorld_setDebugDrawer_1:Sl,emscripten_bind_btSoftRigidDynamicsWorld_getDebugDrawer_0:uc,emscripten_bind_btSoftRigidDynamicsWorld_debugDrawWorld_0:gh,emscripten_bind_btSoftRigidDynamicsWorld_debugDrawObject_3:zo,emscripten_bind_btSoftRigidDynamicsWorld_setGravity_1:yl,emscripten_bind_btSoftRigidDynamicsWorld_getGravity_0:function(e){var t;return e|=0,O=t=O-32|0,d[t+28>>2]=e,1&s[26664]||mc(26664)&&(d[12+(O-16|0)>>2]=26648,uh(26664)),e=d[t+28>>2],r[d[d[e>>2]+76>>2]](t+8|0,e),e=d[t+12>>2],d[6662]=d[t+8>>2],d[6663]=e,e=d[t+20>>2],d[6664]=d[t+16>>2],d[6665]=e,O=t+32|0,26648},emscripten_bind_btSoftRigidDynamicsWorld_addRigidBody_1:Al,emscripten_bind_btSoftRigidDynamicsWorld_addRigidBody_3:Eo,emscripten_bind_btSoftRigidDynamicsWorld_removeRigidBody_1:Cl,emscripten_bind_btSoftRigidDynamicsWorld_addConstraint_1:hl,emscripten_bind_btSoftRigidDynamicsWorld_addConstraint_2:Oa,emscripten_bind_btSoftRigidDynamicsWorld_removeConstraint_1:xl,emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_1:da,emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_2:vo,emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_3:bo,emscripten_bind_btSoftRigidDynamicsWorld_setContactAddedCallback_1:ka,emscripten_bind_btSoftRigidDynamicsWorld_setContactProcessedCallback_1:Va,emscripten_bind_btSoftRigidDynamicsWorld_setContactDestroyedCallback_1:Ba,emscripten_bind_btSoftRigidDynamicsWorld_addAction_1:vl,emscripten_bind_btSoftRigidDynamicsWorld_removeAction_1:Rl,emscripten_bind_btSoftRigidDynamicsWorld_getSolverInfo_0:oc,emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_1:fc,emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_2:Ka,emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_3:ma,emscripten_bind_btSoftRigidDynamicsWorld___destroy___0:Nc,emscripten_bind_btFixedConstraint_btFixedConstraint_4:function(e,t,i,n){var r;return e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,function(e,t,i,n,r){var s,o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0);O=s=O-32|0,Ao(e,11,t,i),d[e>>2]=18812,t=d[n+52>>2],d[e+48>>2]=d[n+48>>2],d[e+52>>2]=t,t=d[n+60>>2],d[e+56>>2]=d[n+56>>2],d[e+60>>2]=t,t=d[r+52>>2],d[e+64>>2]=d[r+48>>2],d[e+68>>2]=t,t=d[r+60>>2],d[e+72>>2]=d[r+56>>2],d[e+76>>2]=t,st(n,s+16|0),st(r,s),o=m[s+12>>2],a=m[s+28>>2],l=m[s>>2],c=m[s+16>>2],h=m[s+4>>2],_=m[s+20>>2],u=m[s+8>>2],p=m[s+24>>2],m[e+92>>2]=y(y(y(o*a)+y(l*c))+y(h*_))+y(u*p),m[e+88>>2]=y(l*_)+y(y(y(o*p)-y(u*a))-y(h*c)),m[e+84>>2]=y(u*c)+y(y(y(o*_)-y(h*a))-y(l*p)),m[e+80>>2]=y(y(y(o*c)-y(l*a))-y(u*_))+y(h*p),O=s+32|0}(e=nc(96),d[r+12>>2],d[r+8>>2],d[r+4>>2],d[r>>2]),O=r+16|0,0|e},emscripten_bind_btFixedConstraint_enableFeedback_1:sa,emscripten_bind_btFixedConstraint_getBreakingImpulseThreshold_0:kl,emscripten_bind_btFixedConstraint_setBreakingImpulseThreshold_1:_a,emscripten_bind_btFixedConstraint_getParam_2:Ko,emscripten_bind_btFixedConstraint_setParam_3:Lo,emscripten_bind_btFixedConstraint___destroy___0:Nc,emscripten_bind_btTransform_btTransform_0:function(){var e;return ph(e=ic(64)),0|e},emscripten_bind_btTransform_btTransform_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t,i){var n;O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,function(e,t){var i,n;for(O=i=O-16|0,d[i+8>>2]=e,d[i+4>>2]=t,e=d[i+8>>2],d[i+12>>2]=e,n=e+48|0,t=e;d[12+(O-16|0)>>2]=t,(0|n)!=(0|(t=t+16|0)););qt(e,d[i+4>>2]),O=i+16|0}(e=d[n+12>>2],d[n+8>>2]),t=d[n+4>>2],i=d[t+4>>2],d[e+48>>2]=d[t>>2],d[e+52>>2]=i,i=d[t+12>>2],d[e+56>>2]=d[t+8>>2],d[e+60>>2]=i,O=n+16|0}(e=ic(64),d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btTransform_setIdentity_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,al(d[t+12>>2]),O=t+16|0},emscripten_bind_btTransform_setOrigin_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Go(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btTransform_setRotation_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,qt(d[i+12>>2],d[i+8>>2]),O=i+16|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btTransform_getOrigin_0:ac,emscripten_bind_btTransform_getRotation_0:function(e){e|=0;var t,i=0;return O=t=O-32|0,d[t+28>>2]=e,1&s[26684]||mc(26684)&&(wc(26668),uh(26684)),function(e,t){var i;O=i=O-16|0,d[i+12>>2]=t,t=d[i+12>>2],wc(e),st(t,e),O=i+16|0}(e=t+8|0,d[t+28>>2]),i=d[e+4>>2],d[6667]=d[e>>2],d[6668]=i,i=d[e+12>>2],d[6669]=d[e+8>>2],d[6670]=i,O=t+32|0,26668},emscripten_bind_btTransform_getBasis_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]},emscripten_bind_btTransform_setFromOpenGLMatrix_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Zo(e=d[i+12>>2],d[i+8>>2],d[i+8>>2]+16|0,d[i+8>>2]+32|0),Zo(e+16|0,d[i+8>>2]+4|0,d[i+8>>2]+20|0,d[i+8>>2]+36|0),Zo(e+32|0,d[i+8>>2]+8|0,d[i+8>>2]+24|0,d[i+8>>2]+40|0),O=i+16|0}(e=d[i+12>>2],d[i+8>>2]),Zo(e+48|0,d[i+8>>2]+48|0,d[i+8>>2]+52|0,d[i+8>>2]+56|0),O=i+16|0}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btTransform_inverse_0:function(e){var t;return e|=0,O=t=O-80|0,d[t+76>>2]=e,1&s[26752]||mc(26752)&&(ph(26688),uh(26752)),Ia(e=t+8|0,d[t+76>>2]),ao(26688,e),O=t+80|0,26688},emscripten_bind_btTransform_op_mul_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=function(e,t){var i;return O=i=O-32|0,d[i+28>>2]=e,d[i+24>>2]=t,Zr(t=i+8|0,e=d[i+28>>2],d[i+24>>2]+48|0),Ro(e+48|0,t),function(e,t){var i;O=i=O-48|0,d[i+44>>2]=e,d[i+40>>2]=t,e=d[i+44>>2],m[i+36>>2]=Xr(d[i+40>>2],e),m[i+32>>2]=Ur(d[i+40>>2],e),m[i+28>>2]=Gr(d[i+40>>2],e),m[i+24>>2]=Xr(d[i+40>>2],e+16|0),m[i+20>>2]=Ur(d[i+40>>2],e+16|0),m[i+16>>2]=Gr(d[i+40>>2],e+16|0),m[i+12>>2]=Xr(d[i+40>>2],e+32|0),m[i+8>>2]=Ur(d[i+40>>2],e+32|0),m[i+4>>2]=Gr(d[i+40>>2],e+32|0),vs(e,i+36|0,i+32|0,i+28|0,i+24|0,i+20|0,i+16|0,i+12|0,i+8|0,i+4|0),O=i+48|0}(e,d[i+24>>2]),O=i+32|0,e}(d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btTransform___destroy___0:Dh,emscripten_bind_ClosestRayResultCallback_ClosestRayResultCallback_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t,i){var n;O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,nl(e=d[n+12>>2]),d[e>>2]=1740,t=d[n+8>>2],i=d[t+4>>2],d[e+20>>2]=d[t>>2],d[e+24>>2]=i,i=d[t+12>>2],d[e+28>>2]=d[t+8>>2],d[e+32>>2]=i,t=d[n+4>>2],i=d[t+4>>2],d[e+36>>2]=d[t>>2],d[e+40>>2]=i,i=d[t+12>>2],d[e+44>>2]=d[t+8>>2],d[e+48>>2]=i,d[12+(O-16|0)>>2]=e+52,d[12+(O-16|0)>>2]=e+68,O=n+16|0}(e=ic(84),d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_ClosestRayResultCallback_hasHit_0:Fl,emscripten_bind_ClosestRayResultCallback_get_m_rayFromWorld_0:E_,emscripten_bind_ClosestRayResultCallback_set_m_rayFromWorld_1:No,emscripten_bind_ClosestRayResultCallback_get_m_rayToWorld_0:F_,emscripten_bind_ClosestRayResultCallback_set_m_rayToWorld_1:Wo,emscripten_bind_ClosestRayResultCallback_get_m_hitNormalWorld_0:A_,emscripten_bind_ClosestRayResultCallback_set_m_hitNormalWorld_1:Do,emscripten_bind_ClosestRayResultCallback_get_m_hitPointWorld_0:C_,emscripten_bind_ClosestRayResultCallback_set_m_hitPointWorld_1:Oo,emscripten_bind_ClosestRayResultCallback_get_m_collisionFilterGroup_0:h_,emscripten_bind_ClosestRayResultCallback_set_m_collisionFilterGroup_1:Lc,emscripten_bind_ClosestRayResultCallback_get_m_collisionFilterMask_0:__,emscripten_bind_ClosestRayResultCallback_set_m_collisionFilterMask_1:kc,emscripten_bind_ClosestRayResultCallback_get_m_closestHitFraction_0:s_,emscripten_bind_ClosestRayResultCallback_set_m_closestHitFraction_1:ah,emscripten_bind_ClosestRayResultCallback_get_m_collisionObject_0:g_,emscripten_bind_ClosestRayResultCallback_set_m_collisionObject_1:_h,emscripten_bind_ClosestRayResultCallback___destroy___0:Nc,emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration_btSoftBodyRigidBodyCollisionConfiguration_0:function(){var e,t,i;return O=e=O-32|0,t=ic(112),rl(i=e+8|0),$i(t,i),O=e+32|0,0|t},emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration_btSoftBodyRigidBodyCollisionConfiguration_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,$i(e=ic(112),d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration___destroy___0:Nc,emscripten_bind_ConcreteContactResultCallback_ConcreteContactResultCallback_0:function(){var e;return e=ic(8),d[e>>2]=0,d[e+4>>2]=0,function(e){var t,i;O=t=O-16|0,d[t+12>>2]=e,e=O-16|0,i=d[t+12>>2],d[e+12>>2]=i,e=d[e+12>>2],d[e>>2]=1944,_[e+4>>1]=1,_[e+6>>1]=65535,d[i>>2]=1824,O=t+16|0}(e),0|e},emscripten_bind_ConcreteContactResultCallback_addSingleResult_7:ds,emscripten_bind_ConcreteContactResultCallback___destroy___0:Nc,emscripten_bind_btBvhTriangleMeshShape_btBvhTriangleMeshShape_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,s[i+11|0]=t,$s(e=nc(76),d[i+12>>2],1&s[i+11|0],1),O=i+16|0,0|e},emscripten_bind_btBvhTriangleMeshShape_btBvhTriangleMeshShape_3:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,s[n+11|0]=t,s[n+10|0]=i,$s(e=nc(76),d[n+12>>2],1&s[n+11|0],1&s[n+10|0]),O=n+16|0,0|e},emscripten_bind_btBvhTriangleMeshShape_setLocalScaling_1:gl,emscripten_bind_btBvhTriangleMeshShape_getLocalScaling_0:hc,emscripten_bind_btBvhTriangleMeshShape_calculateLocalInertia_2:Ma,emscripten_bind_btBvhTriangleMeshShape___destroy___0:Nc,emscripten_bind_btConstCollisionObjectArray_size_0:tc,emscripten_bind_btConstCollisionObjectArray_at_1:Fo,emscripten_bind_btConstCollisionObjectArray___destroy___0:Th,emscripten_bind_btSliderConstraint_btSliderConstraint_3:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,function(e,t,i,n){var r,o,a=0,l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0),S=y(0),x=y(0),T=y(0),E=y(0),R=y(0),P=y(0),I=y(0),M=y(0),D=y(0),O=y(0),w=y(0),F=y(0);Ao(e,7,Hs(),t),s[e+48|0]=0,d[e>>2]=19436,a=d[i+12>>2],d[e+124>>2]=d[i+8>>2],d[e+128>>2]=a,a=d[i+4>>2],d[e+116>>2]=d[i>>2],d[e+120>>2]=a,a=d[i+28>>2],d[e+140>>2]=d[i+24>>2],d[e+144>>2]=a,a=d[i+20>>2],d[e+132>>2]=d[i+16>>2],d[e+136>>2]=a,a=d[i+36>>2],d[e+148>>2]=d[i+32>>2],d[e+152>>2]=a,a=d[i+44>>2],d[e+156>>2]=d[i+40>>2],d[e+160>>2]=a,a=d[i+56>>2],r=d[i+60>>2],o=d[i+52>>2],i=d[i+48>>2],s[e+180|0]=n,d[e+164>>2]=i,d[e+168>>2]=o,d[e+172>>2]=a,d[e+176>>2]=r,O=m[t+52>>2],w=m[t+56>>2],F=m[t+60>>2],v=m[e+172>>2],A=m[e+164>>2],C=m[e+168>>2],l=m[t+8>>2],c=m[t+12>>2],h=m[t+28>>2],_=m[t+20>>2],u=m[t+24>>2],S=m[e+132>>2],x=m[e+148>>2],T=m[e+152>>2],E=m[e+120>>2],R=m[e+136>>2],p=m[t+44>>2],P=m[e+156>>2],f=m[t+36>>2],I=m[e+124>>2],g=m[t+40>>2],M=m[e+140>>2],b=m[t+4>>2],D=m[e+116>>2],d[e+288>>2]=1065353216,d[e+292>>2]=0,d[e+280>>2]=1065353216,d[e+284>>2]=1060320051,d[e+272>>2]=1065353216,d[e+276>>2]=0,d[e+264>>2]=1065353216,d[e+268>>2]=1060320051,d[e+224>>2]=0,d[e+228>>2]=0,d[e+216>>2]=1065353216,d[e+220>>2]=1060320051,d[e+208>>2]=0,d[e+212>>2]=0,d[e+200>>2]=1065353216,d[e+204>>2]=1060320051,d[e+192>>2]=0,d[e+196>>2]=0,d[e+184>>2]=1065353216,d[e+188>>2]=-1082130432,d[e+112>>2]=0,d[e+96>>2]=0,d[e+80>>2]=0,d[e- -64>>2]=0,m[e+92>>2]=y(y(I*f)+y(M*g))+y(P*p),m[e+88>>2]=y(y(E*f)+y(R*g))+y(T*p),m[e+84>>2]=y(y(D*f)+y(S*g))+y(x*p),m[e+76>>2]=y(y(I*_)+y(M*u))+y(P*h),m[e+72>>2]=y(y(E*_)+y(R*u))+y(T*h),m[e+68>>2]=y(y(D*_)+y(S*u))+y(x*h),m[e+60>>2]=y(y(b*I)+y(l*M))+y(c*P),m[e+56>>2]=y(y(b*E)+y(l*R))+y(c*T),m[e+52>>2]=y(y(D*b)+y(S*l))+y(x*c),m[e+108>>2]=F+y(y(y(f*A)+y(g*C))+y(p*v)),m[e+104>>2]=w+y(y(y(_*A)+y(u*C))+y(h*v)),m[e+100>>2]=O+y(y(y(b*A)+y(l*C))+y(c*v)),d[e+1124>>2]=0,d[e+1116>>2]=0,d[e+1120>>2]=0,s[e+1096|0]=0,d[e+256>>2]=1065353216,d[e+260>>2]=0,d[e+248>>2]=1065353216,d[e+252>>2]=1060320051,d[e+240>>2]=1065353216,d[e+244>>2]=0,d[e+232>>2]=1065353216,d[e+236>>2]=1060320051,d[e+1100>>2]=0,d[e+1104>>2]=0,d[e+300>>2]=0,s[0|(t=e+1105|0)]=0,s[t+1|0]=0,s[t+2|0]=0,s[t+3|0]=0,s[t+4|0]=0,s[t+5|0]=0,s[t+6|0]=0,s[t+7|0]=0,s[e+49|0]=1,te(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0)}(e=nc(1128),d[n+12>>2],d[n+8>>2],1&s[n+7|0]),O=n+16|0,0|e},emscripten_bind_btSliderConstraint_btSliderConstraint_5:function(e,t,i,n,r){var o;return e|=0,t|=0,i|=0,n|=0,r|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,s[o+15|0]=r,function(e,t,i,n,r,o){Ao(e,7,t,i),s[e+48|0]=0,d[e>>2]=19436,t=d[n+12>>2],d[e+60>>2]=d[n+8>>2],d[e+64>>2]=t,t=d[n+4>>2],d[e+52>>2]=d[n>>2],d[e+56>>2]=t,t=d[n+28>>2],d[e+76>>2]=d[n+24>>2],d[e+80>>2]=t,t=d[n+20>>2],d[e+68>>2]=d[n+16>>2],d[e+72>>2]=t,t=d[n+44>>2],d[e+92>>2]=d[n+40>>2],d[e+96>>2]=t,t=d[n+36>>2],d[e+84>>2]=d[n+32>>2],d[e+88>>2]=t,t=d[n+60>>2],d[e+108>>2]=d[n+56>>2],d[e+112>>2]=t,t=d[n+52>>2],d[e+100>>2]=d[n+48>>2],d[e+104>>2]=t,t=d[r+12>>2],d[e+124>>2]=d[r+8>>2],d[e+128>>2]=t,t=d[r+4>>2],d[e+116>>2]=d[r>>2],d[e+120>>2]=t,t=d[r+28>>2],d[e+140>>2]=d[r+24>>2],d[e+144>>2]=t,t=d[r+20>>2],d[e+132>>2]=d[r+16>>2],d[e+136>>2]=t,t=d[r+44>>2],d[e+156>>2]=d[r+40>>2],d[e+160>>2]=t,t=d[r+36>>2],d[e+148>>2]=d[r+32>>2],d[e+152>>2]=t,t=d[r+60>>2],d[e+172>>2]=d[r+56>>2],d[e+176>>2]=t,t=d[r+52>>2],d[e+164>>2]=d[r+48>>2],d[e+168>>2]=t,d[e+288>>2]=1065353216,d[e+292>>2]=0,d[e+280>>2]=1065353216,d[e+284>>2]=1060320051,d[e+272>>2]=1065353216,d[e+276>>2]=0,d[e+264>>2]=1065353216,d[e+268>>2]=1060320051,d[e+224>>2]=0,d[e+228>>2]=0,d[e+216>>2]=1065353216,d[e+220>>2]=1060320051,d[e+208>>2]=0,d[e+212>>2]=0,d[e+200>>2]=1065353216,d[e+204>>2]=1060320051,d[e+192>>2]=0,d[e+196>>2]=0,d[e+184>>2]=1065353216,d[e+188>>2]=-1082130432,s[e+180|0]=o,d[e+1124>>2]=0,d[e+1116>>2]=0,d[e+1120>>2]=0,s[e+1096|0]=0,d[e+256>>2]=1065353216,d[e+260>>2]=0,d[e+248>>2]=1065353216,d[e+252>>2]=1060320051,d[e+240>>2]=1065353216,d[e+244>>2]=0,d[e+232>>2]=1065353216,d[e+236>>2]=1060320051,d[e+300>>2]=0,s[0|(t=e+1105|0)]=0,s[t+1|0]=0,s[t+2|0]=0,s[t+3|0]=0,s[t+4|0]=0,s[t+5|0]=0,s[t+6|0]=0,s[t+7|0]=0,d[e+1100>>2]=0,d[e+1104>>2]=0,s[e+49|0]=1,te(e,d[e+28>>2]+4|0,d[e+32>>2]+4|0)}(e=nc(1128),d[o+28>>2],d[o+24>>2],d[o+20>>2],d[o+16>>2],1&s[o+15|0]),O=o+32|0,0|e},emscripten_bind_btSliderConstraint_setLowerLinLimit_1:la,emscripten_bind_btSliderConstraint_setUpperLinLimit_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],m[e+8>>2]=t,m[d[e+12>>2]+188>>2]=m[e+8>>2],O=i+16|0},emscripten_bind_btSliderConstraint_setLowerAngLimit_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+192>>2]=Cs(m[i+8>>2]),O=i+16|0}(d[i+12>>2],m[i+8>>2]),O=i+16|0},emscripten_bind_btSliderConstraint_setUpperAngLimit_1:function(e,t){var i;e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,function(e,t){var i;O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,m[d[i+12>>2]+196>>2]=Cs(m[i+8>>2]),O=i+16|0}(d[i+12>>2],m[i+8>>2]),O=i+16|0},emscripten_bind_btSliderConstraint_enableFeedback_1:sa,emscripten_bind_btSliderConstraint_getBreakingImpulseThreshold_0:kl,emscripten_bind_btSliderConstraint_setBreakingImpulseThreshold_1:_a,emscripten_bind_btSliderConstraint_getParam_2:Ko,emscripten_bind_btSliderConstraint_setParam_3:Lo,emscripten_bind_btSliderConstraint___destroy___0:Nc,emscripten_bind_btPairCachingGhostObject_btPairCachingGhostObject_0:function(){var e;return function(e){var t;kn(e),d[e+276>>2]=0,s[e+280|0]=1,d[e+268>>2]=0,d[e+272>>2]=0,d[e+236>>2]=4,d[e>>2]=4084,d[7717]=d[7717]+1,Zn(t=0|r[d[6606]](76,16)),d[e+284>>2]=t}(e=nc(288)),0|e},emscripten_bind_btPairCachingGhostObject_setAnisotropicFriction_2:tl,emscripten_bind_btPairCachingGhostObject_getCollisionShape_0:Xl,emscripten_bind_btPairCachingGhostObject_setContactProcessingThreshold_1:la,emscripten_bind_btPairCachingGhostObject_setActivationState_1:Xa,emscripten_bind_btPairCachingGhostObject_forceActivationState_1:pc,emscripten_bind_btPairCachingGhostObject_activate_0:n_,emscripten_bind_btPairCachingGhostObject_activate_1:yc,emscripten_bind_btPairCachingGhostObject_isActive_0:Rh,emscripten_bind_btPairCachingGhostObject_isKinematicObject_0:dl,emscripten_bind_btPairCachingGhostObject_isStaticObject_0:ul,emscripten_bind_btPairCachingGhostObject_isStaticOrKinematicObject_0:pl,emscripten_bind_btPairCachingGhostObject_getRestitution_0:Bl,emscripten_bind_btPairCachingGhostObject_getFriction_0:Nl,emscripten_bind_btPairCachingGhostObject_getRollingFriction_0:Ll,emscripten_bind_btPairCachingGhostObject_setRestitution_1:Ac,emscripten_bind_btPairCachingGhostObject_setFriction_1:Cc,emscripten_bind_btPairCachingGhostObject_setRollingFriction_1:Sc,emscripten_bind_btPairCachingGhostObject_getWorldTransform_0:lc,emscripten_bind_btPairCachingGhostObject_getCollisionFlags_0:Wl,emscripten_bind_btPairCachingGhostObject_setCollisionFlags_1:ha,emscripten_bind_btPairCachingGhostObject_setWorldTransform_1:Ec,emscripten_bind_btPairCachingGhostObject_setCollisionShape_1:ml,emscripten_bind_btPairCachingGhostObject_setCcdMotionThreshold_1:oa,emscripten_bind_btPairCachingGhostObject_setCcdSweptSphereRadius_1:aa,emscripten_bind_btPairCachingGhostObject_getUserIndex_0:Hl,emscripten_bind_btPairCachingGhostObject_setUserIndex_1:ua,emscripten_bind_btPairCachingGhostObject_getUserPointer_0:Hl,emscripten_bind_btPairCachingGhostObject_setUserPointer_1:ua,emscripten_bind_btPairCachingGhostObject_getBroadphaseHandle_0:zl,emscripten_bind_btPairCachingGhostObject_getNumOverlappingObjects_0:Ih,emscripten_bind_btPairCachingGhostObject_getOverlappingObject_1:Zl,emscripten_bind_btPairCachingGhostObject___destroy___0:Bc,emscripten_bind_btManifoldPoint_getPositionWorldOnA_0:ac,emscripten_bind_btManifoldPoint_getPositionWorldOnB_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+32|0},emscripten_bind_btManifoldPoint_getAppliedImpulse_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,+m[d[e+12>>2]+120>>2]},emscripten_bind_btManifoldPoint_getDistance_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,+m[d[e+12>>2]+80>>2]},emscripten_bind_btManifoldPoint_get_m_localPointA_0:V_,emscripten_bind_btManifoldPoint_set_m_localPointA_1:$o,emscripten_bind_btManifoldPoint_get_m_localPointB_0:D_,emscripten_bind_btManifoldPoint_set_m_localPointB_1:jo,emscripten_bind_btManifoldPoint_get_m_positionWorldOnB_0:x_,emscripten_bind_btManifoldPoint_set_m_positionWorldOnB_1:Bo,emscripten_bind_btManifoldPoint_get_m_positionWorldOnA_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+48|0},emscripten_bind_btManifoldPoint_set_m_positionWorldOnA_1:Go,emscripten_bind_btManifoldPoint_get_m_normalWorldOnB_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]- -64|0},emscripten_bind_btManifoldPoint_set_m_normalWorldOnB_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+64>>2]=d[e>>2],d[t+68>>2]=i,i=d[e+12>>2],d[t+72>>2]=d[e+8>>2],d[t+76>>2]=i},emscripten_bind_btManifoldPoint_get_m_userPersistentData_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[d[t+12>>2]+112>>2]},emscripten_bind_btManifoldPoint_set_m_userPersistentData_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[d[i+12>>2]+112>>2]=d[i+8>>2]},emscripten_bind_btManifoldPoint___destroy___0:Dh,emscripten_bind_btPoint2PointConstraint_btPoint2PointConstraint_2:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t,i){var n=0,r=y(0),o=y(0),a=y(0),l=y(0),c=y(0),h=y(0),_=y(0),u=y(0),p=y(0),f=y(0),g=y(0),b=y(0),v=y(0),A=y(0),C=y(0);go(e,3,t),d[e>>2]=19160,n=d[i+4>>2],d[e+300>>2]=d[i>>2],d[e+304>>2]=n,n=d[i+12>>2],d[e+308>>2]=d[i+8>>2],d[e+312>>2]=n,l=m[t+52>>2],c=m[t+8>>2],h=m[t+12>>2],_=m[t+56>>2],u=m[t+20>>2],p=m[t+24>>2],f=m[t+28>>2],g=m[t+60>>2],b=m[t+36>>2],v=m[t+40>>2],r=m[i+8>>2],A=m[t+44>>2],C=m[t+4>>2],o=m[i>>2],a=m[i+4>>2],d[e+356>>2]=0,d[e+348>>2]=1050253722,d[e+352>>2]=1065353216,s[e+344|0]=0,d[e+328>>2]=0,d[e+332>>2]=0,m[e+324>>2]=g+y(y(y(o*b)+y(a*v))+y(r*A)),m[e+320>>2]=_+y(y(y(o*u)+y(a*p))+y(r*f)),m[e+316>>2]=l+y(y(y(o*C)+y(a*c))+y(r*h))}(e=nc(360),d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btPoint2PointConstraint_btPoint2PointConstraint_4:function(e,t,i,n){var r;return e|=0,t|=0,i|=0,n|=0,O=r=O-16|0,d[r+12>>2]=e,d[r+8>>2]=t,d[r+4>>2]=i,d[r>>2]=n,function(e,t,i,n,r){Ao(e,3,t,i),d[e>>2]=19160,t=d[n+4>>2],d[e+300>>2]=d[n>>2],d[e+304>>2]=t,t=d[n+12>>2],d[e+308>>2]=d[n+8>>2],d[e+312>>2]=t,t=d[r+4>>2],d[e+316>>2]=d[r>>2],d[e+320>>2]=t,t=d[r+12>>2],d[e+324>>2]=d[r+8>>2],d[e+328>>2]=t,d[e+356>>2]=0,d[e+348>>2]=1050253722,d[e+352>>2]=1065353216,s[e+344|0]=0,d[e+332>>2]=0}(e=nc(360),d[r+12>>2],d[r+8>>2],d[r+4>>2],d[r>>2]),O=r+16|0,0|e},emscripten_bind_btPoint2PointConstraint_setPivotA_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+300>>2]=d[e>>2],d[t+304>>2]=i,i=d[e+12>>2],d[t+308>>2]=d[e+8>>2],d[t+312>>2]=i}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btPoint2PointConstraint_setPivotB_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,t=d[i+12>>2],e=d[i+8>>2],i=d[e+4>>2],d[t+316>>2]=d[e>>2],d[t+320>>2]=i,i=d[e+12>>2],d[t+324>>2]=d[e+8>>2],d[t+328>>2]=i}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btPoint2PointConstraint_getPivotInA_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+300|0},emscripten_bind_btPoint2PointConstraint_getPivotInB_0:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,d[12+(e=O-16|0)>>2]=d[t+12>>2],O=t+16|0,d[e+12>>2]+316|0},emscripten_bind_btPoint2PointConstraint_enableFeedback_1:sa,emscripten_bind_btPoint2PointConstraint_getBreakingImpulseThreshold_0:kl,emscripten_bind_btPoint2PointConstraint_setBreakingImpulseThreshold_1:_a,emscripten_bind_btPoint2PointConstraint_getParam_2:Ko,emscripten_bind_btPoint2PointConstraint_setParam_3:Lo,emscripten_bind_btPoint2PointConstraint_get_m_setting_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,d[t+12>>2]+348|0},emscripten_bind_btPoint2PointConstraint_set_m_setting_1:function(e,t){e|=0,t|=0;var i=0;d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],t=d[i+8>>2],i=d[t+4>>2],d[e+348>>2]=d[t>>2],d[e+352>>2]=i,d[e+356>>2]=d[t+8>>2]},emscripten_bind_btPoint2PointConstraint___destroy___0:Nc,emscripten_bind_btSoftBodyHelpers_btSoftBodyHelpers_0:function(){return 0|ic(1)},emscripten_bind_btSoftBodyHelpers_CreateRope_5:function(e,t,i,n,o,a){var l;return e|=0,t|=0,i|=0,n|=0,o|=0,a|=0,O=l=O-32|0,d[l+28>>2]=e,d[l+24>>2]=t,d[l+20>>2]=i,d[l+16>>2]=n,d[l+12>>2]=o,d[l+8>>2]=a,e=function(e,t,i,n,o){var a,l,c,h=0,_=0,u=y(0),p=y(0),f=y(0),g=y(0),v=0,A=y(0),C=y(0),S=y(0),x=y(0);if(d[7717]=d[7717]+1,a=n+2|0,l=0|r[d[6606]]((268435455&a)!=(0|a)?-1:a<<4,16),c=ic((1073741823&a)!=(0|a)?-1:a<<2),(0|n)>=-1)for(v=(0|a)>1?a:1,A=y(n+1|0);C=m[i>>2],p=m[t>>2],S=m[i+4>>2],f=m[t+4>>2],x=m[i+8>>2],g=m[t+8>>2],d[12+(_=(h<<4)+l|0)>>2]=0,u=y(y(0|h)/A),m[_+8>>2]=g+y(u*y(x-g)),m[_+4>>2]=f+y(u*y(S-f)),m[_>>2]=p+y(u*y(C-p)),d[(h<<2)+c>>2]=1065353216,(0|v)!=(0|(h=h+1|0)););if(d[7717]=d[7717]+1,e=Ce(0|r[d[6606]](1252,16),e,a,l,c),1&o&&(m[d[e+720>>2]+88>>2]=0,s[e+924|0]=1),2&o&&(m[88+(d[e+720>>2]+b(n+1|0,104)|0)>>2]=0,s[e+924|0]=1),l&&l&&(d[7718]=d[7718]+1,r[d[6607]](l)),ve(c),(0|n)>=0)for(t=(0|a)>2?a:2,h=1;Lh(e,h+-1|0,h,0,0),(0|t)!=(0|(h=h+1|0)););return e}(d[l+24>>2],d[l+20>>2],d[l+16>>2],d[l+12>>2],d[l+8>>2]),O=l+32|0,0|e},emscripten_bind_btSoftBodyHelpers_CreatePatch_9:function(e,t,i,n,o,a,l,c,h,_){var u;return e|=0,t|=0,i|=0,n|=0,o|=0,a|=0,l|=0,c|=0,h|=0,_|=0,O=u=O-48|0,d[u+44>>2]=e,d[u+40>>2]=t,d[u+36>>2]=i,d[u+32>>2]=n,d[u+28>>2]=o,d[u+24>>2]=a,d[u+20>>2]=l,d[u+16>>2]=c,d[u+12>>2]=h,s[u+11|0]=_,e=function(e,t,i,n,o,a,l,c,h){var _=0,u=0,p=0,f=y(0),g=y(0),v=0,A=y(0),C=0,S=0,x=y(0),T=y(0),E=y(0),R=0,P=y(0),I=y(0),M=y(0),D=0;if(!((0|a)<2|(0|l)<2)){for(P=y(a+-1|0),I=y(l+-1|0),d[7717]=d[7717]+1,_=b(a,l),p=0|r[d[6606]]((0|_)!=(268435455&_)?-1:_<<4,16),v=ic((0|_)!=(1073741823&_)?-1:_<<2);;){for(x=m[t+8>>2],f=y(y(0|C)/I),x=y(x+y(f*y(m[n+8>>2]-x))),T=m[i+8>>2],T=y(y(T+y(f*y(m[o+8>>2]-T)))-x),A=m[i+4>>2],g=y(A+y(f*y(m[o+4>>2]-A))),A=m[t+4>>2],A=y(A+y(f*y(m[n+4>>2]-A))),M=y(g-A),g=m[i>>2],E=y(g+y(f*y(m[o>>2]-g))),g=m[t>>2],g=y(g+y(f*y(m[n>>2]-g))),E=y(E-g),D=b(a,C),u=0;d[12+(S=p+((R=u+D|0)<<4)|0)>>2]=0,f=y(y(0|u)/P),m[S+8>>2]=x+y(T*f),m[S+4>>2]=A+y(M*f),m[S>>2]=g+y(E*f),d[v+(R<<2)>>2]=1065353216,(0|(u=u+1|0))!=(0|a););if((0|(C=C+1|0))==(0|l))break}for(d[7717]=d[7717]+1,_=Ce(0|r[d[6606]](1252,16),e,_,p,v),1&c&&(m[d[_+720>>2]+88>>2]=0,s[_+924|0]=1),2&c&&(m[88+(d[_+720>>2]+b(a+-1|0,104)|0)>>2]=0,s[_+924|0]=1),4&c&&(m[88+(d[_+720>>2]+b(b(l+-1|0,a),104)|0)>>2]=0,s[_+924|0]=1),8&c&&(m[88+(d[_+720>>2]+b((b(l+-1|0,a)+a|0)-1|0,104)|0)>>2]=0,s[_+924|0]=1),p&&p&&(d[7718]=d[7718]+1,r[d[6607]](p)),ve(v),S=(0|a)>0,n=0;;){if(i=l,S)for(C=b(n,a),c=b(e=n+1|0,a),u=0;;){t=u,o=u+C|0;e:{t:{if((0|(u=u+1|0))<(0|a)){if(Lh(_,o,p=u+C|0,0,0),(0|e)>=(0|l))break e;if(Lh(_,o,v=t+c|0,0,0),!(t+n&1))break t;if(lr(_,o,p,t=c+u|0,0),lr(_,o,t,v,0),!h)break e;Lh(_,o,t,0,0);break e}if((0|e)>=(0|l))break e;Lh(_,o,t+c|0,0,0);break e}lr(_,v,o,p,0),lr(_,v,p,c+u|0,0),h&&Lh(_,p,v,0,0)}if((0|a)==(0|u))break}else e=n+1|0;if((0|i)==(0|(n=e)))break}}return _}(d[u+40>>2],d[u+36>>2],d[u+32>>2],d[u+28>>2],d[u+24>>2],d[u+20>>2],d[u+16>>2],d[u+12>>2],1&s[u+11|0]),O=u+48|0,0|e},emscripten_bind_btSoftBodyHelpers_CreatePatchUV_10:function(e,t,i,n,r,o,a,l,c,h,_){var u;return e|=0,t|=0,i|=0,n|=0,r|=0,o|=0,a|=0,l|=0,c|=0,h|=0,_|=0,O=u=O-48|0,d[u+44>>2]=e,d[u+40>>2]=t,d[u+36>>2]=i,d[u+32>>2]=n,d[u+28>>2]=r,d[u+24>>2]=o,d[u+20>>2]=a,d[u+16>>2]=l,d[u+12>>2]=c,s[u+11|0]=h,d[u+4>>2]=_,e=Qe(d[u+40>>2],d[u+36>>2],d[u+32>>2],d[u+28>>2],d[u+24>>2],d[u+20>>2],d[u+16>>2],d[u+12>>2],1&s[u+11|0],d[u+4>>2]),O=u+48|0,0|e},emscripten_bind_btSoftBodyHelpers_CreateEllipsoid_4:function(e,t,i,n,s){var o;return e|=0,t|=0,i|=0,n|=0,s|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,d[o+12>>2]=s,e=function(e,t,i,n){var s,o,a=0,l=0,c=0,h=y(0),_=y(0),u=0,p=0,f=y(0),g=y(0),b=y(0),v=y(0);O=o=O-16|0,s=n+3|0;e:if((0|n)>=-2){for(d[7717]=d[7717]+1,u=0|r[d[6606]](s<<4,16);a=d[o+4>>2],d[(p=(c<<4)+u|0)>>2]=d[o>>2],d[p+4>>2]=a,a=d[o+12>>2],d[p+8>>2]=d[o+8>>2],d[p+12>>2]=a,(0|s)!=(0|(c=c+1|0)););for(f=y(0|s),a=u;;){if(_=y(0),h=y(.5),c=l,l)for(;_=1&c?y(_+h):_,h=y(h*y(.5)),c>>=1;);if(d[a+12>>2]=0,h=y(y(_+_)+y(-1)),m[a+8>>2]=h,_=y(y(y(y(l<<1)*y(3.1415927410125732))+y(3.1415927410125732))/f),h=y(x(y(y(1)-y(h*h)))),m[a+4>>2]=An(_)*h,m[a>>2]=yn(_)*h,a=a+16|0,(0|(l=l+1|0))==(0|s))break}if((0|n)>=-2){for(n=(0|s)>1?s:1,a=0;g=m[t>>2],b=m[i>>2],v=m[t+4>>2],f=m[i+4>>2],_=m[t+8>>2],h=m[i+8>>2],d[12+(l=(a<<4)+u|0)>>2]=0,m[l+8>>2]=_+y(h*m[l+8>>2]),m[l+4>>2]=v+y(f*m[l+4>>2]),m[l>>2]=g+y(b*m[l>>2]),(0|n)!=(0|(a=a+1|0)););c=Ci(e,u,s,1)}else if(c=Ci(e,u,s,1),!u)break e;u&&(d[7718]=d[7718]+1,r[d[6607]](u))}else c=Ci(e,0,s,1);return O=o+16|0,c}(d[o+24>>2],d[o+20>>2],d[o+16>>2],d[o+12>>2]),O=o+32|0,0|e},emscripten_bind_btSoftBodyHelpers_CreateFromTriMesh_5:function(e,t,i,n,o,a){var l;return e|=0,t|=0,i|=0,n|=0,o|=0,a|=0,O=l=O-32|0,d[l+28>>2]=e,d[l+24>>2]=t,d[l+20>>2]=i,d[l+16>>2]=n,d[l+12>>2]=o,s[l+11|0]=a,e=function(e,t,i,n,o){var a,l,c=0,h=0,_=0,p=0,f=0,m=0,g=0,y=0,v=0,A=0;if(O=a=O-16|0,l=b(n,3),(0|n)>=1)for(c=(0|l)>1?l:1;h=(0|(f=d[(_<<2)+i>>2]))>(0|h)?f:h,(0|c)!=(0|(_=_+1|0)););if((c=b(f=h+1|0,f))&&(d[7717]=d[7717]+1,Mn(m=0|r[d[6606]](c,16),0,c)),!((0|h)<=-1)){for(_=0,d[7717]=d[7717]+1,y=0|r[d[6606]](f<<4,16);g=d[(c=a)+4>>2],d[(p=(_<<4)+y|0)>>2]=d[c>>2],d[p+4>>2]=g,g=d[c+12>>2],d[p+8>>2]=d[c+8>>2],d[p+12>>2]=g,c=(0|h)!=(0|_),_=_+1|0,c;);if(!((0|h)<0))for(p=(((0|(c=b(h,3)+3|0))>3?c:3)+-1>>>0)/3|0,_=0,h=0;g=d[4+(c=(_<<2)+t|0)>>2],v=d[c>>2],A=d[c+8>>2],d[12+(c=(h<<4)+y|0)>>2]=0,d[c+8>>2]=A,d[c>>2]=v,d[c+4>>2]=g,_=_+3|0,c=(0|h)!=(0|p),h=h+1|0,c;);}if(_=0,d[7717]=d[7717]+1,e=Ce(0|r[d[6606]](1252,16),e,f,y,0),(0|n)>=1)for(;t=d[4+(n=(_<<2)+i|0)>>2],c=d[n>>2],h=b(c,f),n=d[n+8>>2],u[0|(p=(h+n|0)+m|0)]||(s[0|p]=1,s[(c+b(n,f)|0)+m|0]=1,Lh(e,n,c,0,0)),p=b(t,f),u[0|(g=(p+c|0)+m|0)]||(s[0|g]=1,s[(t+h|0)+m|0]=1,Lh(e,c,t,0,0)),h=(t+b(n,f)|0)+m|0,u[0|h]||(s[0|h]=1,s[(n+p|0)+m|0]=1,Lh(e,t,n,0,0)),lr(e,c,t,n,0),(0|(_=_+3|0))<(0|l););return o&&rt(e),y&&y&&(d[7718]=d[7718]+1,r[d[6607]](y)),m&&m&&(d[7718]=d[7718]+1,r[d[6607]](m)),O=a+16|0,e}(d[l+24>>2],d[l+20>>2],d[l+16>>2],d[l+12>>2],1&s[l+11|0]),O=l+32|0,0|e},emscripten_bind_btSoftBodyHelpers_CreateFromConvexHull_4:function(e,t,i,n,r){var o;return e|=0,t|=0,i|=0,n|=0,r|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,s[o+15|0]=r,e=Ci(d[o+24>>2],d[o+20>>2],d[o+16>>2],1&s[o+15|0]),O=o+32|0,0|e},emscripten_bind_btSoftBodyHelpers___destroy___0:Dh,emscripten_bind_btBroadphaseProxy_get_m_collisionFilterGroup_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,_[d[t+12>>2]+4>>1]},emscripten_bind_btBroadphaseProxy_set_m_collisionFilterGroup_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,_[d[i+12>>2]+4>>1]=d[i+8>>2]},emscripten_bind_btBroadphaseProxy_get_m_collisionFilterMask_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,_[d[t+12>>2]+6>>1]},emscripten_bind_btBroadphaseProxy_set_m_collisionFilterMask_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,_[d[i+12>>2]+6>>1]=d[i+8>>2]},emscripten_bind_btBroadphaseProxy___destroy___0:Fh,emscripten_bind_tNodeArray_size_0:tc,emscripten_bind_tNodeArray_at_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,O=i+16|0,d[d[e+12>>2]+12>>2]+b(d[e+8>>2],104)|0},emscripten_bind_tNodeArray___destroy___0:Th,emscripten_bind_btBoxShape_btBoxShape_1:function(e){var t;return e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e,t){var i,n=y(0),s=y(0),o=y(0),a=0,l=y(0),c=y(0),h=y(0);po(e),d[e+4>>2]=0,d[e>>2]=14828,i=e,n=m[t>>2],s=m[t+8>>2],o=m[t+4>>2],(n=y(m[((n>2]*y(.10000000149011612)))>2]?(es(e,n),a=d[e>>2]):a=14828,n=y(r[d[a+48>>2]](i)),s=y(r[d[d[e>>2]+48>>2]](e)),o=y(r[d[d[e>>2]+48>>2]](e)),l=m[t>>2],c=m[t+4>>2],h=m[t+8>>2],d[e+40>>2]=0,m[e+36>>2]=y(h*m[e+20>>2])-o,m[e+32>>2]=y(c*m[e+16>>2])-s,m[e+28>>2]=y(l*m[e+12>>2])-n}(e=nc(56),d[t+12>>2]),O=t+16|0,0|e},emscripten_bind_btBoxShape_setMargin_1:fl,emscripten_bind_btBoxShape_getMargin_0:jl,emscripten_bind_btBoxShape_setLocalScaling_1:gl,emscripten_bind_btBoxShape_getLocalScaling_0:hc,emscripten_bind_btBoxShape_calculateLocalInertia_2:Ma,emscripten_bind_btBoxShape___destroy___0:Nc,emscripten_bind_btFace_get_m_indices_0:V_,emscripten_bind_btFace_set_m_indices_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,Ch(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btFace_get_m_plane_1:function(e,t){var i;return e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,y(m[(d[i+12>>2]+20|0)+(d[i+8>>2]<<2)>>2])},emscripten_bind_btFace_set_m_plane_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),d[12+(n=O-16|0)>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,m[(d[n+12>>2]+20|0)+(d[n+8>>2]<<2)>>2]=m[n+4>>2]},emscripten_bind_btFace___destroy___0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,(e=d[t+12>>2])&&(B_(e),ve(e)),O=t+16|0},emscripten_bind_DebugDrawer_DebugDrawer_0:function(){var e;return e=ic(4),d[e>>2]=0,function(e){var t,i;O=t=O-16|0,d[t+12>>2]=e,e=O-16|0,i=d[t+12>>2],d[e+12>>2]=i,d[d[e+12>>2]>>2]=2428,d[i>>2]=2276,O=t+16|0}(e),0|e},emscripten_bind_DebugDrawer_drawLine_3:Qo,emscripten_bind_DebugDrawer_drawContactPoint_5:Ns,emscripten_bind_DebugDrawer_reportErrorWarning_1:Tl,emscripten_bind_DebugDrawer_draw3dText_2:wa,emscripten_bind_DebugDrawer_setDebugMode_1:Pl,emscripten_bind_DebugDrawer_getDebugMode_0:dc,emscripten_bind_DebugDrawer___destroy___0:Nc,emscripten_bind_btCapsuleShapeX_btCapsuleShapeX_2:function(e,t){var i,n;return e=y(e),t=y(t),O=i=O-16|0,m[i+12>>2]=e,m[i+8>>2]=t,function(e,t,i){d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,d[e+52>>2]=0,d[e>>2]=14120,d[e+4>>2]=10,d[e+40>>2]=0,m[e+36>>2]=t,m[e+32>>2]=t,m[e+28>>2]=i*y(.5)}(n=nc(56),m[i+12>>2],m[i+8>>2]),O=i+16|0,0|n},emscripten_bind_btCapsuleShapeX_setMargin_1:fl,emscripten_bind_btCapsuleShapeX_getMargin_0:jl,emscripten_bind_btCapsuleShapeX_getUpAxis_0:ql,emscripten_bind_btCapsuleShapeX_getRadius_0:fh,emscripten_bind_btCapsuleShapeX_getHalfHeight_0:mh,emscripten_bind_btCapsuleShapeX_setLocalScaling_1:gl,emscripten_bind_btCapsuleShapeX_getLocalScaling_0:hc,emscripten_bind_btCapsuleShapeX_calculateLocalInertia_2:Ma,emscripten_bind_btCapsuleShapeX___destroy___0:Nc,emscripten_bind_btQuaternion_btQuaternion_4:function(e,t,i,n){var r,s;return e=y(e),t=y(t),i=y(i),n=y(n),O=r=O-16|0,m[r+12>>2]=e,m[r+8>>2]=t,m[r+4>>2]=i,m[r>>2]=n,ia(s=ic(16),r+12|0,r+8|0,r+4|0,r),O=r+16|0,0|s},emscripten_bind_btQuaternion_setValue_4:So,emscripten_bind_btQuaternion_setEulerZYX_3:function(e,t,i,n){var r;e|=0,t=y(t),i=y(i),n=y(n),O=r=O-16|0,d[r+12>>2]=e,m[r+8>>2]=t,m[r+4>>2]=i,m[r>>2]=n,function(e,t,i,n){var r;O=r=O-80|0,d[r+76>>2]=e,d[r+72>>2]=t,d[r+68>>2]=i,d[r+64>>2]=n,e=d[r+76>>2],m[r+60>>2]=m[d[r+72>>2]>>2]*y(.5),m[r+56>>2]=m[d[r+68>>2]>>2]*y(.5),m[r+52>>2]=m[d[r+64>>2]>>2]*y(.5),m[r+48>>2]=Uh(m[r+60>>2]),m[r+44>>2]=Vh(m[r+60>>2]),m[r+40>>2]=Uh(m[r+56>>2]),m[r+36>>2]=Vh(m[r+56>>2]),m[r+32>>2]=Uh(m[r+52>>2]),m[r+28>>2]=Vh(m[r+52>>2]),m[r+24>>2]=y(y(m[r+28>>2]*m[r+40>>2])*m[r+48>>2])-y(y(m[r+32>>2]*m[r+36>>2])*m[r+44>>2]),m[r+20>>2]=y(y(m[r+32>>2]*m[r+36>>2])*m[r+48>>2])+y(y(m[r+28>>2]*m[r+40>>2])*m[r+44>>2]),m[r+16>>2]=y(y(m[r+32>>2]*m[r+40>>2])*m[r+44>>2])-y(y(m[r+28>>2]*m[r+36>>2])*m[r+48>>2]),m[r+12>>2]=y(y(m[r+32>>2]*m[r+40>>2])*m[r+48>>2])+y(y(m[r+28>>2]*m[r+36>>2])*m[r+44>>2]),eo(e,r+24|0,r+20|0,r+16|0,r+12|0),O=r+80|0}(d[r+12>>2],r+8|0,r+4|0,r),O=r+16|0},emscripten_bind_btQuaternion_setRotation_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,function(e,t,i){var n;O=n=O-48|0,d[n+44>>2]=e,d[n+40>>2]=t,d[n+36>>2]=i,e=d[n+44>>2],m[n+32>>2]=Ml(d[n+40>>2]),m[n+28>>2]=Vh(y(m[d[n+36>>2]>>2]*y(.5)))/m[n+32>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],m[n+24>>2]=m[d[t+12>>2]>>2]*m[n+28>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],m[n+20>>2]=m[d[t+12>>2]+4>>2]*m[n+28>>2],d[12+(t=O-16|0)>>2]=d[n+40>>2],m[n+16>>2]=m[d[t+12>>2]+8>>2]*m[n+28>>2],m[n+12>>2]=Uh(y(m[d[n+36>>2]>>2]*y(.5))),eo(e,n+24|0,n+20|0,n+16|0,n+12|0),O=n+48|0}(d[n+12>>2],d[n+8>>2],n+4|0),O=n+16|0},emscripten_bind_btQuaternion_normalize_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e){var t;O=t=O-16|0,d[t+12>>2]=e,e=d[t+12>>2],m[t+8>>2]=Ol(e),$a(e,t+8|0),O=t+16|0}(d[t+12>>2]),O=t+16|0},emscripten_bind_btQuaternion_length2_0:function(e){e|=0;var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=vh(d[t+12>>2]),O=t+16|0,y(i)},emscripten_bind_btQuaternion_length_0:function(e){e|=0;var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=Ol(d[t+12>>2]),O=t+16|0,y(i)},emscripten_bind_btQuaternion_dot_1:function(e,t){e|=0,t|=0;var i,n=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,n=ls(d[i+12>>2],d[i+8>>2]),O=i+16|0,y(n)},emscripten_bind_btQuaternion_normalized_0:function(e){e|=0;var t,i=0;return O=t=O-32|0,d[t+28>>2]=e,1&s[26772]||mc(26772)&&(wc(26756),uh(26772)),function(e,t){var i;O=i=O-16|0,d[i+12>>2]=t,t=d[i+12>>2],m[i+8>>2]=Ol(t),function(e,t,i){var n;O=n=O-16|0,d[n+12>>2]=t,d[n+8>>2]=i,t=d[n+12>>2],m[n+4>>2]=y(1)/m[d[n+8>>2]>>2],function(e,t,i){var n;O=n=O-32|0,d[n+28>>2]=t,d[n+24>>2]=i,i=O-16|0,t=d[n+28>>2],d[i+12>>2]=t,m[n+20>>2]=m[d[i+12>>2]>>2]*m[d[n+24>>2]>>2],d[12+(i=O-16|0)>>2]=t,m[n+16>>2]=m[d[i+12>>2]+4>>2]*m[d[n+24>>2]>>2],d[12+(i=O-16|0)>>2]=t,m[n+12>>2]=m[d[i+12>>2]+8>>2]*m[d[n+24>>2]>>2],m[n+8>>2]=m[t+12>>2]*m[d[n+24>>2]>>2],ia(e,n+20|0,n+16|0,n+12|0,n+8|0),O=n+32|0}(e,t,n+4|0),O=n+16|0}(e,t,i+8|0),O=i+16|0}(e=t+8|0,d[t+28>>2]),i=d[e+4>>2],d[6689]=d[e>>2],d[6690]=i,i=d[e+12>>2],d[6691]=d[e+8>>2],d[6692]=i,O=t+32|0,26756},emscripten_bind_btQuaternion_getAxis_0:function(e){var t;return e|=0,O=t=O-32|0,d[t+28>>2]=e,1&s[26792]||mc(26792)&&(d[12+(O-16|0)>>2]=26776,uh(26792)),function(e,t){var i,n=0;O=i=O-48|0,d[i+44>>2]=t,t=d[i+44>>2],m[i+40>>2]=y(1)-y(m[t+12>>2]*m[t+12>>2]),m[i+40>>2]>2]=1,m[i+32>>2]=0,m[i+28>>2]=0,Zo(e,i+36|0,i+32|0,i+28|0)):(m[12+(n=O-16|0)>>2]=m[i+40>>2],m[i+24>>2]=y(1)/y(x(m[n+12>>2])),m[i+20>>2]=m[t>>2]*m[i+24>>2],m[i+16>>2]=m[t+4>>2]*m[i+24>>2],m[i+12>>2]=m[t+8>>2]*m[i+24>>2],Zo(e,i+20|0,i+16|0,i+12|0)),O=i+48|0}(t+8|0,d[t+28>>2]),e=d[t+12>>2],d[6694]=d[t+8>>2],d[6695]=e,e=d[t+20>>2],d[6696]=d[t+16>>2],d[6697]=e,O=t+32|0,26776},emscripten_bind_btQuaternion_inverse_0:function(e){e|=0;var t,i=0;return O=t=O-32|0,d[t+28>>2]=e,1&s[26812]||mc(26812)&&(wc(26796),uh(26812)),function(e,t){var i;O=i=O-16|0,d[i+12>>2]=t,t=d[i+12>>2],m[i+8>>2]=-m[t>>2],m[i+4>>2]=-m[t+4>>2],m[i>>2]=-m[t+8>>2],ia(e,i+8|0,i+4|0,i,t+12|0),O=i+16|0}(e=t+8|0,d[t+28>>2]),i=d[e+4>>2],d[6699]=d[e>>2],d[6700]=i,i=d[e+12>>2],d[6701]=d[e+8>>2],d[6702]=i,O=t+32|0,26796},emscripten_bind_btQuaternion_getAngle_0:function(e){e|=0;var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=function(e){var t;return O=t=O-16|0,d[t+12>>2]=e,m[t+8>>2]=y(2)*Ga(m[d[t+12>>2]+12>>2]),O=t+16|0,m[t+8>>2]}(d[t+12>>2]),O=t+16|0,y(i)},emscripten_bind_btQuaternion_getAngleShortestPath_0:function(e){e|=0;var t,i=y(0);return O=t=O-16|0,d[t+12>>2]=e,i=function(e){var t;return O=t=O-16|0,d[t+12>>2]=e,ls(e=d[t+12>>2],e)>2]=y(2)*Ga(m[e+12>>2]):m[t+8>>2]=y(2)*Ga(y(-m[e+12>>2])),O=t+16|0,m[t+8>>2]}(d[t+12>>2]),O=t+16|0,y(i)},emscripten_bind_btQuaternion_angle_1:function(e,t){e|=0,t|=0;var i,n=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,n=function(e,t){var i,n=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],n=y(vh(e)*vh(d[i+8>>2])),m[12+(t=O-16|0)>>2]=n,m[i+4>>2]=x(m[t+12>>2]),n=Ga(y(ls(e,d[i+8>>2])/m[i+4>>2])),O=i+16|0,n}(d[i+12>>2],d[i+8>>2]),O=i+16|0,y(n)},emscripten_bind_btQuaternion_angleShortestPath_1:function(e,t){e|=0,t|=0;var i,n=y(0);return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,n=function(e,t){var i,n=y(0);return O=i=O-32|0,d[i+24>>2]=e,d[i+20>>2]=t,e=d[i+24>>2],n=y(vh(e)*vh(d[i+20>>2])),m[12+(t=O-16|0)>>2]=n,m[i+16>>2]=x(m[t+12>>2]),ls(e,d[i+20>>2])>2]=t,d[i+24>>2]=d[i+28>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],m[i+20>>2]=-m[d[t+12>>2]>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],m[i+16>>2]=-m[d[t+12>>2]+4>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],m[i+12>>2]=-m[d[t+12>>2]+8>>2],m[i+8>>2]=-m[d[i+24>>2]+12>>2],ia(e,i+20|0,i+16|0,i+12|0,i+8|0),O=i+32|0}(i,d[i+20>>2]),m[i+28>>2]=Ga(y(ls(e,i)/m[i+16>>2]))*y(2)):m[i+28>>2]=Ga(y(ls(e,d[i+20>>2])/m[i+16>>2]))*y(2),O=i+32|0,m[i+28>>2]}(d[i+12>>2],d[i+8>>2]),O=i+16|0,y(n)},emscripten_bind_btQuaternion_op_add_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],m[e>>2]=m[e>>2]+m[d[t+12>>2]>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],m[e+4>>2]=m[e+4>>2]+m[d[t+12>>2]+4>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],m[e+8>>2]=m[e+8>>2]+m[d[t+12>>2]+8>>2],m[e+12>>2]=m[e+12>>2]+m[d[i+8>>2]+12>>2],O=i+16|0,e}(d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btQuaternion_op_sub_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=function(e,t){var i;return O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=d[i+12>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],m[e>>2]=m[e>>2]-m[d[t+12>>2]>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],m[e+4>>2]=m[e+4>>2]-m[d[t+12>>2]+4>>2],d[12+(t=O-16|0)>>2]=d[i+8>>2],m[e+8>>2]=m[e+8>>2]-m[d[t+12>>2]+8>>2],m[e+12>>2]=m[e+12>>2]-m[d[i+8>>2]+12>>2],O=i+16|0,e}(d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btQuaternion_op_mul_1:function(e,t){var i;return e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,e=to(d[i+12>>2],i+8|0),O=i+16|0,0|e},emscripten_bind_btQuaternion_op_mulq_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,e=function(e,t){var i,n=y(0),r=y(0);return O=i=O-32|0,d[i+28>>2]=e,d[i+24>>2]=t,e=d[i+28>>2],n=m[e+12>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],n=y(y(n*m[d[t+12>>2]>>2])+y(m[e>>2]*m[d[i+24>>2]+12>>2])),r=m[e+4>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],n=y(n+y(r*m[d[t+12>>2]+8>>2])),r=m[e+8>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],m[i+20>>2]=n-y(r*m[d[t+12>>2]+4>>2]),n=m[e+12>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],n=y(y(n*m[d[t+12>>2]+4>>2])+y(m[e+4>>2]*m[d[i+24>>2]+12>>2])),r=m[e+8>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],n=y(n+y(r*m[d[t+12>>2]>>2])),r=m[e>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],m[i+16>>2]=n-y(r*m[d[t+12>>2]+8>>2]),n=m[e+12>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],n=y(y(n*m[d[t+12>>2]+8>>2])+y(m[e+8>>2]*m[d[i+24>>2]+12>>2])),r=m[e>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],n=y(n+y(r*m[d[t+12>>2]+4>>2])),r=m[e+4>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],m[i+12>>2]=n-y(r*m[d[t+12>>2]>>2]),n=y(m[e+12>>2]*m[d[i+24>>2]+12>>2]),r=m[e>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],n=y(n-y(r*m[d[t+12>>2]>>2])),r=m[e+4>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],n=y(n-y(r*m[d[t+12>>2]+4>>2])),r=m[e+8>>2],d[12+(t=O-16|0)>>2]=d[i+24>>2],m[i+8>>2]=n-y(r*m[d[t+12>>2]+8>>2]),eo(e,i+20|0,i+16|0,i+12|0,i+8|0),O=i+32|0,e}(d[i+12>>2],d[i+8>>2]),O=i+16|0,0|e},emscripten_bind_btQuaternion_op_div_1:function(e,t){var i;return e|=0,t=y(t),O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,e=$a(d[i+12>>2],i+8|0),O=i+16|0,0|e},emscripten_bind_btQuaternion_x_0:Ql,emscripten_bind_btQuaternion_y_0:Ul,emscripten_bind_btQuaternion_z_0:Gl,emscripten_bind_btQuaternion_w_0:Vl,emscripten_bind_btQuaternion_setX_1:ga,emscripten_bind_btQuaternion_setY_1:pa,emscripten_bind_btQuaternion_setZ_1:fa,emscripten_bind_btQuaternion_setW_1:ca,emscripten_bind_btQuaternion___destroy___0:Dh,emscripten_bind_btCapsuleShapeZ_btCapsuleShapeZ_2:function(e,t){var i,n;return e=y(e),t=y(t),O=i=O-16|0,m[i+12>>2]=e,m[i+8>>2]=t,function(e,t,i){d[e+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,d[e+52>>2]=2,d[e>>2]=14220,d[e+4>>2]=10,d[e+40>>2]=0,m[e+36>>2]=i*y(.5),m[e+32>>2]=t,m[e+28>>2]=t}(n=nc(56),m[i+12>>2],m[i+8>>2]),O=i+16|0,0|n},emscripten_bind_btCapsuleShapeZ_setMargin_1:fl,emscripten_bind_btCapsuleShapeZ_getMargin_0:jl,emscripten_bind_btCapsuleShapeZ_getUpAxis_0:ql,emscripten_bind_btCapsuleShapeZ_getRadius_0:fh,emscripten_bind_btCapsuleShapeZ_getHalfHeight_0:mh,emscripten_bind_btCapsuleShapeZ_setLocalScaling_1:gl,emscripten_bind_btCapsuleShapeZ_getLocalScaling_0:hc,emscripten_bind_btCapsuleShapeZ_calculateLocalInertia_2:Ma,emscripten_bind_btCapsuleShapeZ___destroy___0:Nc,emscripten_bind_btContactSolverInfo_get_m_splitImpulse_0:function(e){var t;return e|=0,d[12+(t=O-16|0)>>2]=e,0!=d[d[t+12>>2]+44>>2]|0},emscripten_bind_btContactSolverInfo_set_m_splitImpulse_1:function(e,t){var i;e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,s[i+11|0]=t,d[d[i+12>>2]+44>>2]=1&s[i+11|0]},emscripten_bind_btContactSolverInfo_get_m_splitImpulsePenetrationThreshold_0:function(e){e|=0;var t,i=y(0);return d[12+(t=O-16|0)>>2]=e,i=m[d[t+12>>2]+48>>2],0|(y(v(i))>2]=e,d[i+8>>2]=t,m[d[i+12>>2]+48>>2]=d[i+8>>2]},emscripten_bind_btContactSolverInfo_get_m_numIterations_0:p_,emscripten_bind_btContactSolverInfo_set_m_numIterations_1:ch,emscripten_bind_btContactSolverInfo___destroy___0:Dh,emscripten_bind_btGeneric6DofSpringConstraint_btGeneric6DofSpringConstraint_3:function(e,t,i){var n;return e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,function(e,t,i,n){Se(e,t,i,n),s[0|(t=e+1309|0)]=0,s[t+1|0]=0,s[t+2|0]=0,s[t+3|0]=0,d[e+4>>2]=9,d[e>>2]=19020,s[0|(t=e+1313|0)]=0,s[t+1|0]=0,d[(t=e+1316|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1324|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1332|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1340|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1348|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1356|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1380|0)>>2]=1065353216,d[t+4>>2]=1065353216,d[(t=e+1372|0)>>2]=1065353216,d[t+4>>2]=1065353216,d[e+1364>>2]=1065353216,d[e+1368>>2]=1065353216}(e=nc(1388),d[n+12>>2],d[n+8>>2],1&s[n+7|0]),O=n+16|0,0|e},emscripten_bind_btGeneric6DofSpringConstraint_btGeneric6DofSpringConstraint_5:function(e,t,i,n,r){var o;return e|=0,t|=0,i|=0,n|=0,r|=0,O=o=O-32|0,d[o+28>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,s[o+15|0]=r,function(e,t,i,n,r,o){ze(e,t,i,n,r,o),s[0|(t=e+1309|0)]=0,s[t+1|0]=0,s[t+2|0]=0,s[t+3|0]=0,d[e+4>>2]=9,d[e>>2]=19020,s[0|(t=e+1313|0)]=0,s[t+1|0]=0,d[(t=e+1316|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1324|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1332|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1340|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1348|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1356|0)>>2]=0,d[t+4>>2]=0,d[(t=e+1380|0)>>2]=1065353216,d[t+4>>2]=1065353216,d[(t=e+1372|0)>>2]=1065353216,d[t+4>>2]=1065353216,d[e+1364>>2]=1065353216,d[e+1368>>2]=1065353216}(e=nc(1388),d[o+28>>2],d[o+24>>2],d[o+20>>2],d[o+16>>2],1&s[o+15|0]),O=o+32|0,0|e},emscripten_bind_btGeneric6DofSpringConstraint_enableSpring_2:function(e,t,i){var n;e|=0,t|=0,i|=0,O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,s[n+7|0]=i,function(e,t,i){var n;s[1309+(n=e+t|0)|0]=i,(0|t)<=2?s[n+788|0]=i:s[720+((t<<6)+e|0)|0]=i}(d[n+12>>2],d[n+8>>2],1&s[n+7|0]),O=n+16|0},emscripten_bind_btGeneric6DofSpringConstraint_setStiffness_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,m[1340+(d[n+12>>2]+(d[n+8>>2]<<2)|0)>>2]=m[n+4>>2],O=n+16|0},emscripten_bind_btGeneric6DofSpringConstraint_setDamping_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,m[1364+(d[n+12>>2]+(d[n+8>>2]<<2)|0)>>2]=m[n+4>>2],O=n+16|0},emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_0:function(e){var t;e|=0,O=t=O-16|0,d[t+12>>2]=e,function(e){var t,i=0,n=0;Q_(e),d[e+1316>>2]=d[e+1256>>2],t=d[4+(n=e+1260|0)>>2],d[(i=e+1320|0)>>2]=d[n>>2],d[i+4>>2]=t,d[e+1328>>2]=d[e+1192>>2],i=e+1332|0,n=d[4+(e=e+1196|0)>>2],d[i>>2]=d[e>>2],d[i+4>>2]=n}(d[t+12>>2]),O=t+16|0},emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_1:function(e,t){var i;e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,function(e,t){Q_(e),d[1316+(e=(t<<2)+e|0)>>2]=d[((0|t)<3?e+1256|0:e+1180|0)>>2]}(d[i+12>>2],d[i+8>>2]),O=i+16|0},emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_2:function(e,t,i){var n;e|=0,t|=0,i=y(i),O=n=O-16|0,d[n+12>>2]=e,d[n+8>>2]=t,m[n+4>>2]=i,m[1316+(d[n+12>>2]+(d[n+8>>2]<<2)|0)>>2]=m[n+4>>2],O=n+16|0},emscripten_bind_btGeneric6DofSpringConstraint_setLinearLowerLimit_1:xc,emscripten_bind_btGeneric6DofSpringConstraint_setLinearUpperLimit_1:Tc,emscripten_bind_btGeneric6DofSpringConstraint_setAngularLowerLimit_1:Rc,emscripten_bind_btGeneric6DofSpringConstraint_setAngularUpperLimit_1:Pc,emscripten_bind_btGeneric6DofSpringConstraint_getFrameOffsetA_0:ac,emscripten_bind_btGeneric6DofSpringConstraint_enableFeedback_1:sa,emscripten_bind_btGeneric6DofSpringConstraint_getBreakingImpulseThreshold_0:kl,emscripten_bind_btGeneric6DofSpringConstraint_setBreakingImpulseThreshold_1:_a,emscripten_bind_btGeneric6DofSpringConstraint_getParam_2:Ko,emscripten_bind_btGeneric6DofSpringConstraint_setParam_3:Lo,emscripten_bind_btGeneric6DofSpringConstraint___destroy___0:Nc,emscripten_bind_btSphereShape_btSphereShape_1:function(e){var t,i;return e=y(e),O=t=O-16|0,m[t+12>>2]=e,function(e,t){var i,n;O=i=O-16|0,d[i+12>>2]=e,m[i+8>>2]=t,n=d[i+12>>2],d[(e=n)+4>>2]=35,d[e+8>>2]=0,d[e>>2]=13316,d[e+44>>2]=1025758986,d[e+20>>2]=1065353216,d[e+24>>2]=0,d[e+12>>2]=1065353216,d[e+16>>2]=1065353216,d[e>>2]=13444,d[e>>2]=11556,d[e+4>>2]=8,t=m[i+8>>2],d[12+(e=O-16|0)>>2]=n+28,m[e+8>>2]=t,m[d[e+12>>2]>>2]=m[e+8>>2],m[n+44>>2]=m[i+8>>2],O=i+16|0}(i=nc(52),m[t+12>>2]),O=t+16|0,0|i},emscripten_bind_btSphereShape_setMargin_1:fl,emscripten_bind_btSphereShape_getMargin_0:jl,emscripten_bind_btSphereShape_setLocalScaling_1:gl,emscripten_bind_btSphereShape_getLocalScaling_0:hc,emscripten_bind_btSphereShape_calculateLocalInertia_2:Ma,emscripten_bind_btSphereShape___destroy___0:Nc,emscripten_bind_Face_get_m_n_1:function(e,t){var i;return e|=0,t|=0,d[12+(i=O-16|0)>>2]=e,d[i+8>>2]=t,d[(d[i+12>>2]+8|0)+(d[i+8>>2]<<2)>>2]},emscripten_bind_Face_set_m_n_2:function(e,t,i){var n;e|=0,t|=0,i|=0,d[12+(n=O-16|0)>>2]=e,d[n+8>>2]=t,d[n+4>>2]=i,d[(d[n+12>>2]+8|0)+(d[n+8>>2]<<2)>>2]=d[n+4>>2]},emscripten_bind_Face_get_m_normal_0:E_,emscripten_bind_Face_set_m_normal_1:No,emscripten_bind_Face_get_m_ra_0:Kh,emscripten_bind_Face_set_m_ra_1:Qc,emscripten_bind_Face___destroy___0:Dh,emscripten_bind_tFaceArray_size_0:tc,emscripten_bind_tFaceArray_at_1:function(e,t){var i;return e|=0,t|=0,O=i=O-16|0,d[i+12>>2]=e,d[i+8>>2]=t,t=d[i+8>>2],d[12+(e=O-16|0)>>2]=d[i+12>>2],d[e+8>>2]=t,O=i+16|0,d[d[e+12>>2]+12>>2]+b(d[e+8>>2],44)|0},emscripten_bind_tFaceArray___destroy___0:Th,emscripten_bind_LocalConvexResult_LocalConvexResult_5:function(e,t,i,n,r){var s;return e|=0,t|=0,i|=0,n|=0,r=y(r),O=s=O-32|0,d[s+28>>2]=e,d[s+24>>2]=t,d[s+20>>2]=i,d[s+16>>2]=n,m[s+12>>2]=r,function(e,t,i,n,r,s){var o;d[28+(o=O-32|0)>>2]=e,d[o+24>>2]=t,d[o+20>>2]=i,d[o+16>>2]=n,d[o+12>>2]=r,m[o+8>>2]=s,e=d[o+28>>2],d[e>>2]=d[o+24>>2],d[e+4>>2]=d[o+20>>2],t=d[o+16>>2],i=d[t+4>>2],d[e+8>>2]=d[t>>2],d[e+12>>2]=i,i=d[t+12>>2],d[e+16>>2]=d[t+8>>2],d[e+20>>2]=i,t=d[o+12>>2],i=d[t+4>>2],d[e+24>>2]=d[t>>2],d[e+28>>2]=i,i=d[t+12>>2],d[e+32>>2]=d[t+8>>2],d[e+36>>2]=i,m[e+40>>2]=m[o+8>>2]}(e=ic(44),d[s+28>>2],d[s+24>>2],d[s+20>>2],d[s+16>>2],m[s+12>>2]),O=s+32|0,0|e},emscripten_bind_LocalConvexResult_get_m_hitCollisionObject_0:v_,emscripten_bind_LocalConvexResult_set_m_hitCollisionObject_1:yh,emscripten_bind_LocalConvexResult_get_m_localShapeInfo_0:m_,emscripten_bind_LocalConvexResult_set_m_localShapeInfo_1:dh,emscripten_bind_LocalConvexResult_get_m_hitNormalLocal_0:N_,emscripten_bind_LocalConvexResult_set_m_hitNormalLocal_1:Ho,emscripten_bind_LocalConvexResult_get_m_hitPointLocal_0:M_,emscripten_bind_LocalConvexResult_set_m_hitPointLocal_1:wo,emscripten_bind_LocalConvexResult_get_m_hitFraction_0:Gh,emscripten_bind_LocalConvexResult_set_m_hitFraction_1:Uc,emscripten_bind_LocalConvexResult___destroy___0:Dh,emscripten_enum_btConstraintParams_BT_CONSTRAINT_ERP:Md,emscripten_enum_btConstraintParams_BT_CONSTRAINT_STOP_ERP:Dd,emscripten_enum_btConstraintParams_BT_CONSTRAINT_CFM:Od,emscripten_enum_btConstraintParams_BT_CONSTRAINT_STOP_CFM:wd,emscripten_enum_PHY_ScalarType_PHY_FLOAT:function(){return 0},emscripten_enum_PHY_ScalarType_PHY_DOUBLE:Md,emscripten_enum_PHY_ScalarType_PHY_INTEGER:Dd,emscripten_enum_PHY_ScalarType_PHY_SHORT:Od,emscripten_enum_PHY_ScalarType_PHY_FIXEDPOINT88:wd,emscripten_enum_PHY_ScalarType_PHY_UCHAR:function(){return 5},malloc:L,free:ve,__growWasmMemory:function(e){return 0|T()},dynCall_vi:function(e,t){t|=0,r[e|=0](t)},dynCall_v:function(e){r[e|=0]()}}}({Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:1/0,Math:Math},e,t.buffer)}(se,S,x)}}_=null,t.wasmBinary&&(g=t.wasmBinary),t.noExitRuntime&&t.noExitRuntime;var A=Error,C={};g=[],"object"!=typeof C&&y("no native wasm support detected");var S,x=new function(e){var t=Array(930);return t.grow=function(){930<=t.length&&Y("Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH."),t.push(null)},t.set=function(e,i){t[e]=i},t.get=function(e){return t[e]},t}({initial:930,maximum:930,element:"anyfunc"}),T=!1;function E(e,t){e||Y("Assertion failed: "+t)}var R,P,I,M,D,O,w="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,F=t.INITIAL_MEMORY||67108864;(S=t.wasmMemory?t.wasmMemory:new function(){return{buffer:new ArrayBuffer(F/65536*65536),grow:function(e){return nT(e)}}})&&(R=S.buffer),F=R.byteLength;var B=R;function N(e){for(;0>>16)*n+i*(t>>>16)<<16)|0}),!Math.fround){var W=new Float32Array(1);Math.fround=function(e){return W[0]=e,W[0]}}Math.clz32||(Math.clz32=function(e){var t=32,i=e>>16;return i&&(t-=16,e=i),(i=e>>8)&&(t-=8,e=i),(i=e>>4)&&(t-=4,e=i),(i=e>>2)&&(t-=2,e=i),e>>1?t-2:t-e}),Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)});var z=0,H=null,X=null;function Y(e){throw t.onAbort&&t.onAbort(e),b(e+=""),y(e),T=!0,new A("abort("+e+"). Build with -s ASSERTIONS=1 for more info.")}function Q(e,t){return String.prototype.startsWith?e.startsWith(t):0===e.indexOf(t)}t.preloadedImages={},t.preloadedAudios={};var q="data:application/octet-stream;base64,",K="";if(!Q(K,q)){var Z=K;K=t.locateFile?t.locateFile(Z,m):m+Z}function $(){try{if(g)return new Uint8Array(g);var e=re(K);if(e)return e;if(u)return u(K);throw"both async and sync fetching of the wasm failed"}catch(e){Y(e)}}var J={1960:function(e,i,n,r,s,o,a,l){if(!(e=t.getCache(t.ConcreteContactResultCallback)[e]).hasOwnProperty("addSingleResult"))throw"a JSImplementation must implement all functions, you forgot ConcreteContactResultCallback::addSingleResult.";return e.addSingleResult(i,n,r,s,o,a,l)},2520:function(e,i,n,r){if(!(e=t.getCache(t.DebugDrawer)[e]).hasOwnProperty("drawLine"))throw"a JSImplementation must implement all functions, you forgot DebugDrawer::drawLine.";e.drawLine(i,n,r)},2745:function(e,i,n,r,s,o){if(!(e=t.getCache(t.DebugDrawer)[e]).hasOwnProperty("drawContactPoint"))throw"a JSImplementation must implement all functions, you forgot DebugDrawer::drawContactPoint.";e.drawContactPoint(i,n,r,s,o)},3002:function(e,i){if(!(e=t.getCache(t.DebugDrawer)[e]).hasOwnProperty("reportErrorWarning"))throw"a JSImplementation must implement all functions, you forgot DebugDrawer::reportErrorWarning.";e.reportErrorWarning(i)},3249:function(e,i,n){if(!(e=t.getCache(t.DebugDrawer)[e]).hasOwnProperty("draw3dText"))throw"a JSImplementation must implement all functions, you forgot DebugDrawer::draw3dText.";e.draw3dText(i,n)},3476:function(e,i){if(!(e=t.getCache(t.DebugDrawer)[e]).hasOwnProperty("setDebugMode"))throw"a JSImplementation must implement all functions, you forgot DebugDrawer::setDebugMode.";e.setDebugMode(i)},3705:function(e){if(!(e=t.getCache(t.DebugDrawer)[e]).hasOwnProperty("getDebugMode"))throw"a JSImplementation must implement all functions, you forgot DebugDrawer::getDebugMode.";return e.getDebugMode()}};k.push({la:function(){oe()}});var ee=[];function te(e,t){var i;for(ee.length=0,t>>=2;i=I[e++];)ee.push(105>i?O[++t>>1]:M[t]),++t;return ee}function ie(e){for(var t=[],i=0;i>4,r=(15&r)<<4|s>>2;var a=(3&s)<<6|o;t+=String.fromCharCode(n),64!==s&&(t+=String.fromCharCode(r)),64!==o&&(t+=String.fromCharCode(a))}while(i>2]=t/1e3|0,M[e+4>>2]=t%1e3*1e3|0,0},memory:S,table:x};!function(){function e(e){t.asm=e.exports,z--,t.monitorRunDependencies&&t.monitorRunDependencies(z),0==z&&(null!==H&&(clearInterval(H),H=null),X&&(e=X,X=null,e()))}function i(t){e(t.instance)}function n(e){return(g||!a&&!l||"function"!=typeof fetch||Q(K,"file://")?new s((function(e){e($())})):fetch(K,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+K+"'";return e.arrayBuffer()})).catch((function(){return $()}))).then((function(){return{then:function(e){e({instance:new v})}}})).then(e,(function(e){y("failed to asynchronously prepare wasm: "+e),Y(e)}))}var r={env:se,wasi_snapshot_preview1:se};if(z++,t.monitorRunDependencies&&t.monitorRunDependencies(z),t.instantiateWasm)try{return t.instantiateWasm(r,e)}catch(e){return y("Module.instantiateWasm callback failed with error: "+e),!1}!function(){if(g||"function"!=typeof C.instantiateStreaming||Q(K,q)||Q(K,"file://")||"function"!=typeof fetch)return n(i);fetch(K,{credentials:"same-origin"}).then((function(e){return C.instantiateStreaming(e,r).then(i,(function(e){return y("wasm streaming compile failed: "+e),y("falling back to ArrayBuffer instantiation"),n(i)}))}))}()}();var oe=t.___wasm_call_ctors=function(){return(oe=t.___wasm_call_ctors=t.asm.__wasm_call_ctors).apply(null,arguments)};t.___em_js__array_bounds_check_error=function(){return(t.___em_js__array_bounds_check_error=t.asm.__em_js__array_bounds_check_error).apply(null,arguments)};var ae=t._emscripten_bind_btCollisionWorld_getDispatcher_0=function(){return(ae=t._emscripten_bind_btCollisionWorld_getDispatcher_0=t.asm.emscripten_bind_btCollisionWorld_getDispatcher_0).apply(null,arguments)},le=t._emscripten_bind_btCollisionWorld_rayTest_3=function(){return(le=t._emscripten_bind_btCollisionWorld_rayTest_3=t.asm.emscripten_bind_btCollisionWorld_rayTest_3).apply(null,arguments)},ce=t._emscripten_bind_btCollisionWorld_getPairCache_0=function(){return(ce=t._emscripten_bind_btCollisionWorld_getPairCache_0=t.asm.emscripten_bind_btCollisionWorld_getPairCache_0).apply(null,arguments)},he=t._emscripten_bind_btCollisionWorld_getDispatchInfo_0=function(){return(he=t._emscripten_bind_btCollisionWorld_getDispatchInfo_0=t.asm.emscripten_bind_btCollisionWorld_getDispatchInfo_0).apply(null,arguments)},_e=t._emscripten_bind_btCollisionWorld_addCollisionObject_1=function(){return(_e=t._emscripten_bind_btCollisionWorld_addCollisionObject_1=t.asm.emscripten_bind_btCollisionWorld_addCollisionObject_1).apply(null,arguments)},de=t._emscripten_bind_btCollisionWorld_addCollisionObject_2=function(){return(de=t._emscripten_bind_btCollisionWorld_addCollisionObject_2=t.asm.emscripten_bind_btCollisionWorld_addCollisionObject_2).apply(null,arguments)},ue=t._emscripten_bind_btCollisionWorld_addCollisionObject_3=function(){return(ue=t._emscripten_bind_btCollisionWorld_addCollisionObject_3=t.asm.emscripten_bind_btCollisionWorld_addCollisionObject_3).apply(null,arguments)},pe=t._emscripten_bind_btCollisionWorld_removeCollisionObject_1=function(){return(pe=t._emscripten_bind_btCollisionWorld_removeCollisionObject_1=t.asm.emscripten_bind_btCollisionWorld_removeCollisionObject_1).apply(null,arguments)},fe=t._emscripten_bind_btCollisionWorld_getBroadphase_0=function(){return(fe=t._emscripten_bind_btCollisionWorld_getBroadphase_0=t.asm.emscripten_bind_btCollisionWorld_getBroadphase_0).apply(null,arguments)},me=t._emscripten_bind_btCollisionWorld_convexSweepTest_5=function(){return(me=t._emscripten_bind_btCollisionWorld_convexSweepTest_5=t.asm.emscripten_bind_btCollisionWorld_convexSweepTest_5).apply(null,arguments)},ge=t._emscripten_bind_btCollisionWorld_contactPairTest_3=function(){return(ge=t._emscripten_bind_btCollisionWorld_contactPairTest_3=t.asm.emscripten_bind_btCollisionWorld_contactPairTest_3).apply(null,arguments)},be=t._emscripten_bind_btCollisionWorld_contactTest_2=function(){return(be=t._emscripten_bind_btCollisionWorld_contactTest_2=t.asm.emscripten_bind_btCollisionWorld_contactTest_2).apply(null,arguments)},ye=t._emscripten_bind_btCollisionWorld_updateSingleAabb_1=function(){return(ye=t._emscripten_bind_btCollisionWorld_updateSingleAabb_1=t.asm.emscripten_bind_btCollisionWorld_updateSingleAabb_1).apply(null,arguments)},ve=t._emscripten_bind_btCollisionWorld_setDebugDrawer_1=function(){return(ve=t._emscripten_bind_btCollisionWorld_setDebugDrawer_1=t.asm.emscripten_bind_btCollisionWorld_setDebugDrawer_1).apply(null,arguments)},Ae=t._emscripten_bind_btCollisionWorld_getDebugDrawer_0=function(){return(Ae=t._emscripten_bind_btCollisionWorld_getDebugDrawer_0=t.asm.emscripten_bind_btCollisionWorld_getDebugDrawer_0).apply(null,arguments)},Ce=t._emscripten_bind_btCollisionWorld_debugDrawWorld_0=function(){return(Ce=t._emscripten_bind_btCollisionWorld_debugDrawWorld_0=t.asm.emscripten_bind_btCollisionWorld_debugDrawWorld_0).apply(null,arguments)},Se=t._emscripten_bind_btCollisionWorld_debugDrawObject_3=function(){return(Se=t._emscripten_bind_btCollisionWorld_debugDrawObject_3=t.asm.emscripten_bind_btCollisionWorld_debugDrawObject_3).apply(null,arguments)},xe=t._emscripten_bind_btCollisionWorld___destroy___0=function(){return(xe=t._emscripten_bind_btCollisionWorld___destroy___0=t.asm.emscripten_bind_btCollisionWorld___destroy___0).apply(null,arguments)},Te=t._emscripten_bind_btCollisionShape_setLocalScaling_1=function(){return(Te=t._emscripten_bind_btCollisionShape_setLocalScaling_1=t.asm.emscripten_bind_btCollisionShape_setLocalScaling_1).apply(null,arguments)},Ee=t._emscripten_bind_btCollisionShape_getLocalScaling_0=function(){return(Ee=t._emscripten_bind_btCollisionShape_getLocalScaling_0=t.asm.emscripten_bind_btCollisionShape_getLocalScaling_0).apply(null,arguments)},Re=t._emscripten_bind_btCollisionShape_calculateLocalInertia_2=function(){return(Re=t._emscripten_bind_btCollisionShape_calculateLocalInertia_2=t.asm.emscripten_bind_btCollisionShape_calculateLocalInertia_2).apply(null,arguments)},Pe=t._emscripten_bind_btCollisionShape_setMargin_1=function(){return(Pe=t._emscripten_bind_btCollisionShape_setMargin_1=t.asm.emscripten_bind_btCollisionShape_setMargin_1).apply(null,arguments)},Ie=t._emscripten_bind_btCollisionShape_getMargin_0=function(){return(Ie=t._emscripten_bind_btCollisionShape_getMargin_0=t.asm.emscripten_bind_btCollisionShape_getMargin_0).apply(null,arguments)},Me=t._emscripten_bind_btCollisionShape___destroy___0=function(){return(Me=t._emscripten_bind_btCollisionShape___destroy___0=t.asm.emscripten_bind_btCollisionShape___destroy___0).apply(null,arguments)},De=t._emscripten_bind_btCollisionObject_setAnisotropicFriction_2=function(){return(De=t._emscripten_bind_btCollisionObject_setAnisotropicFriction_2=t.asm.emscripten_bind_btCollisionObject_setAnisotropicFriction_2).apply(null,arguments)},Oe=t._emscripten_bind_btCollisionObject_getCollisionShape_0=function(){return(Oe=t._emscripten_bind_btCollisionObject_getCollisionShape_0=t.asm.emscripten_bind_btCollisionObject_getCollisionShape_0).apply(null,arguments)},we=t._emscripten_bind_btCollisionObject_setContactProcessingThreshold_1=function(){return(we=t._emscripten_bind_btCollisionObject_setContactProcessingThreshold_1=t.asm.emscripten_bind_btCollisionObject_setContactProcessingThreshold_1).apply(null,arguments)},Fe=t._emscripten_bind_btCollisionObject_setActivationState_1=function(){return(Fe=t._emscripten_bind_btCollisionObject_setActivationState_1=t.asm.emscripten_bind_btCollisionObject_setActivationState_1).apply(null,arguments)},Be=t._emscripten_bind_btCollisionObject_forceActivationState_1=function(){return(Be=t._emscripten_bind_btCollisionObject_forceActivationState_1=t.asm.emscripten_bind_btCollisionObject_forceActivationState_1).apply(null,arguments)},Ne=t._emscripten_bind_btCollisionObject_activate_0=function(){return(Ne=t._emscripten_bind_btCollisionObject_activate_0=t.asm.emscripten_bind_btCollisionObject_activate_0).apply(null,arguments)},Le=t._emscripten_bind_btCollisionObject_activate_1=function(){return(Le=t._emscripten_bind_btCollisionObject_activate_1=t.asm.emscripten_bind_btCollisionObject_activate_1).apply(null,arguments)},ke=t._emscripten_bind_btCollisionObject_isActive_0=function(){return(ke=t._emscripten_bind_btCollisionObject_isActive_0=t.asm.emscripten_bind_btCollisionObject_isActive_0).apply(null,arguments)},Ve=t._emscripten_bind_btCollisionObject_isKinematicObject_0=function(){return(Ve=t._emscripten_bind_btCollisionObject_isKinematicObject_0=t.asm.emscripten_bind_btCollisionObject_isKinematicObject_0).apply(null,arguments)},Ue=t._emscripten_bind_btCollisionObject_isStaticObject_0=function(){return(Ue=t._emscripten_bind_btCollisionObject_isStaticObject_0=t.asm.emscripten_bind_btCollisionObject_isStaticObject_0).apply(null,arguments)},Ge=t._emscripten_bind_btCollisionObject_isStaticOrKinematicObject_0=function(){return(Ge=t._emscripten_bind_btCollisionObject_isStaticOrKinematicObject_0=t.asm.emscripten_bind_btCollisionObject_isStaticOrKinematicObject_0).apply(null,arguments)},je=t._emscripten_bind_btCollisionObject_getRestitution_0=function(){return(je=t._emscripten_bind_btCollisionObject_getRestitution_0=t.asm.emscripten_bind_btCollisionObject_getRestitution_0).apply(null,arguments)},We=t._emscripten_bind_btCollisionObject_getFriction_0=function(){return(We=t._emscripten_bind_btCollisionObject_getFriction_0=t.asm.emscripten_bind_btCollisionObject_getFriction_0).apply(null,arguments)},ze=t._emscripten_bind_btCollisionObject_getRollingFriction_0=function(){return(ze=t._emscripten_bind_btCollisionObject_getRollingFriction_0=t.asm.emscripten_bind_btCollisionObject_getRollingFriction_0).apply(null,arguments)},He=t._emscripten_bind_btCollisionObject_setRestitution_1=function(){return(He=t._emscripten_bind_btCollisionObject_setRestitution_1=t.asm.emscripten_bind_btCollisionObject_setRestitution_1).apply(null,arguments)},Xe=t._emscripten_bind_btCollisionObject_setFriction_1=function(){return(Xe=t._emscripten_bind_btCollisionObject_setFriction_1=t.asm.emscripten_bind_btCollisionObject_setFriction_1).apply(null,arguments)},Ye=t._emscripten_bind_btCollisionObject_setRollingFriction_1=function(){return(Ye=t._emscripten_bind_btCollisionObject_setRollingFriction_1=t.asm.emscripten_bind_btCollisionObject_setRollingFriction_1).apply(null,arguments)},Qe=t._emscripten_bind_btCollisionObject_getWorldTransform_0=function(){return(Qe=t._emscripten_bind_btCollisionObject_getWorldTransform_0=t.asm.emscripten_bind_btCollisionObject_getWorldTransform_0).apply(null,arguments)},qe=t._emscripten_bind_btCollisionObject_getCollisionFlags_0=function(){return(qe=t._emscripten_bind_btCollisionObject_getCollisionFlags_0=t.asm.emscripten_bind_btCollisionObject_getCollisionFlags_0).apply(null,arguments)},Ke=t._emscripten_bind_btCollisionObject_setCollisionFlags_1=function(){return(Ke=t._emscripten_bind_btCollisionObject_setCollisionFlags_1=t.asm.emscripten_bind_btCollisionObject_setCollisionFlags_1).apply(null,arguments)},Ze=t._emscripten_bind_btCollisionObject_setWorldTransform_1=function(){return(Ze=t._emscripten_bind_btCollisionObject_setWorldTransform_1=t.asm.emscripten_bind_btCollisionObject_setWorldTransform_1).apply(null,arguments)},$e=t._emscripten_bind_btCollisionObject_setCollisionShape_1=function(){return($e=t._emscripten_bind_btCollisionObject_setCollisionShape_1=t.asm.emscripten_bind_btCollisionObject_setCollisionShape_1).apply(null,arguments)},Je=t._emscripten_bind_btCollisionObject_setCcdMotionThreshold_1=function(){return(Je=t._emscripten_bind_btCollisionObject_setCcdMotionThreshold_1=t.asm.emscripten_bind_btCollisionObject_setCcdMotionThreshold_1).apply(null,arguments)},et=t._emscripten_bind_btCollisionObject_setCcdSweptSphereRadius_1=function(){return(et=t._emscripten_bind_btCollisionObject_setCcdSweptSphereRadius_1=t.asm.emscripten_bind_btCollisionObject_setCcdSweptSphereRadius_1).apply(null,arguments)},tt=t._emscripten_bind_btCollisionObject_getUserIndex_0=function(){return(tt=t._emscripten_bind_btCollisionObject_getUserIndex_0=t.asm.emscripten_bind_btCollisionObject_getUserIndex_0).apply(null,arguments)},it=t._emscripten_bind_btCollisionObject_setUserIndex_1=function(){return(it=t._emscripten_bind_btCollisionObject_setUserIndex_1=t.asm.emscripten_bind_btCollisionObject_setUserIndex_1).apply(null,arguments)},nt=t._emscripten_bind_btCollisionObject_getUserPointer_0=function(){return(nt=t._emscripten_bind_btCollisionObject_getUserPointer_0=t.asm.emscripten_bind_btCollisionObject_getUserPointer_0).apply(null,arguments)},rt=t._emscripten_bind_btCollisionObject_setUserPointer_1=function(){return(rt=t._emscripten_bind_btCollisionObject_setUserPointer_1=t.asm.emscripten_bind_btCollisionObject_setUserPointer_1).apply(null,arguments)},st=t._emscripten_bind_btCollisionObject_getBroadphaseHandle_0=function(){return(st=t._emscripten_bind_btCollisionObject_getBroadphaseHandle_0=t.asm.emscripten_bind_btCollisionObject_getBroadphaseHandle_0).apply(null,arguments)},ot=t._emscripten_bind_btCollisionObject___destroy___0=function(){return(ot=t._emscripten_bind_btCollisionObject___destroy___0=t.asm.emscripten_bind_btCollisionObject___destroy___0).apply(null,arguments)},at=t._emscripten_bind_btDynamicsWorld_addAction_1=function(){return(at=t._emscripten_bind_btDynamicsWorld_addAction_1=t.asm.emscripten_bind_btDynamicsWorld_addAction_1).apply(null,arguments)},lt=t._emscripten_bind_btDynamicsWorld_removeAction_1=function(){return(lt=t._emscripten_bind_btDynamicsWorld_removeAction_1=t.asm.emscripten_bind_btDynamicsWorld_removeAction_1).apply(null,arguments)},ct=t._emscripten_bind_btDynamicsWorld_getSolverInfo_0=function(){return(ct=t._emscripten_bind_btDynamicsWorld_getSolverInfo_0=t.asm.emscripten_bind_btDynamicsWorld_getSolverInfo_0).apply(null,arguments)},ht=t._emscripten_bind_btDynamicsWorld_setInternalTickCallback_1=function(){return(ht=t._emscripten_bind_btDynamicsWorld_setInternalTickCallback_1=t.asm.emscripten_bind_btDynamicsWorld_setInternalTickCallback_1).apply(null,arguments)},_t=t._emscripten_bind_btDynamicsWorld_setInternalTickCallback_2=function(){return(_t=t._emscripten_bind_btDynamicsWorld_setInternalTickCallback_2=t.asm.emscripten_bind_btDynamicsWorld_setInternalTickCallback_2).apply(null,arguments)},dt=t._emscripten_bind_btDynamicsWorld_setInternalTickCallback_3=function(){return(dt=t._emscripten_bind_btDynamicsWorld_setInternalTickCallback_3=t.asm.emscripten_bind_btDynamicsWorld_setInternalTickCallback_3).apply(null,arguments)},ut=t._emscripten_bind_btDynamicsWorld_getDispatcher_0=function(){return(ut=t._emscripten_bind_btDynamicsWorld_getDispatcher_0=t.asm.emscripten_bind_btDynamicsWorld_getDispatcher_0).apply(null,arguments)},pt=t._emscripten_bind_btDynamicsWorld_rayTest_3=function(){return(pt=t._emscripten_bind_btDynamicsWorld_rayTest_3=t.asm.emscripten_bind_btDynamicsWorld_rayTest_3).apply(null,arguments)},ft=t._emscripten_bind_btDynamicsWorld_getPairCache_0=function(){return(ft=t._emscripten_bind_btDynamicsWorld_getPairCache_0=t.asm.emscripten_bind_btDynamicsWorld_getPairCache_0).apply(null,arguments)},mt=t._emscripten_bind_btDynamicsWorld_getDispatchInfo_0=function(){return(mt=t._emscripten_bind_btDynamicsWorld_getDispatchInfo_0=t.asm.emscripten_bind_btDynamicsWorld_getDispatchInfo_0).apply(null,arguments)},gt=t._emscripten_bind_btDynamicsWorld_addCollisionObject_1=function(){return(gt=t._emscripten_bind_btDynamicsWorld_addCollisionObject_1=t.asm.emscripten_bind_btDynamicsWorld_addCollisionObject_1).apply(null,arguments)},bt=t._emscripten_bind_btDynamicsWorld_addCollisionObject_2=function(){return(bt=t._emscripten_bind_btDynamicsWorld_addCollisionObject_2=t.asm.emscripten_bind_btDynamicsWorld_addCollisionObject_2).apply(null,arguments)},yt=t._emscripten_bind_btDynamicsWorld_addCollisionObject_3=function(){return(yt=t._emscripten_bind_btDynamicsWorld_addCollisionObject_3=t.asm.emscripten_bind_btDynamicsWorld_addCollisionObject_3).apply(null,arguments)},vt=t._emscripten_bind_btDynamicsWorld_removeCollisionObject_1=function(){return(vt=t._emscripten_bind_btDynamicsWorld_removeCollisionObject_1=t.asm.emscripten_bind_btDynamicsWorld_removeCollisionObject_1).apply(null,arguments)},At=t._emscripten_bind_btDynamicsWorld_getBroadphase_0=function(){return(At=t._emscripten_bind_btDynamicsWorld_getBroadphase_0=t.asm.emscripten_bind_btDynamicsWorld_getBroadphase_0).apply(null,arguments)},Ct=t._emscripten_bind_btDynamicsWorld_convexSweepTest_5=function(){return(Ct=t._emscripten_bind_btDynamicsWorld_convexSweepTest_5=t.asm.emscripten_bind_btDynamicsWorld_convexSweepTest_5).apply(null,arguments)},St=t._emscripten_bind_btDynamicsWorld_contactPairTest_3=function(){return(St=t._emscripten_bind_btDynamicsWorld_contactPairTest_3=t.asm.emscripten_bind_btDynamicsWorld_contactPairTest_3).apply(null,arguments)},xt=t._emscripten_bind_btDynamicsWorld_contactTest_2=function(){return(xt=t._emscripten_bind_btDynamicsWorld_contactTest_2=t.asm.emscripten_bind_btDynamicsWorld_contactTest_2).apply(null,arguments)},Tt=t._emscripten_bind_btDynamicsWorld_updateSingleAabb_1=function(){return(Tt=t._emscripten_bind_btDynamicsWorld_updateSingleAabb_1=t.asm.emscripten_bind_btDynamicsWorld_updateSingleAabb_1).apply(null,arguments)},Et=t._emscripten_bind_btDynamicsWorld_setDebugDrawer_1=function(){return(Et=t._emscripten_bind_btDynamicsWorld_setDebugDrawer_1=t.asm.emscripten_bind_btDynamicsWorld_setDebugDrawer_1).apply(null,arguments)},Rt=t._emscripten_bind_btDynamicsWorld_getDebugDrawer_0=function(){return(Rt=t._emscripten_bind_btDynamicsWorld_getDebugDrawer_0=t.asm.emscripten_bind_btDynamicsWorld_getDebugDrawer_0).apply(null,arguments)},Pt=t._emscripten_bind_btDynamicsWorld_debugDrawWorld_0=function(){return(Pt=t._emscripten_bind_btDynamicsWorld_debugDrawWorld_0=t.asm.emscripten_bind_btDynamicsWorld_debugDrawWorld_0).apply(null,arguments)},It=t._emscripten_bind_btDynamicsWorld_debugDrawObject_3=function(){return(It=t._emscripten_bind_btDynamicsWorld_debugDrawObject_3=t.asm.emscripten_bind_btDynamicsWorld_debugDrawObject_3).apply(null,arguments)},Mt=t._emscripten_bind_btDynamicsWorld___destroy___0=function(){return(Mt=t._emscripten_bind_btDynamicsWorld___destroy___0=t.asm.emscripten_bind_btDynamicsWorld___destroy___0).apply(null,arguments)},Dt=t._emscripten_bind_btTypedConstraint_enableFeedback_1=function(){return(Dt=t._emscripten_bind_btTypedConstraint_enableFeedback_1=t.asm.emscripten_bind_btTypedConstraint_enableFeedback_1).apply(null,arguments)},Ot=t._emscripten_bind_btTypedConstraint_getBreakingImpulseThreshold_0=function(){return(Ot=t._emscripten_bind_btTypedConstraint_getBreakingImpulseThreshold_0=t.asm.emscripten_bind_btTypedConstraint_getBreakingImpulseThreshold_0).apply(null,arguments)},wt=t._emscripten_bind_btTypedConstraint_setBreakingImpulseThreshold_1=function(){return(wt=t._emscripten_bind_btTypedConstraint_setBreakingImpulseThreshold_1=t.asm.emscripten_bind_btTypedConstraint_setBreakingImpulseThreshold_1).apply(null,arguments)},Ft=t._emscripten_bind_btTypedConstraint_getParam_2=function(){return(Ft=t._emscripten_bind_btTypedConstraint_getParam_2=t.asm.emscripten_bind_btTypedConstraint_getParam_2).apply(null,arguments)},Bt=t._emscripten_bind_btTypedConstraint_setParam_3=function(){return(Bt=t._emscripten_bind_btTypedConstraint_setParam_3=t.asm.emscripten_bind_btTypedConstraint_setParam_3).apply(null,arguments)},Nt=t._emscripten_bind_btTypedConstraint___destroy___0=function(){return(Nt=t._emscripten_bind_btTypedConstraint___destroy___0=t.asm.emscripten_bind_btTypedConstraint___destroy___0).apply(null,arguments)},Lt=t._emscripten_bind_btConcaveShape_setLocalScaling_1=function(){return(Lt=t._emscripten_bind_btConcaveShape_setLocalScaling_1=t.asm.emscripten_bind_btConcaveShape_setLocalScaling_1).apply(null,arguments)},kt=t._emscripten_bind_btConcaveShape_getLocalScaling_0=function(){return(kt=t._emscripten_bind_btConcaveShape_getLocalScaling_0=t.asm.emscripten_bind_btConcaveShape_getLocalScaling_0).apply(null,arguments)},Vt=t._emscripten_bind_btConcaveShape_calculateLocalInertia_2=function(){return(Vt=t._emscripten_bind_btConcaveShape_calculateLocalInertia_2=t.asm.emscripten_bind_btConcaveShape_calculateLocalInertia_2).apply(null,arguments)},Ut=t._emscripten_bind_btConcaveShape___destroy___0=function(){return(Ut=t._emscripten_bind_btConcaveShape___destroy___0=t.asm.emscripten_bind_btConcaveShape___destroy___0).apply(null,arguments)},Gt=t._emscripten_bind_btCapsuleShape_btCapsuleShape_2=function(){return(Gt=t._emscripten_bind_btCapsuleShape_btCapsuleShape_2=t.asm.emscripten_bind_btCapsuleShape_btCapsuleShape_2).apply(null,arguments)},jt=t._emscripten_bind_btCapsuleShape_setMargin_1=function(){return(jt=t._emscripten_bind_btCapsuleShape_setMargin_1=t.asm.emscripten_bind_btCapsuleShape_setMargin_1).apply(null,arguments)},Wt=t._emscripten_bind_btCapsuleShape_getMargin_0=function(){return(Wt=t._emscripten_bind_btCapsuleShape_getMargin_0=t.asm.emscripten_bind_btCapsuleShape_getMargin_0).apply(null,arguments)},zt=t._emscripten_bind_btCapsuleShape_getUpAxis_0=function(){return(zt=t._emscripten_bind_btCapsuleShape_getUpAxis_0=t.asm.emscripten_bind_btCapsuleShape_getUpAxis_0).apply(null,arguments)},Ht=t._emscripten_bind_btCapsuleShape_getRadius_0=function(){return(Ht=t._emscripten_bind_btCapsuleShape_getRadius_0=t.asm.emscripten_bind_btCapsuleShape_getRadius_0).apply(null,arguments)},Xt=t._emscripten_bind_btCapsuleShape_getHalfHeight_0=function(){return(Xt=t._emscripten_bind_btCapsuleShape_getHalfHeight_0=t.asm.emscripten_bind_btCapsuleShape_getHalfHeight_0).apply(null,arguments)},Yt=t._emscripten_bind_btCapsuleShape_setLocalScaling_1=function(){return(Yt=t._emscripten_bind_btCapsuleShape_setLocalScaling_1=t.asm.emscripten_bind_btCapsuleShape_setLocalScaling_1).apply(null,arguments)},Qt=t._emscripten_bind_btCapsuleShape_getLocalScaling_0=function(){return(Qt=t._emscripten_bind_btCapsuleShape_getLocalScaling_0=t.asm.emscripten_bind_btCapsuleShape_getLocalScaling_0).apply(null,arguments)},qt=t._emscripten_bind_btCapsuleShape_calculateLocalInertia_2=function(){return(qt=t._emscripten_bind_btCapsuleShape_calculateLocalInertia_2=t.asm.emscripten_bind_btCapsuleShape_calculateLocalInertia_2).apply(null,arguments)},Kt=t._emscripten_bind_btCapsuleShape___destroy___0=function(){return(Kt=t._emscripten_bind_btCapsuleShape___destroy___0=t.asm.emscripten_bind_btCapsuleShape___destroy___0).apply(null,arguments)},Zt=t._emscripten_bind_btIDebugDraw_drawLine_3=function(){return(Zt=t._emscripten_bind_btIDebugDraw_drawLine_3=t.asm.emscripten_bind_btIDebugDraw_drawLine_3).apply(null,arguments)},$t=t._emscripten_bind_btIDebugDraw_drawContactPoint_5=function(){return($t=t._emscripten_bind_btIDebugDraw_drawContactPoint_5=t.asm.emscripten_bind_btIDebugDraw_drawContactPoint_5).apply(null,arguments)},Jt=t._emscripten_bind_btIDebugDraw_reportErrorWarning_1=function(){return(Jt=t._emscripten_bind_btIDebugDraw_reportErrorWarning_1=t.asm.emscripten_bind_btIDebugDraw_reportErrorWarning_1).apply(null,arguments)},ei=t._emscripten_bind_btIDebugDraw_draw3dText_2=function(){return(ei=t._emscripten_bind_btIDebugDraw_draw3dText_2=t.asm.emscripten_bind_btIDebugDraw_draw3dText_2).apply(null,arguments)},ti=t._emscripten_bind_btIDebugDraw_setDebugMode_1=function(){return(ti=t._emscripten_bind_btIDebugDraw_setDebugMode_1=t.asm.emscripten_bind_btIDebugDraw_setDebugMode_1).apply(null,arguments)},ii=t._emscripten_bind_btIDebugDraw_getDebugMode_0=function(){return(ii=t._emscripten_bind_btIDebugDraw_getDebugMode_0=t.asm.emscripten_bind_btIDebugDraw_getDebugMode_0).apply(null,arguments)},ni=t._emscripten_bind_btIDebugDraw___destroy___0=function(){return(ni=t._emscripten_bind_btIDebugDraw___destroy___0=t.asm.emscripten_bind_btIDebugDraw___destroy___0).apply(null,arguments)},ri=t._emscripten_bind_btDefaultCollisionConfiguration_btDefaultCollisionConfiguration_0=function(){return(ri=t._emscripten_bind_btDefaultCollisionConfiguration_btDefaultCollisionConfiguration_0=t.asm.emscripten_bind_btDefaultCollisionConfiguration_btDefaultCollisionConfiguration_0).apply(null,arguments)},si=t._emscripten_bind_btDefaultCollisionConfiguration_btDefaultCollisionConfiguration_1=function(){return(si=t._emscripten_bind_btDefaultCollisionConfiguration_btDefaultCollisionConfiguration_1=t.asm.emscripten_bind_btDefaultCollisionConfiguration_btDefaultCollisionConfiguration_1).apply(null,arguments)},oi=t._emscripten_bind_btDefaultCollisionConfiguration___destroy___0=function(){return(oi=t._emscripten_bind_btDefaultCollisionConfiguration___destroy___0=t.asm.emscripten_bind_btDefaultCollisionConfiguration___destroy___0).apply(null,arguments)},ai=t._emscripten_bind_btTriangleMeshShape_setLocalScaling_1=function(){return(ai=t._emscripten_bind_btTriangleMeshShape_setLocalScaling_1=t.asm.emscripten_bind_btTriangleMeshShape_setLocalScaling_1).apply(null,arguments)},li=t._emscripten_bind_btTriangleMeshShape_getLocalScaling_0=function(){return(li=t._emscripten_bind_btTriangleMeshShape_getLocalScaling_0=t.asm.emscripten_bind_btTriangleMeshShape_getLocalScaling_0).apply(null,arguments)},ci=t._emscripten_bind_btTriangleMeshShape_calculateLocalInertia_2=function(){return(ci=t._emscripten_bind_btTriangleMeshShape_calculateLocalInertia_2=t.asm.emscripten_bind_btTriangleMeshShape_calculateLocalInertia_2).apply(null,arguments)},hi=t._emscripten_bind_btTriangleMeshShape___destroy___0=function(){return(hi=t._emscripten_bind_btTriangleMeshShape___destroy___0=t.asm.emscripten_bind_btTriangleMeshShape___destroy___0).apply(null,arguments)},_i=t._emscripten_bind_btGhostObject_btGhostObject_0=function(){return(_i=t._emscripten_bind_btGhostObject_btGhostObject_0=t.asm.emscripten_bind_btGhostObject_btGhostObject_0).apply(null,arguments)},di=t._emscripten_bind_btGhostObject_getNumOverlappingObjects_0=function(){return(di=t._emscripten_bind_btGhostObject_getNumOverlappingObjects_0=t.asm.emscripten_bind_btGhostObject_getNumOverlappingObjects_0).apply(null,arguments)},ui=t._emscripten_bind_btGhostObject_getOverlappingObject_1=function(){return(ui=t._emscripten_bind_btGhostObject_getOverlappingObject_1=t.asm.emscripten_bind_btGhostObject_getOverlappingObject_1).apply(null,arguments)},pi=t._emscripten_bind_btGhostObject_setAnisotropicFriction_2=function(){return(pi=t._emscripten_bind_btGhostObject_setAnisotropicFriction_2=t.asm.emscripten_bind_btGhostObject_setAnisotropicFriction_2).apply(null,arguments)},fi=t._emscripten_bind_btGhostObject_getCollisionShape_0=function(){return(fi=t._emscripten_bind_btGhostObject_getCollisionShape_0=t.asm.emscripten_bind_btGhostObject_getCollisionShape_0).apply(null,arguments)},mi=t._emscripten_bind_btGhostObject_setContactProcessingThreshold_1=function(){return(mi=t._emscripten_bind_btGhostObject_setContactProcessingThreshold_1=t.asm.emscripten_bind_btGhostObject_setContactProcessingThreshold_1).apply(null,arguments)},gi=t._emscripten_bind_btGhostObject_setActivationState_1=function(){return(gi=t._emscripten_bind_btGhostObject_setActivationState_1=t.asm.emscripten_bind_btGhostObject_setActivationState_1).apply(null,arguments)},bi=t._emscripten_bind_btGhostObject_forceActivationState_1=function(){return(bi=t._emscripten_bind_btGhostObject_forceActivationState_1=t.asm.emscripten_bind_btGhostObject_forceActivationState_1).apply(null,arguments)},yi=t._emscripten_bind_btGhostObject_activate_0=function(){return(yi=t._emscripten_bind_btGhostObject_activate_0=t.asm.emscripten_bind_btGhostObject_activate_0).apply(null,arguments)},vi=t._emscripten_bind_btGhostObject_activate_1=function(){return(vi=t._emscripten_bind_btGhostObject_activate_1=t.asm.emscripten_bind_btGhostObject_activate_1).apply(null,arguments)},Ai=t._emscripten_bind_btGhostObject_isActive_0=function(){return(Ai=t._emscripten_bind_btGhostObject_isActive_0=t.asm.emscripten_bind_btGhostObject_isActive_0).apply(null,arguments)},Ci=t._emscripten_bind_btGhostObject_isKinematicObject_0=function(){return(Ci=t._emscripten_bind_btGhostObject_isKinematicObject_0=t.asm.emscripten_bind_btGhostObject_isKinematicObject_0).apply(null,arguments)},Si=t._emscripten_bind_btGhostObject_isStaticObject_0=function(){return(Si=t._emscripten_bind_btGhostObject_isStaticObject_0=t.asm.emscripten_bind_btGhostObject_isStaticObject_0).apply(null,arguments)},xi=t._emscripten_bind_btGhostObject_isStaticOrKinematicObject_0=function(){return(xi=t._emscripten_bind_btGhostObject_isStaticOrKinematicObject_0=t.asm.emscripten_bind_btGhostObject_isStaticOrKinematicObject_0).apply(null,arguments)},Ti=t._emscripten_bind_btGhostObject_getRestitution_0=function(){return(Ti=t._emscripten_bind_btGhostObject_getRestitution_0=t.asm.emscripten_bind_btGhostObject_getRestitution_0).apply(null,arguments)},Ei=t._emscripten_bind_btGhostObject_getFriction_0=function(){return(Ei=t._emscripten_bind_btGhostObject_getFriction_0=t.asm.emscripten_bind_btGhostObject_getFriction_0).apply(null,arguments)},Ri=t._emscripten_bind_btGhostObject_getRollingFriction_0=function(){return(Ri=t._emscripten_bind_btGhostObject_getRollingFriction_0=t.asm.emscripten_bind_btGhostObject_getRollingFriction_0).apply(null,arguments)},Pi=t._emscripten_bind_btGhostObject_setRestitution_1=function(){return(Pi=t._emscripten_bind_btGhostObject_setRestitution_1=t.asm.emscripten_bind_btGhostObject_setRestitution_1).apply(null,arguments)},Ii=t._emscripten_bind_btGhostObject_setFriction_1=function(){return(Ii=t._emscripten_bind_btGhostObject_setFriction_1=t.asm.emscripten_bind_btGhostObject_setFriction_1).apply(null,arguments)},Mi=t._emscripten_bind_btGhostObject_setRollingFriction_1=function(){return(Mi=t._emscripten_bind_btGhostObject_setRollingFriction_1=t.asm.emscripten_bind_btGhostObject_setRollingFriction_1).apply(null,arguments)},Di=t._emscripten_bind_btGhostObject_getWorldTransform_0=function(){return(Di=t._emscripten_bind_btGhostObject_getWorldTransform_0=t.asm.emscripten_bind_btGhostObject_getWorldTransform_0).apply(null,arguments)},Oi=t._emscripten_bind_btGhostObject_getCollisionFlags_0=function(){return(Oi=t._emscripten_bind_btGhostObject_getCollisionFlags_0=t.asm.emscripten_bind_btGhostObject_getCollisionFlags_0).apply(null,arguments)},wi=t._emscripten_bind_btGhostObject_setCollisionFlags_1=function(){return(wi=t._emscripten_bind_btGhostObject_setCollisionFlags_1=t.asm.emscripten_bind_btGhostObject_setCollisionFlags_1).apply(null,arguments)},Fi=t._emscripten_bind_btGhostObject_setWorldTransform_1=function(){return(Fi=t._emscripten_bind_btGhostObject_setWorldTransform_1=t.asm.emscripten_bind_btGhostObject_setWorldTransform_1).apply(null,arguments)},Bi=t._emscripten_bind_btGhostObject_setCollisionShape_1=function(){return(Bi=t._emscripten_bind_btGhostObject_setCollisionShape_1=t.asm.emscripten_bind_btGhostObject_setCollisionShape_1).apply(null,arguments)},Ni=t._emscripten_bind_btGhostObject_setCcdMotionThreshold_1=function(){return(Ni=t._emscripten_bind_btGhostObject_setCcdMotionThreshold_1=t.asm.emscripten_bind_btGhostObject_setCcdMotionThreshold_1).apply(null,arguments)},Li=t._emscripten_bind_btGhostObject_setCcdSweptSphereRadius_1=function(){return(Li=t._emscripten_bind_btGhostObject_setCcdSweptSphereRadius_1=t.asm.emscripten_bind_btGhostObject_setCcdSweptSphereRadius_1).apply(null,arguments)},ki=t._emscripten_bind_btGhostObject_getUserIndex_0=function(){return(ki=t._emscripten_bind_btGhostObject_getUserIndex_0=t.asm.emscripten_bind_btGhostObject_getUserIndex_0).apply(null,arguments)},Vi=t._emscripten_bind_btGhostObject_setUserIndex_1=function(){return(Vi=t._emscripten_bind_btGhostObject_setUserIndex_1=t.asm.emscripten_bind_btGhostObject_setUserIndex_1).apply(null,arguments)},Ui=t._emscripten_bind_btGhostObject_getUserPointer_0=function(){return(Ui=t._emscripten_bind_btGhostObject_getUserPointer_0=t.asm.emscripten_bind_btGhostObject_getUserPointer_0).apply(null,arguments)},Gi=t._emscripten_bind_btGhostObject_setUserPointer_1=function(){return(Gi=t._emscripten_bind_btGhostObject_setUserPointer_1=t.asm.emscripten_bind_btGhostObject_setUserPointer_1).apply(null,arguments)},ji=t._emscripten_bind_btGhostObject_getBroadphaseHandle_0=function(){return(ji=t._emscripten_bind_btGhostObject_getBroadphaseHandle_0=t.asm.emscripten_bind_btGhostObject_getBroadphaseHandle_0).apply(null,arguments)},Wi=t._emscripten_bind_btGhostObject___destroy___0=function(){return(Wi=t._emscripten_bind_btGhostObject___destroy___0=t.asm.emscripten_bind_btGhostObject___destroy___0).apply(null,arguments)},zi=t._emscripten_bind_btConeShape_btConeShape_2=function(){return(zi=t._emscripten_bind_btConeShape_btConeShape_2=t.asm.emscripten_bind_btConeShape_btConeShape_2).apply(null,arguments)},Hi=t._emscripten_bind_btConeShape_setLocalScaling_1=function(){return(Hi=t._emscripten_bind_btConeShape_setLocalScaling_1=t.asm.emscripten_bind_btConeShape_setLocalScaling_1).apply(null,arguments)},Xi=t._emscripten_bind_btConeShape_getLocalScaling_0=function(){return(Xi=t._emscripten_bind_btConeShape_getLocalScaling_0=t.asm.emscripten_bind_btConeShape_getLocalScaling_0).apply(null,arguments)},Yi=t._emscripten_bind_btConeShape_calculateLocalInertia_2=function(){return(Yi=t._emscripten_bind_btConeShape_calculateLocalInertia_2=t.asm.emscripten_bind_btConeShape_calculateLocalInertia_2).apply(null,arguments)},Qi=t._emscripten_bind_btConeShape___destroy___0=function(){return(Qi=t._emscripten_bind_btConeShape___destroy___0=t.asm.emscripten_bind_btConeShape___destroy___0).apply(null,arguments)},qi=t._emscripten_bind_btActionInterface_updateAction_2=function(){return(qi=t._emscripten_bind_btActionInterface_updateAction_2=t.asm.emscripten_bind_btActionInterface_updateAction_2).apply(null,arguments)},Ki=t._emscripten_bind_btActionInterface___destroy___0=function(){return(Ki=t._emscripten_bind_btActionInterface___destroy___0=t.asm.emscripten_bind_btActionInterface___destroy___0).apply(null,arguments)},Zi=t._emscripten_bind_btVector3_btVector3_0=function(){return(Zi=t._emscripten_bind_btVector3_btVector3_0=t.asm.emscripten_bind_btVector3_btVector3_0).apply(null,arguments)},$i=t._emscripten_bind_btVector3_btVector3_3=function(){return($i=t._emscripten_bind_btVector3_btVector3_3=t.asm.emscripten_bind_btVector3_btVector3_3).apply(null,arguments)},Ji=t._emscripten_bind_btVector3_length_0=function(){return(Ji=t._emscripten_bind_btVector3_length_0=t.asm.emscripten_bind_btVector3_length_0).apply(null,arguments)},en=t._emscripten_bind_btVector3_x_0=function(){return(en=t._emscripten_bind_btVector3_x_0=t.asm.emscripten_bind_btVector3_x_0).apply(null,arguments)},tn=t._emscripten_bind_btVector3_y_0=function(){return(tn=t._emscripten_bind_btVector3_y_0=t.asm.emscripten_bind_btVector3_y_0).apply(null,arguments)},nn=t._emscripten_bind_btVector3_z_0=function(){return(nn=t._emscripten_bind_btVector3_z_0=t.asm.emscripten_bind_btVector3_z_0).apply(null,arguments)},rn=t._emscripten_bind_btVector3_setX_1=function(){return(rn=t._emscripten_bind_btVector3_setX_1=t.asm.emscripten_bind_btVector3_setX_1).apply(null,arguments)},sn=t._emscripten_bind_btVector3_setY_1=function(){return(sn=t._emscripten_bind_btVector3_setY_1=t.asm.emscripten_bind_btVector3_setY_1).apply(null,arguments)},on=t._emscripten_bind_btVector3_setZ_1=function(){return(on=t._emscripten_bind_btVector3_setZ_1=t.asm.emscripten_bind_btVector3_setZ_1).apply(null,arguments)},an=t._emscripten_bind_btVector3_setValue_3=function(){return(an=t._emscripten_bind_btVector3_setValue_3=t.asm.emscripten_bind_btVector3_setValue_3).apply(null,arguments)},ln=t._emscripten_bind_btVector3_normalize_0=function(){return(ln=t._emscripten_bind_btVector3_normalize_0=t.asm.emscripten_bind_btVector3_normalize_0).apply(null,arguments)},cn=t._emscripten_bind_btVector3_rotate_2=function(){return(cn=t._emscripten_bind_btVector3_rotate_2=t.asm.emscripten_bind_btVector3_rotate_2).apply(null,arguments)},hn=t._emscripten_bind_btVector3_dot_1=function(){return(hn=t._emscripten_bind_btVector3_dot_1=t.asm.emscripten_bind_btVector3_dot_1).apply(null,arguments)},_n=t._emscripten_bind_btVector3_op_mul_1=function(){return(_n=t._emscripten_bind_btVector3_op_mul_1=t.asm.emscripten_bind_btVector3_op_mul_1).apply(null,arguments)},dn=t._emscripten_bind_btVector3_op_add_1=function(){return(dn=t._emscripten_bind_btVector3_op_add_1=t.asm.emscripten_bind_btVector3_op_add_1).apply(null,arguments)},un=t._emscripten_bind_btVector3_op_sub_1=function(){return(un=t._emscripten_bind_btVector3_op_sub_1=t.asm.emscripten_bind_btVector3_op_sub_1).apply(null,arguments)},pn=t._emscripten_bind_btVector3___destroy___0=function(){return(pn=t._emscripten_bind_btVector3___destroy___0=t.asm.emscripten_bind_btVector3___destroy___0).apply(null,arguments)},fn=t._emscripten_bind_btVehicleRaycaster_castRay_3=function(){return(fn=t._emscripten_bind_btVehicleRaycaster_castRay_3=t.asm.emscripten_bind_btVehicleRaycaster_castRay_3).apply(null,arguments)},mn=t._emscripten_bind_btVehicleRaycaster___destroy___0=function(){return(mn=t._emscripten_bind_btVehicleRaycaster___destroy___0=t.asm.emscripten_bind_btVehicleRaycaster___destroy___0).apply(null,arguments)},gn=t._emscripten_bind_btQuadWord_x_0=function(){return(gn=t._emscripten_bind_btQuadWord_x_0=t.asm.emscripten_bind_btQuadWord_x_0).apply(null,arguments)},bn=t._emscripten_bind_btQuadWord_y_0=function(){return(bn=t._emscripten_bind_btQuadWord_y_0=t.asm.emscripten_bind_btQuadWord_y_0).apply(null,arguments)},yn=t._emscripten_bind_btQuadWord_z_0=function(){return(yn=t._emscripten_bind_btQuadWord_z_0=t.asm.emscripten_bind_btQuadWord_z_0).apply(null,arguments)},vn=t._emscripten_bind_btQuadWord_w_0=function(){return(vn=t._emscripten_bind_btQuadWord_w_0=t.asm.emscripten_bind_btQuadWord_w_0).apply(null,arguments)},An=t._emscripten_bind_btQuadWord_setX_1=function(){return(An=t._emscripten_bind_btQuadWord_setX_1=t.asm.emscripten_bind_btQuadWord_setX_1).apply(null,arguments)},Cn=t._emscripten_bind_btQuadWord_setY_1=function(){return(Cn=t._emscripten_bind_btQuadWord_setY_1=t.asm.emscripten_bind_btQuadWord_setY_1).apply(null,arguments)},Sn=t._emscripten_bind_btQuadWord_setZ_1=function(){return(Sn=t._emscripten_bind_btQuadWord_setZ_1=t.asm.emscripten_bind_btQuadWord_setZ_1).apply(null,arguments)},xn=t._emscripten_bind_btQuadWord_setW_1=function(){return(xn=t._emscripten_bind_btQuadWord_setW_1=t.asm.emscripten_bind_btQuadWord_setW_1).apply(null,arguments)},Tn=t._emscripten_bind_btQuadWord___destroy___0=function(){return(Tn=t._emscripten_bind_btQuadWord___destroy___0=t.asm.emscripten_bind_btQuadWord___destroy___0).apply(null,arguments)},En=t._emscripten_bind_btCylinderShape_btCylinderShape_1=function(){return(En=t._emscripten_bind_btCylinderShape_btCylinderShape_1=t.asm.emscripten_bind_btCylinderShape_btCylinderShape_1).apply(null,arguments)},Rn=t._emscripten_bind_btCylinderShape_setMargin_1=function(){return(Rn=t._emscripten_bind_btCylinderShape_setMargin_1=t.asm.emscripten_bind_btCylinderShape_setMargin_1).apply(null,arguments)},Pn=t._emscripten_bind_btCylinderShape_getMargin_0=function(){return(Pn=t._emscripten_bind_btCylinderShape_getMargin_0=t.asm.emscripten_bind_btCylinderShape_getMargin_0).apply(null,arguments)},In=t._emscripten_bind_btCylinderShape_setLocalScaling_1=function(){return(In=t._emscripten_bind_btCylinderShape_setLocalScaling_1=t.asm.emscripten_bind_btCylinderShape_setLocalScaling_1).apply(null,arguments)},Mn=t._emscripten_bind_btCylinderShape_getLocalScaling_0=function(){return(Mn=t._emscripten_bind_btCylinderShape_getLocalScaling_0=t.asm.emscripten_bind_btCylinderShape_getLocalScaling_0).apply(null,arguments)},Dn=t._emscripten_bind_btCylinderShape_calculateLocalInertia_2=function(){return(Dn=t._emscripten_bind_btCylinderShape_calculateLocalInertia_2=t.asm.emscripten_bind_btCylinderShape_calculateLocalInertia_2).apply(null,arguments)},On=t._emscripten_bind_btCylinderShape___destroy___0=function(){return(On=t._emscripten_bind_btCylinderShape___destroy___0=t.asm.emscripten_bind_btCylinderShape___destroy___0).apply(null,arguments)},wn=t._emscripten_bind_btDiscreteDynamicsWorld_btDiscreteDynamicsWorld_4=function(){return(wn=t._emscripten_bind_btDiscreteDynamicsWorld_btDiscreteDynamicsWorld_4=t.asm.emscripten_bind_btDiscreteDynamicsWorld_btDiscreteDynamicsWorld_4).apply(null,arguments)},Fn=t._emscripten_bind_btDiscreteDynamicsWorld_setGravity_1=function(){return(Fn=t._emscripten_bind_btDiscreteDynamicsWorld_setGravity_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_setGravity_1).apply(null,arguments)},Bn=t._emscripten_bind_btDiscreteDynamicsWorld_getGravity_0=function(){return(Bn=t._emscripten_bind_btDiscreteDynamicsWorld_getGravity_0=t.asm.emscripten_bind_btDiscreteDynamicsWorld_getGravity_0).apply(null,arguments)},Nn=t._emscripten_bind_btDiscreteDynamicsWorld_addRigidBody_1=function(){return(Nn=t._emscripten_bind_btDiscreteDynamicsWorld_addRigidBody_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_addRigidBody_1).apply(null,arguments)},Ln=t._emscripten_bind_btDiscreteDynamicsWorld_addRigidBody_3=function(){return(Ln=t._emscripten_bind_btDiscreteDynamicsWorld_addRigidBody_3=t.asm.emscripten_bind_btDiscreteDynamicsWorld_addRigidBody_3).apply(null,arguments)},kn=t._emscripten_bind_btDiscreteDynamicsWorld_removeRigidBody_1=function(){return(kn=t._emscripten_bind_btDiscreteDynamicsWorld_removeRigidBody_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_removeRigidBody_1).apply(null,arguments)},Vn=t._emscripten_bind_btDiscreteDynamicsWorld_addConstraint_1=function(){return(Vn=t._emscripten_bind_btDiscreteDynamicsWorld_addConstraint_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_addConstraint_1).apply(null,arguments)},Un=t._emscripten_bind_btDiscreteDynamicsWorld_addConstraint_2=function(){return(Un=t._emscripten_bind_btDiscreteDynamicsWorld_addConstraint_2=t.asm.emscripten_bind_btDiscreteDynamicsWorld_addConstraint_2).apply(null,arguments)},Gn=t._emscripten_bind_btDiscreteDynamicsWorld_removeConstraint_1=function(){return(Gn=t._emscripten_bind_btDiscreteDynamicsWorld_removeConstraint_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_removeConstraint_1).apply(null,arguments)},jn=t._emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_1=function(){return(jn=t._emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_1).apply(null,arguments)},Wn=t._emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_2=function(){return(Wn=t._emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_2=t.asm.emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_2).apply(null,arguments)},zn=t._emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_3=function(){return(zn=t._emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_3=t.asm.emscripten_bind_btDiscreteDynamicsWorld_stepSimulation_3).apply(null,arguments)},Hn=t._emscripten_bind_btDiscreteDynamicsWorld_setContactAddedCallback_1=function(){return(Hn=t._emscripten_bind_btDiscreteDynamicsWorld_setContactAddedCallback_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_setContactAddedCallback_1).apply(null,arguments)},Xn=t._emscripten_bind_btDiscreteDynamicsWorld_setContactProcessedCallback_1=function(){return(Xn=t._emscripten_bind_btDiscreteDynamicsWorld_setContactProcessedCallback_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_setContactProcessedCallback_1).apply(null,arguments)},Yn=t._emscripten_bind_btDiscreteDynamicsWorld_setContactDestroyedCallback_1=function(){return(Yn=t._emscripten_bind_btDiscreteDynamicsWorld_setContactDestroyedCallback_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_setContactDestroyedCallback_1).apply(null,arguments)},Qn=t._emscripten_bind_btDiscreteDynamicsWorld_getDispatcher_0=function(){return(Qn=t._emscripten_bind_btDiscreteDynamicsWorld_getDispatcher_0=t.asm.emscripten_bind_btDiscreteDynamicsWorld_getDispatcher_0).apply(null,arguments)},qn=t._emscripten_bind_btDiscreteDynamicsWorld_rayTest_3=function(){return(qn=t._emscripten_bind_btDiscreteDynamicsWorld_rayTest_3=t.asm.emscripten_bind_btDiscreteDynamicsWorld_rayTest_3).apply(null,arguments)},Kn=t._emscripten_bind_btDiscreteDynamicsWorld_getPairCache_0=function(){return(Kn=t._emscripten_bind_btDiscreteDynamicsWorld_getPairCache_0=t.asm.emscripten_bind_btDiscreteDynamicsWorld_getPairCache_0).apply(null,arguments)},Zn=t._emscripten_bind_btDiscreteDynamicsWorld_getDispatchInfo_0=function(){return(Zn=t._emscripten_bind_btDiscreteDynamicsWorld_getDispatchInfo_0=t.asm.emscripten_bind_btDiscreteDynamicsWorld_getDispatchInfo_0).apply(null,arguments)},$n=t._emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_1=function(){return($n=t._emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_1).apply(null,arguments)},Jn=t._emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_2=function(){return(Jn=t._emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_2=t.asm.emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_2).apply(null,arguments)},er=t._emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_3=function(){return(er=t._emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_3=t.asm.emscripten_bind_btDiscreteDynamicsWorld_addCollisionObject_3).apply(null,arguments)},tr=t._emscripten_bind_btDiscreteDynamicsWorld_removeCollisionObject_1=function(){return(tr=t._emscripten_bind_btDiscreteDynamicsWorld_removeCollisionObject_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_removeCollisionObject_1).apply(null,arguments)},ir=t._emscripten_bind_btDiscreteDynamicsWorld_getBroadphase_0=function(){return(ir=t._emscripten_bind_btDiscreteDynamicsWorld_getBroadphase_0=t.asm.emscripten_bind_btDiscreteDynamicsWorld_getBroadphase_0).apply(null,arguments)},nr=t._emscripten_bind_btDiscreteDynamicsWorld_convexSweepTest_5=function(){return(nr=t._emscripten_bind_btDiscreteDynamicsWorld_convexSweepTest_5=t.asm.emscripten_bind_btDiscreteDynamicsWorld_convexSweepTest_5).apply(null,arguments)},rr=t._emscripten_bind_btDiscreteDynamicsWorld_contactPairTest_3=function(){return(rr=t._emscripten_bind_btDiscreteDynamicsWorld_contactPairTest_3=t.asm.emscripten_bind_btDiscreteDynamicsWorld_contactPairTest_3).apply(null,arguments)},sr=t._emscripten_bind_btDiscreteDynamicsWorld_contactTest_2=function(){return(sr=t._emscripten_bind_btDiscreteDynamicsWorld_contactTest_2=t.asm.emscripten_bind_btDiscreteDynamicsWorld_contactTest_2).apply(null,arguments)},or=t._emscripten_bind_btDiscreteDynamicsWorld_updateSingleAabb_1=function(){return(or=t._emscripten_bind_btDiscreteDynamicsWorld_updateSingleAabb_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_updateSingleAabb_1).apply(null,arguments)},ar=t._emscripten_bind_btDiscreteDynamicsWorld_setDebugDrawer_1=function(){return(ar=t._emscripten_bind_btDiscreteDynamicsWorld_setDebugDrawer_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_setDebugDrawer_1).apply(null,arguments)},lr=t._emscripten_bind_btDiscreteDynamicsWorld_getDebugDrawer_0=function(){return(lr=t._emscripten_bind_btDiscreteDynamicsWorld_getDebugDrawer_0=t.asm.emscripten_bind_btDiscreteDynamicsWorld_getDebugDrawer_0).apply(null,arguments)},cr=t._emscripten_bind_btDiscreteDynamicsWorld_debugDrawWorld_0=function(){return(cr=t._emscripten_bind_btDiscreteDynamicsWorld_debugDrawWorld_0=t.asm.emscripten_bind_btDiscreteDynamicsWorld_debugDrawWorld_0).apply(null,arguments)},hr=t._emscripten_bind_btDiscreteDynamicsWorld_debugDrawObject_3=function(){return(hr=t._emscripten_bind_btDiscreteDynamicsWorld_debugDrawObject_3=t.asm.emscripten_bind_btDiscreteDynamicsWorld_debugDrawObject_3).apply(null,arguments)},_r=t._emscripten_bind_btDiscreteDynamicsWorld_addAction_1=function(){return(_r=t._emscripten_bind_btDiscreteDynamicsWorld_addAction_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_addAction_1).apply(null,arguments)},dr=t._emscripten_bind_btDiscreteDynamicsWorld_removeAction_1=function(){return(dr=t._emscripten_bind_btDiscreteDynamicsWorld_removeAction_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_removeAction_1).apply(null,arguments)},ur=t._emscripten_bind_btDiscreteDynamicsWorld_getSolverInfo_0=function(){return(ur=t._emscripten_bind_btDiscreteDynamicsWorld_getSolverInfo_0=t.asm.emscripten_bind_btDiscreteDynamicsWorld_getSolverInfo_0).apply(null,arguments)},pr=t._emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_1=function(){return(pr=t._emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_1=t.asm.emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_1).apply(null,arguments)},fr=t._emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_2=function(){return(fr=t._emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_2=t.asm.emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_2).apply(null,arguments)},mr=t._emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_3=function(){return(mr=t._emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_3=t.asm.emscripten_bind_btDiscreteDynamicsWorld_setInternalTickCallback_3).apply(null,arguments)},gr=t._emscripten_bind_btDiscreteDynamicsWorld___destroy___0=function(){return(gr=t._emscripten_bind_btDiscreteDynamicsWorld___destroy___0=t.asm.emscripten_bind_btDiscreteDynamicsWorld___destroy___0).apply(null,arguments)},br=t._emscripten_bind_btConvexShape_setLocalScaling_1=function(){return(br=t._emscripten_bind_btConvexShape_setLocalScaling_1=t.asm.emscripten_bind_btConvexShape_setLocalScaling_1).apply(null,arguments)},yr=t._emscripten_bind_btConvexShape_getLocalScaling_0=function(){return(yr=t._emscripten_bind_btConvexShape_getLocalScaling_0=t.asm.emscripten_bind_btConvexShape_getLocalScaling_0).apply(null,arguments)},vr=t._emscripten_bind_btConvexShape_calculateLocalInertia_2=function(){return(vr=t._emscripten_bind_btConvexShape_calculateLocalInertia_2=t.asm.emscripten_bind_btConvexShape_calculateLocalInertia_2).apply(null,arguments)},Ar=t._emscripten_bind_btConvexShape_setMargin_1=function(){return(Ar=t._emscripten_bind_btConvexShape_setMargin_1=t.asm.emscripten_bind_btConvexShape_setMargin_1).apply(null,arguments)},Cr=t._emscripten_bind_btConvexShape_getMargin_0=function(){return(Cr=t._emscripten_bind_btConvexShape_getMargin_0=t.asm.emscripten_bind_btConvexShape_getMargin_0).apply(null,arguments)},Sr=t._emscripten_bind_btConvexShape___destroy___0=function(){return(Sr=t._emscripten_bind_btConvexShape___destroy___0=t.asm.emscripten_bind_btConvexShape___destroy___0).apply(null,arguments)},xr=t._emscripten_bind_btDispatcher_getNumManifolds_0=function(){return(xr=t._emscripten_bind_btDispatcher_getNumManifolds_0=t.asm.emscripten_bind_btDispatcher_getNumManifolds_0).apply(null,arguments)},Tr=t._emscripten_bind_btDispatcher_getManifoldByIndexInternal_1=function(){return(Tr=t._emscripten_bind_btDispatcher_getManifoldByIndexInternal_1=t.asm.emscripten_bind_btDispatcher_getManifoldByIndexInternal_1).apply(null,arguments)},Er=t._emscripten_bind_btDispatcher___destroy___0=function(){return(Er=t._emscripten_bind_btDispatcher___destroy___0=t.asm.emscripten_bind_btDispatcher___destroy___0).apply(null,arguments)},Rr=t._emscripten_bind_btGeneric6DofConstraint_btGeneric6DofConstraint_3=function(){return(Rr=t._emscripten_bind_btGeneric6DofConstraint_btGeneric6DofConstraint_3=t.asm.emscripten_bind_btGeneric6DofConstraint_btGeneric6DofConstraint_3).apply(null,arguments)},Pr=t._emscripten_bind_btGeneric6DofConstraint_btGeneric6DofConstraint_5=function(){return(Pr=t._emscripten_bind_btGeneric6DofConstraint_btGeneric6DofConstraint_5=t.asm.emscripten_bind_btGeneric6DofConstraint_btGeneric6DofConstraint_5).apply(null,arguments)},Ir=t._emscripten_bind_btGeneric6DofConstraint_setLinearLowerLimit_1=function(){return(Ir=t._emscripten_bind_btGeneric6DofConstraint_setLinearLowerLimit_1=t.asm.emscripten_bind_btGeneric6DofConstraint_setLinearLowerLimit_1).apply(null,arguments)},Mr=t._emscripten_bind_btGeneric6DofConstraint_setLinearUpperLimit_1=function(){return(Mr=t._emscripten_bind_btGeneric6DofConstraint_setLinearUpperLimit_1=t.asm.emscripten_bind_btGeneric6DofConstraint_setLinearUpperLimit_1).apply(null,arguments)},Dr=t._emscripten_bind_btGeneric6DofConstraint_setAngularLowerLimit_1=function(){return(Dr=t._emscripten_bind_btGeneric6DofConstraint_setAngularLowerLimit_1=t.asm.emscripten_bind_btGeneric6DofConstraint_setAngularLowerLimit_1).apply(null,arguments)},Or=t._emscripten_bind_btGeneric6DofConstraint_setAngularUpperLimit_1=function(){return(Or=t._emscripten_bind_btGeneric6DofConstraint_setAngularUpperLimit_1=t.asm.emscripten_bind_btGeneric6DofConstraint_setAngularUpperLimit_1).apply(null,arguments)},wr=t._emscripten_bind_btGeneric6DofConstraint_getFrameOffsetA_0=function(){return(wr=t._emscripten_bind_btGeneric6DofConstraint_getFrameOffsetA_0=t.asm.emscripten_bind_btGeneric6DofConstraint_getFrameOffsetA_0).apply(null,arguments)},Fr=t._emscripten_bind_btGeneric6DofConstraint_enableFeedback_1=function(){return(Fr=t._emscripten_bind_btGeneric6DofConstraint_enableFeedback_1=t.asm.emscripten_bind_btGeneric6DofConstraint_enableFeedback_1).apply(null,arguments)},Br=t._emscripten_bind_btGeneric6DofConstraint_getBreakingImpulseThreshold_0=function(){return(Br=t._emscripten_bind_btGeneric6DofConstraint_getBreakingImpulseThreshold_0=t.asm.emscripten_bind_btGeneric6DofConstraint_getBreakingImpulseThreshold_0).apply(null,arguments)},Nr=t._emscripten_bind_btGeneric6DofConstraint_setBreakingImpulseThreshold_1=function(){return(Nr=t._emscripten_bind_btGeneric6DofConstraint_setBreakingImpulseThreshold_1=t.asm.emscripten_bind_btGeneric6DofConstraint_setBreakingImpulseThreshold_1).apply(null,arguments)},Lr=t._emscripten_bind_btGeneric6DofConstraint_getParam_2=function(){return(Lr=t._emscripten_bind_btGeneric6DofConstraint_getParam_2=t.asm.emscripten_bind_btGeneric6DofConstraint_getParam_2).apply(null,arguments)},kr=t._emscripten_bind_btGeneric6DofConstraint_setParam_3=function(){return(kr=t._emscripten_bind_btGeneric6DofConstraint_setParam_3=t.asm.emscripten_bind_btGeneric6DofConstraint_setParam_3).apply(null,arguments)},Vr=t._emscripten_bind_btGeneric6DofConstraint___destroy___0=function(){return(Vr=t._emscripten_bind_btGeneric6DofConstraint___destroy___0=t.asm.emscripten_bind_btGeneric6DofConstraint___destroy___0).apply(null,arguments)},Ur=t._emscripten_bind_btStridingMeshInterface_setScaling_1=function(){return(Ur=t._emscripten_bind_btStridingMeshInterface_setScaling_1=t.asm.emscripten_bind_btStridingMeshInterface_setScaling_1).apply(null,arguments)},Gr=t._emscripten_bind_btStridingMeshInterface___destroy___0=function(){return(Gr=t._emscripten_bind_btStridingMeshInterface___destroy___0=t.asm.emscripten_bind_btStridingMeshInterface___destroy___0).apply(null,arguments)},jr=t._emscripten_bind_btMotionState_getWorldTransform_1=function(){return(jr=t._emscripten_bind_btMotionState_getWorldTransform_1=t.asm.emscripten_bind_btMotionState_getWorldTransform_1).apply(null,arguments)},Wr=t._emscripten_bind_btMotionState_setWorldTransform_1=function(){return(Wr=t._emscripten_bind_btMotionState_setWorldTransform_1=t.asm.emscripten_bind_btMotionState_setWorldTransform_1).apply(null,arguments)},zr=t._emscripten_bind_btMotionState___destroy___0=function(){return(zr=t._emscripten_bind_btMotionState___destroy___0=t.asm.emscripten_bind_btMotionState___destroy___0).apply(null,arguments)},Hr=t._emscripten_bind_ConvexResultCallback_hasHit_0=function(){return(Hr=t._emscripten_bind_ConvexResultCallback_hasHit_0=t.asm.emscripten_bind_ConvexResultCallback_hasHit_0).apply(null,arguments)},Xr=t._emscripten_bind_ConvexResultCallback_get_m_collisionFilterGroup_0=function(){return(Xr=t._emscripten_bind_ConvexResultCallback_get_m_collisionFilterGroup_0=t.asm.emscripten_bind_ConvexResultCallback_get_m_collisionFilterGroup_0).apply(null,arguments)},Yr=t._emscripten_bind_ConvexResultCallback_set_m_collisionFilterGroup_1=function(){return(Yr=t._emscripten_bind_ConvexResultCallback_set_m_collisionFilterGroup_1=t.asm.emscripten_bind_ConvexResultCallback_set_m_collisionFilterGroup_1).apply(null,arguments)},Qr=t._emscripten_bind_ConvexResultCallback_get_m_collisionFilterMask_0=function(){return(Qr=t._emscripten_bind_ConvexResultCallback_get_m_collisionFilterMask_0=t.asm.emscripten_bind_ConvexResultCallback_get_m_collisionFilterMask_0).apply(null,arguments)},qr=t._emscripten_bind_ConvexResultCallback_set_m_collisionFilterMask_1=function(){return(qr=t._emscripten_bind_ConvexResultCallback_set_m_collisionFilterMask_1=t.asm.emscripten_bind_ConvexResultCallback_set_m_collisionFilterMask_1).apply(null,arguments)},Kr=t._emscripten_bind_ConvexResultCallback_get_m_closestHitFraction_0=function(){return(Kr=t._emscripten_bind_ConvexResultCallback_get_m_closestHitFraction_0=t.asm.emscripten_bind_ConvexResultCallback_get_m_closestHitFraction_0).apply(null,arguments)},Zr=t._emscripten_bind_ConvexResultCallback_set_m_closestHitFraction_1=function(){return(Zr=t._emscripten_bind_ConvexResultCallback_set_m_closestHitFraction_1=t.asm.emscripten_bind_ConvexResultCallback_set_m_closestHitFraction_1).apply(null,arguments)},$r=t._emscripten_bind_ConvexResultCallback___destroy___0=function(){return($r=t._emscripten_bind_ConvexResultCallback___destroy___0=t.asm.emscripten_bind_ConvexResultCallback___destroy___0).apply(null,arguments)},Jr=t._emscripten_bind_ContactResultCallback_addSingleResult_7=function(){return(Jr=t._emscripten_bind_ContactResultCallback_addSingleResult_7=t.asm.emscripten_bind_ContactResultCallback_addSingleResult_7).apply(null,arguments)},es=t._emscripten_bind_ContactResultCallback___destroy___0=function(){return(es=t._emscripten_bind_ContactResultCallback___destroy___0=t.asm.emscripten_bind_ContactResultCallback___destroy___0).apply(null,arguments)},ts=t._emscripten_bind_btSoftBodySolver___destroy___0=function(){return(ts=t._emscripten_bind_btSoftBodySolver___destroy___0=t.asm.emscripten_bind_btSoftBodySolver___destroy___0).apply(null,arguments)},is=t._emscripten_bind_RayResultCallback_hasHit_0=function(){return(is=t._emscripten_bind_RayResultCallback_hasHit_0=t.asm.emscripten_bind_RayResultCallback_hasHit_0).apply(null,arguments)},ns=t._emscripten_bind_RayResultCallback_get_m_collisionFilterGroup_0=function(){return(ns=t._emscripten_bind_RayResultCallback_get_m_collisionFilterGroup_0=t.asm.emscripten_bind_RayResultCallback_get_m_collisionFilterGroup_0).apply(null,arguments)},rs=t._emscripten_bind_RayResultCallback_set_m_collisionFilterGroup_1=function(){return(rs=t._emscripten_bind_RayResultCallback_set_m_collisionFilterGroup_1=t.asm.emscripten_bind_RayResultCallback_set_m_collisionFilterGroup_1).apply(null,arguments)},ss=t._emscripten_bind_RayResultCallback_get_m_collisionFilterMask_0=function(){return(ss=t._emscripten_bind_RayResultCallback_get_m_collisionFilterMask_0=t.asm.emscripten_bind_RayResultCallback_get_m_collisionFilterMask_0).apply(null,arguments)},os=t._emscripten_bind_RayResultCallback_set_m_collisionFilterMask_1=function(){return(os=t._emscripten_bind_RayResultCallback_set_m_collisionFilterMask_1=t.asm.emscripten_bind_RayResultCallback_set_m_collisionFilterMask_1).apply(null,arguments)},as=t._emscripten_bind_RayResultCallback_get_m_closestHitFraction_0=function(){return(as=t._emscripten_bind_RayResultCallback_get_m_closestHitFraction_0=t.asm.emscripten_bind_RayResultCallback_get_m_closestHitFraction_0).apply(null,arguments)},ls=t._emscripten_bind_RayResultCallback_set_m_closestHitFraction_1=function(){return(ls=t._emscripten_bind_RayResultCallback_set_m_closestHitFraction_1=t.asm.emscripten_bind_RayResultCallback_set_m_closestHitFraction_1).apply(null,arguments)},cs=t._emscripten_bind_RayResultCallback_get_m_collisionObject_0=function(){return(cs=t._emscripten_bind_RayResultCallback_get_m_collisionObject_0=t.asm.emscripten_bind_RayResultCallback_get_m_collisionObject_0).apply(null,arguments)},hs=t._emscripten_bind_RayResultCallback_set_m_collisionObject_1=function(){return(hs=t._emscripten_bind_RayResultCallback_set_m_collisionObject_1=t.asm.emscripten_bind_RayResultCallback_set_m_collisionObject_1).apply(null,arguments)},_s=t._emscripten_bind_RayResultCallback___destroy___0=function(){return(_s=t._emscripten_bind_RayResultCallback___destroy___0=t.asm.emscripten_bind_RayResultCallback___destroy___0).apply(null,arguments)},ds=t._emscripten_bind_btMatrix3x3_setEulerZYX_3=function(){return(ds=t._emscripten_bind_btMatrix3x3_setEulerZYX_3=t.asm.emscripten_bind_btMatrix3x3_setEulerZYX_3).apply(null,arguments)},us=t._emscripten_bind_btMatrix3x3_getRotation_1=function(){return(us=t._emscripten_bind_btMatrix3x3_getRotation_1=t.asm.emscripten_bind_btMatrix3x3_getRotation_1).apply(null,arguments)},ps=t._emscripten_bind_btMatrix3x3_getRow_1=function(){return(ps=t._emscripten_bind_btMatrix3x3_getRow_1=t.asm.emscripten_bind_btMatrix3x3_getRow_1).apply(null,arguments)},fs=t._emscripten_bind_btMatrix3x3___destroy___0=function(){return(fs=t._emscripten_bind_btMatrix3x3___destroy___0=t.asm.emscripten_bind_btMatrix3x3___destroy___0).apply(null,arguments)},ms=t._emscripten_bind_btScalarArray_size_0=function(){return(ms=t._emscripten_bind_btScalarArray_size_0=t.asm.emscripten_bind_btScalarArray_size_0).apply(null,arguments)},gs=t._emscripten_bind_btScalarArray_at_1=function(){return(gs=t._emscripten_bind_btScalarArray_at_1=t.asm.emscripten_bind_btScalarArray_at_1).apply(null,arguments)},bs=t._emscripten_bind_btScalarArray___destroy___0=function(){return(bs=t._emscripten_bind_btScalarArray___destroy___0=t.asm.emscripten_bind_btScalarArray___destroy___0).apply(null,arguments)},ys=t._emscripten_bind_Material_get_m_kLST_0=function(){return(ys=t._emscripten_bind_Material_get_m_kLST_0=t.asm.emscripten_bind_Material_get_m_kLST_0).apply(null,arguments)},vs=t._emscripten_bind_Material_set_m_kLST_1=function(){return(vs=t._emscripten_bind_Material_set_m_kLST_1=t.asm.emscripten_bind_Material_set_m_kLST_1).apply(null,arguments)},As=t._emscripten_bind_Material_get_m_kAST_0=function(){return(As=t._emscripten_bind_Material_get_m_kAST_0=t.asm.emscripten_bind_Material_get_m_kAST_0).apply(null,arguments)},Cs=t._emscripten_bind_Material_set_m_kAST_1=function(){return(Cs=t._emscripten_bind_Material_set_m_kAST_1=t.asm.emscripten_bind_Material_set_m_kAST_1).apply(null,arguments)},Ss=t._emscripten_bind_Material_get_m_kVST_0=function(){return(Ss=t._emscripten_bind_Material_get_m_kVST_0=t.asm.emscripten_bind_Material_get_m_kVST_0).apply(null,arguments)},xs=t._emscripten_bind_Material_set_m_kVST_1=function(){return(xs=t._emscripten_bind_Material_set_m_kVST_1=t.asm.emscripten_bind_Material_set_m_kVST_1).apply(null,arguments)},Ts=t._emscripten_bind_Material_get_m_flags_0=function(){return(Ts=t._emscripten_bind_Material_get_m_flags_0=t.asm.emscripten_bind_Material_get_m_flags_0).apply(null,arguments)},Es=t._emscripten_bind_Material_set_m_flags_1=function(){return(Es=t._emscripten_bind_Material_set_m_flags_1=t.asm.emscripten_bind_Material_set_m_flags_1).apply(null,arguments)},Rs=t._emscripten_bind_Material___destroy___0=function(){return(Rs=t._emscripten_bind_Material___destroy___0=t.asm.emscripten_bind_Material___destroy___0).apply(null,arguments)},Ps=t._emscripten_bind_btDispatcherInfo_get_m_timeStep_0=function(){return(Ps=t._emscripten_bind_btDispatcherInfo_get_m_timeStep_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_timeStep_0).apply(null,arguments)},Is=t._emscripten_bind_btDispatcherInfo_set_m_timeStep_1=function(){return(Is=t._emscripten_bind_btDispatcherInfo_set_m_timeStep_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_timeStep_1).apply(null,arguments)},Ms=t._emscripten_bind_btDispatcherInfo_get_m_stepCount_0=function(){return(Ms=t._emscripten_bind_btDispatcherInfo_get_m_stepCount_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_stepCount_0).apply(null,arguments)},Ds=t._emscripten_bind_btDispatcherInfo_set_m_stepCount_1=function(){return(Ds=t._emscripten_bind_btDispatcherInfo_set_m_stepCount_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_stepCount_1).apply(null,arguments)},Os=t._emscripten_bind_btDispatcherInfo_get_m_dispatchFunc_0=function(){return(Os=t._emscripten_bind_btDispatcherInfo_get_m_dispatchFunc_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_dispatchFunc_0).apply(null,arguments)},ws=t._emscripten_bind_btDispatcherInfo_set_m_dispatchFunc_1=function(){return(ws=t._emscripten_bind_btDispatcherInfo_set_m_dispatchFunc_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_dispatchFunc_1).apply(null,arguments)},Fs=t._emscripten_bind_btDispatcherInfo_get_m_timeOfImpact_0=function(){return(Fs=t._emscripten_bind_btDispatcherInfo_get_m_timeOfImpact_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_timeOfImpact_0).apply(null,arguments)},Bs=t._emscripten_bind_btDispatcherInfo_set_m_timeOfImpact_1=function(){return(Bs=t._emscripten_bind_btDispatcherInfo_set_m_timeOfImpact_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_timeOfImpact_1).apply(null,arguments)},Ns=t._emscripten_bind_btDispatcherInfo_get_m_useContinuous_0=function(){return(Ns=t._emscripten_bind_btDispatcherInfo_get_m_useContinuous_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_useContinuous_0).apply(null,arguments)},Ls=t._emscripten_bind_btDispatcherInfo_set_m_useContinuous_1=function(){return(Ls=t._emscripten_bind_btDispatcherInfo_set_m_useContinuous_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_useContinuous_1).apply(null,arguments)},ks=t._emscripten_bind_btDispatcherInfo_get_m_enableSatConvex_0=function(){return(ks=t._emscripten_bind_btDispatcherInfo_get_m_enableSatConvex_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_enableSatConvex_0).apply(null,arguments)},Vs=t._emscripten_bind_btDispatcherInfo_set_m_enableSatConvex_1=function(){return(Vs=t._emscripten_bind_btDispatcherInfo_set_m_enableSatConvex_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_enableSatConvex_1).apply(null,arguments)},Us=t._emscripten_bind_btDispatcherInfo_get_m_enableSPU_0=function(){return(Us=t._emscripten_bind_btDispatcherInfo_get_m_enableSPU_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_enableSPU_0).apply(null,arguments)},Gs=t._emscripten_bind_btDispatcherInfo_set_m_enableSPU_1=function(){return(Gs=t._emscripten_bind_btDispatcherInfo_set_m_enableSPU_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_enableSPU_1).apply(null,arguments)},js=t._emscripten_bind_btDispatcherInfo_get_m_useEpa_0=function(){return(js=t._emscripten_bind_btDispatcherInfo_get_m_useEpa_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_useEpa_0).apply(null,arguments)},Ws=t._emscripten_bind_btDispatcherInfo_set_m_useEpa_1=function(){return(Ws=t._emscripten_bind_btDispatcherInfo_set_m_useEpa_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_useEpa_1).apply(null,arguments)},zs=t._emscripten_bind_btDispatcherInfo_get_m_allowedCcdPenetration_0=function(){return(zs=t._emscripten_bind_btDispatcherInfo_get_m_allowedCcdPenetration_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_allowedCcdPenetration_0).apply(null,arguments)},Hs=t._emscripten_bind_btDispatcherInfo_set_m_allowedCcdPenetration_1=function(){return(Hs=t._emscripten_bind_btDispatcherInfo_set_m_allowedCcdPenetration_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_allowedCcdPenetration_1).apply(null,arguments)},Xs=t._emscripten_bind_btDispatcherInfo_get_m_useConvexConservativeDistanceUtil_0=function(){return(Xs=t._emscripten_bind_btDispatcherInfo_get_m_useConvexConservativeDistanceUtil_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_useConvexConservativeDistanceUtil_0).apply(null,arguments)},Ys=t._emscripten_bind_btDispatcherInfo_set_m_useConvexConservativeDistanceUtil_1=function(){return(Ys=t._emscripten_bind_btDispatcherInfo_set_m_useConvexConservativeDistanceUtil_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_useConvexConservativeDistanceUtil_1).apply(null,arguments)},Qs=t._emscripten_bind_btDispatcherInfo_get_m_convexConservativeDistanceThreshold_0=function(){return(Qs=t._emscripten_bind_btDispatcherInfo_get_m_convexConservativeDistanceThreshold_0=t.asm.emscripten_bind_btDispatcherInfo_get_m_convexConservativeDistanceThreshold_0).apply(null,arguments)},qs=t._emscripten_bind_btDispatcherInfo_set_m_convexConservativeDistanceThreshold_1=function(){return(qs=t._emscripten_bind_btDispatcherInfo_set_m_convexConservativeDistanceThreshold_1=t.asm.emscripten_bind_btDispatcherInfo_set_m_convexConservativeDistanceThreshold_1).apply(null,arguments)},Ks=t._emscripten_bind_btDispatcherInfo___destroy___0=function(){return(Ks=t._emscripten_bind_btDispatcherInfo___destroy___0=t.asm.emscripten_bind_btDispatcherInfo___destroy___0).apply(null,arguments)},Zs=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_chassisConnectionCS_0=function(){return(Zs=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_chassisConnectionCS_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_chassisConnectionCS_0).apply(null,arguments)},$s=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_chassisConnectionCS_1=function(){return($s=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_chassisConnectionCS_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_chassisConnectionCS_1).apply(null,arguments)},Js=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelDirectionCS_0=function(){return(Js=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelDirectionCS_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelDirectionCS_0).apply(null,arguments)},eo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelDirectionCS_1=function(){return(eo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelDirectionCS_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelDirectionCS_1).apply(null,arguments)},to=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelAxleCS_0=function(){return(to=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelAxleCS_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelAxleCS_0).apply(null,arguments)},io=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelAxleCS_1=function(){return(io=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelAxleCS_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelAxleCS_1).apply(null,arguments)},no=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_suspensionRestLength_0=function(){return(no=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_suspensionRestLength_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_suspensionRestLength_0).apply(null,arguments)},ro=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_suspensionRestLength_1=function(){return(ro=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_suspensionRestLength_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_suspensionRestLength_1).apply(null,arguments)},so=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_maxSuspensionTravelCm_0=function(){return(so=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_maxSuspensionTravelCm_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_maxSuspensionTravelCm_0).apply(null,arguments)},oo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_maxSuspensionTravelCm_1=function(){return(oo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_maxSuspensionTravelCm_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_maxSuspensionTravelCm_1).apply(null,arguments)},ao=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelRadius_0=function(){return(ao=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelRadius_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelRadius_0).apply(null,arguments)},lo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelRadius_1=function(){return(lo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelRadius_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelRadius_1).apply(null,arguments)},co=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_suspensionStiffness_0=function(){return(co=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_suspensionStiffness_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_suspensionStiffness_0).apply(null,arguments)},ho=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_suspensionStiffness_1=function(){return(ho=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_suspensionStiffness_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_suspensionStiffness_1).apply(null,arguments)},_o=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelsDampingCompression_0=function(){return(_o=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelsDampingCompression_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelsDampingCompression_0).apply(null,arguments)},uo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelsDampingCompression_1=function(){return(uo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelsDampingCompression_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelsDampingCompression_1).apply(null,arguments)},po=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelsDampingRelaxation_0=function(){return(po=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelsDampingRelaxation_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_wheelsDampingRelaxation_0).apply(null,arguments)},fo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelsDampingRelaxation_1=function(){return(fo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelsDampingRelaxation_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_wheelsDampingRelaxation_1).apply(null,arguments)},mo=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_frictionSlip_0=function(){return(mo=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_frictionSlip_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_frictionSlip_0).apply(null,arguments)},go=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_frictionSlip_1=function(){return(go=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_frictionSlip_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_frictionSlip_1).apply(null,arguments)},bo=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_maxSuspensionForce_0=function(){return(bo=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_maxSuspensionForce_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_maxSuspensionForce_0).apply(null,arguments)},yo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_maxSuspensionForce_1=function(){return(yo=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_maxSuspensionForce_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_maxSuspensionForce_1).apply(null,arguments)},vo=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_bIsFrontWheel_0=function(){return(vo=t._emscripten_bind_btWheelInfoConstructionInfo_get_m_bIsFrontWheel_0=t.asm.emscripten_bind_btWheelInfoConstructionInfo_get_m_bIsFrontWheel_0).apply(null,arguments)},Ao=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_bIsFrontWheel_1=function(){return(Ao=t._emscripten_bind_btWheelInfoConstructionInfo_set_m_bIsFrontWheel_1=t.asm.emscripten_bind_btWheelInfoConstructionInfo_set_m_bIsFrontWheel_1).apply(null,arguments)},Co=t._emscripten_bind_btWheelInfoConstructionInfo___destroy___0=function(){return(Co=t._emscripten_bind_btWheelInfoConstructionInfo___destroy___0=t.asm.emscripten_bind_btWheelInfoConstructionInfo___destroy___0).apply(null,arguments)},So=t._emscripten_bind_btConvexTriangleMeshShape_btConvexTriangleMeshShape_1=function(){return(So=t._emscripten_bind_btConvexTriangleMeshShape_btConvexTriangleMeshShape_1=t.asm.emscripten_bind_btConvexTriangleMeshShape_btConvexTriangleMeshShape_1).apply(null,arguments)},xo=t._emscripten_bind_btConvexTriangleMeshShape_btConvexTriangleMeshShape_2=function(){return(xo=t._emscripten_bind_btConvexTriangleMeshShape_btConvexTriangleMeshShape_2=t.asm.emscripten_bind_btConvexTriangleMeshShape_btConvexTriangleMeshShape_2).apply(null,arguments)},To=t._emscripten_bind_btConvexTriangleMeshShape_setLocalScaling_1=function(){return(To=t._emscripten_bind_btConvexTriangleMeshShape_setLocalScaling_1=t.asm.emscripten_bind_btConvexTriangleMeshShape_setLocalScaling_1).apply(null,arguments)},Eo=t._emscripten_bind_btConvexTriangleMeshShape_getLocalScaling_0=function(){return(Eo=t._emscripten_bind_btConvexTriangleMeshShape_getLocalScaling_0=t.asm.emscripten_bind_btConvexTriangleMeshShape_getLocalScaling_0).apply(null,arguments)},Ro=t._emscripten_bind_btConvexTriangleMeshShape_calculateLocalInertia_2=function(){return(Ro=t._emscripten_bind_btConvexTriangleMeshShape_calculateLocalInertia_2=t.asm.emscripten_bind_btConvexTriangleMeshShape_calculateLocalInertia_2).apply(null,arguments)},Po=t._emscripten_bind_btConvexTriangleMeshShape_setMargin_1=function(){return(Po=t._emscripten_bind_btConvexTriangleMeshShape_setMargin_1=t.asm.emscripten_bind_btConvexTriangleMeshShape_setMargin_1).apply(null,arguments)},Io=t._emscripten_bind_btConvexTriangleMeshShape_getMargin_0=function(){return(Io=t._emscripten_bind_btConvexTriangleMeshShape_getMargin_0=t.asm.emscripten_bind_btConvexTriangleMeshShape_getMargin_0).apply(null,arguments)},Mo=t._emscripten_bind_btConvexTriangleMeshShape___destroy___0=function(){return(Mo=t._emscripten_bind_btConvexTriangleMeshShape___destroy___0=t.asm.emscripten_bind_btConvexTriangleMeshShape___destroy___0).apply(null,arguments)},Do=t._emscripten_bind_btBroadphaseInterface_getOverlappingPairCache_0=function(){return(Do=t._emscripten_bind_btBroadphaseInterface_getOverlappingPairCache_0=t.asm.emscripten_bind_btBroadphaseInterface_getOverlappingPairCache_0).apply(null,arguments)},Oo=t._emscripten_bind_btBroadphaseInterface___destroy___0=function(){return(Oo=t._emscripten_bind_btBroadphaseInterface___destroy___0=t.asm.emscripten_bind_btBroadphaseInterface___destroy___0).apply(null,arguments)},wo=t._emscripten_bind_btRigidBodyConstructionInfo_btRigidBodyConstructionInfo_3=function(){return(wo=t._emscripten_bind_btRigidBodyConstructionInfo_btRigidBodyConstructionInfo_3=t.asm.emscripten_bind_btRigidBodyConstructionInfo_btRigidBodyConstructionInfo_3).apply(null,arguments)},Fo=t._emscripten_bind_btRigidBodyConstructionInfo_btRigidBodyConstructionInfo_4=function(){return(Fo=t._emscripten_bind_btRigidBodyConstructionInfo_btRigidBodyConstructionInfo_4=t.asm.emscripten_bind_btRigidBodyConstructionInfo_btRigidBodyConstructionInfo_4).apply(null,arguments)},Bo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_linearDamping_0=function(){return(Bo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_linearDamping_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_linearDamping_0).apply(null,arguments)},No=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_linearDamping_1=function(){return(No=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_linearDamping_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_linearDamping_1).apply(null,arguments)},Lo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_angularDamping_0=function(){return(Lo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_angularDamping_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_angularDamping_0).apply(null,arguments)},ko=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_angularDamping_1=function(){return(ko=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_angularDamping_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_angularDamping_1).apply(null,arguments)},Vo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_friction_0=function(){return(Vo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_friction_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_friction_0).apply(null,arguments)},Uo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_friction_1=function(){return(Uo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_friction_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_friction_1).apply(null,arguments)},Go=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_rollingFriction_0=function(){return(Go=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_rollingFriction_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_rollingFriction_0).apply(null,arguments)},jo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_rollingFriction_1=function(){return(jo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_rollingFriction_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_rollingFriction_1).apply(null,arguments)},Wo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_restitution_0=function(){return(Wo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_restitution_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_restitution_0).apply(null,arguments)},zo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_restitution_1=function(){return(zo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_restitution_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_restitution_1).apply(null,arguments)},Ho=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_linearSleepingThreshold_0=function(){return(Ho=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_linearSleepingThreshold_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_linearSleepingThreshold_0).apply(null,arguments)},Xo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_linearSleepingThreshold_1=function(){return(Xo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_linearSleepingThreshold_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_linearSleepingThreshold_1).apply(null,arguments)},Yo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_angularSleepingThreshold_0=function(){return(Yo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_angularSleepingThreshold_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_angularSleepingThreshold_0).apply(null,arguments)},Qo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_angularSleepingThreshold_1=function(){return(Qo=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_angularSleepingThreshold_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_angularSleepingThreshold_1).apply(null,arguments)},qo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalDamping_0=function(){return(qo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalDamping_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalDamping_0).apply(null,arguments)},Ko=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalDamping_1=function(){return(Ko=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalDamping_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalDamping_1).apply(null,arguments)},Zo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalDampingFactor_0=function(){return(Zo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalDampingFactor_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalDampingFactor_0).apply(null,arguments)},$o=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalDampingFactor_1=function(){return($o=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalDampingFactor_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalDampingFactor_1).apply(null,arguments)},Jo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalLinearDampingThresholdSqr_0=function(){return(Jo=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalLinearDampingThresholdSqr_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalLinearDampingThresholdSqr_0).apply(null,arguments)},ea=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalLinearDampingThresholdSqr_1=function(){return(ea=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalLinearDampingThresholdSqr_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalLinearDampingThresholdSqr_1).apply(null,arguments)},ta=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalAngularDampingThresholdSqr_0=function(){return(ta=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalAngularDampingThresholdSqr_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalAngularDampingThresholdSqr_0).apply(null,arguments)},ia=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalAngularDampingThresholdSqr_1=function(){return(ia=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalAngularDampingThresholdSqr_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalAngularDampingThresholdSqr_1).apply(null,arguments)},na=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalAngularDampingFactor_0=function(){return(na=t._emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalAngularDampingFactor_0=t.asm.emscripten_bind_btRigidBodyConstructionInfo_get_m_additionalAngularDampingFactor_0).apply(null,arguments)},ra=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalAngularDampingFactor_1=function(){return(ra=t._emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalAngularDampingFactor_1=t.asm.emscripten_bind_btRigidBodyConstructionInfo_set_m_additionalAngularDampingFactor_1).apply(null,arguments)},sa=t._emscripten_bind_btRigidBodyConstructionInfo___destroy___0=function(){return(sa=t._emscripten_bind_btRigidBodyConstructionInfo___destroy___0=t.asm.emscripten_bind_btRigidBodyConstructionInfo___destroy___0).apply(null,arguments)},oa=t._emscripten_bind_btCollisionConfiguration___destroy___0=function(){return(oa=t._emscripten_bind_btCollisionConfiguration___destroy___0=t.asm.emscripten_bind_btCollisionConfiguration___destroy___0).apply(null,arguments)},aa=t._emscripten_bind_btPersistentManifold_btPersistentManifold_0=function(){return(aa=t._emscripten_bind_btPersistentManifold_btPersistentManifold_0=t.asm.emscripten_bind_btPersistentManifold_btPersistentManifold_0).apply(null,arguments)},la=t._emscripten_bind_btPersistentManifold_getBody0_0=function(){return(la=t._emscripten_bind_btPersistentManifold_getBody0_0=t.asm.emscripten_bind_btPersistentManifold_getBody0_0).apply(null,arguments)},ca=t._emscripten_bind_btPersistentManifold_getBody1_0=function(){return(ca=t._emscripten_bind_btPersistentManifold_getBody1_0=t.asm.emscripten_bind_btPersistentManifold_getBody1_0).apply(null,arguments)},ha=t._emscripten_bind_btPersistentManifold_getNumContacts_0=function(){return(ha=t._emscripten_bind_btPersistentManifold_getNumContacts_0=t.asm.emscripten_bind_btPersistentManifold_getNumContacts_0).apply(null,arguments)},_a=t._emscripten_bind_btPersistentManifold_getContactPoint_1=function(){return(_a=t._emscripten_bind_btPersistentManifold_getContactPoint_1=t.asm.emscripten_bind_btPersistentManifold_getContactPoint_1).apply(null,arguments)},da=t._emscripten_bind_btPersistentManifold___destroy___0=function(){return(da=t._emscripten_bind_btPersistentManifold___destroy___0=t.asm.emscripten_bind_btPersistentManifold___destroy___0).apply(null,arguments)},ua=t._emscripten_bind_btCompoundShape_btCompoundShape_0=function(){return(ua=t._emscripten_bind_btCompoundShape_btCompoundShape_0=t.asm.emscripten_bind_btCompoundShape_btCompoundShape_0).apply(null,arguments)},pa=t._emscripten_bind_btCompoundShape_btCompoundShape_1=function(){return(pa=t._emscripten_bind_btCompoundShape_btCompoundShape_1=t.asm.emscripten_bind_btCompoundShape_btCompoundShape_1).apply(null,arguments)},fa=t._emscripten_bind_btCompoundShape_addChildShape_2=function(){return(fa=t._emscripten_bind_btCompoundShape_addChildShape_2=t.asm.emscripten_bind_btCompoundShape_addChildShape_2).apply(null,arguments)},ma=t._emscripten_bind_btCompoundShape_removeChildShape_1=function(){return(ma=t._emscripten_bind_btCompoundShape_removeChildShape_1=t.asm.emscripten_bind_btCompoundShape_removeChildShape_1).apply(null,arguments)},ga=t._emscripten_bind_btCompoundShape_removeChildShapeByIndex_1=function(){return(ga=t._emscripten_bind_btCompoundShape_removeChildShapeByIndex_1=t.asm.emscripten_bind_btCompoundShape_removeChildShapeByIndex_1).apply(null,arguments)},ba=t._emscripten_bind_btCompoundShape_getNumChildShapes_0=function(){return(ba=t._emscripten_bind_btCompoundShape_getNumChildShapes_0=t.asm.emscripten_bind_btCompoundShape_getNumChildShapes_0).apply(null,arguments)},ya=t._emscripten_bind_btCompoundShape_getChildShape_1=function(){return(ya=t._emscripten_bind_btCompoundShape_getChildShape_1=t.asm.emscripten_bind_btCompoundShape_getChildShape_1).apply(null,arguments)},va=t._emscripten_bind_btCompoundShape_updateChildTransform_2=function(){return(va=t._emscripten_bind_btCompoundShape_updateChildTransform_2=t.asm.emscripten_bind_btCompoundShape_updateChildTransform_2).apply(null,arguments)},Aa=t._emscripten_bind_btCompoundShape_updateChildTransform_3=function(){return(Aa=t._emscripten_bind_btCompoundShape_updateChildTransform_3=t.asm.emscripten_bind_btCompoundShape_updateChildTransform_3).apply(null,arguments)},Ca=t._emscripten_bind_btCompoundShape_setMargin_1=function(){return(Ca=t._emscripten_bind_btCompoundShape_setMargin_1=t.asm.emscripten_bind_btCompoundShape_setMargin_1).apply(null,arguments)},Sa=t._emscripten_bind_btCompoundShape_getMargin_0=function(){return(Sa=t._emscripten_bind_btCompoundShape_getMargin_0=t.asm.emscripten_bind_btCompoundShape_getMargin_0).apply(null,arguments)},xa=t._emscripten_bind_btCompoundShape_setLocalScaling_1=function(){return(xa=t._emscripten_bind_btCompoundShape_setLocalScaling_1=t.asm.emscripten_bind_btCompoundShape_setLocalScaling_1).apply(null,arguments)},Ta=t._emscripten_bind_btCompoundShape_getLocalScaling_0=function(){return(Ta=t._emscripten_bind_btCompoundShape_getLocalScaling_0=t.asm.emscripten_bind_btCompoundShape_getLocalScaling_0).apply(null,arguments)},Ea=t._emscripten_bind_btCompoundShape_calculateLocalInertia_2=function(){return(Ea=t._emscripten_bind_btCompoundShape_calculateLocalInertia_2=t.asm.emscripten_bind_btCompoundShape_calculateLocalInertia_2).apply(null,arguments)},Ra=t._emscripten_bind_btCompoundShape___destroy___0=function(){return(Ra=t._emscripten_bind_btCompoundShape___destroy___0=t.asm.emscripten_bind_btCompoundShape___destroy___0).apply(null,arguments)},Pa=t._emscripten_bind_ClosestConvexResultCallback_ClosestConvexResultCallback_2=function(){return(Pa=t._emscripten_bind_ClosestConvexResultCallback_ClosestConvexResultCallback_2=t.asm.emscripten_bind_ClosestConvexResultCallback_ClosestConvexResultCallback_2).apply(null,arguments)},Ia=t._emscripten_bind_ClosestConvexResultCallback_hasHit_0=function(){return(Ia=t._emscripten_bind_ClosestConvexResultCallback_hasHit_0=t.asm.emscripten_bind_ClosestConvexResultCallback_hasHit_0).apply(null,arguments)},Ma=t._emscripten_bind_ClosestConvexResultCallback_get_m_convexFromWorld_0=function(){return(Ma=t._emscripten_bind_ClosestConvexResultCallback_get_m_convexFromWorld_0=t.asm.emscripten_bind_ClosestConvexResultCallback_get_m_convexFromWorld_0).apply(null,arguments)},Da=t._emscripten_bind_ClosestConvexResultCallback_set_m_convexFromWorld_1=function(){return(Da=t._emscripten_bind_ClosestConvexResultCallback_set_m_convexFromWorld_1=t.asm.emscripten_bind_ClosestConvexResultCallback_set_m_convexFromWorld_1).apply(null,arguments)},Oa=t._emscripten_bind_ClosestConvexResultCallback_get_m_convexToWorld_0=function(){return(Oa=t._emscripten_bind_ClosestConvexResultCallback_get_m_convexToWorld_0=t.asm.emscripten_bind_ClosestConvexResultCallback_get_m_convexToWorld_0).apply(null,arguments)},wa=t._emscripten_bind_ClosestConvexResultCallback_set_m_convexToWorld_1=function(){return(wa=t._emscripten_bind_ClosestConvexResultCallback_set_m_convexToWorld_1=t.asm.emscripten_bind_ClosestConvexResultCallback_set_m_convexToWorld_1).apply(null,arguments)},Fa=t._emscripten_bind_ClosestConvexResultCallback_get_m_hitNormalWorld_0=function(){return(Fa=t._emscripten_bind_ClosestConvexResultCallback_get_m_hitNormalWorld_0=t.asm.emscripten_bind_ClosestConvexResultCallback_get_m_hitNormalWorld_0).apply(null,arguments)},Ba=t._emscripten_bind_ClosestConvexResultCallback_set_m_hitNormalWorld_1=function(){return(Ba=t._emscripten_bind_ClosestConvexResultCallback_set_m_hitNormalWorld_1=t.asm.emscripten_bind_ClosestConvexResultCallback_set_m_hitNormalWorld_1).apply(null,arguments)},Na=t._emscripten_bind_ClosestConvexResultCallback_get_m_hitPointWorld_0=function(){return(Na=t._emscripten_bind_ClosestConvexResultCallback_get_m_hitPointWorld_0=t.asm.emscripten_bind_ClosestConvexResultCallback_get_m_hitPointWorld_0).apply(null,arguments)},La=t._emscripten_bind_ClosestConvexResultCallback_set_m_hitPointWorld_1=function(){return(La=t._emscripten_bind_ClosestConvexResultCallback_set_m_hitPointWorld_1=t.asm.emscripten_bind_ClosestConvexResultCallback_set_m_hitPointWorld_1).apply(null,arguments)},ka=t._emscripten_bind_ClosestConvexResultCallback_get_m_collisionFilterGroup_0=function(){return(ka=t._emscripten_bind_ClosestConvexResultCallback_get_m_collisionFilterGroup_0=t.asm.emscripten_bind_ClosestConvexResultCallback_get_m_collisionFilterGroup_0).apply(null,arguments)},Va=t._emscripten_bind_ClosestConvexResultCallback_set_m_collisionFilterGroup_1=function(){return(Va=t._emscripten_bind_ClosestConvexResultCallback_set_m_collisionFilterGroup_1=t.asm.emscripten_bind_ClosestConvexResultCallback_set_m_collisionFilterGroup_1).apply(null,arguments)},Ua=t._emscripten_bind_ClosestConvexResultCallback_get_m_collisionFilterMask_0=function(){return(Ua=t._emscripten_bind_ClosestConvexResultCallback_get_m_collisionFilterMask_0=t.asm.emscripten_bind_ClosestConvexResultCallback_get_m_collisionFilterMask_0).apply(null,arguments)},Ga=t._emscripten_bind_ClosestConvexResultCallback_set_m_collisionFilterMask_1=function(){return(Ga=t._emscripten_bind_ClosestConvexResultCallback_set_m_collisionFilterMask_1=t.asm.emscripten_bind_ClosestConvexResultCallback_set_m_collisionFilterMask_1).apply(null,arguments)},ja=t._emscripten_bind_ClosestConvexResultCallback_get_m_closestHitFraction_0=function(){return(ja=t._emscripten_bind_ClosestConvexResultCallback_get_m_closestHitFraction_0=t.asm.emscripten_bind_ClosestConvexResultCallback_get_m_closestHitFraction_0).apply(null,arguments)},Wa=t._emscripten_bind_ClosestConvexResultCallback_set_m_closestHitFraction_1=function(){return(Wa=t._emscripten_bind_ClosestConvexResultCallback_set_m_closestHitFraction_1=t.asm.emscripten_bind_ClosestConvexResultCallback_set_m_closestHitFraction_1).apply(null,arguments)},za=t._emscripten_bind_ClosestConvexResultCallback___destroy___0=function(){return(za=t._emscripten_bind_ClosestConvexResultCallback___destroy___0=t.asm.emscripten_bind_ClosestConvexResultCallback___destroy___0).apply(null,arguments)},Ha=t._emscripten_bind_AllHitsRayResultCallback_AllHitsRayResultCallback_2=function(){return(Ha=t._emscripten_bind_AllHitsRayResultCallback_AllHitsRayResultCallback_2=t.asm.emscripten_bind_AllHitsRayResultCallback_AllHitsRayResultCallback_2).apply(null,arguments)},Xa=t._emscripten_bind_AllHitsRayResultCallback_hasHit_0=function(){return(Xa=t._emscripten_bind_AllHitsRayResultCallback_hasHit_0=t.asm.emscripten_bind_AllHitsRayResultCallback_hasHit_0).apply(null,arguments)},Ya=t._emscripten_bind_AllHitsRayResultCallback_get_m_collisionObjects_0=function(){return(Ya=t._emscripten_bind_AllHitsRayResultCallback_get_m_collisionObjects_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_collisionObjects_0).apply(null,arguments)},Qa=t._emscripten_bind_AllHitsRayResultCallback_set_m_collisionObjects_1=function(){return(Qa=t._emscripten_bind_AllHitsRayResultCallback_set_m_collisionObjects_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_collisionObjects_1).apply(null,arguments)},qa=t._emscripten_bind_AllHitsRayResultCallback_get_m_rayFromWorld_0=function(){return(qa=t._emscripten_bind_AllHitsRayResultCallback_get_m_rayFromWorld_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_rayFromWorld_0).apply(null,arguments)},Ka=t._emscripten_bind_AllHitsRayResultCallback_set_m_rayFromWorld_1=function(){return(Ka=t._emscripten_bind_AllHitsRayResultCallback_set_m_rayFromWorld_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_rayFromWorld_1).apply(null,arguments)},Za=t._emscripten_bind_AllHitsRayResultCallback_get_m_rayToWorld_0=function(){return(Za=t._emscripten_bind_AllHitsRayResultCallback_get_m_rayToWorld_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_rayToWorld_0).apply(null,arguments)},$a=t._emscripten_bind_AllHitsRayResultCallback_set_m_rayToWorld_1=function(){return($a=t._emscripten_bind_AllHitsRayResultCallback_set_m_rayToWorld_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_rayToWorld_1).apply(null,arguments)},Ja=t._emscripten_bind_AllHitsRayResultCallback_get_m_hitNormalWorld_0=function(){return(Ja=t._emscripten_bind_AllHitsRayResultCallback_get_m_hitNormalWorld_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_hitNormalWorld_0).apply(null,arguments)},el=t._emscripten_bind_AllHitsRayResultCallback_set_m_hitNormalWorld_1=function(){return(el=t._emscripten_bind_AllHitsRayResultCallback_set_m_hitNormalWorld_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_hitNormalWorld_1).apply(null,arguments)},tl=t._emscripten_bind_AllHitsRayResultCallback_get_m_hitPointWorld_0=function(){return(tl=t._emscripten_bind_AllHitsRayResultCallback_get_m_hitPointWorld_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_hitPointWorld_0).apply(null,arguments)},il=t._emscripten_bind_AllHitsRayResultCallback_set_m_hitPointWorld_1=function(){return(il=t._emscripten_bind_AllHitsRayResultCallback_set_m_hitPointWorld_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_hitPointWorld_1).apply(null,arguments)},nl=t._emscripten_bind_AllHitsRayResultCallback_get_m_hitFractions_0=function(){return(nl=t._emscripten_bind_AllHitsRayResultCallback_get_m_hitFractions_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_hitFractions_0).apply(null,arguments)},rl=t._emscripten_bind_AllHitsRayResultCallback_set_m_hitFractions_1=function(){return(rl=t._emscripten_bind_AllHitsRayResultCallback_set_m_hitFractions_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_hitFractions_1).apply(null,arguments)},sl=t._emscripten_bind_AllHitsRayResultCallback_get_m_collisionFilterGroup_0=function(){return(sl=t._emscripten_bind_AllHitsRayResultCallback_get_m_collisionFilterGroup_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_collisionFilterGroup_0).apply(null,arguments)},ol=t._emscripten_bind_AllHitsRayResultCallback_set_m_collisionFilterGroup_1=function(){return(ol=t._emscripten_bind_AllHitsRayResultCallback_set_m_collisionFilterGroup_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_collisionFilterGroup_1).apply(null,arguments)},al=t._emscripten_bind_AllHitsRayResultCallback_get_m_collisionFilterMask_0=function(){return(al=t._emscripten_bind_AllHitsRayResultCallback_get_m_collisionFilterMask_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_collisionFilterMask_0).apply(null,arguments)},ll=t._emscripten_bind_AllHitsRayResultCallback_set_m_collisionFilterMask_1=function(){return(ll=t._emscripten_bind_AllHitsRayResultCallback_set_m_collisionFilterMask_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_collisionFilterMask_1).apply(null,arguments)},cl=t._emscripten_bind_AllHitsRayResultCallback_get_m_closestHitFraction_0=function(){return(cl=t._emscripten_bind_AllHitsRayResultCallback_get_m_closestHitFraction_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_closestHitFraction_0).apply(null,arguments)},hl=t._emscripten_bind_AllHitsRayResultCallback_set_m_closestHitFraction_1=function(){return(hl=t._emscripten_bind_AllHitsRayResultCallback_set_m_closestHitFraction_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_closestHitFraction_1).apply(null,arguments)},_l=t._emscripten_bind_AllHitsRayResultCallback_get_m_collisionObject_0=function(){return(_l=t._emscripten_bind_AllHitsRayResultCallback_get_m_collisionObject_0=t.asm.emscripten_bind_AllHitsRayResultCallback_get_m_collisionObject_0).apply(null,arguments)},dl=t._emscripten_bind_AllHitsRayResultCallback_set_m_collisionObject_1=function(){return(dl=t._emscripten_bind_AllHitsRayResultCallback_set_m_collisionObject_1=t.asm.emscripten_bind_AllHitsRayResultCallback_set_m_collisionObject_1).apply(null,arguments)},ul=t._emscripten_bind_AllHitsRayResultCallback___destroy___0=function(){return(ul=t._emscripten_bind_AllHitsRayResultCallback___destroy___0=t.asm.emscripten_bind_AllHitsRayResultCallback___destroy___0).apply(null,arguments)},pl=t._emscripten_bind_tMaterialArray_size_0=function(){return(pl=t._emscripten_bind_tMaterialArray_size_0=t.asm.emscripten_bind_tMaterialArray_size_0).apply(null,arguments)},fl=t._emscripten_bind_tMaterialArray_at_1=function(){return(fl=t._emscripten_bind_tMaterialArray_at_1=t.asm.emscripten_bind_tMaterialArray_at_1).apply(null,arguments)},ml=t._emscripten_bind_tMaterialArray___destroy___0=function(){return(ml=t._emscripten_bind_tMaterialArray___destroy___0=t.asm.emscripten_bind_tMaterialArray___destroy___0).apply(null,arguments)},gl=t._emscripten_bind_btDefaultVehicleRaycaster_btDefaultVehicleRaycaster_1=function(){return(gl=t._emscripten_bind_btDefaultVehicleRaycaster_btDefaultVehicleRaycaster_1=t.asm.emscripten_bind_btDefaultVehicleRaycaster_btDefaultVehicleRaycaster_1).apply(null,arguments)},bl=t._emscripten_bind_btDefaultVehicleRaycaster_castRay_3=function(){return(bl=t._emscripten_bind_btDefaultVehicleRaycaster_castRay_3=t.asm.emscripten_bind_btDefaultVehicleRaycaster_castRay_3).apply(null,arguments)},yl=t._emscripten_bind_btDefaultVehicleRaycaster___destroy___0=function(){return(yl=t._emscripten_bind_btDefaultVehicleRaycaster___destroy___0=t.asm.emscripten_bind_btDefaultVehicleRaycaster___destroy___0).apply(null,arguments)},vl=t._emscripten_bind_btEmptyShape_btEmptyShape_0=function(){return(vl=t._emscripten_bind_btEmptyShape_btEmptyShape_0=t.asm.emscripten_bind_btEmptyShape_btEmptyShape_0).apply(null,arguments)},Al=t._emscripten_bind_btEmptyShape_setLocalScaling_1=function(){return(Al=t._emscripten_bind_btEmptyShape_setLocalScaling_1=t.asm.emscripten_bind_btEmptyShape_setLocalScaling_1).apply(null,arguments)},Cl=t._emscripten_bind_btEmptyShape_getLocalScaling_0=function(){return(Cl=t._emscripten_bind_btEmptyShape_getLocalScaling_0=t.asm.emscripten_bind_btEmptyShape_getLocalScaling_0).apply(null,arguments)},Sl=t._emscripten_bind_btEmptyShape_calculateLocalInertia_2=function(){return(Sl=t._emscripten_bind_btEmptyShape_calculateLocalInertia_2=t.asm.emscripten_bind_btEmptyShape_calculateLocalInertia_2).apply(null,arguments)},xl=t._emscripten_bind_btEmptyShape___destroy___0=function(){return(xl=t._emscripten_bind_btEmptyShape___destroy___0=t.asm.emscripten_bind_btEmptyShape___destroy___0).apply(null,arguments)},Tl=t._emscripten_bind_btConstraintSetting_btConstraintSetting_0=function(){return(Tl=t._emscripten_bind_btConstraintSetting_btConstraintSetting_0=t.asm.emscripten_bind_btConstraintSetting_btConstraintSetting_0).apply(null,arguments)},El=t._emscripten_bind_btConstraintSetting_get_m_tau_0=function(){return(El=t._emscripten_bind_btConstraintSetting_get_m_tau_0=t.asm.emscripten_bind_btConstraintSetting_get_m_tau_0).apply(null,arguments)},Rl=t._emscripten_bind_btConstraintSetting_set_m_tau_1=function(){return(Rl=t._emscripten_bind_btConstraintSetting_set_m_tau_1=t.asm.emscripten_bind_btConstraintSetting_set_m_tau_1).apply(null,arguments)},Pl=t._emscripten_bind_btConstraintSetting_get_m_damping_0=function(){return(Pl=t._emscripten_bind_btConstraintSetting_get_m_damping_0=t.asm.emscripten_bind_btConstraintSetting_get_m_damping_0).apply(null,arguments)},Il=t._emscripten_bind_btConstraintSetting_set_m_damping_1=function(){return(Il=t._emscripten_bind_btConstraintSetting_set_m_damping_1=t.asm.emscripten_bind_btConstraintSetting_set_m_damping_1).apply(null,arguments)},Ml=t._emscripten_bind_btConstraintSetting_get_m_impulseClamp_0=function(){return(Ml=t._emscripten_bind_btConstraintSetting_get_m_impulseClamp_0=t.asm.emscripten_bind_btConstraintSetting_get_m_impulseClamp_0).apply(null,arguments)},Dl=t._emscripten_bind_btConstraintSetting_set_m_impulseClamp_1=function(){return(Dl=t._emscripten_bind_btConstraintSetting_set_m_impulseClamp_1=t.asm.emscripten_bind_btConstraintSetting_set_m_impulseClamp_1).apply(null,arguments)},Ol=t._emscripten_bind_btConstraintSetting___destroy___0=function(){return(Ol=t._emscripten_bind_btConstraintSetting___destroy___0=t.asm.emscripten_bind_btConstraintSetting___destroy___0).apply(null,arguments)},wl=t._emscripten_bind_LocalShapeInfo_get_m_shapePart_0=function(){return(wl=t._emscripten_bind_LocalShapeInfo_get_m_shapePart_0=t.asm.emscripten_bind_LocalShapeInfo_get_m_shapePart_0).apply(null,arguments)},Fl=t._emscripten_bind_LocalShapeInfo_set_m_shapePart_1=function(){return(Fl=t._emscripten_bind_LocalShapeInfo_set_m_shapePart_1=t.asm.emscripten_bind_LocalShapeInfo_set_m_shapePart_1).apply(null,arguments)},Bl=t._emscripten_bind_LocalShapeInfo_get_m_triangleIndex_0=function(){return(Bl=t._emscripten_bind_LocalShapeInfo_get_m_triangleIndex_0=t.asm.emscripten_bind_LocalShapeInfo_get_m_triangleIndex_0).apply(null,arguments)},Nl=t._emscripten_bind_LocalShapeInfo_set_m_triangleIndex_1=function(){return(Nl=t._emscripten_bind_LocalShapeInfo_set_m_triangleIndex_1=t.asm.emscripten_bind_LocalShapeInfo_set_m_triangleIndex_1).apply(null,arguments)},Ll=t._emscripten_bind_LocalShapeInfo___destroy___0=function(){return(Ll=t._emscripten_bind_LocalShapeInfo___destroy___0=t.asm.emscripten_bind_LocalShapeInfo___destroy___0).apply(null,arguments)},kl=t._emscripten_bind_btRigidBody_btRigidBody_1=function(){return(kl=t._emscripten_bind_btRigidBody_btRigidBody_1=t.asm.emscripten_bind_btRigidBody_btRigidBody_1).apply(null,arguments)},Vl=t._emscripten_bind_btRigidBody_getCenterOfMassTransform_0=function(){return(Vl=t._emscripten_bind_btRigidBody_getCenterOfMassTransform_0=t.asm.emscripten_bind_btRigidBody_getCenterOfMassTransform_0).apply(null,arguments)},Ul=t._emscripten_bind_btRigidBody_setCenterOfMassTransform_1=function(){return(Ul=t._emscripten_bind_btRigidBody_setCenterOfMassTransform_1=t.asm.emscripten_bind_btRigidBody_setCenterOfMassTransform_1).apply(null,arguments)},Gl=t._emscripten_bind_btRigidBody_setSleepingThresholds_2=function(){return(Gl=t._emscripten_bind_btRigidBody_setSleepingThresholds_2=t.asm.emscripten_bind_btRigidBody_setSleepingThresholds_2).apply(null,arguments)},jl=t._emscripten_bind_btRigidBody_getLinearDamping_0=function(){return(jl=t._emscripten_bind_btRigidBody_getLinearDamping_0=t.asm.emscripten_bind_btRigidBody_getLinearDamping_0).apply(null,arguments)},Wl=t._emscripten_bind_btRigidBody_getAngularDamping_0=function(){return(Wl=t._emscripten_bind_btRigidBody_getAngularDamping_0=t.asm.emscripten_bind_btRigidBody_getAngularDamping_0).apply(null,arguments)},zl=t._emscripten_bind_btRigidBody_setDamping_2=function(){return(zl=t._emscripten_bind_btRigidBody_setDamping_2=t.asm.emscripten_bind_btRigidBody_setDamping_2).apply(null,arguments)},Hl=t._emscripten_bind_btRigidBody_setMassProps_2=function(){return(Hl=t._emscripten_bind_btRigidBody_setMassProps_2=t.asm.emscripten_bind_btRigidBody_setMassProps_2).apply(null,arguments)},Xl=t._emscripten_bind_btRigidBody_getLinearFactor_0=function(){return(Xl=t._emscripten_bind_btRigidBody_getLinearFactor_0=t.asm.emscripten_bind_btRigidBody_getLinearFactor_0).apply(null,arguments)},Yl=t._emscripten_bind_btRigidBody_setLinearFactor_1=function(){return(Yl=t._emscripten_bind_btRigidBody_setLinearFactor_1=t.asm.emscripten_bind_btRigidBody_setLinearFactor_1).apply(null,arguments)},Ql=t._emscripten_bind_btRigidBody_applyTorque_1=function(){return(Ql=t._emscripten_bind_btRigidBody_applyTorque_1=t.asm.emscripten_bind_btRigidBody_applyTorque_1).apply(null,arguments)},ql=t._emscripten_bind_btRigidBody_applyLocalTorque_1=function(){return(ql=t._emscripten_bind_btRigidBody_applyLocalTorque_1=t.asm.emscripten_bind_btRigidBody_applyLocalTorque_1).apply(null,arguments)},Kl=t._emscripten_bind_btRigidBody_applyForce_2=function(){return(Kl=t._emscripten_bind_btRigidBody_applyForce_2=t.asm.emscripten_bind_btRigidBody_applyForce_2).apply(null,arguments)},Zl=t._emscripten_bind_btRigidBody_applyCentralForce_1=function(){return(Zl=t._emscripten_bind_btRigidBody_applyCentralForce_1=t.asm.emscripten_bind_btRigidBody_applyCentralForce_1).apply(null,arguments)},$l=t._emscripten_bind_btRigidBody_applyCentralLocalForce_1=function(){return($l=t._emscripten_bind_btRigidBody_applyCentralLocalForce_1=t.asm.emscripten_bind_btRigidBody_applyCentralLocalForce_1).apply(null,arguments)},Jl=t._emscripten_bind_btRigidBody_applyTorqueImpulse_1=function(){return(Jl=t._emscripten_bind_btRigidBody_applyTorqueImpulse_1=t.asm.emscripten_bind_btRigidBody_applyTorqueImpulse_1).apply(null,arguments)},ec=t._emscripten_bind_btRigidBody_applyImpulse_2=function(){return(ec=t._emscripten_bind_btRigidBody_applyImpulse_2=t.asm.emscripten_bind_btRigidBody_applyImpulse_2).apply(null,arguments)},tc=t._emscripten_bind_btRigidBody_applyCentralImpulse_1=function(){return(tc=t._emscripten_bind_btRigidBody_applyCentralImpulse_1=t.asm.emscripten_bind_btRigidBody_applyCentralImpulse_1).apply(null,arguments)},ic=t._emscripten_bind_btRigidBody_updateInertiaTensor_0=function(){return(ic=t._emscripten_bind_btRigidBody_updateInertiaTensor_0=t.asm.emscripten_bind_btRigidBody_updateInertiaTensor_0).apply(null,arguments)},nc=t._emscripten_bind_btRigidBody_getLinearVelocity_0=function(){return(nc=t._emscripten_bind_btRigidBody_getLinearVelocity_0=t.asm.emscripten_bind_btRigidBody_getLinearVelocity_0).apply(null,arguments)},rc=t._emscripten_bind_btRigidBody_getAngularVelocity_0=function(){return(rc=t._emscripten_bind_btRigidBody_getAngularVelocity_0=t.asm.emscripten_bind_btRigidBody_getAngularVelocity_0).apply(null,arguments)},sc=t._emscripten_bind_btRigidBody_setLinearVelocity_1=function(){return(sc=t._emscripten_bind_btRigidBody_setLinearVelocity_1=t.asm.emscripten_bind_btRigidBody_setLinearVelocity_1).apply(null,arguments)},oc=t._emscripten_bind_btRigidBody_setAngularVelocity_1=function(){return(oc=t._emscripten_bind_btRigidBody_setAngularVelocity_1=t.asm.emscripten_bind_btRigidBody_setAngularVelocity_1).apply(null,arguments)},ac=t._emscripten_bind_btRigidBody_getMotionState_0=function(){return(ac=t._emscripten_bind_btRigidBody_getMotionState_0=t.asm.emscripten_bind_btRigidBody_getMotionState_0).apply(null,arguments)},lc=t._emscripten_bind_btRigidBody_setMotionState_1=function(){return(lc=t._emscripten_bind_btRigidBody_setMotionState_1=t.asm.emscripten_bind_btRigidBody_setMotionState_1).apply(null,arguments)},cc=t._emscripten_bind_btRigidBody_getAngularFactor_0=function(){return(cc=t._emscripten_bind_btRigidBody_getAngularFactor_0=t.asm.emscripten_bind_btRigidBody_getAngularFactor_0).apply(null,arguments)},hc=t._emscripten_bind_btRigidBody_setAngularFactor_1=function(){return(hc=t._emscripten_bind_btRigidBody_setAngularFactor_1=t.asm.emscripten_bind_btRigidBody_setAngularFactor_1).apply(null,arguments)},_c=t._emscripten_bind_btRigidBody_upcast_1=function(){return(_c=t._emscripten_bind_btRigidBody_upcast_1=t.asm.emscripten_bind_btRigidBody_upcast_1).apply(null,arguments)},dc=t._emscripten_bind_btRigidBody_getAabb_2=function(){return(dc=t._emscripten_bind_btRigidBody_getAabb_2=t.asm.emscripten_bind_btRigidBody_getAabb_2).apply(null,arguments)},uc=t._emscripten_bind_btRigidBody_applyGravity_0=function(){return(uc=t._emscripten_bind_btRigidBody_applyGravity_0=t.asm.emscripten_bind_btRigidBody_applyGravity_0).apply(null,arguments)},pc=t._emscripten_bind_btRigidBody_getGravity_0=function(){return(pc=t._emscripten_bind_btRigidBody_getGravity_0=t.asm.emscripten_bind_btRigidBody_getGravity_0).apply(null,arguments)},fc=t._emscripten_bind_btRigidBody_setGravity_1=function(){return(fc=t._emscripten_bind_btRigidBody_setGravity_1=t.asm.emscripten_bind_btRigidBody_setGravity_1).apply(null,arguments)},mc=t._emscripten_bind_btRigidBody_getBroadphaseProxy_0=function(){return(mc=t._emscripten_bind_btRigidBody_getBroadphaseProxy_0=t.asm.emscripten_bind_btRigidBody_getBroadphaseProxy_0).apply(null,arguments)},gc=t._emscripten_bind_btRigidBody_clearForces_0=function(){return(gc=t._emscripten_bind_btRigidBody_clearForces_0=t.asm.emscripten_bind_btRigidBody_clearForces_0).apply(null,arguments)},bc=t._emscripten_bind_btRigidBody_setAnisotropicFriction_2=function(){return(bc=t._emscripten_bind_btRigidBody_setAnisotropicFriction_2=t.asm.emscripten_bind_btRigidBody_setAnisotropicFriction_2).apply(null,arguments)},yc=t._emscripten_bind_btRigidBody_getCollisionShape_0=function(){return(yc=t._emscripten_bind_btRigidBody_getCollisionShape_0=t.asm.emscripten_bind_btRigidBody_getCollisionShape_0).apply(null,arguments)},vc=t._emscripten_bind_btRigidBody_setContactProcessingThreshold_1=function(){return(vc=t._emscripten_bind_btRigidBody_setContactProcessingThreshold_1=t.asm.emscripten_bind_btRigidBody_setContactProcessingThreshold_1).apply(null,arguments)},Ac=t._emscripten_bind_btRigidBody_setActivationState_1=function(){return(Ac=t._emscripten_bind_btRigidBody_setActivationState_1=t.asm.emscripten_bind_btRigidBody_setActivationState_1).apply(null,arguments)},Cc=t._emscripten_bind_btRigidBody_forceActivationState_1=function(){return(Cc=t._emscripten_bind_btRigidBody_forceActivationState_1=t.asm.emscripten_bind_btRigidBody_forceActivationState_1).apply(null,arguments)},Sc=t._emscripten_bind_btRigidBody_activate_0=function(){return(Sc=t._emscripten_bind_btRigidBody_activate_0=t.asm.emscripten_bind_btRigidBody_activate_0).apply(null,arguments)},xc=t._emscripten_bind_btRigidBody_activate_1=function(){return(xc=t._emscripten_bind_btRigidBody_activate_1=t.asm.emscripten_bind_btRigidBody_activate_1).apply(null,arguments)},Tc=t._emscripten_bind_btRigidBody_isActive_0=function(){return(Tc=t._emscripten_bind_btRigidBody_isActive_0=t.asm.emscripten_bind_btRigidBody_isActive_0).apply(null,arguments)},Ec=t._emscripten_bind_btRigidBody_isKinematicObject_0=function(){return(Ec=t._emscripten_bind_btRigidBody_isKinematicObject_0=t.asm.emscripten_bind_btRigidBody_isKinematicObject_0).apply(null,arguments)},Rc=t._emscripten_bind_btRigidBody_isStaticObject_0=function(){return(Rc=t._emscripten_bind_btRigidBody_isStaticObject_0=t.asm.emscripten_bind_btRigidBody_isStaticObject_0).apply(null,arguments)},Pc=t._emscripten_bind_btRigidBody_isStaticOrKinematicObject_0=function(){return(Pc=t._emscripten_bind_btRigidBody_isStaticOrKinematicObject_0=t.asm.emscripten_bind_btRigidBody_isStaticOrKinematicObject_0).apply(null,arguments)},Ic=t._emscripten_bind_btRigidBody_getRestitution_0=function(){return(Ic=t._emscripten_bind_btRigidBody_getRestitution_0=t.asm.emscripten_bind_btRigidBody_getRestitution_0).apply(null,arguments)},Mc=t._emscripten_bind_btRigidBody_getFriction_0=function(){return(Mc=t._emscripten_bind_btRigidBody_getFriction_0=t.asm.emscripten_bind_btRigidBody_getFriction_0).apply(null,arguments)},Dc=t._emscripten_bind_btRigidBody_getRollingFriction_0=function(){return(Dc=t._emscripten_bind_btRigidBody_getRollingFriction_0=t.asm.emscripten_bind_btRigidBody_getRollingFriction_0).apply(null,arguments)},Oc=t._emscripten_bind_btRigidBody_setRestitution_1=function(){return(Oc=t._emscripten_bind_btRigidBody_setRestitution_1=t.asm.emscripten_bind_btRigidBody_setRestitution_1).apply(null,arguments)},wc=t._emscripten_bind_btRigidBody_setFriction_1=function(){return(wc=t._emscripten_bind_btRigidBody_setFriction_1=t.asm.emscripten_bind_btRigidBody_setFriction_1).apply(null,arguments)},Fc=t._emscripten_bind_btRigidBody_setRollingFriction_1=function(){return(Fc=t._emscripten_bind_btRigidBody_setRollingFriction_1=t.asm.emscripten_bind_btRigidBody_setRollingFriction_1).apply(null,arguments)},Bc=t._emscripten_bind_btRigidBody_getWorldTransform_0=function(){return(Bc=t._emscripten_bind_btRigidBody_getWorldTransform_0=t.asm.emscripten_bind_btRigidBody_getWorldTransform_0).apply(null,arguments)},Nc=t._emscripten_bind_btRigidBody_getCollisionFlags_0=function(){return(Nc=t._emscripten_bind_btRigidBody_getCollisionFlags_0=t.asm.emscripten_bind_btRigidBody_getCollisionFlags_0).apply(null,arguments)},Lc=t._emscripten_bind_btRigidBody_setCollisionFlags_1=function(){return(Lc=t._emscripten_bind_btRigidBody_setCollisionFlags_1=t.asm.emscripten_bind_btRigidBody_setCollisionFlags_1).apply(null,arguments)},kc=t._emscripten_bind_btRigidBody_setWorldTransform_1=function(){return(kc=t._emscripten_bind_btRigidBody_setWorldTransform_1=t.asm.emscripten_bind_btRigidBody_setWorldTransform_1).apply(null,arguments)},Vc=t._emscripten_bind_btRigidBody_setCollisionShape_1=function(){return(Vc=t._emscripten_bind_btRigidBody_setCollisionShape_1=t.asm.emscripten_bind_btRigidBody_setCollisionShape_1).apply(null,arguments)},Uc=t._emscripten_bind_btRigidBody_setCcdMotionThreshold_1=function(){return(Uc=t._emscripten_bind_btRigidBody_setCcdMotionThreshold_1=t.asm.emscripten_bind_btRigidBody_setCcdMotionThreshold_1).apply(null,arguments)},Gc=t._emscripten_bind_btRigidBody_setCcdSweptSphereRadius_1=function(){return(Gc=t._emscripten_bind_btRigidBody_setCcdSweptSphereRadius_1=t.asm.emscripten_bind_btRigidBody_setCcdSweptSphereRadius_1).apply(null,arguments)},jc=t._emscripten_bind_btRigidBody_getUserIndex_0=function(){return(jc=t._emscripten_bind_btRigidBody_getUserIndex_0=t.asm.emscripten_bind_btRigidBody_getUserIndex_0).apply(null,arguments)},Wc=t._emscripten_bind_btRigidBody_setUserIndex_1=function(){return(Wc=t._emscripten_bind_btRigidBody_setUserIndex_1=t.asm.emscripten_bind_btRigidBody_setUserIndex_1).apply(null,arguments)},zc=t._emscripten_bind_btRigidBody_getUserPointer_0=function(){return(zc=t._emscripten_bind_btRigidBody_getUserPointer_0=t.asm.emscripten_bind_btRigidBody_getUserPointer_0).apply(null,arguments)},Hc=t._emscripten_bind_btRigidBody_setUserPointer_1=function(){return(Hc=t._emscripten_bind_btRigidBody_setUserPointer_1=t.asm.emscripten_bind_btRigidBody_setUserPointer_1).apply(null,arguments)},Xc=t._emscripten_bind_btRigidBody_getBroadphaseHandle_0=function(){return(Xc=t._emscripten_bind_btRigidBody_getBroadphaseHandle_0=t.asm.emscripten_bind_btRigidBody_getBroadphaseHandle_0).apply(null,arguments)},Yc=t._emscripten_bind_btRigidBody___destroy___0=function(){return(Yc=t._emscripten_bind_btRigidBody___destroy___0=t.asm.emscripten_bind_btRigidBody___destroy___0).apply(null,arguments)},Qc=t._emscripten_bind_btIndexedMeshArray_size_0=function(){return(Qc=t._emscripten_bind_btIndexedMeshArray_size_0=t.asm.emscripten_bind_btIndexedMeshArray_size_0).apply(null,arguments)},qc=t._emscripten_bind_btIndexedMeshArray_at_1=function(){return(qc=t._emscripten_bind_btIndexedMeshArray_at_1=t.asm.emscripten_bind_btIndexedMeshArray_at_1).apply(null,arguments)},Kc=t._emscripten_bind_btIndexedMeshArray___destroy___0=function(){return(Kc=t._emscripten_bind_btIndexedMeshArray___destroy___0=t.asm.emscripten_bind_btIndexedMeshArray___destroy___0).apply(null,arguments)},Zc=t._emscripten_bind_btDbvtBroadphase_btDbvtBroadphase_0=function(){return(Zc=t._emscripten_bind_btDbvtBroadphase_btDbvtBroadphase_0=t.asm.emscripten_bind_btDbvtBroadphase_btDbvtBroadphase_0).apply(null,arguments)},$c=t._emscripten_bind_btDbvtBroadphase___destroy___0=function(){return($c=t._emscripten_bind_btDbvtBroadphase___destroy___0=t.asm.emscripten_bind_btDbvtBroadphase___destroy___0).apply(null,arguments)},Jc=t._emscripten_bind_btHeightfieldTerrainShape_btHeightfieldTerrainShape_9=function(){return(Jc=t._emscripten_bind_btHeightfieldTerrainShape_btHeightfieldTerrainShape_9=t.asm.emscripten_bind_btHeightfieldTerrainShape_btHeightfieldTerrainShape_9).apply(null,arguments)},eh=t._emscripten_bind_btHeightfieldTerrainShape_setMargin_1=function(){return(eh=t._emscripten_bind_btHeightfieldTerrainShape_setMargin_1=t.asm.emscripten_bind_btHeightfieldTerrainShape_setMargin_1).apply(null,arguments)},th=t._emscripten_bind_btHeightfieldTerrainShape_getMargin_0=function(){return(th=t._emscripten_bind_btHeightfieldTerrainShape_getMargin_0=t.asm.emscripten_bind_btHeightfieldTerrainShape_getMargin_0).apply(null,arguments)},ih=t._emscripten_bind_btHeightfieldTerrainShape_setLocalScaling_1=function(){return(ih=t._emscripten_bind_btHeightfieldTerrainShape_setLocalScaling_1=t.asm.emscripten_bind_btHeightfieldTerrainShape_setLocalScaling_1).apply(null,arguments)},nh=t._emscripten_bind_btHeightfieldTerrainShape_getLocalScaling_0=function(){return(nh=t._emscripten_bind_btHeightfieldTerrainShape_getLocalScaling_0=t.asm.emscripten_bind_btHeightfieldTerrainShape_getLocalScaling_0).apply(null,arguments)},rh=t._emscripten_bind_btHeightfieldTerrainShape_calculateLocalInertia_2=function(){return(rh=t._emscripten_bind_btHeightfieldTerrainShape_calculateLocalInertia_2=t.asm.emscripten_bind_btHeightfieldTerrainShape_calculateLocalInertia_2).apply(null,arguments)},sh=t._emscripten_bind_btHeightfieldTerrainShape___destroy___0=function(){return(sh=t._emscripten_bind_btHeightfieldTerrainShape___destroy___0=t.asm.emscripten_bind_btHeightfieldTerrainShape___destroy___0).apply(null,arguments)},oh=t._emscripten_bind_btDefaultSoftBodySolver_btDefaultSoftBodySolver_0=function(){return(oh=t._emscripten_bind_btDefaultSoftBodySolver_btDefaultSoftBodySolver_0=t.asm.emscripten_bind_btDefaultSoftBodySolver_btDefaultSoftBodySolver_0).apply(null,arguments)},ah=t._emscripten_bind_btDefaultSoftBodySolver___destroy___0=function(){return(ah=t._emscripten_bind_btDefaultSoftBodySolver___destroy___0=t.asm.emscripten_bind_btDefaultSoftBodySolver___destroy___0).apply(null,arguments)},lh=t._emscripten_bind_btCollisionDispatcher_btCollisionDispatcher_1=function(){return(lh=t._emscripten_bind_btCollisionDispatcher_btCollisionDispatcher_1=t.asm.emscripten_bind_btCollisionDispatcher_btCollisionDispatcher_1).apply(null,arguments)},ch=t._emscripten_bind_btCollisionDispatcher_getNumManifolds_0=function(){return(ch=t._emscripten_bind_btCollisionDispatcher_getNumManifolds_0=t.asm.emscripten_bind_btCollisionDispatcher_getNumManifolds_0).apply(null,arguments)},hh=t._emscripten_bind_btCollisionDispatcher_getManifoldByIndexInternal_1=function(){return(hh=t._emscripten_bind_btCollisionDispatcher_getManifoldByIndexInternal_1=t.asm.emscripten_bind_btCollisionDispatcher_getManifoldByIndexInternal_1).apply(null,arguments)},_h=t._emscripten_bind_btCollisionDispatcher___destroy___0=function(){return(_h=t._emscripten_bind_btCollisionDispatcher___destroy___0=t.asm.emscripten_bind_btCollisionDispatcher___destroy___0).apply(null,arguments)},dh=t._emscripten_bind_btAxisSweep3_btAxisSweep3_2=function(){return(dh=t._emscripten_bind_btAxisSweep3_btAxisSweep3_2=t.asm.emscripten_bind_btAxisSweep3_btAxisSweep3_2).apply(null,arguments)},uh=t._emscripten_bind_btAxisSweep3_btAxisSweep3_3=function(){return(uh=t._emscripten_bind_btAxisSweep3_btAxisSweep3_3=t.asm.emscripten_bind_btAxisSweep3_btAxisSweep3_3).apply(null,arguments)},ph=t._emscripten_bind_btAxisSweep3_btAxisSweep3_4=function(){return(ph=t._emscripten_bind_btAxisSweep3_btAxisSweep3_4=t.asm.emscripten_bind_btAxisSweep3_btAxisSweep3_4).apply(null,arguments)},fh=t._emscripten_bind_btAxisSweep3_btAxisSweep3_5=function(){return(fh=t._emscripten_bind_btAxisSweep3_btAxisSweep3_5=t.asm.emscripten_bind_btAxisSweep3_btAxisSweep3_5).apply(null,arguments)},mh=t._emscripten_bind_btAxisSweep3___destroy___0=function(){return(mh=t._emscripten_bind_btAxisSweep3___destroy___0=t.asm.emscripten_bind_btAxisSweep3___destroy___0).apply(null,arguments)},gh=t._emscripten_bind_VoidPtr___destroy___0=function(){return(gh=t._emscripten_bind_VoidPtr___destroy___0=t.asm.emscripten_bind_VoidPtr___destroy___0).apply(null,arguments)},bh=t._emscripten_bind_btSoftBodyWorldInfo_btSoftBodyWorldInfo_0=function(){return(bh=t._emscripten_bind_btSoftBodyWorldInfo_btSoftBodyWorldInfo_0=t.asm.emscripten_bind_btSoftBodyWorldInfo_btSoftBodyWorldInfo_0).apply(null,arguments)},yh=t._emscripten_bind_btSoftBodyWorldInfo_get_air_density_0=function(){return(yh=t._emscripten_bind_btSoftBodyWorldInfo_get_air_density_0=t.asm.emscripten_bind_btSoftBodyWorldInfo_get_air_density_0).apply(null,arguments)},vh=t._emscripten_bind_btSoftBodyWorldInfo_set_air_density_1=function(){return(vh=t._emscripten_bind_btSoftBodyWorldInfo_set_air_density_1=t.asm.emscripten_bind_btSoftBodyWorldInfo_set_air_density_1).apply(null,arguments)},Ah=t._emscripten_bind_btSoftBodyWorldInfo_get_water_density_0=function(){return(Ah=t._emscripten_bind_btSoftBodyWorldInfo_get_water_density_0=t.asm.emscripten_bind_btSoftBodyWorldInfo_get_water_density_0).apply(null,arguments)},Ch=t._emscripten_bind_btSoftBodyWorldInfo_set_water_density_1=function(){return(Ch=t._emscripten_bind_btSoftBodyWorldInfo_set_water_density_1=t.asm.emscripten_bind_btSoftBodyWorldInfo_set_water_density_1).apply(null,arguments)},Sh=t._emscripten_bind_btSoftBodyWorldInfo_get_water_offset_0=function(){return(Sh=t._emscripten_bind_btSoftBodyWorldInfo_get_water_offset_0=t.asm.emscripten_bind_btSoftBodyWorldInfo_get_water_offset_0).apply(null,arguments)},xh=t._emscripten_bind_btSoftBodyWorldInfo_set_water_offset_1=function(){return(xh=t._emscripten_bind_btSoftBodyWorldInfo_set_water_offset_1=t.asm.emscripten_bind_btSoftBodyWorldInfo_set_water_offset_1).apply(null,arguments)},Th=t._emscripten_bind_btSoftBodyWorldInfo_get_m_maxDisplacement_0=function(){return(Th=t._emscripten_bind_btSoftBodyWorldInfo_get_m_maxDisplacement_0=t.asm.emscripten_bind_btSoftBodyWorldInfo_get_m_maxDisplacement_0).apply(null,arguments)},Eh=t._emscripten_bind_btSoftBodyWorldInfo_set_m_maxDisplacement_1=function(){return(Eh=t._emscripten_bind_btSoftBodyWorldInfo_set_m_maxDisplacement_1=t.asm.emscripten_bind_btSoftBodyWorldInfo_set_m_maxDisplacement_1).apply(null,arguments)},Rh=t._emscripten_bind_btSoftBodyWorldInfo_get_water_normal_0=function(){return(Rh=t._emscripten_bind_btSoftBodyWorldInfo_get_water_normal_0=t.asm.emscripten_bind_btSoftBodyWorldInfo_get_water_normal_0).apply(null,arguments)},Ph=t._emscripten_bind_btSoftBodyWorldInfo_set_water_normal_1=function(){return(Ph=t._emscripten_bind_btSoftBodyWorldInfo_set_water_normal_1=t.asm.emscripten_bind_btSoftBodyWorldInfo_set_water_normal_1).apply(null,arguments)},Ih=t._emscripten_bind_btSoftBodyWorldInfo_get_m_broadphase_0=function(){return(Ih=t._emscripten_bind_btSoftBodyWorldInfo_get_m_broadphase_0=t.asm.emscripten_bind_btSoftBodyWorldInfo_get_m_broadphase_0).apply(null,arguments)},Mh=t._emscripten_bind_btSoftBodyWorldInfo_set_m_broadphase_1=function(){return(Mh=t._emscripten_bind_btSoftBodyWorldInfo_set_m_broadphase_1=t.asm.emscripten_bind_btSoftBodyWorldInfo_set_m_broadphase_1).apply(null,arguments)},Dh=t._emscripten_bind_btSoftBodyWorldInfo_get_m_dispatcher_0=function(){return(Dh=t._emscripten_bind_btSoftBodyWorldInfo_get_m_dispatcher_0=t.asm.emscripten_bind_btSoftBodyWorldInfo_get_m_dispatcher_0).apply(null,arguments)},Oh=t._emscripten_bind_btSoftBodyWorldInfo_set_m_dispatcher_1=function(){return(Oh=t._emscripten_bind_btSoftBodyWorldInfo_set_m_dispatcher_1=t.asm.emscripten_bind_btSoftBodyWorldInfo_set_m_dispatcher_1).apply(null,arguments)},wh=t._emscripten_bind_btSoftBodyWorldInfo_get_m_gravity_0=function(){return(wh=t._emscripten_bind_btSoftBodyWorldInfo_get_m_gravity_0=t.asm.emscripten_bind_btSoftBodyWorldInfo_get_m_gravity_0).apply(null,arguments)},Fh=t._emscripten_bind_btSoftBodyWorldInfo_set_m_gravity_1=function(){return(Fh=t._emscripten_bind_btSoftBodyWorldInfo_set_m_gravity_1=t.asm.emscripten_bind_btSoftBodyWorldInfo_set_m_gravity_1).apply(null,arguments)},Bh=t._emscripten_bind_btSoftBodyWorldInfo___destroy___0=function(){return(Bh=t._emscripten_bind_btSoftBodyWorldInfo___destroy___0=t.asm.emscripten_bind_btSoftBodyWorldInfo___destroy___0).apply(null,arguments)},Nh=t._emscripten_bind_btConeTwistConstraint_btConeTwistConstraint_2=function(){return(Nh=t._emscripten_bind_btConeTwistConstraint_btConeTwistConstraint_2=t.asm.emscripten_bind_btConeTwistConstraint_btConeTwistConstraint_2).apply(null,arguments)},Lh=t._emscripten_bind_btConeTwistConstraint_btConeTwistConstraint_4=function(){return(Lh=t._emscripten_bind_btConeTwistConstraint_btConeTwistConstraint_4=t.asm.emscripten_bind_btConeTwistConstraint_btConeTwistConstraint_4).apply(null,arguments)},kh=t._emscripten_bind_btConeTwistConstraint_setLimit_2=function(){return(kh=t._emscripten_bind_btConeTwistConstraint_setLimit_2=t.asm.emscripten_bind_btConeTwistConstraint_setLimit_2).apply(null,arguments)},Vh=t._emscripten_bind_btConeTwistConstraint_setAngularOnly_1=function(){return(Vh=t._emscripten_bind_btConeTwistConstraint_setAngularOnly_1=t.asm.emscripten_bind_btConeTwistConstraint_setAngularOnly_1).apply(null,arguments)},Uh=t._emscripten_bind_btConeTwistConstraint_setDamping_1=function(){return(Uh=t._emscripten_bind_btConeTwistConstraint_setDamping_1=t.asm.emscripten_bind_btConeTwistConstraint_setDamping_1).apply(null,arguments)},Gh=t._emscripten_bind_btConeTwistConstraint_enableMotor_1=function(){return(Gh=t._emscripten_bind_btConeTwistConstraint_enableMotor_1=t.asm.emscripten_bind_btConeTwistConstraint_enableMotor_1).apply(null,arguments)},jh=t._emscripten_bind_btConeTwistConstraint_setMaxMotorImpulse_1=function(){return(jh=t._emscripten_bind_btConeTwistConstraint_setMaxMotorImpulse_1=t.asm.emscripten_bind_btConeTwistConstraint_setMaxMotorImpulse_1).apply(null,arguments)},Wh=t._emscripten_bind_btConeTwistConstraint_setMaxMotorImpulseNormalized_1=function(){return(Wh=t._emscripten_bind_btConeTwistConstraint_setMaxMotorImpulseNormalized_1=t.asm.emscripten_bind_btConeTwistConstraint_setMaxMotorImpulseNormalized_1).apply(null,arguments)},zh=t._emscripten_bind_btConeTwistConstraint_setMotorTarget_1=function(){return(zh=t._emscripten_bind_btConeTwistConstraint_setMotorTarget_1=t.asm.emscripten_bind_btConeTwistConstraint_setMotorTarget_1).apply(null,arguments)},Hh=t._emscripten_bind_btConeTwistConstraint_setMotorTargetInConstraintSpace_1=function(){return(Hh=t._emscripten_bind_btConeTwistConstraint_setMotorTargetInConstraintSpace_1=t.asm.emscripten_bind_btConeTwistConstraint_setMotorTargetInConstraintSpace_1).apply(null,arguments)},Xh=t._emscripten_bind_btConeTwistConstraint_enableFeedback_1=function(){return(Xh=t._emscripten_bind_btConeTwistConstraint_enableFeedback_1=t.asm.emscripten_bind_btConeTwistConstraint_enableFeedback_1).apply(null,arguments)},Yh=t._emscripten_bind_btConeTwistConstraint_getBreakingImpulseThreshold_0=function(){return(Yh=t._emscripten_bind_btConeTwistConstraint_getBreakingImpulseThreshold_0=t.asm.emscripten_bind_btConeTwistConstraint_getBreakingImpulseThreshold_0).apply(null,arguments)},Qh=t._emscripten_bind_btConeTwistConstraint_setBreakingImpulseThreshold_1=function(){return(Qh=t._emscripten_bind_btConeTwistConstraint_setBreakingImpulseThreshold_1=t.asm.emscripten_bind_btConeTwistConstraint_setBreakingImpulseThreshold_1).apply(null,arguments)},qh=t._emscripten_bind_btConeTwistConstraint_getParam_2=function(){return(qh=t._emscripten_bind_btConeTwistConstraint_getParam_2=t.asm.emscripten_bind_btConeTwistConstraint_getParam_2).apply(null,arguments)},Kh=t._emscripten_bind_btConeTwistConstraint_setParam_3=function(){return(Kh=t._emscripten_bind_btConeTwistConstraint_setParam_3=t.asm.emscripten_bind_btConeTwistConstraint_setParam_3).apply(null,arguments)},Zh=t._emscripten_bind_btConeTwistConstraint___destroy___0=function(){return(Zh=t._emscripten_bind_btConeTwistConstraint___destroy___0=t.asm.emscripten_bind_btConeTwistConstraint___destroy___0).apply(null,arguments)},$h=t._emscripten_bind_btHingeConstraint_btHingeConstraint_2=function(){return($h=t._emscripten_bind_btHingeConstraint_btHingeConstraint_2=t.asm.emscripten_bind_btHingeConstraint_btHingeConstraint_2).apply(null,arguments)},Jh=t._emscripten_bind_btHingeConstraint_btHingeConstraint_3=function(){return(Jh=t._emscripten_bind_btHingeConstraint_btHingeConstraint_3=t.asm.emscripten_bind_btHingeConstraint_btHingeConstraint_3).apply(null,arguments)},e_=t._emscripten_bind_btHingeConstraint_btHingeConstraint_4=function(){return(e_=t._emscripten_bind_btHingeConstraint_btHingeConstraint_4=t.asm.emscripten_bind_btHingeConstraint_btHingeConstraint_4).apply(null,arguments)},t_=t._emscripten_bind_btHingeConstraint_btHingeConstraint_5=function(){return(t_=t._emscripten_bind_btHingeConstraint_btHingeConstraint_5=t.asm.emscripten_bind_btHingeConstraint_btHingeConstraint_5).apply(null,arguments)},i_=t._emscripten_bind_btHingeConstraint_btHingeConstraint_6=function(){return(i_=t._emscripten_bind_btHingeConstraint_btHingeConstraint_6=t.asm.emscripten_bind_btHingeConstraint_btHingeConstraint_6).apply(null,arguments)},n_=t._emscripten_bind_btHingeConstraint_btHingeConstraint_7=function(){return(n_=t._emscripten_bind_btHingeConstraint_btHingeConstraint_7=t.asm.emscripten_bind_btHingeConstraint_btHingeConstraint_7).apply(null,arguments)},r_=t._emscripten_bind_btHingeConstraint_setLimit_4=function(){return(r_=t._emscripten_bind_btHingeConstraint_setLimit_4=t.asm.emscripten_bind_btHingeConstraint_setLimit_4).apply(null,arguments)},s_=t._emscripten_bind_btHingeConstraint_setLimit_5=function(){return(s_=t._emscripten_bind_btHingeConstraint_setLimit_5=t.asm.emscripten_bind_btHingeConstraint_setLimit_5).apply(null,arguments)},o_=t._emscripten_bind_btHingeConstraint_enableAngularMotor_3=function(){return(o_=t._emscripten_bind_btHingeConstraint_enableAngularMotor_3=t.asm.emscripten_bind_btHingeConstraint_enableAngularMotor_3).apply(null,arguments)},a_=t._emscripten_bind_btHingeConstraint_setAngularOnly_1=function(){return(a_=t._emscripten_bind_btHingeConstraint_setAngularOnly_1=t.asm.emscripten_bind_btHingeConstraint_setAngularOnly_1).apply(null,arguments)},l_=t._emscripten_bind_btHingeConstraint_enableMotor_1=function(){return(l_=t._emscripten_bind_btHingeConstraint_enableMotor_1=t.asm.emscripten_bind_btHingeConstraint_enableMotor_1).apply(null,arguments)},c_=t._emscripten_bind_btHingeConstraint_setMaxMotorImpulse_1=function(){return(c_=t._emscripten_bind_btHingeConstraint_setMaxMotorImpulse_1=t.asm.emscripten_bind_btHingeConstraint_setMaxMotorImpulse_1).apply(null,arguments)},h_=t._emscripten_bind_btHingeConstraint_setMotorTarget_2=function(){return(h_=t._emscripten_bind_btHingeConstraint_setMotorTarget_2=t.asm.emscripten_bind_btHingeConstraint_setMotorTarget_2).apply(null,arguments)},__=t._emscripten_bind_btHingeConstraint_enableFeedback_1=function(){return(__=t._emscripten_bind_btHingeConstraint_enableFeedback_1=t.asm.emscripten_bind_btHingeConstraint_enableFeedback_1).apply(null,arguments)},d_=t._emscripten_bind_btHingeConstraint_getBreakingImpulseThreshold_0=function(){return(d_=t._emscripten_bind_btHingeConstraint_getBreakingImpulseThreshold_0=t.asm.emscripten_bind_btHingeConstraint_getBreakingImpulseThreshold_0).apply(null,arguments)},u_=t._emscripten_bind_btHingeConstraint_setBreakingImpulseThreshold_1=function(){return(u_=t._emscripten_bind_btHingeConstraint_setBreakingImpulseThreshold_1=t.asm.emscripten_bind_btHingeConstraint_setBreakingImpulseThreshold_1).apply(null,arguments)},p_=t._emscripten_bind_btHingeConstraint_getParam_2=function(){return(p_=t._emscripten_bind_btHingeConstraint_getParam_2=t.asm.emscripten_bind_btHingeConstraint_getParam_2).apply(null,arguments)},f_=t._emscripten_bind_btHingeConstraint_setParam_3=function(){return(f_=t._emscripten_bind_btHingeConstraint_setParam_3=t.asm.emscripten_bind_btHingeConstraint_setParam_3).apply(null,arguments)},m_=t._emscripten_bind_btHingeConstraint___destroy___0=function(){return(m_=t._emscripten_bind_btHingeConstraint___destroy___0=t.asm.emscripten_bind_btHingeConstraint___destroy___0).apply(null,arguments)},g_=t._emscripten_bind_btConeShapeZ_btConeShapeZ_2=function(){return(g_=t._emscripten_bind_btConeShapeZ_btConeShapeZ_2=t.asm.emscripten_bind_btConeShapeZ_btConeShapeZ_2).apply(null,arguments)},b_=t._emscripten_bind_btConeShapeZ_setLocalScaling_1=function(){return(b_=t._emscripten_bind_btConeShapeZ_setLocalScaling_1=t.asm.emscripten_bind_btConeShapeZ_setLocalScaling_1).apply(null,arguments)},y_=t._emscripten_bind_btConeShapeZ_getLocalScaling_0=function(){return(y_=t._emscripten_bind_btConeShapeZ_getLocalScaling_0=t.asm.emscripten_bind_btConeShapeZ_getLocalScaling_0).apply(null,arguments)},v_=t._emscripten_bind_btConeShapeZ_calculateLocalInertia_2=function(){return(v_=t._emscripten_bind_btConeShapeZ_calculateLocalInertia_2=t.asm.emscripten_bind_btConeShapeZ_calculateLocalInertia_2).apply(null,arguments)},A_=t._emscripten_bind_btConeShapeZ___destroy___0=function(){return(A_=t._emscripten_bind_btConeShapeZ___destroy___0=t.asm.emscripten_bind_btConeShapeZ___destroy___0).apply(null,arguments)},C_=t._emscripten_bind_btConeShapeX_btConeShapeX_2=function(){return(C_=t._emscripten_bind_btConeShapeX_btConeShapeX_2=t.asm.emscripten_bind_btConeShapeX_btConeShapeX_2).apply(null,arguments)},S_=t._emscripten_bind_btConeShapeX_setLocalScaling_1=function(){return(S_=t._emscripten_bind_btConeShapeX_setLocalScaling_1=t.asm.emscripten_bind_btConeShapeX_setLocalScaling_1).apply(null,arguments)},x_=t._emscripten_bind_btConeShapeX_getLocalScaling_0=function(){return(x_=t._emscripten_bind_btConeShapeX_getLocalScaling_0=t.asm.emscripten_bind_btConeShapeX_getLocalScaling_0).apply(null,arguments)},T_=t._emscripten_bind_btConeShapeX_calculateLocalInertia_2=function(){return(T_=t._emscripten_bind_btConeShapeX_calculateLocalInertia_2=t.asm.emscripten_bind_btConeShapeX_calculateLocalInertia_2).apply(null,arguments)},E_=t._emscripten_bind_btConeShapeX___destroy___0=function(){return(E_=t._emscripten_bind_btConeShapeX___destroy___0=t.asm.emscripten_bind_btConeShapeX___destroy___0).apply(null,arguments)},R_=t._emscripten_bind_btTriangleMesh_btTriangleMesh_0=function(){return(R_=t._emscripten_bind_btTriangleMesh_btTriangleMesh_0=t.asm.emscripten_bind_btTriangleMesh_btTriangleMesh_0).apply(null,arguments)},P_=t._emscripten_bind_btTriangleMesh_btTriangleMesh_1=function(){return(P_=t._emscripten_bind_btTriangleMesh_btTriangleMesh_1=t.asm.emscripten_bind_btTriangleMesh_btTriangleMesh_1).apply(null,arguments)},I_=t._emscripten_bind_btTriangleMesh_btTriangleMesh_2=function(){return(I_=t._emscripten_bind_btTriangleMesh_btTriangleMesh_2=t.asm.emscripten_bind_btTriangleMesh_btTriangleMesh_2).apply(null,arguments)},M_=t._emscripten_bind_btTriangleMesh_addTriangle_3=function(){return(M_=t._emscripten_bind_btTriangleMesh_addTriangle_3=t.asm.emscripten_bind_btTriangleMesh_addTriangle_3).apply(null,arguments)},D_=t._emscripten_bind_btTriangleMesh_addTriangle_4=function(){return(D_=t._emscripten_bind_btTriangleMesh_addTriangle_4=t.asm.emscripten_bind_btTriangleMesh_addTriangle_4).apply(null,arguments)},O_=t._emscripten_bind_btTriangleMesh_findOrAddVertex_2=function(){return(O_=t._emscripten_bind_btTriangleMesh_findOrAddVertex_2=t.asm.emscripten_bind_btTriangleMesh_findOrAddVertex_2).apply(null,arguments)},w_=t._emscripten_bind_btTriangleMesh_addIndex_1=function(){return(w_=t._emscripten_bind_btTriangleMesh_addIndex_1=t.asm.emscripten_bind_btTriangleMesh_addIndex_1).apply(null,arguments)},F_=t._emscripten_bind_btTriangleMesh_getIndexedMeshArray_0=function(){return(F_=t._emscripten_bind_btTriangleMesh_getIndexedMeshArray_0=t.asm.emscripten_bind_btTriangleMesh_getIndexedMeshArray_0).apply(null,arguments)},B_=t._emscripten_bind_btTriangleMesh_setScaling_1=function(){return(B_=t._emscripten_bind_btTriangleMesh_setScaling_1=t.asm.emscripten_bind_btTriangleMesh_setScaling_1).apply(null,arguments)},N_=t._emscripten_bind_btTriangleMesh___destroy___0=function(){return(N_=t._emscripten_bind_btTriangleMesh___destroy___0=t.asm.emscripten_bind_btTriangleMesh___destroy___0).apply(null,arguments)},L_=t._emscripten_bind_btConvexHullShape_btConvexHullShape_0=function(){return(L_=t._emscripten_bind_btConvexHullShape_btConvexHullShape_0=t.asm.emscripten_bind_btConvexHullShape_btConvexHullShape_0).apply(null,arguments)},k_=t._emscripten_bind_btConvexHullShape_btConvexHullShape_1=function(){return(k_=t._emscripten_bind_btConvexHullShape_btConvexHullShape_1=t.asm.emscripten_bind_btConvexHullShape_btConvexHullShape_1).apply(null,arguments)},V_=t._emscripten_bind_btConvexHullShape_btConvexHullShape_2=function(){return(V_=t._emscripten_bind_btConvexHullShape_btConvexHullShape_2=t.asm.emscripten_bind_btConvexHullShape_btConvexHullShape_2).apply(null,arguments)},U_=t._emscripten_bind_btConvexHullShape_addPoint_1=function(){return(U_=t._emscripten_bind_btConvexHullShape_addPoint_1=t.asm.emscripten_bind_btConvexHullShape_addPoint_1).apply(null,arguments)},G_=t._emscripten_bind_btConvexHullShape_addPoint_2=function(){return(G_=t._emscripten_bind_btConvexHullShape_addPoint_2=t.asm.emscripten_bind_btConvexHullShape_addPoint_2).apply(null,arguments)},j_=t._emscripten_bind_btConvexHullShape_setMargin_1=function(){return(j_=t._emscripten_bind_btConvexHullShape_setMargin_1=t.asm.emscripten_bind_btConvexHullShape_setMargin_1).apply(null,arguments)},W_=t._emscripten_bind_btConvexHullShape_getMargin_0=function(){return(W_=t._emscripten_bind_btConvexHullShape_getMargin_0=t.asm.emscripten_bind_btConvexHullShape_getMargin_0).apply(null,arguments)},z_=t._emscripten_bind_btConvexHullShape_getNumVertices_0=function(){return(z_=t._emscripten_bind_btConvexHullShape_getNumVertices_0=t.asm.emscripten_bind_btConvexHullShape_getNumVertices_0).apply(null,arguments)},H_=t._emscripten_bind_btConvexHullShape_initializePolyhedralFeatures_1=function(){return(H_=t._emscripten_bind_btConvexHullShape_initializePolyhedralFeatures_1=t.asm.emscripten_bind_btConvexHullShape_initializePolyhedralFeatures_1).apply(null,arguments)},X_=t._emscripten_bind_btConvexHullShape_recalcLocalAabb_0=function(){return(X_=t._emscripten_bind_btConvexHullShape_recalcLocalAabb_0=t.asm.emscripten_bind_btConvexHullShape_recalcLocalAabb_0).apply(null,arguments)},Y_=t._emscripten_bind_btConvexHullShape_getConvexPolyhedron_0=function(){return(Y_=t._emscripten_bind_btConvexHullShape_getConvexPolyhedron_0=t.asm.emscripten_bind_btConvexHullShape_getConvexPolyhedron_0).apply(null,arguments)},Q_=t._emscripten_bind_btConvexHullShape_setLocalScaling_1=function(){return(Q_=t._emscripten_bind_btConvexHullShape_setLocalScaling_1=t.asm.emscripten_bind_btConvexHullShape_setLocalScaling_1).apply(null,arguments)},q_=t._emscripten_bind_btConvexHullShape_getLocalScaling_0=function(){return(q_=t._emscripten_bind_btConvexHullShape_getLocalScaling_0=t.asm.emscripten_bind_btConvexHullShape_getLocalScaling_0).apply(null,arguments)},K_=t._emscripten_bind_btConvexHullShape_calculateLocalInertia_2=function(){return(K_=t._emscripten_bind_btConvexHullShape_calculateLocalInertia_2=t.asm.emscripten_bind_btConvexHullShape_calculateLocalInertia_2).apply(null,arguments)},Z_=t._emscripten_bind_btConvexHullShape___destroy___0=function(){return(Z_=t._emscripten_bind_btConvexHullShape___destroy___0=t.asm.emscripten_bind_btConvexHullShape___destroy___0).apply(null,arguments)},$_=t._emscripten_bind_btVehicleTuning_btVehicleTuning_0=function(){return($_=t._emscripten_bind_btVehicleTuning_btVehicleTuning_0=t.asm.emscripten_bind_btVehicleTuning_btVehicleTuning_0).apply(null,arguments)},J_=t._emscripten_bind_btVehicleTuning_get_m_suspensionStiffness_0=function(){return(J_=t._emscripten_bind_btVehicleTuning_get_m_suspensionStiffness_0=t.asm.emscripten_bind_btVehicleTuning_get_m_suspensionStiffness_0).apply(null,arguments)},ed=t._emscripten_bind_btVehicleTuning_set_m_suspensionStiffness_1=function(){return(ed=t._emscripten_bind_btVehicleTuning_set_m_suspensionStiffness_1=t.asm.emscripten_bind_btVehicleTuning_set_m_suspensionStiffness_1).apply(null,arguments)},td=t._emscripten_bind_btVehicleTuning_get_m_suspensionCompression_0=function(){return(td=t._emscripten_bind_btVehicleTuning_get_m_suspensionCompression_0=t.asm.emscripten_bind_btVehicleTuning_get_m_suspensionCompression_0).apply(null,arguments)},id=t._emscripten_bind_btVehicleTuning_set_m_suspensionCompression_1=function(){return(id=t._emscripten_bind_btVehicleTuning_set_m_suspensionCompression_1=t.asm.emscripten_bind_btVehicleTuning_set_m_suspensionCompression_1).apply(null,arguments)},nd=t._emscripten_bind_btVehicleTuning_get_m_suspensionDamping_0=function(){return(nd=t._emscripten_bind_btVehicleTuning_get_m_suspensionDamping_0=t.asm.emscripten_bind_btVehicleTuning_get_m_suspensionDamping_0).apply(null,arguments)},rd=t._emscripten_bind_btVehicleTuning_set_m_suspensionDamping_1=function(){return(rd=t._emscripten_bind_btVehicleTuning_set_m_suspensionDamping_1=t.asm.emscripten_bind_btVehicleTuning_set_m_suspensionDamping_1).apply(null,arguments)},sd=t._emscripten_bind_btVehicleTuning_get_m_maxSuspensionTravelCm_0=function(){return(sd=t._emscripten_bind_btVehicleTuning_get_m_maxSuspensionTravelCm_0=t.asm.emscripten_bind_btVehicleTuning_get_m_maxSuspensionTravelCm_0).apply(null,arguments)},od=t._emscripten_bind_btVehicleTuning_set_m_maxSuspensionTravelCm_1=function(){return(od=t._emscripten_bind_btVehicleTuning_set_m_maxSuspensionTravelCm_1=t.asm.emscripten_bind_btVehicleTuning_set_m_maxSuspensionTravelCm_1).apply(null,arguments)},ad=t._emscripten_bind_btVehicleTuning_get_m_frictionSlip_0=function(){return(ad=t._emscripten_bind_btVehicleTuning_get_m_frictionSlip_0=t.asm.emscripten_bind_btVehicleTuning_get_m_frictionSlip_0).apply(null,arguments)},ld=t._emscripten_bind_btVehicleTuning_set_m_frictionSlip_1=function(){return(ld=t._emscripten_bind_btVehicleTuning_set_m_frictionSlip_1=t.asm.emscripten_bind_btVehicleTuning_set_m_frictionSlip_1).apply(null,arguments)},cd=t._emscripten_bind_btVehicleTuning_get_m_maxSuspensionForce_0=function(){return(cd=t._emscripten_bind_btVehicleTuning_get_m_maxSuspensionForce_0=t.asm.emscripten_bind_btVehicleTuning_get_m_maxSuspensionForce_0).apply(null,arguments)},hd=t._emscripten_bind_btVehicleTuning_set_m_maxSuspensionForce_1=function(){return(hd=t._emscripten_bind_btVehicleTuning_set_m_maxSuspensionForce_1=t.asm.emscripten_bind_btVehicleTuning_set_m_maxSuspensionForce_1).apply(null,arguments)},_d=t._emscripten_bind_btCollisionObjectWrapper_getWorldTransform_0=function(){return(_d=t._emscripten_bind_btCollisionObjectWrapper_getWorldTransform_0=t.asm.emscripten_bind_btCollisionObjectWrapper_getWorldTransform_0).apply(null,arguments)},dd=t._emscripten_bind_btCollisionObjectWrapper_getCollisionObject_0=function(){return(dd=t._emscripten_bind_btCollisionObjectWrapper_getCollisionObject_0=t.asm.emscripten_bind_btCollisionObjectWrapper_getCollisionObject_0).apply(null,arguments)},ud=t._emscripten_bind_btCollisionObjectWrapper_getCollisionShape_0=function(){return(ud=t._emscripten_bind_btCollisionObjectWrapper_getCollisionShape_0=t.asm.emscripten_bind_btCollisionObjectWrapper_getCollisionShape_0).apply(null,arguments)},pd=t._emscripten_bind_btShapeHull_btShapeHull_1=function(){return(pd=t._emscripten_bind_btShapeHull_btShapeHull_1=t.asm.emscripten_bind_btShapeHull_btShapeHull_1).apply(null,arguments)},fd=t._emscripten_bind_btShapeHull_buildHull_1=function(){return(fd=t._emscripten_bind_btShapeHull_buildHull_1=t.asm.emscripten_bind_btShapeHull_buildHull_1).apply(null,arguments)},md=t._emscripten_bind_btShapeHull_numVertices_0=function(){return(md=t._emscripten_bind_btShapeHull_numVertices_0=t.asm.emscripten_bind_btShapeHull_numVertices_0).apply(null,arguments)},gd=t._emscripten_bind_btShapeHull_getVertexPointer_0=function(){return(gd=t._emscripten_bind_btShapeHull_getVertexPointer_0=t.asm.emscripten_bind_btShapeHull_getVertexPointer_0).apply(null,arguments)},bd=t._emscripten_bind_btShapeHull___destroy___0=function(){return(bd=t._emscripten_bind_btShapeHull___destroy___0=t.asm.emscripten_bind_btShapeHull___destroy___0).apply(null,arguments)},yd=t._emscripten_bind_btDefaultMotionState_btDefaultMotionState_0=function(){return(yd=t._emscripten_bind_btDefaultMotionState_btDefaultMotionState_0=t.asm.emscripten_bind_btDefaultMotionState_btDefaultMotionState_0).apply(null,arguments)},vd=t._emscripten_bind_btDefaultMotionState_btDefaultMotionState_1=function(){return(vd=t._emscripten_bind_btDefaultMotionState_btDefaultMotionState_1=t.asm.emscripten_bind_btDefaultMotionState_btDefaultMotionState_1).apply(null,arguments)},Ad=t._emscripten_bind_btDefaultMotionState_btDefaultMotionState_2=function(){return(Ad=t._emscripten_bind_btDefaultMotionState_btDefaultMotionState_2=t.asm.emscripten_bind_btDefaultMotionState_btDefaultMotionState_2).apply(null,arguments)},Cd=t._emscripten_bind_btDefaultMotionState_getWorldTransform_1=function(){return(Cd=t._emscripten_bind_btDefaultMotionState_getWorldTransform_1=t.asm.emscripten_bind_btDefaultMotionState_getWorldTransform_1).apply(null,arguments)},Sd=t._emscripten_bind_btDefaultMotionState_setWorldTransform_1=function(){return(Sd=t._emscripten_bind_btDefaultMotionState_setWorldTransform_1=t.asm.emscripten_bind_btDefaultMotionState_setWorldTransform_1).apply(null,arguments)},xd=t._emscripten_bind_btDefaultMotionState_get_m_graphicsWorldTrans_0=function(){return(xd=t._emscripten_bind_btDefaultMotionState_get_m_graphicsWorldTrans_0=t.asm.emscripten_bind_btDefaultMotionState_get_m_graphicsWorldTrans_0).apply(null,arguments)},Td=t._emscripten_bind_btDefaultMotionState_set_m_graphicsWorldTrans_1=function(){return(Td=t._emscripten_bind_btDefaultMotionState_set_m_graphicsWorldTrans_1=t.asm.emscripten_bind_btDefaultMotionState_set_m_graphicsWorldTrans_1).apply(null,arguments)},Ed=t._emscripten_bind_btDefaultMotionState___destroy___0=function(){return(Ed=t._emscripten_bind_btDefaultMotionState___destroy___0=t.asm.emscripten_bind_btDefaultMotionState___destroy___0).apply(null,arguments)},Rd=t._emscripten_bind_btWheelInfo_btWheelInfo_1=function(){return(Rd=t._emscripten_bind_btWheelInfo_btWheelInfo_1=t.asm.emscripten_bind_btWheelInfo_btWheelInfo_1).apply(null,arguments)},Pd=t._emscripten_bind_btWheelInfo_getSuspensionRestLength_0=function(){return(Pd=t._emscripten_bind_btWheelInfo_getSuspensionRestLength_0=t.asm.emscripten_bind_btWheelInfo_getSuspensionRestLength_0).apply(null,arguments)},Id=t._emscripten_bind_btWheelInfo_updateWheel_2=function(){return(Id=t._emscripten_bind_btWheelInfo_updateWheel_2=t.asm.emscripten_bind_btWheelInfo_updateWheel_2).apply(null,arguments)},Md=t._emscripten_bind_btWheelInfo_get_m_suspensionStiffness_0=function(){return(Md=t._emscripten_bind_btWheelInfo_get_m_suspensionStiffness_0=t.asm.emscripten_bind_btWheelInfo_get_m_suspensionStiffness_0).apply(null,arguments)},Dd=t._emscripten_bind_btWheelInfo_set_m_suspensionStiffness_1=function(){return(Dd=t._emscripten_bind_btWheelInfo_set_m_suspensionStiffness_1=t.asm.emscripten_bind_btWheelInfo_set_m_suspensionStiffness_1).apply(null,arguments)},Od=t._emscripten_bind_btWheelInfo_get_m_frictionSlip_0=function(){return(Od=t._emscripten_bind_btWheelInfo_get_m_frictionSlip_0=t.asm.emscripten_bind_btWheelInfo_get_m_frictionSlip_0).apply(null,arguments)},wd=t._emscripten_bind_btWheelInfo_set_m_frictionSlip_1=function(){return(wd=t._emscripten_bind_btWheelInfo_set_m_frictionSlip_1=t.asm.emscripten_bind_btWheelInfo_set_m_frictionSlip_1).apply(null,arguments)},Fd=t._emscripten_bind_btWheelInfo_get_m_engineForce_0=function(){return(Fd=t._emscripten_bind_btWheelInfo_get_m_engineForce_0=t.asm.emscripten_bind_btWheelInfo_get_m_engineForce_0).apply(null,arguments)},Bd=t._emscripten_bind_btWheelInfo_set_m_engineForce_1=function(){return(Bd=t._emscripten_bind_btWheelInfo_set_m_engineForce_1=t.asm.emscripten_bind_btWheelInfo_set_m_engineForce_1).apply(null,arguments)},Nd=t._emscripten_bind_btWheelInfo_get_m_rollInfluence_0=function(){return(Nd=t._emscripten_bind_btWheelInfo_get_m_rollInfluence_0=t.asm.emscripten_bind_btWheelInfo_get_m_rollInfluence_0).apply(null,arguments)},Ld=t._emscripten_bind_btWheelInfo_set_m_rollInfluence_1=function(){return(Ld=t._emscripten_bind_btWheelInfo_set_m_rollInfluence_1=t.asm.emscripten_bind_btWheelInfo_set_m_rollInfluence_1).apply(null,arguments)},kd=t._emscripten_bind_btWheelInfo_get_m_suspensionRestLength1_0=function(){return(kd=t._emscripten_bind_btWheelInfo_get_m_suspensionRestLength1_0=t.asm.emscripten_bind_btWheelInfo_get_m_suspensionRestLength1_0).apply(null,arguments)},Vd=t._emscripten_bind_btWheelInfo_set_m_suspensionRestLength1_1=function(){return(Vd=t._emscripten_bind_btWheelInfo_set_m_suspensionRestLength1_1=t.asm.emscripten_bind_btWheelInfo_set_m_suspensionRestLength1_1).apply(null,arguments)},Ud=t._emscripten_bind_btWheelInfo_get_m_wheelsRadius_0=function(){return(Ud=t._emscripten_bind_btWheelInfo_get_m_wheelsRadius_0=t.asm.emscripten_bind_btWheelInfo_get_m_wheelsRadius_0).apply(null,arguments)},Gd=t._emscripten_bind_btWheelInfo_set_m_wheelsRadius_1=function(){return(Gd=t._emscripten_bind_btWheelInfo_set_m_wheelsRadius_1=t.asm.emscripten_bind_btWheelInfo_set_m_wheelsRadius_1).apply(null,arguments)},jd=t._emscripten_bind_btWheelInfo_get_m_wheelsDampingCompression_0=function(){return(jd=t._emscripten_bind_btWheelInfo_get_m_wheelsDampingCompression_0=t.asm.emscripten_bind_btWheelInfo_get_m_wheelsDampingCompression_0).apply(null,arguments)},Wd=t._emscripten_bind_btWheelInfo_set_m_wheelsDampingCompression_1=function(){return(Wd=t._emscripten_bind_btWheelInfo_set_m_wheelsDampingCompression_1=t.asm.emscripten_bind_btWheelInfo_set_m_wheelsDampingCompression_1).apply(null,arguments)},zd=t._emscripten_bind_btWheelInfo_get_m_wheelsDampingRelaxation_0=function(){return(zd=t._emscripten_bind_btWheelInfo_get_m_wheelsDampingRelaxation_0=t.asm.emscripten_bind_btWheelInfo_get_m_wheelsDampingRelaxation_0).apply(null,arguments)},Hd=t._emscripten_bind_btWheelInfo_set_m_wheelsDampingRelaxation_1=function(){return(Hd=t._emscripten_bind_btWheelInfo_set_m_wheelsDampingRelaxation_1=t.asm.emscripten_bind_btWheelInfo_set_m_wheelsDampingRelaxation_1).apply(null,arguments)},Xd=t._emscripten_bind_btWheelInfo_get_m_steering_0=function(){return(Xd=t._emscripten_bind_btWheelInfo_get_m_steering_0=t.asm.emscripten_bind_btWheelInfo_get_m_steering_0).apply(null,arguments)},Yd=t._emscripten_bind_btWheelInfo_set_m_steering_1=function(){return(Yd=t._emscripten_bind_btWheelInfo_set_m_steering_1=t.asm.emscripten_bind_btWheelInfo_set_m_steering_1).apply(null,arguments)},Qd=t._emscripten_bind_btWheelInfo_get_m_maxSuspensionForce_0=function(){return(Qd=t._emscripten_bind_btWheelInfo_get_m_maxSuspensionForce_0=t.asm.emscripten_bind_btWheelInfo_get_m_maxSuspensionForce_0).apply(null,arguments)},qd=t._emscripten_bind_btWheelInfo_set_m_maxSuspensionForce_1=function(){return(qd=t._emscripten_bind_btWheelInfo_set_m_maxSuspensionForce_1=t.asm.emscripten_bind_btWheelInfo_set_m_maxSuspensionForce_1).apply(null,arguments)},Kd=t._emscripten_bind_btWheelInfo_get_m_maxSuspensionTravelCm_0=function(){return(Kd=t._emscripten_bind_btWheelInfo_get_m_maxSuspensionTravelCm_0=t.asm.emscripten_bind_btWheelInfo_get_m_maxSuspensionTravelCm_0).apply(null,arguments)},Zd=t._emscripten_bind_btWheelInfo_set_m_maxSuspensionTravelCm_1=function(){return(Zd=t._emscripten_bind_btWheelInfo_set_m_maxSuspensionTravelCm_1=t.asm.emscripten_bind_btWheelInfo_set_m_maxSuspensionTravelCm_1).apply(null,arguments)},$d=t._emscripten_bind_btWheelInfo_get_m_wheelsSuspensionForce_0=function(){return($d=t._emscripten_bind_btWheelInfo_get_m_wheelsSuspensionForce_0=t.asm.emscripten_bind_btWheelInfo_get_m_wheelsSuspensionForce_0).apply(null,arguments)},Jd=t._emscripten_bind_btWheelInfo_set_m_wheelsSuspensionForce_1=function(){return(Jd=t._emscripten_bind_btWheelInfo_set_m_wheelsSuspensionForce_1=t.asm.emscripten_bind_btWheelInfo_set_m_wheelsSuspensionForce_1).apply(null,arguments)},eu=t._emscripten_bind_btWheelInfo_get_m_bIsFrontWheel_0=function(){return(eu=t._emscripten_bind_btWheelInfo_get_m_bIsFrontWheel_0=t.asm.emscripten_bind_btWheelInfo_get_m_bIsFrontWheel_0).apply(null,arguments)},tu=t._emscripten_bind_btWheelInfo_set_m_bIsFrontWheel_1=function(){return(tu=t._emscripten_bind_btWheelInfo_set_m_bIsFrontWheel_1=t.asm.emscripten_bind_btWheelInfo_set_m_bIsFrontWheel_1).apply(null,arguments)},iu=t._emscripten_bind_btWheelInfo_get_m_raycastInfo_0=function(){return(iu=t._emscripten_bind_btWheelInfo_get_m_raycastInfo_0=t.asm.emscripten_bind_btWheelInfo_get_m_raycastInfo_0).apply(null,arguments)},nu=t._emscripten_bind_btWheelInfo_set_m_raycastInfo_1=function(){return(nu=t._emscripten_bind_btWheelInfo_set_m_raycastInfo_1=t.asm.emscripten_bind_btWheelInfo_set_m_raycastInfo_1).apply(null,arguments)},ru=t._emscripten_bind_btWheelInfo_get_m_chassisConnectionPointCS_0=function(){return(ru=t._emscripten_bind_btWheelInfo_get_m_chassisConnectionPointCS_0=t.asm.emscripten_bind_btWheelInfo_get_m_chassisConnectionPointCS_0).apply(null,arguments)},su=t._emscripten_bind_btWheelInfo_set_m_chassisConnectionPointCS_1=function(){return(su=t._emscripten_bind_btWheelInfo_set_m_chassisConnectionPointCS_1=t.asm.emscripten_bind_btWheelInfo_set_m_chassisConnectionPointCS_1).apply(null,arguments)},ou=t._emscripten_bind_btWheelInfo_get_m_worldTransform_0=function(){return(ou=t._emscripten_bind_btWheelInfo_get_m_worldTransform_0=t.asm.emscripten_bind_btWheelInfo_get_m_worldTransform_0).apply(null,arguments)},au=t._emscripten_bind_btWheelInfo_set_m_worldTransform_1=function(){return(au=t._emscripten_bind_btWheelInfo_set_m_worldTransform_1=t.asm.emscripten_bind_btWheelInfo_set_m_worldTransform_1).apply(null,arguments)},lu=t._emscripten_bind_btWheelInfo_get_m_wheelDirectionCS_0=function(){return(lu=t._emscripten_bind_btWheelInfo_get_m_wheelDirectionCS_0=t.asm.emscripten_bind_btWheelInfo_get_m_wheelDirectionCS_0).apply(null,arguments)},cu=t._emscripten_bind_btWheelInfo_set_m_wheelDirectionCS_1=function(){return(cu=t._emscripten_bind_btWheelInfo_set_m_wheelDirectionCS_1=t.asm.emscripten_bind_btWheelInfo_set_m_wheelDirectionCS_1).apply(null,arguments)},hu=t._emscripten_bind_btWheelInfo_get_m_wheelAxleCS_0=function(){return(hu=t._emscripten_bind_btWheelInfo_get_m_wheelAxleCS_0=t.asm.emscripten_bind_btWheelInfo_get_m_wheelAxleCS_0).apply(null,arguments)},_u=t._emscripten_bind_btWheelInfo_set_m_wheelAxleCS_1=function(){return(_u=t._emscripten_bind_btWheelInfo_set_m_wheelAxleCS_1=t.asm.emscripten_bind_btWheelInfo_set_m_wheelAxleCS_1).apply(null,arguments)},du=t._emscripten_bind_btWheelInfo_get_m_rotation_0=function(){return(du=t._emscripten_bind_btWheelInfo_get_m_rotation_0=t.asm.emscripten_bind_btWheelInfo_get_m_rotation_0).apply(null,arguments)},uu=t._emscripten_bind_btWheelInfo_set_m_rotation_1=function(){return(uu=t._emscripten_bind_btWheelInfo_set_m_rotation_1=t.asm.emscripten_bind_btWheelInfo_set_m_rotation_1).apply(null,arguments)},pu=t._emscripten_bind_btWheelInfo_get_m_deltaRotation_0=function(){return(pu=t._emscripten_bind_btWheelInfo_get_m_deltaRotation_0=t.asm.emscripten_bind_btWheelInfo_get_m_deltaRotation_0).apply(null,arguments)},fu=t._emscripten_bind_btWheelInfo_set_m_deltaRotation_1=function(){return(fu=t._emscripten_bind_btWheelInfo_set_m_deltaRotation_1=t.asm.emscripten_bind_btWheelInfo_set_m_deltaRotation_1).apply(null,arguments)},mu=t._emscripten_bind_btWheelInfo_get_m_brake_0=function(){return(mu=t._emscripten_bind_btWheelInfo_get_m_brake_0=t.asm.emscripten_bind_btWheelInfo_get_m_brake_0).apply(null,arguments)},gu=t._emscripten_bind_btWheelInfo_set_m_brake_1=function(){return(gu=t._emscripten_bind_btWheelInfo_set_m_brake_1=t.asm.emscripten_bind_btWheelInfo_set_m_brake_1).apply(null,arguments)},bu=t._emscripten_bind_btWheelInfo_get_m_clippedInvContactDotSuspension_0=function(){return(bu=t._emscripten_bind_btWheelInfo_get_m_clippedInvContactDotSuspension_0=t.asm.emscripten_bind_btWheelInfo_get_m_clippedInvContactDotSuspension_0).apply(null,arguments)},yu=t._emscripten_bind_btWheelInfo_set_m_clippedInvContactDotSuspension_1=function(){return(yu=t._emscripten_bind_btWheelInfo_set_m_clippedInvContactDotSuspension_1=t.asm.emscripten_bind_btWheelInfo_set_m_clippedInvContactDotSuspension_1).apply(null,arguments)},vu=t._emscripten_bind_btWheelInfo_get_m_suspensionRelativeVelocity_0=function(){return(vu=t._emscripten_bind_btWheelInfo_get_m_suspensionRelativeVelocity_0=t.asm.emscripten_bind_btWheelInfo_get_m_suspensionRelativeVelocity_0).apply(null,arguments)},Au=t._emscripten_bind_btWheelInfo_set_m_suspensionRelativeVelocity_1=function(){return(Au=t._emscripten_bind_btWheelInfo_set_m_suspensionRelativeVelocity_1=t.asm.emscripten_bind_btWheelInfo_set_m_suspensionRelativeVelocity_1).apply(null,arguments)},Cu=t._emscripten_bind_btWheelInfo_get_m_skidInfo_0=function(){return(Cu=t._emscripten_bind_btWheelInfo_get_m_skidInfo_0=t.asm.emscripten_bind_btWheelInfo_get_m_skidInfo_0).apply(null,arguments)},Su=t._emscripten_bind_btWheelInfo_set_m_skidInfo_1=function(){return(Su=t._emscripten_bind_btWheelInfo_set_m_skidInfo_1=t.asm.emscripten_bind_btWheelInfo_set_m_skidInfo_1).apply(null,arguments)},xu=t._emscripten_bind_btWheelInfo___destroy___0=function(){return(xu=t._emscripten_bind_btWheelInfo___destroy___0=t.asm.emscripten_bind_btWheelInfo___destroy___0).apply(null,arguments)},Tu=t._emscripten_bind_btVector4_btVector4_0=function(){return(Tu=t._emscripten_bind_btVector4_btVector4_0=t.asm.emscripten_bind_btVector4_btVector4_0).apply(null,arguments)},Eu=t._emscripten_bind_btVector4_btVector4_4=function(){return(Eu=t._emscripten_bind_btVector4_btVector4_4=t.asm.emscripten_bind_btVector4_btVector4_4).apply(null,arguments)},Ru=t._emscripten_bind_btVector4_w_0=function(){return(Ru=t._emscripten_bind_btVector4_w_0=t.asm.emscripten_bind_btVector4_w_0).apply(null,arguments)},Pu=t._emscripten_bind_btVector4_setValue_4=function(){return(Pu=t._emscripten_bind_btVector4_setValue_4=t.asm.emscripten_bind_btVector4_setValue_4).apply(null,arguments)},Iu=t._emscripten_bind_btVector4_length_0=function(){return(Iu=t._emscripten_bind_btVector4_length_0=t.asm.emscripten_bind_btVector4_length_0).apply(null,arguments)},Mu=t._emscripten_bind_btVector4_x_0=function(){return(Mu=t._emscripten_bind_btVector4_x_0=t.asm.emscripten_bind_btVector4_x_0).apply(null,arguments)},Du=t._emscripten_bind_btVector4_y_0=function(){return(Du=t._emscripten_bind_btVector4_y_0=t.asm.emscripten_bind_btVector4_y_0).apply(null,arguments)},Ou=t._emscripten_bind_btVector4_z_0=function(){return(Ou=t._emscripten_bind_btVector4_z_0=t.asm.emscripten_bind_btVector4_z_0).apply(null,arguments)},wu=t._emscripten_bind_btVector4_setX_1=function(){return(wu=t._emscripten_bind_btVector4_setX_1=t.asm.emscripten_bind_btVector4_setX_1).apply(null,arguments)},Fu=t._emscripten_bind_btVector4_setY_1=function(){return(Fu=t._emscripten_bind_btVector4_setY_1=t.asm.emscripten_bind_btVector4_setY_1).apply(null,arguments)},Bu=t._emscripten_bind_btVector4_setZ_1=function(){return(Bu=t._emscripten_bind_btVector4_setZ_1=t.asm.emscripten_bind_btVector4_setZ_1).apply(null,arguments)},Nu=t._emscripten_bind_btVector4_normalize_0=function(){return(Nu=t._emscripten_bind_btVector4_normalize_0=t.asm.emscripten_bind_btVector4_normalize_0).apply(null,arguments)},Lu=t._emscripten_bind_btVector4_rotate_2=function(){return(Lu=t._emscripten_bind_btVector4_rotate_2=t.asm.emscripten_bind_btVector4_rotate_2).apply(null,arguments)},ku=t._emscripten_bind_btVector4_dot_1=function(){return(ku=t._emscripten_bind_btVector4_dot_1=t.asm.emscripten_bind_btVector4_dot_1).apply(null,arguments)},Vu=t._emscripten_bind_btVector4_op_mul_1=function(){return(Vu=t._emscripten_bind_btVector4_op_mul_1=t.asm.emscripten_bind_btVector4_op_mul_1).apply(null,arguments)},Uu=t._emscripten_bind_btVector4_op_add_1=function(){return(Uu=t._emscripten_bind_btVector4_op_add_1=t.asm.emscripten_bind_btVector4_op_add_1).apply(null,arguments)},Gu=t._emscripten_bind_btVector4_op_sub_1=function(){return(Gu=t._emscripten_bind_btVector4_op_sub_1=t.asm.emscripten_bind_btVector4_op_sub_1).apply(null,arguments)},ju=t._emscripten_bind_btVector4___destroy___0=function(){return(ju=t._emscripten_bind_btVector4___destroy___0=t.asm.emscripten_bind_btVector4___destroy___0).apply(null,arguments)},Wu=t._emscripten_bind_btDefaultCollisionConstructionInfo_btDefaultCollisionConstructionInfo_0=function(){return(Wu=t._emscripten_bind_btDefaultCollisionConstructionInfo_btDefaultCollisionConstructionInfo_0=t.asm.emscripten_bind_btDefaultCollisionConstructionInfo_btDefaultCollisionConstructionInfo_0).apply(null,arguments)},zu=t._emscripten_bind_btDefaultCollisionConstructionInfo___destroy___0=function(){return(zu=t._emscripten_bind_btDefaultCollisionConstructionInfo___destroy___0=t.asm.emscripten_bind_btDefaultCollisionConstructionInfo___destroy___0).apply(null,arguments)},Hu=t._emscripten_bind_Anchor_get_m_node_0=function(){return(Hu=t._emscripten_bind_Anchor_get_m_node_0=t.asm.emscripten_bind_Anchor_get_m_node_0).apply(null,arguments)},Xu=t._emscripten_bind_Anchor_set_m_node_1=function(){return(Xu=t._emscripten_bind_Anchor_set_m_node_1=t.asm.emscripten_bind_Anchor_set_m_node_1).apply(null,arguments)},Yu=t._emscripten_bind_Anchor_get_m_local_0=function(){return(Yu=t._emscripten_bind_Anchor_get_m_local_0=t.asm.emscripten_bind_Anchor_get_m_local_0).apply(null,arguments)},Qu=t._emscripten_bind_Anchor_set_m_local_1=function(){return(Qu=t._emscripten_bind_Anchor_set_m_local_1=t.asm.emscripten_bind_Anchor_set_m_local_1).apply(null,arguments)},qu=t._emscripten_bind_Anchor_get_m_body_0=function(){return(qu=t._emscripten_bind_Anchor_get_m_body_0=t.asm.emscripten_bind_Anchor_get_m_body_0).apply(null,arguments)},Ku=t._emscripten_bind_Anchor_set_m_body_1=function(){return(Ku=t._emscripten_bind_Anchor_set_m_body_1=t.asm.emscripten_bind_Anchor_set_m_body_1).apply(null,arguments)},Zu=t._emscripten_bind_Anchor_get_m_influence_0=function(){return(Zu=t._emscripten_bind_Anchor_get_m_influence_0=t.asm.emscripten_bind_Anchor_get_m_influence_0).apply(null,arguments)},$u=t._emscripten_bind_Anchor_set_m_influence_1=function(){return($u=t._emscripten_bind_Anchor_set_m_influence_1=t.asm.emscripten_bind_Anchor_set_m_influence_1).apply(null,arguments)},Ju=t._emscripten_bind_Anchor_get_m_c0_0=function(){return(Ju=t._emscripten_bind_Anchor_get_m_c0_0=t.asm.emscripten_bind_Anchor_get_m_c0_0).apply(null,arguments)},ep=t._emscripten_bind_Anchor_set_m_c0_1=function(){return(ep=t._emscripten_bind_Anchor_set_m_c0_1=t.asm.emscripten_bind_Anchor_set_m_c0_1).apply(null,arguments)},tp=t._emscripten_bind_Anchor_get_m_c1_0=function(){return(tp=t._emscripten_bind_Anchor_get_m_c1_0=t.asm.emscripten_bind_Anchor_get_m_c1_0).apply(null,arguments)},ip=t._emscripten_bind_Anchor_set_m_c1_1=function(){return(ip=t._emscripten_bind_Anchor_set_m_c1_1=t.asm.emscripten_bind_Anchor_set_m_c1_1).apply(null,arguments)},np=t._emscripten_bind_Anchor_get_m_c2_0=function(){return(np=t._emscripten_bind_Anchor_get_m_c2_0=t.asm.emscripten_bind_Anchor_get_m_c2_0).apply(null,arguments)},rp=t._emscripten_bind_Anchor_set_m_c2_1=function(){return(rp=t._emscripten_bind_Anchor_set_m_c2_1=t.asm.emscripten_bind_Anchor_set_m_c2_1).apply(null,arguments)},sp=t._emscripten_bind_Anchor___destroy___0=function(){return(sp=t._emscripten_bind_Anchor___destroy___0=t.asm.emscripten_bind_Anchor___destroy___0).apply(null,arguments)},op=t._emscripten_bind_btVehicleRaycasterResult_get_m_hitPointInWorld_0=function(){return(op=t._emscripten_bind_btVehicleRaycasterResult_get_m_hitPointInWorld_0=t.asm.emscripten_bind_btVehicleRaycasterResult_get_m_hitPointInWorld_0).apply(null,arguments)},ap=t._emscripten_bind_btVehicleRaycasterResult_set_m_hitPointInWorld_1=function(){return(ap=t._emscripten_bind_btVehicleRaycasterResult_set_m_hitPointInWorld_1=t.asm.emscripten_bind_btVehicleRaycasterResult_set_m_hitPointInWorld_1).apply(null,arguments)},lp=t._emscripten_bind_btVehicleRaycasterResult_get_m_hitNormalInWorld_0=function(){return(lp=t._emscripten_bind_btVehicleRaycasterResult_get_m_hitNormalInWorld_0=t.asm.emscripten_bind_btVehicleRaycasterResult_get_m_hitNormalInWorld_0).apply(null,arguments)},cp=t._emscripten_bind_btVehicleRaycasterResult_set_m_hitNormalInWorld_1=function(){return(cp=t._emscripten_bind_btVehicleRaycasterResult_set_m_hitNormalInWorld_1=t.asm.emscripten_bind_btVehicleRaycasterResult_set_m_hitNormalInWorld_1).apply(null,arguments)},hp=t._emscripten_bind_btVehicleRaycasterResult_get_m_distFraction_0=function(){return(hp=t._emscripten_bind_btVehicleRaycasterResult_get_m_distFraction_0=t.asm.emscripten_bind_btVehicleRaycasterResult_get_m_distFraction_0).apply(null,arguments)},_p=t._emscripten_bind_btVehicleRaycasterResult_set_m_distFraction_1=function(){return(_p=t._emscripten_bind_btVehicleRaycasterResult_set_m_distFraction_1=t.asm.emscripten_bind_btVehicleRaycasterResult_set_m_distFraction_1).apply(null,arguments)},dp=t._emscripten_bind_btVehicleRaycasterResult___destroy___0=function(){return(dp=t._emscripten_bind_btVehicleRaycasterResult___destroy___0=t.asm.emscripten_bind_btVehicleRaycasterResult___destroy___0).apply(null,arguments)},up=t._emscripten_bind_btVector3Array_size_0=function(){return(up=t._emscripten_bind_btVector3Array_size_0=t.asm.emscripten_bind_btVector3Array_size_0).apply(null,arguments)},pp=t._emscripten_bind_btVector3Array_at_1=function(){return(pp=t._emscripten_bind_btVector3Array_at_1=t.asm.emscripten_bind_btVector3Array_at_1).apply(null,arguments)},fp=t._emscripten_bind_btVector3Array___destroy___0=function(){return(fp=t._emscripten_bind_btVector3Array___destroy___0=t.asm.emscripten_bind_btVector3Array___destroy___0).apply(null,arguments)},mp=t._emscripten_bind_btConstraintSolver___destroy___0=function(){return(mp=t._emscripten_bind_btConstraintSolver___destroy___0=t.asm.emscripten_bind_btConstraintSolver___destroy___0).apply(null,arguments)},gp=t._emscripten_bind_btRaycastVehicle_btRaycastVehicle_3=function(){return(gp=t._emscripten_bind_btRaycastVehicle_btRaycastVehicle_3=t.asm.emscripten_bind_btRaycastVehicle_btRaycastVehicle_3).apply(null,arguments)},bp=t._emscripten_bind_btRaycastVehicle_applyEngineForce_2=function(){return(bp=t._emscripten_bind_btRaycastVehicle_applyEngineForce_2=t.asm.emscripten_bind_btRaycastVehicle_applyEngineForce_2).apply(null,arguments)},yp=t._emscripten_bind_btRaycastVehicle_setSteeringValue_2=function(){return(yp=t._emscripten_bind_btRaycastVehicle_setSteeringValue_2=t.asm.emscripten_bind_btRaycastVehicle_setSteeringValue_2).apply(null,arguments)},vp=t._emscripten_bind_btRaycastVehicle_getWheelTransformWS_1=function(){return(vp=t._emscripten_bind_btRaycastVehicle_getWheelTransformWS_1=t.asm.emscripten_bind_btRaycastVehicle_getWheelTransformWS_1).apply(null,arguments)},Ap=t._emscripten_bind_btRaycastVehicle_updateWheelTransform_2=function(){return(Ap=t._emscripten_bind_btRaycastVehicle_updateWheelTransform_2=t.asm.emscripten_bind_btRaycastVehicle_updateWheelTransform_2).apply(null,arguments)},Cp=t._emscripten_bind_btRaycastVehicle_addWheel_7=function(){return(Cp=t._emscripten_bind_btRaycastVehicle_addWheel_7=t.asm.emscripten_bind_btRaycastVehicle_addWheel_7).apply(null,arguments)},Sp=t._emscripten_bind_btRaycastVehicle_getNumWheels_0=function(){return(Sp=t._emscripten_bind_btRaycastVehicle_getNumWheels_0=t.asm.emscripten_bind_btRaycastVehicle_getNumWheels_0).apply(null,arguments)},xp=t._emscripten_bind_btRaycastVehicle_getRigidBody_0=function(){return(xp=t._emscripten_bind_btRaycastVehicle_getRigidBody_0=t.asm.emscripten_bind_btRaycastVehicle_getRigidBody_0).apply(null,arguments)},Tp=t._emscripten_bind_btRaycastVehicle_getWheelInfo_1=function(){return(Tp=t._emscripten_bind_btRaycastVehicle_getWheelInfo_1=t.asm.emscripten_bind_btRaycastVehicle_getWheelInfo_1).apply(null,arguments)},Ep=t._emscripten_bind_btRaycastVehicle_setBrake_2=function(){return(Ep=t._emscripten_bind_btRaycastVehicle_setBrake_2=t.asm.emscripten_bind_btRaycastVehicle_setBrake_2).apply(null,arguments)},Rp=t._emscripten_bind_btRaycastVehicle_setCoordinateSystem_3=function(){return(Rp=t._emscripten_bind_btRaycastVehicle_setCoordinateSystem_3=t.asm.emscripten_bind_btRaycastVehicle_setCoordinateSystem_3).apply(null,arguments)},Pp=t._emscripten_bind_btRaycastVehicle_getCurrentSpeedKmHour_0=function(){return(Pp=t._emscripten_bind_btRaycastVehicle_getCurrentSpeedKmHour_0=t.asm.emscripten_bind_btRaycastVehicle_getCurrentSpeedKmHour_0).apply(null,arguments)},Ip=t._emscripten_bind_btRaycastVehicle_getChassisWorldTransform_0=function(){return(Ip=t._emscripten_bind_btRaycastVehicle_getChassisWorldTransform_0=t.asm.emscripten_bind_btRaycastVehicle_getChassisWorldTransform_0).apply(null,arguments)},Mp=t._emscripten_bind_btRaycastVehicle_rayCast_1=function(){return(Mp=t._emscripten_bind_btRaycastVehicle_rayCast_1=t.asm.emscripten_bind_btRaycastVehicle_rayCast_1).apply(null,arguments)},Dp=t._emscripten_bind_btRaycastVehicle_updateVehicle_1=function(){return(Dp=t._emscripten_bind_btRaycastVehicle_updateVehicle_1=t.asm.emscripten_bind_btRaycastVehicle_updateVehicle_1).apply(null,arguments)},Op=t._emscripten_bind_btRaycastVehicle_resetSuspension_0=function(){return(Op=t._emscripten_bind_btRaycastVehicle_resetSuspension_0=t.asm.emscripten_bind_btRaycastVehicle_resetSuspension_0).apply(null,arguments)},wp=t._emscripten_bind_btRaycastVehicle_getSteeringValue_1=function(){return(wp=t._emscripten_bind_btRaycastVehicle_getSteeringValue_1=t.asm.emscripten_bind_btRaycastVehicle_getSteeringValue_1).apply(null,arguments)},Fp=t._emscripten_bind_btRaycastVehicle_updateWheelTransformsWS_1=function(){return(Fp=t._emscripten_bind_btRaycastVehicle_updateWheelTransformsWS_1=t.asm.emscripten_bind_btRaycastVehicle_updateWheelTransformsWS_1).apply(null,arguments)},Bp=t._emscripten_bind_btRaycastVehicle_updateWheelTransformsWS_2=function(){return(Bp=t._emscripten_bind_btRaycastVehicle_updateWheelTransformsWS_2=t.asm.emscripten_bind_btRaycastVehicle_updateWheelTransformsWS_2).apply(null,arguments)},Np=t._emscripten_bind_btRaycastVehicle_setPitchControl_1=function(){return(Np=t._emscripten_bind_btRaycastVehicle_setPitchControl_1=t.asm.emscripten_bind_btRaycastVehicle_setPitchControl_1).apply(null,arguments)},Lp=t._emscripten_bind_btRaycastVehicle_updateSuspension_1=function(){return(Lp=t._emscripten_bind_btRaycastVehicle_updateSuspension_1=t.asm.emscripten_bind_btRaycastVehicle_updateSuspension_1).apply(null,arguments)},kp=t._emscripten_bind_btRaycastVehicle_updateFriction_1=function(){return(kp=t._emscripten_bind_btRaycastVehicle_updateFriction_1=t.asm.emscripten_bind_btRaycastVehicle_updateFriction_1).apply(null,arguments)},Vp=t._emscripten_bind_btRaycastVehicle_getRightAxis_0=function(){return(Vp=t._emscripten_bind_btRaycastVehicle_getRightAxis_0=t.asm.emscripten_bind_btRaycastVehicle_getRightAxis_0).apply(null,arguments)},Up=t._emscripten_bind_btRaycastVehicle_getUpAxis_0=function(){return(Up=t._emscripten_bind_btRaycastVehicle_getUpAxis_0=t.asm.emscripten_bind_btRaycastVehicle_getUpAxis_0).apply(null,arguments)},Gp=t._emscripten_bind_btRaycastVehicle_getForwardAxis_0=function(){return(Gp=t._emscripten_bind_btRaycastVehicle_getForwardAxis_0=t.asm.emscripten_bind_btRaycastVehicle_getForwardAxis_0).apply(null,arguments)},jp=t._emscripten_bind_btRaycastVehicle_getForwardVector_0=function(){return(jp=t._emscripten_bind_btRaycastVehicle_getForwardVector_0=t.asm.emscripten_bind_btRaycastVehicle_getForwardVector_0).apply(null,arguments)},Wp=t._emscripten_bind_btRaycastVehicle_getUserConstraintType_0=function(){return(Wp=t._emscripten_bind_btRaycastVehicle_getUserConstraintType_0=t.asm.emscripten_bind_btRaycastVehicle_getUserConstraintType_0).apply(null,arguments)},zp=t._emscripten_bind_btRaycastVehicle_setUserConstraintType_1=function(){return(zp=t._emscripten_bind_btRaycastVehicle_setUserConstraintType_1=t.asm.emscripten_bind_btRaycastVehicle_setUserConstraintType_1).apply(null,arguments)},Hp=t._emscripten_bind_btRaycastVehicle_setUserConstraintId_1=function(){return(Hp=t._emscripten_bind_btRaycastVehicle_setUserConstraintId_1=t.asm.emscripten_bind_btRaycastVehicle_setUserConstraintId_1).apply(null,arguments)},Xp=t._emscripten_bind_btRaycastVehicle_getUserConstraintId_0=function(){return(Xp=t._emscripten_bind_btRaycastVehicle_getUserConstraintId_0=t.asm.emscripten_bind_btRaycastVehicle_getUserConstraintId_0).apply(null,arguments)},Yp=t._emscripten_bind_btRaycastVehicle_updateAction_2=function(){return(Yp=t._emscripten_bind_btRaycastVehicle_updateAction_2=t.asm.emscripten_bind_btRaycastVehicle_updateAction_2).apply(null,arguments)},Qp=t._emscripten_bind_btRaycastVehicle___destroy___0=function(){return(Qp=t._emscripten_bind_btRaycastVehicle___destroy___0=t.asm.emscripten_bind_btRaycastVehicle___destroy___0).apply(null,arguments)},qp=t._emscripten_bind_btCylinderShapeX_btCylinderShapeX_1=function(){return(qp=t._emscripten_bind_btCylinderShapeX_btCylinderShapeX_1=t.asm.emscripten_bind_btCylinderShapeX_btCylinderShapeX_1).apply(null,arguments)},Kp=t._emscripten_bind_btCylinderShapeX_setMargin_1=function(){return(Kp=t._emscripten_bind_btCylinderShapeX_setMargin_1=t.asm.emscripten_bind_btCylinderShapeX_setMargin_1).apply(null,arguments)},Zp=t._emscripten_bind_btCylinderShapeX_getMargin_0=function(){return(Zp=t._emscripten_bind_btCylinderShapeX_getMargin_0=t.asm.emscripten_bind_btCylinderShapeX_getMargin_0).apply(null,arguments)},$p=t._emscripten_bind_btCylinderShapeX_setLocalScaling_1=function(){return($p=t._emscripten_bind_btCylinderShapeX_setLocalScaling_1=t.asm.emscripten_bind_btCylinderShapeX_setLocalScaling_1).apply(null,arguments)},Jp=t._emscripten_bind_btCylinderShapeX_getLocalScaling_0=function(){return(Jp=t._emscripten_bind_btCylinderShapeX_getLocalScaling_0=t.asm.emscripten_bind_btCylinderShapeX_getLocalScaling_0).apply(null,arguments)},ef=t._emscripten_bind_btCylinderShapeX_calculateLocalInertia_2=function(){return(ef=t._emscripten_bind_btCylinderShapeX_calculateLocalInertia_2=t.asm.emscripten_bind_btCylinderShapeX_calculateLocalInertia_2).apply(null,arguments)},tf=t._emscripten_bind_btCylinderShapeX___destroy___0=function(){return(tf=t._emscripten_bind_btCylinderShapeX___destroy___0=t.asm.emscripten_bind_btCylinderShapeX___destroy___0).apply(null,arguments)},nf=t._emscripten_bind_btCylinderShapeZ_btCylinderShapeZ_1=function(){return(nf=t._emscripten_bind_btCylinderShapeZ_btCylinderShapeZ_1=t.asm.emscripten_bind_btCylinderShapeZ_btCylinderShapeZ_1).apply(null,arguments)},rf=t._emscripten_bind_btCylinderShapeZ_setMargin_1=function(){return(rf=t._emscripten_bind_btCylinderShapeZ_setMargin_1=t.asm.emscripten_bind_btCylinderShapeZ_setMargin_1).apply(null,arguments)},sf=t._emscripten_bind_btCylinderShapeZ_getMargin_0=function(){return(sf=t._emscripten_bind_btCylinderShapeZ_getMargin_0=t.asm.emscripten_bind_btCylinderShapeZ_getMargin_0).apply(null,arguments)},of=t._emscripten_bind_btCylinderShapeZ_setLocalScaling_1=function(){return(of=t._emscripten_bind_btCylinderShapeZ_setLocalScaling_1=t.asm.emscripten_bind_btCylinderShapeZ_setLocalScaling_1).apply(null,arguments)},af=t._emscripten_bind_btCylinderShapeZ_getLocalScaling_0=function(){return(af=t._emscripten_bind_btCylinderShapeZ_getLocalScaling_0=t.asm.emscripten_bind_btCylinderShapeZ_getLocalScaling_0).apply(null,arguments)},lf=t._emscripten_bind_btCylinderShapeZ_calculateLocalInertia_2=function(){return(lf=t._emscripten_bind_btCylinderShapeZ_calculateLocalInertia_2=t.asm.emscripten_bind_btCylinderShapeZ_calculateLocalInertia_2).apply(null,arguments)},cf=t._emscripten_bind_btCylinderShapeZ___destroy___0=function(){return(cf=t._emscripten_bind_btCylinderShapeZ___destroy___0=t.asm.emscripten_bind_btCylinderShapeZ___destroy___0).apply(null,arguments)},hf=t._emscripten_bind_btConvexPolyhedron_get_m_vertices_0=function(){return(hf=t._emscripten_bind_btConvexPolyhedron_get_m_vertices_0=t.asm.emscripten_bind_btConvexPolyhedron_get_m_vertices_0).apply(null,arguments)},_f=t._emscripten_bind_btConvexPolyhedron_set_m_vertices_1=function(){return(_f=t._emscripten_bind_btConvexPolyhedron_set_m_vertices_1=t.asm.emscripten_bind_btConvexPolyhedron_set_m_vertices_1).apply(null,arguments)},df=t._emscripten_bind_btConvexPolyhedron_get_m_faces_0=function(){return(df=t._emscripten_bind_btConvexPolyhedron_get_m_faces_0=t.asm.emscripten_bind_btConvexPolyhedron_get_m_faces_0).apply(null,arguments)},uf=t._emscripten_bind_btConvexPolyhedron_set_m_faces_1=function(){return(uf=t._emscripten_bind_btConvexPolyhedron_set_m_faces_1=t.asm.emscripten_bind_btConvexPolyhedron_set_m_faces_1).apply(null,arguments)},pf=t._emscripten_bind_btConvexPolyhedron___destroy___0=function(){return(pf=t._emscripten_bind_btConvexPolyhedron___destroy___0=t.asm.emscripten_bind_btConvexPolyhedron___destroy___0).apply(null,arguments)},ff=t._emscripten_bind_btSequentialImpulseConstraintSolver_btSequentialImpulseConstraintSolver_0=function(){return(ff=t._emscripten_bind_btSequentialImpulseConstraintSolver_btSequentialImpulseConstraintSolver_0=t.asm.emscripten_bind_btSequentialImpulseConstraintSolver_btSequentialImpulseConstraintSolver_0).apply(null,arguments)},mf=t._emscripten_bind_btSequentialImpulseConstraintSolver___destroy___0=function(){return(mf=t._emscripten_bind_btSequentialImpulseConstraintSolver___destroy___0=t.asm.emscripten_bind_btSequentialImpulseConstraintSolver___destroy___0).apply(null,arguments)},gf=t._emscripten_bind_tAnchorArray_size_0=function(){return(gf=t._emscripten_bind_tAnchorArray_size_0=t.asm.emscripten_bind_tAnchorArray_size_0).apply(null,arguments)},bf=t._emscripten_bind_tAnchorArray_at_1=function(){return(bf=t._emscripten_bind_tAnchorArray_at_1=t.asm.emscripten_bind_tAnchorArray_at_1).apply(null,arguments)},yf=t._emscripten_bind_tAnchorArray_clear_0=function(){return(yf=t._emscripten_bind_tAnchorArray_clear_0=t.asm.emscripten_bind_tAnchorArray_clear_0).apply(null,arguments)},vf=t._emscripten_bind_tAnchorArray_push_back_1=function(){return(vf=t._emscripten_bind_tAnchorArray_push_back_1=t.asm.emscripten_bind_tAnchorArray_push_back_1).apply(null,arguments)},Af=t._emscripten_bind_tAnchorArray_pop_back_0=function(){return(Af=t._emscripten_bind_tAnchorArray_pop_back_0=t.asm.emscripten_bind_tAnchorArray_pop_back_0).apply(null,arguments)},Cf=t._emscripten_bind_tAnchorArray___destroy___0=function(){return(Cf=t._emscripten_bind_tAnchorArray___destroy___0=t.asm.emscripten_bind_tAnchorArray___destroy___0).apply(null,arguments)},Sf=t._emscripten_bind_RaycastInfo_get_m_contactNormalWS_0=function(){return(Sf=t._emscripten_bind_RaycastInfo_get_m_contactNormalWS_0=t.asm.emscripten_bind_RaycastInfo_get_m_contactNormalWS_0).apply(null,arguments)},xf=t._emscripten_bind_RaycastInfo_set_m_contactNormalWS_1=function(){return(xf=t._emscripten_bind_RaycastInfo_set_m_contactNormalWS_1=t.asm.emscripten_bind_RaycastInfo_set_m_contactNormalWS_1).apply(null,arguments)},Tf=t._emscripten_bind_RaycastInfo_get_m_contactPointWS_0=function(){return(Tf=t._emscripten_bind_RaycastInfo_get_m_contactPointWS_0=t.asm.emscripten_bind_RaycastInfo_get_m_contactPointWS_0).apply(null,arguments)},Ef=t._emscripten_bind_RaycastInfo_set_m_contactPointWS_1=function(){return(Ef=t._emscripten_bind_RaycastInfo_set_m_contactPointWS_1=t.asm.emscripten_bind_RaycastInfo_set_m_contactPointWS_1).apply(null,arguments)},Rf=t._emscripten_bind_RaycastInfo_get_m_suspensionLength_0=function(){return(Rf=t._emscripten_bind_RaycastInfo_get_m_suspensionLength_0=t.asm.emscripten_bind_RaycastInfo_get_m_suspensionLength_0).apply(null,arguments)},Pf=t._emscripten_bind_RaycastInfo_set_m_suspensionLength_1=function(){return(Pf=t._emscripten_bind_RaycastInfo_set_m_suspensionLength_1=t.asm.emscripten_bind_RaycastInfo_set_m_suspensionLength_1).apply(null,arguments)},If=t._emscripten_bind_RaycastInfo_get_m_hardPointWS_0=function(){return(If=t._emscripten_bind_RaycastInfo_get_m_hardPointWS_0=t.asm.emscripten_bind_RaycastInfo_get_m_hardPointWS_0).apply(null,arguments)},Mf=t._emscripten_bind_RaycastInfo_set_m_hardPointWS_1=function(){return(Mf=t._emscripten_bind_RaycastInfo_set_m_hardPointWS_1=t.asm.emscripten_bind_RaycastInfo_set_m_hardPointWS_1).apply(null,arguments)},Df=t._emscripten_bind_RaycastInfo_get_m_wheelDirectionWS_0=function(){return(Df=t._emscripten_bind_RaycastInfo_get_m_wheelDirectionWS_0=t.asm.emscripten_bind_RaycastInfo_get_m_wheelDirectionWS_0).apply(null,arguments)},Of=t._emscripten_bind_RaycastInfo_set_m_wheelDirectionWS_1=function(){return(Of=t._emscripten_bind_RaycastInfo_set_m_wheelDirectionWS_1=t.asm.emscripten_bind_RaycastInfo_set_m_wheelDirectionWS_1).apply(null,arguments)},wf=t._emscripten_bind_RaycastInfo_get_m_wheelAxleWS_0=function(){return(wf=t._emscripten_bind_RaycastInfo_get_m_wheelAxleWS_0=t.asm.emscripten_bind_RaycastInfo_get_m_wheelAxleWS_0).apply(null,arguments)},Ff=t._emscripten_bind_RaycastInfo_set_m_wheelAxleWS_1=function(){return(Ff=t._emscripten_bind_RaycastInfo_set_m_wheelAxleWS_1=t.asm.emscripten_bind_RaycastInfo_set_m_wheelAxleWS_1).apply(null,arguments)},Bf=t._emscripten_bind_RaycastInfo_get_m_isInContact_0=function(){return(Bf=t._emscripten_bind_RaycastInfo_get_m_isInContact_0=t.asm.emscripten_bind_RaycastInfo_get_m_isInContact_0).apply(null,arguments)},Nf=t._emscripten_bind_RaycastInfo_set_m_isInContact_1=function(){return(Nf=t._emscripten_bind_RaycastInfo_set_m_isInContact_1=t.asm.emscripten_bind_RaycastInfo_set_m_isInContact_1).apply(null,arguments)},Lf=t._emscripten_bind_RaycastInfo_get_m_groundObject_0=function(){return(Lf=t._emscripten_bind_RaycastInfo_get_m_groundObject_0=t.asm.emscripten_bind_RaycastInfo_get_m_groundObject_0).apply(null,arguments)},kf=t._emscripten_bind_RaycastInfo_set_m_groundObject_1=function(){return(kf=t._emscripten_bind_RaycastInfo_set_m_groundObject_1=t.asm.emscripten_bind_RaycastInfo_set_m_groundObject_1).apply(null,arguments)},Vf=t._emscripten_bind_RaycastInfo___destroy___0=function(){return(Vf=t._emscripten_bind_RaycastInfo___destroy___0=t.asm.emscripten_bind_RaycastInfo___destroy___0).apply(null,arguments)},Uf=t._emscripten_bind_btMultiSphereShape_btMultiSphereShape_3=function(){return(Uf=t._emscripten_bind_btMultiSphereShape_btMultiSphereShape_3=t.asm.emscripten_bind_btMultiSphereShape_btMultiSphereShape_3).apply(null,arguments)},Gf=t._emscripten_bind_btMultiSphereShape_setLocalScaling_1=function(){return(Gf=t._emscripten_bind_btMultiSphereShape_setLocalScaling_1=t.asm.emscripten_bind_btMultiSphereShape_setLocalScaling_1).apply(null,arguments)},jf=t._emscripten_bind_btMultiSphereShape_getLocalScaling_0=function(){return(jf=t._emscripten_bind_btMultiSphereShape_getLocalScaling_0=t.asm.emscripten_bind_btMultiSphereShape_getLocalScaling_0).apply(null,arguments)},Wf=t._emscripten_bind_btMultiSphereShape_calculateLocalInertia_2=function(){return(Wf=t._emscripten_bind_btMultiSphereShape_calculateLocalInertia_2=t.asm.emscripten_bind_btMultiSphereShape_calculateLocalInertia_2).apply(null,arguments)},zf=t._emscripten_bind_btMultiSphereShape___destroy___0=function(){return(zf=t._emscripten_bind_btMultiSphereShape___destroy___0=t.asm.emscripten_bind_btMultiSphereShape___destroy___0).apply(null,arguments)},Hf=t._emscripten_bind_btSoftBody_btSoftBody_4=function(){return(Hf=t._emscripten_bind_btSoftBody_btSoftBody_4=t.asm.emscripten_bind_btSoftBody_btSoftBody_4).apply(null,arguments)},Xf=t._emscripten_bind_btSoftBody_checkLink_2=function(){return(Xf=t._emscripten_bind_btSoftBody_checkLink_2=t.asm.emscripten_bind_btSoftBody_checkLink_2).apply(null,arguments)},Yf=t._emscripten_bind_btSoftBody_checkFace_3=function(){return(Yf=t._emscripten_bind_btSoftBody_checkFace_3=t.asm.emscripten_bind_btSoftBody_checkFace_3).apply(null,arguments)},Qf=t._emscripten_bind_btSoftBody_appendMaterial_0=function(){return(Qf=t._emscripten_bind_btSoftBody_appendMaterial_0=t.asm.emscripten_bind_btSoftBody_appendMaterial_0).apply(null,arguments)},qf=t._emscripten_bind_btSoftBody_appendNode_2=function(){return(qf=t._emscripten_bind_btSoftBody_appendNode_2=t.asm.emscripten_bind_btSoftBody_appendNode_2).apply(null,arguments)},Kf=t._emscripten_bind_btSoftBody_appendLink_4=function(){return(Kf=t._emscripten_bind_btSoftBody_appendLink_4=t.asm.emscripten_bind_btSoftBody_appendLink_4).apply(null,arguments)},Zf=t._emscripten_bind_btSoftBody_appendFace_4=function(){return(Zf=t._emscripten_bind_btSoftBody_appendFace_4=t.asm.emscripten_bind_btSoftBody_appendFace_4).apply(null,arguments)},$f=t._emscripten_bind_btSoftBody_appendTetra_5=function(){return($f=t._emscripten_bind_btSoftBody_appendTetra_5=t.asm.emscripten_bind_btSoftBody_appendTetra_5).apply(null,arguments)},Jf=t._emscripten_bind_btSoftBody_appendAnchor_4=function(){return(Jf=t._emscripten_bind_btSoftBody_appendAnchor_4=t.asm.emscripten_bind_btSoftBody_appendAnchor_4).apply(null,arguments)},em=t._emscripten_bind_btSoftBody_addForce_1=function(){return(em=t._emscripten_bind_btSoftBody_addForce_1=t.asm.emscripten_bind_btSoftBody_addForce_1).apply(null,arguments)},tm=t._emscripten_bind_btSoftBody_addForce_2=function(){return(tm=t._emscripten_bind_btSoftBody_addForce_2=t.asm.emscripten_bind_btSoftBody_addForce_2).apply(null,arguments)},im=t._emscripten_bind_btSoftBody_addAeroForceToNode_2=function(){return(im=t._emscripten_bind_btSoftBody_addAeroForceToNode_2=t.asm.emscripten_bind_btSoftBody_addAeroForceToNode_2).apply(null,arguments)},nm=t._emscripten_bind_btSoftBody_getTotalMass_0=function(){return(nm=t._emscripten_bind_btSoftBody_getTotalMass_0=t.asm.emscripten_bind_btSoftBody_getTotalMass_0).apply(null,arguments)},rm=t._emscripten_bind_btSoftBody_setTotalMass_2=function(){return(rm=t._emscripten_bind_btSoftBody_setTotalMass_2=t.asm.emscripten_bind_btSoftBody_setTotalMass_2).apply(null,arguments)},sm=t._emscripten_bind_btSoftBody_setMass_2=function(){return(sm=t._emscripten_bind_btSoftBody_setMass_2=t.asm.emscripten_bind_btSoftBody_setMass_2).apply(null,arguments)},om=t._emscripten_bind_btSoftBody_transform_1=function(){return(om=t._emscripten_bind_btSoftBody_transform_1=t.asm.emscripten_bind_btSoftBody_transform_1).apply(null,arguments)},am=t._emscripten_bind_btSoftBody_translate_1=function(){return(am=t._emscripten_bind_btSoftBody_translate_1=t.asm.emscripten_bind_btSoftBody_translate_1).apply(null,arguments)},lm=t._emscripten_bind_btSoftBody_rotate_1=function(){return(lm=t._emscripten_bind_btSoftBody_rotate_1=t.asm.emscripten_bind_btSoftBody_rotate_1).apply(null,arguments)},cm=t._emscripten_bind_btSoftBody_scale_1=function(){return(cm=t._emscripten_bind_btSoftBody_scale_1=t.asm.emscripten_bind_btSoftBody_scale_1).apply(null,arguments)},hm=t._emscripten_bind_btSoftBody_generateClusters_1=function(){return(hm=t._emscripten_bind_btSoftBody_generateClusters_1=t.asm.emscripten_bind_btSoftBody_generateClusters_1).apply(null,arguments)},_m=t._emscripten_bind_btSoftBody_generateClusters_2=function(){return(_m=t._emscripten_bind_btSoftBody_generateClusters_2=t.asm.emscripten_bind_btSoftBody_generateClusters_2).apply(null,arguments)},dm=t._emscripten_bind_btSoftBody_generateBendingConstraints_2=function(){return(dm=t._emscripten_bind_btSoftBody_generateBendingConstraints_2=t.asm.emscripten_bind_btSoftBody_generateBendingConstraints_2).apply(null,arguments)},um=t._emscripten_bind_btSoftBody_upcast_1=function(){return(um=t._emscripten_bind_btSoftBody_upcast_1=t.asm.emscripten_bind_btSoftBody_upcast_1).apply(null,arguments)},pm=t._emscripten_bind_btSoftBody_setAnisotropicFriction_2=function(){return(pm=t._emscripten_bind_btSoftBody_setAnisotropicFriction_2=t.asm.emscripten_bind_btSoftBody_setAnisotropicFriction_2).apply(null,arguments)},fm=t._emscripten_bind_btSoftBody_getCollisionShape_0=function(){return(fm=t._emscripten_bind_btSoftBody_getCollisionShape_0=t.asm.emscripten_bind_btSoftBody_getCollisionShape_0).apply(null,arguments)},mm=t._emscripten_bind_btSoftBody_setContactProcessingThreshold_1=function(){return(mm=t._emscripten_bind_btSoftBody_setContactProcessingThreshold_1=t.asm.emscripten_bind_btSoftBody_setContactProcessingThreshold_1).apply(null,arguments)},gm=t._emscripten_bind_btSoftBody_setActivationState_1=function(){return(gm=t._emscripten_bind_btSoftBody_setActivationState_1=t.asm.emscripten_bind_btSoftBody_setActivationState_1).apply(null,arguments)},bm=t._emscripten_bind_btSoftBody_forceActivationState_1=function(){return(bm=t._emscripten_bind_btSoftBody_forceActivationState_1=t.asm.emscripten_bind_btSoftBody_forceActivationState_1).apply(null,arguments)},ym=t._emscripten_bind_btSoftBody_activate_0=function(){return(ym=t._emscripten_bind_btSoftBody_activate_0=t.asm.emscripten_bind_btSoftBody_activate_0).apply(null,arguments)},vm=t._emscripten_bind_btSoftBody_activate_1=function(){return(vm=t._emscripten_bind_btSoftBody_activate_1=t.asm.emscripten_bind_btSoftBody_activate_1).apply(null,arguments)},Am=t._emscripten_bind_btSoftBody_isActive_0=function(){return(Am=t._emscripten_bind_btSoftBody_isActive_0=t.asm.emscripten_bind_btSoftBody_isActive_0).apply(null,arguments)},Cm=t._emscripten_bind_btSoftBody_isKinematicObject_0=function(){return(Cm=t._emscripten_bind_btSoftBody_isKinematicObject_0=t.asm.emscripten_bind_btSoftBody_isKinematicObject_0).apply(null,arguments)},Sm=t._emscripten_bind_btSoftBody_isStaticObject_0=function(){return(Sm=t._emscripten_bind_btSoftBody_isStaticObject_0=t.asm.emscripten_bind_btSoftBody_isStaticObject_0).apply(null,arguments)},xm=t._emscripten_bind_btSoftBody_isStaticOrKinematicObject_0=function(){return(xm=t._emscripten_bind_btSoftBody_isStaticOrKinematicObject_0=t.asm.emscripten_bind_btSoftBody_isStaticOrKinematicObject_0).apply(null,arguments)},Tm=t._emscripten_bind_btSoftBody_getRestitution_0=function(){return(Tm=t._emscripten_bind_btSoftBody_getRestitution_0=t.asm.emscripten_bind_btSoftBody_getRestitution_0).apply(null,arguments)},Em=t._emscripten_bind_btSoftBody_getFriction_0=function(){return(Em=t._emscripten_bind_btSoftBody_getFriction_0=t.asm.emscripten_bind_btSoftBody_getFriction_0).apply(null,arguments)},Rm=t._emscripten_bind_btSoftBody_getRollingFriction_0=function(){return(Rm=t._emscripten_bind_btSoftBody_getRollingFriction_0=t.asm.emscripten_bind_btSoftBody_getRollingFriction_0).apply(null,arguments)},Pm=t._emscripten_bind_btSoftBody_setRestitution_1=function(){return(Pm=t._emscripten_bind_btSoftBody_setRestitution_1=t.asm.emscripten_bind_btSoftBody_setRestitution_1).apply(null,arguments)},Im=t._emscripten_bind_btSoftBody_setFriction_1=function(){return(Im=t._emscripten_bind_btSoftBody_setFriction_1=t.asm.emscripten_bind_btSoftBody_setFriction_1).apply(null,arguments)},Mm=t._emscripten_bind_btSoftBody_setRollingFriction_1=function(){return(Mm=t._emscripten_bind_btSoftBody_setRollingFriction_1=t.asm.emscripten_bind_btSoftBody_setRollingFriction_1).apply(null,arguments)},Dm=t._emscripten_bind_btSoftBody_getWorldTransform_0=function(){return(Dm=t._emscripten_bind_btSoftBody_getWorldTransform_0=t.asm.emscripten_bind_btSoftBody_getWorldTransform_0).apply(null,arguments)},Om=t._emscripten_bind_btSoftBody_getCollisionFlags_0=function(){return(Om=t._emscripten_bind_btSoftBody_getCollisionFlags_0=t.asm.emscripten_bind_btSoftBody_getCollisionFlags_0).apply(null,arguments)},wm=t._emscripten_bind_btSoftBody_setCollisionFlags_1=function(){return(wm=t._emscripten_bind_btSoftBody_setCollisionFlags_1=t.asm.emscripten_bind_btSoftBody_setCollisionFlags_1).apply(null,arguments)},Fm=t._emscripten_bind_btSoftBody_setWorldTransform_1=function(){return(Fm=t._emscripten_bind_btSoftBody_setWorldTransform_1=t.asm.emscripten_bind_btSoftBody_setWorldTransform_1).apply(null,arguments)},Bm=t._emscripten_bind_btSoftBody_setCollisionShape_1=function(){return(Bm=t._emscripten_bind_btSoftBody_setCollisionShape_1=t.asm.emscripten_bind_btSoftBody_setCollisionShape_1).apply(null,arguments)},Nm=t._emscripten_bind_btSoftBody_setCcdMotionThreshold_1=function(){return(Nm=t._emscripten_bind_btSoftBody_setCcdMotionThreshold_1=t.asm.emscripten_bind_btSoftBody_setCcdMotionThreshold_1).apply(null,arguments)},Lm=t._emscripten_bind_btSoftBody_setCcdSweptSphereRadius_1=function(){return(Lm=t._emscripten_bind_btSoftBody_setCcdSweptSphereRadius_1=t.asm.emscripten_bind_btSoftBody_setCcdSweptSphereRadius_1).apply(null,arguments)},km=t._emscripten_bind_btSoftBody_getUserIndex_0=function(){return(km=t._emscripten_bind_btSoftBody_getUserIndex_0=t.asm.emscripten_bind_btSoftBody_getUserIndex_0).apply(null,arguments)},Vm=t._emscripten_bind_btSoftBody_setUserIndex_1=function(){return(Vm=t._emscripten_bind_btSoftBody_setUserIndex_1=t.asm.emscripten_bind_btSoftBody_setUserIndex_1).apply(null,arguments)},Um=t._emscripten_bind_btSoftBody_getUserPointer_0=function(){return(Um=t._emscripten_bind_btSoftBody_getUserPointer_0=t.asm.emscripten_bind_btSoftBody_getUserPointer_0).apply(null,arguments)},Gm=t._emscripten_bind_btSoftBody_setUserPointer_1=function(){return(Gm=t._emscripten_bind_btSoftBody_setUserPointer_1=t.asm.emscripten_bind_btSoftBody_setUserPointer_1).apply(null,arguments)},jm=t._emscripten_bind_btSoftBody_getBroadphaseHandle_0=function(){return(jm=t._emscripten_bind_btSoftBody_getBroadphaseHandle_0=t.asm.emscripten_bind_btSoftBody_getBroadphaseHandle_0).apply(null,arguments)},Wm=t._emscripten_bind_btSoftBody_get_m_cfg_0=function(){return(Wm=t._emscripten_bind_btSoftBody_get_m_cfg_0=t.asm.emscripten_bind_btSoftBody_get_m_cfg_0).apply(null,arguments)},zm=t._emscripten_bind_btSoftBody_set_m_cfg_1=function(){return(zm=t._emscripten_bind_btSoftBody_set_m_cfg_1=t.asm.emscripten_bind_btSoftBody_set_m_cfg_1).apply(null,arguments)},Hm=t._emscripten_bind_btSoftBody_get_m_nodes_0=function(){return(Hm=t._emscripten_bind_btSoftBody_get_m_nodes_0=t.asm.emscripten_bind_btSoftBody_get_m_nodes_0).apply(null,arguments)},Xm=t._emscripten_bind_btSoftBody_set_m_nodes_1=function(){return(Xm=t._emscripten_bind_btSoftBody_set_m_nodes_1=t.asm.emscripten_bind_btSoftBody_set_m_nodes_1).apply(null,arguments)},Ym=t._emscripten_bind_btSoftBody_get_m_faces_0=function(){return(Ym=t._emscripten_bind_btSoftBody_get_m_faces_0=t.asm.emscripten_bind_btSoftBody_get_m_faces_0).apply(null,arguments)},Qm=t._emscripten_bind_btSoftBody_set_m_faces_1=function(){return(Qm=t._emscripten_bind_btSoftBody_set_m_faces_1=t.asm.emscripten_bind_btSoftBody_set_m_faces_1).apply(null,arguments)},qm=t._emscripten_bind_btSoftBody_get_m_materials_0=function(){return(qm=t._emscripten_bind_btSoftBody_get_m_materials_0=t.asm.emscripten_bind_btSoftBody_get_m_materials_0).apply(null,arguments)},Km=t._emscripten_bind_btSoftBody_set_m_materials_1=function(){return(Km=t._emscripten_bind_btSoftBody_set_m_materials_1=t.asm.emscripten_bind_btSoftBody_set_m_materials_1).apply(null,arguments)},Zm=t._emscripten_bind_btSoftBody_get_m_anchors_0=function(){return(Zm=t._emscripten_bind_btSoftBody_get_m_anchors_0=t.asm.emscripten_bind_btSoftBody_get_m_anchors_0).apply(null,arguments)},$m=t._emscripten_bind_btSoftBody_set_m_anchors_1=function(){return($m=t._emscripten_bind_btSoftBody_set_m_anchors_1=t.asm.emscripten_bind_btSoftBody_set_m_anchors_1).apply(null,arguments)},Jm=t._emscripten_bind_btSoftBody___destroy___0=function(){return(Jm=t._emscripten_bind_btSoftBody___destroy___0=t.asm.emscripten_bind_btSoftBody___destroy___0).apply(null,arguments)},eg=t._emscripten_bind_btIntArray_size_0=function(){return(eg=t._emscripten_bind_btIntArray_size_0=t.asm.emscripten_bind_btIntArray_size_0).apply(null,arguments)},tg=t._emscripten_bind_btIntArray_at_1=function(){return(tg=t._emscripten_bind_btIntArray_at_1=t.asm.emscripten_bind_btIntArray_at_1).apply(null,arguments)},ig=t._emscripten_bind_btIntArray___destroy___0=function(){return(ig=t._emscripten_bind_btIntArray___destroy___0=t.asm.emscripten_bind_btIntArray___destroy___0).apply(null,arguments)},ng=t._emscripten_bind_Config_get_kVCF_0=function(){return(ng=t._emscripten_bind_Config_get_kVCF_0=t.asm.emscripten_bind_Config_get_kVCF_0).apply(null,arguments)},rg=t._emscripten_bind_Config_set_kVCF_1=function(){return(rg=t._emscripten_bind_Config_set_kVCF_1=t.asm.emscripten_bind_Config_set_kVCF_1).apply(null,arguments)},sg=t._emscripten_bind_Config_get_kDP_0=function(){return(sg=t._emscripten_bind_Config_get_kDP_0=t.asm.emscripten_bind_Config_get_kDP_0).apply(null,arguments)},og=t._emscripten_bind_Config_set_kDP_1=function(){return(og=t._emscripten_bind_Config_set_kDP_1=t.asm.emscripten_bind_Config_set_kDP_1).apply(null,arguments)},ag=t._emscripten_bind_Config_get_kDG_0=function(){return(ag=t._emscripten_bind_Config_get_kDG_0=t.asm.emscripten_bind_Config_get_kDG_0).apply(null,arguments)},lg=t._emscripten_bind_Config_set_kDG_1=function(){return(lg=t._emscripten_bind_Config_set_kDG_1=t.asm.emscripten_bind_Config_set_kDG_1).apply(null,arguments)},cg=t._emscripten_bind_Config_get_kLF_0=function(){return(cg=t._emscripten_bind_Config_get_kLF_0=t.asm.emscripten_bind_Config_get_kLF_0).apply(null,arguments)},hg=t._emscripten_bind_Config_set_kLF_1=function(){return(hg=t._emscripten_bind_Config_set_kLF_1=t.asm.emscripten_bind_Config_set_kLF_1).apply(null,arguments)},_g=t._emscripten_bind_Config_get_kPR_0=function(){return(_g=t._emscripten_bind_Config_get_kPR_0=t.asm.emscripten_bind_Config_get_kPR_0).apply(null,arguments)},dg=t._emscripten_bind_Config_set_kPR_1=function(){return(dg=t._emscripten_bind_Config_set_kPR_1=t.asm.emscripten_bind_Config_set_kPR_1).apply(null,arguments)},ug=t._emscripten_bind_Config_get_kVC_0=function(){return(ug=t._emscripten_bind_Config_get_kVC_0=t.asm.emscripten_bind_Config_get_kVC_0).apply(null,arguments)},pg=t._emscripten_bind_Config_set_kVC_1=function(){return(pg=t._emscripten_bind_Config_set_kVC_1=t.asm.emscripten_bind_Config_set_kVC_1).apply(null,arguments)},fg=t._emscripten_bind_Config_get_kDF_0=function(){return(fg=t._emscripten_bind_Config_get_kDF_0=t.asm.emscripten_bind_Config_get_kDF_0).apply(null,arguments)},mg=t._emscripten_bind_Config_set_kDF_1=function(){return(mg=t._emscripten_bind_Config_set_kDF_1=t.asm.emscripten_bind_Config_set_kDF_1).apply(null,arguments)},gg=t._emscripten_bind_Config_get_kMT_0=function(){return(gg=t._emscripten_bind_Config_get_kMT_0=t.asm.emscripten_bind_Config_get_kMT_0).apply(null,arguments)},bg=t._emscripten_bind_Config_set_kMT_1=function(){return(bg=t._emscripten_bind_Config_set_kMT_1=t.asm.emscripten_bind_Config_set_kMT_1).apply(null,arguments)},yg=t._emscripten_bind_Config_get_kCHR_0=function(){return(yg=t._emscripten_bind_Config_get_kCHR_0=t.asm.emscripten_bind_Config_get_kCHR_0).apply(null,arguments)},vg=t._emscripten_bind_Config_set_kCHR_1=function(){return(vg=t._emscripten_bind_Config_set_kCHR_1=t.asm.emscripten_bind_Config_set_kCHR_1).apply(null,arguments)},Ag=t._emscripten_bind_Config_get_kKHR_0=function(){return(Ag=t._emscripten_bind_Config_get_kKHR_0=t.asm.emscripten_bind_Config_get_kKHR_0).apply(null,arguments)},Cg=t._emscripten_bind_Config_set_kKHR_1=function(){return(Cg=t._emscripten_bind_Config_set_kKHR_1=t.asm.emscripten_bind_Config_set_kKHR_1).apply(null,arguments)},Sg=t._emscripten_bind_Config_get_kSHR_0=function(){return(Sg=t._emscripten_bind_Config_get_kSHR_0=t.asm.emscripten_bind_Config_get_kSHR_0).apply(null,arguments)},xg=t._emscripten_bind_Config_set_kSHR_1=function(){return(xg=t._emscripten_bind_Config_set_kSHR_1=t.asm.emscripten_bind_Config_set_kSHR_1).apply(null,arguments)},Tg=t._emscripten_bind_Config_get_kAHR_0=function(){return(Tg=t._emscripten_bind_Config_get_kAHR_0=t.asm.emscripten_bind_Config_get_kAHR_0).apply(null,arguments)},Eg=t._emscripten_bind_Config_set_kAHR_1=function(){return(Eg=t._emscripten_bind_Config_set_kAHR_1=t.asm.emscripten_bind_Config_set_kAHR_1).apply(null,arguments)},Rg=t._emscripten_bind_Config_get_kSRHR_CL_0=function(){return(Rg=t._emscripten_bind_Config_get_kSRHR_CL_0=t.asm.emscripten_bind_Config_get_kSRHR_CL_0).apply(null,arguments)},Pg=t._emscripten_bind_Config_set_kSRHR_CL_1=function(){return(Pg=t._emscripten_bind_Config_set_kSRHR_CL_1=t.asm.emscripten_bind_Config_set_kSRHR_CL_1).apply(null,arguments)},Ig=t._emscripten_bind_Config_get_kSKHR_CL_0=function(){return(Ig=t._emscripten_bind_Config_get_kSKHR_CL_0=t.asm.emscripten_bind_Config_get_kSKHR_CL_0).apply(null,arguments)},Mg=t._emscripten_bind_Config_set_kSKHR_CL_1=function(){return(Mg=t._emscripten_bind_Config_set_kSKHR_CL_1=t.asm.emscripten_bind_Config_set_kSKHR_CL_1).apply(null,arguments)},Dg=t._emscripten_bind_Config_get_kSSHR_CL_0=function(){return(Dg=t._emscripten_bind_Config_get_kSSHR_CL_0=t.asm.emscripten_bind_Config_get_kSSHR_CL_0).apply(null,arguments)},Og=t._emscripten_bind_Config_set_kSSHR_CL_1=function(){return(Og=t._emscripten_bind_Config_set_kSSHR_CL_1=t.asm.emscripten_bind_Config_set_kSSHR_CL_1).apply(null,arguments)},wg=t._emscripten_bind_Config_get_kSR_SPLT_CL_0=function(){return(wg=t._emscripten_bind_Config_get_kSR_SPLT_CL_0=t.asm.emscripten_bind_Config_get_kSR_SPLT_CL_0).apply(null,arguments)},Fg=t._emscripten_bind_Config_set_kSR_SPLT_CL_1=function(){return(Fg=t._emscripten_bind_Config_set_kSR_SPLT_CL_1=t.asm.emscripten_bind_Config_set_kSR_SPLT_CL_1).apply(null,arguments)},Bg=t._emscripten_bind_Config_get_kSK_SPLT_CL_0=function(){return(Bg=t._emscripten_bind_Config_get_kSK_SPLT_CL_0=t.asm.emscripten_bind_Config_get_kSK_SPLT_CL_0).apply(null,arguments)},Ng=t._emscripten_bind_Config_set_kSK_SPLT_CL_1=function(){return(Ng=t._emscripten_bind_Config_set_kSK_SPLT_CL_1=t.asm.emscripten_bind_Config_set_kSK_SPLT_CL_1).apply(null,arguments)},Lg=t._emscripten_bind_Config_get_kSS_SPLT_CL_0=function(){return(Lg=t._emscripten_bind_Config_get_kSS_SPLT_CL_0=t.asm.emscripten_bind_Config_get_kSS_SPLT_CL_0).apply(null,arguments)},kg=t._emscripten_bind_Config_set_kSS_SPLT_CL_1=function(){return(kg=t._emscripten_bind_Config_set_kSS_SPLT_CL_1=t.asm.emscripten_bind_Config_set_kSS_SPLT_CL_1).apply(null,arguments)},Vg=t._emscripten_bind_Config_get_maxvolume_0=function(){return(Vg=t._emscripten_bind_Config_get_maxvolume_0=t.asm.emscripten_bind_Config_get_maxvolume_0).apply(null,arguments)},Ug=t._emscripten_bind_Config_set_maxvolume_1=function(){return(Ug=t._emscripten_bind_Config_set_maxvolume_1=t.asm.emscripten_bind_Config_set_maxvolume_1).apply(null,arguments)},Gg=t._emscripten_bind_Config_get_timescale_0=function(){return(Gg=t._emscripten_bind_Config_get_timescale_0=t.asm.emscripten_bind_Config_get_timescale_0).apply(null,arguments)},jg=t._emscripten_bind_Config_set_timescale_1=function(){return(jg=t._emscripten_bind_Config_set_timescale_1=t.asm.emscripten_bind_Config_set_timescale_1).apply(null,arguments)},Wg=t._emscripten_bind_Config_get_viterations_0=function(){return(Wg=t._emscripten_bind_Config_get_viterations_0=t.asm.emscripten_bind_Config_get_viterations_0).apply(null,arguments)},zg=t._emscripten_bind_Config_set_viterations_1=function(){return(zg=t._emscripten_bind_Config_set_viterations_1=t.asm.emscripten_bind_Config_set_viterations_1).apply(null,arguments)},Hg=t._emscripten_bind_Config_get_piterations_0=function(){return(Hg=t._emscripten_bind_Config_get_piterations_0=t.asm.emscripten_bind_Config_get_piterations_0).apply(null,arguments)},Xg=t._emscripten_bind_Config_set_piterations_1=function(){return(Xg=t._emscripten_bind_Config_set_piterations_1=t.asm.emscripten_bind_Config_set_piterations_1).apply(null,arguments)},Yg=t._emscripten_bind_Config_get_diterations_0=function(){return(Yg=t._emscripten_bind_Config_get_diterations_0=t.asm.emscripten_bind_Config_get_diterations_0).apply(null,arguments)},Qg=t._emscripten_bind_Config_set_diterations_1=function(){return(Qg=t._emscripten_bind_Config_set_diterations_1=t.asm.emscripten_bind_Config_set_diterations_1).apply(null,arguments)},qg=t._emscripten_bind_Config_get_citerations_0=function(){return(qg=t._emscripten_bind_Config_get_citerations_0=t.asm.emscripten_bind_Config_get_citerations_0).apply(null,arguments)},Kg=t._emscripten_bind_Config_set_citerations_1=function(){return(Kg=t._emscripten_bind_Config_set_citerations_1=t.asm.emscripten_bind_Config_set_citerations_1).apply(null,arguments)},Zg=t._emscripten_bind_Config_get_collisions_0=function(){return(Zg=t._emscripten_bind_Config_get_collisions_0=t.asm.emscripten_bind_Config_get_collisions_0).apply(null,arguments)},$g=t._emscripten_bind_Config_set_collisions_1=function(){return($g=t._emscripten_bind_Config_set_collisions_1=t.asm.emscripten_bind_Config_set_collisions_1).apply(null,arguments)},Jg=t._emscripten_bind_Config___destroy___0=function(){return(Jg=t._emscripten_bind_Config___destroy___0=t.asm.emscripten_bind_Config___destroy___0).apply(null,arguments)},eb=t._emscripten_bind_Node_get_m_x_0=function(){return(eb=t._emscripten_bind_Node_get_m_x_0=t.asm.emscripten_bind_Node_get_m_x_0).apply(null,arguments)},tb=t._emscripten_bind_Node_set_m_x_1=function(){return(tb=t._emscripten_bind_Node_set_m_x_1=t.asm.emscripten_bind_Node_set_m_x_1).apply(null,arguments)},ib=t._emscripten_bind_Node_get_m_q_0=function(){return(ib=t._emscripten_bind_Node_get_m_q_0=t.asm.emscripten_bind_Node_get_m_q_0).apply(null,arguments)},nb=t._emscripten_bind_Node_set_m_q_1=function(){return(nb=t._emscripten_bind_Node_set_m_q_1=t.asm.emscripten_bind_Node_set_m_q_1).apply(null,arguments)},rb=t._emscripten_bind_Node_get_m_v_0=function(){return(rb=t._emscripten_bind_Node_get_m_v_0=t.asm.emscripten_bind_Node_get_m_v_0).apply(null,arguments)},sb=t._emscripten_bind_Node_set_m_v_1=function(){return(sb=t._emscripten_bind_Node_set_m_v_1=t.asm.emscripten_bind_Node_set_m_v_1).apply(null,arguments)},ob=t._emscripten_bind_Node_get_m_f_0=function(){return(ob=t._emscripten_bind_Node_get_m_f_0=t.asm.emscripten_bind_Node_get_m_f_0).apply(null,arguments)},ab=t._emscripten_bind_Node_set_m_f_1=function(){return(ab=t._emscripten_bind_Node_set_m_f_1=t.asm.emscripten_bind_Node_set_m_f_1).apply(null,arguments)},lb=t._emscripten_bind_Node_get_m_n_0=function(){return(lb=t._emscripten_bind_Node_get_m_n_0=t.asm.emscripten_bind_Node_get_m_n_0).apply(null,arguments)},cb=t._emscripten_bind_Node_set_m_n_1=function(){return(cb=t._emscripten_bind_Node_set_m_n_1=t.asm.emscripten_bind_Node_set_m_n_1).apply(null,arguments)},hb=t._emscripten_bind_Node_get_m_im_0=function(){return(hb=t._emscripten_bind_Node_get_m_im_0=t.asm.emscripten_bind_Node_get_m_im_0).apply(null,arguments)},_b=t._emscripten_bind_Node_set_m_im_1=function(){return(_b=t._emscripten_bind_Node_set_m_im_1=t.asm.emscripten_bind_Node_set_m_im_1).apply(null,arguments)},db=t._emscripten_bind_Node_get_m_area_0=function(){return(db=t._emscripten_bind_Node_get_m_area_0=t.asm.emscripten_bind_Node_get_m_area_0).apply(null,arguments)},ub=t._emscripten_bind_Node_set_m_area_1=function(){return(ub=t._emscripten_bind_Node_set_m_area_1=t.asm.emscripten_bind_Node_set_m_area_1).apply(null,arguments)},pb=t._emscripten_bind_Node___destroy___0=function(){return(pb=t._emscripten_bind_Node___destroy___0=t.asm.emscripten_bind_Node___destroy___0).apply(null,arguments)},fb=t._emscripten_bind_btGhostPairCallback_btGhostPairCallback_0=function(){return(fb=t._emscripten_bind_btGhostPairCallback_btGhostPairCallback_0=t.asm.emscripten_bind_btGhostPairCallback_btGhostPairCallback_0).apply(null,arguments)},mb=t._emscripten_bind_btGhostPairCallback___destroy___0=function(){return(mb=t._emscripten_bind_btGhostPairCallback___destroy___0=t.asm.emscripten_bind_btGhostPairCallback___destroy___0).apply(null,arguments)},gb=t._emscripten_bind_btOverlappingPairCallback___destroy___0=function(){return(gb=t._emscripten_bind_btOverlappingPairCallback___destroy___0=t.asm.emscripten_bind_btOverlappingPairCallback___destroy___0).apply(null,arguments)},bb=t._emscripten_bind_btKinematicCharacterController_btKinematicCharacterController_3=function(){return(bb=t._emscripten_bind_btKinematicCharacterController_btKinematicCharacterController_3=t.asm.emscripten_bind_btKinematicCharacterController_btKinematicCharacterController_3).apply(null,arguments)},yb=t._emscripten_bind_btKinematicCharacterController_btKinematicCharacterController_4=function(){return(yb=t._emscripten_bind_btKinematicCharacterController_btKinematicCharacterController_4=t.asm.emscripten_bind_btKinematicCharacterController_btKinematicCharacterController_4).apply(null,arguments)},vb=t._emscripten_bind_btKinematicCharacterController_setUpAxis_1=function(){return(vb=t._emscripten_bind_btKinematicCharacterController_setUpAxis_1=t.asm.emscripten_bind_btKinematicCharacterController_setUpAxis_1).apply(null,arguments)},Ab=t._emscripten_bind_btKinematicCharacterController_setWalkDirection_1=function(){return(Ab=t._emscripten_bind_btKinematicCharacterController_setWalkDirection_1=t.asm.emscripten_bind_btKinematicCharacterController_setWalkDirection_1).apply(null,arguments)},Cb=t._emscripten_bind_btKinematicCharacterController_setVelocityForTimeInterval_2=function(){return(Cb=t._emscripten_bind_btKinematicCharacterController_setVelocityForTimeInterval_2=t.asm.emscripten_bind_btKinematicCharacterController_setVelocityForTimeInterval_2).apply(null,arguments)},Sb=t._emscripten_bind_btKinematicCharacterController_warp_1=function(){return(Sb=t._emscripten_bind_btKinematicCharacterController_warp_1=t.asm.emscripten_bind_btKinematicCharacterController_warp_1).apply(null,arguments)},xb=t._emscripten_bind_btKinematicCharacterController_preStep_1=function(){return(xb=t._emscripten_bind_btKinematicCharacterController_preStep_1=t.asm.emscripten_bind_btKinematicCharacterController_preStep_1).apply(null,arguments)},Tb=t._emscripten_bind_btKinematicCharacterController_playerStep_2=function(){return(Tb=t._emscripten_bind_btKinematicCharacterController_playerStep_2=t.asm.emscripten_bind_btKinematicCharacterController_playerStep_2).apply(null,arguments)},Eb=t._emscripten_bind_btKinematicCharacterController_setFallSpeed_1=function(){return(Eb=t._emscripten_bind_btKinematicCharacterController_setFallSpeed_1=t.asm.emscripten_bind_btKinematicCharacterController_setFallSpeed_1).apply(null,arguments)},Rb=t._emscripten_bind_btKinematicCharacterController_setJumpSpeed_1=function(){return(Rb=t._emscripten_bind_btKinematicCharacterController_setJumpSpeed_1=t.asm.emscripten_bind_btKinematicCharacterController_setJumpSpeed_1).apply(null,arguments)},Pb=t._emscripten_bind_btKinematicCharacterController_setMaxJumpHeight_1=function(){return(Pb=t._emscripten_bind_btKinematicCharacterController_setMaxJumpHeight_1=t.asm.emscripten_bind_btKinematicCharacterController_setMaxJumpHeight_1).apply(null,arguments)},Ib=t._emscripten_bind_btKinematicCharacterController_canJump_0=function(){return(Ib=t._emscripten_bind_btKinematicCharacterController_canJump_0=t.asm.emscripten_bind_btKinematicCharacterController_canJump_0).apply(null,arguments)},Mb=t._emscripten_bind_btKinematicCharacterController_jump_0=function(){return(Mb=t._emscripten_bind_btKinematicCharacterController_jump_0=t.asm.emscripten_bind_btKinematicCharacterController_jump_0).apply(null,arguments)},Db=t._emscripten_bind_btKinematicCharacterController_setGravity_1=function(){return(Db=t._emscripten_bind_btKinematicCharacterController_setGravity_1=t.asm.emscripten_bind_btKinematicCharacterController_setGravity_1).apply(null,arguments)},Ob=t._emscripten_bind_btKinematicCharacterController_getGravity_0=function(){return(Ob=t._emscripten_bind_btKinematicCharacterController_getGravity_0=t.asm.emscripten_bind_btKinematicCharacterController_getGravity_0).apply(null,arguments)},wb=t._emscripten_bind_btKinematicCharacterController_setMaxSlope_1=function(){return(wb=t._emscripten_bind_btKinematicCharacterController_setMaxSlope_1=t.asm.emscripten_bind_btKinematicCharacterController_setMaxSlope_1).apply(null,arguments)},Fb=t._emscripten_bind_btKinematicCharacterController_getMaxSlope_0=function(){return(Fb=t._emscripten_bind_btKinematicCharacterController_getMaxSlope_0=t.asm.emscripten_bind_btKinematicCharacterController_getMaxSlope_0).apply(null,arguments)},Bb=t._emscripten_bind_btKinematicCharacterController_getGhostObject_0=function(){return(Bb=t._emscripten_bind_btKinematicCharacterController_getGhostObject_0=t.asm.emscripten_bind_btKinematicCharacterController_getGhostObject_0).apply(null,arguments)},Nb=t._emscripten_bind_btKinematicCharacterController_setUseGhostSweepTest_1=function(){return(Nb=t._emscripten_bind_btKinematicCharacterController_setUseGhostSweepTest_1=t.asm.emscripten_bind_btKinematicCharacterController_setUseGhostSweepTest_1).apply(null,arguments)},Lb=t._emscripten_bind_btKinematicCharacterController_onGround_0=function(){return(Lb=t._emscripten_bind_btKinematicCharacterController_onGround_0=t.asm.emscripten_bind_btKinematicCharacterController_onGround_0).apply(null,arguments)},kb=t._emscripten_bind_btKinematicCharacterController_setUpInterpolate_1=function(){return(kb=t._emscripten_bind_btKinematicCharacterController_setUpInterpolate_1=t.asm.emscripten_bind_btKinematicCharacterController_setUpInterpolate_1).apply(null,arguments)},Vb=t._emscripten_bind_btKinematicCharacterController_updateAction_2=function(){return(Vb=t._emscripten_bind_btKinematicCharacterController_updateAction_2=t.asm.emscripten_bind_btKinematicCharacterController_updateAction_2).apply(null,arguments)},Ub=t._emscripten_bind_btKinematicCharacterController___destroy___0=function(){return(Ub=t._emscripten_bind_btKinematicCharacterController___destroy___0=t.asm.emscripten_bind_btKinematicCharacterController___destroy___0).apply(null,arguments)},Gb=t._emscripten_bind_btSoftBodyArray_size_0=function(){return(Gb=t._emscripten_bind_btSoftBodyArray_size_0=t.asm.emscripten_bind_btSoftBodyArray_size_0).apply(null,arguments)},jb=t._emscripten_bind_btSoftBodyArray_at_1=function(){return(jb=t._emscripten_bind_btSoftBodyArray_at_1=t.asm.emscripten_bind_btSoftBodyArray_at_1).apply(null,arguments)},Wb=t._emscripten_bind_btSoftBodyArray___destroy___0=function(){return(Wb=t._emscripten_bind_btSoftBodyArray___destroy___0=t.asm.emscripten_bind_btSoftBodyArray___destroy___0).apply(null,arguments)},zb=t._emscripten_bind_btFaceArray_size_0=function(){return(zb=t._emscripten_bind_btFaceArray_size_0=t.asm.emscripten_bind_btFaceArray_size_0).apply(null,arguments)},Hb=t._emscripten_bind_btFaceArray_at_1=function(){return(Hb=t._emscripten_bind_btFaceArray_at_1=t.asm.emscripten_bind_btFaceArray_at_1).apply(null,arguments)},Xb=t._emscripten_bind_btFaceArray___destroy___0=function(){return(Xb=t._emscripten_bind_btFaceArray___destroy___0=t.asm.emscripten_bind_btFaceArray___destroy___0).apply(null,arguments)},Yb=t._emscripten_bind_btStaticPlaneShape_btStaticPlaneShape_2=function(){return(Yb=t._emscripten_bind_btStaticPlaneShape_btStaticPlaneShape_2=t.asm.emscripten_bind_btStaticPlaneShape_btStaticPlaneShape_2).apply(null,arguments)},Qb=t._emscripten_bind_btStaticPlaneShape_setLocalScaling_1=function(){return(Qb=t._emscripten_bind_btStaticPlaneShape_setLocalScaling_1=t.asm.emscripten_bind_btStaticPlaneShape_setLocalScaling_1).apply(null,arguments)},qb=t._emscripten_bind_btStaticPlaneShape_getLocalScaling_0=function(){return(qb=t._emscripten_bind_btStaticPlaneShape_getLocalScaling_0=t.asm.emscripten_bind_btStaticPlaneShape_getLocalScaling_0).apply(null,arguments)},Kb=t._emscripten_bind_btStaticPlaneShape_calculateLocalInertia_2=function(){return(Kb=t._emscripten_bind_btStaticPlaneShape_calculateLocalInertia_2=t.asm.emscripten_bind_btStaticPlaneShape_calculateLocalInertia_2).apply(null,arguments)},Zb=t._emscripten_bind_btStaticPlaneShape___destroy___0=function(){return(Zb=t._emscripten_bind_btStaticPlaneShape___destroy___0=t.asm.emscripten_bind_btStaticPlaneShape___destroy___0).apply(null,arguments)},$b=t._emscripten_bind_btOverlappingPairCache_setInternalGhostPairCallback_1=function(){return($b=t._emscripten_bind_btOverlappingPairCache_setInternalGhostPairCallback_1=t.asm.emscripten_bind_btOverlappingPairCache_setInternalGhostPairCallback_1).apply(null,arguments)},Jb=t._emscripten_bind_btOverlappingPairCache_getNumOverlappingPairs_0=function(){return(Jb=t._emscripten_bind_btOverlappingPairCache_getNumOverlappingPairs_0=t.asm.emscripten_bind_btOverlappingPairCache_getNumOverlappingPairs_0).apply(null,arguments)},ey=t._emscripten_bind_btOverlappingPairCache___destroy___0=function(){return(ey=t._emscripten_bind_btOverlappingPairCache___destroy___0=t.asm.emscripten_bind_btOverlappingPairCache___destroy___0).apply(null,arguments)},ty=t._emscripten_bind_btIndexedMesh_get_m_numTriangles_0=function(){return(ty=t._emscripten_bind_btIndexedMesh_get_m_numTriangles_0=t.asm.emscripten_bind_btIndexedMesh_get_m_numTriangles_0).apply(null,arguments)},iy=t._emscripten_bind_btIndexedMesh_set_m_numTriangles_1=function(){return(iy=t._emscripten_bind_btIndexedMesh_set_m_numTriangles_1=t.asm.emscripten_bind_btIndexedMesh_set_m_numTriangles_1).apply(null,arguments)},ny=t._emscripten_bind_btIndexedMesh___destroy___0=function(){return(ny=t._emscripten_bind_btIndexedMesh___destroy___0=t.asm.emscripten_bind_btIndexedMesh___destroy___0).apply(null,arguments)},ry=t._emscripten_bind_btSoftRigidDynamicsWorld_btSoftRigidDynamicsWorld_5=function(){return(ry=t._emscripten_bind_btSoftRigidDynamicsWorld_btSoftRigidDynamicsWorld_5=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_btSoftRigidDynamicsWorld_5).apply(null,arguments)},sy=t._emscripten_bind_btSoftRigidDynamicsWorld_addSoftBody_3=function(){return(sy=t._emscripten_bind_btSoftRigidDynamicsWorld_addSoftBody_3=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_addSoftBody_3).apply(null,arguments)},oy=t._emscripten_bind_btSoftRigidDynamicsWorld_removeSoftBody_1=function(){return(oy=t._emscripten_bind_btSoftRigidDynamicsWorld_removeSoftBody_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_removeSoftBody_1).apply(null,arguments)},ay=t._emscripten_bind_btSoftRigidDynamicsWorld_removeCollisionObject_1=function(){return(ay=t._emscripten_bind_btSoftRigidDynamicsWorld_removeCollisionObject_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_removeCollisionObject_1).apply(null,arguments)},ly=t._emscripten_bind_btSoftRigidDynamicsWorld_getWorldInfo_0=function(){return(ly=t._emscripten_bind_btSoftRigidDynamicsWorld_getWorldInfo_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_getWorldInfo_0).apply(null,arguments)},cy=t._emscripten_bind_btSoftRigidDynamicsWorld_getSoftBodyArray_0=function(){return(cy=t._emscripten_bind_btSoftRigidDynamicsWorld_getSoftBodyArray_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_getSoftBodyArray_0).apply(null,arguments)},hy=t._emscripten_bind_btSoftRigidDynamicsWorld_getDispatcher_0=function(){return(hy=t._emscripten_bind_btSoftRigidDynamicsWorld_getDispatcher_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_getDispatcher_0).apply(null,arguments)},_y=t._emscripten_bind_btSoftRigidDynamicsWorld_rayTest_3=function(){return(_y=t._emscripten_bind_btSoftRigidDynamicsWorld_rayTest_3=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_rayTest_3).apply(null,arguments)},dy=t._emscripten_bind_btSoftRigidDynamicsWorld_getPairCache_0=function(){return(dy=t._emscripten_bind_btSoftRigidDynamicsWorld_getPairCache_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_getPairCache_0).apply(null,arguments)},uy=t._emscripten_bind_btSoftRigidDynamicsWorld_getDispatchInfo_0=function(){return(uy=t._emscripten_bind_btSoftRigidDynamicsWorld_getDispatchInfo_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_getDispatchInfo_0).apply(null,arguments)},py=t._emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_1=function(){return(py=t._emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_1).apply(null,arguments)},fy=t._emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_2=function(){return(fy=t._emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_2=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_2).apply(null,arguments)},my=t._emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_3=function(){return(my=t._emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_3=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_addCollisionObject_3).apply(null,arguments)},gy=t._emscripten_bind_btSoftRigidDynamicsWorld_getBroadphase_0=function(){return(gy=t._emscripten_bind_btSoftRigidDynamicsWorld_getBroadphase_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_getBroadphase_0).apply(null,arguments)},by=t._emscripten_bind_btSoftRigidDynamicsWorld_convexSweepTest_5=function(){return(by=t._emscripten_bind_btSoftRigidDynamicsWorld_convexSweepTest_5=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_convexSweepTest_5).apply(null,arguments)},yy=t._emscripten_bind_btSoftRigidDynamicsWorld_contactPairTest_3=function(){return(yy=t._emscripten_bind_btSoftRigidDynamicsWorld_contactPairTest_3=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_contactPairTest_3).apply(null,arguments)},vy=t._emscripten_bind_btSoftRigidDynamicsWorld_contactTest_2=function(){return(vy=t._emscripten_bind_btSoftRigidDynamicsWorld_contactTest_2=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_contactTest_2).apply(null,arguments)},Ay=t._emscripten_bind_btSoftRigidDynamicsWorld_updateSingleAabb_1=function(){return(Ay=t._emscripten_bind_btSoftRigidDynamicsWorld_updateSingleAabb_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_updateSingleAabb_1).apply(null,arguments)},Cy=t._emscripten_bind_btSoftRigidDynamicsWorld_setDebugDrawer_1=function(){return(Cy=t._emscripten_bind_btSoftRigidDynamicsWorld_setDebugDrawer_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_setDebugDrawer_1).apply(null,arguments)},Sy=t._emscripten_bind_btSoftRigidDynamicsWorld_getDebugDrawer_0=function(){return(Sy=t._emscripten_bind_btSoftRigidDynamicsWorld_getDebugDrawer_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_getDebugDrawer_0).apply(null,arguments)},xy=t._emscripten_bind_btSoftRigidDynamicsWorld_debugDrawWorld_0=function(){return(xy=t._emscripten_bind_btSoftRigidDynamicsWorld_debugDrawWorld_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_debugDrawWorld_0).apply(null,arguments)},Ty=t._emscripten_bind_btSoftRigidDynamicsWorld_debugDrawObject_3=function(){return(Ty=t._emscripten_bind_btSoftRigidDynamicsWorld_debugDrawObject_3=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_debugDrawObject_3).apply(null,arguments)},Ey=t._emscripten_bind_btSoftRigidDynamicsWorld_setGravity_1=function(){return(Ey=t._emscripten_bind_btSoftRigidDynamicsWorld_setGravity_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_setGravity_1).apply(null,arguments)},Ry=t._emscripten_bind_btSoftRigidDynamicsWorld_getGravity_0=function(){return(Ry=t._emscripten_bind_btSoftRigidDynamicsWorld_getGravity_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_getGravity_0).apply(null,arguments)},Py=t._emscripten_bind_btSoftRigidDynamicsWorld_addRigidBody_1=function(){return(Py=t._emscripten_bind_btSoftRigidDynamicsWorld_addRigidBody_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_addRigidBody_1).apply(null,arguments)},Iy=t._emscripten_bind_btSoftRigidDynamicsWorld_addRigidBody_3=function(){return(Iy=t._emscripten_bind_btSoftRigidDynamicsWorld_addRigidBody_3=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_addRigidBody_3).apply(null,arguments)},My=t._emscripten_bind_btSoftRigidDynamicsWorld_removeRigidBody_1=function(){return(My=t._emscripten_bind_btSoftRigidDynamicsWorld_removeRigidBody_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_removeRigidBody_1).apply(null,arguments)},Dy=t._emscripten_bind_btSoftRigidDynamicsWorld_addConstraint_1=function(){return(Dy=t._emscripten_bind_btSoftRigidDynamicsWorld_addConstraint_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_addConstraint_1).apply(null,arguments)},Oy=t._emscripten_bind_btSoftRigidDynamicsWorld_addConstraint_2=function(){return(Oy=t._emscripten_bind_btSoftRigidDynamicsWorld_addConstraint_2=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_addConstraint_2).apply(null,arguments)},wy=t._emscripten_bind_btSoftRigidDynamicsWorld_removeConstraint_1=function(){return(wy=t._emscripten_bind_btSoftRigidDynamicsWorld_removeConstraint_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_removeConstraint_1).apply(null,arguments)},Fy=t._emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_1=function(){return(Fy=t._emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_1).apply(null,arguments)},By=t._emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_2=function(){return(By=t._emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_2=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_2).apply(null,arguments)},Ny=t._emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_3=function(){return(Ny=t._emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_3=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_stepSimulation_3).apply(null,arguments)},Ly=t._emscripten_bind_btSoftRigidDynamicsWorld_setContactAddedCallback_1=function(){return(Ly=t._emscripten_bind_btSoftRigidDynamicsWorld_setContactAddedCallback_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_setContactAddedCallback_1).apply(null,arguments)},ky=t._emscripten_bind_btSoftRigidDynamicsWorld_setContactProcessedCallback_1=function(){return(ky=t._emscripten_bind_btSoftRigidDynamicsWorld_setContactProcessedCallback_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_setContactProcessedCallback_1).apply(null,arguments)},Vy=t._emscripten_bind_btSoftRigidDynamicsWorld_setContactDestroyedCallback_1=function(){return(Vy=t._emscripten_bind_btSoftRigidDynamicsWorld_setContactDestroyedCallback_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_setContactDestroyedCallback_1).apply(null,arguments)},Uy=t._emscripten_bind_btSoftRigidDynamicsWorld_addAction_1=function(){return(Uy=t._emscripten_bind_btSoftRigidDynamicsWorld_addAction_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_addAction_1).apply(null,arguments)},Gy=t._emscripten_bind_btSoftRigidDynamicsWorld_removeAction_1=function(){return(Gy=t._emscripten_bind_btSoftRigidDynamicsWorld_removeAction_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_removeAction_1).apply(null,arguments)},jy=t._emscripten_bind_btSoftRigidDynamicsWorld_getSolverInfo_0=function(){return(jy=t._emscripten_bind_btSoftRigidDynamicsWorld_getSolverInfo_0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_getSolverInfo_0).apply(null,arguments)},Wy=t._emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_1=function(){return(Wy=t._emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_1=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_1).apply(null,arguments)},zy=t._emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_2=function(){return(zy=t._emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_2=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_2).apply(null,arguments)},Hy=t._emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_3=function(){return(Hy=t._emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_3=t.asm.emscripten_bind_btSoftRigidDynamicsWorld_setInternalTickCallback_3).apply(null,arguments)},Xy=t._emscripten_bind_btSoftRigidDynamicsWorld___destroy___0=function(){return(Xy=t._emscripten_bind_btSoftRigidDynamicsWorld___destroy___0=t.asm.emscripten_bind_btSoftRigidDynamicsWorld___destroy___0).apply(null,arguments)},Yy=t._emscripten_bind_btFixedConstraint_btFixedConstraint_4=function(){return(Yy=t._emscripten_bind_btFixedConstraint_btFixedConstraint_4=t.asm.emscripten_bind_btFixedConstraint_btFixedConstraint_4).apply(null,arguments)},Qy=t._emscripten_bind_btFixedConstraint_enableFeedback_1=function(){return(Qy=t._emscripten_bind_btFixedConstraint_enableFeedback_1=t.asm.emscripten_bind_btFixedConstraint_enableFeedback_1).apply(null,arguments)},qy=t._emscripten_bind_btFixedConstraint_getBreakingImpulseThreshold_0=function(){return(qy=t._emscripten_bind_btFixedConstraint_getBreakingImpulseThreshold_0=t.asm.emscripten_bind_btFixedConstraint_getBreakingImpulseThreshold_0).apply(null,arguments)},Ky=t._emscripten_bind_btFixedConstraint_setBreakingImpulseThreshold_1=function(){return(Ky=t._emscripten_bind_btFixedConstraint_setBreakingImpulseThreshold_1=t.asm.emscripten_bind_btFixedConstraint_setBreakingImpulseThreshold_1).apply(null,arguments)},Zy=t._emscripten_bind_btFixedConstraint_getParam_2=function(){return(Zy=t._emscripten_bind_btFixedConstraint_getParam_2=t.asm.emscripten_bind_btFixedConstraint_getParam_2).apply(null,arguments)},$y=t._emscripten_bind_btFixedConstraint_setParam_3=function(){return($y=t._emscripten_bind_btFixedConstraint_setParam_3=t.asm.emscripten_bind_btFixedConstraint_setParam_3).apply(null,arguments)},Jy=t._emscripten_bind_btFixedConstraint___destroy___0=function(){return(Jy=t._emscripten_bind_btFixedConstraint___destroy___0=t.asm.emscripten_bind_btFixedConstraint___destroy___0).apply(null,arguments)},ev=t._emscripten_bind_btTransform_btTransform_0=function(){return(ev=t._emscripten_bind_btTransform_btTransform_0=t.asm.emscripten_bind_btTransform_btTransform_0).apply(null,arguments)},tv=t._emscripten_bind_btTransform_btTransform_2=function(){return(tv=t._emscripten_bind_btTransform_btTransform_2=t.asm.emscripten_bind_btTransform_btTransform_2).apply(null,arguments)},iv=t._emscripten_bind_btTransform_setIdentity_0=function(){return(iv=t._emscripten_bind_btTransform_setIdentity_0=t.asm.emscripten_bind_btTransform_setIdentity_0).apply(null,arguments)},nv=t._emscripten_bind_btTransform_setOrigin_1=function(){return(nv=t._emscripten_bind_btTransform_setOrigin_1=t.asm.emscripten_bind_btTransform_setOrigin_1).apply(null,arguments)},rv=t._emscripten_bind_btTransform_setRotation_1=function(){return(rv=t._emscripten_bind_btTransform_setRotation_1=t.asm.emscripten_bind_btTransform_setRotation_1).apply(null,arguments)},sv=t._emscripten_bind_btTransform_getOrigin_0=function(){return(sv=t._emscripten_bind_btTransform_getOrigin_0=t.asm.emscripten_bind_btTransform_getOrigin_0).apply(null,arguments)},ov=t._emscripten_bind_btTransform_getRotation_0=function(){return(ov=t._emscripten_bind_btTransform_getRotation_0=t.asm.emscripten_bind_btTransform_getRotation_0).apply(null,arguments)},av=t._emscripten_bind_btTransform_getBasis_0=function(){return(av=t._emscripten_bind_btTransform_getBasis_0=t.asm.emscripten_bind_btTransform_getBasis_0).apply(null,arguments)},lv=t._emscripten_bind_btTransform_setFromOpenGLMatrix_1=function(){return(lv=t._emscripten_bind_btTransform_setFromOpenGLMatrix_1=t.asm.emscripten_bind_btTransform_setFromOpenGLMatrix_1).apply(null,arguments)},cv=t._emscripten_bind_btTransform_inverse_0=function(){return(cv=t._emscripten_bind_btTransform_inverse_0=t.asm.emscripten_bind_btTransform_inverse_0).apply(null,arguments)},hv=t._emscripten_bind_btTransform_op_mul_1=function(){return(hv=t._emscripten_bind_btTransform_op_mul_1=t.asm.emscripten_bind_btTransform_op_mul_1).apply(null,arguments)},_v=t._emscripten_bind_btTransform___destroy___0=function(){return(_v=t._emscripten_bind_btTransform___destroy___0=t.asm.emscripten_bind_btTransform___destroy___0).apply(null,arguments)},dv=t._emscripten_bind_ClosestRayResultCallback_ClosestRayResultCallback_2=function(){return(dv=t._emscripten_bind_ClosestRayResultCallback_ClosestRayResultCallback_2=t.asm.emscripten_bind_ClosestRayResultCallback_ClosestRayResultCallback_2).apply(null,arguments)},uv=t._emscripten_bind_ClosestRayResultCallback_hasHit_0=function(){return(uv=t._emscripten_bind_ClosestRayResultCallback_hasHit_0=t.asm.emscripten_bind_ClosestRayResultCallback_hasHit_0).apply(null,arguments)},pv=t._emscripten_bind_ClosestRayResultCallback_get_m_rayFromWorld_0=function(){return(pv=t._emscripten_bind_ClosestRayResultCallback_get_m_rayFromWorld_0=t.asm.emscripten_bind_ClosestRayResultCallback_get_m_rayFromWorld_0).apply(null,arguments)},fv=t._emscripten_bind_ClosestRayResultCallback_set_m_rayFromWorld_1=function(){return(fv=t._emscripten_bind_ClosestRayResultCallback_set_m_rayFromWorld_1=t.asm.emscripten_bind_ClosestRayResultCallback_set_m_rayFromWorld_1).apply(null,arguments)},mv=t._emscripten_bind_ClosestRayResultCallback_get_m_rayToWorld_0=function(){return(mv=t._emscripten_bind_ClosestRayResultCallback_get_m_rayToWorld_0=t.asm.emscripten_bind_ClosestRayResultCallback_get_m_rayToWorld_0).apply(null,arguments)},gv=t._emscripten_bind_ClosestRayResultCallback_set_m_rayToWorld_1=function(){return(gv=t._emscripten_bind_ClosestRayResultCallback_set_m_rayToWorld_1=t.asm.emscripten_bind_ClosestRayResultCallback_set_m_rayToWorld_1).apply(null,arguments)},bv=t._emscripten_bind_ClosestRayResultCallback_get_m_hitNormalWorld_0=function(){return(bv=t._emscripten_bind_ClosestRayResultCallback_get_m_hitNormalWorld_0=t.asm.emscripten_bind_ClosestRayResultCallback_get_m_hitNormalWorld_0).apply(null,arguments)},yv=t._emscripten_bind_ClosestRayResultCallback_set_m_hitNormalWorld_1=function(){return(yv=t._emscripten_bind_ClosestRayResultCallback_set_m_hitNormalWorld_1=t.asm.emscripten_bind_ClosestRayResultCallback_set_m_hitNormalWorld_1).apply(null,arguments)},vv=t._emscripten_bind_ClosestRayResultCallback_get_m_hitPointWorld_0=function(){return(vv=t._emscripten_bind_ClosestRayResultCallback_get_m_hitPointWorld_0=t.asm.emscripten_bind_ClosestRayResultCallback_get_m_hitPointWorld_0).apply(null,arguments)},Av=t._emscripten_bind_ClosestRayResultCallback_set_m_hitPointWorld_1=function(){return(Av=t._emscripten_bind_ClosestRayResultCallback_set_m_hitPointWorld_1=t.asm.emscripten_bind_ClosestRayResultCallback_set_m_hitPointWorld_1).apply(null,arguments)},Cv=t._emscripten_bind_ClosestRayResultCallback_get_m_collisionFilterGroup_0=function(){return(Cv=t._emscripten_bind_ClosestRayResultCallback_get_m_collisionFilterGroup_0=t.asm.emscripten_bind_ClosestRayResultCallback_get_m_collisionFilterGroup_0).apply(null,arguments)},Sv=t._emscripten_bind_ClosestRayResultCallback_set_m_collisionFilterGroup_1=function(){return(Sv=t._emscripten_bind_ClosestRayResultCallback_set_m_collisionFilterGroup_1=t.asm.emscripten_bind_ClosestRayResultCallback_set_m_collisionFilterGroup_1).apply(null,arguments)},xv=t._emscripten_bind_ClosestRayResultCallback_get_m_collisionFilterMask_0=function(){return(xv=t._emscripten_bind_ClosestRayResultCallback_get_m_collisionFilterMask_0=t.asm.emscripten_bind_ClosestRayResultCallback_get_m_collisionFilterMask_0).apply(null,arguments)},Tv=t._emscripten_bind_ClosestRayResultCallback_set_m_collisionFilterMask_1=function(){return(Tv=t._emscripten_bind_ClosestRayResultCallback_set_m_collisionFilterMask_1=t.asm.emscripten_bind_ClosestRayResultCallback_set_m_collisionFilterMask_1).apply(null,arguments)},Ev=t._emscripten_bind_ClosestRayResultCallback_get_m_closestHitFraction_0=function(){return(Ev=t._emscripten_bind_ClosestRayResultCallback_get_m_closestHitFraction_0=t.asm.emscripten_bind_ClosestRayResultCallback_get_m_closestHitFraction_0).apply(null,arguments)},Rv=t._emscripten_bind_ClosestRayResultCallback_set_m_closestHitFraction_1=function(){return(Rv=t._emscripten_bind_ClosestRayResultCallback_set_m_closestHitFraction_1=t.asm.emscripten_bind_ClosestRayResultCallback_set_m_closestHitFraction_1).apply(null,arguments)},Pv=t._emscripten_bind_ClosestRayResultCallback_get_m_collisionObject_0=function(){return(Pv=t._emscripten_bind_ClosestRayResultCallback_get_m_collisionObject_0=t.asm.emscripten_bind_ClosestRayResultCallback_get_m_collisionObject_0).apply(null,arguments)},Iv=t._emscripten_bind_ClosestRayResultCallback_set_m_collisionObject_1=function(){return(Iv=t._emscripten_bind_ClosestRayResultCallback_set_m_collisionObject_1=t.asm.emscripten_bind_ClosestRayResultCallback_set_m_collisionObject_1).apply(null,arguments)},Mv=t._emscripten_bind_ClosestRayResultCallback___destroy___0=function(){return(Mv=t._emscripten_bind_ClosestRayResultCallback___destroy___0=t.asm.emscripten_bind_ClosestRayResultCallback___destroy___0).apply(null,arguments)},Dv=t._emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration_btSoftBodyRigidBodyCollisionConfiguration_0=function(){return(Dv=t._emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration_btSoftBodyRigidBodyCollisionConfiguration_0=t.asm.emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration_btSoftBodyRigidBodyCollisionConfiguration_0).apply(null,arguments)},Ov=t._emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration_btSoftBodyRigidBodyCollisionConfiguration_1=function(){return(Ov=t._emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration_btSoftBodyRigidBodyCollisionConfiguration_1=t.asm.emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration_btSoftBodyRigidBodyCollisionConfiguration_1).apply(null,arguments)},wv=t._emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration___destroy___0=function(){return(wv=t._emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration___destroy___0=t.asm.emscripten_bind_btSoftBodyRigidBodyCollisionConfiguration___destroy___0).apply(null,arguments)},Fv=t._emscripten_bind_ConcreteContactResultCallback_ConcreteContactResultCallback_0=function(){return(Fv=t._emscripten_bind_ConcreteContactResultCallback_ConcreteContactResultCallback_0=t.asm.emscripten_bind_ConcreteContactResultCallback_ConcreteContactResultCallback_0).apply(null,arguments)},Bv=t._emscripten_bind_ConcreteContactResultCallback_addSingleResult_7=function(){return(Bv=t._emscripten_bind_ConcreteContactResultCallback_addSingleResult_7=t.asm.emscripten_bind_ConcreteContactResultCallback_addSingleResult_7).apply(null,arguments)},Nv=t._emscripten_bind_ConcreteContactResultCallback___destroy___0=function(){return(Nv=t._emscripten_bind_ConcreteContactResultCallback___destroy___0=t.asm.emscripten_bind_ConcreteContactResultCallback___destroy___0).apply(null,arguments)},Lv=t._emscripten_bind_btBvhTriangleMeshShape_btBvhTriangleMeshShape_2=function(){return(Lv=t._emscripten_bind_btBvhTriangleMeshShape_btBvhTriangleMeshShape_2=t.asm.emscripten_bind_btBvhTriangleMeshShape_btBvhTriangleMeshShape_2).apply(null,arguments)},kv=t._emscripten_bind_btBvhTriangleMeshShape_btBvhTriangleMeshShape_3=function(){return(kv=t._emscripten_bind_btBvhTriangleMeshShape_btBvhTriangleMeshShape_3=t.asm.emscripten_bind_btBvhTriangleMeshShape_btBvhTriangleMeshShape_3).apply(null,arguments)},Vv=t._emscripten_bind_btBvhTriangleMeshShape_setLocalScaling_1=function(){return(Vv=t._emscripten_bind_btBvhTriangleMeshShape_setLocalScaling_1=t.asm.emscripten_bind_btBvhTriangleMeshShape_setLocalScaling_1).apply(null,arguments)},Uv=t._emscripten_bind_btBvhTriangleMeshShape_getLocalScaling_0=function(){return(Uv=t._emscripten_bind_btBvhTriangleMeshShape_getLocalScaling_0=t.asm.emscripten_bind_btBvhTriangleMeshShape_getLocalScaling_0).apply(null,arguments)},Gv=t._emscripten_bind_btBvhTriangleMeshShape_calculateLocalInertia_2=function(){return(Gv=t._emscripten_bind_btBvhTriangleMeshShape_calculateLocalInertia_2=t.asm.emscripten_bind_btBvhTriangleMeshShape_calculateLocalInertia_2).apply(null,arguments)},jv=t._emscripten_bind_btBvhTriangleMeshShape___destroy___0=function(){return(jv=t._emscripten_bind_btBvhTriangleMeshShape___destroy___0=t.asm.emscripten_bind_btBvhTriangleMeshShape___destroy___0).apply(null,arguments)},Wv=t._emscripten_bind_btConstCollisionObjectArray_size_0=function(){return(Wv=t._emscripten_bind_btConstCollisionObjectArray_size_0=t.asm.emscripten_bind_btConstCollisionObjectArray_size_0).apply(null,arguments)},zv=t._emscripten_bind_btConstCollisionObjectArray_at_1=function(){return(zv=t._emscripten_bind_btConstCollisionObjectArray_at_1=t.asm.emscripten_bind_btConstCollisionObjectArray_at_1).apply(null,arguments)},Hv=t._emscripten_bind_btConstCollisionObjectArray___destroy___0=function(){return(Hv=t._emscripten_bind_btConstCollisionObjectArray___destroy___0=t.asm.emscripten_bind_btConstCollisionObjectArray___destroy___0).apply(null,arguments)},Xv=t._emscripten_bind_btSliderConstraint_btSliderConstraint_3=function(){return(Xv=t._emscripten_bind_btSliderConstraint_btSliderConstraint_3=t.asm.emscripten_bind_btSliderConstraint_btSliderConstraint_3).apply(null,arguments)},Yv=t._emscripten_bind_btSliderConstraint_btSliderConstraint_5=function(){return(Yv=t._emscripten_bind_btSliderConstraint_btSliderConstraint_5=t.asm.emscripten_bind_btSliderConstraint_btSliderConstraint_5).apply(null,arguments)},Qv=t._emscripten_bind_btSliderConstraint_setLowerLinLimit_1=function(){return(Qv=t._emscripten_bind_btSliderConstraint_setLowerLinLimit_1=t.asm.emscripten_bind_btSliderConstraint_setLowerLinLimit_1).apply(null,arguments)},qv=t._emscripten_bind_btSliderConstraint_setUpperLinLimit_1=function(){return(qv=t._emscripten_bind_btSliderConstraint_setUpperLinLimit_1=t.asm.emscripten_bind_btSliderConstraint_setUpperLinLimit_1).apply(null,arguments)},Kv=t._emscripten_bind_btSliderConstraint_setLowerAngLimit_1=function(){return(Kv=t._emscripten_bind_btSliderConstraint_setLowerAngLimit_1=t.asm.emscripten_bind_btSliderConstraint_setLowerAngLimit_1).apply(null,arguments)},Zv=t._emscripten_bind_btSliderConstraint_setUpperAngLimit_1=function(){return(Zv=t._emscripten_bind_btSliderConstraint_setUpperAngLimit_1=t.asm.emscripten_bind_btSliderConstraint_setUpperAngLimit_1).apply(null,arguments)},$v=t._emscripten_bind_btSliderConstraint_enableFeedback_1=function(){return($v=t._emscripten_bind_btSliderConstraint_enableFeedback_1=t.asm.emscripten_bind_btSliderConstraint_enableFeedback_1).apply(null,arguments)},Jv=t._emscripten_bind_btSliderConstraint_getBreakingImpulseThreshold_0=function(){return(Jv=t._emscripten_bind_btSliderConstraint_getBreakingImpulseThreshold_0=t.asm.emscripten_bind_btSliderConstraint_getBreakingImpulseThreshold_0).apply(null,arguments)},eA=t._emscripten_bind_btSliderConstraint_setBreakingImpulseThreshold_1=function(){return(eA=t._emscripten_bind_btSliderConstraint_setBreakingImpulseThreshold_1=t.asm.emscripten_bind_btSliderConstraint_setBreakingImpulseThreshold_1).apply(null,arguments)},tA=t._emscripten_bind_btSliderConstraint_getParam_2=function(){return(tA=t._emscripten_bind_btSliderConstraint_getParam_2=t.asm.emscripten_bind_btSliderConstraint_getParam_2).apply(null,arguments)},iA=t._emscripten_bind_btSliderConstraint_setParam_3=function(){return(iA=t._emscripten_bind_btSliderConstraint_setParam_3=t.asm.emscripten_bind_btSliderConstraint_setParam_3).apply(null,arguments)},nA=t._emscripten_bind_btSliderConstraint___destroy___0=function(){return(nA=t._emscripten_bind_btSliderConstraint___destroy___0=t.asm.emscripten_bind_btSliderConstraint___destroy___0).apply(null,arguments)},rA=t._emscripten_bind_btPairCachingGhostObject_btPairCachingGhostObject_0=function(){return(rA=t._emscripten_bind_btPairCachingGhostObject_btPairCachingGhostObject_0=t.asm.emscripten_bind_btPairCachingGhostObject_btPairCachingGhostObject_0).apply(null,arguments)},sA=t._emscripten_bind_btPairCachingGhostObject_setAnisotropicFriction_2=function(){return(sA=t._emscripten_bind_btPairCachingGhostObject_setAnisotropicFriction_2=t.asm.emscripten_bind_btPairCachingGhostObject_setAnisotropicFriction_2).apply(null,arguments)},oA=t._emscripten_bind_btPairCachingGhostObject_getCollisionShape_0=function(){return(oA=t._emscripten_bind_btPairCachingGhostObject_getCollisionShape_0=t.asm.emscripten_bind_btPairCachingGhostObject_getCollisionShape_0).apply(null,arguments)},aA=t._emscripten_bind_btPairCachingGhostObject_setContactProcessingThreshold_1=function(){return(aA=t._emscripten_bind_btPairCachingGhostObject_setContactProcessingThreshold_1=t.asm.emscripten_bind_btPairCachingGhostObject_setContactProcessingThreshold_1).apply(null,arguments)},lA=t._emscripten_bind_btPairCachingGhostObject_setActivationState_1=function(){return(lA=t._emscripten_bind_btPairCachingGhostObject_setActivationState_1=t.asm.emscripten_bind_btPairCachingGhostObject_setActivationState_1).apply(null,arguments)},cA=t._emscripten_bind_btPairCachingGhostObject_forceActivationState_1=function(){return(cA=t._emscripten_bind_btPairCachingGhostObject_forceActivationState_1=t.asm.emscripten_bind_btPairCachingGhostObject_forceActivationState_1).apply(null,arguments)},hA=t._emscripten_bind_btPairCachingGhostObject_activate_0=function(){return(hA=t._emscripten_bind_btPairCachingGhostObject_activate_0=t.asm.emscripten_bind_btPairCachingGhostObject_activate_0).apply(null,arguments)},_A=t._emscripten_bind_btPairCachingGhostObject_activate_1=function(){return(_A=t._emscripten_bind_btPairCachingGhostObject_activate_1=t.asm.emscripten_bind_btPairCachingGhostObject_activate_1).apply(null,arguments)},dA=t._emscripten_bind_btPairCachingGhostObject_isActive_0=function(){return(dA=t._emscripten_bind_btPairCachingGhostObject_isActive_0=t.asm.emscripten_bind_btPairCachingGhostObject_isActive_0).apply(null,arguments)},uA=t._emscripten_bind_btPairCachingGhostObject_isKinematicObject_0=function(){return(uA=t._emscripten_bind_btPairCachingGhostObject_isKinematicObject_0=t.asm.emscripten_bind_btPairCachingGhostObject_isKinematicObject_0).apply(null,arguments)},pA=t._emscripten_bind_btPairCachingGhostObject_isStaticObject_0=function(){return(pA=t._emscripten_bind_btPairCachingGhostObject_isStaticObject_0=t.asm.emscripten_bind_btPairCachingGhostObject_isStaticObject_0).apply(null,arguments)},fA=t._emscripten_bind_btPairCachingGhostObject_isStaticOrKinematicObject_0=function(){return(fA=t._emscripten_bind_btPairCachingGhostObject_isStaticOrKinematicObject_0=t.asm.emscripten_bind_btPairCachingGhostObject_isStaticOrKinematicObject_0).apply(null,arguments)},mA=t._emscripten_bind_btPairCachingGhostObject_getRestitution_0=function(){return(mA=t._emscripten_bind_btPairCachingGhostObject_getRestitution_0=t.asm.emscripten_bind_btPairCachingGhostObject_getRestitution_0).apply(null,arguments)},gA=t._emscripten_bind_btPairCachingGhostObject_getFriction_0=function(){return(gA=t._emscripten_bind_btPairCachingGhostObject_getFriction_0=t.asm.emscripten_bind_btPairCachingGhostObject_getFriction_0).apply(null,arguments)},bA=t._emscripten_bind_btPairCachingGhostObject_getRollingFriction_0=function(){return(bA=t._emscripten_bind_btPairCachingGhostObject_getRollingFriction_0=t.asm.emscripten_bind_btPairCachingGhostObject_getRollingFriction_0).apply(null,arguments)},yA=t._emscripten_bind_btPairCachingGhostObject_setRestitution_1=function(){return(yA=t._emscripten_bind_btPairCachingGhostObject_setRestitution_1=t.asm.emscripten_bind_btPairCachingGhostObject_setRestitution_1).apply(null,arguments)},vA=t._emscripten_bind_btPairCachingGhostObject_setFriction_1=function(){return(vA=t._emscripten_bind_btPairCachingGhostObject_setFriction_1=t.asm.emscripten_bind_btPairCachingGhostObject_setFriction_1).apply(null,arguments)},AA=t._emscripten_bind_btPairCachingGhostObject_setRollingFriction_1=function(){return(AA=t._emscripten_bind_btPairCachingGhostObject_setRollingFriction_1=t.asm.emscripten_bind_btPairCachingGhostObject_setRollingFriction_1).apply(null,arguments)},CA=t._emscripten_bind_btPairCachingGhostObject_getWorldTransform_0=function(){return(CA=t._emscripten_bind_btPairCachingGhostObject_getWorldTransform_0=t.asm.emscripten_bind_btPairCachingGhostObject_getWorldTransform_0).apply(null,arguments)},SA=t._emscripten_bind_btPairCachingGhostObject_getCollisionFlags_0=function(){return(SA=t._emscripten_bind_btPairCachingGhostObject_getCollisionFlags_0=t.asm.emscripten_bind_btPairCachingGhostObject_getCollisionFlags_0).apply(null,arguments)},xA=t._emscripten_bind_btPairCachingGhostObject_setCollisionFlags_1=function(){return(xA=t._emscripten_bind_btPairCachingGhostObject_setCollisionFlags_1=t.asm.emscripten_bind_btPairCachingGhostObject_setCollisionFlags_1).apply(null,arguments)},TA=t._emscripten_bind_btPairCachingGhostObject_setWorldTransform_1=function(){return(TA=t._emscripten_bind_btPairCachingGhostObject_setWorldTransform_1=t.asm.emscripten_bind_btPairCachingGhostObject_setWorldTransform_1).apply(null,arguments)},EA=t._emscripten_bind_btPairCachingGhostObject_setCollisionShape_1=function(){return(EA=t._emscripten_bind_btPairCachingGhostObject_setCollisionShape_1=t.asm.emscripten_bind_btPairCachingGhostObject_setCollisionShape_1).apply(null,arguments)},RA=t._emscripten_bind_btPairCachingGhostObject_setCcdMotionThreshold_1=function(){return(RA=t._emscripten_bind_btPairCachingGhostObject_setCcdMotionThreshold_1=t.asm.emscripten_bind_btPairCachingGhostObject_setCcdMotionThreshold_1).apply(null,arguments)},PA=t._emscripten_bind_btPairCachingGhostObject_setCcdSweptSphereRadius_1=function(){return(PA=t._emscripten_bind_btPairCachingGhostObject_setCcdSweptSphereRadius_1=t.asm.emscripten_bind_btPairCachingGhostObject_setCcdSweptSphereRadius_1).apply(null,arguments)},IA=t._emscripten_bind_btPairCachingGhostObject_getUserIndex_0=function(){return(IA=t._emscripten_bind_btPairCachingGhostObject_getUserIndex_0=t.asm.emscripten_bind_btPairCachingGhostObject_getUserIndex_0).apply(null,arguments)},MA=t._emscripten_bind_btPairCachingGhostObject_setUserIndex_1=function(){return(MA=t._emscripten_bind_btPairCachingGhostObject_setUserIndex_1=t.asm.emscripten_bind_btPairCachingGhostObject_setUserIndex_1).apply(null,arguments)},DA=t._emscripten_bind_btPairCachingGhostObject_getUserPointer_0=function(){return(DA=t._emscripten_bind_btPairCachingGhostObject_getUserPointer_0=t.asm.emscripten_bind_btPairCachingGhostObject_getUserPointer_0).apply(null,arguments)},OA=t._emscripten_bind_btPairCachingGhostObject_setUserPointer_1=function(){return(OA=t._emscripten_bind_btPairCachingGhostObject_setUserPointer_1=t.asm.emscripten_bind_btPairCachingGhostObject_setUserPointer_1).apply(null,arguments)},wA=t._emscripten_bind_btPairCachingGhostObject_getBroadphaseHandle_0=function(){return(wA=t._emscripten_bind_btPairCachingGhostObject_getBroadphaseHandle_0=t.asm.emscripten_bind_btPairCachingGhostObject_getBroadphaseHandle_0).apply(null,arguments)},FA=t._emscripten_bind_btPairCachingGhostObject_getNumOverlappingObjects_0=function(){return(FA=t._emscripten_bind_btPairCachingGhostObject_getNumOverlappingObjects_0=t.asm.emscripten_bind_btPairCachingGhostObject_getNumOverlappingObjects_0).apply(null,arguments)},BA=t._emscripten_bind_btPairCachingGhostObject_getOverlappingObject_1=function(){return(BA=t._emscripten_bind_btPairCachingGhostObject_getOverlappingObject_1=t.asm.emscripten_bind_btPairCachingGhostObject_getOverlappingObject_1).apply(null,arguments)},NA=t._emscripten_bind_btPairCachingGhostObject___destroy___0=function(){return(NA=t._emscripten_bind_btPairCachingGhostObject___destroy___0=t.asm.emscripten_bind_btPairCachingGhostObject___destroy___0).apply(null,arguments)},LA=t._emscripten_bind_btManifoldPoint_getPositionWorldOnA_0=function(){return(LA=t._emscripten_bind_btManifoldPoint_getPositionWorldOnA_0=t.asm.emscripten_bind_btManifoldPoint_getPositionWorldOnA_0).apply(null,arguments)},kA=t._emscripten_bind_btManifoldPoint_getPositionWorldOnB_0=function(){return(kA=t._emscripten_bind_btManifoldPoint_getPositionWorldOnB_0=t.asm.emscripten_bind_btManifoldPoint_getPositionWorldOnB_0).apply(null,arguments)},VA=t._emscripten_bind_btManifoldPoint_getAppliedImpulse_0=function(){return(VA=t._emscripten_bind_btManifoldPoint_getAppliedImpulse_0=t.asm.emscripten_bind_btManifoldPoint_getAppliedImpulse_0).apply(null,arguments)},UA=t._emscripten_bind_btManifoldPoint_getDistance_0=function(){return(UA=t._emscripten_bind_btManifoldPoint_getDistance_0=t.asm.emscripten_bind_btManifoldPoint_getDistance_0).apply(null,arguments)},GA=t._emscripten_bind_btManifoldPoint_get_m_localPointA_0=function(){return(GA=t._emscripten_bind_btManifoldPoint_get_m_localPointA_0=t.asm.emscripten_bind_btManifoldPoint_get_m_localPointA_0).apply(null,arguments)},jA=t._emscripten_bind_btManifoldPoint_set_m_localPointA_1=function(){return(jA=t._emscripten_bind_btManifoldPoint_set_m_localPointA_1=t.asm.emscripten_bind_btManifoldPoint_set_m_localPointA_1).apply(null,arguments)},WA=t._emscripten_bind_btManifoldPoint_get_m_localPointB_0=function(){return(WA=t._emscripten_bind_btManifoldPoint_get_m_localPointB_0=t.asm.emscripten_bind_btManifoldPoint_get_m_localPointB_0).apply(null,arguments)},zA=t._emscripten_bind_btManifoldPoint_set_m_localPointB_1=function(){return(zA=t._emscripten_bind_btManifoldPoint_set_m_localPointB_1=t.asm.emscripten_bind_btManifoldPoint_set_m_localPointB_1).apply(null,arguments)},HA=t._emscripten_bind_btManifoldPoint_get_m_positionWorldOnB_0=function(){return(HA=t._emscripten_bind_btManifoldPoint_get_m_positionWorldOnB_0=t.asm.emscripten_bind_btManifoldPoint_get_m_positionWorldOnB_0).apply(null,arguments)},XA=t._emscripten_bind_btManifoldPoint_set_m_positionWorldOnB_1=function(){return(XA=t._emscripten_bind_btManifoldPoint_set_m_positionWorldOnB_1=t.asm.emscripten_bind_btManifoldPoint_set_m_positionWorldOnB_1).apply(null,arguments)},YA=t._emscripten_bind_btManifoldPoint_get_m_positionWorldOnA_0=function(){return(YA=t._emscripten_bind_btManifoldPoint_get_m_positionWorldOnA_0=t.asm.emscripten_bind_btManifoldPoint_get_m_positionWorldOnA_0).apply(null,arguments)},QA=t._emscripten_bind_btManifoldPoint_set_m_positionWorldOnA_1=function(){return(QA=t._emscripten_bind_btManifoldPoint_set_m_positionWorldOnA_1=t.asm.emscripten_bind_btManifoldPoint_set_m_positionWorldOnA_1).apply(null,arguments)},qA=t._emscripten_bind_btManifoldPoint_get_m_normalWorldOnB_0=function(){return(qA=t._emscripten_bind_btManifoldPoint_get_m_normalWorldOnB_0=t.asm.emscripten_bind_btManifoldPoint_get_m_normalWorldOnB_0).apply(null,arguments)},KA=t._emscripten_bind_btManifoldPoint_set_m_normalWorldOnB_1=function(){return(KA=t._emscripten_bind_btManifoldPoint_set_m_normalWorldOnB_1=t.asm.emscripten_bind_btManifoldPoint_set_m_normalWorldOnB_1).apply(null,arguments)},ZA=t._emscripten_bind_btManifoldPoint_get_m_userPersistentData_0=function(){return(ZA=t._emscripten_bind_btManifoldPoint_get_m_userPersistentData_0=t.asm.emscripten_bind_btManifoldPoint_get_m_userPersistentData_0).apply(null,arguments)},$A=t._emscripten_bind_btManifoldPoint_set_m_userPersistentData_1=function(){return($A=t._emscripten_bind_btManifoldPoint_set_m_userPersistentData_1=t.asm.emscripten_bind_btManifoldPoint_set_m_userPersistentData_1).apply(null,arguments)},JA=t._emscripten_bind_btManifoldPoint___destroy___0=function(){return(JA=t._emscripten_bind_btManifoldPoint___destroy___0=t.asm.emscripten_bind_btManifoldPoint___destroy___0).apply(null,arguments)},eC=t._emscripten_bind_btPoint2PointConstraint_btPoint2PointConstraint_2=function(){return(eC=t._emscripten_bind_btPoint2PointConstraint_btPoint2PointConstraint_2=t.asm.emscripten_bind_btPoint2PointConstraint_btPoint2PointConstraint_2).apply(null,arguments)},tC=t._emscripten_bind_btPoint2PointConstraint_btPoint2PointConstraint_4=function(){return(tC=t._emscripten_bind_btPoint2PointConstraint_btPoint2PointConstraint_4=t.asm.emscripten_bind_btPoint2PointConstraint_btPoint2PointConstraint_4).apply(null,arguments)},iC=t._emscripten_bind_btPoint2PointConstraint_setPivotA_1=function(){return(iC=t._emscripten_bind_btPoint2PointConstraint_setPivotA_1=t.asm.emscripten_bind_btPoint2PointConstraint_setPivotA_1).apply(null,arguments)},nC=t._emscripten_bind_btPoint2PointConstraint_setPivotB_1=function(){return(nC=t._emscripten_bind_btPoint2PointConstraint_setPivotB_1=t.asm.emscripten_bind_btPoint2PointConstraint_setPivotB_1).apply(null,arguments)},rC=t._emscripten_bind_btPoint2PointConstraint_getPivotInA_0=function(){return(rC=t._emscripten_bind_btPoint2PointConstraint_getPivotInA_0=t.asm.emscripten_bind_btPoint2PointConstraint_getPivotInA_0).apply(null,arguments)},sC=t._emscripten_bind_btPoint2PointConstraint_getPivotInB_0=function(){return(sC=t._emscripten_bind_btPoint2PointConstraint_getPivotInB_0=t.asm.emscripten_bind_btPoint2PointConstraint_getPivotInB_0).apply(null,arguments)},oC=t._emscripten_bind_btPoint2PointConstraint_enableFeedback_1=function(){return(oC=t._emscripten_bind_btPoint2PointConstraint_enableFeedback_1=t.asm.emscripten_bind_btPoint2PointConstraint_enableFeedback_1).apply(null,arguments)},aC=t._emscripten_bind_btPoint2PointConstraint_getBreakingImpulseThreshold_0=function(){return(aC=t._emscripten_bind_btPoint2PointConstraint_getBreakingImpulseThreshold_0=t.asm.emscripten_bind_btPoint2PointConstraint_getBreakingImpulseThreshold_0).apply(null,arguments)},lC=t._emscripten_bind_btPoint2PointConstraint_setBreakingImpulseThreshold_1=function(){return(lC=t._emscripten_bind_btPoint2PointConstraint_setBreakingImpulseThreshold_1=t.asm.emscripten_bind_btPoint2PointConstraint_setBreakingImpulseThreshold_1).apply(null,arguments)},cC=t._emscripten_bind_btPoint2PointConstraint_getParam_2=function(){return(cC=t._emscripten_bind_btPoint2PointConstraint_getParam_2=t.asm.emscripten_bind_btPoint2PointConstraint_getParam_2).apply(null,arguments)},hC=t._emscripten_bind_btPoint2PointConstraint_setParam_3=function(){return(hC=t._emscripten_bind_btPoint2PointConstraint_setParam_3=t.asm.emscripten_bind_btPoint2PointConstraint_setParam_3).apply(null,arguments)},_C=t._emscripten_bind_btPoint2PointConstraint_get_m_setting_0=function(){return(_C=t._emscripten_bind_btPoint2PointConstraint_get_m_setting_0=t.asm.emscripten_bind_btPoint2PointConstraint_get_m_setting_0).apply(null,arguments)},dC=t._emscripten_bind_btPoint2PointConstraint_set_m_setting_1=function(){return(dC=t._emscripten_bind_btPoint2PointConstraint_set_m_setting_1=t.asm.emscripten_bind_btPoint2PointConstraint_set_m_setting_1).apply(null,arguments)},uC=t._emscripten_bind_btPoint2PointConstraint___destroy___0=function(){return(uC=t._emscripten_bind_btPoint2PointConstraint___destroy___0=t.asm.emscripten_bind_btPoint2PointConstraint___destroy___0).apply(null,arguments)},pC=t._emscripten_bind_btSoftBodyHelpers_btSoftBodyHelpers_0=function(){return(pC=t._emscripten_bind_btSoftBodyHelpers_btSoftBodyHelpers_0=t.asm.emscripten_bind_btSoftBodyHelpers_btSoftBodyHelpers_0).apply(null,arguments)},fC=t._emscripten_bind_btSoftBodyHelpers_CreateRope_5=function(){return(fC=t._emscripten_bind_btSoftBodyHelpers_CreateRope_5=t.asm.emscripten_bind_btSoftBodyHelpers_CreateRope_5).apply(null,arguments)},mC=t._emscripten_bind_btSoftBodyHelpers_CreatePatch_9=function(){return(mC=t._emscripten_bind_btSoftBodyHelpers_CreatePatch_9=t.asm.emscripten_bind_btSoftBodyHelpers_CreatePatch_9).apply(null,arguments)},gC=t._emscripten_bind_btSoftBodyHelpers_CreatePatchUV_10=function(){return(gC=t._emscripten_bind_btSoftBodyHelpers_CreatePatchUV_10=t.asm.emscripten_bind_btSoftBodyHelpers_CreatePatchUV_10).apply(null,arguments)},bC=t._emscripten_bind_btSoftBodyHelpers_CreateEllipsoid_4=function(){return(bC=t._emscripten_bind_btSoftBodyHelpers_CreateEllipsoid_4=t.asm.emscripten_bind_btSoftBodyHelpers_CreateEllipsoid_4).apply(null,arguments)},yC=t._emscripten_bind_btSoftBodyHelpers_CreateFromTriMesh_5=function(){return(yC=t._emscripten_bind_btSoftBodyHelpers_CreateFromTriMesh_5=t.asm.emscripten_bind_btSoftBodyHelpers_CreateFromTriMesh_5).apply(null,arguments)},vC=t._emscripten_bind_btSoftBodyHelpers_CreateFromConvexHull_4=function(){return(vC=t._emscripten_bind_btSoftBodyHelpers_CreateFromConvexHull_4=t.asm.emscripten_bind_btSoftBodyHelpers_CreateFromConvexHull_4).apply(null,arguments)},AC=t._emscripten_bind_btSoftBodyHelpers___destroy___0=function(){return(AC=t._emscripten_bind_btSoftBodyHelpers___destroy___0=t.asm.emscripten_bind_btSoftBodyHelpers___destroy___0).apply(null,arguments)},CC=t._emscripten_bind_btBroadphaseProxy_get_m_collisionFilterGroup_0=function(){return(CC=t._emscripten_bind_btBroadphaseProxy_get_m_collisionFilterGroup_0=t.asm.emscripten_bind_btBroadphaseProxy_get_m_collisionFilterGroup_0).apply(null,arguments)},SC=t._emscripten_bind_btBroadphaseProxy_set_m_collisionFilterGroup_1=function(){return(SC=t._emscripten_bind_btBroadphaseProxy_set_m_collisionFilterGroup_1=t.asm.emscripten_bind_btBroadphaseProxy_set_m_collisionFilterGroup_1).apply(null,arguments)},xC=t._emscripten_bind_btBroadphaseProxy_get_m_collisionFilterMask_0=function(){return(xC=t._emscripten_bind_btBroadphaseProxy_get_m_collisionFilterMask_0=t.asm.emscripten_bind_btBroadphaseProxy_get_m_collisionFilterMask_0).apply(null,arguments)},TC=t._emscripten_bind_btBroadphaseProxy_set_m_collisionFilterMask_1=function(){return(TC=t._emscripten_bind_btBroadphaseProxy_set_m_collisionFilterMask_1=t.asm.emscripten_bind_btBroadphaseProxy_set_m_collisionFilterMask_1).apply(null,arguments)},EC=t._emscripten_bind_btBroadphaseProxy___destroy___0=function(){return(EC=t._emscripten_bind_btBroadphaseProxy___destroy___0=t.asm.emscripten_bind_btBroadphaseProxy___destroy___0).apply(null,arguments)},RC=t._emscripten_bind_tNodeArray_size_0=function(){return(RC=t._emscripten_bind_tNodeArray_size_0=t.asm.emscripten_bind_tNodeArray_size_0).apply(null,arguments)},PC=t._emscripten_bind_tNodeArray_at_1=function(){return(PC=t._emscripten_bind_tNodeArray_at_1=t.asm.emscripten_bind_tNodeArray_at_1).apply(null,arguments)},IC=t._emscripten_bind_tNodeArray___destroy___0=function(){return(IC=t._emscripten_bind_tNodeArray___destroy___0=t.asm.emscripten_bind_tNodeArray___destroy___0).apply(null,arguments)},MC=t._emscripten_bind_btBoxShape_btBoxShape_1=function(){return(MC=t._emscripten_bind_btBoxShape_btBoxShape_1=t.asm.emscripten_bind_btBoxShape_btBoxShape_1).apply(null,arguments)},DC=t._emscripten_bind_btBoxShape_setMargin_1=function(){return(DC=t._emscripten_bind_btBoxShape_setMargin_1=t.asm.emscripten_bind_btBoxShape_setMargin_1).apply(null,arguments)},OC=t._emscripten_bind_btBoxShape_getMargin_0=function(){return(OC=t._emscripten_bind_btBoxShape_getMargin_0=t.asm.emscripten_bind_btBoxShape_getMargin_0).apply(null,arguments)},wC=t._emscripten_bind_btBoxShape_setLocalScaling_1=function(){return(wC=t._emscripten_bind_btBoxShape_setLocalScaling_1=t.asm.emscripten_bind_btBoxShape_setLocalScaling_1).apply(null,arguments)},FC=t._emscripten_bind_btBoxShape_getLocalScaling_0=function(){return(FC=t._emscripten_bind_btBoxShape_getLocalScaling_0=t.asm.emscripten_bind_btBoxShape_getLocalScaling_0).apply(null,arguments)},BC=t._emscripten_bind_btBoxShape_calculateLocalInertia_2=function(){return(BC=t._emscripten_bind_btBoxShape_calculateLocalInertia_2=t.asm.emscripten_bind_btBoxShape_calculateLocalInertia_2).apply(null,arguments)},NC=t._emscripten_bind_btBoxShape___destroy___0=function(){return(NC=t._emscripten_bind_btBoxShape___destroy___0=t.asm.emscripten_bind_btBoxShape___destroy___0).apply(null,arguments)},LC=t._emscripten_bind_btFace_get_m_indices_0=function(){return(LC=t._emscripten_bind_btFace_get_m_indices_0=t.asm.emscripten_bind_btFace_get_m_indices_0).apply(null,arguments)},kC=t._emscripten_bind_btFace_set_m_indices_1=function(){return(kC=t._emscripten_bind_btFace_set_m_indices_1=t.asm.emscripten_bind_btFace_set_m_indices_1).apply(null,arguments)},VC=t._emscripten_bind_btFace_get_m_plane_1=function(){return(VC=t._emscripten_bind_btFace_get_m_plane_1=t.asm.emscripten_bind_btFace_get_m_plane_1).apply(null,arguments)},UC=t._emscripten_bind_btFace_set_m_plane_2=function(){return(UC=t._emscripten_bind_btFace_set_m_plane_2=t.asm.emscripten_bind_btFace_set_m_plane_2).apply(null,arguments)},GC=t._emscripten_bind_btFace___destroy___0=function(){return(GC=t._emscripten_bind_btFace___destroy___0=t.asm.emscripten_bind_btFace___destroy___0).apply(null,arguments)},jC=t._emscripten_bind_DebugDrawer_DebugDrawer_0=function(){return(jC=t._emscripten_bind_DebugDrawer_DebugDrawer_0=t.asm.emscripten_bind_DebugDrawer_DebugDrawer_0).apply(null,arguments)},WC=t._emscripten_bind_DebugDrawer_drawLine_3=function(){return(WC=t._emscripten_bind_DebugDrawer_drawLine_3=t.asm.emscripten_bind_DebugDrawer_drawLine_3).apply(null,arguments)},zC=t._emscripten_bind_DebugDrawer_drawContactPoint_5=function(){return(zC=t._emscripten_bind_DebugDrawer_drawContactPoint_5=t.asm.emscripten_bind_DebugDrawer_drawContactPoint_5).apply(null,arguments)},HC=t._emscripten_bind_DebugDrawer_reportErrorWarning_1=function(){return(HC=t._emscripten_bind_DebugDrawer_reportErrorWarning_1=t.asm.emscripten_bind_DebugDrawer_reportErrorWarning_1).apply(null,arguments)},XC=t._emscripten_bind_DebugDrawer_draw3dText_2=function(){return(XC=t._emscripten_bind_DebugDrawer_draw3dText_2=t.asm.emscripten_bind_DebugDrawer_draw3dText_2).apply(null,arguments)},YC=t._emscripten_bind_DebugDrawer_setDebugMode_1=function(){return(YC=t._emscripten_bind_DebugDrawer_setDebugMode_1=t.asm.emscripten_bind_DebugDrawer_setDebugMode_1).apply(null,arguments)},QC=t._emscripten_bind_DebugDrawer_getDebugMode_0=function(){return(QC=t._emscripten_bind_DebugDrawer_getDebugMode_0=t.asm.emscripten_bind_DebugDrawer_getDebugMode_0).apply(null,arguments)},qC=t._emscripten_bind_DebugDrawer___destroy___0=function(){return(qC=t._emscripten_bind_DebugDrawer___destroy___0=t.asm.emscripten_bind_DebugDrawer___destroy___0).apply(null,arguments)},KC=t._emscripten_bind_btCapsuleShapeX_btCapsuleShapeX_2=function(){return(KC=t._emscripten_bind_btCapsuleShapeX_btCapsuleShapeX_2=t.asm.emscripten_bind_btCapsuleShapeX_btCapsuleShapeX_2).apply(null,arguments)},ZC=t._emscripten_bind_btCapsuleShapeX_setMargin_1=function(){return(ZC=t._emscripten_bind_btCapsuleShapeX_setMargin_1=t.asm.emscripten_bind_btCapsuleShapeX_setMargin_1).apply(null,arguments)},$C=t._emscripten_bind_btCapsuleShapeX_getMargin_0=function(){return($C=t._emscripten_bind_btCapsuleShapeX_getMargin_0=t.asm.emscripten_bind_btCapsuleShapeX_getMargin_0).apply(null,arguments)},JC=t._emscripten_bind_btCapsuleShapeX_getUpAxis_0=function(){return(JC=t._emscripten_bind_btCapsuleShapeX_getUpAxis_0=t.asm.emscripten_bind_btCapsuleShapeX_getUpAxis_0).apply(null,arguments)},eS=t._emscripten_bind_btCapsuleShapeX_getRadius_0=function(){return(eS=t._emscripten_bind_btCapsuleShapeX_getRadius_0=t.asm.emscripten_bind_btCapsuleShapeX_getRadius_0).apply(null,arguments)},tS=t._emscripten_bind_btCapsuleShapeX_getHalfHeight_0=function(){return(tS=t._emscripten_bind_btCapsuleShapeX_getHalfHeight_0=t.asm.emscripten_bind_btCapsuleShapeX_getHalfHeight_0).apply(null,arguments)},iS=t._emscripten_bind_btCapsuleShapeX_setLocalScaling_1=function(){return(iS=t._emscripten_bind_btCapsuleShapeX_setLocalScaling_1=t.asm.emscripten_bind_btCapsuleShapeX_setLocalScaling_1).apply(null,arguments)},nS=t._emscripten_bind_btCapsuleShapeX_getLocalScaling_0=function(){return(nS=t._emscripten_bind_btCapsuleShapeX_getLocalScaling_0=t.asm.emscripten_bind_btCapsuleShapeX_getLocalScaling_0).apply(null,arguments)},rS=t._emscripten_bind_btCapsuleShapeX_calculateLocalInertia_2=function(){return(rS=t._emscripten_bind_btCapsuleShapeX_calculateLocalInertia_2=t.asm.emscripten_bind_btCapsuleShapeX_calculateLocalInertia_2).apply(null,arguments)},sS=t._emscripten_bind_btCapsuleShapeX___destroy___0=function(){return(sS=t._emscripten_bind_btCapsuleShapeX___destroy___0=t.asm.emscripten_bind_btCapsuleShapeX___destroy___0).apply(null,arguments)},oS=t._emscripten_bind_btQuaternion_btQuaternion_4=function(){return(oS=t._emscripten_bind_btQuaternion_btQuaternion_4=t.asm.emscripten_bind_btQuaternion_btQuaternion_4).apply(null,arguments)},aS=t._emscripten_bind_btQuaternion_setValue_4=function(){return(aS=t._emscripten_bind_btQuaternion_setValue_4=t.asm.emscripten_bind_btQuaternion_setValue_4).apply(null,arguments)},lS=t._emscripten_bind_btQuaternion_setEulerZYX_3=function(){return(lS=t._emscripten_bind_btQuaternion_setEulerZYX_3=t.asm.emscripten_bind_btQuaternion_setEulerZYX_3).apply(null,arguments)},cS=t._emscripten_bind_btQuaternion_setRotation_2=function(){return(cS=t._emscripten_bind_btQuaternion_setRotation_2=t.asm.emscripten_bind_btQuaternion_setRotation_2).apply(null,arguments)},hS=t._emscripten_bind_btQuaternion_normalize_0=function(){return(hS=t._emscripten_bind_btQuaternion_normalize_0=t.asm.emscripten_bind_btQuaternion_normalize_0).apply(null,arguments)},_S=t._emscripten_bind_btQuaternion_length2_0=function(){return(_S=t._emscripten_bind_btQuaternion_length2_0=t.asm.emscripten_bind_btQuaternion_length2_0).apply(null,arguments)},dS=t._emscripten_bind_btQuaternion_length_0=function(){return(dS=t._emscripten_bind_btQuaternion_length_0=t.asm.emscripten_bind_btQuaternion_length_0).apply(null,arguments)},uS=t._emscripten_bind_btQuaternion_dot_1=function(){return(uS=t._emscripten_bind_btQuaternion_dot_1=t.asm.emscripten_bind_btQuaternion_dot_1).apply(null,arguments)},pS=t._emscripten_bind_btQuaternion_normalized_0=function(){return(pS=t._emscripten_bind_btQuaternion_normalized_0=t.asm.emscripten_bind_btQuaternion_normalized_0).apply(null,arguments)},fS=t._emscripten_bind_btQuaternion_getAxis_0=function(){return(fS=t._emscripten_bind_btQuaternion_getAxis_0=t.asm.emscripten_bind_btQuaternion_getAxis_0).apply(null,arguments)},mS=t._emscripten_bind_btQuaternion_inverse_0=function(){return(mS=t._emscripten_bind_btQuaternion_inverse_0=t.asm.emscripten_bind_btQuaternion_inverse_0).apply(null,arguments)},gS=t._emscripten_bind_btQuaternion_getAngle_0=function(){return(gS=t._emscripten_bind_btQuaternion_getAngle_0=t.asm.emscripten_bind_btQuaternion_getAngle_0).apply(null,arguments)},bS=t._emscripten_bind_btQuaternion_getAngleShortestPath_0=function(){return(bS=t._emscripten_bind_btQuaternion_getAngleShortestPath_0=t.asm.emscripten_bind_btQuaternion_getAngleShortestPath_0).apply(null,arguments)},yS=t._emscripten_bind_btQuaternion_angle_1=function(){return(yS=t._emscripten_bind_btQuaternion_angle_1=t.asm.emscripten_bind_btQuaternion_angle_1).apply(null,arguments)},vS=t._emscripten_bind_btQuaternion_angleShortestPath_1=function(){return(vS=t._emscripten_bind_btQuaternion_angleShortestPath_1=t.asm.emscripten_bind_btQuaternion_angleShortestPath_1).apply(null,arguments)},AS=t._emscripten_bind_btQuaternion_op_add_1=function(){return(AS=t._emscripten_bind_btQuaternion_op_add_1=t.asm.emscripten_bind_btQuaternion_op_add_1).apply(null,arguments)},CS=t._emscripten_bind_btQuaternion_op_sub_1=function(){return(CS=t._emscripten_bind_btQuaternion_op_sub_1=t.asm.emscripten_bind_btQuaternion_op_sub_1).apply(null,arguments)},SS=t._emscripten_bind_btQuaternion_op_mul_1=function(){return(SS=t._emscripten_bind_btQuaternion_op_mul_1=t.asm.emscripten_bind_btQuaternion_op_mul_1).apply(null,arguments)},xS=t._emscripten_bind_btQuaternion_op_mulq_1=function(){return(xS=t._emscripten_bind_btQuaternion_op_mulq_1=t.asm.emscripten_bind_btQuaternion_op_mulq_1).apply(null,arguments)},TS=t._emscripten_bind_btQuaternion_op_div_1=function(){return(TS=t._emscripten_bind_btQuaternion_op_div_1=t.asm.emscripten_bind_btQuaternion_op_div_1).apply(null,arguments)},ES=t._emscripten_bind_btQuaternion_x_0=function(){return(ES=t._emscripten_bind_btQuaternion_x_0=t.asm.emscripten_bind_btQuaternion_x_0).apply(null,arguments)},RS=t._emscripten_bind_btQuaternion_y_0=function(){return(RS=t._emscripten_bind_btQuaternion_y_0=t.asm.emscripten_bind_btQuaternion_y_0).apply(null,arguments)},PS=t._emscripten_bind_btQuaternion_z_0=function(){return(PS=t._emscripten_bind_btQuaternion_z_0=t.asm.emscripten_bind_btQuaternion_z_0).apply(null,arguments)},IS=t._emscripten_bind_btQuaternion_w_0=function(){return(IS=t._emscripten_bind_btQuaternion_w_0=t.asm.emscripten_bind_btQuaternion_w_0).apply(null,arguments)},MS=t._emscripten_bind_btQuaternion_setX_1=function(){return(MS=t._emscripten_bind_btQuaternion_setX_1=t.asm.emscripten_bind_btQuaternion_setX_1).apply(null,arguments)},DS=t._emscripten_bind_btQuaternion_setY_1=function(){return(DS=t._emscripten_bind_btQuaternion_setY_1=t.asm.emscripten_bind_btQuaternion_setY_1).apply(null,arguments)},OS=t._emscripten_bind_btQuaternion_setZ_1=function(){return(OS=t._emscripten_bind_btQuaternion_setZ_1=t.asm.emscripten_bind_btQuaternion_setZ_1).apply(null,arguments)},wS=t._emscripten_bind_btQuaternion_setW_1=function(){return(wS=t._emscripten_bind_btQuaternion_setW_1=t.asm.emscripten_bind_btQuaternion_setW_1).apply(null,arguments)},FS=t._emscripten_bind_btQuaternion___destroy___0=function(){return(FS=t._emscripten_bind_btQuaternion___destroy___0=t.asm.emscripten_bind_btQuaternion___destroy___0).apply(null,arguments)},BS=t._emscripten_bind_btCapsuleShapeZ_btCapsuleShapeZ_2=function(){return(BS=t._emscripten_bind_btCapsuleShapeZ_btCapsuleShapeZ_2=t.asm.emscripten_bind_btCapsuleShapeZ_btCapsuleShapeZ_2).apply(null,arguments)},NS=t._emscripten_bind_btCapsuleShapeZ_setMargin_1=function(){return(NS=t._emscripten_bind_btCapsuleShapeZ_setMargin_1=t.asm.emscripten_bind_btCapsuleShapeZ_setMargin_1).apply(null,arguments)},LS=t._emscripten_bind_btCapsuleShapeZ_getMargin_0=function(){return(LS=t._emscripten_bind_btCapsuleShapeZ_getMargin_0=t.asm.emscripten_bind_btCapsuleShapeZ_getMargin_0).apply(null,arguments)},kS=t._emscripten_bind_btCapsuleShapeZ_getUpAxis_0=function(){return(kS=t._emscripten_bind_btCapsuleShapeZ_getUpAxis_0=t.asm.emscripten_bind_btCapsuleShapeZ_getUpAxis_0).apply(null,arguments)},VS=t._emscripten_bind_btCapsuleShapeZ_getRadius_0=function(){return(VS=t._emscripten_bind_btCapsuleShapeZ_getRadius_0=t.asm.emscripten_bind_btCapsuleShapeZ_getRadius_0).apply(null,arguments)},US=t._emscripten_bind_btCapsuleShapeZ_getHalfHeight_0=function(){return(US=t._emscripten_bind_btCapsuleShapeZ_getHalfHeight_0=t.asm.emscripten_bind_btCapsuleShapeZ_getHalfHeight_0).apply(null,arguments)},GS=t._emscripten_bind_btCapsuleShapeZ_setLocalScaling_1=function(){return(GS=t._emscripten_bind_btCapsuleShapeZ_setLocalScaling_1=t.asm.emscripten_bind_btCapsuleShapeZ_setLocalScaling_1).apply(null,arguments)},jS=t._emscripten_bind_btCapsuleShapeZ_getLocalScaling_0=function(){return(jS=t._emscripten_bind_btCapsuleShapeZ_getLocalScaling_0=t.asm.emscripten_bind_btCapsuleShapeZ_getLocalScaling_0).apply(null,arguments)},WS=t._emscripten_bind_btCapsuleShapeZ_calculateLocalInertia_2=function(){return(WS=t._emscripten_bind_btCapsuleShapeZ_calculateLocalInertia_2=t.asm.emscripten_bind_btCapsuleShapeZ_calculateLocalInertia_2).apply(null,arguments)},zS=t._emscripten_bind_btCapsuleShapeZ___destroy___0=function(){return(zS=t._emscripten_bind_btCapsuleShapeZ___destroy___0=t.asm.emscripten_bind_btCapsuleShapeZ___destroy___0).apply(null,arguments)},HS=t._emscripten_bind_btContactSolverInfo_get_m_splitImpulse_0=function(){return(HS=t._emscripten_bind_btContactSolverInfo_get_m_splitImpulse_0=t.asm.emscripten_bind_btContactSolverInfo_get_m_splitImpulse_0).apply(null,arguments)},XS=t._emscripten_bind_btContactSolverInfo_set_m_splitImpulse_1=function(){return(XS=t._emscripten_bind_btContactSolverInfo_set_m_splitImpulse_1=t.asm.emscripten_bind_btContactSolverInfo_set_m_splitImpulse_1).apply(null,arguments)},YS=t._emscripten_bind_btContactSolverInfo_get_m_splitImpulsePenetrationThreshold_0=function(){return(YS=t._emscripten_bind_btContactSolverInfo_get_m_splitImpulsePenetrationThreshold_0=t.asm.emscripten_bind_btContactSolverInfo_get_m_splitImpulsePenetrationThreshold_0).apply(null,arguments)},QS=t._emscripten_bind_btContactSolverInfo_set_m_splitImpulsePenetrationThreshold_1=function(){return(QS=t._emscripten_bind_btContactSolverInfo_set_m_splitImpulsePenetrationThreshold_1=t.asm.emscripten_bind_btContactSolverInfo_set_m_splitImpulsePenetrationThreshold_1).apply(null,arguments)},qS=t._emscripten_bind_btContactSolverInfo_get_m_numIterations_0=function(){return(qS=t._emscripten_bind_btContactSolverInfo_get_m_numIterations_0=t.asm.emscripten_bind_btContactSolverInfo_get_m_numIterations_0).apply(null,arguments)},KS=t._emscripten_bind_btContactSolverInfo_set_m_numIterations_1=function(){return(KS=t._emscripten_bind_btContactSolverInfo_set_m_numIterations_1=t.asm.emscripten_bind_btContactSolverInfo_set_m_numIterations_1).apply(null,arguments)},ZS=t._emscripten_bind_btContactSolverInfo___destroy___0=function(){return(ZS=t._emscripten_bind_btContactSolverInfo___destroy___0=t.asm.emscripten_bind_btContactSolverInfo___destroy___0).apply(null,arguments)},$S=t._emscripten_bind_btGeneric6DofSpringConstraint_btGeneric6DofSpringConstraint_3=function(){return($S=t._emscripten_bind_btGeneric6DofSpringConstraint_btGeneric6DofSpringConstraint_3=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_btGeneric6DofSpringConstraint_3).apply(null,arguments)},JS=t._emscripten_bind_btGeneric6DofSpringConstraint_btGeneric6DofSpringConstraint_5=function(){return(JS=t._emscripten_bind_btGeneric6DofSpringConstraint_btGeneric6DofSpringConstraint_5=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_btGeneric6DofSpringConstraint_5).apply(null,arguments)},ex=t._emscripten_bind_btGeneric6DofSpringConstraint_enableSpring_2=function(){return(ex=t._emscripten_bind_btGeneric6DofSpringConstraint_enableSpring_2=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_enableSpring_2).apply(null,arguments)},tx=t._emscripten_bind_btGeneric6DofSpringConstraint_setStiffness_2=function(){return(tx=t._emscripten_bind_btGeneric6DofSpringConstraint_setStiffness_2=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setStiffness_2).apply(null,arguments)},ix=t._emscripten_bind_btGeneric6DofSpringConstraint_setDamping_2=function(){return(ix=t._emscripten_bind_btGeneric6DofSpringConstraint_setDamping_2=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setDamping_2).apply(null,arguments)},nx=t._emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_0=function(){return(nx=t._emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_0=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_0).apply(null,arguments)},rx=t._emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_1=function(){return(rx=t._emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_1=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_1).apply(null,arguments)},sx=t._emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_2=function(){return(sx=t._emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_2=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setEquilibriumPoint_2).apply(null,arguments)},ox=t._emscripten_bind_btGeneric6DofSpringConstraint_setLinearLowerLimit_1=function(){return(ox=t._emscripten_bind_btGeneric6DofSpringConstraint_setLinearLowerLimit_1=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setLinearLowerLimit_1).apply(null,arguments)},ax=t._emscripten_bind_btGeneric6DofSpringConstraint_setLinearUpperLimit_1=function(){return(ax=t._emscripten_bind_btGeneric6DofSpringConstraint_setLinearUpperLimit_1=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setLinearUpperLimit_1).apply(null,arguments)},lx=t._emscripten_bind_btGeneric6DofSpringConstraint_setAngularLowerLimit_1=function(){return(lx=t._emscripten_bind_btGeneric6DofSpringConstraint_setAngularLowerLimit_1=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setAngularLowerLimit_1).apply(null,arguments)},cx=t._emscripten_bind_btGeneric6DofSpringConstraint_setAngularUpperLimit_1=function(){return(cx=t._emscripten_bind_btGeneric6DofSpringConstraint_setAngularUpperLimit_1=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setAngularUpperLimit_1).apply(null,arguments)},hx=t._emscripten_bind_btGeneric6DofSpringConstraint_getFrameOffsetA_0=function(){return(hx=t._emscripten_bind_btGeneric6DofSpringConstraint_getFrameOffsetA_0=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_getFrameOffsetA_0).apply(null,arguments)},_x=t._emscripten_bind_btGeneric6DofSpringConstraint_enableFeedback_1=function(){return(_x=t._emscripten_bind_btGeneric6DofSpringConstraint_enableFeedback_1=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_enableFeedback_1).apply(null,arguments)},dx=t._emscripten_bind_btGeneric6DofSpringConstraint_getBreakingImpulseThreshold_0=function(){return(dx=t._emscripten_bind_btGeneric6DofSpringConstraint_getBreakingImpulseThreshold_0=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_getBreakingImpulseThreshold_0).apply(null,arguments)},ux=t._emscripten_bind_btGeneric6DofSpringConstraint_setBreakingImpulseThreshold_1=function(){return(ux=t._emscripten_bind_btGeneric6DofSpringConstraint_setBreakingImpulseThreshold_1=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setBreakingImpulseThreshold_1).apply(null,arguments)},px=t._emscripten_bind_btGeneric6DofSpringConstraint_getParam_2=function(){return(px=t._emscripten_bind_btGeneric6DofSpringConstraint_getParam_2=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_getParam_2).apply(null,arguments)},fx=t._emscripten_bind_btGeneric6DofSpringConstraint_setParam_3=function(){return(fx=t._emscripten_bind_btGeneric6DofSpringConstraint_setParam_3=t.asm.emscripten_bind_btGeneric6DofSpringConstraint_setParam_3).apply(null,arguments)},mx=t._emscripten_bind_btGeneric6DofSpringConstraint___destroy___0=function(){return(mx=t._emscripten_bind_btGeneric6DofSpringConstraint___destroy___0=t.asm.emscripten_bind_btGeneric6DofSpringConstraint___destroy___0).apply(null,arguments)},gx=t._emscripten_bind_btSphereShape_btSphereShape_1=function(){return(gx=t._emscripten_bind_btSphereShape_btSphereShape_1=t.asm.emscripten_bind_btSphereShape_btSphereShape_1).apply(null,arguments)},bx=t._emscripten_bind_btSphereShape_setMargin_1=function(){return(bx=t._emscripten_bind_btSphereShape_setMargin_1=t.asm.emscripten_bind_btSphereShape_setMargin_1).apply(null,arguments)},yx=t._emscripten_bind_btSphereShape_getMargin_0=function(){return(yx=t._emscripten_bind_btSphereShape_getMargin_0=t.asm.emscripten_bind_btSphereShape_getMargin_0).apply(null,arguments)},vx=t._emscripten_bind_btSphereShape_setLocalScaling_1=function(){return(vx=t._emscripten_bind_btSphereShape_setLocalScaling_1=t.asm.emscripten_bind_btSphereShape_setLocalScaling_1).apply(null,arguments)},Ax=t._emscripten_bind_btSphereShape_getLocalScaling_0=function(){return(Ax=t._emscripten_bind_btSphereShape_getLocalScaling_0=t.asm.emscripten_bind_btSphereShape_getLocalScaling_0).apply(null,arguments)},Cx=t._emscripten_bind_btSphereShape_calculateLocalInertia_2=function(){return(Cx=t._emscripten_bind_btSphereShape_calculateLocalInertia_2=t.asm.emscripten_bind_btSphereShape_calculateLocalInertia_2).apply(null,arguments)},Sx=t._emscripten_bind_btSphereShape___destroy___0=function(){return(Sx=t._emscripten_bind_btSphereShape___destroy___0=t.asm.emscripten_bind_btSphereShape___destroy___0).apply(null,arguments)},xx=t._emscripten_bind_Face_get_m_n_1=function(){return(xx=t._emscripten_bind_Face_get_m_n_1=t.asm.emscripten_bind_Face_get_m_n_1).apply(null,arguments)},Tx=t._emscripten_bind_Face_set_m_n_2=function(){return(Tx=t._emscripten_bind_Face_set_m_n_2=t.asm.emscripten_bind_Face_set_m_n_2).apply(null,arguments)},Ex=t._emscripten_bind_Face_get_m_normal_0=function(){return(Ex=t._emscripten_bind_Face_get_m_normal_0=t.asm.emscripten_bind_Face_get_m_normal_0).apply(null,arguments)},Rx=t._emscripten_bind_Face_set_m_normal_1=function(){return(Rx=t._emscripten_bind_Face_set_m_normal_1=t.asm.emscripten_bind_Face_set_m_normal_1).apply(null,arguments)},Px=t._emscripten_bind_Face_get_m_ra_0=function(){return(Px=t._emscripten_bind_Face_get_m_ra_0=t.asm.emscripten_bind_Face_get_m_ra_0).apply(null,arguments)},Ix=t._emscripten_bind_Face_set_m_ra_1=function(){return(Ix=t._emscripten_bind_Face_set_m_ra_1=t.asm.emscripten_bind_Face_set_m_ra_1).apply(null,arguments)},Mx=t._emscripten_bind_Face___destroy___0=function(){return(Mx=t._emscripten_bind_Face___destroy___0=t.asm.emscripten_bind_Face___destroy___0).apply(null,arguments)},Dx=t._emscripten_bind_tFaceArray_size_0=function(){return(Dx=t._emscripten_bind_tFaceArray_size_0=t.asm.emscripten_bind_tFaceArray_size_0).apply(null,arguments)},Ox=t._emscripten_bind_tFaceArray_at_1=function(){return(Ox=t._emscripten_bind_tFaceArray_at_1=t.asm.emscripten_bind_tFaceArray_at_1).apply(null,arguments)},wx=t._emscripten_bind_tFaceArray___destroy___0=function(){return(wx=t._emscripten_bind_tFaceArray___destroy___0=t.asm.emscripten_bind_tFaceArray___destroy___0).apply(null,arguments)},Fx=t._emscripten_bind_LocalConvexResult_LocalConvexResult_5=function(){return(Fx=t._emscripten_bind_LocalConvexResult_LocalConvexResult_5=t.asm.emscripten_bind_LocalConvexResult_LocalConvexResult_5).apply(null,arguments)},Bx=t._emscripten_bind_LocalConvexResult_get_m_hitCollisionObject_0=function(){return(Bx=t._emscripten_bind_LocalConvexResult_get_m_hitCollisionObject_0=t.asm.emscripten_bind_LocalConvexResult_get_m_hitCollisionObject_0).apply(null,arguments)},Nx=t._emscripten_bind_LocalConvexResult_set_m_hitCollisionObject_1=function(){return(Nx=t._emscripten_bind_LocalConvexResult_set_m_hitCollisionObject_1=t.asm.emscripten_bind_LocalConvexResult_set_m_hitCollisionObject_1).apply(null,arguments)},Lx=t._emscripten_bind_LocalConvexResult_get_m_localShapeInfo_0=function(){return(Lx=t._emscripten_bind_LocalConvexResult_get_m_localShapeInfo_0=t.asm.emscripten_bind_LocalConvexResult_get_m_localShapeInfo_0).apply(null,arguments)},kx=t._emscripten_bind_LocalConvexResult_set_m_localShapeInfo_1=function(){return(kx=t._emscripten_bind_LocalConvexResult_set_m_localShapeInfo_1=t.asm.emscripten_bind_LocalConvexResult_set_m_localShapeInfo_1).apply(null,arguments)},Vx=t._emscripten_bind_LocalConvexResult_get_m_hitNormalLocal_0=function(){return(Vx=t._emscripten_bind_LocalConvexResult_get_m_hitNormalLocal_0=t.asm.emscripten_bind_LocalConvexResult_get_m_hitNormalLocal_0).apply(null,arguments)},Ux=t._emscripten_bind_LocalConvexResult_set_m_hitNormalLocal_1=function(){return(Ux=t._emscripten_bind_LocalConvexResult_set_m_hitNormalLocal_1=t.asm.emscripten_bind_LocalConvexResult_set_m_hitNormalLocal_1).apply(null,arguments)},Gx=t._emscripten_bind_LocalConvexResult_get_m_hitPointLocal_0=function(){return(Gx=t._emscripten_bind_LocalConvexResult_get_m_hitPointLocal_0=t.asm.emscripten_bind_LocalConvexResult_get_m_hitPointLocal_0).apply(null,arguments)},jx=t._emscripten_bind_LocalConvexResult_set_m_hitPointLocal_1=function(){return(jx=t._emscripten_bind_LocalConvexResult_set_m_hitPointLocal_1=t.asm.emscripten_bind_LocalConvexResult_set_m_hitPointLocal_1).apply(null,arguments)},Wx=t._emscripten_bind_LocalConvexResult_get_m_hitFraction_0=function(){return(Wx=t._emscripten_bind_LocalConvexResult_get_m_hitFraction_0=t.asm.emscripten_bind_LocalConvexResult_get_m_hitFraction_0).apply(null,arguments)},zx=t._emscripten_bind_LocalConvexResult_set_m_hitFraction_1=function(){return(zx=t._emscripten_bind_LocalConvexResult_set_m_hitFraction_1=t.asm.emscripten_bind_LocalConvexResult_set_m_hitFraction_1).apply(null,arguments)},Hx=t._emscripten_bind_LocalConvexResult___destroy___0=function(){return(Hx=t._emscripten_bind_LocalConvexResult___destroy___0=t.asm.emscripten_bind_LocalConvexResult___destroy___0).apply(null,arguments)},Xx=t._emscripten_enum_btConstraintParams_BT_CONSTRAINT_ERP=function(){return(Xx=t._emscripten_enum_btConstraintParams_BT_CONSTRAINT_ERP=t.asm.emscripten_enum_btConstraintParams_BT_CONSTRAINT_ERP).apply(null,arguments)},Yx=t._emscripten_enum_btConstraintParams_BT_CONSTRAINT_STOP_ERP=function(){return(Yx=t._emscripten_enum_btConstraintParams_BT_CONSTRAINT_STOP_ERP=t.asm.emscripten_enum_btConstraintParams_BT_CONSTRAINT_STOP_ERP).apply(null,arguments)},Qx=t._emscripten_enum_btConstraintParams_BT_CONSTRAINT_CFM=function(){return(Qx=t._emscripten_enum_btConstraintParams_BT_CONSTRAINT_CFM=t.asm.emscripten_enum_btConstraintParams_BT_CONSTRAINT_CFM).apply(null,arguments)},qx=t._emscripten_enum_btConstraintParams_BT_CONSTRAINT_STOP_CFM=function(){return(qx=t._emscripten_enum_btConstraintParams_BT_CONSTRAINT_STOP_CFM=t.asm.emscripten_enum_btConstraintParams_BT_CONSTRAINT_STOP_CFM).apply(null,arguments)},Kx=t._emscripten_enum_PHY_ScalarType_PHY_FLOAT=function(){return(Kx=t._emscripten_enum_PHY_ScalarType_PHY_FLOAT=t.asm.emscripten_enum_PHY_ScalarType_PHY_FLOAT).apply(null,arguments)},Zx=t._emscripten_enum_PHY_ScalarType_PHY_DOUBLE=function(){return(Zx=t._emscripten_enum_PHY_ScalarType_PHY_DOUBLE=t.asm.emscripten_enum_PHY_ScalarType_PHY_DOUBLE).apply(null,arguments)},$x=t._emscripten_enum_PHY_ScalarType_PHY_INTEGER=function(){return($x=t._emscripten_enum_PHY_ScalarType_PHY_INTEGER=t.asm.emscripten_enum_PHY_ScalarType_PHY_INTEGER).apply(null,arguments)},Jx=t._emscripten_enum_PHY_ScalarType_PHY_SHORT=function(){return(Jx=t._emscripten_enum_PHY_ScalarType_PHY_SHORT=t.asm.emscripten_enum_PHY_ScalarType_PHY_SHORT).apply(null,arguments)},eT=t._emscripten_enum_PHY_ScalarType_PHY_FIXEDPOINT88=function(){return(eT=t._emscripten_enum_PHY_ScalarType_PHY_FIXEDPOINT88=t.asm.emscripten_enum_PHY_ScalarType_PHY_FIXEDPOINT88).apply(null,arguments)},tT=t._emscripten_enum_PHY_ScalarType_PHY_UCHAR=function(){return(tT=t._emscripten_enum_PHY_ScalarType_PHY_UCHAR=t.asm.emscripten_enum_PHY_ScalarType_PHY_UCHAR).apply(null,arguments)};t._malloc=function(){return(t._malloc=t.asm.malloc).apply(null,arguments)},t._free=function(){return(t._free=t.asm.free).apply(null,arguments)};var iT,nT=t.__growWasmMemory=function(){return(nT=t.__growWasmMemory=t.asm.__growWasmMemory).apply(null,arguments)};function rT(){function e(){if(!iT&&(iT=!0,t.calledRun=!0,!T)){if(G=!0,N(k),N(V),r(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;){var e=t.postRun.shift();U.unshift(e)}N(U)}}if(!(0=i);)++t;if(16(n=224==(240&n)?(15&n)<<12|r<<6|s:(7&n)<<18|r<<12|s<<6|63&I[e++])?i+=String.fromCharCode(n):(n-=65536,i+=String.fromCharCode(55296|n>>10,56320|1023&n))}}else i+=String.fromCharCode(n)}e=i}}else e="";return e},X=function e(){iT||rT(),iT||(X=e)},t.run=rT,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);0=cT?(E(0>>=0,t.BYTES_PER_ELEMENT){case 2:i>>>=1;break;case 4:i>>>=2;break;case 8:i>>>=3}for(var n=0;n=n&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++i)),127>=n?++t:t=2047>=n?t+2:65535>=n?t+3:t+4}if(i=0,0<(n=(t=Array(t+1)).length)){n=i+n-1;for(var r=0;r=s&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++r)),127>=s){if(i>=n)break;t[i++]=s}else{if(2047>=s){if(i+1>=n)break;t[i++]=192|s>>6}else{if(65535>=s){if(i+2>=n)break;t[i++]=224|s>>12}else{if(i+3>=n)break;t[i++]=240|s>>18,t[i++]=128|s>>12&63}t[i++]=128|s>>6&63}t[i++]=128|63&s}}t[i]=0}e=pT(t,P),fT(t,P,e)}return e}function gT(e){if("object"==typeof e){var t=pT(e,D);return fT(e,D,t),t}return e}function bT(){throw"cannot construct a btCollisionWorld, no constructor in IDL"}function yT(){throw"cannot construct a btCollisionShape, no constructor in IDL"}function vT(){throw"cannot construct a btCollisionObject, no constructor in IDL"}function AT(){throw"cannot construct a btDynamicsWorld, no constructor in IDL"}function CT(){throw"cannot construct a btTypedConstraint, no constructor in IDL"}function ST(){throw"cannot construct a btConcaveShape, no constructor in IDL"}function xT(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=Gt(e,t),oT(xT)[this.a]=this}function TT(){throw"cannot construct a btIDebugDraw, no constructor in IDL"}function ET(e){e&&"object"==typeof e&&(e=e.a),this.a=void 0===e?ri():si(e),oT(ET)[this.a]=this}function RT(){throw"cannot construct a btTriangleMeshShape, no constructor in IDL"}function PT(){this.a=_i(),oT(PT)[this.a]=this}function IT(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=zi(e,t),oT(IT)[this.a]=this}function MT(){throw"cannot construct a btActionInterface, no constructor in IDL"}function DT(e,t,i){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),this.a=void 0===e?Zi():void 0===t?_emscripten_bind_btVector3_btVector3_1(e):void 0===i?_emscripten_bind_btVector3_btVector3_2(e,t):$i(e,t,i),oT(DT)[this.a]=this}function OT(){throw"cannot construct a btVehicleRaycaster, no constructor in IDL"}function wT(){throw"cannot construct a btQuadWord, no constructor in IDL"}function FT(e){e&&"object"==typeof e&&(e=e.a),this.a=En(e),oT(FT)[this.a]=this}function BT(e,t,i,n){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),this.a=wn(e,t,i,n),oT(BT)[this.a]=this}function NT(){throw"cannot construct a btConvexShape, no constructor in IDL"}function LT(){throw"cannot construct a btDispatcher, no constructor in IDL"}function kT(e,t,i,n,r){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),this.a=void 0===n?Rr(e,t,i):void 0===r?_emscripten_bind_btGeneric6DofConstraint_btGeneric6DofConstraint_4(e,t,i,n):Pr(e,t,i,n,r),oT(kT)[this.a]=this}function VT(){throw"cannot construct a btStridingMeshInterface, no constructor in IDL"}function UT(){throw"cannot construct a btMotionState, no constructor in IDL"}function GT(){throw"cannot construct a ConvexResultCallback, no constructor in IDL"}function jT(){throw"cannot construct a ContactResultCallback, no constructor in IDL"}function WT(){throw"cannot construct a btSoftBodySolver, no constructor in IDL"}function zT(){throw"cannot construct a RayResultCallback, no constructor in IDL"}function HT(){throw"cannot construct a btMatrix3x3, no constructor in IDL"}function XT(){throw"cannot construct a btScalarArray, no constructor in IDL"}function YT(){throw"cannot construct a Material, no constructor in IDL"}function QT(){throw"cannot construct a btDispatcherInfo, no constructor in IDL"}function qT(){throw"cannot construct a btWheelInfoConstructionInfo, no constructor in IDL"}function KT(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=void 0===t?So(e):xo(e,t),oT(KT)[this.a]=this}function ZT(){throw"cannot construct a btBroadphaseInterface, no constructor in IDL"}function $T(e,t,i,n){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),this.a=void 0===n?wo(e,t,i):Fo(e,t,i,n),oT($T)[this.a]=this}function JT(){throw"cannot construct a btCollisionConfiguration, no constructor in IDL"}function eE(){this.a=aa(),oT(eE)[this.a]=this}function tE(e){e&&"object"==typeof e&&(e=e.a),this.a=void 0===e?ua():pa(e),oT(tE)[this.a]=this}function iE(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=Pa(e,t),oT(iE)[this.a]=this}function nE(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=Ha(e,t),oT(nE)[this.a]=this}function rE(){throw"cannot construct a tMaterialArray, no constructor in IDL"}function sE(e){e&&"object"==typeof e&&(e=e.a),this.a=gl(e),oT(sE)[this.a]=this}function oE(){this.a=vl(),oT(oE)[this.a]=this}function aE(){this.a=Tl(),oT(aE)[this.a]=this}function lE(){throw"cannot construct a LocalShapeInfo, no constructor in IDL"}function cE(e){e&&"object"==typeof e&&(e=e.a),this.a=kl(e),oT(cE)[this.a]=this}function hE(){throw"cannot construct a btIndexedMeshArray, no constructor in IDL"}function _E(){this.a=Zc(),oT(_E)[this.a]=this}function dE(e,t,i,n,r,s,o,a,l){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),s&&"object"==typeof s&&(s=s.a),o&&"object"==typeof o&&(o=o.a),a&&"object"==typeof a&&(a=a.a),l&&"object"==typeof l&&(l=l.a),this.a=Jc(e,t,i,n,r,s,o,a,l),oT(dE)[this.a]=this}function uE(){this.a=oh(),oT(uE)[this.a]=this}function pE(e){e&&"object"==typeof e&&(e=e.a),this.a=lh(e),oT(pE)[this.a]=this}function fE(e,t,i,n,r){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),this.a=void 0===i?dh(e,t):void 0===n?uh(e,t,i):void 0===r?ph(e,t,i,n):fh(e,t,i,n,r),oT(fE)[this.a]=this}function mE(){throw"cannot construct a VoidPtr, no constructor in IDL"}function gE(){this.a=bh(),oT(gE)[this.a]=this}function bE(e,t,i,n){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),this.a=void 0===i?Nh(e,t):void 0===n?_emscripten_bind_btConeTwistConstraint_btConeTwistConstraint_3(e,t,i):Lh(e,t,i,n),oT(bE)[this.a]=this}function yE(e,t,i,n,r,s,o){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),s&&"object"==typeof s&&(s=s.a),o&&"object"==typeof o&&(o=o.a),this.a=void 0===i?$h(e,t):void 0===n?Jh(e,t,i):void 0===r?e_(e,t,i,n):void 0===s?t_(e,t,i,n,r):void 0===o?i_(e,t,i,n,r,s):n_(e,t,i,n,r,s,o),oT(yE)[this.a]=this}function vE(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=g_(e,t),oT(vE)[this.a]=this}function AE(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=C_(e,t),oT(AE)[this.a]=this}function CE(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=void 0===e?R_():void 0===t?P_(e):I_(e,t),oT(CE)[this.a]=this}function SE(e,t){uT(),"object"==typeof e&&(e=gT(e)),t&&"object"==typeof t&&(t=t.a),this.a=void 0===e?L_():void 0===t?k_(e):V_(e,t),oT(SE)[this.a]=this}function xE(){this.a=$_(),oT(xE)[this.a]=this}function TE(){throw"cannot construct a btCollisionObjectWrapper, no constructor in IDL"}function EE(e){e&&"object"==typeof e&&(e=e.a),this.a=pd(e),oT(EE)[this.a]=this}function RE(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=void 0===e?yd():void 0===t?vd(e):Ad(e,t),oT(RE)[this.a]=this}function PE(e){e&&"object"==typeof e&&(e=e.a),this.a=Rd(e),oT(PE)[this.a]=this}function IE(e,t,i,n){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),this.a=void 0===e?Tu():void 0===t?_emscripten_bind_btVector4_btVector4_1(e):void 0===i?_emscripten_bind_btVector4_btVector4_2(e,t):void 0===n?_emscripten_bind_btVector4_btVector4_3(e,t,i):Eu(e,t,i,n),oT(IE)[this.a]=this}function ME(){this.a=Wu(),oT(ME)[this.a]=this}function DE(){throw"cannot construct a Anchor, no constructor in IDL"}function OE(){throw"cannot construct a btVehicleRaycasterResult, no constructor in IDL"}function wE(){throw"cannot construct a btVector3Array, no constructor in IDL"}function FE(){throw"cannot construct a btConstraintSolver, no constructor in IDL"}function BE(e,t,i){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),this.a=gp(e,t,i),oT(BE)[this.a]=this}function NE(e){e&&"object"==typeof e&&(e=e.a),this.a=qp(e),oT(NE)[this.a]=this}function LE(e){e&&"object"==typeof e&&(e=e.a),this.a=nf(e),oT(LE)[this.a]=this}function kE(){throw"cannot construct a btConvexPolyhedron, no constructor in IDL"}function VE(){this.a=ff(),oT(VE)[this.a]=this}function UE(){throw"cannot construct a tAnchorArray, no constructor in IDL"}function GE(){throw"cannot construct a RaycastInfo, no constructor in IDL"}function jE(e,t,i){uT(),e&&"object"==typeof e&&(e=e.a),"object"==typeof t&&(t=gT(t)),i&&"object"==typeof i&&(i=i.a),this.a=Uf(e,t,i),oT(jE)[this.a]=this}function WE(e,t,i,n){uT(),e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),"object"==typeof n&&(n=gT(n)),this.a=Hf(e,t,i,n),oT(WE)[this.a]=this}function zE(){throw"cannot construct a btIntArray, no constructor in IDL"}function HE(){throw"cannot construct a Config, no constructor in IDL"}function XE(){throw"cannot construct a Node, no constructor in IDL"}function YE(){this.a=fb(),oT(YE)[this.a]=this}function QE(){throw"cannot construct a btOverlappingPairCallback, no constructor in IDL"}function qE(e,t,i,n){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),this.a=void 0===n?bb(e,t,i):yb(e,t,i,n),oT(qE)[this.a]=this}function KE(){throw"cannot construct a btSoftBodyArray, no constructor in IDL"}function ZE(){throw"cannot construct a btFaceArray, no constructor in IDL"}function $E(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=Yb(e,t),oT($E)[this.a]=this}function JE(){throw"cannot construct a btOverlappingPairCache, no constructor in IDL"}function eR(){throw"cannot construct a btIndexedMesh, no constructor in IDL"}function tR(e,t,i,n,r){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),this.a=ry(e,t,i,n,r),oT(tR)[this.a]=this}function iR(e,t,i,n){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),this.a=Yy(e,t,i,n),oT(iR)[this.a]=this}function nR(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=void 0===e?ev():void 0===t?_emscripten_bind_btTransform_btTransform_1(e):tv(e,t),oT(nR)[this.a]=this}function rR(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=dv(e,t),oT(rR)[this.a]=this}function sR(e){e&&"object"==typeof e&&(e=e.a),this.a=void 0===e?Dv():Ov(e),oT(sR)[this.a]=this}function oR(){this.a=Fv(),oT(oR)[this.a]=this}function aR(e,t,i){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),this.a=void 0===i?Lv(e,t):kv(e,t,i),oT(aR)[this.a]=this}function lR(){throw"cannot construct a btConstCollisionObjectArray, no constructor in IDL"}function cR(e,t,i,n,r){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),this.a=void 0===n?Xv(e,t,i):void 0===r?_emscripten_bind_btSliderConstraint_btSliderConstraint_4(e,t,i,n):Yv(e,t,i,n,r),oT(cR)[this.a]=this}function hR(){this.a=rA(),oT(hR)[this.a]=this}function _R(){throw"cannot construct a btManifoldPoint, no constructor in IDL"}function dR(e,t,i,n){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),this.a=void 0===i?eC(e,t):void 0===n?_emscripten_bind_btPoint2PointConstraint_btPoint2PointConstraint_3(e,t,i):tC(e,t,i,n),oT(dR)[this.a]=this}function uR(){this.a=pC(),oT(uR)[this.a]=this}function pR(){throw"cannot construct a btBroadphaseProxy, no constructor in IDL"}function fR(){throw"cannot construct a tNodeArray, no constructor in IDL"}function mR(e){e&&"object"==typeof e&&(e=e.a),this.a=MC(e),oT(mR)[this.a]=this}function gR(){throw"cannot construct a btFace, no constructor in IDL"}function bR(){this.a=jC(),oT(bR)[this.a]=this}function yR(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=KC(e,t),oT(yR)[this.a]=this}function vR(e,t,i,n){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),this.a=oS(e,t,i,n),oT(vR)[this.a]=this}function AR(e,t){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),this.a=BS(e,t),oT(AR)[this.a]=this}function CR(){throw"cannot construct a btContactSolverInfo, no constructor in IDL"}function SR(e,t,i,n,r){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),this.a=void 0===n?$S(e,t,i):void 0===r?_emscripten_bind_btGeneric6DofSpringConstraint_btGeneric6DofSpringConstraint_4(e,t,i,n):JS(e,t,i,n,r),oT(SR)[this.a]=this}function xR(e){e&&"object"==typeof e&&(e=e.a),this.a=gx(e),oT(xR)[this.a]=this}function TR(){throw"cannot construct a Face, no constructor in IDL"}function ER(){throw"cannot construct a tFaceArray, no constructor in IDL"}function RR(e,t,i,n,r){e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),this.a=Fx(e,t,i,n,r),oT(RR)[this.a]=this}return bT.prototype=Object.create(sT.prototype),bT.prototype.constructor=bT,bT.prototype.b=bT,bT.c={},t.btCollisionWorld=bT,bT.prototype.getDispatcher=function(){return aT(ae(this.a),LT)},bT.prototype.rayTest=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),le(n,e,t,i)},bT.prototype.getPairCache=function(){return aT(ce(this.a),JE)},bT.prototype.getDispatchInfo=function(){return aT(he(this.a),QT)},bT.prototype.addCollisionObject=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?_e(n,e):void 0===i?de(n,e,t):ue(n,e,t,i)},bT.prototype.removeCollisionObject=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),pe(t,e)},bT.prototype.getBroadphase=function(){return aT(fe(this.a),ZT)},bT.prototype.convexSweepTest=function(e,t,i,n,r){var s=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),me(s,e,t,i,n,r)},bT.prototype.contactPairTest=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),ge(n,e,t,i)},bT.prototype.contactTest=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),be(i,e,t)},bT.prototype.updateSingleAabb=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ye(t,e)},bT.prototype.setDebugDrawer=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ve(t,e)},bT.prototype.getDebugDrawer=function(){return aT(Ae(this.a),TT)},bT.prototype.debugDrawWorld=function(){Ce(this.a)},bT.prototype.debugDrawObject=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),Se(n,e,t,i)},bT.prototype.__destroy__=function(){xe(this.a)},yT.prototype=Object.create(sT.prototype),yT.prototype.constructor=yT,yT.prototype.b=yT,yT.c={},t.btCollisionShape=yT,yT.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Te(t,e)},yT.prototype.getLocalScaling=function(){return aT(Ee(this.a),DT)},yT.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Re(i,e,t)},yT.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Pe(t,e)},yT.prototype.getMargin=function(){return Ie(this.a)},yT.prototype.__destroy__=function(){Me(this.a)},vT.prototype=Object.create(sT.prototype),vT.prototype.constructor=vT,vT.prototype.b=vT,vT.c={},t.btCollisionObject=vT,vT.prototype.setAnisotropicFriction=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),De(i,e,t)},vT.prototype.getCollisionShape=function(){return aT(Oe(this.a),yT)},vT.prototype.setContactProcessingThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),we(t,e)},vT.prototype.setActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fe(t,e)},vT.prototype.forceActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Be(t,e)},vT.prototype.activate=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),void 0===e?Ne(t):Le(t,e)},vT.prototype.isActive=function(){return!!ke(this.a)},vT.prototype.isKinematicObject=function(){return!!Ve(this.a)},vT.prototype.isStaticObject=function(){return!!Ue(this.a)},vT.prototype.isStaticOrKinematicObject=function(){return!!Ge(this.a)},vT.prototype.getRestitution=function(){return je(this.a)},vT.prototype.getFriction=function(){return We(this.a)},vT.prototype.getRollingFriction=function(){return ze(this.a)},vT.prototype.setRestitution=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),He(t,e)},vT.prototype.setFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Xe(t,e)},vT.prototype.setRollingFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ye(t,e)},vT.prototype.getWorldTransform=function(){return aT(Qe(this.a),nR)},vT.prototype.getCollisionFlags=function(){return qe(this.a)},vT.prototype.setCollisionFlags=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ke(t,e)},vT.prototype.setWorldTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ze(t,e)},vT.prototype.setCollisionShape=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$e(t,e)},vT.prototype.setCcdMotionThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Je(t,e)},vT.prototype.setCcdSweptSphereRadius=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),et(t,e)},vT.prototype.getUserIndex=function(){return tt(this.a)},vT.prototype.setUserIndex=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),it(t,e)},vT.prototype.getUserPointer=function(){return aT(nt(this.a),mE)},vT.prototype.setUserPointer=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),rt(t,e)},vT.prototype.getBroadphaseHandle=function(){return aT(st(this.a),pR)},vT.prototype.__destroy__=function(){ot(this.a)},AT.prototype=Object.create(bT.prototype),AT.prototype.constructor=AT,AT.prototype.b=AT,AT.c={},t.btDynamicsWorld=AT,AT.prototype.addAction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),at(t,e)},AT.prototype.removeAction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),lt(t,e)},AT.prototype.getSolverInfo=function(){return aT(ct(this.a),CR)},AT.prototype.setInternalTickCallback=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?ht(n,e):void 0===i?_t(n,e,t):dt(n,e,t,i)},AT.prototype.getDispatcher=function(){return aT(ut(this.a),LT)},AT.prototype.rayTest=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),pt(n,e,t,i)},AT.prototype.getPairCache=function(){return aT(ft(this.a),JE)},AT.prototype.getDispatchInfo=function(){return aT(mt(this.a),QT)},AT.prototype.addCollisionObject=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?gt(n,e):void 0===i?bt(n,e,t):yt(n,e,t,i)},AT.prototype.removeCollisionObject=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),vt(t,e)},AT.prototype.getBroadphase=function(){return aT(At(this.a),ZT)},AT.prototype.convexSweepTest=function(e,t,i,n,r){var s=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),Ct(s,e,t,i,n,r)},AT.prototype.contactPairTest=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),St(n,e,t,i)},AT.prototype.contactTest=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),xt(i,e,t)},AT.prototype.updateSingleAabb=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Tt(t,e)},AT.prototype.setDebugDrawer=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Et(t,e)},AT.prototype.getDebugDrawer=function(){return aT(Rt(this.a),TT)},AT.prototype.debugDrawWorld=function(){Pt(this.a)},AT.prototype.debugDrawObject=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),It(n,e,t,i)},AT.prototype.__destroy__=function(){Mt(this.a)},CT.prototype=Object.create(sT.prototype),CT.prototype.constructor=CT,CT.prototype.b=CT,CT.c={},t.btTypedConstraint=CT,CT.prototype.enableFeedback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Dt(t,e)},CT.prototype.getBreakingImpulseThreshold=function(){return Ot(this.a)},CT.prototype.setBreakingImpulseThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wt(t,e)},CT.prototype.getParam=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Ft(i,e,t)},CT.prototype.setParam=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),Bt(n,e,t,i)},CT.prototype.__destroy__=function(){Nt(this.a)},ST.prototype=Object.create(yT.prototype),ST.prototype.constructor=ST,ST.prototype.b=ST,ST.c={},t.btConcaveShape=ST,ST.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Lt(t,e)},ST.prototype.getLocalScaling=function(){return aT(kt(this.a),DT)},ST.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Vt(i,e,t)},ST.prototype.__destroy__=function(){Ut(this.a)},xT.prototype=Object.create(yT.prototype),xT.prototype.constructor=xT,xT.prototype.b=xT,xT.c={},t.btCapsuleShape=xT,xT.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),jt(t,e)},xT.prototype.getMargin=function(){return Wt(this.a)},xT.prototype.getUpAxis=function(){return zt(this.a)},xT.prototype.getRadius=function(){return Ht(this.a)},xT.prototype.getHalfHeight=function(){return Xt(this.a)},xT.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Yt(t,e)},xT.prototype.getLocalScaling=function(){return aT(Qt(this.a),DT)},xT.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),qt(i,e,t)},xT.prototype.__destroy__=function(){Kt(this.a)},TT.prototype=Object.create(sT.prototype),TT.prototype.constructor=TT,TT.prototype.b=TT,TT.c={},t.btIDebugDraw=TT,TT.prototype.drawLine=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),Zt(n,e,t,i)},TT.prototype.drawContactPoint=function(e,t,i,n,r){var s=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),$t(s,e,t,i,n,r)},TT.prototype.reportErrorWarning=function(e){var t=this.a;uT(),e=e&&"object"==typeof e?e.a:mT(e),Jt(t,e)},TT.prototype.draw3dText=function(e,t){var i=this.a;uT(),e&&"object"==typeof e&&(e=e.a),t=t&&"object"==typeof t?t.a:mT(t),ei(i,e,t)},TT.prototype.setDebugMode=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ti(t,e)},TT.prototype.getDebugMode=function(){return ii(this.a)},TT.prototype.__destroy__=function(){ni(this.a)},ET.prototype=Object.create(sT.prototype),ET.prototype.constructor=ET,ET.prototype.b=ET,ET.c={},t.btDefaultCollisionConfiguration=ET,ET.prototype.__destroy__=function(){oi(this.a)},RT.prototype=Object.create(ST.prototype),RT.prototype.constructor=RT,RT.prototype.b=RT,RT.c={},t.btTriangleMeshShape=RT,RT.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ai(t,e)},RT.prototype.getLocalScaling=function(){return aT(li(this.a),DT)},RT.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),ci(i,e,t)},RT.prototype.__destroy__=function(){hi(this.a)},PT.prototype=Object.create(vT.prototype),PT.prototype.constructor=PT,PT.prototype.b=PT,PT.c={},t.btGhostObject=PT,PT.prototype.getNumOverlappingObjects=function(){return di(this.a)},PT.prototype.getOverlappingObject=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(ui(t,e),vT)},PT.prototype.setAnisotropicFriction=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),pi(i,e,t)},PT.prototype.getCollisionShape=function(){return aT(fi(this.a),yT)},PT.prototype.setContactProcessingThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),mi(t,e)},PT.prototype.setActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),gi(t,e)},PT.prototype.forceActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),bi(t,e)},PT.prototype.activate=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),void 0===e?yi(t):vi(t,e)},PT.prototype.isActive=function(){return!!Ai(this.a)},PT.prototype.isKinematicObject=function(){return!!Ci(this.a)},PT.prototype.isStaticObject=function(){return!!Si(this.a)},PT.prototype.isStaticOrKinematicObject=function(){return!!xi(this.a)},PT.prototype.getRestitution=function(){return Ti(this.a)},PT.prototype.getFriction=function(){return Ei(this.a)},PT.prototype.getRollingFriction=function(){return Ri(this.a)},PT.prototype.setRestitution=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Pi(t,e)},PT.prototype.setFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ii(t,e)},PT.prototype.setRollingFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Mi(t,e)},PT.prototype.getWorldTransform=function(){return aT(Di(this.a),nR)},PT.prototype.getCollisionFlags=function(){return Oi(this.a)},PT.prototype.setCollisionFlags=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wi(t,e)},PT.prototype.setWorldTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fi(t,e)},PT.prototype.setCollisionShape=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Bi(t,e)},PT.prototype.setCcdMotionThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ni(t,e)},PT.prototype.setCcdSweptSphereRadius=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Li(t,e)},PT.prototype.getUserIndex=function(){return ki(this.a)},PT.prototype.setUserIndex=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Vi(t,e)},PT.prototype.getUserPointer=function(){return aT(Ui(this.a),mE)},PT.prototype.setUserPointer=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Gi(t,e)},PT.prototype.getBroadphaseHandle=function(){return aT(ji(this.a),pR)},PT.prototype.__destroy__=function(){Wi(this.a)},IT.prototype=Object.create(yT.prototype),IT.prototype.constructor=IT,IT.prototype.b=IT,IT.c={},t.btConeShape=IT,IT.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Hi(t,e)},IT.prototype.getLocalScaling=function(){return aT(Xi(this.a),DT)},IT.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Yi(i,e,t)},IT.prototype.__destroy__=function(){Qi(this.a)},MT.prototype=Object.create(sT.prototype),MT.prototype.constructor=MT,MT.prototype.b=MT,MT.c={},t.btActionInterface=MT,MT.prototype.updateAction=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),qi(i,e,t)},MT.prototype.__destroy__=function(){Ki(this.a)},DT.prototype=Object.create(sT.prototype),DT.prototype.constructor=DT,DT.prototype.b=DT,DT.c={},t.btVector3=DT,DT.prototype.length=DT.prototype.length=function(){return Ji(this.a)},DT.prototype.x=DT.prototype.x=function(){return en(this.a)},DT.prototype.y=DT.prototype.y=function(){return tn(this.a)},DT.prototype.z=DT.prototype.z=function(){return nn(this.a)},DT.prototype.setX=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),rn(t,e)},DT.prototype.setY=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),sn(t,e)},DT.prototype.setZ=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),on(t,e)},DT.prototype.setValue=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),an(n,e,t,i)},DT.prototype.normalize=DT.prototype.normalize=function(){ln(this.a)},DT.prototype.rotate=DT.prototype.rotate=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),aT(cn(i,e,t),DT)},DT.prototype.dot=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),hn(t,e)},DT.prototype.op_mul=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(_n(t,e),DT)},DT.prototype.op_add=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(dn(t,e),DT)},DT.prototype.op_sub=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(un(t,e),DT)},DT.prototype.__destroy__=function(){pn(this.a)},OT.prototype=Object.create(sT.prototype),OT.prototype.constructor=OT,OT.prototype.b=OT,OT.c={},t.btVehicleRaycaster=OT,OT.prototype.castRay=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),fn(n,e,t,i)},OT.prototype.__destroy__=function(){mn(this.a)},wT.prototype=Object.create(sT.prototype),wT.prototype.constructor=wT,wT.prototype.b=wT,wT.c={},t.btQuadWord=wT,wT.prototype.x=wT.prototype.x=function(){return gn(this.a)},wT.prototype.y=wT.prototype.y=function(){return bn(this.a)},wT.prototype.z=wT.prototype.z=function(){return yn(this.a)},wT.prototype.w=function(){return vn(this.a)},wT.prototype.setX=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),An(t,e)},wT.prototype.setY=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Cn(t,e)},wT.prototype.setZ=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Sn(t,e)},wT.prototype.setW=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),xn(t,e)},wT.prototype.__destroy__=function(){Tn(this.a)},FT.prototype=Object.create(yT.prototype),FT.prototype.constructor=FT,FT.prototype.b=FT,FT.c={},t.btCylinderShape=FT,FT.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Rn(t,e)},FT.prototype.getMargin=function(){return Pn(this.a)},FT.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),In(t,e)},FT.prototype.getLocalScaling=function(){return aT(Mn(this.a),DT)},FT.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Dn(i,e,t)},FT.prototype.__destroy__=function(){On(this.a)},BT.prototype=Object.create(AT.prototype),BT.prototype.constructor=BT,BT.prototype.b=BT,BT.c={},t.btDiscreteDynamicsWorld=BT,BT.prototype.setGravity=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fn(t,e)},BT.prototype.getGravity=function(){return aT(Bn(this.a),DT)},BT.prototype.addRigidBody=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?Nn(n,e):void 0===i?_emscripten_bind_btDiscreteDynamicsWorld_addRigidBody_2(n,e,t):Ln(n,e,t,i)},BT.prototype.removeRigidBody=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),kn(t,e)},BT.prototype.addConstraint=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),void 0===t?Vn(i,e):Un(i,e,t)},BT.prototype.removeConstraint=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Gn(t,e)},BT.prototype.stepSimulation=function(e,t,i){var n=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?jn(n,e):void 0===i?Wn(n,e,t):zn(n,e,t,i)},BT.prototype.setContactAddedCallback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Hn(t,e)},BT.prototype.setContactProcessedCallback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Xn(t,e)},BT.prototype.setContactDestroyedCallback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Yn(t,e)},BT.prototype.getDispatcher=function(){return aT(Qn(this.a),LT)},BT.prototype.rayTest=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),qn(n,e,t,i)},BT.prototype.getPairCache=function(){return aT(Kn(this.a),JE)},BT.prototype.getDispatchInfo=function(){return aT(Zn(this.a),QT)},BT.prototype.addCollisionObject=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?$n(n,e):void 0===i?Jn(n,e,t):er(n,e,t,i)},BT.prototype.removeCollisionObject=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),tr(t,e)},BT.prototype.getBroadphase=function(){return aT(ir(this.a),ZT)},BT.prototype.convexSweepTest=function(e,t,i,n,r){var s=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),nr(s,e,t,i,n,r)},BT.prototype.contactPairTest=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),rr(n,e,t,i)},BT.prototype.contactTest=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),sr(i,e,t)},BT.prototype.updateSingleAabb=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),or(t,e)},BT.prototype.setDebugDrawer=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ar(t,e)},BT.prototype.getDebugDrawer=function(){return aT(lr(this.a),TT)},BT.prototype.debugDrawWorld=function(){cr(this.a)},BT.prototype.debugDrawObject=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),hr(n,e,t,i)},BT.prototype.addAction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),_r(t,e)},BT.prototype.removeAction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),dr(t,e)},BT.prototype.getSolverInfo=function(){return aT(ur(this.a),CR)},BT.prototype.setInternalTickCallback=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?pr(n,e):void 0===i?fr(n,e,t):mr(n,e,t,i)},BT.prototype.__destroy__=function(){gr(this.a)},NT.prototype=Object.create(yT.prototype),NT.prototype.constructor=NT,NT.prototype.b=NT,NT.c={},t.btConvexShape=NT,NT.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),br(t,e)},NT.prototype.getLocalScaling=function(){return aT(yr(this.a),DT)},NT.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),vr(i,e,t)},NT.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ar(t,e)},NT.prototype.getMargin=function(){return Cr(this.a)},NT.prototype.__destroy__=function(){Sr(this.a)},LT.prototype=Object.create(sT.prototype),LT.prototype.constructor=LT,LT.prototype.b=LT,LT.c={},t.btDispatcher=LT,LT.prototype.getNumManifolds=function(){return xr(this.a)},LT.prototype.getManifoldByIndexInternal=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(Tr(t,e),eE)},LT.prototype.__destroy__=function(){Er(this.a)},kT.prototype=Object.create(CT.prototype),kT.prototype.constructor=kT,kT.prototype.b=kT,kT.c={},t.btGeneric6DofConstraint=kT,kT.prototype.setLinearLowerLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ir(t,e)},kT.prototype.setLinearUpperLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Mr(t,e)},kT.prototype.setAngularLowerLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Dr(t,e)},kT.prototype.setAngularUpperLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Or(t,e)},kT.prototype.getFrameOffsetA=function(){return aT(wr(this.a),nR)},kT.prototype.enableFeedback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fr(t,e)},kT.prototype.getBreakingImpulseThreshold=function(){return Br(this.a)},kT.prototype.setBreakingImpulseThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Nr(t,e)},kT.prototype.getParam=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Lr(i,e,t)},kT.prototype.setParam=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),kr(n,e,t,i)},kT.prototype.__destroy__=function(){Vr(this.a)},VT.prototype=Object.create(sT.prototype),VT.prototype.constructor=VT,VT.prototype.b=VT,VT.c={},t.btStridingMeshInterface=VT,VT.prototype.setScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ur(t,e)},VT.prototype.__destroy__=function(){Gr(this.a)},UT.prototype=Object.create(sT.prototype),UT.prototype.constructor=UT,UT.prototype.b=UT,UT.c={},t.btMotionState=UT,UT.prototype.getWorldTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),jr(t,e)},UT.prototype.setWorldTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Wr(t,e)},UT.prototype.__destroy__=function(){zr(this.a)},GT.prototype=Object.create(sT.prototype),GT.prototype.constructor=GT,GT.prototype.b=GT,GT.c={},t.ConvexResultCallback=GT,GT.prototype.hasHit=function(){return!!Hr(this.a)},GT.prototype.get_m_collisionFilterGroup=GT.prototype.f=function(){return Xr(this.a)},GT.prototype.set_m_collisionFilterGroup=GT.prototype.h=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Yr(t,e)},Object.defineProperty(GT.prototype,"m_collisionFilterGroup",{get:GT.prototype.f,set:GT.prototype.h}),GT.prototype.get_m_collisionFilterMask=GT.prototype.g=function(){return Qr(this.a)},GT.prototype.set_m_collisionFilterMask=GT.prototype.i=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),qr(t,e)},Object.defineProperty(GT.prototype,"m_collisionFilterMask",{get:GT.prototype.g,set:GT.prototype.i}),GT.prototype.get_m_closestHitFraction=GT.prototype.j=function(){return Kr(this.a)},GT.prototype.set_m_closestHitFraction=GT.prototype.l=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Zr(t,e)},Object.defineProperty(GT.prototype,"m_closestHitFraction",{get:GT.prototype.j,set:GT.prototype.l}),GT.prototype.__destroy__=function(){$r(this.a)},jT.prototype=Object.create(sT.prototype),jT.prototype.constructor=jT,jT.prototype.b=jT,jT.c={},t.ContactResultCallback=jT,jT.prototype.addSingleResult=function(e,t,i,n,r,s,o){var a=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),s&&"object"==typeof s&&(s=s.a),o&&"object"==typeof o&&(o=o.a),Jr(a,e,t,i,n,r,s,o)},jT.prototype.__destroy__=function(){es(this.a)},WT.prototype=Object.create(sT.prototype),WT.prototype.constructor=WT,WT.prototype.b=WT,WT.c={},t.btSoftBodySolver=WT,WT.prototype.__destroy__=function(){ts(this.a)},zT.prototype=Object.create(sT.prototype),zT.prototype.constructor=zT,zT.prototype.b=zT,zT.c={},t.RayResultCallback=zT,zT.prototype.hasHit=function(){return!!is(this.a)},zT.prototype.get_m_collisionFilterGroup=zT.prototype.f=function(){return ns(this.a)},zT.prototype.set_m_collisionFilterGroup=zT.prototype.h=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),rs(t,e)},Object.defineProperty(zT.prototype,"m_collisionFilterGroup",{get:zT.prototype.f,set:zT.prototype.h}),zT.prototype.get_m_collisionFilterMask=zT.prototype.g=function(){return ss(this.a)},zT.prototype.set_m_collisionFilterMask=zT.prototype.i=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),os(t,e)},Object.defineProperty(zT.prototype,"m_collisionFilterMask",{get:zT.prototype.g,set:zT.prototype.i}),zT.prototype.get_m_closestHitFraction=zT.prototype.j=function(){return as(this.a)},zT.prototype.set_m_closestHitFraction=zT.prototype.l=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ls(t,e)},Object.defineProperty(zT.prototype,"m_closestHitFraction",{get:zT.prototype.j,set:zT.prototype.l}),zT.prototype.get_m_collisionObject=zT.prototype.u=function(){return aT(cs(this.a),vT)},zT.prototype.set_m_collisionObject=zT.prototype.G=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),hs(t,e)},Object.defineProperty(zT.prototype,"m_collisionObject",{get:zT.prototype.u,set:zT.prototype.G}),zT.prototype.__destroy__=function(){_s(this.a)},HT.prototype=Object.create(sT.prototype),HT.prototype.constructor=HT,HT.prototype.b=HT,HT.c={},t.btMatrix3x3=HT,HT.prototype.setEulerZYX=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),ds(n,e,t,i)},HT.prototype.getRotation=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),us(t,e)},HT.prototype.getRow=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(ps(t,e),DT)},HT.prototype.__destroy__=function(){fs(this.a)},XT.prototype=Object.create(sT.prototype),XT.prototype.constructor=XT,XT.prototype.b=XT,XT.c={},t.btScalarArray=XT,XT.prototype.size=XT.prototype.size=function(){return ms(this.a)},XT.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),gs(t,e)},XT.prototype.__destroy__=function(){bs(this.a)},YT.prototype=Object.create(sT.prototype),YT.prototype.constructor=YT,YT.prototype.b=YT,YT.c={},t.Material=YT,YT.prototype.get_m_kLST=YT.prototype.Kb=function(){return ys(this.a)},YT.prototype.set_m_kLST=YT.prototype.ve=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),vs(t,e)},Object.defineProperty(YT.prototype,"m_kLST",{get:YT.prototype.Kb,set:YT.prototype.ve}),YT.prototype.get_m_kAST=YT.prototype.Jb=function(){return As(this.a)},YT.prototype.set_m_kAST=YT.prototype.ue=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Cs(t,e)},Object.defineProperty(YT.prototype,"m_kAST",{get:YT.prototype.Jb,set:YT.prototype.ue}),YT.prototype.get_m_kVST=YT.prototype.Lb=function(){return Ss(this.a)},YT.prototype.set_m_kVST=YT.prototype.we=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),xs(t,e)},Object.defineProperty(YT.prototype,"m_kVST",{get:YT.prototype.Lb,set:YT.prototype.we}),YT.prototype.get_m_flags=YT.prototype.rb=function(){return Ts(this.a)},YT.prototype.set_m_flags=YT.prototype.ce=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Es(t,e)},Object.defineProperty(YT.prototype,"m_flags",{get:YT.prototype.rb,set:YT.prototype.ce}),YT.prototype.__destroy__=function(){Rs(this.a)},QT.prototype=Object.create(sT.prototype),QT.prototype.constructor=QT,QT.prototype.b=QT,QT.c={},t.btDispatcherInfo=QT,QT.prototype.get_m_timeStep=QT.prototype.zc=function(){return Ps(this.a)},QT.prototype.set_m_timeStep=QT.prototype.kf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Is(t,e)},Object.defineProperty(QT.prototype,"m_timeStep",{get:QT.prototype.zc,set:QT.prototype.kf}),QT.prototype.get_m_stepCount=QT.prototype.qc=function(){return Ms(this.a)},QT.prototype.set_m_stepCount=QT.prototype.af=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ds(t,e)},Object.defineProperty(QT.prototype,"m_stepCount",{get:QT.prototype.qc,set:QT.prototype.af}),QT.prototype.get_m_dispatchFunc=QT.prototype.kb=function(){return Os(this.a)},QT.prototype.set_m_dispatchFunc=QT.prototype.Wd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ws(t,e)},Object.defineProperty(QT.prototype,"m_dispatchFunc",{get:QT.prototype.kb,set:QT.prototype.Wd}),QT.prototype.get_m_timeOfImpact=QT.prototype.yc=function(){return Fs(this.a)},QT.prototype.set_m_timeOfImpact=QT.prototype.jf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Bs(t,e)},Object.defineProperty(QT.prototype,"m_timeOfImpact",{get:QT.prototype.yc,set:QT.prototype.jf}),QT.prototype.get_m_useContinuous=QT.prototype.Bc=function(){return!!Ns(this.a)},QT.prototype.set_m_useContinuous=QT.prototype.mf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ls(t,e)},Object.defineProperty(QT.prototype,"m_useContinuous",{get:QT.prototype.Bc,set:QT.prototype.mf}),QT.prototype.get_m_enableSatConvex=QT.prototype.ob=function(){return!!ks(this.a)},QT.prototype.set_m_enableSatConvex=QT.prototype.$d=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Vs(t,e)},Object.defineProperty(QT.prototype,"m_enableSatConvex",{get:QT.prototype.ob,set:QT.prototype.$d}),QT.prototype.get_m_enableSPU=QT.prototype.nb=function(){return!!Us(this.a)},QT.prototype.set_m_enableSPU=QT.prototype.Zd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Gs(t,e)},Object.defineProperty(QT.prototype,"m_enableSPU",{get:QT.prototype.nb,set:QT.prototype.Zd}),QT.prototype.get_m_useEpa=QT.prototype.Dc=function(){return!!js(this.a)},QT.prototype.set_m_useEpa=QT.prototype.pf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ws(t,e)},Object.defineProperty(QT.prototype,"m_useEpa",{get:QT.prototype.Dc,set:QT.prototype.pf}),QT.prototype.get_m_allowedCcdPenetration=QT.prototype.Na=function(){return zs(this.a)},QT.prototype.set_m_allowedCcdPenetration=QT.prototype.zd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Hs(t,e)},Object.defineProperty(QT.prototype,"m_allowedCcdPenetration",{get:QT.prototype.Na,set:QT.prototype.zd}),QT.prototype.get_m_useConvexConservativeDistanceUtil=QT.prototype.Cc=function(){return!!Xs(this.a)},QT.prototype.set_m_useConvexConservativeDistanceUtil=QT.prototype.nf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ys(t,e)},Object.defineProperty(QT.prototype,"m_useConvexConservativeDistanceUtil",{get:QT.prototype.Cc,set:QT.prototype.nf}),QT.prototype.get_m_convexConservativeDistanceThreshold=QT.prototype.fb=function(){return Qs(this.a)},QT.prototype.set_m_convexConservativeDistanceThreshold=QT.prototype.Rd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),qs(t,e)},Object.defineProperty(QT.prototype,"m_convexConservativeDistanceThreshold",{get:QT.prototype.fb,set:QT.prototype.Rd}),QT.prototype.__destroy__=function(){Ks(this.a)},qT.prototype=Object.create(sT.prototype),qT.prototype.constructor=qT,qT.prototype.b=qT,qT.c={},t.btWheelInfoConstructionInfo=qT,qT.prototype.get_m_chassisConnectionCS=qT.prototype.Za=function(){return aT(Zs(this.a),DT)},qT.prototype.set_m_chassisConnectionCS=qT.prototype.Ld=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$s(t,e)},Object.defineProperty(qT.prototype,"m_chassisConnectionCS",{get:qT.prototype.Za,set:qT.prototype.Ld}),qT.prototype.get_m_wheelDirectionCS=qT.prototype.V=function(){return aT(Js(this.a),DT)},qT.prototype.set_m_wheelDirectionCS=qT.prototype.fa=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),eo(t,e)},Object.defineProperty(qT.prototype,"m_wheelDirectionCS",{get:qT.prototype.V,set:qT.prototype.fa}),qT.prototype.get_m_wheelAxleCS=qT.prototype.U=function(){return aT(to(this.a),DT)},qT.prototype.set_m_wheelAxleCS=qT.prototype.ea=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),io(t,e)},Object.defineProperty(qT.prototype,"m_wheelAxleCS",{get:qT.prototype.U,set:qT.prototype.ea}),qT.prototype.get_m_suspensionRestLength=qT.prototype.vc=function(){return no(this.a)},qT.prototype.set_m_suspensionRestLength=qT.prototype.ff=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ro(t,e)},Object.defineProperty(qT.prototype,"m_suspensionRestLength",{get:qT.prototype.vc,set:qT.prototype.ff}),qT.prototype.get_m_maxSuspensionTravelCm=qT.prototype.D=function(){return so(this.a)},qT.prototype.set_m_maxSuspensionTravelCm=qT.prototype.L=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),oo(t,e)},Object.defineProperty(qT.prototype,"m_maxSuspensionTravelCm",{get:qT.prototype.D,set:qT.prototype.L}),qT.prototype.get_m_wheelRadius=qT.prototype.Jc=function(){return ao(this.a)},qT.prototype.set_m_wheelRadius=qT.prototype.vf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),lo(t,e)},Object.defineProperty(qT.prototype,"m_wheelRadius",{get:qT.prototype.Jc,set:qT.prototype.vf}),qT.prototype.get_m_suspensionStiffness=qT.prototype.F=function(){return co(this.a)},qT.prototype.set_m_suspensionStiffness=qT.prototype.M=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ho(t,e)},Object.defineProperty(qT.prototype,"m_suspensionStiffness",{get:qT.prototype.F,set:qT.prototype.M}),qT.prototype.get_m_wheelsDampingCompression=qT.prototype.W=function(){return _o(this.a)},qT.prototype.set_m_wheelsDampingCompression=qT.prototype.ga=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),uo(t,e)},Object.defineProperty(qT.prototype,"m_wheelsDampingCompression",{get:qT.prototype.W,set:qT.prototype.ga}),qT.prototype.get_m_wheelsDampingRelaxation=qT.prototype.X=function(){return po(this.a)},qT.prototype.set_m_wheelsDampingRelaxation=qT.prototype.ha=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),fo(t,e)},Object.defineProperty(qT.prototype,"m_wheelsDampingRelaxation",{get:qT.prototype.X,set:qT.prototype.ha}),qT.prototype.get_m_frictionSlip=qT.prototype.v=function(){return mo(this.a)},qT.prototype.set_m_frictionSlip=qT.prototype.H=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),go(t,e)},Object.defineProperty(qT.prototype,"m_frictionSlip",{get:qT.prototype.v,set:qT.prototype.H}),qT.prototype.get_m_maxSuspensionForce=qT.prototype.C=function(){return bo(this.a)},qT.prototype.set_m_maxSuspensionForce=qT.prototype.K=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),yo(t,e)},Object.defineProperty(qT.prototype,"m_maxSuspensionForce",{get:qT.prototype.C,set:qT.prototype.K}),qT.prototype.get_m_bIsFrontWheel=qT.prototype.O=function(){return!!vo(this.a)},qT.prototype.set_m_bIsFrontWheel=qT.prototype.Z=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ao(t,e)},Object.defineProperty(qT.prototype,"m_bIsFrontWheel",{get:qT.prototype.O,set:qT.prototype.Z}),qT.prototype.__destroy__=function(){Co(this.a)},KT.prototype=Object.create(NT.prototype),KT.prototype.constructor=KT,KT.prototype.b=KT,KT.c={},t.btConvexTriangleMeshShape=KT,KT.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),To(t,e)},KT.prototype.getLocalScaling=function(){return aT(Eo(this.a),DT)},KT.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Ro(i,e,t)},KT.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Po(t,e)},KT.prototype.getMargin=function(){return Io(this.a)},KT.prototype.__destroy__=function(){Mo(this.a)},ZT.prototype=Object.create(sT.prototype),ZT.prototype.constructor=ZT,ZT.prototype.b=ZT,ZT.c={},t.btBroadphaseInterface=ZT,ZT.prototype.getOverlappingPairCache=function(){return aT(Do(this.a),JE)},ZT.prototype.__destroy__=function(){Oo(this.a)},$T.prototype=Object.create(sT.prototype),$T.prototype.constructor=$T,$T.prototype.b=$T,$T.c={},t.btRigidBodyConstructionInfo=$T,$T.prototype.get_m_linearDamping=$T.prototype.Mb=function(){return Bo(this.a)},$T.prototype.set_m_linearDamping=$T.prototype.xe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),No(t,e)},Object.defineProperty($T.prototype,"m_linearDamping",{get:$T.prototype.Mb,set:$T.prototype.xe}),$T.prototype.get_m_angularDamping=$T.prototype.Pa=function(){return Lo(this.a)},$T.prototype.set_m_angularDamping=$T.prototype.Bd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ko(t,e)},Object.defineProperty($T.prototype,"m_angularDamping",{get:$T.prototype.Pa,set:$T.prototype.Bd}),$T.prototype.get_m_friction=$T.prototype.sb=function(){return Vo(this.a)},$T.prototype.set_m_friction=$T.prototype.de=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Uo(t,e)},Object.defineProperty($T.prototype,"m_friction",{get:$T.prototype.sb,set:$T.prototype.de}),$T.prototype.get_m_rollingFriction=$T.prototype.ic=function(){return Go(this.a)},$T.prototype.set_m_rollingFriction=$T.prototype.Te=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),jo(t,e)},Object.defineProperty($T.prototype,"m_rollingFriction",{get:$T.prototype.ic,set:$T.prototype.Te}),$T.prototype.get_m_restitution=$T.prototype.fc=function(){return Wo(this.a)},$T.prototype.set_m_restitution=$T.prototype.Re=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),zo(t,e)},Object.defineProperty($T.prototype,"m_restitution",{get:$T.prototype.fc,set:$T.prototype.Re}),$T.prototype.get_m_linearSleepingThreshold=$T.prototype.Nb=function(){return Ho(this.a)},$T.prototype.set_m_linearSleepingThreshold=$T.prototype.ye=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Xo(t,e)},Object.defineProperty($T.prototype,"m_linearSleepingThreshold",{get:$T.prototype.Nb,set:$T.prototype.ye}),$T.prototype.get_m_angularSleepingThreshold=$T.prototype.Qa=function(){return Yo(this.a)},$T.prototype.set_m_angularSleepingThreshold=$T.prototype.Cd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Qo(t,e)},Object.defineProperty($T.prototype,"m_angularSleepingThreshold",{get:$T.prototype.Qa,set:$T.prototype.Cd}),$T.prototype.get_m_additionalDamping=$T.prototype.Ka=function(){return!!qo(this.a)},$T.prototype.set_m_additionalDamping=$T.prototype.wd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ko(t,e)},Object.defineProperty($T.prototype,"m_additionalDamping",{get:$T.prototype.Ka,set:$T.prototype.wd}),$T.prototype.get_m_additionalDampingFactor=$T.prototype.La=function(){return Zo(this.a)},$T.prototype.set_m_additionalDampingFactor=$T.prototype.xd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$o(t,e)},Object.defineProperty($T.prototype,"m_additionalDampingFactor",{get:$T.prototype.La,set:$T.prototype.xd}),$T.prototype.get_m_additionalLinearDampingThresholdSqr=$T.prototype.Ma=function(){return Jo(this.a)},$T.prototype.set_m_additionalLinearDampingThresholdSqr=$T.prototype.yd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ea(t,e)},Object.defineProperty($T.prototype,"m_additionalLinearDampingThresholdSqr",{get:$T.prototype.Ma,set:$T.prototype.yd}),$T.prototype.get_m_additionalAngularDampingThresholdSqr=$T.prototype.Ja=function(){return ta(this.a)},$T.prototype.set_m_additionalAngularDampingThresholdSqr=$T.prototype.vd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ia(t,e)},Object.defineProperty($T.prototype,"m_additionalAngularDampingThresholdSqr",{get:$T.prototype.Ja,set:$T.prototype.vd}),$T.prototype.get_m_additionalAngularDampingFactor=$T.prototype.Ia=function(){return na(this.a)},$T.prototype.set_m_additionalAngularDampingFactor=$T.prototype.ud=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ra(t,e)},Object.defineProperty($T.prototype,"m_additionalAngularDampingFactor",{get:$T.prototype.Ia,set:$T.prototype.ud}),$T.prototype.__destroy__=function(){sa(this.a)},JT.prototype=Object.create(sT.prototype),JT.prototype.constructor=JT,JT.prototype.b=JT,JT.c={},t.btCollisionConfiguration=JT,JT.prototype.__destroy__=function(){oa(this.a)},eE.prototype=Object.create(sT.prototype),eE.prototype.constructor=eE,eE.prototype.b=eE,eE.c={},t.btPersistentManifold=eE,eE.prototype.getBody0=function(){return aT(la(this.a),vT)},eE.prototype.getBody1=function(){return aT(ca(this.a),vT)},eE.prototype.getNumContacts=function(){return ha(this.a)},eE.prototype.getContactPoint=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(_a(t,e),_R)},eE.prototype.__destroy__=function(){da(this.a)},tE.prototype=Object.create(yT.prototype),tE.prototype.constructor=tE,tE.prototype.b=tE,tE.c={},t.btCompoundShape=tE,tE.prototype.addChildShape=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),fa(i,e,t)},tE.prototype.removeChildShape=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ma(t,e)},tE.prototype.removeChildShapeByIndex=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ga(t,e)},tE.prototype.getNumChildShapes=function(){return ba(this.a)},tE.prototype.getChildShape=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(ya(t,e),yT)},tE.prototype.updateChildTransform=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===i?va(n,e,t):Aa(n,e,t,i)},tE.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ca(t,e)},tE.prototype.getMargin=function(){return Sa(this.a)},tE.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),xa(t,e)},tE.prototype.getLocalScaling=function(){return aT(Ta(this.a),DT)},tE.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Ea(i,e,t)},tE.prototype.__destroy__=function(){Ra(this.a)},iE.prototype=Object.create(GT.prototype),iE.prototype.constructor=iE,iE.prototype.b=iE,iE.c={},t.ClosestConvexResultCallback=iE,iE.prototype.hasHit=function(){return!!Ia(this.a)},iE.prototype.get_m_convexFromWorld=iE.prototype.gb=function(){return aT(Ma(this.a),DT)},iE.prototype.set_m_convexFromWorld=iE.prototype.Sd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Da(t,e)},Object.defineProperty(iE.prototype,"m_convexFromWorld",{get:iE.prototype.gb,set:iE.prototype.Sd}),iE.prototype.get_m_convexToWorld=iE.prototype.hb=function(){return aT(Oa(this.a),DT)},iE.prototype.set_m_convexToWorld=iE.prototype.Td=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wa(t,e)},Object.defineProperty(iE.prototype,"m_convexToWorld",{get:iE.prototype.hb,set:iE.prototype.Td}),iE.prototype.get_m_hitNormalWorld=iE.prototype.A=function(){return aT(Fa(this.a),DT)},iE.prototype.set_m_hitNormalWorld=iE.prototype.I=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ba(t,e)},Object.defineProperty(iE.prototype,"m_hitNormalWorld",{get:iE.prototype.A,set:iE.prototype.I}),iE.prototype.get_m_hitPointWorld=iE.prototype.B=function(){return aT(Na(this.a),DT)},iE.prototype.set_m_hitPointWorld=iE.prototype.J=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),La(t,e)},Object.defineProperty(iE.prototype,"m_hitPointWorld",{get:iE.prototype.B,set:iE.prototype.J}),iE.prototype.get_m_collisionFilterGroup=iE.prototype.f=function(){return ka(this.a)},iE.prototype.set_m_collisionFilterGroup=iE.prototype.h=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Va(t,e)},Object.defineProperty(iE.prototype,"m_collisionFilterGroup",{get:iE.prototype.f,set:iE.prototype.h}),iE.prototype.get_m_collisionFilterMask=iE.prototype.g=function(){return Ua(this.a)},iE.prototype.set_m_collisionFilterMask=iE.prototype.i=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ga(t,e)},Object.defineProperty(iE.prototype,"m_collisionFilterMask",{get:iE.prototype.g,set:iE.prototype.i}),iE.prototype.get_m_closestHitFraction=iE.prototype.j=function(){return ja(this.a)},iE.prototype.set_m_closestHitFraction=iE.prototype.l=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Wa(t,e)},Object.defineProperty(iE.prototype,"m_closestHitFraction",{get:iE.prototype.j,set:iE.prototype.l}),iE.prototype.__destroy__=function(){za(this.a)},nE.prototype=Object.create(zT.prototype),nE.prototype.constructor=nE,nE.prototype.b=nE,nE.c={},t.AllHitsRayResultCallback=nE,nE.prototype.hasHit=function(){return!!Xa(this.a)},nE.prototype.get_m_collisionObjects=nE.prototype.bb=function(){return aT(Ya(this.a),lR)},nE.prototype.set_m_collisionObjects=nE.prototype.Od=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Qa(t,e)},Object.defineProperty(nE.prototype,"m_collisionObjects",{get:nE.prototype.bb,set:nE.prototype.Od}),nE.prototype.get_m_rayFromWorld=nE.prototype.S=function(){return aT(qa(this.a),DT)},nE.prototype.set_m_rayFromWorld=nE.prototype.ba=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ka(t,e)},Object.defineProperty(nE.prototype,"m_rayFromWorld",{get:nE.prototype.S,set:nE.prototype.ba}),nE.prototype.get_m_rayToWorld=nE.prototype.T=function(){return aT(Za(this.a),DT)},nE.prototype.set_m_rayToWorld=nE.prototype.da=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$a(t,e)},Object.defineProperty(nE.prototype,"m_rayToWorld",{get:nE.prototype.T,set:nE.prototype.da}),nE.prototype.get_m_hitNormalWorld=nE.prototype.A=function(){return aT(Ja(this.a),wE)},nE.prototype.set_m_hitNormalWorld=nE.prototype.I=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),el(t,e)},Object.defineProperty(nE.prototype,"m_hitNormalWorld",{get:nE.prototype.A,set:nE.prototype.I}),nE.prototype.get_m_hitPointWorld=nE.prototype.B=function(){return aT(tl(this.a),wE)},nE.prototype.set_m_hitPointWorld=nE.prototype.J=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),il(t,e)},Object.defineProperty(nE.prototype,"m_hitPointWorld",{get:nE.prototype.B,set:nE.prototype.J}),nE.prototype.get_m_hitFractions=nE.prototype.zb=function(){return aT(nl(this.a),XT)},nE.prototype.set_m_hitFractions=nE.prototype.ke=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),rl(t,e)},Object.defineProperty(nE.prototype,"m_hitFractions",{get:nE.prototype.zb,set:nE.prototype.ke}),nE.prototype.get_m_collisionFilterGroup=nE.prototype.f=function(){return sl(this.a)},nE.prototype.set_m_collisionFilterGroup=nE.prototype.h=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ol(t,e)},Object.defineProperty(nE.prototype,"m_collisionFilterGroup",{get:nE.prototype.f,set:nE.prototype.h}),nE.prototype.get_m_collisionFilterMask=nE.prototype.g=function(){return al(this.a)},nE.prototype.set_m_collisionFilterMask=nE.prototype.i=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ll(t,e)},Object.defineProperty(nE.prototype,"m_collisionFilterMask",{get:nE.prototype.g,set:nE.prototype.i}),nE.prototype.get_m_closestHitFraction=nE.prototype.j=function(){return cl(this.a)},nE.prototype.set_m_closestHitFraction=nE.prototype.l=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),hl(t,e)},Object.defineProperty(nE.prototype,"m_closestHitFraction",{get:nE.prototype.j,set:nE.prototype.l}),nE.prototype.get_m_collisionObject=nE.prototype.u=function(){return aT(_l(this.a),vT)},nE.prototype.set_m_collisionObject=nE.prototype.G=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),dl(t,e)},Object.defineProperty(nE.prototype,"m_collisionObject",{get:nE.prototype.u,set:nE.prototype.G}),nE.prototype.__destroy__=function(){ul(this.a)},rE.prototype=Object.create(sT.prototype),rE.prototype.constructor=rE,rE.prototype.b=rE,rE.c={},t.tMaterialArray=rE,rE.prototype.size=rE.prototype.size=function(){return pl(this.a)},rE.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(fl(t,e),YT)},rE.prototype.__destroy__=function(){ml(this.a)},sE.prototype=Object.create(OT.prototype),sE.prototype.constructor=sE,sE.prototype.b=sE,sE.c={},t.btDefaultVehicleRaycaster=sE,sE.prototype.castRay=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),bl(n,e,t,i)},sE.prototype.__destroy__=function(){yl(this.a)},oE.prototype=Object.create(ST.prototype),oE.prototype.constructor=oE,oE.prototype.b=oE,oE.c={},t.btEmptyShape=oE,oE.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Al(t,e)},oE.prototype.getLocalScaling=function(){return aT(Cl(this.a),DT)},oE.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Sl(i,e,t)},oE.prototype.__destroy__=function(){xl(this.a)},aE.prototype=Object.create(sT.prototype),aE.prototype.constructor=aE,aE.prototype.b=aE,aE.c={},t.btConstraintSetting=aE,aE.prototype.get_m_tau=aE.prototype.xc=function(){return El(this.a)},aE.prototype.set_m_tau=aE.prototype.hf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Rl(t,e)},Object.defineProperty(aE.prototype,"m_tau",{get:aE.prototype.xc,set:aE.prototype.hf}),aE.prototype.get_m_damping=aE.prototype.ib=function(){return Pl(this.a)},aE.prototype.set_m_damping=aE.prototype.Ud=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Il(t,e)},Object.defineProperty(aE.prototype,"m_damping",{get:aE.prototype.ib,set:aE.prototype.Ud}),aE.prototype.get_m_impulseClamp=aE.prototype.Fb=function(){return Ml(this.a)},aE.prototype.set_m_impulseClamp=aE.prototype.qe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Dl(t,e)},Object.defineProperty(aE.prototype,"m_impulseClamp",{get:aE.prototype.Fb,set:aE.prototype.qe}),aE.prototype.__destroy__=function(){Ol(this.a)},lE.prototype=Object.create(sT.prototype),lE.prototype.constructor=lE,lE.prototype.b=lE,lE.c={},t.LocalShapeInfo=lE,lE.prototype.get_m_shapePart=lE.prototype.lc=function(){return wl(this.a)},lE.prototype.set_m_shapePart=lE.prototype.We=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fl(t,e)},Object.defineProperty(lE.prototype,"m_shapePart",{get:lE.prototype.lc,set:lE.prototype.We}),lE.prototype.get_m_triangleIndex=lE.prototype.Ac=function(){return Bl(this.a)},lE.prototype.set_m_triangleIndex=lE.prototype.lf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Nl(t,e)},Object.defineProperty(lE.prototype,"m_triangleIndex",{get:lE.prototype.Ac,set:lE.prototype.lf}),lE.prototype.__destroy__=function(){Ll(this.a)},cE.prototype=Object.create(vT.prototype),cE.prototype.constructor=cE,cE.prototype.b=cE,cE.c={},t.btRigidBody=cE,cE.prototype.getCenterOfMassTransform=function(){return aT(Vl(this.a),nR)},cE.prototype.setCenterOfMassTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ul(t,e)},cE.prototype.setSleepingThresholds=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Gl(i,e,t)},cE.prototype.getLinearDamping=function(){return jl(this.a)},cE.prototype.getAngularDamping=function(){return Wl(this.a)},cE.prototype.setDamping=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),zl(i,e,t)},cE.prototype.setMassProps=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Hl(i,e,t)},cE.prototype.getLinearFactor=function(){return aT(Xl(this.a),DT)},cE.prototype.setLinearFactor=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Yl(t,e)},cE.prototype.applyTorque=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ql(t,e)},cE.prototype.applyLocalTorque=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ql(t,e)},cE.prototype.applyForce=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Kl(i,e,t)},cE.prototype.applyCentralForce=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Zl(t,e)},cE.prototype.applyCentralLocalForce=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$l(t,e)},cE.prototype.applyTorqueImpulse=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Jl(t,e)},cE.prototype.applyImpulse=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),ec(i,e,t)},cE.prototype.applyCentralImpulse=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),tc(t,e)},cE.prototype.updateInertiaTensor=function(){ic(this.a)},cE.prototype.getLinearVelocity=function(){return aT(nc(this.a),DT)},cE.prototype.getAngularVelocity=function(){return aT(rc(this.a),DT)},cE.prototype.setLinearVelocity=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),sc(t,e)},cE.prototype.setAngularVelocity=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),oc(t,e)},cE.prototype.getMotionState=function(){return aT(ac(this.a),UT)},cE.prototype.setMotionState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),lc(t,e)},cE.prototype.getAngularFactor=function(){return aT(cc(this.a),DT)},cE.prototype.setAngularFactor=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),hc(t,e)},cE.prototype.upcast=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(_c(t,e),cE)},cE.prototype.getAabb=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),dc(i,e,t)},cE.prototype.applyGravity=function(){uc(this.a)},cE.prototype.getGravity=function(){return aT(pc(this.a),DT)},cE.prototype.setGravity=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),fc(t,e)},cE.prototype.getBroadphaseProxy=function(){return aT(mc(this.a),pR)},cE.prototype.clearForces=function(){gc(this.a)},cE.prototype.setAnisotropicFriction=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),bc(i,e,t)},cE.prototype.getCollisionShape=function(){return aT(yc(this.a),yT)},cE.prototype.setContactProcessingThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),vc(t,e)},cE.prototype.setActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ac(t,e)},cE.prototype.forceActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Cc(t,e)},cE.prototype.activate=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),void 0===e?Sc(t):xc(t,e)},cE.prototype.isActive=function(){return!!Tc(this.a)},cE.prototype.isKinematicObject=function(){return!!Ec(this.a)},cE.prototype.isStaticObject=function(){return!!Rc(this.a)},cE.prototype.isStaticOrKinematicObject=function(){return!!Pc(this.a)},cE.prototype.getRestitution=function(){return Ic(this.a)},cE.prototype.getFriction=function(){return Mc(this.a)},cE.prototype.getRollingFriction=function(){return Dc(this.a)},cE.prototype.setRestitution=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Oc(t,e)},cE.prototype.setFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wc(t,e)},cE.prototype.setRollingFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fc(t,e)},cE.prototype.getWorldTransform=function(){return aT(Bc(this.a),nR)},cE.prototype.getCollisionFlags=function(){return Nc(this.a)},cE.prototype.setCollisionFlags=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Lc(t,e)},cE.prototype.setWorldTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),kc(t,e)},cE.prototype.setCollisionShape=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Vc(t,e)},cE.prototype.setCcdMotionThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Uc(t,e)},cE.prototype.setCcdSweptSphereRadius=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Gc(t,e)},cE.prototype.getUserIndex=function(){return jc(this.a)},cE.prototype.setUserIndex=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Wc(t,e)},cE.prototype.getUserPointer=function(){return aT(zc(this.a),mE)},cE.prototype.setUserPointer=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Hc(t,e)},cE.prototype.getBroadphaseHandle=function(){return aT(Xc(this.a),pR)},cE.prototype.__destroy__=function(){Yc(this.a)},hE.prototype=Object.create(sT.prototype),hE.prototype.constructor=hE,hE.prototype.b=hE,hE.c={},t.btIndexedMeshArray=hE,hE.prototype.size=hE.prototype.size=function(){return Qc(this.a)},hE.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(qc(t,e),eR)},hE.prototype.__destroy__=function(){Kc(this.a)},_E.prototype=Object.create(sT.prototype),_E.prototype.constructor=_E,_E.prototype.b=_E,_E.c={},t.btDbvtBroadphase=_E,_E.prototype.__destroy__=function(){$c(this.a)},dE.prototype=Object.create(ST.prototype),dE.prototype.constructor=dE,dE.prototype.b=dE,dE.c={},t.btHeightfieldTerrainShape=dE,dE.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),eh(t,e)},dE.prototype.getMargin=function(){return th(this.a)},dE.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ih(t,e)},dE.prototype.getLocalScaling=function(){return aT(nh(this.a),DT)},dE.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),rh(i,e,t)},dE.prototype.__destroy__=function(){sh(this.a)},uE.prototype=Object.create(WT.prototype),uE.prototype.constructor=uE,uE.prototype.b=uE,uE.c={},t.btDefaultSoftBodySolver=uE,uE.prototype.__destroy__=function(){ah(this.a)},pE.prototype=Object.create(LT.prototype),pE.prototype.constructor=pE,pE.prototype.b=pE,pE.c={},t.btCollisionDispatcher=pE,pE.prototype.getNumManifolds=function(){return ch(this.a)},pE.prototype.getManifoldByIndexInternal=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(hh(t,e),eE)},pE.prototype.__destroy__=function(){_h(this.a)},fE.prototype=Object.create(sT.prototype),fE.prototype.constructor=fE,fE.prototype.b=fE,fE.c={},t.btAxisSweep3=fE,fE.prototype.__destroy__=function(){mh(this.a)},mE.prototype=Object.create(sT.prototype),mE.prototype.constructor=mE,mE.prototype.b=mE,mE.c={},t.VoidPtr=mE,mE.prototype.__destroy__=function(){gh(this.a)},gE.prototype=Object.create(sT.prototype),gE.prototype.constructor=gE,gE.prototype.b=gE,gE.c={},t.btSoftBodyWorldInfo=gE,gE.prototype.get_air_density=gE.prototype.ma=function(){return yh(this.a)},gE.prototype.set_air_density=gE.prototype.Xc=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),vh(t,e)},Object.defineProperty(gE.prototype,"air_density",{get:gE.prototype.ma,set:gE.prototype.Xc}),gE.prototype.get_water_density=gE.prototype.Sc=function(){return Ah(this.a)},gE.prototype.set_water_density=gE.prototype.Ef=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ch(t,e)},Object.defineProperty(gE.prototype,"water_density",{get:gE.prototype.Sc,set:gE.prototype.Ef}),gE.prototype.get_water_offset=gE.prototype.Uc=function(){return Sh(this.a)},gE.prototype.set_water_offset=gE.prototype.Gf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),xh(t,e)},Object.defineProperty(gE.prototype,"water_offset",{get:gE.prototype.Uc,set:gE.prototype.Gf}),gE.prototype.get_m_maxDisplacement=gE.prototype.Tb=function(){return Th(this.a)},gE.prototype.set_m_maxDisplacement=gE.prototype.Ee=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Eh(t,e)},Object.defineProperty(gE.prototype,"m_maxDisplacement",{get:gE.prototype.Tb,set:gE.prototype.Ee}),gE.prototype.get_water_normal=gE.prototype.Tc=function(){return aT(Rh(this.a),DT)},gE.prototype.set_water_normal=gE.prototype.Ff=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ph(t,e)},Object.defineProperty(gE.prototype,"water_normal",{get:gE.prototype.Tc,set:gE.prototype.Ff}),gE.prototype.get_m_broadphase=gE.prototype.Ua=function(){return aT(Ih(this.a),ZT)},gE.prototype.set_m_broadphase=gE.prototype.Gd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Mh(t,e)},Object.defineProperty(gE.prototype,"m_broadphase",{get:gE.prototype.Ua,set:gE.prototype.Gd}),gE.prototype.get_m_dispatcher=gE.prototype.lb=function(){return aT(Dh(this.a),LT)},gE.prototype.set_m_dispatcher=gE.prototype.Xd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Oh(t,e)},Object.defineProperty(gE.prototype,"m_dispatcher",{get:gE.prototype.lb,set:gE.prototype.Xd}),gE.prototype.get_m_gravity=gE.prototype.ub=function(){return aT(wh(this.a),DT)},gE.prototype.set_m_gravity=gE.prototype.fe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fh(t,e)},Object.defineProperty(gE.prototype,"m_gravity",{get:gE.prototype.ub,set:gE.prototype.fe}),gE.prototype.__destroy__=function(){Bh(this.a)},bE.prototype=Object.create(CT.prototype),bE.prototype.constructor=bE,bE.prototype.b=bE,bE.c={},t.btConeTwistConstraint=bE,bE.prototype.setLimit=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),kh(i,e,t)},bE.prototype.setAngularOnly=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Vh(t,e)},bE.prototype.setDamping=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Uh(t,e)},bE.prototype.enableMotor=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Gh(t,e)},bE.prototype.setMaxMotorImpulse=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),jh(t,e)},bE.prototype.setMaxMotorImpulseNormalized=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Wh(t,e)},bE.prototype.setMotorTarget=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),zh(t,e)},bE.prototype.setMotorTargetInConstraintSpace=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Hh(t,e)},bE.prototype.enableFeedback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Xh(t,e)},bE.prototype.getBreakingImpulseThreshold=function(){return Yh(this.a)},bE.prototype.setBreakingImpulseThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Qh(t,e)},bE.prototype.getParam=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),qh(i,e,t)},bE.prototype.setParam=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),Kh(n,e,t,i)},bE.prototype.__destroy__=function(){Zh(this.a)},yE.prototype=Object.create(CT.prototype),yE.prototype.constructor=yE,yE.prototype.b=yE,yE.c={},t.btHingeConstraint=yE,yE.prototype.setLimit=function(e,t,i,n,r){var s=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),void 0===r?r_(s,e,t,i,n):s_(s,e,t,i,n,r)},yE.prototype.enableAngularMotor=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),o_(n,e,t,i)},yE.prototype.setAngularOnly=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),a_(t,e)},yE.prototype.enableMotor=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),l_(t,e)},yE.prototype.setMaxMotorImpulse=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),c_(t,e)},yE.prototype.setMotorTarget=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),h_(i,e,t)},yE.prototype.enableFeedback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),__(t,e)},yE.prototype.getBreakingImpulseThreshold=function(){return d_(this.a)},yE.prototype.setBreakingImpulseThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),u_(t,e)},yE.prototype.getParam=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),p_(i,e,t)},yE.prototype.setParam=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),f_(n,e,t,i)},yE.prototype.__destroy__=function(){m_(this.a)},vE.prototype=Object.create(IT.prototype),vE.prototype.constructor=vE,vE.prototype.b=vE,vE.c={},t.btConeShapeZ=vE,vE.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),b_(t,e)},vE.prototype.getLocalScaling=function(){return aT(y_(this.a),DT)},vE.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),v_(i,e,t)},vE.prototype.__destroy__=function(){A_(this.a)},AE.prototype=Object.create(IT.prototype),AE.prototype.constructor=AE,AE.prototype.b=AE,AE.c={},t.btConeShapeX=AE,AE.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),S_(t,e)},AE.prototype.getLocalScaling=function(){return aT(x_(this.a),DT)},AE.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),T_(i,e,t)},AE.prototype.__destroy__=function(){E_(this.a)},CE.prototype=Object.create(VT.prototype),CE.prototype.constructor=CE,CE.prototype.b=CE,CE.c={},t.btTriangleMesh=CE,CE.prototype.addTriangle=function(e,t,i,n){var r=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),void 0===n?M_(r,e,t,i):D_(r,e,t,i,n)},CE.prototype.findOrAddVertex=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),O_(i,e,t)},CE.prototype.addIndex=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),w_(t,e)},CE.prototype.getIndexedMeshArray=function(){return aT(F_(this.a),hE)},CE.prototype.setScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),B_(t,e)},CE.prototype.__destroy__=function(){N_(this.a)},SE.prototype=Object.create(yT.prototype),SE.prototype.constructor=SE,SE.prototype.b=SE,SE.c={},t.btConvexHullShape=SE,SE.prototype.addPoint=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),void 0===t?U_(i,e):G_(i,e,t)},SE.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),j_(t,e)},SE.prototype.getMargin=function(){return W_(this.a)},SE.prototype.getNumVertices=function(){return z_(this.a)},SE.prototype.initializePolyhedralFeatures=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),!!H_(t,e)},SE.prototype.recalcLocalAabb=function(){X_(this.a)},SE.prototype.getConvexPolyhedron=function(){return aT(Y_(this.a),kE)},SE.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Q_(t,e)},SE.prototype.getLocalScaling=function(){return aT(q_(this.a),DT)},SE.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),K_(i,e,t)},SE.prototype.__destroy__=function(){Z_(this.a)},xE.prototype=Object.create(sT.prototype),xE.prototype.constructor=xE,xE.prototype.b=xE,xE.c={},t.btVehicleTuning=xE,xE.prototype.get_m_suspensionStiffness=xE.prototype.F=function(){return J_(this.a)},xE.prototype.set_m_suspensionStiffness=xE.prototype.M=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ed(t,e)},Object.defineProperty(xE.prototype,"m_suspensionStiffness",{get:xE.prototype.F,set:xE.prototype.M}),xE.prototype.get_m_suspensionCompression=xE.prototype.rc=function(){return td(this.a)},xE.prototype.set_m_suspensionCompression=xE.prototype.bf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),id(t,e)},Object.defineProperty(xE.prototype,"m_suspensionCompression",{get:xE.prototype.rc,set:xE.prototype.bf}),xE.prototype.get_m_suspensionDamping=xE.prototype.sc=function(){return nd(this.a)},xE.prototype.set_m_suspensionDamping=xE.prototype.cf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),rd(t,e)},Object.defineProperty(xE.prototype,"m_suspensionDamping",{get:xE.prototype.sc,set:xE.prototype.cf}),xE.prototype.get_m_maxSuspensionTravelCm=xE.prototype.D=function(){return sd(this.a)},xE.prototype.set_m_maxSuspensionTravelCm=xE.prototype.L=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),od(t,e)},Object.defineProperty(xE.prototype,"m_maxSuspensionTravelCm",{get:xE.prototype.D,set:xE.prototype.L}),xE.prototype.get_m_frictionSlip=xE.prototype.v=function(){return ad(this.a)},xE.prototype.set_m_frictionSlip=xE.prototype.H=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ld(t,e)},Object.defineProperty(xE.prototype,"m_frictionSlip",{get:xE.prototype.v,set:xE.prototype.H}),xE.prototype.get_m_maxSuspensionForce=xE.prototype.C=function(){return cd(this.a)},xE.prototype.set_m_maxSuspensionForce=xE.prototype.K=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),hd(t,e)},Object.defineProperty(xE.prototype,"m_maxSuspensionForce",{get:xE.prototype.C,set:xE.prototype.K}),TE.prototype=Object.create(sT.prototype),TE.prototype.constructor=TE,TE.prototype.b=TE,TE.c={},t.btCollisionObjectWrapper=TE,TE.prototype.getWorldTransform=function(){return aT(_d(this.a),nR)},TE.prototype.getCollisionObject=function(){return aT(dd(this.a),vT)},TE.prototype.getCollisionShape=function(){return aT(ud(this.a),yT)},EE.prototype=Object.create(sT.prototype),EE.prototype.constructor=EE,EE.prototype.b=EE,EE.c={},t.btShapeHull=EE,EE.prototype.buildHull=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),!!fd(t,e)},EE.prototype.numVertices=function(){return md(this.a)},EE.prototype.getVertexPointer=function(){return aT(gd(this.a),DT)},EE.prototype.__destroy__=function(){bd(this.a)},RE.prototype=Object.create(UT.prototype),RE.prototype.constructor=RE,RE.prototype.b=RE,RE.c={},t.btDefaultMotionState=RE,RE.prototype.getWorldTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Cd(t,e)},RE.prototype.setWorldTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Sd(t,e)},RE.prototype.get_m_graphicsWorldTrans=RE.prototype.tb=function(){return aT(xd(this.a),nR)},RE.prototype.set_m_graphicsWorldTrans=RE.prototype.ee=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Td(t,e)},Object.defineProperty(RE.prototype,"m_graphicsWorldTrans",{get:RE.prototype.tb,set:RE.prototype.ee}),RE.prototype.__destroy__=function(){Ed(this.a)},PE.prototype=Object.create(sT.prototype),PE.prototype.constructor=PE,PE.prototype.b=PE,PE.c={},t.btWheelInfo=PE,PE.prototype.getSuspensionRestLength=function(){return Pd(this.a)},PE.prototype.updateWheel=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Id(i,e,t)},PE.prototype.get_m_suspensionStiffness=PE.prototype.F=function(){return Md(this.a)},PE.prototype.set_m_suspensionStiffness=PE.prototype.M=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Dd(t,e)},Object.defineProperty(PE.prototype,"m_suspensionStiffness",{get:PE.prototype.F,set:PE.prototype.M}),PE.prototype.get_m_frictionSlip=PE.prototype.v=function(){return Od(this.a)},PE.prototype.set_m_frictionSlip=PE.prototype.H=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wd(t,e)},Object.defineProperty(PE.prototype,"m_frictionSlip",{get:PE.prototype.v,set:PE.prototype.H}),PE.prototype.get_m_engineForce=PE.prototype.pb=function(){return Fd(this.a)},PE.prototype.set_m_engineForce=PE.prototype.ae=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Bd(t,e)},Object.defineProperty(PE.prototype,"m_engineForce",{get:PE.prototype.pb,set:PE.prototype.ae}),PE.prototype.get_m_rollInfluence=PE.prototype.hc=function(){return Nd(this.a)},PE.prototype.set_m_rollInfluence=PE.prototype.Se=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ld(t,e)},Object.defineProperty(PE.prototype,"m_rollInfluence",{get:PE.prototype.hc,set:PE.prototype.Se}),PE.prototype.get_m_suspensionRestLength1=PE.prototype.wc=function(){return kd(this.a)},PE.prototype.set_m_suspensionRestLength1=PE.prototype.gf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Vd(t,e)},Object.defineProperty(PE.prototype,"m_suspensionRestLength1",{get:PE.prototype.wc,set:PE.prototype.gf}),PE.prototype.get_m_wheelsRadius=PE.prototype.Kc=function(){return Ud(this.a)},PE.prototype.set_m_wheelsRadius=PE.prototype.wf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Gd(t,e)},Object.defineProperty(PE.prototype,"m_wheelsRadius",{get:PE.prototype.Kc,set:PE.prototype.wf}),PE.prototype.get_m_wheelsDampingCompression=PE.prototype.W=function(){return jd(this.a)},PE.prototype.set_m_wheelsDampingCompression=PE.prototype.ga=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Wd(t,e)},Object.defineProperty(PE.prototype,"m_wheelsDampingCompression",{get:PE.prototype.W,set:PE.prototype.ga}),PE.prototype.get_m_wheelsDampingRelaxation=PE.prototype.X=function(){return zd(this.a)},PE.prototype.set_m_wheelsDampingRelaxation=PE.prototype.ha=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Hd(t,e)},Object.defineProperty(PE.prototype,"m_wheelsDampingRelaxation",{get:PE.prototype.X,set:PE.prototype.ha}),PE.prototype.get_m_steering=PE.prototype.pc=function(){return Xd(this.a)},PE.prototype.set_m_steering=PE.prototype.$e=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Yd(t,e)},Object.defineProperty(PE.prototype,"m_steering",{get:PE.prototype.pc,set:PE.prototype.$e}),PE.prototype.get_m_maxSuspensionForce=PE.prototype.C=function(){return Qd(this.a)},PE.prototype.set_m_maxSuspensionForce=PE.prototype.K=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),qd(t,e)},Object.defineProperty(PE.prototype,"m_maxSuspensionForce",{get:PE.prototype.C,set:PE.prototype.K}),PE.prototype.get_m_maxSuspensionTravelCm=PE.prototype.D=function(){return Kd(this.a)},PE.prototype.set_m_maxSuspensionTravelCm=PE.prototype.L=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Zd(t,e)},Object.defineProperty(PE.prototype,"m_maxSuspensionTravelCm",{get:PE.prototype.D,set:PE.prototype.L}),PE.prototype.get_m_wheelsSuspensionForce=PE.prototype.Lc=function(){return $d(this.a)},PE.prototype.set_m_wheelsSuspensionForce=PE.prototype.xf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Jd(t,e)},Object.defineProperty(PE.prototype,"m_wheelsSuspensionForce",{get:PE.prototype.Lc,set:PE.prototype.xf}),PE.prototype.get_m_bIsFrontWheel=PE.prototype.O=function(){return!!eu(this.a)},PE.prototype.set_m_bIsFrontWheel=PE.prototype.Z=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),tu(t,e)},Object.defineProperty(PE.prototype,"m_bIsFrontWheel",{get:PE.prototype.O,set:PE.prototype.Z}),PE.prototype.get_m_raycastInfo=PE.prototype.ec=function(){return aT(iu(this.a),GE)},PE.prototype.set_m_raycastInfo=PE.prototype.Qe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),nu(t,e)},Object.defineProperty(PE.prototype,"m_raycastInfo",{get:PE.prototype.ec,set:PE.prototype.Qe}),PE.prototype.get_m_chassisConnectionPointCS=PE.prototype.$a=function(){return aT(ru(this.a),DT)},PE.prototype.set_m_chassisConnectionPointCS=PE.prototype.Md=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),su(t,e)},Object.defineProperty(PE.prototype,"m_chassisConnectionPointCS",{get:PE.prototype.$a,set:PE.prototype.Md}),PE.prototype.get_m_worldTransform=PE.prototype.Mc=function(){return aT(ou(this.a),nR)},PE.prototype.set_m_worldTransform=PE.prototype.yf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),au(t,e)},Object.defineProperty(PE.prototype,"m_worldTransform",{get:PE.prototype.Mc,set:PE.prototype.yf}),PE.prototype.get_m_wheelDirectionCS=PE.prototype.V=function(){return aT(lu(this.a),DT)},PE.prototype.set_m_wheelDirectionCS=PE.prototype.fa=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),cu(t,e)},Object.defineProperty(PE.prototype,"m_wheelDirectionCS",{get:PE.prototype.V,set:PE.prototype.fa}),PE.prototype.get_m_wheelAxleCS=PE.prototype.U=function(){return aT(hu(this.a),DT)},PE.prototype.set_m_wheelAxleCS=PE.prototype.ea=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),_u(t,e)},Object.defineProperty(PE.prototype,"m_wheelAxleCS",{get:PE.prototype.U,set:PE.prototype.ea}),PE.prototype.get_m_rotation=PE.prototype.jc=function(){return du(this.a)},PE.prototype.set_m_rotation=PE.prototype.Ue=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),uu(t,e)},Object.defineProperty(PE.prototype,"m_rotation",{get:PE.prototype.jc,set:PE.prototype.Ue}),PE.prototype.get_m_deltaRotation=PE.prototype.jb=function(){return pu(this.a)},PE.prototype.set_m_deltaRotation=PE.prototype.Vd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),fu(t,e)},Object.defineProperty(PE.prototype,"m_deltaRotation",{get:PE.prototype.jb,set:PE.prototype.Vd}),PE.prototype.get_m_brake=PE.prototype.Ta=function(){return mu(this.a)},PE.prototype.set_m_brake=PE.prototype.Fd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),gu(t,e)},Object.defineProperty(PE.prototype,"m_brake",{get:PE.prototype.Ta,set:PE.prototype.Fd}),PE.prototype.get_m_clippedInvContactDotSuspension=PE.prototype.ab=function(){return bu(this.a)},PE.prototype.set_m_clippedInvContactDotSuspension=PE.prototype.Nd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),yu(t,e)},Object.defineProperty(PE.prototype,"m_clippedInvContactDotSuspension",{get:PE.prototype.ab,set:PE.prototype.Nd}),PE.prototype.get_m_suspensionRelativeVelocity=PE.prototype.uc=function(){return vu(this.a)},PE.prototype.set_m_suspensionRelativeVelocity=PE.prototype.ef=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Au(t,e)},Object.defineProperty(PE.prototype,"m_suspensionRelativeVelocity",{get:PE.prototype.uc,set:PE.prototype.ef}),PE.prototype.get_m_skidInfo=PE.prototype.mc=function(){return Cu(this.a)},PE.prototype.set_m_skidInfo=PE.prototype.Xe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Su(t,e)},Object.defineProperty(PE.prototype,"m_skidInfo",{get:PE.prototype.mc,set:PE.prototype.Xe}),PE.prototype.__destroy__=function(){xu(this.a)},IE.prototype=Object.create(DT.prototype),IE.prototype.constructor=IE,IE.prototype.b=IE,IE.c={},t.btVector4=IE,IE.prototype.w=function(){return Ru(this.a)},IE.prototype.setValue=function(e,t,i,n){var r=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),Pu(r,e,t,i,n)},IE.prototype.length=IE.prototype.length=function(){return Iu(this.a)},IE.prototype.x=IE.prototype.x=function(){return Mu(this.a)},IE.prototype.y=IE.prototype.y=function(){return Du(this.a)},IE.prototype.z=IE.prototype.z=function(){return Ou(this.a)},IE.prototype.setX=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wu(t,e)},IE.prototype.setY=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fu(t,e)},IE.prototype.setZ=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Bu(t,e)},IE.prototype.normalize=IE.prototype.normalize=function(){Nu(this.a)},IE.prototype.rotate=IE.prototype.rotate=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),aT(Lu(i,e,t),DT)},IE.prototype.dot=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),ku(t,e)},IE.prototype.op_mul=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(Vu(t,e),DT)},IE.prototype.op_add=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(Uu(t,e),DT)},IE.prototype.op_sub=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(Gu(t,e),DT)},IE.prototype.__destroy__=function(){ju(this.a)},ME.prototype=Object.create(sT.prototype),ME.prototype.constructor=ME,ME.prototype.b=ME,ME.c={},t.btDefaultCollisionConstructionInfo=ME,ME.prototype.__destroy__=function(){zu(this.a)},DE.prototype=Object.create(sT.prototype),DE.prototype.constructor=DE,DE.prototype.b=DE,DE.c={},t.Anchor=DE,DE.prototype.get_m_node=DE.prototype.Ub=function(){return aT(Hu(this.a),XE)},DE.prototype.set_m_node=DE.prototype.Fe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Xu(t,e)},Object.defineProperty(DE.prototype,"m_node",{get:DE.prototype.Ub,set:DE.prototype.Fe}),DE.prototype.get_m_local=DE.prototype.Ob=function(){return aT(Yu(this.a),DT)},DE.prototype.set_m_local=DE.prototype.ze=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Qu(t,e)},Object.defineProperty(DE.prototype,"m_local",{get:DE.prototype.Ob,set:DE.prototype.ze}),DE.prototype.get_m_body=DE.prototype.Sa=function(){return aT(qu(this.a),cE)},DE.prototype.set_m_body=DE.prototype.Ed=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ku(t,e)},Object.defineProperty(DE.prototype,"m_body",{get:DE.prototype.Sa,set:DE.prototype.Ed}),DE.prototype.get_m_influence=DE.prototype.Hb=function(){return Zu(this.a)},DE.prototype.set_m_influence=DE.prototype.se=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$u(t,e)},Object.defineProperty(DE.prototype,"m_influence",{get:DE.prototype.Hb,set:DE.prototype.se}),DE.prototype.get_m_c0=DE.prototype.Va=function(){return aT(Ju(this.a),HT)},DE.prototype.set_m_c0=DE.prototype.Hd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ep(t,e)},Object.defineProperty(DE.prototype,"m_c0",{get:DE.prototype.Va,set:DE.prototype.Hd}),DE.prototype.get_m_c1=DE.prototype.Wa=function(){return aT(tp(this.a),DT)},DE.prototype.set_m_c1=DE.prototype.Id=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ip(t,e)},Object.defineProperty(DE.prototype,"m_c1",{get:DE.prototype.Wa,set:DE.prototype.Id}),DE.prototype.get_m_c2=DE.prototype.Xa=function(){return np(this.a)},DE.prototype.set_m_c2=DE.prototype.Jd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),rp(t,e)},Object.defineProperty(DE.prototype,"m_c2",{get:DE.prototype.Xa,set:DE.prototype.Jd}),DE.prototype.__destroy__=function(){sp(this.a)},OE.prototype=Object.create(sT.prototype),OE.prototype.constructor=OE,OE.prototype.b=OE,OE.c={},t.btVehicleRaycasterResult=OE,OE.prototype.get_m_hitPointInWorld=OE.prototype.Cb=function(){return aT(op(this.a),DT)},OE.prototype.set_m_hitPointInWorld=OE.prototype.ne=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ap(t,e)},Object.defineProperty(OE.prototype,"m_hitPointInWorld",{get:OE.prototype.Cb,set:OE.prototype.ne}),OE.prototype.get_m_hitNormalInWorld=OE.prototype.Ab=function(){return aT(lp(this.a),DT)},OE.prototype.set_m_hitNormalInWorld=OE.prototype.le=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),cp(t,e)},Object.defineProperty(OE.prototype,"m_hitNormalInWorld",{get:OE.prototype.Ab,set:OE.prototype.le}),OE.prototype.get_m_distFraction=OE.prototype.mb=function(){return hp(this.a)},OE.prototype.set_m_distFraction=OE.prototype.Yd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),_p(t,e)},Object.defineProperty(OE.prototype,"m_distFraction",{get:OE.prototype.mb,set:OE.prototype.Yd}),OE.prototype.__destroy__=function(){dp(this.a)},wE.prototype=Object.create(sT.prototype),wE.prototype.constructor=wE,wE.prototype.b=wE,wE.c={},t.btVector3Array=wE,wE.prototype.size=wE.prototype.size=function(){return up(this.a)},wE.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(pp(t,e),DT)},wE.prototype.__destroy__=function(){fp(this.a)},FE.prototype=Object.create(sT.prototype),FE.prototype.constructor=FE,FE.prototype.b=FE,FE.c={},t.btConstraintSolver=FE,FE.prototype.__destroy__=function(){mp(this.a)},BE.prototype=Object.create(MT.prototype),BE.prototype.constructor=BE,BE.prototype.b=BE,BE.c={},t.btRaycastVehicle=BE,BE.prototype.applyEngineForce=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),bp(i,e,t)},BE.prototype.setSteeringValue=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),yp(i,e,t)},BE.prototype.getWheelTransformWS=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(vp(t,e),nR)},BE.prototype.updateWheelTransform=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Ap(i,e,t)},BE.prototype.addWheel=function(e,t,i,n,r,s,o){var a=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),s&&"object"==typeof s&&(s=s.a),o&&"object"==typeof o&&(o=o.a),aT(Cp(a,e,t,i,n,r,s,o),PE)},BE.prototype.getNumWheels=function(){return Sp(this.a)},BE.prototype.getRigidBody=function(){return aT(xp(this.a),cE)},BE.prototype.getWheelInfo=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(Tp(t,e),PE)},BE.prototype.setBrake=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Ep(i,e,t)},BE.prototype.setCoordinateSystem=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),Rp(n,e,t,i)},BE.prototype.getCurrentSpeedKmHour=function(){return Pp(this.a)},BE.prototype.getChassisWorldTransform=function(){return aT(Ip(this.a),nR)},BE.prototype.rayCast=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),Mp(t,e)},BE.prototype.updateVehicle=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Dp(t,e)},BE.prototype.resetSuspension=function(){Op(this.a)},BE.prototype.getSteeringValue=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),wp(t,e)},BE.prototype.updateWheelTransformsWS=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),void 0===t?Fp(i,e):Bp(i,e,t)},BE.prototype.setPitchControl=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Np(t,e)},BE.prototype.updateSuspension=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Lp(t,e)},BE.prototype.updateFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),kp(t,e)},BE.prototype.getRightAxis=function(){return Vp(this.a)},BE.prototype.getUpAxis=function(){return Up(this.a)},BE.prototype.getForwardAxis=function(){return Gp(this.a)},BE.prototype.getForwardVector=function(){return aT(jp(this.a),DT)},BE.prototype.getUserConstraintType=function(){return Wp(this.a)},BE.prototype.setUserConstraintType=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),zp(t,e)},BE.prototype.setUserConstraintId=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Hp(t,e)},BE.prototype.getUserConstraintId=function(){return Xp(this.a)},BE.prototype.updateAction=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Yp(i,e,t)},BE.prototype.__destroy__=function(){Qp(this.a)},NE.prototype=Object.create(FT.prototype),NE.prototype.constructor=NE,NE.prototype.b=NE,NE.c={},t.btCylinderShapeX=NE,NE.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Kp(t,e)},NE.prototype.getMargin=function(){return Zp(this.a)},NE.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$p(t,e)},NE.prototype.getLocalScaling=function(){return aT(Jp(this.a),DT)},NE.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),ef(i,e,t)},NE.prototype.__destroy__=function(){tf(this.a)},LE.prototype=Object.create(FT.prototype),LE.prototype.constructor=LE,LE.prototype.b=LE,LE.c={},t.btCylinderShapeZ=LE,LE.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),rf(t,e)},LE.prototype.getMargin=function(){return sf(this.a)},LE.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),of(t,e)},LE.prototype.getLocalScaling=function(){return aT(af(this.a),DT)},LE.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),lf(i,e,t)},LE.prototype.__destroy__=function(){cf(this.a)},kE.prototype=Object.create(sT.prototype),kE.prototype.constructor=kE,kE.prototype.b=kE,kE.c={},t.btConvexPolyhedron=kE,kE.prototype.get_m_vertices=kE.prototype.Gc=function(){return aT(hf(this.a),wE)},kE.prototype.set_m_vertices=kE.prototype.sf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),_f(t,e)},Object.defineProperty(kE.prototype,"m_vertices",{get:kE.prototype.Gc,set:kE.prototype.sf}),kE.prototype.get_m_faces=kE.prototype.P=function(){return aT(df(this.a),ZE)},kE.prototype.set_m_faces=kE.prototype.$=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),uf(t,e)},Object.defineProperty(kE.prototype,"m_faces",{get:kE.prototype.P,set:kE.prototype.$}),kE.prototype.__destroy__=function(){pf(this.a)},VE.prototype=Object.create(sT.prototype),VE.prototype.constructor=VE,VE.prototype.b=VE,VE.c={},t.btSequentialImpulseConstraintSolver=VE,VE.prototype.__destroy__=function(){mf(this.a)},UE.prototype=Object.create(sT.prototype),UE.prototype.constructor=UE,UE.prototype.b=UE,UE.c={},t.tAnchorArray=UE,UE.prototype.size=UE.prototype.size=function(){return gf(this.a)},UE.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(bf(t,e),DE)},UE.prototype.clear=UE.prototype.clear=function(){yf(this.a)},UE.prototype.push_back=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),vf(t,e)},UE.prototype.pop_back=function(){Af(this.a)},UE.prototype.__destroy__=function(){Cf(this.a)},GE.prototype=Object.create(sT.prototype),GE.prototype.constructor=GE,GE.prototype.b=GE,GE.c={},t.RaycastInfo=GE,GE.prototype.get_m_contactNormalWS=GE.prototype.cb=function(){return aT(Sf(this.a),DT)},GE.prototype.set_m_contactNormalWS=GE.prototype.Pd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),xf(t,e)},Object.defineProperty(GE.prototype,"m_contactNormalWS",{get:GE.prototype.cb,set:GE.prototype.Pd}),GE.prototype.get_m_contactPointWS=GE.prototype.eb=function(){return aT(Tf(this.a),DT)},GE.prototype.set_m_contactPointWS=GE.prototype.Qd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ef(t,e)},Object.defineProperty(GE.prototype,"m_contactPointWS",{get:GE.prototype.eb,set:GE.prototype.Qd}),GE.prototype.get_m_suspensionLength=GE.prototype.tc=function(){return Rf(this.a)},GE.prototype.set_m_suspensionLength=GE.prototype.df=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Pf(t,e)},Object.defineProperty(GE.prototype,"m_suspensionLength",{get:GE.prototype.tc,set:GE.prototype.df}),GE.prototype.get_m_hardPointWS=GE.prototype.wb=function(){return aT(If(this.a),DT)},GE.prototype.set_m_hardPointWS=GE.prototype.he=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Mf(t,e)},Object.defineProperty(GE.prototype,"m_hardPointWS",{get:GE.prototype.wb,set:GE.prototype.he}),GE.prototype.get_m_wheelDirectionWS=GE.prototype.Ic=function(){return aT(Df(this.a),DT)},GE.prototype.set_m_wheelDirectionWS=GE.prototype.uf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Of(t,e)},Object.defineProperty(GE.prototype,"m_wheelDirectionWS",{get:GE.prototype.Ic,set:GE.prototype.uf}),GE.prototype.get_m_wheelAxleWS=GE.prototype.Hc=function(){return aT(wf(this.a),DT)},GE.prototype.set_m_wheelAxleWS=GE.prototype.tf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ff(t,e)},Object.defineProperty(GE.prototype,"m_wheelAxleWS",{get:GE.prototype.Hc,set:GE.prototype.tf}),GE.prototype.get_m_isInContact=GE.prototype.Ib=function(){return!!Bf(this.a)},GE.prototype.set_m_isInContact=GE.prototype.te=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Nf(t,e)},Object.defineProperty(GE.prototype,"m_isInContact",{get:GE.prototype.Ib,set:GE.prototype.te}),GE.prototype.get_m_groundObject=GE.prototype.vb=function(){return Lf(this.a)},GE.prototype.set_m_groundObject=GE.prototype.ge=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),kf(t,e)},Object.defineProperty(GE.prototype,"m_groundObject",{get:GE.prototype.vb,set:GE.prototype.ge}),GE.prototype.__destroy__=function(){Vf(this.a)},jE.prototype=Object.create(yT.prototype),jE.prototype.constructor=jE,jE.prototype.b=jE,jE.c={},t.btMultiSphereShape=jE,jE.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Gf(t,e)},jE.prototype.getLocalScaling=function(){return aT(jf(this.a),DT)},jE.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Wf(i,e,t)},jE.prototype.__destroy__=function(){zf(this.a)},WE.prototype=Object.create(vT.prototype),WE.prototype.constructor=WE,WE.prototype.b=WE,WE.c={},t.btSoftBody=WE,WE.prototype.checkLink=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),!!Xf(i,e,t)},WE.prototype.checkFace=function(e,t,i){var n=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),!!Yf(n,e,t,i)},WE.prototype.appendMaterial=function(){return aT(Qf(this.a),YT)},WE.prototype.appendNode=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),qf(i,e,t)},WE.prototype.appendLink=function(e,t,i,n){var r=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),Kf(r,e,t,i,n)},WE.prototype.appendFace=function(e,t,i,n){var r=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),Zf(r,e,t,i,n)},WE.prototype.appendTetra=function(e,t,i,n,r){var s=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),$f(s,e,t,i,n,r)},WE.prototype.appendAnchor=function(e,t,i,n){var r=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),Jf(r,e,t,i,n)},WE.prototype.addForce=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),void 0===t?em(i,e):tm(i,e,t)},WE.prototype.addAeroForceToNode=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),im(i,e,t)},WE.prototype.getTotalMass=function(){return nm(this.a)},WE.prototype.setTotalMass=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),rm(i,e,t)},WE.prototype.setMass=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),sm(i,e,t)},WE.prototype.transform=WE.prototype.transform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),om(t,e)},WE.prototype.translate=WE.prototype.translate=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),am(t,e)},WE.prototype.rotate=WE.prototype.rotate=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),lm(t,e)},WE.prototype.scale=WE.prototype.scale=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),cm(t,e)},WE.prototype.generateClusters=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),void 0===t?hm(i,e):_m(i,e,t)},WE.prototype.generateBendingConstraints=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),dm(i,e,t)},WE.prototype.upcast=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(um(t,e),WE)},WE.prototype.setAnisotropicFriction=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),pm(i,e,t)},WE.prototype.getCollisionShape=function(){return aT(fm(this.a),yT)},WE.prototype.setContactProcessingThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),mm(t,e)},WE.prototype.setActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),gm(t,e)},WE.prototype.forceActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),bm(t,e)},WE.prototype.activate=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),void 0===e?ym(t):vm(t,e)},WE.prototype.isActive=function(){return!!Am(this.a)},WE.prototype.isKinematicObject=function(){return!!Cm(this.a)},WE.prototype.isStaticObject=function(){return!!Sm(this.a)},WE.prototype.isStaticOrKinematicObject=function(){return!!xm(this.a)},WE.prototype.getRestitution=function(){return Tm(this.a)},WE.prototype.getFriction=function(){return Em(this.a)},WE.prototype.getRollingFriction=function(){return Rm(this.a)},WE.prototype.setRestitution=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Pm(t,e)},WE.prototype.setFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Im(t,e)},WE.prototype.setRollingFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Mm(t,e)},WE.prototype.getWorldTransform=function(){return aT(Dm(this.a),nR)},WE.prototype.getCollisionFlags=function(){return Om(this.a)},WE.prototype.setCollisionFlags=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wm(t,e)},WE.prototype.setWorldTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fm(t,e)},WE.prototype.setCollisionShape=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Bm(t,e)},WE.prototype.setCcdMotionThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Nm(t,e)},WE.prototype.setCcdSweptSphereRadius=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Lm(t,e)},WE.prototype.getUserIndex=function(){return km(this.a)},WE.prototype.setUserIndex=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Vm(t,e)},WE.prototype.getUserPointer=function(){return aT(Um(this.a),mE)},WE.prototype.setUserPointer=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Gm(t,e)},WE.prototype.getBroadphaseHandle=function(){return aT(jm(this.a),pR)},WE.prototype.get_m_cfg=WE.prototype.Ya=function(){return aT(Wm(this.a),HE)},WE.prototype.set_m_cfg=WE.prototype.Kd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),zm(t,e)},Object.defineProperty(WE.prototype,"m_cfg",{get:WE.prototype.Ya,set:WE.prototype.Kd}),WE.prototype.get_m_nodes=WE.prototype.Vb=function(){return aT(Hm(this.a),fR)},WE.prototype.set_m_nodes=WE.prototype.Ge=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Xm(t,e)},Object.defineProperty(WE.prototype,"m_nodes",{get:WE.prototype.Vb,set:WE.prototype.Ge}),WE.prototype.get_m_faces=WE.prototype.P=function(){return aT(Ym(this.a),ER)},WE.prototype.set_m_faces=WE.prototype.$=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Qm(t,e)},Object.defineProperty(WE.prototype,"m_faces",{get:WE.prototype.P,set:WE.prototype.$}),WE.prototype.get_m_materials=WE.prototype.Sb=function(){return aT(qm(this.a),rE)},WE.prototype.set_m_materials=WE.prototype.De=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Km(t,e)},Object.defineProperty(WE.prototype,"m_materials",{get:WE.prototype.Sb,set:WE.prototype.De}),WE.prototype.get_m_anchors=WE.prototype.Oa=function(){return aT(Zm(this.a),UE)},WE.prototype.set_m_anchors=WE.prototype.Ad=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$m(t,e)},Object.defineProperty(WE.prototype,"m_anchors",{get:WE.prototype.Oa,set:WE.prototype.Ad}),WE.prototype.__destroy__=function(){Jm(this.a)},zE.prototype=Object.create(sT.prototype),zE.prototype.constructor=zE,zE.prototype.b=zE,zE.c={},t.btIntArray=zE,zE.prototype.size=zE.prototype.size=function(){return eg(this.a)},zE.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),tg(t,e)},zE.prototype.__destroy__=function(){ig(this.a)},HE.prototype=Object.create(sT.prototype),HE.prototype.constructor=HE,HE.prototype.b=HE,HE.c={},t.Config=HE,HE.prototype.get_kVCF=HE.prototype.Ha=function(){return ng(this.a)},HE.prototype.set_kVCF=HE.prototype.td=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),rg(t,e)},Object.defineProperty(HE.prototype,"kVCF",{get:HE.prototype.Ha,set:HE.prototype.td}),HE.prototype.get_kDP=HE.prototype.ua=function(){return sg(this.a)},HE.prototype.set_kDP=HE.prototype.ed=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),og(t,e)},Object.defineProperty(HE.prototype,"kDP",{get:HE.prototype.ua,set:HE.prototype.ed}),HE.prototype.get_kDG=HE.prototype.ta=function(){return ag(this.a)},HE.prototype.set_kDG=HE.prototype.dd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),lg(t,e)},Object.defineProperty(HE.prototype,"kDG",{get:HE.prototype.ta,set:HE.prototype.dd}),HE.prototype.get_kLF=HE.prototype.wa=function(){return cg(this.a)},HE.prototype.set_kLF=HE.prototype.hd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),hg(t,e)},Object.defineProperty(HE.prototype,"kLF",{get:HE.prototype.wa,set:HE.prototype.hd}),HE.prototype.get_kPR=HE.prototype.ya=function(){return _g(this.a)},HE.prototype.set_kPR=HE.prototype.kd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),dg(t,e)},Object.defineProperty(HE.prototype,"kPR",{get:HE.prototype.ya,set:HE.prototype.kd}),HE.prototype.get_kVC=HE.prototype.Ga=function(){return ug(this.a)},HE.prototype.set_kVC=HE.prototype.sd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),pg(t,e)},Object.defineProperty(HE.prototype,"kVC",{get:HE.prototype.Ga,set:HE.prototype.sd}),HE.prototype.get_kDF=HE.prototype.sa=function(){return fg(this.a)},HE.prototype.set_kDF=HE.prototype.cd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),mg(t,e)},Object.defineProperty(HE.prototype,"kDF",{get:HE.prototype.sa,set:HE.prototype.cd}),HE.prototype.get_kMT=HE.prototype.xa=function(){return gg(this.a)},HE.prototype.set_kMT=HE.prototype.jd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),bg(t,e)},Object.defineProperty(HE.prototype,"kMT",{get:HE.prototype.xa,set:HE.prototype.jd}),HE.prototype.get_kCHR=HE.prototype.ra=function(){return yg(this.a)},HE.prototype.set_kCHR=HE.prototype.bd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),vg(t,e)},Object.defineProperty(HE.prototype,"kCHR",{get:HE.prototype.ra,set:HE.prototype.bd}),HE.prototype.get_kKHR=HE.prototype.va=function(){return Ag(this.a)},HE.prototype.set_kKHR=HE.prototype.gd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Cg(t,e)},Object.defineProperty(HE.prototype,"kKHR",{get:HE.prototype.va,set:HE.prototype.gd}),HE.prototype.get_kSHR=HE.prototype.za=function(){return Sg(this.a)},HE.prototype.set_kSHR=HE.prototype.ld=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),xg(t,e)},Object.defineProperty(HE.prototype,"kSHR",{get:HE.prototype.za,set:HE.prototype.ld}),HE.prototype.get_kAHR=HE.prototype.qa=function(){return Tg(this.a)},HE.prototype.set_kAHR=HE.prototype.ad=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Eg(t,e)},Object.defineProperty(HE.prototype,"kAHR",{get:HE.prototype.qa,set:HE.prototype.ad}),HE.prototype.get_kSRHR_CL=HE.prototype.Ca=function(){return Rg(this.a)},HE.prototype.set_kSRHR_CL=HE.prototype.od=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Pg(t,e)},Object.defineProperty(HE.prototype,"kSRHR_CL",{get:HE.prototype.Ca,set:HE.prototype.od}),HE.prototype.get_kSKHR_CL=HE.prototype.Aa=function(){return Ig(this.a)},HE.prototype.set_kSKHR_CL=HE.prototype.md=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Mg(t,e)},Object.defineProperty(HE.prototype,"kSKHR_CL",{get:HE.prototype.Aa,set:HE.prototype.md}),HE.prototype.get_kSSHR_CL=HE.prototype.Ea=function(){return Dg(this.a)},HE.prototype.set_kSSHR_CL=HE.prototype.qd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Og(t,e)},Object.defineProperty(HE.prototype,"kSSHR_CL",{get:HE.prototype.Ea,set:HE.prototype.qd}),HE.prototype.get_kSR_SPLT_CL=HE.prototype.Da=function(){return wg(this.a)},HE.prototype.set_kSR_SPLT_CL=HE.prototype.pd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Fg(t,e)},Object.defineProperty(HE.prototype,"kSR_SPLT_CL",{get:HE.prototype.Da,set:HE.prototype.pd}),HE.prototype.get_kSK_SPLT_CL=HE.prototype.Ba=function(){return Bg(this.a)},HE.prototype.set_kSK_SPLT_CL=HE.prototype.nd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ng(t,e)},Object.defineProperty(HE.prototype,"kSK_SPLT_CL",{get:HE.prototype.Ba,set:HE.prototype.nd}),HE.prototype.get_kSS_SPLT_CL=HE.prototype.Fa=function(){return Lg(this.a)},HE.prototype.set_kSS_SPLT_CL=HE.prototype.rd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),kg(t,e)},Object.defineProperty(HE.prototype,"kSS_SPLT_CL",{get:HE.prototype.Fa,set:HE.prototype.rd}),HE.prototype.get_maxvolume=HE.prototype.Oc=function(){return Vg(this.a)},HE.prototype.set_maxvolume=HE.prototype.Af=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ug(t,e)},Object.defineProperty(HE.prototype,"maxvolume",{get:HE.prototype.Oc,set:HE.prototype.Af}),HE.prototype.get_timescale=HE.prototype.Qc=function(){return Gg(this.a)},HE.prototype.set_timescale=HE.prototype.Cf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),jg(t,e)},Object.defineProperty(HE.prototype,"timescale",{get:HE.prototype.Qc,set:HE.prototype.Cf}),HE.prototype.get_viterations=HE.prototype.Rc=function(){return Wg(this.a)},HE.prototype.set_viterations=HE.prototype.Df=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),zg(t,e)},Object.defineProperty(HE.prototype,"viterations",{get:HE.prototype.Rc,set:HE.prototype.Df}),HE.prototype.get_piterations=HE.prototype.Pc=function(){return Hg(this.a)},HE.prototype.set_piterations=HE.prototype.Bf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Xg(t,e)},Object.defineProperty(HE.prototype,"piterations",{get:HE.prototype.Pc,set:HE.prototype.Bf}),HE.prototype.get_diterations=HE.prototype.pa=function(){return Yg(this.a)},HE.prototype.set_diterations=HE.prototype.$c=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Qg(t,e)},Object.defineProperty(HE.prototype,"diterations",{get:HE.prototype.pa,set:HE.prototype.$c}),HE.prototype.get_citerations=HE.prototype.na=function(){return qg(this.a)},HE.prototype.set_citerations=HE.prototype.Yc=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Kg(t,e)},Object.defineProperty(HE.prototype,"citerations",{get:HE.prototype.na,set:HE.prototype.Yc}),HE.prototype.get_collisions=HE.prototype.oa=function(){return Zg(this.a)},HE.prototype.set_collisions=HE.prototype.Zc=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$g(t,e)},Object.defineProperty(HE.prototype,"collisions",{get:HE.prototype.oa,set:HE.prototype.Zc}),HE.prototype.__destroy__=function(){Jg(this.a)},XE.prototype=Object.create(sT.prototype),XE.prototype.constructor=XE,XE.prototype.b=XE,XE.c={},t.Node=XE,XE.prototype.get_m_x=XE.prototype.Nc=function(){return aT(eb(this.a),DT)},XE.prototype.set_m_x=XE.prototype.zf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),tb(t,e)},Object.defineProperty(XE.prototype,"m_x",{get:XE.prototype.Nc,set:XE.prototype.zf}),XE.prototype.get_m_q=XE.prototype.cc=function(){return aT(ib(this.a),DT)},XE.prototype.set_m_q=XE.prototype.Oe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),nb(t,e)},Object.defineProperty(XE.prototype,"m_q",{get:XE.prototype.cc,set:XE.prototype.Oe}),XE.prototype.get_m_v=XE.prototype.Fc=function(){return aT(rb(this.a),DT)},XE.prototype.set_m_v=XE.prototype.rf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),sb(t,e)},Object.defineProperty(XE.prototype,"m_v",{get:XE.prototype.Fc,set:XE.prototype.rf}),XE.prototype.get_m_f=XE.prototype.qb=function(){return aT(ob(this.a),DT)},XE.prototype.set_m_f=XE.prototype.be=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ab(t,e)},Object.defineProperty(XE.prototype,"m_f",{get:XE.prototype.qb,set:XE.prototype.be}),XE.prototype.get_m_n=XE.prototype.R=function(){return aT(lb(this.a),DT)},XE.prototype.set_m_n=XE.prototype.aa=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),cb(t,e)},Object.defineProperty(XE.prototype,"m_n",{get:XE.prototype.R,set:XE.prototype.aa}),XE.prototype.get_m_im=XE.prototype.Eb=function(){return hb(this.a)},XE.prototype.set_m_im=XE.prototype.pe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),_b(t,e)},Object.defineProperty(XE.prototype,"m_im",{get:XE.prototype.Eb,set:XE.prototype.pe}),XE.prototype.get_m_area=XE.prototype.Ra=function(){return db(this.a)},XE.prototype.set_m_area=XE.prototype.Dd=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ub(t,e)},Object.defineProperty(XE.prototype,"m_area",{get:XE.prototype.Ra,set:XE.prototype.Dd}),XE.prototype.__destroy__=function(){pb(this.a)},YE.prototype=Object.create(sT.prototype),YE.prototype.constructor=YE,YE.prototype.b=YE,YE.c={},t.btGhostPairCallback=YE,YE.prototype.__destroy__=function(){mb(this.a)},QE.prototype=Object.create(sT.prototype),QE.prototype.constructor=QE,QE.prototype.b=QE,QE.c={},t.btOverlappingPairCallback=QE,QE.prototype.__destroy__=function(){gb(this.a)},qE.prototype=Object.create(MT.prototype),qE.prototype.constructor=qE,qE.prototype.b=qE,qE.c={},t.btKinematicCharacterController=qE,qE.prototype.setUpAxis=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),vb(t,e)},qE.prototype.setWalkDirection=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ab(t,e)},qE.prototype.setVelocityForTimeInterval=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Cb(i,e,t)},qE.prototype.warp=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Sb(t,e)},qE.prototype.preStep=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),xb(t,e)},qE.prototype.playerStep=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Tb(i,e,t)},qE.prototype.setFallSpeed=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Eb(t,e)},qE.prototype.setJumpSpeed=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Rb(t,e)},qE.prototype.setMaxJumpHeight=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Pb(t,e)},qE.prototype.canJump=function(){return!!Ib(this.a)},qE.prototype.jump=function(){Mb(this.a)},qE.prototype.setGravity=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Db(t,e)},qE.prototype.getGravity=function(){return Ob(this.a)},qE.prototype.setMaxSlope=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wb(t,e)},qE.prototype.getMaxSlope=function(){return Fb(this.a)},qE.prototype.getGhostObject=function(){return aT(Bb(this.a),hR)},qE.prototype.setUseGhostSweepTest=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Nb(t,e)},qE.prototype.onGround=function(){return!!Lb(this.a)},qE.prototype.setUpInterpolate=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),kb(t,e)},qE.prototype.updateAction=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Vb(i,e,t)},qE.prototype.__destroy__=function(){Ub(this.a)},KE.prototype=Object.create(sT.prototype),KE.prototype.constructor=KE,KE.prototype.b=KE,KE.c={},t.btSoftBodyArray=KE,KE.prototype.size=KE.prototype.size=function(){return Gb(this.a)},KE.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(jb(t,e),WE)},KE.prototype.__destroy__=function(){Wb(this.a)},ZE.prototype=Object.create(sT.prototype),ZE.prototype.constructor=ZE,ZE.prototype.b=ZE,ZE.c={},t.btFaceArray=ZE,ZE.prototype.size=ZE.prototype.size=function(){return zb(this.a)},ZE.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(Hb(t,e),gR)},ZE.prototype.__destroy__=function(){Xb(this.a)},$E.prototype=Object.create(ST.prototype),$E.prototype.constructor=$E,$E.prototype.b=$E,$E.c={},t.btStaticPlaneShape=$E,$E.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Qb(t,e)},$E.prototype.getLocalScaling=function(){return aT(qb(this.a),DT)},$E.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Kb(i,e,t)},$E.prototype.__destroy__=function(){Zb(this.a)},JE.prototype=Object.create(sT.prototype),JE.prototype.constructor=JE,JE.prototype.b=JE,JE.c={},t.btOverlappingPairCache=JE,JE.prototype.setInternalGhostPairCallback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$b(t,e)},JE.prototype.getNumOverlappingPairs=function(){return Jb(this.a)},JE.prototype.__destroy__=function(){ey(this.a)},eR.prototype=Object.create(sT.prototype),eR.prototype.constructor=eR,eR.prototype.b=eR,eR.c={},t.btIndexedMesh=eR,eR.prototype.get_m_numTriangles=eR.prototype.Zb=function(){return ty(this.a)},eR.prototype.set_m_numTriangles=eR.prototype.Ke=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),iy(t,e)},Object.defineProperty(eR.prototype,"m_numTriangles",{get:eR.prototype.Zb,set:eR.prototype.Ke}),eR.prototype.__destroy__=function(){ny(this.a)},tR.prototype=Object.create(BT.prototype),tR.prototype.constructor=tR,tR.prototype.b=tR,tR.c={},t.btSoftRigidDynamicsWorld=tR,tR.prototype.addSoftBody=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),sy(n,e,t,i)},tR.prototype.removeSoftBody=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),oy(t,e)},tR.prototype.removeCollisionObject=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ay(t,e)},tR.prototype.getWorldInfo=function(){return aT(ly(this.a),gE)},tR.prototype.getSoftBodyArray=function(){return aT(cy(this.a),KE)},tR.prototype.getDispatcher=function(){return aT(hy(this.a),LT)},tR.prototype.rayTest=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),_y(n,e,t,i)},tR.prototype.getPairCache=function(){return aT(dy(this.a),JE)},tR.prototype.getDispatchInfo=function(){return aT(uy(this.a),QT)},tR.prototype.addCollisionObject=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?py(n,e):void 0===i?fy(n,e,t):my(n,e,t,i)},tR.prototype.getBroadphase=function(){return aT(gy(this.a),ZT)},tR.prototype.convexSweepTest=function(e,t,i,n,r){var s=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),by(s,e,t,i,n,r)},tR.prototype.contactPairTest=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),yy(n,e,t,i)},tR.prototype.contactTest=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),vy(i,e,t)},tR.prototype.updateSingleAabb=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ay(t,e)},tR.prototype.setDebugDrawer=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Cy(t,e)},tR.prototype.getDebugDrawer=function(){return aT(Sy(this.a),TT)},tR.prototype.debugDrawWorld=function(){xy(this.a)},tR.prototype.debugDrawObject=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),Ty(n,e,t,i)},tR.prototype.setGravity=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ey(t,e)},tR.prototype.getGravity=function(){return aT(Ry(this.a),DT)},tR.prototype.addRigidBody=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?Py(n,e):void 0===i?_emscripten_bind_btSoftRigidDynamicsWorld_addRigidBody_2(n,e,t):Iy(n,e,t,i)},tR.prototype.removeRigidBody=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),My(t,e)},tR.prototype.addConstraint=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),void 0===t?Dy(i,e):Oy(i,e,t)},tR.prototype.removeConstraint=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wy(t,e)},tR.prototype.stepSimulation=function(e,t,i){var n=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?Fy(n,e):void 0===i?By(n,e,t):Ny(n,e,t,i)},tR.prototype.setContactAddedCallback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ly(t,e)},tR.prototype.setContactProcessedCallback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ky(t,e)},tR.prototype.setContactDestroyedCallback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Vy(t,e)},tR.prototype.addAction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Uy(t,e)},tR.prototype.removeAction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Gy(t,e)},tR.prototype.getSolverInfo=function(){return aT(jy(this.a),CR)},tR.prototype.setInternalTickCallback=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),void 0===t?Wy(n,e):void 0===i?zy(n,e,t):Hy(n,e,t,i)},tR.prototype.__destroy__=function(){Xy(this.a)},iR.prototype=Object.create(CT.prototype),iR.prototype.constructor=iR,iR.prototype.b=iR,iR.c={},t.btFixedConstraint=iR,iR.prototype.enableFeedback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Qy(t,e)},iR.prototype.getBreakingImpulseThreshold=function(){return qy(this.a)},iR.prototype.setBreakingImpulseThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ky(t,e)},iR.prototype.getParam=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Zy(i,e,t)},iR.prototype.setParam=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),$y(n,e,t,i)},iR.prototype.__destroy__=function(){Jy(this.a)},nR.prototype=Object.create(sT.prototype),nR.prototype.constructor=nR,nR.prototype.b=nR,nR.c={},t.btTransform=nR,nR.prototype.setIdentity=function(){iv(this.a)},nR.prototype.setOrigin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),nv(t,e)},nR.prototype.setRotation=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),rv(t,e)},nR.prototype.getOrigin=function(){return aT(sv(this.a),DT)},nR.prototype.getRotation=function(){return aT(ov(this.a),vR)},nR.prototype.getBasis=function(){return aT(av(this.a),HT)},nR.prototype.setFromOpenGLMatrix=function(e){var t=this.a;uT(),"object"==typeof e&&(e=gT(e)),lv(t,e)},nR.prototype.inverse=nR.prototype.inverse=function(){return aT(cv(this.a),nR)},nR.prototype.op_mul=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(hv(t,e),nR)},nR.prototype.__destroy__=function(){_v(this.a)},rR.prototype=Object.create(zT.prototype),rR.prototype.constructor=rR,rR.prototype.b=rR,rR.c={},t.ClosestRayResultCallback=rR,rR.prototype.hasHit=function(){return!!uv(this.a)},rR.prototype.get_m_rayFromWorld=rR.prototype.S=function(){return aT(pv(this.a),DT)},rR.prototype.set_m_rayFromWorld=rR.prototype.ba=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),fv(t,e)},Object.defineProperty(rR.prototype,"m_rayFromWorld",{get:rR.prototype.S,set:rR.prototype.ba}),rR.prototype.get_m_rayToWorld=rR.prototype.T=function(){return aT(mv(this.a),DT)},rR.prototype.set_m_rayToWorld=rR.prototype.da=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),gv(t,e)},Object.defineProperty(rR.prototype,"m_rayToWorld",{get:rR.prototype.T,set:rR.prototype.da}),rR.prototype.get_m_hitNormalWorld=rR.prototype.A=function(){return aT(bv(this.a),DT)},rR.prototype.set_m_hitNormalWorld=rR.prototype.I=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),yv(t,e)},Object.defineProperty(rR.prototype,"m_hitNormalWorld",{get:rR.prototype.A,set:rR.prototype.I}),rR.prototype.get_m_hitPointWorld=rR.prototype.B=function(){return aT(vv(this.a),DT)},rR.prototype.set_m_hitPointWorld=rR.prototype.J=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Av(t,e)},Object.defineProperty(rR.prototype,"m_hitPointWorld",{get:rR.prototype.B,set:rR.prototype.J}),rR.prototype.get_m_collisionFilterGroup=rR.prototype.f=function(){return Cv(this.a)},rR.prototype.set_m_collisionFilterGroup=rR.prototype.h=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Sv(t,e)},Object.defineProperty(rR.prototype,"m_collisionFilterGroup",{get:rR.prototype.f,set:rR.prototype.h}),rR.prototype.get_m_collisionFilterMask=rR.prototype.g=function(){return xv(this.a)},rR.prototype.set_m_collisionFilterMask=rR.prototype.i=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Tv(t,e)},Object.defineProperty(rR.prototype,"m_collisionFilterMask",{get:rR.prototype.g,set:rR.prototype.i}),rR.prototype.get_m_closestHitFraction=rR.prototype.j=function(){return Ev(this.a)},rR.prototype.set_m_closestHitFraction=rR.prototype.l=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Rv(t,e)},Object.defineProperty(rR.prototype,"m_closestHitFraction",{get:rR.prototype.j,set:rR.prototype.l}),rR.prototype.get_m_collisionObject=rR.prototype.u=function(){return aT(Pv(this.a),vT)},rR.prototype.set_m_collisionObject=rR.prototype.G=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Iv(t,e)},Object.defineProperty(rR.prototype,"m_collisionObject",{get:rR.prototype.u,set:rR.prototype.G}),rR.prototype.__destroy__=function(){Mv(this.a)},sR.prototype=Object.create(ET.prototype),sR.prototype.constructor=sR,sR.prototype.b=sR,sR.c={},t.btSoftBodyRigidBodyCollisionConfiguration=sR,sR.prototype.__destroy__=function(){wv(this.a)},oR.prototype=Object.create(jT.prototype),oR.prototype.constructor=oR,oR.prototype.b=oR,oR.c={},t.ConcreteContactResultCallback=oR,oR.prototype.addSingleResult=function(e,t,i,n,r,s,o){var a=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),s&&"object"==typeof s&&(s=s.a),o&&"object"==typeof o&&(o=o.a),Bv(a,e,t,i,n,r,s,o)},oR.prototype.__destroy__=function(){Nv(this.a)},aR.prototype=Object.create(RT.prototype),aR.prototype.constructor=aR,aR.prototype.b=aR,aR.c={},t.btBvhTriangleMeshShape=aR,aR.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Vv(t,e)},aR.prototype.getLocalScaling=function(){return aT(Uv(this.a),DT)},aR.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Gv(i,e,t)},aR.prototype.__destroy__=function(){jv(this.a)},lR.prototype=Object.create(sT.prototype),lR.prototype.constructor=lR,lR.prototype.b=lR,lR.c={},t.btConstCollisionObjectArray=lR,lR.prototype.size=lR.prototype.size=function(){return Wv(this.a)},lR.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(zv(t,e),vT)},lR.prototype.__destroy__=function(){Hv(this.a)},cR.prototype=Object.create(CT.prototype),cR.prototype.constructor=cR,cR.prototype.b=cR,cR.c={},t.btSliderConstraint=cR,cR.prototype.setLowerLinLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Qv(t,e)},cR.prototype.setUpperLinLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),qv(t,e)},cR.prototype.setLowerAngLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Kv(t,e)},cR.prototype.setUpperAngLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Zv(t,e)},cR.prototype.enableFeedback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$v(t,e)},cR.prototype.getBreakingImpulseThreshold=function(){return Jv(this.a)},cR.prototype.setBreakingImpulseThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),eA(t,e)},cR.prototype.getParam=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),tA(i,e,t)},cR.prototype.setParam=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),iA(n,e,t,i)},cR.prototype.__destroy__=function(){nA(this.a)},hR.prototype=Object.create(PT.prototype),hR.prototype.constructor=hR,hR.prototype.b=hR,hR.c={},t.btPairCachingGhostObject=hR,hR.prototype.setAnisotropicFriction=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),sA(i,e,t)},hR.prototype.getCollisionShape=function(){return aT(oA(this.a),yT)},hR.prototype.setContactProcessingThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),aA(t,e)},hR.prototype.setActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),lA(t,e)},hR.prototype.forceActivationState=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),cA(t,e)},hR.prototype.activate=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),void 0===e?hA(t):_A(t,e)},hR.prototype.isActive=function(){return!!dA(this.a)},hR.prototype.isKinematicObject=function(){return!!uA(this.a)},hR.prototype.isStaticObject=function(){return!!pA(this.a)},hR.prototype.isStaticOrKinematicObject=function(){return!!fA(this.a)},hR.prototype.getRestitution=function(){return mA(this.a)},hR.prototype.getFriction=function(){return gA(this.a)},hR.prototype.getRollingFriction=function(){return bA(this.a)},hR.prototype.setRestitution=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),yA(t,e)},hR.prototype.setFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),vA(t,e)},hR.prototype.setRollingFriction=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),AA(t,e)},hR.prototype.getWorldTransform=function(){return aT(CA(this.a),nR)},hR.prototype.getCollisionFlags=function(){return SA(this.a)},hR.prototype.setCollisionFlags=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),xA(t,e)},hR.prototype.setWorldTransform=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),TA(t,e)},hR.prototype.setCollisionShape=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),EA(t,e)},hR.prototype.setCcdMotionThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),RA(t,e)},hR.prototype.setCcdSweptSphereRadius=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),PA(t,e)},hR.prototype.getUserIndex=function(){return IA(this.a)},hR.prototype.setUserIndex=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),MA(t,e)},hR.prototype.getUserPointer=function(){return aT(DA(this.a),mE)},hR.prototype.setUserPointer=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),OA(t,e)},hR.prototype.getBroadphaseHandle=function(){return aT(wA(this.a),pR)},hR.prototype.getNumOverlappingObjects=function(){return FA(this.a)},hR.prototype.getOverlappingObject=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(BA(t,e),vT)},hR.prototype.__destroy__=function(){NA(this.a)},_R.prototype=Object.create(sT.prototype),_R.prototype.constructor=_R,_R.prototype.b=_R,_R.c={},t.btManifoldPoint=_R,_R.prototype.getPositionWorldOnA=function(){return aT(LA(this.a),DT)},_R.prototype.getPositionWorldOnB=function(){return aT(kA(this.a),DT)},_R.prototype.getAppliedImpulse=function(){return VA(this.a)},_R.prototype.getDistance=function(){return UA(this.a)},_R.prototype.get_m_localPointA=_R.prototype.Pb=function(){return aT(GA(this.a),DT)},_R.prototype.set_m_localPointA=_R.prototype.Ae=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),jA(t,e)},Object.defineProperty(_R.prototype,"m_localPointA",{get:_R.prototype.Pb,set:_R.prototype.Ae}),_R.prototype.get_m_localPointB=_R.prototype.Qb=function(){return aT(WA(this.a),DT)},_R.prototype.set_m_localPointB=_R.prototype.Be=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),zA(t,e)},Object.defineProperty(_R.prototype,"m_localPointB",{get:_R.prototype.Qb,set:_R.prototype.Be}),_R.prototype.get_m_positionWorldOnB=_R.prototype.bc=function(){return aT(HA(this.a),DT)},_R.prototype.set_m_positionWorldOnB=_R.prototype.Ne=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),XA(t,e)},Object.defineProperty(_R.prototype,"m_positionWorldOnB",{get:_R.prototype.bc,set:_R.prototype.Ne}),_R.prototype.get_m_positionWorldOnA=_R.prototype.ac=function(){return aT(YA(this.a),DT)},_R.prototype.set_m_positionWorldOnA=_R.prototype.Me=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),QA(t,e)},Object.defineProperty(_R.prototype,"m_positionWorldOnA",{get:_R.prototype.ac,set:_R.prototype.Me}),_R.prototype.get_m_normalWorldOnB=_R.prototype.Xb=function(){return aT(qA(this.a),DT)},_R.prototype.set_m_normalWorldOnB=_R.prototype.Ie=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),KA(t,e)},Object.defineProperty(_R.prototype,"m_normalWorldOnB",{get:_R.prototype.Xb,set:_R.prototype.Ie}),_R.prototype.get_m_userPersistentData=_R.prototype.Ec=function(){return ZA(this.a)},_R.prototype.set_m_userPersistentData=_R.prototype.qf=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),$A(t,e)},Object.defineProperty(_R.prototype,"m_userPersistentData",{get:_R.prototype.Ec,set:_R.prototype.qf}),_R.prototype.__destroy__=function(){JA(this.a)},dR.prototype=Object.create(CT.prototype),dR.prototype.constructor=dR,dR.prototype.b=dR,dR.c={},t.btPoint2PointConstraint=dR,dR.prototype.setPivotA=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),iC(t,e)},dR.prototype.setPivotB=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),nC(t,e)},dR.prototype.getPivotInA=function(){return aT(rC(this.a),DT)},dR.prototype.getPivotInB=function(){return aT(sC(this.a),DT)},dR.prototype.enableFeedback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),oC(t,e)},dR.prototype.getBreakingImpulseThreshold=function(){return aC(this.a)},dR.prototype.setBreakingImpulseThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),lC(t,e)},dR.prototype.getParam=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),cC(i,e,t)},dR.prototype.setParam=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),hC(n,e,t,i)},dR.prototype.get_m_setting=dR.prototype.kc=function(){return aT(_C(this.a),aE)},dR.prototype.set_m_setting=dR.prototype.Ve=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),dC(t,e)},Object.defineProperty(dR.prototype,"m_setting",{get:dR.prototype.kc,set:dR.prototype.Ve}),dR.prototype.__destroy__=function(){uC(this.a)},uR.prototype=Object.create(sT.prototype),uR.prototype.constructor=uR,uR.prototype.b=uR,uR.c={},t.btSoftBodyHelpers=uR,uR.prototype.CreateRope=function(e,t,i,n,r){var s=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),aT(fC(s,e,t,i,n,r),WE)},uR.prototype.CreatePatch=function(e,t,i,n,r,s,o,a,l){var c=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),s&&"object"==typeof s&&(s=s.a),o&&"object"==typeof o&&(o=o.a),a&&"object"==typeof a&&(a=a.a),l&&"object"==typeof l&&(l=l.a),aT(mC(c,e,t,i,n,r,s,o,a,l),WE)},uR.prototype.CreatePatchUV=function(e,t,i,n,r,s,o,a,l,c){var h=this.a;return uT(),e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),s&&"object"==typeof s&&(s=s.a),o&&"object"==typeof o&&(o=o.a),a&&"object"==typeof a&&(a=a.a),l&&"object"==typeof l&&(l=l.a),"object"==typeof c&&(c=gT(c)),aT(gC(h,e,t,i,n,r,s,o,a,l,c),WE)},uR.prototype.CreateEllipsoid=function(e,t,i,n){var r=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),aT(bC(r,e,t,i,n),WE)},uR.prototype.CreateFromTriMesh=function(e,t,i,n,r){var s=this.a;if(uT(),e&&"object"==typeof e&&(e=e.a),"object"==typeof t&&(t=gT(t)),"object"==typeof i&&"object"==typeof i){var o=pT(i,M);fT(i,M,o),i=o}return n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),aT(yC(s,e,t,i,n,r),WE)},uR.prototype.CreateFromConvexHull=function(e,t,i,n){var r=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),aT(vC(r,e,t,i,n),WE)},uR.prototype.__destroy__=function(){AC(this.a)},pR.prototype=Object.create(sT.prototype),pR.prototype.constructor=pR,pR.prototype.b=pR,pR.c={},t.btBroadphaseProxy=pR,pR.prototype.get_m_collisionFilterGroup=pR.prototype.f=function(){return CC(this.a)},pR.prototype.set_m_collisionFilterGroup=pR.prototype.h=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),SC(t,e)},Object.defineProperty(pR.prototype,"m_collisionFilterGroup",{get:pR.prototype.f,set:pR.prototype.h}),pR.prototype.get_m_collisionFilterMask=pR.prototype.g=function(){return xC(this.a)},pR.prototype.set_m_collisionFilterMask=pR.prototype.i=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),TC(t,e)},Object.defineProperty(pR.prototype,"m_collisionFilterMask",{get:pR.prototype.g,set:pR.prototype.i}),pR.prototype.__destroy__=function(){EC(this.a)},fR.prototype=Object.create(sT.prototype),fR.prototype.constructor=fR,fR.prototype.b=fR,fR.c={},t.tNodeArray=fR,fR.prototype.size=fR.prototype.size=function(){return RC(this.a)},fR.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(PC(t,e),XE)},fR.prototype.__destroy__=function(){IC(this.a)},mR.prototype=Object.create(yT.prototype),mR.prototype.constructor=mR,mR.prototype.b=mR,mR.c={},t.btBoxShape=mR,mR.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),DC(t,e)},mR.prototype.getMargin=function(){return OC(this.a)},mR.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wC(t,e)},mR.prototype.getLocalScaling=function(){return aT(FC(this.a),DT)},mR.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),BC(i,e,t)},mR.prototype.__destroy__=function(){NC(this.a)},gR.prototype=Object.create(sT.prototype),gR.prototype.constructor=gR,gR.prototype.b=gR,gR.c={},t.btFace=gR,gR.prototype.get_m_indices=gR.prototype.Gb=function(){return aT(LC(this.a),zE)},gR.prototype.set_m_indices=gR.prototype.re=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),kC(t,e)},Object.defineProperty(gR.prototype,"m_indices",{get:gR.prototype.Gb,set:gR.prototype.re}),gR.prototype.get_m_plane=gR.prototype.$b=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),VC(t,e)},gR.prototype.set_m_plane=gR.prototype.Le=function(e,t){var i=this.a;uT(),e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),UC(i,e,t)},Object.defineProperty(gR.prototype,"m_plane",{get:gR.prototype.$b,set:gR.prototype.Le}),gR.prototype.__destroy__=function(){GC(this.a)},bR.prototype=Object.create(TT.prototype),bR.prototype.constructor=bR,bR.prototype.b=bR,bR.c={},t.DebugDrawer=bR,bR.prototype.drawLine=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),WC(n,e,t,i)},bR.prototype.drawContactPoint=function(e,t,i,n,r){var s=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),r&&"object"==typeof r&&(r=r.a),zC(s,e,t,i,n,r)},bR.prototype.reportErrorWarning=function(e){var t=this.a;uT(),e=e&&"object"==typeof e?e.a:mT(e),HC(t,e)},bR.prototype.draw3dText=function(e,t){var i=this.a;uT(),e&&"object"==typeof e&&(e=e.a),t=t&&"object"==typeof t?t.a:mT(t),XC(i,e,t)},bR.prototype.setDebugMode=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),YC(t,e)},bR.prototype.getDebugMode=function(){return QC(this.a)},bR.prototype.__destroy__=function(){qC(this.a)},yR.prototype=Object.create(xT.prototype),yR.prototype.constructor=yR,yR.prototype.b=yR,yR.c={},t.btCapsuleShapeX=yR,yR.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ZC(t,e)},yR.prototype.getMargin=function(){return $C(this.a)},yR.prototype.getUpAxis=function(){return JC(this.a)},yR.prototype.getRadius=function(){return eS(this.a)},yR.prototype.getHalfHeight=function(){return tS(this.a)},yR.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),iS(t,e)},yR.prototype.getLocalScaling=function(){return aT(nS(this.a),DT)},yR.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),rS(i,e,t)},yR.prototype.__destroy__=function(){sS(this.a)},vR.prototype=Object.create(wT.prototype),vR.prototype.constructor=vR,vR.prototype.b=vR,vR.c={},t.btQuaternion=vR,vR.prototype.setValue=function(e,t,i,n){var r=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),n&&"object"==typeof n&&(n=n.a),aS(r,e,t,i,n)},vR.prototype.setEulerZYX=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),lS(n,e,t,i)},vR.prototype.setRotation=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),cS(i,e,t)},vR.prototype.normalize=vR.prototype.normalize=function(){hS(this.a)},vR.prototype.length2=function(){return _S(this.a)},vR.prototype.length=vR.prototype.length=function(){return dS(this.a)},vR.prototype.dot=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),uS(t,e)},vR.prototype.normalized=function(){return aT(pS(this.a),vR)},vR.prototype.getAxis=function(){return aT(fS(this.a),DT)},vR.prototype.inverse=vR.prototype.inverse=function(){return aT(mS(this.a),vR)},vR.prototype.getAngle=function(){return gS(this.a)},vR.prototype.getAngleShortestPath=function(){return bS(this.a)},vR.prototype.angle=vR.prototype.angle=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),yS(t,e)},vR.prototype.angleShortestPath=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),vS(t,e)},vR.prototype.op_add=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(AS(t,e),vR)},vR.prototype.op_sub=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(CS(t,e),vR)},vR.prototype.op_mul=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(SS(t,e),vR)},vR.prototype.op_mulq=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(xS(t,e),vR)},vR.prototype.op_div=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(TS(t,e),vR)},vR.prototype.x=vR.prototype.x=function(){return ES(this.a)},vR.prototype.y=vR.prototype.y=function(){return RS(this.a)},vR.prototype.z=vR.prototype.z=function(){return PS(this.a)},vR.prototype.w=function(){return IS(this.a)},vR.prototype.setX=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),MS(t,e)},vR.prototype.setY=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),DS(t,e)},vR.prototype.setZ=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),OS(t,e)},vR.prototype.setW=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),wS(t,e)},vR.prototype.__destroy__=function(){FS(this.a)},AR.prototype=Object.create(xT.prototype),AR.prototype.constructor=AR,AR.prototype.b=AR,AR.c={},t.btCapsuleShapeZ=AR,AR.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),NS(t,e)},AR.prototype.getMargin=function(){return LS(this.a)},AR.prototype.getUpAxis=function(){return kS(this.a)},AR.prototype.getRadius=function(){return VS(this.a)},AR.prototype.getHalfHeight=function(){return US(this.a)},AR.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),GS(t,e)},AR.prototype.getLocalScaling=function(){return aT(jS(this.a),DT)},AR.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),WS(i,e,t)},AR.prototype.__destroy__=function(){zS(this.a)},CR.prototype=Object.create(sT.prototype),CR.prototype.constructor=CR,CR.prototype.b=CR,CR.c={},t.btContactSolverInfo=CR,CR.prototype.get_m_splitImpulse=CR.prototype.nc=function(){return!!HS(this.a)},CR.prototype.set_m_splitImpulse=CR.prototype.Ye=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),XS(t,e)},Object.defineProperty(CR.prototype,"m_splitImpulse",{get:CR.prototype.nc,set:CR.prototype.Ye}),CR.prototype.get_m_splitImpulsePenetrationThreshold=CR.prototype.oc=function(){return YS(this.a)},CR.prototype.set_m_splitImpulsePenetrationThreshold=CR.prototype.Ze=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),QS(t,e)},Object.defineProperty(CR.prototype,"m_splitImpulsePenetrationThreshold",{get:CR.prototype.oc,set:CR.prototype.Ze}),CR.prototype.get_m_numIterations=CR.prototype.Yb=function(){return qS(this.a)},CR.prototype.set_m_numIterations=CR.prototype.Je=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),KS(t,e)},Object.defineProperty(CR.prototype,"m_numIterations",{get:CR.prototype.Yb,set:CR.prototype.Je}),CR.prototype.__destroy__=function(){ZS(this.a)},SR.prototype=Object.create(kT.prototype),SR.prototype.constructor=SR,SR.prototype.b=SR,SR.c={},t.btGeneric6DofSpringConstraint=SR,SR.prototype.enableSpring=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),ex(i,e,t)},SR.prototype.setStiffness=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),tx(i,e,t)},SR.prototype.setDamping=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),ix(i,e,t)},SR.prototype.setEquilibriumPoint=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),void 0===e?nx(i):void 0===t?rx(i,e):sx(i,e,t)},SR.prototype.setLinearLowerLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ox(t,e)},SR.prototype.setLinearUpperLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ax(t,e)},SR.prototype.setAngularLowerLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),lx(t,e)},SR.prototype.setAngularUpperLimit=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),cx(t,e)},SR.prototype.getFrameOffsetA=function(){return aT(hx(this.a),nR)},SR.prototype.enableFeedback=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),_x(t,e)},SR.prototype.getBreakingImpulseThreshold=function(){return dx(this.a)},SR.prototype.setBreakingImpulseThreshold=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),ux(t,e)},SR.prototype.getParam=function(e,t){var i=this.a;return e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),px(i,e,t)},SR.prototype.setParam=function(e,t,i){var n=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),i&&"object"==typeof i&&(i=i.a),fx(n,e,t,i)},SR.prototype.__destroy__=function(){mx(this.a)},xR.prototype=Object.create(yT.prototype),xR.prototype.constructor=xR,xR.prototype.b=xR,xR.c={},t.btSphereShape=xR,xR.prototype.setMargin=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),bx(t,e)},xR.prototype.getMargin=function(){return yx(this.a)},xR.prototype.setLocalScaling=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),vx(t,e)},xR.prototype.getLocalScaling=function(){return aT(Ax(this.a),DT)},xR.prototype.calculateLocalInertia=function(e,t){var i=this.a;e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Cx(i,e,t)},xR.prototype.__destroy__=function(){Sx(this.a)},TR.prototype=Object.create(sT.prototype),TR.prototype.constructor=TR,TR.prototype.b=TR,TR.c={},t.Face=TR,TR.prototype.get_m_n=TR.prototype.R=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(xx(t,e),XE)},TR.prototype.set_m_n=TR.prototype.aa=function(e,t){var i=this.a;uT(),e&&"object"==typeof e&&(e=e.a),t&&"object"==typeof t&&(t=t.a),Tx(i,e,t)},Object.defineProperty(TR.prototype,"m_n",{get:TR.prototype.R,set:TR.prototype.aa}),TR.prototype.get_m_normal=TR.prototype.Wb=function(){return aT(Ex(this.a),DT)},TR.prototype.set_m_normal=TR.prototype.He=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Rx(t,e)},Object.defineProperty(TR.prototype,"m_normal",{get:TR.prototype.Wb,set:TR.prototype.He}),TR.prototype.get_m_ra=TR.prototype.dc=function(){return Px(this.a)},TR.prototype.set_m_ra=TR.prototype.Pe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ix(t,e)},Object.defineProperty(TR.prototype,"m_ra",{get:TR.prototype.dc,set:TR.prototype.Pe}),TR.prototype.__destroy__=function(){Mx(this.a)},ER.prototype=Object.create(sT.prototype),ER.prototype.constructor=ER,ER.prototype.b=ER,ER.c={},t.tFaceArray=ER,ER.prototype.size=ER.prototype.size=function(){return Dx(this.a)},ER.prototype.at=function(e){var t=this.a;return e&&"object"==typeof e&&(e=e.a),aT(Ox(t,e),TR)},ER.prototype.__destroy__=function(){wx(this.a)},RR.prototype=Object.create(sT.prototype),RR.prototype.constructor=RR,RR.prototype.b=RR,RR.c={},t.LocalConvexResult=RR,RR.prototype.get_m_hitCollisionObject=RR.prototype.xb=function(){return aT(Bx(this.a),vT)},RR.prototype.set_m_hitCollisionObject=RR.prototype.ie=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Nx(t,e)},Object.defineProperty(RR.prototype,"m_hitCollisionObject",{get:RR.prototype.xb,set:RR.prototype.ie}),RR.prototype.get_m_localShapeInfo=RR.prototype.Rb=function(){return aT(Lx(this.a),lE)},RR.prototype.set_m_localShapeInfo=RR.prototype.Ce=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),kx(t,e)},Object.defineProperty(RR.prototype,"m_localShapeInfo",{get:RR.prototype.Rb,set:RR.prototype.Ce}),RR.prototype.get_m_hitNormalLocal=RR.prototype.Bb=function(){return aT(Vx(this.a),DT)},RR.prototype.set_m_hitNormalLocal=RR.prototype.me=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),Ux(t,e)},Object.defineProperty(RR.prototype,"m_hitNormalLocal",{get:RR.prototype.Bb,set:RR.prototype.me}),RR.prototype.get_m_hitPointLocal=RR.prototype.Db=function(){return aT(Gx(this.a),DT)},RR.prototype.set_m_hitPointLocal=RR.prototype.oe=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),jx(t,e)},Object.defineProperty(RR.prototype,"m_hitPointLocal",{get:RR.prototype.Db,set:RR.prototype.oe}),RR.prototype.get_m_hitFraction=RR.prototype.yb=function(){return Wx(this.a)},RR.prototype.set_m_hitFraction=RR.prototype.je=function(e){var t=this.a;e&&"object"==typeof e&&(e=e.a),zx(t,e)},Object.defineProperty(RR.prototype,"m_hitFraction",{get:RR.prototype.yb,set:RR.prototype.je}),RR.prototype.__destroy__=function(){Hx(this.a)},function(){function e(){t.BT_CONSTRAINT_ERP=Xx(),t.BT_CONSTRAINT_STOP_ERP=Yx(),t.BT_CONSTRAINT_CFM=Qx(),t.BT_CONSTRAINT_STOP_CFM=qx(),t.PHY_FLOAT=Kx(),t.PHY_DOUBLE=Zx(),t.PHY_INTEGER=$x(),t.PHY_SHORT=Jx(),t.PHY_FIXEDPOINT88=eT(),t.PHY_UCHAR=tT()}G?e():V.unshift(e)}(),this.Ammo=t,e.ready});e.exports=r},"../../../node_modules/css-loader/dist/runtime/api.js":function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(n)for(var a=0;a0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),i&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=i):h[2]=i),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},"../../../node_modules/css-loader/dist/runtime/noSourceMaps.js":function(e){"use strict";e.exports=function(e){return e[1]}},"../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":function(e){"use strict";var t=[];function i(e){for(var i=-1,n=0;n0?" ".concat(i.layer):""," {")),n+=i.css,r&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var s=i.sourceMap;s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,i)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},"../../../node_modules/style-loader/dist/runtime/styleTagTransform.js":function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}}]);